diff --git a/NEWS b/NEWS index aeb5c8d52..b1d09ce94 100644 --- a/NEWS +++ b/NEWS @@ -17,7 +17,7 @@ Changes from 0.3.0 * Object-oriented runtime system, in the style of Objective-C. * Runtime fixups of built-in functions whose builtin number is zero. If a built-in function is available to the engine, with - the same name given in the source code (i.e. + the same name given in the source code (e.g. "void (void) coredump = #0;"), the engine will set the value to the actual number used by the engine. * Debugging support (needs compiler support, which qfcc diff --git a/tools/qfcc/include/def.h b/tools/qfcc/include/def.h index 8d70e4cf4..439dd249f 100644 --- a/tools/qfcc/include/def.h +++ b/tools/qfcc/include/def.h @@ -52,6 +52,7 @@ typedef struct def_s { unsigned global:1; // globally declared def unsigned external:1; // externally declared def unsigned local:1; // function local def + unsigned system:1; // system def string_t file; // source file int line; // source line @@ -98,6 +99,7 @@ typedef struct scope_s { typedef enum { st_none, st_global, + st_system, st_extern, st_static, st_local diff --git a/tools/qfcc/include/obj_file.h b/tools/qfcc/include/obj_file.h index 01a52c028..4aa8bfd81 100644 --- a/tools/qfcc/include/obj_file.h +++ b/tools/qfcc/include/obj_file.h @@ -75,6 +75,7 @@ typedef struct qfo_def_s { #define QFOD_GLOBAL (1u<<3) #define QFOD_EXTERNAL (1u<<4) #define QFOD_LOCAL (1u<<5) +#define QFOD_SYSTEM (1u<<6) typedef struct qfo_func_s { string_t name; diff --git a/tools/qfcc/source/def.c b/tools/qfcc/source/def.c index b6e0ad5c5..76a74c355 100644 --- a/tools/qfcc/source/def.c +++ b/tools/qfcc/source/def.c @@ -151,6 +151,9 @@ set_storage_bits (def_t *def, storage_class_t storage) switch (storage) { case st_none: break; + case st_system: + def->system = 1; + // fall through case st_global: def->global = 1; def->external = 0; @@ -240,6 +243,7 @@ get_def (type_t *type, const char *name, scope_t *scope, case st_none: case st_global: case st_local: + case st_system: space = scope->space; break; case st_extern: diff --git a/tools/qfcc/source/obj_file.c b/tools/qfcc/source/obj_file.c index ad94dd6b9..296681ba8 100644 --- a/tools/qfcc/source/obj_file.c +++ b/tools/qfcc/source/obj_file.c @@ -134,6 +134,8 @@ flags (def_t *d) flags |= QFOD_EXTERNAL; if (d->local) flags |= QFOD_LOCAL; + if (d->system) + flags |= QFOD_SYSTEM; return flags; } @@ -538,6 +540,7 @@ qfo_to_progs (qfo_t *qfo, pr_info_t *pr) pd->global = (qd->flags & QFOD_GLOBAL) != 0; pd->external = (qd->flags & QFOD_EXTERNAL) != 0; pd->local = (qd->flags & QFOD_LOCAL) != 0; + pd->system = (qd->flags & QFOD_SYSTEM) != 0; pd->file = qd->file; pd->line = qd->line; } diff --git a/tools/qfcc/source/qc-lex.l b/tools/qfcc/source/qc-lex.l index 4d4008b76..99013b93d 100644 --- a/tools/qfcc/source/qc-lex.l +++ b/tools/qfcc/source/qc-lex.l @@ -301,6 +301,7 @@ static keyword_t keywords[] = { {"@argv", ARGV, 0, 0, PROG_VERSION}, {"@extern", EXTERN, 0, 1, PROG_ID_VERSION}, {"@static", STATIC, 0, 1, PROG_ID_VERSION}, + {"@system", SYSTEM, 0, 1, PROG_ID_VERSION}, {"@sizeof", SIZEOF, 0, 0, PROG_VERSION}, }; diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 9cb0bde10..773d4a2a5 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -128,7 +128,7 @@ void free_local_inits (hashtab_t *def_list); %token LOCAL RETURN WHILE DO IF ELSE FOR BREAK CONTINUE ELLIPSIS NIL %token IFBE IFB IFAE IFA %token SWITCH CASE DEFAULT STRUCT UNION ENUM TYPEDEF SUPER SELF THIS -%token ARGC ARGV EXTERN STATIC SIZEOF +%token ARGC ARGV EXTERN STATIC SYSTEM SIZEOF %token ELE_START %token TYPE %token CLASS DEFS ENCODE END IMPLEMENTATION INTERFACE PRIVATE PROTECTED @@ -223,6 +223,7 @@ simple_def storage_class : EXTERN { current_storage = st_extern; } | STATIC { current_storage = st_static; } + | SYSTEM { current_storage = st_system; } ; struct_defs