From: Dale Weiler Date: Fri, 18 Oct 2013 01:30:17 +0000 (-0400) Subject: Merge branch 'master' into threading X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9e18f0c7322902f1c22bea3aca2b4d5ced3ae2d;p=xonotic%2Fgmqcc.git Merge branch 'master' into threading Conflicts: gmqcc.h include.mk parser.c --- d9e18f0c7322902f1c22bea3aca2b4d5ced3ae2d diff --cc Makefile index f482de6,1215107..31d0d68 --- a/Makefile +++ b/Makefile @@@ -164,5 -158,6 +158,7 @@@ ir.o: gmqcc.h opts.def ir. ftepp.o: gmqcc.h opts.def lexer.h utf8.o: gmqcc.h opts.def correct.o: gmqcc.h opts.def +thread.o: gmqcc.h opts.def fold.o: ast.h ir.h gmqcc.h opts.def parser.h lexer.h + intrin.o: parser.h gmqcc.h opts.def lexer.h ast.h ir.h + exec.o: gmqcc.h opts.def diff --cc gmqcc.h index 6a54489,49b5a82..50abefe --- a/gmqcc.h +++ b/gmqcc.h @@@ -446,39 -399,48 +399,52 @@@ void util_htrm (hash_table_t void *util_htget (hash_table_t *ht, const char *key); void *util_htgeth(hash_table_t *ht, const char *key, size_t hash); - /*===================================================================*/ - /*=========================== thread.c ==============================*/ - /*===================================================================*/ - GMQCC_INLINE uint32_t util_atomic_xadd32(volatile uint32_t *x, uint32_t v); - - /*===================================================================*/ - /*============================ file.c ===============================*/ - /*===================================================================*/ - /* file handling */ - void fs_file_close (FILE *); - int fs_file_error (FILE *); - int fs_file_getc (FILE *); - int fs_file_printf (FILE *, const char *, ...); - int fs_file_puts (FILE *, const char *); - int fs_file_seek (FILE *, long int, int); - long int fs_file_tell (FILE *); - - size_t fs_file_read (void *, size_t, size_t, FILE *); - size_t fs_file_write (const void *, size_t, size_t, FILE *); - - FILE *fs_file_open (const char *, const char *); - int fs_file_getline(char **, size_t *, FILE *); - - /* directory handling */ + int util_snprintf(char *str, size_t, const char *fmt, ...); + + ++/* thread.c */ ++uint32_t util_atomic_xadd32(volatile uint32_t *x, uint32_t v); ++ ++ + /* fs.c */ + #define FS_FILE_SEEK_SET 0 + #define FS_FILE_SEEK_CUR 1 + #define FS_FILE_SEEK_END 2 + #define FS_FILE_EOF -1 + + typedef struct fs_dir_s fs_dir_t; + /*typedef struct fs_file_s fs_file_t;*/ + typedef struct dirent fs_dirent_t; + + void fs_file_close (fs_file_t *); + int fs_file_error (fs_file_t *); + int fs_file_getc (fs_file_t *); + int fs_file_printf (fs_file_t *, const char *, ...); + int fs_file_puts (fs_file_t *, const char *); + int fs_file_seek (fs_file_t *, long int, int); + long fs_file_tell (fs_file_t *); + int fs_file_flush (fs_file_t *); + + size_t fs_file_read (void *, size_t, size_t, fs_file_t *); + size_t fs_file_write (const void *, size_t, size_t, fs_file_t *); + + fs_file_t *fs_file_open (const char *, const char *); + int fs_file_getline(char **, size_t *, fs_file_t *); + int fs_dir_make (const char *); - DIR *fs_dir_open (const char *); - int fs_dir_close (DIR *); - struct dirent *fs_dir_read (DIR *); + fs_dir_t *fs_dir_open (const char *); + int fs_dir_close (fs_dir_t *); + fs_dirent_t *fs_dir_read (fs_dir_t *); + + /* correct.c */ + typedef struct correct_trie_s { + void *value; + struct correct_trie_s *entries; + } correct_trie_t; + + correct_trie_t* correct_trie_new(void); - /*===================================================================*/ - /*=========================== correct.c =============================*/ - /*===================================================================*/ typedef struct { char ***edits; size_t **lens; diff --cc include.mk index bbbeb97,2bc2a83..dae57d3 --- a/include.mk +++ b/include.mk @@@ -11,13 -11,16 +11,16 @@@ CC ?= clan # linker flags and optional additional libraries if required LDFLAGS += -LIBS += -lm +LIBS += -lm -lpthread + #common objects + COMMON = ansi.o util.o stat.o fs.o opts.o conout.o + #objects - OBJ_C = main.o lexer.o parser.o thread.o fs.o stat.o util.o code.o ast.o ir.o conout.o ftepp.o opts.o utf8.o correct.o fold.o intrin.o - OBJ_P = util.o fs.o conout.o opts.o pak.o stat.o - OBJ_T = test.o util.o opts.o conout.o fs.o stat.o - OBJ_X = exec-standalone.o util.o opts.o conout.o fs.o stat.o -OBJ_C = $(COMMON) main.o lexer.o parser.o code.o ast.o ir.o ftepp.o utf8.o correct.o fold.o intrin.o ++OBJ_C = $(COMMON) main.o lexer.o parser.o code.o ast.o ir.o ftepp.o utf8.o correct.o fold.o intrin.o thread.o + OBJ_P = $(COMMON) pak.o + OBJ_T = $(COMMON) test.o + OBJ_X = $(COMMON) exec.o #gource flags GOURCEFLAGS = \ diff --cc opts.def index ec1e759,57625dd..5827ca5 --- a/opts.def +++ b/opts.def @@@ -126,8 -130,8 +130,9 @@@ GMQCC_DEFINE_FLAG(MAX_ARRAY_SIZE) GMQCC_DEFINE_FLAG(ADD_INFO) GMQCC_DEFINE_FLAG(CORRECTION) + GMQCC_DEFINE_FLAG(J) GMQCC_DEFINE_FLAG(STATISTICS) + GMQCC_DEFINE_FLAG(PROGSRC) #endif /* some cleanup so we don't have to */ diff --cc parser.c index d46dc98,82ce53b..e6b7f61 --- a/parser.c +++ b/parser.c @@@ -23,7 -23,7 +23,8 @@@ */ #include #include +#include + #include "parser.h" #define PARSER_HT_LOCALS 2