Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed enum bitpacking in basic_function. #5

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ BUILD_FOLDER = build/basic

SOURCE_FOLDERS += ./arch/osx ./src

CC = gcc-10
CFLAGS = -g -Wall -Werror -std=c99 -lreadline -lm -DARCH_OSX=1 -DARCH_XMEGA=2 -DARCH=1
CC = gcc
CFLAGS = -g -Wall -Werror -std=c99 -DARCH_OSX=1 -DARCH_XMEGA=2 -DARCH=1
LDFLAGS = -lreadline -lm

VPATH = $(SOURCE_FOLDERS)

Expand Down
14 changes: 6 additions & 8 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ typedef union

typedef struct {
token token;
basic_function_type type : 3;
size_t nr_arguments : 3;
basic_function_type type : 4;
size_t nr_arguments : 4;
kind kind_1 : 1;
kind kind_2 : 1;
kind kind_3 : 1;
Expand Down Expand Up @@ -831,7 +831,7 @@ string_term(void)
size_t vector[5];
get_vector(vector,5);
string = C_STRDUP(variable_array_get_string(var_name, vector));
if (string == NULL) string = &_dummy;
if (string == NULL) string = (char*)&_dummy;

expect(T_RIGHT_BANANA);
}
Expand Down Expand Up @@ -908,7 +908,7 @@ do_print(basic_type* rv)
expression(&expr);
expression_print(&expr);
if (expr.type == expression_type_string){
if (expr.value.string != &_dummy)
if (expr.value.string != (char*)&_dummy)
free(expr.value.string);
}
}
Expand Down Expand Up @@ -2066,10 +2066,8 @@ int do_sleep(basic_type* delay, basic_type* rv)
nanosleep(&ts, NULL);

#endif
struct timespec ts;
ts.tv_sec = milliseconds / 1000;
ts.tv_nsec = (milliseconds % 1000) * 1000000;
nanosleep(&ts, NULL);
#else
Sleep(milliseconds);
#endif

rv->kind = kind_numeric;
Expand Down
2 changes: 1 addition & 1 deletion src/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ char *tokenizer_get_string(void)

void tokenizer_get_variable_name(char *name)
{
strncpy(name, tokenizer_actual_variable, sizeof(tokenizer_actual_variable));
strncpy(name, &tokenizer_actual_variable[0], sizeof(tokenizer_actual_variable));
}

void
Expand Down