[gamecode] Rename ev_integer to ev_int

And other related fields so integer is now int (and uinteger is uint). I
really don't know why I went with integer in the first place, but this
will make using macros easier for dealing with types.
This commit is contained in:
Bill Currie 2022-01-18 13:21:06 +09:00
parent 978d6fd3e8
commit cfe7c44df0
59 changed files with 969 additions and 972 deletions

View file

@ -416,29 +416,29 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
*/ */
#define G_DOUBLE(p,o) (*(double *) ((p)->pr_globals + o)) #define G_DOUBLE(p,o) (*(double *) ((p)->pr_globals + o))
/** Access an integer global. Can be assigned to. /** Access an int global. Can be assigned to.
\par QC type: \par QC type:
\c integer \c int
\param p pointer to ::progs_t VM struct \param p pointer to ::progs_t VM struct
\param o offset into global data space \param o offset into global data space
\return int lvalue \return int lvalue
\hideinitializer \hideinitializer
*/ */
#define G_INT(p,o) G_var (p, o, integer) #define G_INT(p,o) G_var (p, o, int)
/** Access an unsigned integer global. Can be assigned to. /** Access an unsigned int global. Can be assigned to.
\par QC type: \par QC type:
\c uinteger \c uint
\param p pointer to ::progs_t VM struct \param p pointer to ::progs_t VM struct
\param o offset into global data space \param o offset into global data space
\return unsigned int lvalue \return unsigned int lvalue
\hideinitializer \hideinitializer
*/ */
#define G_UINT(p,o) G_var (p, o, uinteger) #define G_UINT(p,o) G_var (p, o, uint)
/** Access a vector global. Can be assigned to. /** Access a vector global. Can be assigned to.
@ -632,29 +632,29 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
*/ */
#define P_DOUBLE(p,n) P_PACKED(p, double, n) #define P_DOUBLE(p,n) P_PACKED(p, double, n)
/** Access an integer parameter. Can be assigned to. /** Access an int parameter. Can be assigned to.
\par QC type: \par QC type:
\c integer \c int
\param p pointer to ::progs_t VM struct \param p pointer to ::progs_t VM struct
\param n parameter number (0-7) \param n parameter number (0-7)
\return int lvalue \return int lvalue
\hideinitializer \hideinitializer
*/ */
#define P_INT(p,n) P_var (p, n, integer) #define P_INT(p,n) P_var (p, n, int)
/** Access an unsigned integer parameter. Can be assigned to. /** Access an unsigned int parameter. Can be assigned to.
\par QC type: \par QC type:
\c uinteger \c uint
\param p pointer to ::progs_t VM struct \param p pointer to ::progs_t VM struct
\param n parameter number (0-7) \param n parameter number (0-7)
\return unsigned int lvalue \return unsigned int lvalue
\hideinitializer \hideinitializer
*/ */
#define P_UINT(p,n) P_var (p, n, uinteger) #define P_UINT(p,n) P_var (p, n, uint)
/** Access a vector parameter. Can be used any way a vec3_t variable can. /** Access a vector parameter. Can be used any way a vec3_t variable can.
@ -850,24 +850,24 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
/** Access the VM function return value as a \c ::pr_int_t (AKA int32_t) /** Access the VM function return value as a \c ::pr_int_t (AKA int32_t)
\par QC type: \par QC type:
\c integer \c int
\param p pointer to ::progs_t VM struct \param p pointer to ::progs_t VM struct
\return ::pr_int_t lvalue \return ::pr_int_t lvalue
\hideinitializer \hideinitializer
*/ */
#define R_INT(p) R_var (p, integer) #define R_INT(p) R_var (p, int)
/** Access the VM function return value as a \c ::pr_uint_t (AKA uint32_t) /** Access the VM function return value as a \c ::pr_uint_t (AKA uint32_t)
\par QC type: \par QC type:
\c uinteger \c uint
\param p pointer to ::progs_t VM struct \param p pointer to ::progs_t VM struct
\return ::pr_int_t lvalue \return ::pr_int_t lvalue
\hideinitializer \hideinitializer
*/ */
#define R_UINT(p) R_var (p, uinteger) #define R_UINT(p) R_var (p, uint)
/** Access the VM function return value as a \c ::vec3_t vector. /** Access the VM function return value as a \c ::vec3_t vector.
@ -1036,29 +1036,29 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
*/ */
#define E_DOUBLE(e,o) (*(double *) ((e)->v + o)) #define E_DOUBLE(e,o) (*(double *) ((e)->v + o))
/** Access an integer entity field. Can be assigned to. /** Access an int entity field. Can be assigned to.
\par QC type: \par QC type:
\c integer \c int
\param e pointer to the entity \param e pointer to the entity
\param o field offset into entity data space \param o field offset into entity data space
\return int lvalue \return int lvalue
\hideinitializer \hideinitializer
*/ */
#define E_INT(e,o) E_var (e, o, integer) #define E_INT(e,o) E_var (e, o, int)
/** Access an unsigned integer entity field. Can be assigned to. /** Access an unsigned int entity field. Can be assigned to.
\par QC type: \par QC type:
\c uinteger \c uint
\param e pointer to the entity \param e pointer to the entity
\param o field offset into entity data space \param o field offset into entity data space
\return unsigned int lvalue \return unsigned int lvalue
\hideinitializer \hideinitializer
*/ */
#define E_UINT(e,o) E_var (e, o, uinteger) #define E_UINT(e,o) E_var (e, o, uint)
/** Access a vector entity field. Can be used any way a vec3_t variable can. /** Access a vector entity field. Can be used any way a vec3_t variable can.
@ -1452,14 +1452,14 @@ void PR_FreeTempStrings (progs_t *pr);
<ul> <ul>
<li>\c '@' \c id Not yet implemented. Silently ignored. <li>\c '@' \c id Not yet implemented. Silently ignored.
<li>\c 'e' \c entity Prints the edict number of the given entity ("%i") <li>\c 'e' \c entity Prints the edict number of the given entity ("%i")
<li>\c 'i' \c integer Print a integer value. ("%i") <li>\c 'i' \c int Print a int value. ("%i")
<li>\c 'f' \c float Print a float value. ("%f") <li>\c 'f' \c float Print a float value. ("%f")
<li>\c 'g' \c float Print a float value. ("%f") <li>\c 'g' \c float Print a float value. ("%f")
<li>\c 'p' \c void * Print a pointer value. ("%#x") <li>\c 'p' \c void * Print a pointer value. ("%#x")
<li>\c 's' \c string Print a string value. ("%s") <li>\c 's' \c string Print a string value. ("%s")
<li>\c 'v' \c vector Print a vector value. ("'%g %g %g'") <li>\c 'v' \c vector Print a vector value. ("'%g %g %g'")
<li>\c 'q' \c quaternion Print a quaternion value. ("'%g %g %g %g'") <li>\c 'q' \c quaternion Print a quaternion value. ("'%g %g %g %g'")
<li>\c 'x' \c uinteger Print an unsigned integer value. ("%x") <li>\c 'x' \c uint Print an unsigned int value. ("%x")
</ul> </ul>
</ul> </ul>
@ -1528,7 +1528,7 @@ void *PR_Resources_Find (progs_t *pr, const char *name);
/** \name Resource Map support /** \name Resource Map support
These macros can be used to create functions for mapping C resources These macros can be used to create functions for mapping C resources
to QuakeC integer handles. to QuakeC int handles.
Valid handles are always negative. Valid handles are always negative.
@ -1731,8 +1731,8 @@ typedef struct type_view_s {
type_view_func func_view; type_view_func func_view;
type_view_func pointer_view; type_view_func pointer_view;
type_view_func quat_view; type_view_func quat_view;
type_view_func integer_view; type_view_func int_view;
type_view_func uinteger_view; type_view_func uint_view;
type_view_func short_view; type_view_func short_view;
type_view_func double_view; type_view_func double_view;
type_view_func long_view; type_view_func long_view;

View file

@ -524,9 +524,9 @@ typedef union pr_type_u {
pr_uint_t entity_var; pr_uint_t entity_var;
float vector_var; // really [3], but this structure must be 32 bits float vector_var; // really [3], but this structure must be 32 bits
float quat_var; // really [4], but this structure must be 32 bits float quat_var; // really [4], but this structure must be 32 bits
pr_int_t integer_var; pr_int_t int_var;
pr_ptr_t pointer_var; pr_ptr_t pointer_var;
pr_uint_t uinteger_var; pr_uint_t uint_var;
} pr_type_t; } pr_type_t;
typedef struct pr_va_list_s { typedef struct pr_va_list_s {

View file

@ -39,8 +39,8 @@ EV_TYPE(field)
EV_TYPE(func) EV_TYPE(func)
EV_TYPE(pointer) // end of v6 types EV_TYPE(pointer) // end of v6 types
EV_TYPE(quat) EV_TYPE(quat)
EV_TYPE(integer) EV_TYPE(int)
EV_TYPE(uinteger) EV_TYPE(uint)
EV_TYPE(short) // value is embedded in the opcode EV_TYPE(short) // value is embedded in the opcode
EV_TYPE(double) EV_TYPE(double)
EV_TYPE(long) EV_TYPE(long)

View file

@ -48,8 +48,8 @@ branch_fmt = [
] ]
compare_ccc = [ "eq", "lt", "gt", None, "ne", "ge", "le", None] compare_ccc = [ "eq", "lt", "gt", None, "ne", "ge", "le", None]
type_tt = ['I', 'F', 'L', 'D'] type_tt = ['I', 'F', 'L', 'D']
etype_tt = ["ev_integer", "ev_float", "ev_long", "ev_double"] etype_tt = ["ev_int", "ev_float", "ev_long", "ev_double"]
unsigned_t = ["ev_uinteger", "ev_ulong"] unsigned_t = ["ev_uint", "ev_ulong"]
float_t = ["ev_float", "ev_double"] float_t = ["ev_float", "ev_double"]
all_formats = { all_formats = {
@ -58,7 +58,7 @@ all_formats = {
"opname": "all", "opname": "all",
"format": "%Ga, %gc", "format": "%Ga, %gc",
"widths": "{ss+1}, 0, 1", "widths": "{ss+1}, 0, 1",
"types": "ev_integer, ev_integer, ev_integer", "types": "ev_int, ev_int, ev_int",
} }
any_formats = { any_formats = {
"opcode": "OP_ANY_{ss+1}", "opcode": "OP_ANY_{ss+1}",
@ -66,7 +66,7 @@ any_formats = {
"opname": "any", "opname": "any",
"format": "%Ga, %gc", "format": "%Ga, %gc",
"widths": "{ss+1}, 0, 1", "widths": "{ss+1}, 0, 1",
"types": "ev_integer, ev_integer, ev_integer", "types": "ev_int, ev_int, ev_int",
} }
bitops_formats = { bitops_formats = {
"opcode": "OP_{op_bit[oo].upper()}_{bit_type[t]}_{ss+1}", "opcode": "OP_{op_bit[oo].upper()}_{bit_type[t]}_{ss+1}",
@ -78,7 +78,7 @@ bitops_formats = {
"args": { "args": {
"op_bit": ["bitand", "bitor", "bitxor", "bitnot"], "op_bit": ["bitand", "bitor", "bitxor", "bitnot"],
"bit_type": ["I", "L"], "bit_type": ["I", "L"],
"bit_types": ["ev_integer", "ev_long"], "bit_types": ["ev_int", "ev_long"],
"bit_fmt": [ "bit_fmt": [
"%Ga, %Gb, %gc", "%Ga, %Gb, %gc",
"%Ga, %Gb, %gc", "%Ga, %Gb, %gc",
@ -93,7 +93,7 @@ branch_formats = {
"opname": "{op_cond[c*4+cc]}", "opname": "{op_cond[c*4+cc]}",
"format": "{cond_fmt[c*4+cc]}{branch_fmt[0]}", "format": "{cond_fmt[c*4+cc]}{branch_fmt[0]}",
"widths": "{cond_widths[c*4+cc]}", "widths": "{cond_widths[c*4+cc]}",
"types": "ev_void, ev_void, ev_integer", "types": "ev_void, ev_void, ev_int",
"args": { "args": {
"op_mode": "ABCD", "op_mode": "ABCD",
"op_cond": ["ifz", "ifb", "ifa", None, "op_cond": ["ifz", "ifb", "ifa", None,
@ -134,7 +134,7 @@ compare_formats = {
"mnemonic": "{op_cmp[ccc]}.{cmp_type[tt]}", "mnemonic": "{op_cmp[ccc]}.{cmp_type[tt]}",
"opname": "{op_cmp[ccc]}", "opname": "{op_cmp[ccc]}",
"widths": "{ss+1}, {ss+1}, {ss+1}", "widths": "{ss+1}, {ss+1}, {ss+1}",
"types": "{cmp_types[tt]}, {cmp_types[tt]}, ev_integer", "types": "{cmp_types[tt]}, {cmp_types[tt]}, ev_int",
"args": { "args": {
"op_cmp": compare_ccc, "op_cmp": compare_ccc,
"cmp_type": type_tt, "cmp_type": type_tt,
@ -146,7 +146,7 @@ compare2_formats = {
"mnemonic": "{op_cmp[ccc]}.{cmp_type[t]}", "mnemonic": "{op_cmp[ccc]}.{cmp_type[t]}",
"opname": "{op_cmp[ccc]}", "opname": "{op_cmp[ccc]}",
"widths": "{ss+1}, {ss+1}, {ss+1}", "widths": "{ss+1}, {ss+1}, {ss+1}",
"types": "{cmp_types[t]}, {cmp_types[t]}, ev_integer", "types": "{cmp_types[t]}, {cmp_types[t]}, ev_int",
"args": { "args": {
"op_cmp": compare_ccc, "op_cmp": compare_ccc,
"cmp_type": ['u', 'U'], "cmp_type": ['u', 'U'],
@ -228,7 +228,7 @@ memset_formats = {
"opname": "memset", "opname": "memset",
"format": "{memset_fmt[oo]}", "format": "{memset_fmt[oo]}",
"widths": "0, 0, 0", "widths": "0, 0, 0",
"types": "ev_integer, ev_void, ev_void", "types": "ev_int, ev_void, ev_void",
"args": { "args": {
"op_memset": ["i", "p", "pi", None], "op_memset": ["i", "p", "pi", None],
"memset_fmt": ["%Ga, %sb, %gc", "%Ga, %Gb, %Gc", "%Ga, %sb, %Gc", None], "memset_fmt": ["%Ga, %sb, %gc", "%Ga, %Gb, %Gc", "%Ga, %sb, %Gc", None],
@ -240,7 +240,7 @@ move_formats = {
"opname": "memset", "opname": "memset",
"format": "{move_fmt[oo]}", "format": "{move_fmt[oo]}",
"widths": "0, 0, 0", "widths": "0, 0, 0",
"types": "ev_integer, ev_void, ev_void", "types": "ev_int, ev_void, ev_void",
"args": { "args": {
"op_move": ["i", "p", "pi", None], "op_move": ["i", "p", "pi", None],
"move_fmt": ["%Ga, %sb, %gc", "%Ga, %Gb, %Gc", "%Ga, %sb, %Gc", None], "move_fmt": ["%Ga, %sb, %gc", "%Ga, %Gb, %Gc", "%Ga, %sb, %Gc", None],
@ -252,7 +252,7 @@ none_formats = {
"opname": "none", "opname": "none",
"format": "%Ga, %gc", "format": "%Ga, %gc",
"widths": "{ss+1}, 0, 1", "widths": "{ss+1}, 0, 1",
"types": "ev_integer, ev_invalid, ev_integer", "types": "ev_int, ev_invalid, ev_int",
} }
push_formats = { push_formats = {
"opcode": "OP_PUSH_{op_mode[mm]}_{ss+1}", "opcode": "OP_PUSH_{op_mode[mm]}_{ss+1}",
@ -325,7 +325,7 @@ shiftops_formats = {
"op_shift": ["shl", "asr", "shl", "shr"], "op_shift": ["shl", "asr", "shl", "shr"],
"shift_type": ['I', 'L', 'u', 'U'], "shift_type": ['I', 'L', 'u', 'U'],
"shift_types": [ "shift_types": [
["ev_integer", "ev_uinteger"], ["ev_int", "ev_uint"],
["ev_long", "ev_ulong"], ["ev_long", "ev_ulong"],
], ],
}, },
@ -393,14 +393,14 @@ string_formats = {
"%Ga, %gc", "%Ga, %gc",
], ],
"str_types": [ "str_types": [
"ev_string, ev_string, ev_integer", "ev_string, ev_string, ev_int",
"ev_string, ev_string, ev_integer", "ev_string, ev_string, ev_int",
"ev_string, ev_string, ev_integer", "ev_string, ev_string, ev_int",
"ev_string, ev_string, ev_string", "ev_string, ev_string, ev_string",
"ev_string, ev_string, ev_integer", "ev_string, ev_string, ev_int",
"ev_string, ev_string, ev_integer", "ev_string, ev_string, ev_int",
"ev_string, ev_string, ev_integer", "ev_string, ev_string, ev_int",
"ev_string, ev_invalid, ev_integer", "ev_string, ev_invalid, ev_int",
], ],
}, },
} }

View file

@ -137,9 +137,9 @@ static void pr_debug_pointer_view (qfot_type_t *type, pr_type_t *value,
void *_data); void *_data);
static void pr_debug_quat_view (qfot_type_t *type, pr_type_t *value, static void pr_debug_quat_view (qfot_type_t *type, pr_type_t *value,
void *_data); void *_data);
static void pr_debug_integer_view (qfot_type_t *type, pr_type_t *value, static void pr_debug_int_view (qfot_type_t *type, pr_type_t *value,
void *_data); void *_data);
static void pr_debug_uinteger_view (qfot_type_t *type, pr_type_t *value, static void pr_debug_uint_view (qfot_type_t *type, pr_type_t *value,
void *_data); void *_data);
static void pr_debug_short_view (qfot_type_t *type, pr_type_t *value, static void pr_debug_short_view (qfot_type_t *type, pr_type_t *value,
void *_data); void *_data);
@ -170,8 +170,8 @@ static type_view_t raw_type_view = {
pr_debug_func_view, pr_debug_func_view,
pr_debug_pointer_view, pr_debug_pointer_view,
pr_debug_quat_view, pr_debug_quat_view,
pr_debug_integer_view, pr_debug_int_view,
pr_debug_uinteger_view, pr_debug_uint_view,
pr_debug_short_view, pr_debug_short_view,
pr_debug_double_view, pr_debug_double_view,
pr_debug_long_view, pr_debug_long_view,
@ -269,7 +269,7 @@ pr_debug_type_size (const progs_t *pr, const qfot_type_t *type)
} }
return size; return size;
case ty_enum: case ty_enum:
return pr_type_size[ev_integer]; return pr_type_size[ev_int];
case ty_array: case ty_array:
aux_type = &G_STRUCT (pr, qfot_type_t, type->array.type); aux_type = &G_STRUCT (pr, qfot_type_t, type->array.type);
size = pr_debug_type_size (pr, aux_type); size = pr_debug_type_size (pr, aux_type);
@ -356,7 +356,7 @@ parse_expression (progs_t *pr, const char *expr, int conditional)
goto error; goto error;
if (!Script_GetToken (es, 1)) if (!Script_GetToken (es, 1))
goto error; goto error;
pr->wp_val.integer_var = strtol (es->token->str, &e, 0); pr->wp_val.int_var = strtol (es->token->str, &e, 0);
if (e == es->token->str) if (e == es->token->str)
goto error; goto error;
if (*e == '.' || *e == 'e' || *e == 'E') if (*e == '.' || *e == 'e' || *e == 'E')
@ -404,7 +404,7 @@ pr_debug_clear (progs_t *pr, void *data)
pr->watch = 0; pr->watch = 0;
pr->wp_conditional = 0; pr->wp_conditional = 0;
pr->wp_val.integer_var = 0; pr->wp_val.int_var = 0;
for (int i = 0; i < ev_type_count; i++ ) { for (int i = 0; i < ev_type_count; i++ ) {
res->type_encodings[i] = &res->void_type; res->type_encodings[i] = &res->void_type;
@ -1056,11 +1056,11 @@ value_string (pr_debug_data_t *data, qfot_type_t *type, pr_type_t *value)
case ev_quat: case ev_quat:
raw_type_view.quat_view (type, value, data); raw_type_view.quat_view (type, value, data);
break; break;
case ev_integer: case ev_int:
raw_type_view.integer_view (type, value, data); raw_type_view.int_view (type, value, data);
break; break;
case ev_uinteger: case ev_uint:
raw_type_view.uinteger_view (type, value, data); raw_type_view.uint_view (type, value, data);
break; break;
case ev_short: case ev_short:
raw_type_view.short_view (type, value, data); raw_type_view.short_view (type, value, data);
@ -1242,9 +1242,9 @@ pr_debug_float_view (qfot_type_t *type, pr_type_t *value, void *_data)
dstring_t *dstr = data->dstr; dstring_t *dstr = data->dstr;
if (data->pr->progs->version == PROG_ID_VERSION if (data->pr->progs->version == PROG_ID_VERSION
&& ISDENORM (value->integer_var) && ISDENORM (value->int_var)
&& value->uinteger_var != 0x80000000) { && value->uint_var != 0x80000000) {
dasprintf (dstr, "<%08x>", value->integer_var); dasprintf (dstr, "<%08x>", value->int_var);
} else { } else {
dasprintf (dstr, "%.9g", value->float_var); dasprintf (dstr, "%.9g", value->float_var);
} }
@ -1284,12 +1284,12 @@ pr_debug_field_view (qfot_type_t *type, pr_type_t *value, void *_data)
__auto_type data = (pr_debug_data_t *) _data; __auto_type data = (pr_debug_data_t *) _data;
progs_t *pr = data->pr; progs_t *pr = data->pr;
dstring_t *dstr = data->dstr; dstring_t *dstr = data->dstr;
pr_def_t *def = PR_FieldAtOfs (pr, value->integer_var); pr_def_t *def = PR_FieldAtOfs (pr, value->int_var);
if (def) { if (def) {
dasprintf (dstr, ".%s", PR_GetString (pr, def->name)); dasprintf (dstr, ".%s", PR_GetString (pr, def->name));
} else { } else {
dasprintf (dstr, ".<$%04x>", value->integer_var); dasprintf (dstr, ".<$%04x>", value->int_var);
} }
} }
@ -1316,7 +1316,7 @@ pr_debug_pointer_view (qfot_type_t *type, pr_type_t *value, void *_data)
__auto_type data = (pr_debug_data_t *) _data; __auto_type data = (pr_debug_data_t *) _data;
progs_t *pr = data->pr; progs_t *pr = data->pr;
dstring_t *dstr = data->dstr; dstring_t *dstr = data->dstr;
pr_ptr_t offset = value->integer_var; pr_ptr_t offset = value->int_var;
pr_ptr_t offs = offset; pr_ptr_t offs = offset;
pr_def_t *def = 0; pr_def_t *def = 0;
@ -1342,21 +1342,21 @@ pr_debug_quat_view (qfot_type_t *type, pr_type_t *value, void *_data)
} }
static void static void
pr_debug_integer_view (qfot_type_t *type, pr_type_t *value, void *_data) pr_debug_int_view (qfot_type_t *type, pr_type_t *value, void *_data)
{ {
__auto_type data = (pr_debug_data_t *) _data; __auto_type data = (pr_debug_data_t *) _data;
dstring_t *dstr = data->dstr; dstring_t *dstr = data->dstr;
dasprintf (dstr, "%d", value->integer_var); dasprintf (dstr, "%d", value->int_var);
} }
static void static void
pr_debug_uinteger_view (qfot_type_t *type, pr_type_t *value, void *_data) pr_debug_uint_view (qfot_type_t *type, pr_type_t *value, void *_data)
{ {
__auto_type data = (pr_debug_data_t *) _data; __auto_type data = (pr_debug_data_t *) _data;
dstring_t *dstr = data->dstr; dstring_t *dstr = data->dstr;
dasprintf (dstr, "$%08x", value->uinteger_var); dasprintf (dstr, "$%08x", value->uint_var);
} }
static void static void
@ -1365,7 +1365,7 @@ pr_debug_short_view (qfot_type_t *type, pr_type_t *value, void *_data)
__auto_type data = (pr_debug_data_t *) _data; __auto_type data = (pr_debug_data_t *) _data;
dstring_t *dstr = data->dstr; dstring_t *dstr = data->dstr;
dasprintf (dstr, "%04x", (short)value->integer_var); dasprintf (dstr, "%04x", (short)value->int_var);
} }
static void static void
@ -1468,7 +1468,7 @@ PR_Debug_Watch (progs_t *pr, const char *expr)
(int) (intptr_t) (pr->watch - pr->pr_globals)); (int) (intptr_t) (pr->watch - pr->pr_globals));
if (pr->wp_conditional) if (pr->wp_conditional)
Sys_Printf (" if new val == %d\n", Sys_Printf (" if new val == %d\n",
pr->wp_val.integer_var); pr->wp_val.int_var);
} else { Sys_Printf (" none active\n"); } else { Sys_Printf (" none active\n");
} }
return; return;
@ -1481,7 +1481,7 @@ PR_Debug_Watch (progs_t *pr, const char *expr)
if (pr->watch) { if (pr->watch) {
Sys_Printf ("watchpoint set to [%d]\n", PR_SetPointer (pr, pr->watch)); Sys_Printf ("watchpoint set to [%d]\n", PR_SetPointer (pr, pr->watch));
if (pr->wp_conditional) if (pr->wp_conditional)
Sys_Printf (" if new val == %d\n", pr->wp_val.integer_var); Sys_Printf (" if new val == %d\n", pr->wp_val.int_var);
} else { } else {
Sys_Printf ("watchpoint cleared\n"); Sys_Printf ("watchpoint cleared\n");
} }
@ -1672,7 +1672,7 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
{ {
edict_t *ed = 0; edict_t *ed = 0;
opval = pr->pr_globals[s->a].entity_var; opval = pr->pr_globals[s->a].entity_var;
parm_ind = pr->pr_globals[s->b].uinteger_var; parm_ind = pr->pr_globals[s->b].uint_var;
if (parm_ind < pr->progs->entityfields if (parm_ind < pr->progs->entityfields
&& opval > 0 && opval > 0
&& opval < pr->pr_edict_area_size) { && opval < pr->pr_edict_area_size) {

View file

@ -282,7 +282,7 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
if (pr_deadbeef_locals->int_val) if (pr_deadbeef_locals->int_val)
for (i = f->parm_start; i < f->parm_start + f->locals; i++) for (i = f->parm_start; i < f->parm_start + f->locals; i++)
pr->pr_globals[i].integer_var = 0xdeadbeef; pr->pr_globals[i].int_var = 0xdeadbeef;
// copy parameters // copy parameters
if (f->numparms >= 0) { if (f->numparms >= 0) {
@ -297,8 +297,8 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
copy_param (dstParams[i], pr->pr_params[i], f->parm_size[i].size); copy_param (dstParams[i], pr->pr_params[i], f->parm_size[i].size);
} }
copy_args = pr->pr_argc - i; copy_args = pr->pr_argc - i;
argc->integer_var = copy_args; argc->int_var = copy_args;
argv->integer_var = dstParams[i] - pr->pr_globals; argv->int_var = dstParams[i] - pr->pr_globals;
if (i < MAX_PARMS) { if (i < MAX_PARMS) {
memcpy (dstParams[i], pr->pr_params[i], memcpy (dstParams[i], pr->pr_params[i],
(copy_args * pr->pr_param_size) * sizeof (pr_type_t)); (copy_args * pr->pr_param_size) * sizeof (pr_type_t));
@ -461,7 +461,7 @@ static inline void
pr_memset (pr_type_t *dst, int val, int count) pr_memset (pr_type_t *dst, int val, int count)
{ {
while (count-- > 0) { while (count-- > 0) {
(*dst++).integer_var = val; (*dst++).int_var = val;
} }
} }
@ -783,10 +783,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
case OP_STOREP_P_v6p: case OP_STOREP_P_v6p:
pointer = OPB(int); pointer = OPB(int);
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
ptr = pr->pr_globals + pointer; ptr = pr->pr_globals + pointer;
ptr->integer_var = OPA(int); ptr->int_var = OPA(int);
break; break;
case OP_STOREP_V_v6p: case OP_STOREP_V_v6p:
pointer = OPB(int); pointer = OPB(int);
@ -857,7 +857,7 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
"field in an edict"); "field in an edict");
} }
fldofs = OPA(uint) + OPB(int); fldofs = OPA(uint) + OPB(int);
OPC(int) = pr->pr_edict_area[fldofs].integer_var; OPC(int) = pr->pr_edict_area[fldofs].int_var;
break; break;
case OP_LOAD_V_v6p: case OP_LOAD_V_v6p:
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
@ -905,10 +905,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
case OP_LOADB_P_v6p: case OP_LOADB_P_v6p:
pointer = OPA(int) + OPB(int); pointer = OPA(int) + OPB(int);
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
ptr = pr->pr_globals + pointer; ptr = pr->pr_globals + pointer;
OPC(int) = ptr->integer_var; OPC(int) = ptr->int_var;
break; break;
case OP_LOADB_V_v6p: case OP_LOADB_V_v6p:
pointer = OPA(int) + OPB(int); pointer = OPA(int) + OPB(int);
@ -944,10 +944,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
case OP_LOADBI_P_v6p: case OP_LOADBI_P_v6p:
pointer = OPA(int) + (short) st->b; pointer = OPA(int) + (short) st->b;
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
ptr = pr->pr_globals + pointer; ptr = pr->pr_globals + pointer;
OPC(int) = ptr->integer_var; OPC(int) = ptr->int_var;
break; break;
case OP_LOADBI_V_v6p: case OP_LOADBI_V_v6p:
pointer = OPA(int) + (short) st->b; pointer = OPA(int) + (short) st->b;
@ -993,10 +993,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
case OP_STOREB_P_v6p: case OP_STOREB_P_v6p:
pointer = OPB(int) + OPC(int); pointer = OPB(int) + OPC(int);
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
ptr = pr->pr_globals + pointer; ptr = pr->pr_globals + pointer;
ptr->integer_var = OPA(int); ptr->int_var = OPA(int);
break; break;
case OP_STOREB_V_v6p: case OP_STOREB_V_v6p:
pointer = OPB(int) + OPC(int); pointer = OPB(int) + OPC(int);
@ -1032,10 +1032,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
case OP_STOREBI_P_v6p: case OP_STOREBI_P_v6p:
pointer = OPB(int) + (short) st->c; pointer = OPB(int) + (short) st->c;
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
ptr = pr->pr_globals + pointer; ptr = pr->pr_globals + pointer;
ptr->integer_var = OPA(int); ptr->int_var = OPA(int);
break; break;
case OP_STOREBI_V_v6p: case OP_STOREBI_V_v6p:
pointer = OPB(int) + (short) st->c; pointer = OPB(int) + (short) st->c;
@ -1075,7 +1075,7 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 1); check_stack_pointer (pr, stack, 1);
} }
stk->integer_var = OPA(int); stk->int_var = OPA(int);
*pr->globals.stack = stack; *pr->globals.stack = stack;
} }
break; break;
@ -1118,10 +1118,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 1); check_stack_pointer (pr, stack, 1);
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
stk->integer_var = ptr->integer_var; stk->int_var = ptr->int_var;
*pr->globals.stack = stack; *pr->globals.stack = stack;
} }
break; break;
@ -1135,7 +1135,7 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 3); check_stack_pointer (pr, stack, 3);
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
VectorCopy (&ptr->vector_var, &stk->vector_var); VectorCopy (&ptr->vector_var, &stk->vector_var);
@ -1176,10 +1176,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 1); check_stack_pointer (pr, stack, 1);
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
stk->integer_var = ptr->integer_var; stk->int_var = ptr->int_var;
*pr->globals.stack = stack; *pr->globals.stack = stack;
} }
break; break;
@ -1193,7 +1193,7 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 3); check_stack_pointer (pr, stack, 3);
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
VectorCopy (&ptr->vector_var, &stk->vector_var); VectorCopy (&ptr->vector_var, &stk->vector_var);
@ -1231,7 +1231,7 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 1); check_stack_pointer (pr, stack, 1);
} }
OPA(int) = stk->integer_var; OPA(int) = stk->int_var;
*pr->globals.stack = stack + 1; *pr->globals.stack = stack + 1;
} }
break; break;
@ -1274,10 +1274,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 1); check_stack_pointer (pr, stack, 1);
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
ptr->integer_var = stk->integer_var; ptr->int_var = stk->int_var;
*pr->globals.stack = stack + 1; *pr->globals.stack = stack + 1;
} }
break; break;
@ -1291,7 +1291,7 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 3); check_stack_pointer (pr, stack, 3);
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
VectorCopy (&stk->vector_var, &ptr->vector_var); VectorCopy (&stk->vector_var, &ptr->vector_var);
@ -1332,10 +1332,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 1); check_stack_pointer (pr, stack, 1);
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
ptr->integer_var = stk->integer_var; ptr->int_var = stk->int_var;
*pr->globals.stack = stack + 1; *pr->globals.stack = stack + 1;
} }
break; break;
@ -1349,7 +1349,7 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
check_stack_pointer (pr, stack, 3); check_stack_pointer (pr, stack, 3);
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
VectorCopy (&stk->vector_var, &ptr->vector_var); VectorCopy (&stk->vector_var, &ptr->vector_var);
@ -1426,10 +1426,10 @@ pr_exec_quakec (progs_t *pr, int exitdepth)
case OP_JUMPB_v6p: case OP_JUMPB_v6p:
pointer = st->a + OPB(int); pointer = st->a + OPB(int);
if (pr_boundscheck->int_val) { if (pr_boundscheck->int_val) {
PR_BoundsCheck (pr, pointer, ev_integer); PR_BoundsCheck (pr, pointer, ev_int);
} }
ptr = pr->pr_globals + pointer; ptr = pr->pr_globals + pointer;
pointer = ptr->integer_var; pointer = ptr->int_var;
if (pr_boundscheck->int_val if (pr_boundscheck->int_val
&& (pointer >= pr->progs->numstatements)) { && (pointer >= pr->progs->numstatements)) {
PR_RunError (pr, "Invalid jump destination"); PR_RunError (pr, "Invalid jump destination");
@ -1695,8 +1695,8 @@ op_call:
OPC(float) = OPA(double) < OPB(double); OPC(float) = OPA(double) < OPB(double);
break; break;
case OP_NOT_D_v6p: case OP_NOT_D_v6p:
OPC(int) = (op_a[0].integer_var OPC(int) = (op_a[0].int_var
|| (op_a[1].integer_var & ~0x80000000u)); || (op_a[1].int_var & ~0x80000000u));
break; break;
case OP_EQ_D_v6p: case OP_EQ_D_v6p:
OPC(int) = OPA(double) == OPB(double); OPC(int) = OPA(double) == OPB(double);
@ -1730,17 +1730,17 @@ op_call:
default: default:
PR_RunError (pr, "Bad opcode %i", st->op & ~OP_BREAK); PR_RunError (pr, "Bad opcode %i", st->op & ~OP_BREAK);
} }
if (pr->watch && pr->watch->integer_var != old_val.integer_var) { if (pr->watch && pr->watch->int_var != old_val.int_var) {
if (!pr->wp_conditional if (!pr->wp_conditional
|| pr->watch->integer_var == pr->wp_val.integer_var) { || pr->watch->int_var == pr->wp_val.int_var) {
if (pr->debug_handler) { if (pr->debug_handler) {
pr->debug_handler (prd_watchpoint, 0, pr->debug_data); pr->debug_handler (prd_watchpoint, 0, pr->debug_data);
} else { } else {
PR_RunError (pr, "watchpoint hit: %d -> %d", PR_RunError (pr, "watchpoint hit: %d -> %d",
old_val.integer_var, pr->watch->integer_var); old_val.int_var, pr->watch->int_var);
} }
} }
old_val.integer_var = pr->watch->integer_var; old_val.int_var = pr->watch->int_var;
} }
} }
exit_program: exit_program:
@ -3355,7 +3355,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
int think = pr->fields.think + self; int think = pr->fields.think + self;
double time = *pr->globals.dtime + 0.1; double time = *pr->globals.dtime + 0.1;
*(double *) (&pr->pr_edict_area[nextthink]) = time; *(double *) (&pr->pr_edict_area[nextthink]) = time;
pr->pr_edict_area[frame].integer_var = OPA(int); pr->pr_edict_area[frame].int_var = OPA(int);
pr->pr_edict_area[think].func_var = op_b->func_var; pr->pr_edict_area[think].func_var = op_b->func_var;
} }
break; break;
@ -3386,7 +3386,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
int think = pr->fields.think + self; int think = pr->fields.think + self;
double time = *pr->globals.dtime + OPC(double); double time = *pr->globals.dtime + OPC(double);
*(double *) (&pr->pr_edict_area[nextthink]) = time; *(double *) (&pr->pr_edict_area[nextthink]) = time;
pr->pr_edict_area[frame].integer_var = OPA(int); pr->pr_edict_area[frame].int_var = OPA(int);
pr->pr_edict_area[think].func_var = op_b->func_var; pr->pr_edict_area[think].func_var = op_b->func_var;
} }
break; break;
@ -3440,17 +3440,17 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
default: default:
PR_RunError (pr, "Bad opcode o%03o", st->op & OP_MASK); PR_RunError (pr, "Bad opcode o%03o", st->op & OP_MASK);
} }
if (pr->watch && pr->watch->integer_var != old_val.integer_var) { if (pr->watch && pr->watch->int_var != old_val.int_var) {
if (!pr->wp_conditional if (!pr->wp_conditional
|| pr->watch->integer_var == pr->wp_val.integer_var) { || pr->watch->int_var == pr->wp_val.int_var) {
if (pr->debug_handler) { if (pr->debug_handler) {
pr->debug_handler (prd_watchpoint, 0, pr->debug_data); pr->debug_handler (prd_watchpoint, 0, pr->debug_data);
} else { } else {
PR_RunError (pr, "watchpoint hit: %d -> %d", PR_RunError (pr, "watchpoint hit: %d -> %d",
old_val.integer_var, pr->watch->integer_var); old_val.int_var, pr->watch->int_var);
} }
} }
old_val.integer_var = pr->watch->integer_var; old_val.int_var = pr->watch->int_var;
} }
} }
exit_program: exit_program:

View file

@ -43,8 +43,8 @@ VISIBLE const pr_ushort_t pr_type_size[ev_type_count] = {
1, // ev_func 1, // ev_func
1, // ev_pointer 1, // ev_pointer
4, // ev_quat 4, // ev_quat
1, // ev_integer 1, // ev_int
1, // ev_uinteger 1, // ev_uint
0, // ev_short value in opcode 0, // ev_short value in opcode
2, // ev_double 2, // ev_double
2, // ev_long 2, // ev_long

View file

@ -79,7 +79,7 @@ PR_UglyValueString (progs_t *pr, etype_t type, pr_type_t *val, dstring_t *line)
dsprintf (line, "%s", PR_GetString (pr, f->name)); dsprintf (line, "%s", PR_GetString (pr, f->name));
break; break;
case ev_field: case ev_field:
def = PR_FieldAtOfs (pr, val->integer_var); def = PR_FieldAtOfs (pr, val->int_var);
dsprintf (line, "%s", PR_GetString (pr, def->name)); dsprintf (line, "%s", PR_GetString (pr, def->name));
break; break;
case ev_void: case ev_void:
@ -88,8 +88,8 @@ PR_UglyValueString (progs_t *pr, etype_t type, pr_type_t *val, dstring_t *line)
case ev_float: case ev_float:
dsprintf (line, "%.9g", val->float_var); dsprintf (line, "%.9g", val->float_var);
break; break;
case ev_integer: case ev_int:
dsprintf (line, "%d", val->integer_var); dsprintf (line, "%d", val->int_var);
break; break;
case ev_vector: case ev_vector:
dsprintf (line, "%.9g %.9g %.9g", VectorExpand (&val->vector_var)); dsprintf (line, "%.9g %.9g %.9g", VectorExpand (&val->vector_var));
@ -132,7 +132,7 @@ ED_EntityDict (progs_t *pr, edict_t *ed)
// if the value is still all 0, skip the field // if the value is still all 0, skip the field
type = d->type & ~DEF_SAVEGLOBAL; type = d->type & ~DEF_SAVEGLOBAL;
for (j = 0; j < pr_type_size[type]; j++) for (j = 0; j < pr_type_size[type]; j++)
if (v[j].integer_var) if (v[j].int_var)
break; break;
if (j == pr_type_size[type]) if (j == pr_type_size[type])
continue; continue;
@ -257,7 +257,7 @@ ED_ParseEpair (progs_t *pr, pr_type_t *base, pr_def_t *key, const char *s)
Sys_Printf ("Can't find field %s\n", s); Sys_Printf ("Can't find field %s\n", s);
return false; return false;
} }
d->integer_var = G_INT (pr, def->ofs); d->int_var = G_INT (pr, def->ofs);
break; break;
case ev_func: case ev_func:

View file

@ -183,109 +183,109 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_EQ_D_v6p] = {"==", "eq.d", [OP_EQ_D_v6p] = {"==", "eq.d",
ev_double, ev_double, ev_integer, ev_double, ev_double, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_EQ_F_v6p] = {"==", "eq.f", [OP_EQ_F_v6p] = {"==", "eq.f",
ev_float, ev_float, ev_integer, ev_float, ev_float, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_EQ_V_v6p] = {"==", "eq.v", [OP_EQ_V_v6p] = {"==", "eq.v",
ev_vector, ev_vector, ev_integer, ev_vector, ev_vector, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_EQ_Q_v6p] = {"==", "eq.q", [OP_EQ_Q_v6p] = {"==", "eq.q",
ev_quat, ev_quat, ev_integer, ev_quat, ev_quat, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_EQ_S_v6p] = {"==", "eq.s", [OP_EQ_S_v6p] = {"==", "eq.s",
ev_string, ev_string, ev_integer, ev_string, ev_string, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_EQ_E_v6p] = {"==", "eq.e", [OP_EQ_E_v6p] = {"==", "eq.e",
ev_entity, ev_entity, ev_integer, ev_entity, ev_entity, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_EQ_FN_v6p] = {"==", "eq.fn", [OP_EQ_FN_v6p] = {"==", "eq.fn",
ev_func, ev_func, ev_integer, ev_func, ev_func, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_NE_D_v6p] = {"!=", "ne.d", [OP_NE_D_v6p] = {"!=", "ne.d",
ev_double, ev_double, ev_integer, ev_double, ev_double, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_NE_F_v6p] = {"!=", "ne.f", [OP_NE_F_v6p] = {"!=", "ne.f",
ev_float, ev_float, ev_integer, ev_float, ev_float, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_NE_V_v6p] = {"!=", "ne.v", [OP_NE_V_v6p] = {"!=", "ne.v",
ev_vector, ev_vector, ev_integer, ev_vector, ev_vector, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_NE_Q_v6p] = {"!=", "ne.q", [OP_NE_Q_v6p] = {"!=", "ne.q",
ev_quat, ev_quat, ev_integer, ev_quat, ev_quat, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_NE_S_v6p] = {"!=", "ne.s", [OP_NE_S_v6p] = {"!=", "ne.s",
ev_string, ev_string, ev_integer, ev_string, ev_string, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_NE_E_v6p] = {"!=", "ne.e", [OP_NE_E_v6p] = {"!=", "ne.e",
ev_entity, ev_entity, ev_integer, ev_entity, ev_entity, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_NE_FN_v6p] = {"!=", "ne.fn", [OP_NE_FN_v6p] = {"!=", "ne.fn",
ev_func, ev_func, ev_integer, ev_func, ev_func, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_LE_D_v6p] = {"<=", "le.d", [OP_LE_D_v6p] = {"<=", "le.d",
ev_double, ev_double, ev_integer, ev_double, ev_double, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LE_F_v6p] = {"<=", "le.f", [OP_LE_F_v6p] = {"<=", "le.f",
ev_float, ev_float, ev_integer, ev_float, ev_float, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_GE_D_v6p] = {">=", "ge.d", [OP_GE_D_v6p] = {">=", "ge.d",
ev_double, ev_double, ev_integer, ev_double, ev_double, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_GE_F_v6p] = {">=", "ge.f", [OP_GE_F_v6p] = {">=", "ge.f",
ev_float, ev_float, ev_integer, ev_float, ev_float, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_LE_S_v6p] = {"<=", "le.s", [OP_LE_S_v6p] = {"<=", "le.s",
ev_string, ev_string, ev_integer, ev_string, ev_string, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_GE_S_v6p] = {">=", "ge.s", [OP_GE_S_v6p] = {">=", "ge.s",
ev_string, ev_string, ev_integer, ev_string, ev_string, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LT_D_v6p] = {"<", "lt.d", [OP_LT_D_v6p] = {"<", "lt.d",
ev_double, ev_double, ev_integer, ev_double, ev_double, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LT_F_v6p] = {"<", "lt.f", [OP_LT_F_v6p] = {"<", "lt.f",
ev_float, ev_float, ev_integer, ev_float, ev_float, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_GT_D_v6p] = {">", "gt.d", [OP_GT_D_v6p] = {">", "gt.d",
ev_double, ev_double, ev_integer, ev_double, ev_double, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_GT_F_v6p] = {">", "gt.f", [OP_GT_F_v6p] = {">", "gt.f",
ev_float, ev_float, ev_integer, ev_float, ev_float, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_LT_S_v6p] = {"<", "lt.s", [OP_LT_S_v6p] = {"<", "lt.s",
ev_string, ev_string, ev_integer, ev_string, ev_string, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_GT_S_v6p] = {">", "gt.s", [OP_GT_S_v6p] = {">", "gt.s",
ev_string, ev_string, ev_integer, ev_string, ev_string, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
@ -330,7 +330,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga.%Gb(%Ec), %gc", "%Ga.%Gb(%Ec), %gc",
}, },
[OP_LOAD_I_v6p] = {".", "load.i", [OP_LOAD_I_v6p] = {".", "load.i",
ev_entity, ev_field, ev_integer, ev_entity, ev_field, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga.%Gb(%Ec), %gc", "%Ga.%Gb(%Ec), %gc",
}, },
@ -341,52 +341,52 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_LOADB_D_v6p] = {".", "loadb.d", [OP_LOADB_D_v6p] = {".", "loadb.d",
ev_pointer, ev_integer, ev_double, ev_pointer, ev_int, ev_double,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_F_v6p] = {".", "loadb.f", [OP_LOADB_F_v6p] = {".", "loadb.f",
ev_pointer, ev_integer, ev_float, ev_pointer, ev_int, ev_float,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_V_v6p] = {".", "loadb.v", [OP_LOADB_V_v6p] = {".", "loadb.v",
ev_pointer, ev_integer, ev_vector, ev_pointer, ev_int, ev_vector,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_Q_v6p] = {".", "loadb.q", [OP_LOADB_Q_v6p] = {".", "loadb.q",
ev_pointer, ev_integer, ev_quat, ev_pointer, ev_int, ev_quat,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_S_v6p] = {".", "loadb.s", [OP_LOADB_S_v6p] = {".", "loadb.s",
ev_pointer, ev_integer, ev_string, ev_pointer, ev_int, ev_string,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_ENT_v6p] = {".", "loadb.ent", [OP_LOADB_ENT_v6p] = {".", "loadb.ent",
ev_pointer, ev_integer, ev_entity, ev_pointer, ev_int, ev_entity,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_FLD_v6p] = {".", "loadb.fld", [OP_LOADB_FLD_v6p] = {".", "loadb.fld",
ev_pointer, ev_integer, ev_field, ev_pointer, ev_int, ev_field,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_FN_v6p] = {".", "loadb.fn", [OP_LOADB_FN_v6p] = {".", "loadb.fn",
ev_pointer, ev_integer, ev_func, ev_pointer, ev_int, ev_func,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_I_v6p] = {".", "loadb.i", [OP_LOADB_I_v6p] = {".", "loadb.i",
ev_pointer, ev_integer, ev_integer, ev_pointer, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
[OP_LOADB_P_v6p] = {".", "loadb.p", [OP_LOADB_P_v6p] = {".", "loadb.p",
ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int, ev_pointer,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb), %gc", "*(%Ga + %Gb), %gc",
}, },
@ -432,7 +432,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"*(%Ga + %sb), %gc", "*(%Ga + %sb), %gc",
}, },
[OP_LOADBI_I_v6p] = {".", "loadbi.i", [OP_LOADBI_I_v6p] = {".", "loadbi.i",
ev_pointer, ev_short, ev_integer, ev_pointer, ev_short, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %sb), %gc", "*(%Ga + %sb), %gc",
}, },
@ -494,7 +494,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_ADDRESS_I_v6p] = {"&", "address.i", [OP_ADDRESS_I_v6p] = {"&", "address.i",
ev_integer, ev_invalid, ev_pointer, ev_int, ev_invalid, ev_pointer,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
@ -505,7 +505,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_LEA_v6p] = {"&", "lea", [OP_LEA_v6p] = {"&", "lea",
ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int, ev_pointer,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"(%Ga + %Gb), %gc", "(%Ga + %Gb), %gc",
}, },
@ -516,22 +516,22 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_CONV_IF_v6p] = {"<CONV>", "conv.if", [OP_CONV_IF_v6p] = {"<CONV>", "conv.if",
ev_integer, ev_invalid, ev_float, ev_int, ev_invalid, ev_float,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_CONV_FI_v6p] = {"<CONV>", "conv.fi", [OP_CONV_FI_v6p] = {"<CONV>", "conv.fi",
ev_float, ev_invalid, ev_integer, ev_float, ev_invalid, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_CONV_ID_v6p] = {"<CONV>", "conv.id", [OP_CONV_ID_v6p] = {"<CONV>", "conv.id",
ev_integer, ev_invalid, ev_double, ev_int, ev_invalid, ev_double,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_CONV_DI_v6p] = {"<CONV>", "conv.di", [OP_CONV_DI_v6p] = {"<CONV>", "conv.di",
ev_double, ev_invalid, ev_integer, ev_double, ev_invalid, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
@ -587,7 +587,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga, %gb", "%Ga, %gb",
}, },
[OP_STORE_I_v6p] = {"=", "store.i", [OP_STORE_I_v6p] = {"=", "store.i",
ev_integer, ev_integer, ev_invalid, ev_int, ev_int, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gb", "%Ga, %gb",
}, },
@ -638,7 +638,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga, *%Gb", "%Ga, *%Gb",
}, },
[OP_STOREP_I_v6p] = {".=", "storep.i", [OP_STOREP_I_v6p] = {".=", "storep.i",
ev_integer, ev_pointer, ev_invalid, ev_int, ev_pointer, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *%Gb", "%Ga, *%Gb",
}, },
@ -649,52 +649,52 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_STOREB_D_v6p] = {".=", "storeb.d", [OP_STOREB_D_v6p] = {".=", "storeb.d",
ev_double, ev_pointer, ev_integer, ev_double, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_F_v6p] = {".=", "storeb.f", [OP_STOREB_F_v6p] = {".=", "storeb.f",
ev_float, ev_pointer, ev_integer, ev_float, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_V_v6p] = {".=", "storeb.v", [OP_STOREB_V_v6p] = {".=", "storeb.v",
ev_vector, ev_pointer, ev_integer, ev_vector, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_Q_v6p] = {".=", "storeb.q", [OP_STOREB_Q_v6p] = {".=", "storeb.q",
ev_quat, ev_pointer, ev_integer, ev_quat, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_S_v6p] = {".=", "storeb.s", [OP_STOREB_S_v6p] = {".=", "storeb.s",
ev_string, ev_pointer, ev_integer, ev_string, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_ENT_v6p] = {".=", "storeb.ent", [OP_STOREB_ENT_v6p] = {".=", "storeb.ent",
ev_entity, ev_pointer, ev_integer, ev_entity, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_FLD_v6p] = {".=", "storeb.fld", [OP_STOREB_FLD_v6p] = {".=", "storeb.fld",
ev_field, ev_pointer, ev_integer, ev_field, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_FN_v6p] = {".=", "storeb.fn", [OP_STOREB_FN_v6p] = {".=", "storeb.fn",
ev_func, ev_pointer, ev_integer, ev_func, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_I_v6p] = {".=", "storeb.i", [OP_STOREB_I_v6p] = {".=", "storeb.i",
ev_integer, ev_pointer, ev_integer, ev_int, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
[OP_STOREB_P_v6p] = {".=", "storeb.p", [OP_STOREB_P_v6p] = {".=", "storeb.p",
ev_pointer, ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %Gc)", "%Ga, *(%Gb + %Gc)",
}, },
@ -740,7 +740,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga, *(%Gb + %sc)", "%Ga, *(%Gb + %sc)",
}, },
[OP_STOREBI_I_v6p] = {".=", "storebi.i", [OP_STOREBI_I_v6p] = {".=", "storebi.i",
ev_integer, ev_pointer, ev_short, ev_int, ev_pointer, ev_short,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, *(%Gb + %sc)", "%Ga, *(%Gb + %sc)",
}, },
@ -763,73 +763,73 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_NOT_D_v6p] = {"!", "not.d", [OP_NOT_D_v6p] = {"!", "not.d",
ev_double, ev_invalid, ev_integer, ev_double, ev_invalid, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_NOT_F_v6p] = {"!", "not.f", [OP_NOT_F_v6p] = {"!", "not.f",
ev_float, ev_invalid, ev_integer, ev_float, ev_invalid, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_NOT_V_v6p] = {"!", "not.v", [OP_NOT_V_v6p] = {"!", "not.v",
ev_vector, ev_invalid, ev_integer, ev_vector, ev_invalid, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_NOT_Q_v6p] = {"!", "not.q", [OP_NOT_Q_v6p] = {"!", "not.q",
ev_quat, ev_invalid, ev_integer, ev_quat, ev_invalid, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_NOT_S_v6p] = {"!", "not.s", [OP_NOT_S_v6p] = {"!", "not.s",
ev_string, ev_invalid, ev_integer, ev_string, ev_invalid, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_NOT_ENT_v6p] = {"!", "not.ent", [OP_NOT_ENT_v6p] = {"!", "not.ent",
ev_entity, ev_invalid, ev_integer, ev_entity, ev_invalid, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_NOT_FN_v6p] = {"!", "not.fn", [OP_NOT_FN_v6p] = {"!", "not.fn",
ev_func, ev_invalid, ev_integer, ev_func, ev_invalid, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_NOT_P_v6p] = {"!", "not.p", [OP_NOT_P_v6p] = {"!", "not.p",
ev_pointer, ev_invalid, ev_integer, ev_pointer, ev_invalid, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_IF_v6p] = {"<IF>", "if", [OP_IF_v6p] = {"<IF>", "if",
ev_integer, ev_short, ev_invalid, ev_int, ev_short, ev_invalid,
PROG_ID_VERSION, PROG_ID_VERSION,
"%Ga branch %sb (%Ob)", "%Ga branch %sb (%Ob)",
}, },
[OP_IFNOT_v6p] = {"<IFNOT>", "ifnot", [OP_IFNOT_v6p] = {"<IFNOT>", "ifnot",
ev_integer, ev_short, ev_invalid, ev_int, ev_short, ev_invalid,
PROG_ID_VERSION, PROG_ID_VERSION,
"%Ga branch %sb (%Ob)", "%Ga branch %sb (%Ob)",
}, },
[OP_IFBE_v6p] = {"<IFBE>", "ifbe", [OP_IFBE_v6p] = {"<IFBE>", "ifbe",
ev_integer, ev_short, ev_invalid, ev_int, ev_short, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga branch %sb (%Ob)", "%Ga branch %sb (%Ob)",
}, },
[OP_IFB_v6p] = {"<IFB>", "ifb", [OP_IFB_v6p] = {"<IFB>", "ifb",
ev_integer, ev_short, ev_invalid, ev_int, ev_short, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga branch %sb (%Ob)", "%Ga branch %sb (%Ob)",
}, },
[OP_IFAE_v6p] = {"<IFAE>", "ifae", [OP_IFAE_v6p] = {"<IFAE>", "ifae",
ev_integer, ev_short, ev_invalid, ev_int, ev_short, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga branch %sb (%Ob)", "%Ga branch %sb (%Ob)",
}, },
[OP_IFA_v6p] = {"<IFA>", "ifa", [OP_IFA_v6p] = {"<IFA>", "ifa",
ev_integer, ev_short, ev_invalid, ev_int, ev_short, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga branch %sb (%Ob)", "%Ga branch %sb (%Ob)",
}, },
@ -944,22 +944,22 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"branch %sa (%Oa)", "branch %sa (%Oa)",
}, },
[OP_JUMP_v6p] = {"<JUMP>", "jump", [OP_JUMP_v6p] = {"<JUMP>", "jump",
ev_integer, ev_invalid, ev_invalid, ev_int, ev_invalid, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga", "%Ga",
}, },
[OP_JUMPB_v6p] = {"<JUMPB>", "jumpb", [OP_JUMPB_v6p] = {"<JUMPB>", "jumpb",
ev_void, ev_integer, ev_invalid, ev_void, ev_int, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga[%Gb]", "%Ga[%Gb]",
}, },
[OP_AND_v6p] = {"&&", "and.f", [OP_AND_v6p] = {"&&", "and.f",
ev_float, ev_float, ev_integer, ev_float, ev_float, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
[OP_OR_v6p] = {"||", "or.f", [OP_OR_v6p] = {"||", "or.f",
ev_float, ev_float, ev_integer, ev_float, ev_float, ev_int,
PROG_ID_VERSION, PROG_ID_VERSION,
}, },
@ -972,15 +972,15 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_SHL_I_v6p] = {"<<", "shl.i", [OP_SHL_I_v6p] = {"<<", "shl.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_SHR_I_v6p] = {">>", "shr.i", [OP_SHR_I_v6p] = {">>", "shr.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_SHR_U_v6p] = {">>", "shr.u", [OP_SHR_U_v6p] = {">>", "shr.u",
ev_uinteger, ev_integer, ev_uinteger, ev_uint, ev_int, ev_uint,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
@ -994,35 +994,35 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_ADD_I_v6p] = {"+", "add.i", [OP_ADD_I_v6p] = {"+", "add.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_SUB_I_v6p] = {"-", "sub.i", [OP_SUB_I_v6p] = {"-", "sub.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_MUL_I_v6p] = {"*", "mul.i", [OP_MUL_I_v6p] = {"*", "mul.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_DIV_I_v6p] = {"/", "div.i", [OP_DIV_I_v6p] = {"/", "div.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_REM_I_v6p] = {"%", "rem.i", [OP_REM_I_v6p] = {"%", "rem.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_MOD_I_v6p] = {"%%", "mod.i", [OP_MOD_I_v6p] = {"%%", "mod.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_BITAND_I_v6p] = {"&", "bitand.i", [OP_BITAND_I_v6p] = {"&", "bitand.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_BITOR_I_v6p] = {"|", "bitor.i", [OP_BITOR_I_v6p] = {"|", "bitor.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
@ -1037,58 +1037,58 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_GE_I_v6p] = {">=", "ge.i", [OP_GE_I_v6p] = {">=", "ge.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LE_I_v6p] = {"<=", "le.i", [OP_LE_I_v6p] = {"<=", "le.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_GT_I_v6p] = {">", "gt.i", [OP_GT_I_v6p] = {">", "gt.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LT_I_v6p] = {"<", "lt.i", [OP_LT_I_v6p] = {"<", "lt.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_AND_I_v6p] = {"&&", "and.i", [OP_AND_I_v6p] = {"&&", "and.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_OR_I_v6p] = {"||", "or.i", [OP_OR_I_v6p] = {"||", "or.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_NOT_I_v6p] = {"!", "not.i", [OP_NOT_I_v6p] = {"!", "not.i",
ev_integer, ev_invalid, ev_integer, ev_int, ev_invalid, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_EQ_I_v6p] = {"==", "eq.i", [OP_EQ_I_v6p] = {"==", "eq.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_NE_I_v6p] = {"!=", "ne.i", [OP_NE_I_v6p] = {"!=", "ne.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_GE_U_v6p] = {">=", "ge.u", [OP_GE_U_v6p] = {">=", "ge.u",
ev_uinteger, ev_uinteger, ev_integer, ev_uint, ev_uint, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LE_U_v6p] = {"<=", "le.u", [OP_LE_U_v6p] = {"<=", "le.u",
ev_uinteger, ev_uinteger, ev_integer, ev_uint, ev_uint, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_GT_U_v6p] = {">", "gt.u", [OP_GT_U_v6p] = {">", "gt.u",
ev_uinteger, ev_uinteger, ev_integer, ev_uint, ev_uint, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LT_U_v6p] = {"<", "lt.u", [OP_LT_U_v6p] = {"<", "lt.u",
ev_uinteger, ev_uinteger, ev_integer, ev_uint, ev_uint, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
@ -1102,37 +1102,37 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_BITXOR_I_v6p] = {"^", "bitxor.i", [OP_BITXOR_I_v6p] = {"^", "bitxor.i",
ev_integer, ev_integer, ev_integer, ev_int, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_BITNOT_I_v6p] = {"~", "bitnot.i", [OP_BITNOT_I_v6p] = {"~", "bitnot.i",
ev_integer, ev_invalid, ev_integer, ev_int, ev_invalid, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %gc", "%Ga, %gc",
}, },
[OP_GE_P_v6p] = {">=", "ge.p", [OP_GE_P_v6p] = {">=", "ge.p",
ev_pointer, ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LE_P_v6p] = {"<=", "le.p", [OP_LE_P_v6p] = {"<=", "le.p",
ev_pointer, ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_GT_P_v6p] = {">", "gt.p", [OP_GT_P_v6p] = {">", "gt.p",
ev_pointer, ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_LT_P_v6p] = {"<", "lt.p", [OP_LT_P_v6p] = {"<", "lt.p",
ev_pointer, ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_EQ_P_v6p] = {"==", "eq.p", [OP_EQ_P_v6p] = {"==", "eq.p",
ev_pointer, ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
[OP_NE_P_v6p] = {"!=", "ne.p", [OP_NE_P_v6p] = {"!=", "ne.p",
ev_pointer, ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
}, },
@ -1142,7 +1142,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga, %sb, %gc", "%Ga, %sb, %gc",
}, },
[OP_MOVEP_v6p] = {"<MOVEP>", "movep", [OP_MOVEP_v6p] = {"<MOVEP>", "movep",
ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int, ev_pointer,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %Gb, %Gc", "%Ga, %Gb, %Gc",
}, },
@ -1152,17 +1152,17 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga, %sb, %Gc", "%Ga, %sb, %Gc",
}, },
[OP_MEMSETI_v6p] = {"<MEMSET>", "memseti", [OP_MEMSETI_v6p] = {"<MEMSET>", "memseti",
ev_integer, ev_short, ev_void, ev_int, ev_short, ev_void,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %sb, %gc", "%Ga, %sb, %gc",
}, },
[OP_MEMSETP_v6p] = {"<MEMSETP>", "memsetp", [OP_MEMSETP_v6p] = {"<MEMSETP>", "memsetp",
ev_integer, ev_integer, ev_pointer, ev_int, ev_int, ev_pointer,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %Gb, %Gc", "%Ga, %Gb, %Gc",
}, },
[OP_MEMSETPI_v6p] = {"<MEMSETP>", "memsetpi", [OP_MEMSETPI_v6p] = {"<MEMSETP>", "memsetpi",
ev_integer, ev_short, ev_pointer, ev_int, ev_short, ev_pointer,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga, %sb, %Gc", "%Ga, %sb, %Gc",
}, },
@ -1208,7 +1208,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%Ga", "%Ga",
}, },
[OP_PUSH_I_v6p] = {"<PUSH>", "push.i", [OP_PUSH_I_v6p] = {"<PUSH>", "push.i",
ev_integer, ev_invalid, ev_invalid, ev_int, ev_invalid, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%Ga", "%Ga",
}, },
@ -1219,52 +1219,52 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_PUSHB_S_v6p] = {"<PUSH>", "pushb.s", [OP_PUSHB_S_v6p] = {"<PUSH>", "pushb.s",
ev_pointer, ev_integer, ev_string, ev_pointer, ev_int, ev_string,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_F_v6p] = {"<PUSH>", "pushb.f", [OP_PUSHB_F_v6p] = {"<PUSH>", "pushb.f",
ev_pointer, ev_integer, ev_float, ev_pointer, ev_int, ev_float,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_V_v6p] = {"<PUSH>", "pushb.v", [OP_PUSHB_V_v6p] = {"<PUSH>", "pushb.v",
ev_pointer, ev_integer, ev_vector, ev_pointer, ev_int, ev_vector,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_ENT_v6p] = {"<PUSH>", "pushb.ent", [OP_PUSHB_ENT_v6p] = {"<PUSH>", "pushb.ent",
ev_pointer, ev_integer, ev_entity, ev_pointer, ev_int, ev_entity,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_FLD_v6p] = {"<PUSH>", "pushb.fld", [OP_PUSHB_FLD_v6p] = {"<PUSH>", "pushb.fld",
ev_pointer, ev_integer, ev_field, ev_pointer, ev_int, ev_field,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_FN_v6p] = {"<PUSH>", "pushb.fn", [OP_PUSHB_FN_v6p] = {"<PUSH>", "pushb.fn",
ev_pointer, ev_integer, ev_func, ev_pointer, ev_int, ev_func,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_P_v6p] = {"<PUSH>", "pushb.p", [OP_PUSHB_P_v6p] = {"<PUSH>", "pushb.p",
ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int, ev_pointer,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_Q_v6p] = {"<PUSH>", "pushb.q", [OP_PUSHB_Q_v6p] = {"<PUSH>", "pushb.q",
ev_pointer, ev_integer, ev_quat, ev_pointer, ev_int, ev_quat,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_I_v6p] = {"<PUSH>", "pushb.i", [OP_PUSHB_I_v6p] = {"<PUSH>", "pushb.i",
ev_pointer, ev_integer, ev_integer, ev_pointer, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_PUSHB_D_v6p] = {"<PUSH>", "pushb.d", [OP_PUSHB_D_v6p] = {"<PUSH>", "pushb.d",
ev_pointer, ev_integer, ev_double, ev_pointer, ev_int, ev_double,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
@ -1310,7 +1310,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"*(%Ga + %sb)", "*(%Ga + %sb)",
}, },
[OP_PUSHBI_I_v6p] = {"<PUSH>", "pushbi.i", [OP_PUSHBI_I_v6p] = {"<PUSH>", "pushbi.i",
ev_pointer, ev_short, ev_integer, ev_pointer, ev_short, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %sb)", "*(%Ga + %sb)",
}, },
@ -1361,7 +1361,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"%ga", "%ga",
}, },
[OP_POP_I_v6p] = {"<POP>", "pop.i", [OP_POP_I_v6p] = {"<POP>", "pop.i",
ev_integer, ev_invalid, ev_invalid, ev_int, ev_invalid, ev_invalid,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"%ga", "%ga",
}, },
@ -1372,52 +1372,52 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
}, },
[OP_POPB_S_v6p] = {"<POP>", "popb.s", [OP_POPB_S_v6p] = {"<POP>", "popb.s",
ev_pointer, ev_integer, ev_string, ev_pointer, ev_int, ev_string,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_F_v6p] = {"<POP>", "popb.f", [OP_POPB_F_v6p] = {"<POP>", "popb.f",
ev_pointer, ev_integer, ev_float, ev_pointer, ev_int, ev_float,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_V_v6p] = {"<POP>", "popb.v", [OP_POPB_V_v6p] = {"<POP>", "popb.v",
ev_pointer, ev_integer, ev_vector, ev_pointer, ev_int, ev_vector,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_ENT_v6p] = {"<POP>", "popb.ent", [OP_POPB_ENT_v6p] = {"<POP>", "popb.ent",
ev_pointer, ev_integer, ev_entity, ev_pointer, ev_int, ev_entity,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_FLD_v6p] = {"<POP>", "popb.fld", [OP_POPB_FLD_v6p] = {"<POP>", "popb.fld",
ev_pointer, ev_integer, ev_field, ev_pointer, ev_int, ev_field,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_FN_v6p] = {"<POP>", "popb.fn", [OP_POPB_FN_v6p] = {"<POP>", "popb.fn",
ev_pointer, ev_integer, ev_func, ev_pointer, ev_int, ev_func,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_P_v6p] = {"<POP>", "popb.p", [OP_POPB_P_v6p] = {"<POP>", "popb.p",
ev_pointer, ev_integer, ev_pointer, ev_pointer, ev_int, ev_pointer,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_Q_v6p] = {"<POP>", "popb.q", [OP_POPB_Q_v6p] = {"<POP>", "popb.q",
ev_pointer, ev_integer, ev_quat, ev_pointer, ev_int, ev_quat,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_I_v6p] = {"<POP>", "popb.i", [OP_POPB_I_v6p] = {"<POP>", "popb.i",
ev_pointer, ev_integer, ev_integer, ev_pointer, ev_int, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
[OP_POPB_D_v6p] = {"<POP>", "popb.d", [OP_POPB_D_v6p] = {"<POP>", "popb.d",
ev_pointer, ev_integer, ev_double, ev_pointer, ev_int, ev_double,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %Gb)", "*(%Ga + %Gb)",
}, },
@ -1463,7 +1463,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
"*(%Ga + %sb)", "*(%Ga + %sb)",
}, },
[OP_POPBI_I_v6p] = {"<POP>", "popbi.i", [OP_POPBI_I_v6p] = {"<POP>", "popbi.i",
ev_pointer, ev_short, ev_integer, ev_pointer, ev_short, ev_int,
PROG_V6P_VERSION, PROG_V6P_VERSION,
"*(%Ga + %sb)", "*(%Ga + %sb)",
}, },
@ -1652,7 +1652,7 @@ PR_Check_Opcodes (progs_t *pr)
break; break;
case OP_DONE_v6p: case OP_DONE_v6p:
case OP_RETURN_v6p: case OP_RETURN_v6p:
check_global (pr, st, op, ev_integer, st->a, 1); check_global (pr, st, op, ev_int, st->a, 1);
check_global (pr, st, op, ev_void, st->b, 0); check_global (pr, st, op, ev_void, st->b, 0);
check_global (pr, st, op, ev_void, st->c, 0); check_global (pr, st, op, ev_void, st->c, 0);
break; break;
@ -1666,8 +1666,8 @@ PR_Check_Opcodes (progs_t *pr)
case OP_RCALL7_v6p: case OP_RCALL7_v6p:
case OP_RCALL8_v6p: case OP_RCALL8_v6p:
if (st_op > OP_RCALL1_v6p) if (st_op > OP_RCALL1_v6p)
check_global (pr, st, op, ev_integer, st->c, 1); check_global (pr, st, op, ev_int, st->c, 1);
check_global (pr, st, op, ev_integer, st->b, 1); check_global (pr, st, op, ev_int, st->b, 1);
check_global (pr, st, op, ev_func, st->a, 1); check_global (pr, st, op, ev_func, st->a, 1);
break; break;
case OP_STATE_v6p: case OP_STATE_v6p:

View file

@ -86,7 +86,7 @@ bi_gib_builtin_f (void)
pr_list = PR_Zone_Malloc (builtin->pr, GIB_Argc() * sizeof (pr_type_t)); pr_list = PR_Zone_Malloc (builtin->pr, GIB_Argc() * sizeof (pr_type_t));
for (i = 0; i < GIB_Argc(); i++) for (i = 0; i < GIB_Argc(); i++)
pr_list[i].integer_var = PR_SetTempString (builtin->pr, GIB_Argv(i)); pr_list[i].int_var = PR_SetTempString (builtin->pr, GIB_Argv(i));
PR_RESET_PARAMS (builtin->pr); PR_RESET_PARAMS (builtin->pr);
P_INT (builtin->pr, 0) = GIB_Argc(); P_INT (builtin->pr, 0) = GIB_Argc();

View file

@ -295,7 +295,7 @@ PF_Find (progs_t *pr)
continue; continue;
RETURN_EDICT (pr, ed); RETURN_EDICT (pr, ed);
return; return;
case ev_integer: case ev_int:
case ev_entity: case ev_entity:
if (P_INT (pr, 2) != E_INT (ed, f)) if (P_INT (pr, 2) != E_INT (ed, f))
continue; continue;
@ -420,7 +420,7 @@ PF_nextent (progs_t *pr)
#endif #endif
/* /*
integer (float f) ftoi int (float f) ftoi
*/ */
static void static void
PF_ftoi (progs_t *pr) PF_ftoi (progs_t *pr)
@ -453,7 +453,7 @@ PF_ftos (progs_t *pr)
} }
/* /*
float (integer i) itof float (int i) itof
*/ */
static void static void
PF_itof (progs_t *pr) PF_itof (progs_t *pr)
@ -462,7 +462,7 @@ PF_itof (progs_t *pr)
} }
/* /*
string (integer i) itos string (int i) itos
*/ */
static void static void
PF_itos (progs_t *pr) PF_itos (progs_t *pr)
@ -484,7 +484,7 @@ PF_stof (progs_t *pr)
} }
/* /*
integer (string s) stoi int (string s) stoi
*/ */
static void static void
PF_stoi (progs_t *pr) PF_stoi (progs_t *pr)

View file

@ -259,7 +259,7 @@ bi_Hash_FindList (progs_t *pr)
pr_list = PR_Zone_Malloc (pr, count * sizeof (pr_type_t)); pr_list = PR_Zone_Malloc (pr, count * sizeof (pr_type_t));
// the hash tables stores progs pointers... // the hash tables stores progs pointers...
for (count = 0, l = list; *l; l++) for (count = 0, l = list; *l; l++)
pr_list[count++].integer_var = (intptr_t) *l; pr_list[count++].int_var = (intptr_t) *l;
free (list); free (list);
RETURN_POINTER (pr, pr_list); RETURN_POINTER (pr, pr_list);
} }
@ -278,7 +278,7 @@ bi_Hash_FindElementList (progs_t *pr)
pr_list = PR_Zone_Malloc (pr, count * sizeof (pr_type_t)); pr_list = PR_Zone_Malloc (pr, count * sizeof (pr_type_t));
// the hash tables stores progs pointers... // the hash tables stores progs pointers...
for (count = 0, l = list; *l; l++) for (count = 0, l = list; *l; l++)
pr_list[count++].integer_var = (intptr_t) *l; pr_list[count++].int_var = (intptr_t) *l;
free (list); free (list);
RETURN_POINTER (pr, pr_list); RETURN_POINTER (pr, pr_list);
} }
@ -334,7 +334,7 @@ bi_Hash_GetList (progs_t *pr)
pr_list = PR_Zone_Malloc (pr, count * sizeof (pr_type_t)); pr_list = PR_Zone_Malloc (pr, count * sizeof (pr_type_t));
// the hash tables stores progs pointers... // the hash tables stores progs pointers...
for (count = 0, l = list; *l; l++) for (count = 0, l = list; *l; l++)
pr_list[count++].integer_var = (intptr_t) *l; pr_list[count++].int_var = (intptr_t) *l;
free (list); free (list);
RETURN_POINTER (pr, pr_list); RETURN_POINTER (pr, pr_list);
} }

View file

@ -1444,21 +1444,21 @@ static void
rua_obj_increment_retaincount (progs_t *pr) rua_obj_increment_retaincount (progs_t *pr)
{ {
pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0); pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0);
R_INT (pr) = ++(*--obj).integer_var; R_INT (pr) = ++(*--obj).int_var;
} }
static void static void
rua_obj_decrement_retaincount (progs_t *pr) rua_obj_decrement_retaincount (progs_t *pr)
{ {
pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0); pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0);
R_INT (pr) = --(*--obj).integer_var; R_INT (pr) = --(*--obj).int_var;
} }
static void static void
rua_obj_get_retaincount (progs_t *pr) rua_obj_get_retaincount (progs_t *pr)
{ {
pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0); pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0);
R_INT (pr) = (*--obj).integer_var; R_INT (pr) = (*--obj).int_var;
} }
static void static void

View file

@ -77,7 +77,7 @@ static string get_type_key (void *type, void *unused)
-(string) name -(string) name
{ {
if (type.meta == ty_basic) { if (type.meta == ty_basic) {
if (type.type == ev_integer) { if (type.type == ev_int) {
return "int"; return "int";
} }
return pr_type_name[type.type]; return pr_type_name[type.type];
@ -123,7 +123,7 @@ static string get_type_key (void *type, void *unused)
-(string) parseData -(string) parseData
{ {
if (type.meta == ty_basic) { if (type.meta == ty_basic) {
if (type.type == ev_integer) { if (type.type == ev_int) {
return "&cexpr_int"; return "&cexpr_int";
} }
return "&cexpr_" + pr_type_name[type.type]; return "&cexpr_" + pr_type_name[type.type];

View file

@ -187,7 +187,7 @@ extern progs_t sv_pr_state;
#define SVfunc(e,f) SVFIELD (e, f, func) #define SVfunc(e,f) SVFIELD (e, f, func)
#define SVentity(e,f) SVFIELD (e, f, entity) #define SVentity(e,f) SVFIELD (e, f, entity)
#define SVvector(e,f) (&SVFIELD (e, f, vector)) #define SVvector(e,f) (&SVFIELD (e, f, vector))
#define SVinteger(e,f) SVFIELD (e, f, integer) #define SVint(e,f) SVFIELD (e, f, int)
#if TYPECHECK_PROGS #if TYPECHECK_PROGS
#define SVdouble(e,f) E_DOUBLE (e, PR_AccessField (&sv_pr_state, #f, ev_##t, __FILE__, __LINE__)) #define SVdouble(e,f) E_DOUBLE (e, PR_AccessField (&sv_pr_state, #f, ev_##t, __FILE__, __LINE__))
#else #else

View file

@ -323,7 +323,7 @@ static sv_def_t nq_opt_funcs[] = {
}; };
static sv_def_t nq_opt_fields[] = { static sv_def_t nq_opt_fields[] = {
{ev_integer, 0, "rotated_bbox", &sv_fields.rotated_bbox}, {ev_int, 0, "rotated_bbox", &sv_fields.rotated_bbox},
{ev_float, 0, "alpha", &sv_fields.alpha}, {ev_float, 0, "alpha", &sv_fields.alpha},
{ev_float, 0, "gravity", &sv_fields.gravity}, {ev_float, 0, "gravity", &sv_fields.gravity},
{ev_float, 0, "items2", &sv_fields.items2}, {ev_float, 0, "items2", &sv_fields.items2},
@ -355,8 +355,8 @@ set_address (sv_def_t *def, void *address)
case ev_field: case ev_field:
case ev_func: case ev_func:
case ev_pointer: case ev_pointer:
case ev_integer: case ev_int:
case ev_uinteger: case ev_uint:
*(pr_int_t **)def->field = (pr_int_t *) address; *(pr_int_t **)def->field = (pr_int_t *) address;
break; break;
case ev_long: case ev_long:

View file

@ -215,7 +215,7 @@ SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs,
vec3_t hullmins, hullmaxs, size; vec3_t hullmins, hullmaxs, size;
if ((sv_fields.rotated_bbox != -1 if ((sv_fields.rotated_bbox != -1
&& SVinteger (ent, rotated_bbox)) && SVint (ent, rotated_bbox))
|| SVfloat (ent, solid) == SOLID_BSP) { || SVfloat (ent, solid) == SOLID_BSP) {
VectorSubtract (maxs, mins, size); VectorSubtract (maxs, mins, size);
if (size[0] < 3) if (size[0] < 3)
@ -226,8 +226,8 @@ SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs,
hull_index = 2; hull_index = 2;
} }
if (sv_fields.rotated_bbox != -1 if (sv_fields.rotated_bbox != -1
&& SVinteger (ent, rotated_bbox)) { && SVint (ent, rotated_bbox)) {
int h = SVinteger (ent, rotated_bbox) - 1; int h = SVint (ent, rotated_bbox) - 1;
hull_list = pf_hull_list[h]->hulls; hull_list = pf_hull_list[h]->hulls;
} if (SVfloat (ent, solid) == SOLID_BSP) { } if (SVfloat (ent, solid) == SOLID_BSP) {
// explicit hulls in the BSP model // explicit hulls in the BSP model

View file

@ -194,7 +194,7 @@ extern progs_t sv_pr_state;
#define SVfunc(e,f) SVFIELD (e, f, func) #define SVfunc(e,f) SVFIELD (e, f, func)
#define SVentity(e,f) SVFIELD (e, f, entity) #define SVentity(e,f) SVFIELD (e, f, entity)
#define SVvector(e,f) (&SVFIELD (e, f, vector)) #define SVvector(e,f) (&SVFIELD (e, f, vector))
#define SVinteger(e,f) SVFIELD (e, f, integer) #define SVint(e,f) SVFIELD (e, f, int)
#if TYPECHECK_PROGS #if TYPECHECK_PROGS
#define SVdouble(e,f) E_DOUBLE (e, PR_AccessField (&sv_pr_state, #f, ev_##t, __FILE__, __LINE__)) #define SVdouble(e,f) E_DOUBLE (e, PR_AccessField (&sv_pr_state, #f, ev_##t, __FILE__, __LINE__))
#else #else

View file

@ -352,7 +352,7 @@ static sv_def_t qw_opt_funcs[] = {
}; };
static sv_def_t qw_opt_fields[] = { static sv_def_t qw_opt_fields[] = {
{ev_integer, 0, "rotated_bbox", &sv_fields.rotated_bbox}, {ev_int, 0, "rotated_bbox", &sv_fields.rotated_bbox},
{ev_float, 0, "alpha", &sv_fields.alpha}, {ev_float, 0, "alpha", &sv_fields.alpha},
{ev_float, 0, "scale", &sv_fields.scale}, {ev_float, 0, "scale", &sv_fields.scale},
{ev_float, 0, "glow_size", &sv_fields.glow_size}, {ev_float, 0, "glow_size", &sv_fields.glow_size},
@ -388,8 +388,8 @@ set_address (sv_def_t *def, void *address)
case ev_field: case ev_field:
case ev_func: case ev_func:
case ev_pointer: case ev_pointer:
case ev_integer: case ev_int:
case ev_uinteger: case ev_uint:
*(pr_int_t **)def->field = (pr_int_t *) address; *(pr_int_t **)def->field = (pr_int_t *) address;
break; break;
case ev_long: case ev_long:

View file

@ -1548,8 +1548,8 @@ AddLinksToPmove (areanode_t *node)
pe->info = NUM_FOR_EDICT (&sv_pr_state, check); pe->info = NUM_FOR_EDICT (&sv_pr_state, check);
if (sv_fields.rotated_bbox != -1 if (sv_fields.rotated_bbox != -1
&& SVinteger (check, rotated_bbox)) { && SVint (check, rotated_bbox)) {
int h = SVinteger (check, rotated_bbox) - 1; int h = SVint (check, rotated_bbox) - 1;
pe->hull = pf_hull_list[h]->hulls[1]; pe->hull = pf_hull_list[h]->hulls[1];
} else { } else {

View file

@ -215,7 +215,7 @@ SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs,
vec3_t hullmins, hullmaxs, size; vec3_t hullmins, hullmaxs, size;
if ((sv_fields.rotated_bbox != -1 if ((sv_fields.rotated_bbox != -1
&& SVinteger (ent, rotated_bbox)) && SVint (ent, rotated_bbox))
|| SVfloat (ent, solid) == SOLID_BSP) { || SVfloat (ent, solid) == SOLID_BSP) {
VectorSubtract (maxs, mins, size); VectorSubtract (maxs, mins, size);
if (size[0] < 3) if (size[0] < 3)
@ -226,8 +226,8 @@ SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs,
hull_index = 2; hull_index = 2;
} }
if (sv_fields.rotated_bbox != -1 if (sv_fields.rotated_bbox != -1
&& SVinteger (ent, rotated_bbox)) { && SVint (ent, rotated_bbox)) {
int h = SVinteger (ent, rotated_bbox) - 1; int h = SVint (ent, rotated_bbox) - 1;
hull_list = pf_hull_list[h]->hulls; hull_list = pf_hull_list[h]->hulls;
} if (SVfloat (ent, solid) == SOLID_BSP) { } if (SVfloat (ent, solid) == SOLID_BSP) {
// explicit hulls in the BSP model // explicit hulls in the BSP model

View file

@ -84,7 +84,7 @@ class_from_plist (PLDictionary *pldict)
if (str_str (paramstr, ".") >= 0) if (str_str (paramstr, ".") >= 0)
va_list.list[j].float_val = stof (paramstr); va_list.list[j].float_val = stof (paramstr);
else else
va_list.list[j].integer_val = stoi (paramstr); va_list.list[j].int_val = stoi (paramstr);
break; break;
} }
} }

View file

@ -11,8 +11,8 @@ typedef enum {
ev_func, ev_func,
ev_pointer, // end of v6 types ev_pointer, // end of v6 types
ev_quat, ev_quat,
ev_integer, ev_int,
ev_uinteger, ev_uint,
ev_short, // value is embedded in the opcode ev_short, // value is embedded in the opcode
ev_double, ev_double,

View file

@ -221,7 +221,7 @@ error:
break; break;
case ty_enum: case ty_enum:
// enums are ints // enums are ints
size = pr_type_size[ev_integer]; size = pr_type_size[ev_int];
break; break;
case ty_class: case ty_class:
//FIXME //FIXME

View file

@ -201,8 +201,8 @@ typedef struct ex_value_s {
ex_func_t func_val; ///< function constant ex_func_t func_val; ///< function constant
ex_pointer_t pointer; ///< pointer constant ex_pointer_t pointer; ///< pointer constant
float quaternion_val[4]; ///< quaternion constant float quaternion_val[4]; ///< quaternion constant
int integer_val; ///< integer constant int int_val; ///< int constant
unsigned uinteger_val; ///< unsigned integer constant unsigned uint_val; ///< unsigned int constant
short short_val; ///< short constant short short_val; ///< short constant
} v; } v;
} ex_value_t; } ex_value_t;
@ -571,23 +571,23 @@ expr_t *new_pointer_expr (int val, struct type_s *type, struct def_s *def);
expr_t *new_quaternion_expr (const float *quaternion_val); expr_t *new_quaternion_expr (const float *quaternion_val);
const float *expr_quaternion (expr_t *e) __attribute__((pure)); const float *expr_quaternion (expr_t *e) __attribute__((pure));
/** Create a new integer constant expression node. /** Create a new itn constant expression node.
\param integer_val The integer constant being represented. \param int_val The int constant being represented.
\return The new integer constant expression node \return The new int constant expression node
(expr_t::e::integer_val). (expr_t::e::int_val).
*/ */
expr_t *new_integer_expr (int integer_val); expr_t *new_int_expr (int int_val);
int expr_integer (expr_t *e) __attribute__((pure)); int expr_int (expr_t *e) __attribute__((pure));
/** Create a new integer constant expression node. /** Create a new int constant expression node.
\param uinteger_val The integer constant being represented. \param uint_val The int constant being represented.
\return The new integer constant expression node \return The new int constant expression node
(expr_t::e::integer_val). (expr_t::e::int_val).
*/ */
expr_t *new_uinteger_expr (unsigned uinteger_val); expr_t *new_uint_expr (unsigned uint_val);
unsigned expr_uinteger (expr_t *e) __attribute__((pure)); unsigned expr_uint (expr_t *e) __attribute__((pure));
/** Create a new short constant expression node. /** Create a new short constant expression node.
@ -652,8 +652,8 @@ int is_string_val (expr_t *e) __attribute__((pure));
int is_float_val (expr_t *e) __attribute__((pure)); int is_float_val (expr_t *e) __attribute__((pure));
int is_vector_val (expr_t *e) __attribute__((pure)); int is_vector_val (expr_t *e) __attribute__((pure));
int is_quaternion_val (expr_t *e) __attribute__((pure)); int is_quaternion_val (expr_t *e) __attribute__((pure));
int is_integer_val (expr_t *e) __attribute__((pure)); int is_int_val (expr_t *e) __attribute__((pure));
int is_uinteger_val (expr_t *e) __attribute__((pure)); int is_uint_val (expr_t *e) __attribute__((pure));
int is_short_val (expr_t *e) __attribute__((pure)); int is_short_val (expr_t *e) __attribute__((pure));
int is_integral_val (expr_t *e) __attribute__((pure)); int is_integral_val (expr_t *e) __attribute__((pure));
int is_pointer_val (expr_t *e) __attribute__((pure)); int is_pointer_val (expr_t *e) __attribute__((pure));

View file

@ -334,10 +334,10 @@ enum {
*/ */
#define QFO_FLOAT(q, s, o) QFO_var (q, s, float, o) #define QFO_FLOAT(q, s, o) QFO_var (q, s, float, o)
/** Access a integer variable in the object file. Can be assigned to. /** Access a int variable in the object file. Can be assigned to.
\par QC type: \par QC type:
\c integer \c int
\param q pointer to ::qfo_t struct \param q pointer to ::qfo_t struct
\param s space index \param s space index
\param o offset into object file data space \param o offset into object file data space
@ -345,7 +345,7 @@ enum {
\hideinitializer \hideinitializer
*/ */
#define QFO_INT(q, s, o) QFO_var (q, s, integer, o) #define QFO_INT(q, s, o) QFO_var (q, s, int, o)
/** Access a vector variable in the object file. Can be assigned to. /** Access a vector variable in the object file. Can be assigned to.
@ -438,7 +438,7 @@ enum {
\hideinitializer \hideinitializer
*/ */
#define QFO_POINTER(q, s, t, o) ((t *)(char *)&QFO_var (q, s, integer, o)) #define QFO_POINTER(q, s, t, o) ((t *)(char *)&QFO_var (q, s, int, o))
/** Access a structure variable in the object file. Can be assigned to. /** Access a structure variable in the object file. Can be assigned to.

View file

@ -100,7 +100,7 @@ extern pr_info_t pr;
#define D_var(t, d) ((d)->space->data[(d)->offset].t##_var) #define D_var(t, d) ((d)->space->data[(d)->offset].t##_var)
#define D_DOUBLE(d) (*(double *) ((d)->space->data + (d)->offset)) #define D_DOUBLE(d) (*(double *) ((d)->space->data + (d)->offset))
#define D_FLOAT(d) D_var (float, d) #define D_FLOAT(d) D_var (float, d)
#define D_INT(d) D_var (integer, d) #define D_INT(d) D_var (int, d)
#define D_VECTOR(d) (&D_var (vector, d)) #define D_VECTOR(d) (&D_var (vector, d))
#define D_QUAT(d) (&D_var (quat, d)) #define D_QUAT(d) (&D_var (quat, d))
#define D_STRING(d) D_var (string, d) #define D_STRING(d) D_var (string, d)

View file

@ -108,8 +108,8 @@ extern type_t type_function;
extern type_t type_pointer; extern type_t type_pointer;
extern type_t type_floatfield; extern type_t type_floatfield;
extern type_t type_quaternion; extern type_t type_quaternion;
extern type_t type_integer; extern type_t type_int;
extern type_t type_uinteger; extern type_t type_uint;
extern type_t type_short; extern type_t type_short;
extern type_t *type_nil; // for passing nil into ... extern type_t *type_nil; // for passing nil into ...
@ -161,8 +161,8 @@ void encode_type (struct dstring_s *encoding, const type_t *type);
const char *type_get_encoding (const type_t *type); const char *type_get_encoding (const type_t *type);
int is_void (const type_t *type) __attribute__((pure)); int is_void (const type_t *type) __attribute__((pure));
int is_enum (const type_t *type) __attribute__((pure)); int is_enum (const type_t *type) __attribute__((pure));
int is_integer (const type_t *type) __attribute__((pure)); int is_int (const type_t *type) __attribute__((pure));
int is_uinteger (const type_t *type) __attribute__((pure)); int is_uint (const type_t *type) __attribute__((pure));
int is_short (const type_t *type) __attribute__((pure)); int is_short (const type_t *type) __attribute__((pure));
int is_integral (const type_t *type) __attribute__((pure)); int is_integral (const type_t *type) __attribute__((pure));
int is_double (const type_t *type) __attribute__((pure)); int is_double (const type_t *type) __attribute__((pure));

View file

@ -53,8 +53,8 @@ struct ex_value_s *new_pointer_val (int val, struct type_s *type,
struct def_s *def, struct def_s *def,
struct operand_s *tempop); struct operand_s *tempop);
struct ex_value_s *new_quaternion_val (const float *quaternion_val); struct ex_value_s *new_quaternion_val (const float *quaternion_val);
struct ex_value_s *new_integer_val (int integer_val); struct ex_value_s *new_int_val (int int_val);
struct ex_value_s *new_uinteger_val (int uinteger_val); struct ex_value_s *new_uint_val (int uint_val);
struct ex_value_s *new_short_val (short short_val); struct ex_value_s *new_short_val (short short_val);
struct ex_value_s *new_nil_val (struct type_s *type); struct ex_value_s *new_nil_val (struct type_s *type);

View file

@ -132,7 +132,7 @@ static struct_def_t category_struct[] = {
static struct_def_t ivar_struct[] = { static struct_def_t ivar_struct[] = {
{"ivar_name", &type_string}, {"ivar_name", &type_string},
{"ivar_type", &type_string}, {"ivar_type", &type_string},
{"ivar_offset", &type_integer}, {"ivar_offset", &type_int},
{0, 0} {0, 0}
}; };
@ -143,8 +143,8 @@ static struct_def_t super_struct[] = {
}; };
static struct_def_t module_struct[] = { static struct_def_t module_struct[] = {
{"version", &type_integer}, {"version", &type_int},
{"size", &type_integer}, {"size", &type_int},
{"name", &type_string}, {"name", &type_string},
{"symtab", &type_pointer}, {"symtab", &type_pointer},
{0, 0} {0, 0}
@ -154,9 +154,9 @@ static struct_def_t class_struct[] = {
{"class_pointer", &type_Class}, {"class_pointer", &type_Class},
{"super_class", &type_Class}, {"super_class", &type_Class},
{"name", &type_string}, {"name", &type_string},
{"version", &type_integer}, {"version", &type_int},
{"info", &type_integer}, {"info", &type_int},
{"instance_size", &type_integer}, {"instance_size", &type_int},
{"ivars", &type_pointer}, {"ivars", &type_pointer},
{"methods", &type_pointer}, {"methods", &type_pointer},
{"dtable", &type_pointer}, {"dtable", &type_pointer},
@ -729,8 +729,8 @@ emit_ivar_count (def_t *def, void *data, int index)
{ {
ivar_data_t *ivar_data = (ivar_data_t *) data; ivar_data_t *ivar_data = (ivar_data_t *) data;
if (!is_integer(def->type)) if (!is_int(def->type))
internal_error (0, "%s: expected integer def", __FUNCTION__); internal_error (0, "%s: expected int def", __FUNCTION__);
D_INT (def) = ivar_data->count; D_INT (def) = ivar_data->count;
} }
@ -774,8 +774,8 @@ static def_t *
emit_ivars (symtab_t *ivars, const char *name) emit_ivars (symtab_t *ivars, const char *name)
{ {
static struct_def_t ivar_list_struct[] = { static struct_def_t ivar_list_struct[] = {
{"ivar_count", &type_integer, emit_ivar_count}, {"ivar_count", &type_int, emit_ivar_count},
{"ivar_list", 0, emit_ivar_list_item}, {"ivar_list", 0, emit_ivar_list_item},
{0, 0} {0, 0}
}; };
ivar_data_t ivar_data = {0, 0, 0}; ivar_data_t ivar_data = {0, 0, 0};
@ -1411,8 +1411,8 @@ emit_symtab_ref_cnt (def_t *def, void *data, int index)
{ {
obj_symtab_data_t *da = (obj_symtab_data_t *)data; obj_symtab_data_t *da = (obj_symtab_data_t *)data;
if (!is_integer(def->type)) if (!is_int(def->type))
internal_error (0, "%s: expected integer def", __FUNCTION__); internal_error (0, "%s: expected int def", __FUNCTION__);
D_INT (def) = 0; D_INT (def) = 0;
if (da->refs) if (da->refs)
D_INT (def) = da->refs->type->t.array.size; D_INT (def) = da->refs->type->t.array.size;
@ -1435,8 +1435,8 @@ emit_symtab_cls_def_cnt (def_t *def, void *data, int index)
{ {
obj_symtab_data_t *da = (obj_symtab_data_t *)data; obj_symtab_data_t *da = (obj_symtab_data_t *)data;
if (!is_integer(def->type)) if (!is_int(def->type))
internal_error (0, "%s: expected integer def", __FUNCTION__); internal_error (0, "%s: expected int def", __FUNCTION__);
D_INT (def) = da->cls_def_cnt; D_INT (def) = da->cls_def_cnt;
} }
@ -1445,8 +1445,8 @@ emit_symtab_cat_def_cnt (def_t *def, void *data, int index)
{ {
obj_symtab_data_t *da = (obj_symtab_data_t *)data; obj_symtab_data_t *da = (obj_symtab_data_t *)data;
if (!is_integer(def->type)) if (!is_int(def->type))
internal_error (0, "%s: expected integer def", __FUNCTION__); internal_error (0, "%s: expected int def", __FUNCTION__);
D_INT (def) = da->cat_def_cnt; D_INT (def) = da->cat_def_cnt;
} }
@ -1489,11 +1489,11 @@ void
class_finish_module (void) class_finish_module (void)
{ {
static struct_def_t symtab_struct[] = { static struct_def_t symtab_struct[] = {
{"sel_ref_cnt", &type_integer, emit_symtab_ref_cnt}, {"sel_ref_cnt", &type_int, emit_symtab_ref_cnt},
{"refs", &type_SEL, emit_symtab_refs}, {"refs", &type_SEL, emit_symtab_refs},
{"cls_def_cnt", &type_integer, emit_symtab_cls_def_cnt}, {"cls_def_cnt", &type_int, emit_symtab_cls_def_cnt},
{"cat_def_cnt", &type_integer, emit_symtab_cat_def_cnt}, {"cat_def_cnt", &type_int, emit_symtab_cat_def_cnt},
{"defs", 0, emit_symtab_defs}, {"defs", 0, emit_symtab_defs},
{0, 0} {0, 0}
}; };
@ -1750,8 +1750,8 @@ emit_protocol_count (def_t *def, void *data, int index)
{ {
protocollist_t *protocols = (protocollist_t *) data; protocollist_t *protocols = (protocollist_t *) data;
if (!is_integer(def->type)) { if (!is_int(def->type)) {
internal_error (0, "%s: expected integer def", __FUNCTION__); internal_error (0, "%s: expected int def", __FUNCTION__);
} }
D_INT (def) = protocols->count; D_INT (def) = protocols->count;
} }
@ -1777,7 +1777,7 @@ emit_protocol_list (protocollist_t *protocols, const char *name)
{ {
static struct_def_t proto_list_struct[] = { static struct_def_t proto_list_struct[] = {
{"next", &type_pointer, emit_protocol_next}, {"next", &type_pointer, emit_protocol_next},
{"count", &type_integer, emit_protocol_count}, {"count", &type_int, emit_protocol_count},
{"list", 0, emit_protocol_list_item}, {"list", 0, emit_protocol_list_item},
{0, 0}, {0, 0},
}; };

View file

@ -76,7 +76,7 @@ cmp_result_expr (int result)
if (is_float (type_default)) { if (is_float (type_default)) {
return new_float_expr (result); return new_float_expr (result);
} else { } else {
return new_integer_expr(result); return new_int_expr(result);
} }
} }
@ -92,7 +92,7 @@ do_op_string (int op, expr_t *e, expr_t *e1, expr_t *e2)
if (is_compare (op) || is_logic (op)) { if (is_compare (op) || is_logic (op)) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
else else
e->e.expr.type = &type_float; e->e.expr.type = &type_float;
} else { } else {
@ -153,7 +153,7 @@ convert_to_float (expr_t *e)
switch (e->type) { switch (e->type) {
case ex_value: case ex_value:
switch (e->e.value->lltype) { switch (e->e.value->lltype) {
case ev_integer: case ev_int:
convert_int (e); convert_int (e);
return e; return e;
case ev_short: case ev_short:
@ -188,8 +188,8 @@ convert_to_double (expr_t *e)
switch (e->type) { switch (e->type) {
case ex_value: case ex_value:
switch (e->e.value->lltype) { switch (e->e.value->lltype) {
case ev_integer: case ev_int:
e->e.value = new_double_val (expr_integer (e)); e->e.value = new_double_val (expr_int (e));
return e; return e;
case ev_short: case ev_short:
e->e.value = new_double_val (expr_short (e)); e->e.value = new_double_val (expr_short (e));
@ -235,7 +235,7 @@ do_op_float (int op, expr_t *e, expr_t *e1, expr_t *e2)
} }
if (is_compare (op) || is_logic (op)) { if (is_compare (op) || is_logic (op)) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
type = &type_integer; type = &type_int;
else else
type = &type_float; type = &type_float;
} }
@ -354,7 +354,7 @@ do_op_double (int op, expr_t *e, expr_t *e1, expr_t *e2)
e->e.expr.e2 = e2 = conv; e->e.expr.e2 = e2 = conv;
} }
if (is_compare (op) || is_logic (op)) { if (is_compare (op) || is_logic (op)) {
type = &type_integer; type = &type_int;
} }
e->e.expr.type = type; e->e.expr.type = type;
@ -456,7 +456,7 @@ do_op_vector (int op, expr_t *e, expr_t *e1, expr_t *e2)
} }
if (is_compare (op) || is_logic (op)) { if (is_compare (op) || is_logic (op)) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
else else
e->e.expr.type = &type_float; e->e.expr.type = &type_float;
} else if (op == '*' && is_vector(get_type (e2))) { } else if (op == '*' && is_vector(get_type (e2))) {
@ -555,7 +555,7 @@ do_op_entity (int op, expr_t *e, expr_t *e1, expr_t *e2)
} }
if (op == EQ || op == NE) { if (op == EQ || op == NE) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
else else
e->e.expr.type = &type_float; e->e.expr.type = &type_float;
return e; return e;
@ -577,7 +577,7 @@ do_op_func (int op, expr_t *e, expr_t *e1, expr_t *e2)
{ {
if (op == EQ || op == NE) { if (op == EQ || op == NE) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
else else
e->e.expr.type = &type_float; e->e.expr.type = &type_float;
return e; return e;
@ -606,23 +606,23 @@ do_op_pointer (int op, expr_t *e, expr_t *e1, expr_t *e2)
type = get_type (e1); type = get_type (e1);
if (type != get_type (e2)) if (type != get_type (e2))
return error (e2, "invalid operands to binary -"); return error (e2, "invalid operands to binary -");
e1 = new_alias_expr (&type_integer, e1); e1 = new_alias_expr (&type_int, e1);
e2 = new_alias_expr (&type_integer, e2); e2 = new_alias_expr (&type_int, e2);
e = binary_expr ('-', e1, e2); e = binary_expr ('-', e1, e2);
if (type_size (type) != 1) if (type_size (type) != 1)
e = binary_expr ('/', e, new_integer_expr (type_size (type))); e = binary_expr ('/', e, new_int_expr (type_size (type)));
return e; return e;
} }
if (op == EQ || op == NE) { if (op == EQ || op == NE) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
else else
e->e.expr.type = &type_float; e->e.expr.type = &type_float;
} }
if (op != '.' && extract_type (e1) != extract_type (e2)) if (op != '.' && extract_type (e1) != extract_type (e2))
return type_mismatch (e1, e2, op); return type_mismatch (e1, e2, op);
if (op == '.' && is_uinteger(get_type (e2))) if (op == '.' && is_uint(get_type (e2)))
e->e.expr.e2 = cf_cast_expr (&type_integer, e2); e->e.expr.e2 = cf_cast_expr (&type_int, e2);
return e; return e;
} }
@ -677,7 +677,7 @@ do_op_quaternion (int op, expr_t *e, expr_t *e1, expr_t *e2)
} }
if (is_compare (op) || is_logic (op)) { if (is_compare (op) || is_logic (op)) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
else else
e->e.expr.type = &type_float; e->e.expr.type = &type_float;
} else if (op == '/' && !is_constant (e1)) { } else if (op == '/' && !is_constant (e1)) {
@ -759,7 +759,7 @@ do_op_quaternion (int op, expr_t *e, expr_t *e1, expr_t *e2)
} }
static expr_t * static expr_t *
do_op_integer (int op, expr_t *e, expr_t *e1, expr_t *e2) do_op_int (int op, expr_t *e, expr_t *e1, expr_t *e2)
{ {
int isval1 = 0, isval2 = 0; int isval1 = 0, isval2 = 0;
int val1 = 0, val2 = 0; int val1 = 0, val2 = 0;
@ -769,33 +769,33 @@ do_op_integer (int op, expr_t *e, expr_t *e1, expr_t *e2)
}; };
if (!valid_op (op, valid)) if (!valid_op (op, valid))
return error (e1, "invalid operator for integer"); return error (e1, "invalid operator for int");
if (is_short_val (e1)) { if (is_short_val (e1)) {
isval1 = 1; isval1 = 1;
val1 = expr_short (e1); val1 = expr_short (e1);
} }
if (is_integer_val (e1)) { if (is_int_val (e1)) {
isval1 = 1; isval1 = 1;
val1 = expr_integer (e1); val1 = expr_int (e1);
} }
if (is_short_val (e2)) { if (is_short_val (e2)) {
isval2 = 1; isval2 = 1;
val2 = expr_short (e2); val2 = expr_short (e2);
} }
if (is_integer_val (e2)) { if (is_int_val (e2)) {
isval2 = 1; isval2 = 1;
val2 = expr_integer (e2); val2 = expr_int (e2);
} }
if (is_compare (op) || is_logic (op)) { if (is_compare (op) || is_logic (op)) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
else else
e->e.expr.type = &type_float; e->e.expr.type = &type_float;
} else { } else {
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
} }
if (op == '*' && isval1 && val1 == 1) if (op == '*' && isval1 && val1 == 1)
@ -824,36 +824,36 @@ do_op_integer (int op, expr_t *e, expr_t *e1, expr_t *e2)
switch (op) { switch (op) {
case '+': case '+':
e = new_integer_expr (val1 + val2); e = new_int_expr (val1 + val2);
break; break;
case '-': case '-':
e = new_integer_expr (val1 - val2); e = new_int_expr (val1 - val2);
break; break;
case '*': case '*':
e = new_integer_expr (val1 * val2); e = new_int_expr (val1 * val2);
break; break;
case '/': case '/':
if (options.warnings.integer_divide) if (options.warnings.integer_divide)
warning (e2, "%d / %d == %d", val1, val2, val1 / val2); warning (e2, "%d / %d == %d", val1, val2, val1 / val2);
e = new_integer_expr (val1 / val2); e = new_int_expr (val1 / val2);
break; break;
case '&': case '&':
e = new_integer_expr (val1 & val2); e = new_int_expr (val1 & val2);
break; break;
case '|': case '|':
e = new_integer_expr (val1 | val2); e = new_int_expr (val1 | val2);
break; break;
case '^': case '^':
e = new_integer_expr (val1 ^ val2); e = new_int_expr (val1 ^ val2);
break; break;
case '%': case '%':
e = new_integer_expr (val1 % val2); e = new_int_expr (val1 % val2);
break; break;
case SHL: case SHL:
e = new_integer_expr (val1 << val2); e = new_int_expr (val1 << val2);
break; break;
case SHR: case SHR:
e = new_integer_expr (val1 >> val2); e = new_int_expr (val1 >> val2);
break; break;
case AND: case AND:
e = cmp_result_expr (val1 && val2); e = cmp_result_expr (val1 && val2);
@ -888,7 +888,7 @@ do_op_integer (int op, expr_t *e, expr_t *e1, expr_t *e2)
} }
static expr_t * static expr_t *
do_op_uinteger (int op, expr_t *e, expr_t *e1, expr_t *e2) do_op_uint (int op, expr_t *e, expr_t *e1, expr_t *e2)
{ {
return e; return e;
} }
@ -907,7 +907,7 @@ do_op_short (int op, expr_t *e, expr_t *e1, expr_t *e2)
if (is_compare (op) || is_logic (op)) { if (is_compare (op) || is_logic (op)) {
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
else else
e->e.expr.type = &type_float; e->e.expr.type = &type_float;
} else { } else {
@ -1004,14 +1004,14 @@ do_op_compound (int op, expr_t *e, expr_t *e1, expr_t *e2)
return do_op_float (op, e, e1, e2); return do_op_float (op, e, e1, e2);
if (t2->type == ev_double) if (t2->type == ev_double)
return do_op_float (op, e, e1, e2); return do_op_float (op, e, e1, e2);
return do_op_integer (op, e, e1, e2); return do_op_int (op, e, e1, e2);
} }
if (is_enum (t2)) { if (is_enum (t2)) {
if (t1->type == ev_double) if (t1->type == ev_double)
return do_op_double (op, e, e1, e2); return do_op_double (op, e, e1, e2);
if (t1->type == ev_float) if (t1->type == ev_float)
return do_op_float (op, e, e1, e2); return do_op_float (op, e, e1, e2);
return do_op_integer (op, e, e1, e2); return do_op_int (op, e, e1, e2);
} }
} }
return error (e1, "invalid operator for compound"); return error (e1, "invalid operator for compound");
@ -1062,8 +1062,8 @@ static operation_t op_void[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_invalid, // ev_quaternion do_op_invalid, // ev_quaternion
do_op_invalid, // ev_integer do_op_invalid, // ev_int
do_op_invalid, // ev_uinteger do_op_invalid, // ev_uint
do_op_invalid, // ev_short do_op_invalid, // ev_short
do_op_invalid, // ev_double do_op_invalid, // ev_double
0, // ev_long 0, // ev_long
@ -1081,8 +1081,8 @@ static operation_t op_string[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_invalid, // ev_quaternion do_op_invalid, // ev_quaternion
do_op_invalid, // ev_integer do_op_invalid, // ev_int
do_op_invalid, // ev_uinteger do_op_invalid, // ev_uint
do_op_invalid, // ev_short do_op_invalid, // ev_short
do_op_invalid, // ev_double do_op_invalid, // ev_double
0, // ev_long 0, // ev_long
@ -1100,8 +1100,8 @@ static operation_t op_float[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_quaternion, // ev_quaternion do_op_quaternion, // ev_quaternion
do_op_float, // ev_integer do_op_float, // ev_int
do_op_float, // ev_uinteger do_op_float, // ev_uint
do_op_float, // ev_short do_op_float, // ev_short
do_op_double, // ev_double do_op_double, // ev_double
0, // ev_long 0, // ev_long
@ -1119,8 +1119,8 @@ static operation_t op_vector[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_invalid, // ev_quaternion do_op_invalid, // ev_quaternion
do_op_vector, // ev_integer do_op_vector, // ev_int
do_op_vector, // ev_uinteger do_op_vector, // ev_uint
do_op_vector, // ev_short do_op_vector, // ev_short
do_op_vector, // ev_double do_op_vector, // ev_double
0, // ev_long 0, // ev_long
@ -1138,8 +1138,8 @@ static operation_t op_entity[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_invalid, // ev_quaternion do_op_invalid, // ev_quaternion
do_op_invalid, // ev_integer do_op_invalid, // ev_int
do_op_invalid, // ev_uinteger do_op_invalid, // ev_uint
do_op_invalid, // ev_short do_op_invalid, // ev_short
do_op_invalid, // ev_double do_op_invalid, // ev_double
0, // ev_long 0, // ev_long
@ -1157,8 +1157,8 @@ static operation_t op_field[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_invalid, // ev_quaternion do_op_invalid, // ev_quaternion
do_op_invalid, // ev_integer do_op_invalid, // ev_int
do_op_invalid, // ev_uinteger do_op_invalid, // ev_uint
do_op_invalid, // ev_short do_op_invalid, // ev_short
do_op_invalid, // ev_double do_op_invalid, // ev_double
0, // ev_long 0, // ev_long
@ -1176,8 +1176,8 @@ static operation_t op_func[ev_type_count] = {
do_op_func, // ev_func do_op_func, // ev_func
do_op_func, // ev_pointer do_op_func, // ev_pointer
do_op_func, // ev_quaternion do_op_func, // ev_quaternion
do_op_func, // ev_integer do_op_func, // ev_int
do_op_func, // ev_uinteger do_op_func, // ev_uint
do_op_func, // ev_short do_op_func, // ev_short
do_op_func, // ev_double do_op_func, // ev_double
0, // ev_long 0, // ev_long
@ -1195,8 +1195,8 @@ static operation_t op_pointer[ev_type_count] = {
do_op_pointer, // ev_func do_op_pointer, // ev_func
do_op_pointer, // ev_pointer do_op_pointer, // ev_pointer
do_op_pointer, // ev_quaternion do_op_pointer, // ev_quaternion
do_op_pointer, // ev_integer do_op_pointer, // ev_int
do_op_pointer, // ev_uinteger do_op_pointer, // ev_uint
do_op_pointer, // ev_short do_op_pointer, // ev_short
do_op_pointer, // ev_double do_op_pointer, // ev_double
0, // ev_long 0, // ev_long
@ -1214,8 +1214,8 @@ static operation_t op_quaternion[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_quaternion, // ev_quaternion do_op_quaternion, // ev_quaternion
do_op_quaternion, // ev_integer do_op_quaternion, // ev_int
do_op_quaternion, // ev_uinteger do_op_quaternion, // ev_uint
do_op_quaternion, // ev_short do_op_quaternion, // ev_short
do_op_quaternion, // ev_double do_op_quaternion, // ev_double
0, // ev_long 0, // ev_long
@ -1223,7 +1223,7 @@ static operation_t op_quaternion[ev_type_count] = {
do_op_invalid, // ev_invalid do_op_invalid, // ev_invalid
}; };
static operation_t op_integer[ev_type_count] = { static operation_t op_int[ev_type_count] = {
do_op_invalid, // ev_void do_op_invalid, // ev_void
do_op_invalid, // ev_string do_op_invalid, // ev_string
do_op_float, // ev_float do_op_float, // ev_float
@ -1233,16 +1233,16 @@ static operation_t op_integer[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_quaternion, // ev_quaternion do_op_quaternion, // ev_quaternion
do_op_integer, // ev_integer do_op_int, // ev_int
do_op_uinteger, // ev_uinteger do_op_uint, // ev_uint
do_op_integer, // ev_short do_op_int, // ev_short
do_op_double, // ev_double do_op_double, // ev_double
0, // ev_long 0, // ev_long
0, // ev_ulong 0, // ev_ulong
do_op_invalid, // ev_invalid do_op_invalid, // ev_invalid
}; };
static operation_t op_uinteger[ev_type_count] = { static operation_t op_uint[ev_type_count] = {
do_op_invalid, // ev_void do_op_invalid, // ev_void
do_op_invalid, // ev_string do_op_invalid, // ev_string
do_op_float, // ev_float do_op_float, // ev_float
@ -1252,9 +1252,9 @@ static operation_t op_uinteger[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_quaternion, // ev_quaternion do_op_quaternion, // ev_quaternion
do_op_uinteger, // ev_integer do_op_uint, // ev_int
do_op_uinteger, // ev_uinteger do_op_uint, // ev_uint
do_op_uinteger, // ev_short do_op_uint, // ev_short
do_op_double, // ev_double do_op_double, // ev_double
0, // ev_long 0, // ev_long
0, // ev_ulong 0, // ev_ulong
@ -1271,8 +1271,8 @@ static operation_t op_short[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_quaternion, // ev_quaternion do_op_quaternion, // ev_quaternion
do_op_integer, // ev_integer do_op_int, // ev_int
do_op_uinteger, // ev_uinteger do_op_uint, // ev_uint
do_op_short, // ev_short do_op_short, // ev_short
do_op_double, // ev_double do_op_double, // ev_double
0, // ev_long 0, // ev_long
@ -1290,8 +1290,8 @@ static operation_t op_double[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_quaternion, // ev_quaternion do_op_quaternion, // ev_quaternion
do_op_integer, // ev_integer do_op_int, // ev_int
do_op_uinteger, // ev_uinteger do_op_uint, // ev_uint
do_op_short, // ev_short do_op_short, // ev_short
do_op_double, // ev_double do_op_double, // ev_double
0, // ev_long 0, // ev_long
@ -1309,8 +1309,8 @@ static operation_t op_compound[ev_type_count] = {
do_op_invalid, // ev_func do_op_invalid, // ev_func
do_op_invalid, // ev_pointer do_op_invalid, // ev_pointer
do_op_invalid, // ev_quaternion do_op_invalid, // ev_quaternion
do_op_compound, // ev_integer do_op_compound, // ev_int
do_op_compound, // ev_uinteger do_op_compound, // ev_uint
do_op_compound, // ev_short do_op_compound, // ev_short
do_op_compound, // ev_double do_op_compound, // ev_double
do_op_compound, // ev_long do_op_compound, // ev_long
@ -1328,8 +1328,8 @@ static operation_t *do_op[ev_type_count] = {
op_func, // ev_func op_func, // ev_func
op_pointer, // ev_pointer op_pointer, // ev_pointer
op_quaternion, // ev_quaternion op_quaternion, // ev_quaternion
op_integer, // ev_integer op_int, // ev_int
op_uinteger, // ev_uinteger op_uint, // ev_uint
op_short, // ev_short op_short, // ev_short
op_double, // ev_double op_double, // ev_double
0, // ev_long 0, // ev_long
@ -1390,7 +1390,7 @@ uop_float (int op, expr_t *e, expr_t *e1)
if (op == '+') if (op == '+')
return e1; return e1;
type = get_type (e); type = get_type (e);
if (op == 'C' && !is_integer(type) && !is_double(type)) if (op == 'C' && !is_int(type) && !is_double(type))
return error (e1, "invalid cast of float"); return error (e1, "invalid cast of float");
if (!is_constant (e1)) if (!is_constant (e1))
return e; return e;
@ -1403,8 +1403,8 @@ uop_float (int op, expr_t *e, expr_t *e1)
case '~': case '~':
return new_float_expr (~(int) expr_float (e1)); return new_float_expr (~(int) expr_float (e1));
case 'C': case 'C':
if (is_integer(type)) { if (is_int(type)) {
return new_integer_expr (expr_float (e1)); return new_int_expr (expr_float (e1));
} else { } else {
return new_double_expr (expr_float (e1)); return new_double_expr (expr_float (e1));
} }
@ -1533,7 +1533,7 @@ uop_quaternion (int op, expr_t *e, expr_t *e1)
} }
static expr_t * static expr_t *
uop_integer (int op, expr_t *e, expr_t *e1) uop_int (int op, expr_t *e, expr_t *e1)
{ {
static int valid[] = { '+', '-', '!', '~', 'C', 0 }; static int valid[] = { '+', '-', '!', '~', 'C', 0 };
@ -1548,19 +1548,19 @@ uop_integer (int op, expr_t *e, expr_t *e1)
return e; return e;
switch (op) { switch (op) {
case '-': case '-':
return new_integer_expr (-expr_integer (e1)); return new_int_expr (-expr_int (e1));
case '!': case '!':
return cmp_result_expr (!expr_integer (e1)); return cmp_result_expr (!expr_int (e1));
case '~': case '~':
return new_integer_expr (~expr_integer (e1)); return new_int_expr (~expr_int (e1));
case 'C': case 'C':
return new_float_expr (expr_integer (e1)); return new_float_expr (expr_int (e1));
} }
internal_error (e, "integer unary op blew up"); internal_error (e, "int unary op blew up");
} }
static expr_t * static expr_t *
uop_uinteger (int op, expr_t *e, expr_t *e1) uop_uint (int op, expr_t *e, expr_t *e1)
{ {
static int valid[] = { '+', '-', '!', '~', 0 }; static int valid[] = { '+', '-', '!', '~', 0 };
@ -1573,13 +1573,13 @@ uop_uinteger (int op, expr_t *e, expr_t *e1)
return e; return e;
switch (op) { switch (op) {
case '-': case '-':
return new_uinteger_expr (-expr_uinteger (e1)); return new_uint_expr (-expr_uint (e1));
case '!': case '!':
return cmp_result_expr (!expr_uinteger (e1)); return cmp_result_expr (!expr_uint (e1));
case '~': case '~':
return new_uinteger_expr (~expr_uinteger (e1)); return new_uint_expr (~expr_uint (e1));
} }
internal_error (e, "uinteger unary op blew up"); internal_error (e, "uint unary op blew up");
} }
static expr_t * static expr_t *
@ -1617,7 +1617,7 @@ uop_double (int op, expr_t *e, expr_t *e1)
if (op == '+') if (op == '+')
return e1; return e1;
type = get_type (e); type = get_type (e);
if (op == 'C' && !is_integer(type) && !is_float(type)) if (op == 'C' && !is_int(type) && !is_float(type))
return error (e1, "invalid cast of double"); return error (e1, "invalid cast of double");
if (!is_constant (e1)) if (!is_constant (e1))
return e; return e;
@ -1628,8 +1628,8 @@ uop_double (int op, expr_t *e, expr_t *e1)
print_type (get_type (e)); print_type (get_type (e));
return cmp_result_expr (!expr_double (e1)); return cmp_result_expr (!expr_double (e1));
case 'C': case 'C':
if (is_integer(type)) { if (is_int(type)) {
return new_integer_expr (expr_double (e1)); return new_int_expr (expr_double (e1));
} else { } else {
return new_float_expr (expr_double (e1)); return new_float_expr (expr_double (e1));
} }
@ -1644,7 +1644,7 @@ uop_compound (int op, expr_t *e, expr_t *e1)
if (is_scalar (t1)) { if (is_scalar (t1)) {
if (is_enum (t1)) { if (is_enum (t1)) {
return uop_integer (op, e, e1); return uop_int (op, e, e1);
} }
} }
return error (e1, "invalid operand for unary %s", get_op_string (op)); return error (e1, "invalid operand for unary %s", get_op_string (op));
@ -1660,8 +1660,8 @@ static unaryop_t do_unary_op[ev_type_count] = {
uop_func, // ev_func uop_func, // ev_func
uop_pointer, // ev_pointer uop_pointer, // ev_pointer
uop_quaternion, // ev_quaternion uop_quaternion, // ev_quaternion
uop_integer, // ev_integer uop_int, // ev_int
uop_uinteger, // ev_uinteger uop_uint, // ev_uint
uop_short, // ev_short uop_short, // ev_short
uop_double, // ev_double uop_double, // ev_double
uop_compound, // ev_invalid uop_compound, // ev_invalid

View file

@ -164,7 +164,7 @@ emit_basedir (def_t *def, void *data, int index)
static void static void
emit_num_files (def_t *def, void *data, int index) emit_num_files (def_t *def, void *data, int index)
{ {
if (!is_integer (def->type)) { if (!is_int (def->type)) {
internal_error (0, "%s: expected int def", __FUNCTION__); internal_error (0, "%s: expected int def", __FUNCTION__);
} }
D_INT (def) = pr.comp_files.size; D_INT (def) = pr.comp_files.size;
@ -189,7 +189,7 @@ emit_compunit (const char *modname)
static struct_def_t compunit_struct[] = { static struct_def_t compunit_struct[] = {
{"unit_name", &type_string, emit_unit_name}, {"unit_name", &type_string, emit_unit_name},
{"basedir", &type_string, emit_basedir}, {"basedir", &type_string, emit_basedir},
{"num_files", &type_integer, emit_num_files}, {"num_files", &type_int, emit_num_files},
{"files", 0, emit_files_item}, {"files", 0, emit_files_item},
{0, 0} {0, 0}
}; };

View file

@ -378,8 +378,7 @@ init_elements (struct def_s *def, expr_t *eles)
reloc_def_op (c->e.labelref.label, &dummy); reloc_def_op (c->e.labelref.label, &dummy);
continue; continue;
} else if (c->type == ex_value) { } else if (c->type == ex_value) {
if (c->e.value->lltype == ev_integer if (c->e.value->lltype == ev_int && is_float (element->type)) {
&& is_float (element->type)) {
convert_int (c); convert_int (c);
} }
if (is_double (get_type (c)) && is_float (element->type) if (is_double (get_type (c)) && is_float (element->type)
@ -610,7 +609,7 @@ initialize_def (symbol_t *sym, expr_t *init, defspace_t *space,
} }
while (init->type == ex_alias) { while (init->type == ex_alias) {
if (init->e.alias.offset) { if (init->e.alias.offset) {
offset += expr_integer (init->e.alias.offset); offset += expr_int (init->e.alias.offset);
} }
init = init->e.alias.expr; init = init->e.alias.expr;
} }

View file

@ -573,16 +573,16 @@ print_value (dstring_t *dstr, expr_t *e, int level, int id, expr_t *next)
} }
break; break;
case ev_entity: case ev_entity:
label = va (0, "ent %d", e->e.value->v.integer_val); label = va (0, "ent %d", e->e.value->v.int_val);
break; break;
case ev_func: case ev_func:
label = va (0, "func %d", e->e.value->v.integer_val); label = va (0, "func %d", e->e.value->v.int_val);
break; break;
case ev_integer: case ev_int:
label = va (0, "i %d", e->e.value->v.integer_val); label = va (0, "i %d", e->e.value->v.int_val);
break; break;
case ev_uinteger: case ev_uint:
label = va (0, "u %u", e->e.value->v.uinteger_val); label = va (0, "u %u", e->e.value->v.uint_val);
break; break;
case ev_long: case ev_long:
label = va (0, "i %"PRIi64, e->e.value->v.long_val); label = va (0, "i %"PRIi64, e->e.value->v.long_val);

View file

@ -169,7 +169,7 @@ print_struct (dstring_t *dstr, type_t *t, int level, int id)
int val; int val;
const char *port = ""; const char *port = "";
if (sym->sy_type == sy_const) { if (sym->sy_type == sy_const) {
val = sym->s.value->v.integer_val; val = sym->s.value->v.int_val;
} else { } else {
if (sym->sy_type != sy_var) { if (sym->sy_type != sy_var) {
continue; continue;

View file

@ -141,7 +141,7 @@ dump_def (progs_t *pr, pr_def_t *def, int indent)
G_QUAT (pr, offset)[2], G_QUAT (pr, offset)[2],
G_QUAT (pr, offset)[3]); G_QUAT (pr, offset)[3]);
break; break;
case ev_integer: case ev_int:
comment = va (0, " %d", G_INT (pr, offset)); comment = va (0, " %d", G_INT (pr, offset));
break; break;
case ev_short: case ev_short:
@ -327,7 +327,7 @@ qfo_globals (qfo_t *qfo)
QFO_TYPESTR (qfo, def->type)); QFO_TYPESTR (qfo, def->type));
if (!(def->flags & QFOD_EXTERNAL) && qfo->spaces[space].data) if (!(def->flags & QFOD_EXTERNAL) && qfo->spaces[space].data)
printf (" %d", printf (" %d",
qfo->spaces[space].data[def->offset].integer_var); qfo->spaces[space].data[def->offset].int_var);
puts (""); puts ("");
} }
} }

View file

@ -91,7 +91,7 @@ convert_name (expr_t *e)
} }
if (!strcmp (sym->name, "__LINE__") if (!strcmp (sym->name, "__LINE__")
&& current_func) { && current_func) {
new = new_integer_expr (e->line); new = new_int_expr (e->line);
goto convert; goto convert;
} }
if (!strcmp (sym->name, "__INFINITY__") if (!strcmp (sym->name, "__INFINITY__")
@ -230,7 +230,7 @@ get_type (expr_t *e)
case ex_bool: case ex_bool:
if (options.code.progsversion == PROG_ID_VERSION) if (options.code.progsversion == PROG_ID_VERSION)
return &type_float; return &type_float;
return &type_integer; return &type_int;
case ex_nil: case ex_nil:
if (e->e.nil) { if (e->e.nil) {
return e->e.nil; return e->e.nil;
@ -888,20 +888,20 @@ new_quaternion_expr (const float *quaternion_val)
} }
expr_t * expr_t *
new_integer_expr (int integer_val) new_int_expr (int int_val)
{ {
expr_t *e = new_expr (); expr_t *e = new_expr ();
e->type = ex_value; e->type = ex_value;
e->e.value = new_integer_val (integer_val); e->e.value = new_int_val (int_val);
return e; return e;
} }
expr_t * expr_t *
new_uinteger_expr (unsigned uinteger_val) new_uint_expr (unsigned uint_val)
{ {
expr_t *e = new_expr (); expr_t *e = new_expr ();
e->type = ex_value; e->type = ex_value;
e->e.value = new_uinteger_val (uinteger_val); e->e.value = new_uint_val (uint_val);
return e; return e;
} }
@ -1104,12 +1104,12 @@ expr_quaternion (expr_t *e)
} }
int int
is_integer_val (expr_t *e) is_int_val (expr_t *e)
{ {
if (e->type == ex_nil) { if (e->type == ex_nil) {
return 1; return 1;
} }
if (e->type == ex_value && e->e.value->lltype == ev_integer) { if (e->type == ex_value && e->e.value->lltype == ev_int) {
return 1; return 1;
} }
if (e->type == ex_symbol && e->e.symbol->sy_type == sy_const if (e->type == ex_symbol && e->e.symbol->sy_type == sy_const
@ -1124,18 +1124,18 @@ is_integer_val (expr_t *e)
} }
int int
expr_integer (expr_t *e) expr_int (expr_t *e)
{ {
if (e->type == ex_nil) { if (e->type == ex_nil) {
return 0; return 0;
} }
if (e->type == ex_value && e->e.value->lltype == ev_integer) { if (e->type == ex_value && e->e.value->lltype == ev_int) {
return e->e.value->v.integer_val; return e->e.value->v.int_val;
} }
if (e->type == ex_symbol && e->e.symbol->sy_type == sy_const if (e->type == ex_symbol && e->e.symbol->sy_type == sy_const
&& (e->e.symbol->type->type == ev_integer && (e->e.symbol->type->type == ev_int
|| is_enum (e->e.symbol->type))) { || is_enum (e->e.symbol->type))) {
return e->e.symbol->s.value->v.integer_val; return e->e.symbol->s.value->v.int_val;
} }
if (e->type == ex_symbol && e->e.symbol->sy_type == sy_var if (e->type == ex_symbol && e->e.symbol->sy_type == sy_var
&& e->e.symbol->s.def->constant && e->e.symbol->s.def->constant
@ -1146,16 +1146,16 @@ expr_integer (expr_t *e)
&& is_integral (e->e.def->type)) { && is_integral (e->e.def->type)) {
return D_INT (e->e.def); return D_INT (e->e.def);
} }
internal_error (e, "not an integer constant"); internal_error (e, "not an int constant");
} }
int int
is_uinteger_val (expr_t *e) is_uint_val (expr_t *e)
{ {
if (e->type == ex_nil) { if (e->type == ex_nil) {
return 1; return 1;
} }
if (e->type == ex_value && e->e.value->lltype == ev_uinteger) { if (e->type == ex_value && e->e.value->lltype == ev_uint) {
return 1; return 1;
} }
if (e->type == ex_symbol && e->e.symbol->sy_type == sy_const if (e->type == ex_symbol && e->e.symbol->sy_type == sy_const
@ -1170,17 +1170,17 @@ is_uinteger_val (expr_t *e)
} }
unsigned unsigned
expr_uinteger (expr_t *e) expr_uint (expr_t *e)
{ {
if (e->type == ex_nil) { if (e->type == ex_nil) {
return 0; return 0;
} }
if (e->type == ex_value && e->e.value->lltype == ev_uinteger) { if (e->type == ex_value && e->e.value->lltype == ev_uint) {
return e->e.value->v.uinteger_val; return e->e.value->v.uint_val;
} }
if (e->type == ex_symbol && e->e.symbol->sy_type == sy_const if (e->type == ex_symbol && e->e.symbol->sy_type == sy_const
&& e->e.symbol->type->type == ev_uinteger) { && e->e.symbol->type->type == ev_uint) {
return e->e.symbol->s.value->v.uinteger_val; return e->e.symbol->s.value->v.uint_val;
} }
if (e->type == ex_symbol && e->e.symbol->sy_type == sy_var if (e->type == ex_symbol && e->e.symbol->sy_type == sy_var
&& e->e.symbol->s.def->constant && e->e.symbol->s.def->constant
@ -1230,10 +1230,10 @@ int
is_integral_val (expr_t *e) is_integral_val (expr_t *e)
{ {
if (is_constant (e)) { if (is_constant (e)) {
if (is_integer_val (e)) { if (is_int_val (e)) {
return 1; return 1;
} }
if (is_uinteger_val (e)) { if (is_uint_val (e)) {
return 1; return 1;
} }
if (is_short_val (e)) { if (is_short_val (e)) {
@ -1247,11 +1247,11 @@ int
expr_integral (expr_t *e) expr_integral (expr_t *e)
{ {
if (is_constant (e)) { if (is_constant (e)) {
if (is_integer_val (e)) { if (is_int_val (e)) {
return expr_integer (e); return expr_int (e);
} }
if (is_uinteger_val (e)) { if (is_uint_val (e)) {
return expr_uinteger (e); return expr_uint (e);
} }
if (is_short_val (e)) { if (is_short_val (e)) {
return expr_short (e); return expr_short (e);
@ -1293,7 +1293,7 @@ new_offset_alias_expr (type_t *type, expr_t *expr, int offset)
if (!is_constant (ofs_expr)) { if (!is_constant (ofs_expr)) {
internal_error (ofs_expr, "non-constant offset for alias expr"); internal_error (ofs_expr, "non-constant offset for alias expr");
} }
offset += expr_integer (ofs_expr); offset += expr_int (ofs_expr);
if (expr->e.alias.expr->type == ex_alias) { if (expr->e.alias.expr->type == ex_alias) {
internal_error (expr, "alias expr of alias expr"); internal_error (expr, "alias expr of alias expr");
@ -1305,7 +1305,7 @@ new_offset_alias_expr (type_t *type, expr_t *expr, int offset)
alias->type = ex_alias; alias->type = ex_alias;
alias->e.alias.type = type; alias->e.alias.type = type;
alias->e.alias.expr = expr; alias->e.alias.expr = expr;
alias->e.alias.offset = new_integer_expr (offset); alias->e.alias.offset = new_int_expr (offset);
alias->file = expr->file; alias->file = expr->file;
alias->line = expr->line; alias->line = expr->line;
return alias; return alias;
@ -1517,14 +1517,14 @@ convert_from_bool (expr_t *e, type_t *type)
if (is_float (type)) { if (is_float (type)) {
one = new_float_expr (1); one = new_float_expr (1);
zero = new_float_expr (0); zero = new_float_expr (0);
} else if (is_integer (type)) { } else if (is_int (type)) {
one = new_integer_expr (1); one = new_int_expr (1);
zero = new_integer_expr (0); zero = new_int_expr (0);
} else if (is_enum (type) && enum_as_bool (type, &zero, &one)) { } else if (is_enum (type) && enum_as_bool (type, &zero, &one)) {
// don't need to do anything // don't need to do anything
} else if (is_uinteger (type)) { } else if (is_uint (type)) {
one = new_uinteger_expr (1); one = new_uint_expr (1);
zero = new_uinteger_expr (0); zero = new_uint_expr (0);
} else { } else {
return error (e, "can't convert from bool value"); return error (e, "can't convert from bool value");
} }
@ -1541,7 +1541,7 @@ convert_from_bool (expr_t *e, type_t *type)
void void
convert_int (expr_t *e) convert_int (expr_t *e)
{ {
float float_val = expr_integer (e); float float_val = expr_int (e);
e->type = ex_value; e->type = ex_value;
e->e.value = new_float_val (float_val); e->e.value = new_float_val (float_val);
} }
@ -1557,9 +1557,9 @@ convert_short (expr_t *e)
void void
convert_short_int (expr_t *e) convert_short_int (expr_t *e)
{ {
float integer_val = expr_short (e); float int_val = expr_short (e);
e->type = ex_value; e->type = ex_value;
e->e.value = new_integer_val (integer_val); e->e.value = new_int_val (int_val);
} }
void void
@ -1712,10 +1712,10 @@ unary_expr (int op, expr_t *e)
case ev_long: case ev_long:
case ev_ulong: case ev_ulong:
internal_error (e, "long not implemented"); internal_error (e, "long not implemented");
case ev_integer: case ev_int:
return new_integer_expr (-expr_integer (e)); return new_int_expr (-expr_int (e));
case ev_uinteger: case ev_uint:
return new_uinteger_expr (-expr_uinteger (e)); return new_uint_expr (-expr_uint (e));
case ev_short: case ev_short:
return new_short_expr (-expr_short (e)); return new_short_expr (-expr_short (e));
case ev_invalid: case ev_invalid:
@ -1801,22 +1801,22 @@ unary_expr (int op, expr_t *e)
internal_error (e, 0); internal_error (e, 0);
case ev_string: case ev_string:
s = expr_string (e); s = expr_string (e);
return new_integer_expr (!s || !s[0]); return new_int_expr (!s || !s[0]);
case ev_double: case ev_double:
return new_integer_expr (!expr_double (e)); return new_int_expr (!expr_double (e));
case ev_float: case ev_float:
return new_integer_expr (!expr_float (e)); return new_int_expr (!expr_float (e));
case ev_vector: case ev_vector:
return new_integer_expr (!VectorIsZero (expr_vector (e))); return new_int_expr (!VectorIsZero (expr_vector (e)));
case ev_quat: case ev_quat:
return new_integer_expr (!QuatIsZero (expr_quaternion (e))); return new_int_expr (!QuatIsZero (expr_quaternion (e)));
case ev_long: case ev_long:
case ev_ulong: case ev_ulong:
internal_error (e, "long not implemented"); internal_error (e, "long not implemented");
case ev_integer: case ev_int:
return new_integer_expr (!expr_integer (e)); return new_int_expr (!expr_int (e));
case ev_uinteger: case ev_uint:
return new_uinteger_expr (!expr_uinteger (e)); return new_uint_expr (!expr_uint (e));
case ev_short: case ev_short:
return new_short_expr (!expr_short (e)); return new_short_expr (!expr_short (e));
case ev_invalid: case ev_invalid:
@ -1856,7 +1856,7 @@ unary_expr (int op, expr_t *e)
expr_t *n = new_unary_expr (op, e); expr_t *n = new_unary_expr (op, e);
if (options.code.progsversion > PROG_ID_VERSION) if (options.code.progsversion > PROG_ID_VERSION)
n->e.expr.type = &type_integer; n->e.expr.type = &type_int;
else else
n->e.expr.type = &type_float; n->e.expr.type = &type_float;
return n; return n;
@ -1887,16 +1887,16 @@ unary_expr (int op, expr_t *e)
case ev_long: case ev_long:
case ev_ulong: case ev_ulong:
internal_error (e, "long not implemented"); internal_error (e, "long not implemented");
case ev_integer: case ev_int:
return new_integer_expr (~expr_integer (e)); return new_int_expr (~expr_int (e));
case ev_uinteger: case ev_uint:
return new_uinteger_expr (~expr_uinteger (e)); return new_uint_expr (~expr_uint (e));
case ev_short: case ev_short:
return new_short_expr (~expr_short (e)); return new_short_expr (~expr_short (e));
case ev_invalid: case ev_invalid:
t = get_type (e); t = get_type (e);
if (t->meta == ty_enum) { if (t->meta == ty_enum) {
return new_integer_expr (~expr_integer (e)); return new_int_expr (~expr_int (e));
} }
break; break;
case ev_type_count: case ev_type_count:
@ -1936,13 +1936,13 @@ unary_expr (int op, expr_t *e)
case ex_assign: case ex_assign:
bitnot_expr: bitnot_expr:
if (options.code.progsversion == PROG_ID_VERSION) { if (options.code.progsversion == PROG_ID_VERSION) {
expr_t *n1 = new_integer_expr (-1); expr_t *n1 = new_int_expr (-1);
return binary_expr ('-', n1, e); return binary_expr ('-', n1, e);
} else { } else {
expr_t *n = new_unary_expr (op, e); expr_t *n = new_unary_expr (op, e);
type_t *t = get_type (e); type_t *t = get_type (e);
if (!is_integer(t) && !is_float(t) if (!is_int(t) && !is_float(t)
&& !is_quaternion(t)) && !is_quaternion(t))
return error (e, "invalid type for unary ~"); return error (e, "invalid type for unary ~");
n->e.expr.type = t; n->e.expr.type = t;
@ -2052,7 +2052,7 @@ build_function_call (expr_t *fexpr, const type_t *ftype, expr_t *params)
convert_nil (e, t = type_nil); convert_nil (e, t = type_nil);
if (e->type == ex_bool) if (e->type == ex_bool)
convert_from_bool (e, get_type (e)); convert_from_bool (e, get_type (e));
if (is_integer_val (e) if (is_int_val (e)
&& options.code.progsversion == PROG_ID_VERSION) && options.code.progsversion == PROG_ID_VERSION)
convert_int (e); convert_int (e);
if (options.code.promote_float) { if (options.code.promote_float) {
@ -2070,8 +2070,8 @@ build_function_call (expr_t *fexpr, const type_t *ftype, expr_t *params)
} }
} }
} }
if (is_integer_val (e) && options.warnings.vararg_integer) if (is_int_val (e) && options.warnings.vararg_integer)
warning (e, "passing integer constant into ... function"); warning (e, "passing int constant into ... function");
} }
arg_types[arg_count - 1 - i] = t; arg_types[arg_count - 1 - i] = t;
} }
@ -2265,7 +2265,7 @@ return_expr (function_t *f, expr_t *e)
if (e->type == ex_bool) { if (e->type == ex_bool) {
e = convert_from_bool (e, (type_t *) ret_type); //FIXME cast e = convert_from_bool (e, (type_t *) ret_type); //FIXME cast
} }
if (is_float(ret_type) && is_integer_val (e)) { if (is_float(ret_type) && is_int_val (e)) {
convert_int (e); convert_int (e);
t = &type_float; t = &type_float;
} }
@ -2352,7 +2352,7 @@ incop_expr (int op, expr_t *e, int postop)
if (e->type == ex_error) if (e->type == ex_error)
return e; return e;
one = new_integer_expr (1); // integer constants get auto-cast to float one = new_int_expr (1); // int constants get auto-cast to float
if (postop) { if (postop) {
expr_t *t1, *t2; expr_t *t1, *t2;
type_t *type = get_type (e); type_t *type = get_type (e);
@ -2398,22 +2398,22 @@ array_expr (expr_t *array, expr_t *index)
return error (index, "invalid array index type"); return error (index, "invalid array index type");
if (is_short_val (index)) if (is_short_val (index))
ind = expr_short (index); ind = expr_short (index);
if (is_integer_val (index)) if (is_int_val (index))
ind = expr_integer (index); ind = expr_int (index);
if (array_type->t.func.num_params if (array_type->t.func.num_params
&& is_constant (index) && is_constant (index)
&& (ind < array_type->t.array.base && (ind < array_type->t.array.base
|| ind - array_type->t.array.base >= array_type->t.array.size)) || ind - array_type->t.array.base >= array_type->t.array.size))
return error (index, "array index out of bounds"); return error (index, "array index out of bounds");
scale = new_integer_expr (type_size (array_type->t.array.type)); scale = new_int_expr (type_size (array_type->t.array.type));
index = binary_expr ('*', index, scale); index = binary_expr ('*', index, scale);
base = new_integer_expr (array_type->t.array.base); base = new_int_expr (array_type->t.array.base);
offset = binary_expr ('*', base, scale); offset = binary_expr ('*', base, scale);
index = binary_expr ('-', index, offset); index = binary_expr ('-', index, offset);
if (is_short_val (index)) if (is_short_val (index))
ind = expr_short (index); ind = expr_short (index);
if (is_integer_val (index)) if (is_int_val (index))
ind = expr_integer (index); ind = expr_int (index);
if ((is_constant (index) && ind < 32768 && ind >= -32768)) if ((is_constant (index) && ind < 32768 && ind >= -32768))
index = new_short_expr (ind); index = new_short_expr (ind);
if (is_array (array_type)) { if (is_array (array_type)) {
@ -2438,7 +2438,7 @@ pointer_expr (expr_t *pointer)
return pointer; return pointer;
if (pointer_type->type != ev_pointer) if (pointer_type->type != ev_pointer)
return error (pointer, "not a pointer"); return error (pointer, "not a pointer");
return array_expr (pointer, new_integer_expr (0)); return array_expr (pointer, new_int_expr (0));
} }
expr_t * expr_t *
@ -2754,7 +2754,7 @@ build_state_expr (expr_t *e)
step = think->next; step = think->next;
if (think->type == ex_symbol) if (think->type == ex_symbol)
think = think_expr (think->e.symbol); think = think_expr (think->e.symbol);
if (is_integer_val (frame)) if (is_int_val (frame))
convert_int (frame); convert_int (frame);
if (!type_assignable (&type_float, get_type (frame))) if (!type_assignable (&type_float, get_type (frame)))
return error (frame, "invalid type for frame number"); return error (frame, "invalid type for frame number");
@ -2763,7 +2763,7 @@ build_state_expr (expr_t *e)
if (step) { if (step) {
if (step->next) if (step->next)
return error (step->next, "too many state arguments"); return error (step->next, "too many state arguments");
if (is_integer_val (step)) if (is_int_val (step))
convert_int (step); convert_int (step);
if (!type_assignable (&type_float, get_type (step))) if (!type_assignable (&type_float, get_type (step)))
return error (step, "invalid type for step"); return error (step, "invalid type for step");
@ -2843,7 +2843,7 @@ cast_expr (type_t *dstType, expr_t *e)
} else if (is_double (def->type)) { } else if (is_double (def->type)) {
val = new_double_val (D_DOUBLE (def)); val = new_double_val (D_DOUBLE (def));
} else if (is_integral (def->type)) { } else if (is_integral (def->type)) {
val = new_integer_val (D_INT (def)); val = new_int_val (D_INT (def));
} }
} else if (e->type == ex_value) { } else if (e->type == ex_value) {
val = e->e.value; val = e->e.value;
@ -2889,7 +2889,7 @@ sizeof_expr (expr_t *expr, struct type_s *type)
internal_error (0, 0); internal_error (0, 0);
if (!type) if (!type)
type = get_type (expr); type = get_type (expr);
expr = new_integer_expr (type_size (type)); expr = new_int_expr (type_size (type));
return expr; return expr;
} }

View file

@ -53,12 +53,12 @@ static expr_t *double_compare (int op, expr_t *e1, expr_t *e2);
static expr_type_t string_string[] = { static expr_type_t string_string[] = {
{'+', &type_string}, {'+', &type_string},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{LE, &type_integer}, {LE, &type_int},
{GE, &type_integer}, {GE, &type_int},
{LT, &type_integer}, {LT, &type_int},
{GT, &type_integer}, {GT, &type_int},
{0, 0} {0, 0}
}; };
@ -74,14 +74,14 @@ static expr_type_t float_float[] = {
{MOD, &type_float}, {MOD, &type_float},
{SHL, &type_float}, {SHL, &type_float},
{SHR, &type_float}, {SHR, &type_float},
{AND, &type_integer}, {AND, &type_int},
{OR, &type_integer}, {OR, &type_int},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{LE, &type_integer}, {LE, &type_int},
{GE, &type_integer}, {GE, &type_int},
{LT, &type_integer}, {LT, &type_int},
{GT, &type_integer}, {GT, &type_int},
{0, 0} {0, 0}
}; };
@ -95,7 +95,7 @@ static expr_type_t float_quat[] = {
{0, 0} {0, 0}
}; };
static expr_type_t float_integer[] = { static expr_type_t float_int[] = {
{'+', &type_float, 0, &type_float}, {'+', &type_float, 0, &type_float},
{'-', &type_float, 0, &type_float}, {'-', &type_float, 0, &type_float},
{'*', &type_float, 0, &type_float}, {'*', &type_float, 0, &type_float},
@ -107,16 +107,16 @@ static expr_type_t float_integer[] = {
{MOD, &type_float, 0, &type_float}, {MOD, &type_float, 0, &type_float},
{SHL, &type_float, 0, &type_float}, {SHL, &type_float, 0, &type_float},
{SHR, &type_float, 0, &type_float}, {SHR, &type_float, 0, &type_float},
{EQ, &type_integer, 0, &type_float}, {EQ, &type_int, 0, &type_float},
{NE, &type_integer, 0, &type_float}, {NE, &type_int, 0, &type_float},
{LE, &type_integer, 0, &type_float}, {LE, &type_int, 0, &type_float},
{GE, &type_integer, 0, &type_float}, {GE, &type_int, 0, &type_float},
{LT, &type_integer, 0, &type_float}, {LT, &type_int, 0, &type_float},
{GT, &type_integer, 0, &type_float}, {GT, &type_int, 0, &type_float},
{0, 0} {0, 0}
}; };
#define float_uinteger float_integer #define float_uint float_int
#define float_short float_integer #define float_short float_int
static expr_type_t float_double[] = { static expr_type_t float_double[] = {
{'+', &type_double, &type_double, 0}, {'+', &type_double, &type_double, 0},
@ -144,13 +144,13 @@ static expr_type_t vector_vector[] = {
{'+', &type_vector}, {'+', &type_vector},
{'-', &type_vector}, {'-', &type_vector},
{'*', &type_float}, {'*', &type_float},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{0, 0} {0, 0}
}; };
#define vector_integer vector_float #define vector_int vector_float
#define vector_uinteger vector_float #define vector_uint vector_float
#define vector_short vector_float #define vector_short vector_float
static expr_type_t vector_double[] = { static expr_type_t vector_double[] = {
@ -160,20 +160,20 @@ static expr_type_t vector_double[] = {
}; };
static expr_type_t entity_entity[] = { static expr_type_t entity_entity[] = {
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{0, 0} {0, 0}
}; };
static expr_type_t field_field[] = { static expr_type_t field_field[] = {
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{0, 0} {0, 0}
}; };
static expr_type_t func_func[] = { static expr_type_t func_func[] = {
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{0, 0} {0, 0}
}; };
@ -188,13 +188,13 @@ static expr_type_t pointer_pointer[] = {
{0, 0} {0, 0}
}; };
static expr_type_t pointer_integer[] = { static expr_type_t pointer_int[] = {
{'+', 0, 0, 0, pointer_arithmetic}, {'+', 0, 0, 0, pointer_arithmetic},
{'-', 0, 0, 0, pointer_arithmetic}, {'-', 0, 0, 0, pointer_arithmetic},
{0, 0} {0, 0}
}; };
#define pointer_uinteger pointer_integer #define pointer_uint pointer_int
#define pointer_short pointer_integer #define pointer_short pointer_int
static expr_type_t quat_float[] = { static expr_type_t quat_float[] = {
{'*', &type_quaternion}, {'*', &type_quaternion},
@ -211,18 +211,18 @@ static expr_type_t quat_quat[] = {
{'+', &type_quaternion}, {'+', &type_quaternion},
{'-', &type_quaternion}, {'-', &type_quaternion},
{'*', &type_quaternion}, {'*', &type_quaternion},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{0, 0} {0, 0}
}; };
static expr_type_t quat_integer[] = { static expr_type_t quat_int[] = {
{'*', &type_quaternion, 0, &type_float}, {'*', &type_quaternion, 0, &type_float},
{'/', 0, 0, 0, inverse_multiply}, {'/', 0, 0, 0, inverse_multiply},
{0, 0} {0, 0}
}; };
#define quat_uinteger quat_integer #define quat_uint quat_int
#define quat_short quat_integer #define quat_short quat_int
static expr_type_t quat_double[] = { static expr_type_t quat_double[] = {
{'*', &type_quaternion}, {'*', &type_quaternion},
@ -230,7 +230,7 @@ static expr_type_t quat_double[] = {
{0, 0} {0, 0}
}; };
static expr_type_t integer_float[] = { static expr_type_t int_float[] = {
{'+', &type_float, &type_float, 0}, {'+', &type_float, &type_float, 0},
{'-', &type_float, &type_float, 0}, {'-', &type_float, &type_float, 0},
{'*', &type_float, &type_float, 0}, {'*', &type_float, &type_float, 0},
@ -240,206 +240,206 @@ static expr_type_t integer_float[] = {
{'^', &type_float, &type_float, 0}, {'^', &type_float, &type_float, 0},
{'%', &type_float, &type_float, 0}, {'%', &type_float, &type_float, 0},
{MOD, &type_float, &type_float, 0}, {MOD, &type_float, &type_float, 0},
{SHL, &type_integer, 0, &type_integer}, //FIXME? {SHL, &type_int, 0, &type_int}, //FIXME?
{SHR, &type_integer, 0, &type_integer}, //FIXME? {SHR, &type_int, 0, &type_int}, //FIXME?
{EQ, &type_integer, &type_float, 0}, {EQ, &type_int, &type_float, 0},
{NE, &type_integer, &type_float, 0}, {NE, &type_int, &type_float, 0},
{LE, &type_integer, &type_float, 0}, {LE, &type_int, &type_float, 0},
{GE, &type_integer, &type_float, 0}, {GE, &type_int, &type_float, 0},
{LT, &type_integer, &type_float, 0}, {LT, &type_int, &type_float, 0},
{GT, &type_integer, &type_float, 0}, {GT, &type_int, &type_float, 0},
{0, 0} {0, 0}
}; };
static expr_type_t integer_vector[] = { static expr_type_t int_vector[] = {
{'*', &type_vector, &type_float, 0}, {'*', &type_vector, &type_float, 0},
{0, 0} {0, 0}
}; };
static expr_type_t integer_pointer[] = { static expr_type_t int_pointer[] = {
{'+', 0, 0, 0, pointer_arithmetic}, {'+', 0, 0, 0, pointer_arithmetic},
{0, 0} {0, 0}
}; };
static expr_type_t integer_quat[] = { static expr_type_t int_quat[] = {
{'*', &type_quaternion, &type_float, 0}, {'*', &type_quaternion, &type_float, 0},
{0, 0} {0, 0}
}; };
static expr_type_t integer_integer[] = { static expr_type_t int_int[] = {
{'+', &type_integer}, {'+', &type_int},
{'-', &type_integer}, {'-', &type_int},
{'*', &type_integer}, {'*', &type_int},
{'/', &type_integer}, {'/', &type_int},
{'&', &type_integer}, {'&', &type_int},
{'|', &type_integer}, {'|', &type_int},
{'^', &type_integer}, {'^', &type_int},
{'%', &type_integer}, {'%', &type_int},
{MOD, &type_integer}, {MOD, &type_int},
{SHL, &type_integer}, {SHL, &type_int},
{SHR, &type_integer}, {SHR, &type_int},
{AND, &type_integer}, {AND, &type_int},
{OR, &type_integer}, {OR, &type_int},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{LE, &type_integer}, {LE, &type_int},
{GE, &type_integer}, {GE, &type_int},
{LT, &type_integer}, {LT, &type_int},
{GT, &type_integer}, {GT, &type_int},
{0, 0} {0, 0}
}; };
static expr_type_t integer_uinteger[] = { static expr_type_t int_uint[] = {
{'+', &type_integer}, {'+', &type_int},
{'-', &type_integer}, {'-', &type_int},
{'*', &type_integer}, {'*', &type_int},
{'/', &type_integer}, {'/', &type_int},
{'&', &type_integer}, {'&', &type_int},
{'|', &type_integer}, {'|', &type_int},
{'^', &type_integer}, {'^', &type_int},
{'%', &type_integer}, {'%', &type_int},
{MOD, &type_integer}, {MOD, &type_int},
{SHL, &type_integer}, {SHL, &type_int},
{SHR, &type_integer}, {SHR, &type_int},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{LE, &type_integer}, {LE, &type_int},
{GE, &type_integer}, {GE, &type_int},
{LT, &type_integer}, {LT, &type_int},
{GT, &type_integer}, {GT, &type_int},
{0, 0} {0, 0}
}; };
static expr_type_t integer_short[] = { static expr_type_t int_short[] = {
{'+', &type_integer, 0, &type_integer}, {'+', &type_int, 0, &type_int},
{'-', &type_integer, 0, &type_integer}, {'-', &type_int, 0, &type_int},
{'*', &type_integer, 0, &type_integer}, {'*', &type_int, 0, &type_int},
{'/', &type_integer, 0, &type_integer}, {'/', &type_int, 0, &type_int},
{'&', &type_integer, 0, &type_integer}, {'&', &type_int, 0, &type_int},
{'|', &type_integer, 0, &type_integer}, {'|', &type_int, 0, &type_int},
{'^', &type_integer, 0, &type_integer}, {'^', &type_int, 0, &type_int},
{'%', &type_integer, 0, &type_integer}, {'%', &type_int, 0, &type_int},
{MOD, &type_integer, 0, &type_integer}, {MOD, &type_int, 0, &type_int},
{SHL, &type_integer, 0, &type_integer}, {SHL, &type_int, 0, &type_int},
{SHR, &type_integer, 0, &type_integer}, {SHR, &type_int, 0, &type_int},
{EQ, &type_integer, 0, &type_integer}, {EQ, &type_int, 0, &type_int},
{NE, &type_integer, 0, &type_integer}, {NE, &type_int, 0, &type_int},
{LE, &type_integer, 0, &type_integer}, {LE, &type_int, 0, &type_int},
{GE, &type_integer, 0, &type_integer}, {GE, &type_int, 0, &type_int},
{LT, &type_integer, 0, &type_integer}, {LT, &type_int, 0, &type_int},
{GT, &type_integer, 0, &type_integer}, {GT, &type_int, 0, &type_int},
{0, 0} {0, 0}
}; };
static expr_type_t integer_double[] = { static expr_type_t int_double[] = {
{'+', &type_double, &type_double, 0}, {'+', &type_double, &type_double, 0},
{'-', &type_double, &type_double, 0}, {'-', &type_double, &type_double, 0},
{'*', &type_double, &type_double, 0}, {'*', &type_double, &type_double, 0},
{'/', &type_double, &type_double, 0}, {'/', &type_double, &type_double, 0},
{'%', &type_double, &type_double, 0}, {'%', &type_double, &type_double, 0},
{MOD, &type_double, &type_double, 0}, {MOD, &type_double, &type_double, 0},
{EQ, &type_integer, &type_double, 0}, {EQ, &type_int, &type_double, 0},
{NE, &type_integer, &type_double, 0}, {NE, &type_int, &type_double, 0},
{LE, &type_integer, &type_double, 0}, {LE, &type_int, &type_double, 0},
{GE, &type_integer, &type_double, 0}, {GE, &type_int, &type_double, 0},
{LT, &type_integer, &type_double, 0}, {LT, &type_int, &type_double, 0},
{GT, &type_integer, &type_double, 0}, {GT, &type_int, &type_double, 0},
{0, 0} {0, 0}
}; };
#define uinteger_float integer_float #define uint_float int_float
#define uinteger_vector integer_vector #define uint_vector int_vector
#define uinteger_pointer integer_pointer #define uint_pointer int_pointer
#define uinteger_quat integer_quat #define uint_quat int_quat
static expr_type_t uinteger_integer[] = { static expr_type_t uint_int[] = {
{'+', &type_integer}, {'+', &type_int},
{'-', &type_integer}, {'-', &type_int},
{'*', &type_integer}, {'*', &type_int},
{'/', &type_integer}, {'/', &type_int},
{'&', &type_integer}, {'&', &type_int},
{'|', &type_integer}, {'|', &type_int},
{'^', &type_integer}, {'^', &type_int},
{'%', &type_integer}, {'%', &type_int},
{MOD, &type_integer}, {MOD, &type_int},
{SHL, &type_uinteger}, {SHL, &type_uint},
{SHR, &type_uinteger}, {SHR, &type_uint},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{LE, &type_integer}, {LE, &type_int},
{GE, &type_integer}, {GE, &type_int},
{LT, &type_integer}, {LT, &type_int},
{GT, &type_integer}, {GT, &type_int},
{0, 0} {0, 0}
}; };
static expr_type_t uinteger_uinteger[] = { static expr_type_t uint_uint[] = {
{'+', &type_uinteger}, {'+', &type_uint},
{'-', &type_uinteger}, {'-', &type_uint},
{'*', &type_uinteger}, {'*', &type_uint},
{'/', &type_uinteger}, {'/', &type_uint},
{'&', &type_uinteger}, {'&', &type_uint},
{'|', &type_uinteger}, {'|', &type_uint},
{'^', &type_uinteger}, {'^', &type_uint},
{'%', &type_uinteger}, {'%', &type_uint},
{MOD, &type_uinteger}, {MOD, &type_uint},
{SHL, &type_uinteger}, {SHL, &type_uint},
{SHR, &type_uinteger}, {SHR, &type_uint},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{LE, &type_integer}, {LE, &type_int},
{GE, &type_integer}, {GE, &type_int},
{LT, &type_integer}, {LT, &type_int},
{GT, &type_integer}, {GT, &type_int},
{0, 0} {0, 0}
}; };
#define uinteger_short uinteger_integer #define uint_short uint_int
#define uinteger_double integer_double #define uint_double int_double
#define short_float integer_float #define short_float int_float
#define short_vector integer_vector #define short_vector int_vector
#define short_pointer integer_pointer #define short_pointer int_pointer
#define short_quat integer_quat #define short_quat int_quat
static expr_type_t short_integer[] = { static expr_type_t short_int[] = {
{'+', &type_integer, &type_integer, 0}, {'+', &type_int, &type_int, 0},
{'-', &type_integer, &type_integer, 0}, {'-', &type_int, &type_int, 0},
{'*', &type_integer, &type_integer, 0}, {'*', &type_int, &type_int, 0},
{'/', &type_integer, &type_integer, 0}, {'/', &type_int, &type_int, 0},
{'&', &type_integer, &type_integer, 0}, {'&', &type_int, &type_int, 0},
{'|', &type_integer, &type_integer, 0}, {'|', &type_int, &type_int, 0},
{'^', &type_integer, &type_integer, 0}, {'^', &type_int, &type_int, 0},
{'%', &type_integer, &type_integer, 0}, {'%', &type_int, &type_int, 0},
{MOD, &type_integer, &type_integer, 0}, {MOD, &type_int, &type_int, 0},
{SHL, &type_short}, {SHL, &type_short},
{SHR, &type_short}, {SHR, &type_short},
{EQ, &type_integer, &type_integer, 0}, {EQ, &type_int, &type_int, 0},
{NE, &type_integer, &type_integer, 0}, {NE, &type_int, &type_int, 0},
{LE, &type_integer, &type_integer, 0}, {LE, &type_int, &type_int, 0},
{GE, &type_integer, &type_integer, 0}, {GE, &type_int, &type_int, 0},
{LT, &type_integer, &type_integer, 0}, {LT, &type_int, &type_int, 0},
{GT, &type_integer, &type_integer, 0}, {GT, &type_int, &type_int, 0},
{0, 0} {0, 0}
}; };
static expr_type_t short_uinteger[] = { static expr_type_t short_uint[] = {
{'+', &type_uinteger, &type_uinteger, 0}, {'+', &type_uint, &type_uint, 0},
{'-', &type_uinteger, &type_uinteger, 0}, {'-', &type_uint, &type_uint, 0},
{'*', &type_uinteger, &type_uinteger, 0}, {'*', &type_uint, &type_uint, 0},
{'/', &type_uinteger, &type_uinteger, 0}, {'/', &type_uint, &type_uint, 0},
{'&', &type_uinteger, &type_uinteger, 0}, {'&', &type_uint, &type_uint, 0},
{'|', &type_uinteger, &type_uinteger, 0}, {'|', &type_uint, &type_uint, 0},
{'^', &type_uinteger, &type_uinteger, 0}, {'^', &type_uint, &type_uint, 0},
{'%', &type_uinteger, &type_uinteger, 0}, {'%', &type_uint, &type_uint, 0},
{MOD, &type_uinteger, &type_uinteger, 0}, {MOD, &type_uint, &type_uint, 0},
{SHL, &type_short}, {SHL, &type_short},
{SHR, &type_short}, {SHR, &type_short},
{EQ, &type_integer, &type_uinteger, 0}, {EQ, &type_int, &type_uint, 0},
{NE, &type_integer, &type_uinteger, 0}, {NE, &type_int, &type_uint, 0},
{LE, &type_integer, &type_uinteger, 0}, {LE, &type_int, &type_uint, 0},
{GE, &type_integer, &type_uinteger, 0}, {GE, &type_int, &type_uint, 0},
{LT, &type_integer, &type_uinteger, 0}, {LT, &type_int, &type_uint, 0},
{GT, &type_integer, &type_uinteger, 0}, {GT, &type_int, &type_uint, 0},
{0, 0} {0, 0}
}; };
@ -455,15 +455,15 @@ static expr_type_t short_short[] = {
{MOD, &type_short}, {MOD, &type_short},
{SHL, &type_short}, {SHL, &type_short},
{SHR, &type_short}, {SHR, &type_short},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{LE, &type_integer}, {LE, &type_int},
{GE, &type_integer}, {GE, &type_int},
{LT, &type_integer}, {LT, &type_int},
{GT, &type_integer}, {GT, &type_int},
{0, 0} {0, 0}
}; };
#define short_double integer_double #define short_double int_double
static expr_type_t double_float[] = { static expr_type_t double_float[] = {
{'+', &type_double, 0, &type_double}, {'+', &type_double, 0, &type_double},
@ -491,7 +491,7 @@ static expr_type_t double_quat[] = {
{0, 0} {0, 0}
}; };
static expr_type_t double_integer[] = { static expr_type_t double_int[] = {
{'+', &type_double, 0, &type_double}, {'+', &type_double, 0, &type_double},
{'-', &type_double, 0, &type_double}, {'-', &type_double, 0, &type_double},
{'*', &type_double, 0, &type_double}, {'*', &type_double, 0, &type_double},
@ -506,8 +506,8 @@ static expr_type_t double_integer[] = {
{GT, 0, 0, 0, double_compare}, {GT, 0, 0, 0, double_compare},
{0, 0} {0, 0}
}; };
#define double_uinteger double_integer #define double_uint double_int
#define double_short double_integer #define double_short double_int
static expr_type_t double_double[] = { static expr_type_t double_double[] = {
{'+', &type_double}, {'+', &type_double},
@ -516,12 +516,12 @@ static expr_type_t double_double[] = {
{'/', &type_double}, {'/', &type_double},
{'%', &type_double}, {'%', &type_double},
{MOD, &type_double}, {MOD, &type_double},
{EQ, &type_integer}, {EQ, &type_int},
{NE, &type_integer}, {NE, &type_int},
{LE, &type_integer}, {LE, &type_int},
{GE, &type_integer}, {GE, &type_int},
{LT, &type_integer}, {LT, &type_int},
{GT, &type_integer}, {GT, &type_int},
{0, 0} {0, 0}
}; };
@ -535,8 +535,8 @@ static expr_type_t *string_x[ev_type_count] = {
0, // ev_func 0, // ev_func
0, // ev_pointer 0, // ev_pointer
0, // ev_quat 0, // ev_quat
0, // ev_integer 0, // ev_int
0, // ev_uinteger 0, // ev_uint
0, // ev_short 0, // ev_short
0, // ev_double 0, // ev_double
}; };
@ -551,8 +551,8 @@ static expr_type_t *float_x[ev_type_count] = {
0, // ev_func 0, // ev_func
0, // ev_pointer 0, // ev_pointer
float_quat, float_quat,
float_integer, float_int,
float_uinteger, float_uint,
float_short, float_short,
float_double, float_double,
}; };
@ -567,8 +567,8 @@ static expr_type_t *vector_x[ev_type_count] = {
0, // ev_func 0, // ev_func
0, // ev_pointer 0, // ev_pointer
0, // ev_quaternion 0, // ev_quaternion
vector_integer, vector_int,
vector_uinteger, vector_uint,
vector_short, vector_short,
vector_double, vector_double,
}; };
@ -583,8 +583,8 @@ static expr_type_t *entity_x[ev_type_count] = {
0, // ev_func 0, // ev_func
0, // ev_pointer 0, // ev_pointer
0, // ev_quaternion 0, // ev_quaternion
0, // ev_integer 0, // ev_int
0, // ev_uinteger 0, // ev_uint
0, // ev_short 0, // ev_short
0, // ev_double 0, // ev_double
}; };
@ -599,8 +599,8 @@ static expr_type_t *field_x[ev_type_count] = {
0, // ev_func 0, // ev_func
0, // ev_pointer 0, // ev_pointer
0, // ev_quaternion 0, // ev_quaternion
0, // ev_integer 0, // ev_int
0, // ev_uinteger 0, // ev_uint
0, // ev_short 0, // ev_short
0, // ev_double 0, // ev_double
}; };
@ -615,8 +615,8 @@ static expr_type_t *func_x[ev_type_count] = {
func_func, // ev_func func_func, // ev_func
0, // ev_pointer 0, // ev_pointer
0, // ev_quaternion 0, // ev_quaternion
0, // ev_integer 0, // ev_int
0, // ev_uinteger 0, // ev_uint
0, // ev_short 0, // ev_short
0, // ev_double 0, // ev_double
}; };
@ -631,8 +631,8 @@ static expr_type_t *pointer_x[ev_type_count] = {
0, // ev_func 0, // ev_func
pointer_pointer, pointer_pointer,
0, // ev_quat 0, // ev_quat
pointer_integer, pointer_int,
pointer_uinteger, pointer_uint,
pointer_short, pointer_short,
0, // ev_double 0, // ev_double
}; };
@ -647,42 +647,42 @@ static expr_type_t *quat_x[ev_type_count] = {
0, // ev_func 0, // ev_func
0, // ev_pointer 0, // ev_pointer
quat_quat, quat_quat,
quat_integer, quat_int,
quat_uinteger, quat_uint,
quat_short, quat_short,
quat_double, quat_double,
}; };
static expr_type_t *integer_x[ev_type_count] = { static expr_type_t *int_x[ev_type_count] = {
0, // ev_void 0, // ev_void
0, // ev_string 0, // ev_string
integer_float, int_float,
integer_vector, int_vector,
0, // ev_entity 0, // ev_entity
0, // ev_field 0, // ev_field
0, // ev_func 0, // ev_func
integer_pointer, int_pointer,
integer_quat, int_quat,
integer_integer, int_int,
integer_uinteger, int_uint,
integer_short, int_short,
integer_double, int_double,
}; };
static expr_type_t *uinteger_x[ev_type_count] = { static expr_type_t *uint_x[ev_type_count] = {
0, // ev_void 0, // ev_void
0, // ev_string 0, // ev_string
uinteger_float, uint_float,
uinteger_vector, uint_vector,
0, // ev_entity 0, // ev_entity
0, // ev_field 0, // ev_field
0, // ev_func 0, // ev_func
uinteger_pointer, uint_pointer,
uinteger_quat, uint_quat,
uinteger_integer, uint_int,
uinteger_uinteger, uint_uint,
uinteger_short, uint_short,
uinteger_double, uint_double,
}; };
static expr_type_t *short_x[ev_type_count] = { static expr_type_t *short_x[ev_type_count] = {
@ -695,8 +695,8 @@ static expr_type_t *short_x[ev_type_count] = {
0, // ev_func 0, // ev_func
short_pointer, short_pointer,
short_quat, short_quat,
short_integer, short_int,
short_uinteger, short_uint,
short_short, short_short,
short_double, short_double,
}; };
@ -711,8 +711,8 @@ static expr_type_t *double_x[ev_type_count] = {
0, // ev_func 0, // ev_func
0, // ev_pointer 0, // ev_pointer
double_quat, double_quat,
double_integer, double_int,
double_uinteger, double_uint,
double_short, double_short,
double_double, double_double,
}; };
@ -727,8 +727,8 @@ static expr_type_t **binary_expr_types[ev_type_count] = {
func_x, func_x,
pointer_x, pointer_x,
quat_x, quat_x,
integer_x, int_x,
uinteger_x, uint_x,
short_x, short_x,
double_x double_x
}; };
@ -755,20 +755,20 @@ pointer_arithmetic (int op, expr_t *e1, expr_t *e2)
return error (e2, "cannot use %c on pointers of different types", return error (e2, "cannot use %c on pointers of different types",
op); op);
} }
e1 = cast_expr (&type_integer, e1); e1 = cast_expr (&type_int, e1);
e2 = cast_expr (&type_integer, e2); e2 = cast_expr (&type_int, e2);
psize = new_integer_expr (type_size (t1->t.fldptr.type)); psize = new_int_expr (type_size (t1->t.fldptr.type));
return binary_expr ('/', binary_expr ('-', e1, e2), psize); return binary_expr ('/', binary_expr ('-', e1, e2), psize);
} else if (is_pointer (t1)) { } else if (is_pointer (t1)) {
offset = cast_expr (&type_integer, e2); offset = cast_expr (&type_int, e2);
ptr = cast_expr (&type_integer, e1); ptr = cast_expr (&type_int, e1);
ptype = t1; ptype = t1;
} else if (is_pointer (t2)) { } else if (is_pointer (t2)) {
offset = cast_expr (&type_integer, e1); offset = cast_expr (&type_int, e1);
ptr = cast_expr (&type_integer, e2); ptr = cast_expr (&type_int, e2);
ptype = t2; ptype = t2;
} }
psize = new_integer_expr (type_size (ptype->t.fldptr.type)); psize = new_int_expr (type_size (ptype->t.fldptr.type));
e = binary_expr (op, ptr, binary_expr ('*', offset, psize)); e = binary_expr (op, ptr, binary_expr ('*', offset, psize));
return cast_expr (ptype, e); return cast_expr (ptype, e);
} }
@ -785,7 +785,7 @@ pointer_compare (int op, expr_t *e1, expr_t *e2)
get_op_string (op)); get_op_string (op));
} }
e = new_binary_expr (op, e1, e2); e = new_binary_expr (op, e1, e2);
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
return e; return e;
} }
@ -817,19 +817,19 @@ double_compare (int op, expr_t *e1, expr_t *e2)
if (is_float (t2)) { if (is_float (t2)) {
warning (e2, "comparison between double and float"); warning (e2, "comparison between double and float");
} else if (!is_constant (e2)) { } else if (!is_constant (e2)) {
warning (e2, "comparison between double and integer"); warning (e2, "comparison between double and int");
} }
e2 = cast_expr (&type_double, e2); e2 = cast_expr (&type_double, e2);
} else if (is_double (t2)) { } else if (is_double (t2)) {
if (is_float (t1)) { if (is_float (t1)) {
warning (e1, "comparison between float and double"); warning (e1, "comparison between float and double");
} else if (!is_constant (e1)) { } else if (!is_constant (e1)) {
warning (e1, "comparison between integer and double"); warning (e1, "comparison between int and double");
} }
e1 = cast_expr (&type_double, e1); e1 = cast_expr (&type_double, e1);
} }
e = new_binary_expr (op, e1, e2); e = new_binary_expr (op, e1, e2);
e->e.expr.type = &type_integer; e->e.expr.type = &type_int;
return e; return e;
} }

View file

@ -97,10 +97,10 @@ test_expr (expr_t *e)
case ev_long: case ev_long:
case ev_ulong: case ev_ulong:
internal_error (e, "long not implemented"); internal_error (e, "long not implemented");
case ev_uinteger: case ev_uint:
case ev_integer: case ev_int:
case ev_short: case ev_short:
if (!is_integer(type_default)) { if (!is_int(type_default)) {
if (is_constant (e)) { if (is_constant (e)) {
return cast_expr (type_default, e); return cast_expr (type_default, e);
} }
@ -285,8 +285,8 @@ convert_bool (expr_t *e, int block)
int val; int val;
b = goto_expr (0); b = goto_expr (0);
if (is_integer_val (e)) { if (is_int_val (e)) {
val = expr_integer (e); val = expr_int (e);
} else { } else {
val = expr_float (e) != 0; val = expr_float (e) != 0;
} }

View file

@ -665,7 +665,7 @@ build_builtin_function (symbol_t *sym, expr_t *bi_val, int far,
error (bi_val, "%s redefined", sym->name); error (bi_val, "%s redefined", sym->name);
return 0; return 0;
} }
if (!is_integer_val (bi_val) && !is_float_val (bi_val)) { if (!is_int_val (bi_val) && !is_float_val (bi_val)) {
error (bi_val, "invalid constant for = #"); error (bi_val, "invalid constant for = #");
return 0; return 0;
} }
@ -681,8 +681,8 @@ build_builtin_function (symbol_t *sym, expr_t *bi_val, int far,
sym->s.func->def->nosave = 1; sym->s.func->def->nosave = 1;
add_function (sym->s.func); add_function (sym->s.func);
if (is_integer_val (bi_val)) if (is_int_val (bi_val))
bi = expr_integer (bi_val); bi = expr_int (bi_val);
else else
bi = expr_float (bi_val); bi = expr_float (bi_val);
if (bi < 0) { if (bi < 0) {

View file

@ -543,8 +543,8 @@ emit_methods_count (def_t *def, void *data, int index)
{ {
methodlist_t *methods = (methodlist_t *) data; methodlist_t *methods = (methodlist_t *) data;
if (!is_integer(def->type)) if (!is_int(def->type))
internal_error (0, "%s: expected integer def", __FUNCTION__); internal_error (0, "%s: expected int def", __FUNCTION__);
D_INT (def) = methods->count; D_INT (def) = methods->count;
} }
@ -586,7 +586,7 @@ emit_methods (methodlist_t *methods, const char *name, int instance)
{ {
static struct_def_t methods_struct[] = { static struct_def_t methods_struct[] = {
{"method_next", &type_pointer, emit_methods_next}, {"method_next", &type_pointer, emit_methods_next},
{"method_count", &type_integer, emit_methods_count}, {"method_count", &type_int, emit_methods_count},
{"method_list", 0, emit_methods_list_item}, {"method_list", 0, emit_methods_list_item},
{0, 0} {0, 0}
}; };
@ -622,8 +622,8 @@ emit_method_list_count (def_t *def, void *data, int index)
{ {
methodlist_t *methods = (methodlist_t *) data; methodlist_t *methods = (methodlist_t *) data;
if (!is_integer(def->type)) if (!is_int(def->type))
internal_error (0, "%s: expected integer def", __FUNCTION__); internal_error (0, "%s: expected int def", __FUNCTION__);
D_INT (def) = methods->count; D_INT (def) = methods->count;
} }
@ -660,7 +660,7 @@ emit_method_descriptions (methodlist_t *methods, const char *name,
int instance) int instance)
{ {
static struct_def_t method_list_struct[] = { static struct_def_t method_list_struct[] = {
{"count", &type_integer, emit_method_list_count}, {"count", &type_int, emit_method_list_count},
{"method_list", 0, emit_method_list_item}, {"method_list", 0, emit_method_list_item},
{0, 0} {0, 0}
}; };
@ -746,8 +746,8 @@ method_check_params (method_t *method, expr_t *args)
} }
} }
} else { } else {
if (is_integer_val (e) && options.warnings.vararg_integer) { if (is_int_val (e) && options.warnings.vararg_integer) {
warning (e, "passing integer consant into ... function"); warning (e, "passing int consant into ... function");
} }
} }
} }

View file

@ -434,7 +434,7 @@ qfo_byteswap_space (void *space, int size, qfos_type_t type)
case qfos_type: case qfos_type:
case qfos_debug: case qfos_debug:
for (val = (pr_type_t *) space, c = 0; c < size; c++, val++) for (val = (pr_type_t *) space, c = 0; c < size; c++, val++)
val->integer_var = LittleLong (val->integer_var); val->int_var = LittleLong (val->int_var);
break; break;
} }
} }
@ -696,7 +696,7 @@ get_def_type (qfo_t *qfo, pr_ptr_t type)
case ty_enum: case ty_enum:
if (options.code.progsversion == PROG_ID_VERSION) if (options.code.progsversion == PROG_ID_VERSION)
return ev_float; return ev_float;
return ev_integer; return ev_int;
case ty_array: case ty_array:
case ty_class: case ty_class:
return ev_invalid; return ev_invalid;
@ -732,7 +732,7 @@ get_type_size (qfo_t *qfo, pr_ptr_t type)
} }
return size; return size;
case ty_enum: case ty_enum:
return pr_type_size[ev_integer]; return pr_type_size[ev_int];
case ty_array: case ty_array:
return type_def->array.size return type_def->array.size
* get_type_size (qfo, type_def->array.type); * get_type_size (qfo, type_def->array.type);
@ -781,7 +781,7 @@ get_type_alignment_log (qfo_t *qfo, pr_ptr_t type)
} }
return alignment; return alignment;
case ty_enum: case ty_enum:
return qfo_log2 (ev_types[ev_integer]->alignment); return qfo_log2 (ev_types[ev_int]->alignment);
case ty_array: case ty_array:
return get_type_alignment_log (qfo, type_def->array.type); return get_type_alignment_log (qfo, type_def->array.type);
case ty_class: case ty_class:

View file

@ -214,7 +214,7 @@ qfo_encode_struct (type_t *type, defspace_t *space)
if (i == num_fields) if (i == num_fields)
internal_error (0, "whoa, what happened?"); internal_error (0, "whoa, what happened?");
if (sym->sy_type == sy_const) if (sym->sy_type == sy_const)
offset = sym->s.value->v.integer_val; offset = sym->s.value->v.int_val;
else else
offset = sym->s.offset; offset = sym->s.offset;
ENC_DEF (strct->fields[i].type, field_types[i]); ENC_DEF (strct->fields[i].type, field_types[i]);

View file

@ -241,11 +241,11 @@ v6p_opcode_init (void)
// treats the operands of certain operands as integers // treats the operands of certain operands as integers
// irrespective the progs version, so convert the engine's // irrespective the progs version, so convert the engine's
// view of the operands to the prog's view. // view of the operands to the prog's view.
if (mop->type_a == ev_integer) if (mop->type_a == ev_int)
mop->type_a = ev_float; mop->type_a = ev_float;
if (mop->type_b == ev_integer) if (mop->type_b == ev_int)
mop->type_b = ev_float; mop->type_b = ev_float;
if (mop->type_c == ev_integer) if (mop->type_c == ev_int)
mop->type_c = ev_float; mop->type_c = ev_float;
} }
Hash_AddElement (v6p_opcode_type_table, mop); Hash_AddElement (v6p_opcode_type_table, mop);

View file

@ -67,7 +67,7 @@ set_traditional (int traditional)
options.traditional = 0; options.traditional = 0;
options.advanced = true; options.advanced = true;
options.code.progsversion = PROG_V6P_VERSION; options.code.progsversion = PROG_V6P_VERSION;
type_default = &type_integer; type_default = &type_int;
break; break;
case 1: case 1:
options.traditional = 1; options.traditional = 1;

View file

@ -131,9 +131,9 @@ STRING \"(\\.|[^"\\])*\"
else else
i = strtol (yytext, 0, 0); i = strtol (yytext, 0, 0);
if (*c == 'u' || *c == 'U') if (*c == 'u' || *c == 'U')
qc_yylval.expr = new_integer_expr (i);//FIXME qc_yylval.expr = new_int_expr (i);//FIXME
else else
qc_yylval.expr = new_integer_expr (i); qc_yylval.expr = new_int_expr (i);
return VALUE; return VALUE;
} }
@ -208,7 +208,7 @@ STRING \"(\\.|[^"\\])*\"
if (str[1]) if (str[1])
warning (0, "multibyte char constant"); warning (0, "multibyte char constant");
qc_yylval.expr = new_integer_expr (*str); qc_yylval.expr = new_int_expr (*str);
return VALUE; return VALUE;
} }
@ -269,7 +269,7 @@ STRING \"(\\.|[^"\\])*\"
"$"{s}*{FRAMEID} { "$"{s}*{FRAMEID} {
int ret = do_grab (yytext); int ret = do_grab (yytext);
if (ret >= 0) { if (ret >= 0) {
qc_yylval.expr = new_integer_expr (ret); qc_yylval.expr = new_int_expr (ret);
return VALUE; return VALUE;
} else { } else {
BEGIN (-ret); BEGIN (-ret);
@ -376,8 +376,8 @@ static keyword_t at_keywords[] = {
static keyword_t qf_keywords[] = { static keyword_t qf_keywords[] = {
{"quaternion", TYPE, &type_quaternion}, {"quaternion", TYPE, &type_quaternion},
{"double", TYPE, &type_double}, {"double", TYPE, &type_double},
{"int", TYPE, &type_integer }, {"int", TYPE, &type_int },
{"unsigned", TYPE, &type_integer },//FIXME {"unsigned", TYPE, &type_int },//FIXME
{"@function", TYPE, &type_function }, {"@function", TYPE, &type_function },
{"@args", ARGS, 0 }, {"@args", ARGS, 0 },

View file

@ -969,11 +969,11 @@ abs_decl
array_decl array_decl
: '[' expr ']' : '[' expr ']'
{ {
if (!is_integer_val ($2) || expr_integer ($2) < 1) { if (!is_int_val ($2) || expr_int ($2) < 1) {
error (0, "invalid array size"); error (0, "invalid array size");
$$ = 0; $$ = 0;
} else { } else {
$$ = expr_integer ($2); $$ = expr_int ($2);
} }
} }
| '[' ']' { $$ = 0; } | '[' ']' { $$ = 0; }
@ -1104,7 +1104,7 @@ non_code_func
if (sym->s.def) if (sym->s.def)
sym->s.def->nosave |= spec.nosave; sym->s.def->nosave |= spec.nosave;
} else { } else {
if (is_integer_val ($2) || is_float_val ($2)) { if (is_int_val ($2) || is_float_val ($2)) {
error (0, "invalid function initializer." error (0, "invalid function initializer."
" did you forget #?"); " did you forget #?");
} else { } else {

View file

@ -246,7 +246,7 @@ WriteProgs (dprograms_t *progs, int size)
fielddefs[i].name = LittleLong (fielddefs[i].name); fielddefs[i].name = LittleLong (fielddefs[i].name);
} }
for (i = 0; i < progs->numglobals; i++) for (i = 0; i < progs->numglobals; i++)
globals[i].integer_var = LittleLong (globals[i].integer_var); globals[i].int_var = LittleLong (globals[i].int_var);
if (!(h = Qopen (options.output_file, "wb"))) if (!(h = Qopen (options.output_file, "wb")))
Sys_Error ("%s: %s\n", options.output_file, strerror(errno)); Sys_Error ("%s: %s\n", options.output_file, strerror(errno));
@ -307,7 +307,7 @@ WriteSym (pr_debug_header_t *sym, int size)
debug_defs[i].type_encoding = LittleLong (debug_defs[i].type_encoding); debug_defs[i].type_encoding = LittleLong (debug_defs[i].type_encoding);
} }
for (i = 0; i < sym->debug_data_size; i++) { for (i = 0; i < sym->debug_data_size; i++) {
debug_data[i].integer_var = LittleLong (debug_data[i].integer_var); debug_data[i].int_var = LittleLong (debug_data[i].int_var);
} }
if (!(h = Qopen (options.debug_file, "wb"))) if (!(h = Qopen (options.debug_file, "wb")))
@ -441,9 +441,9 @@ finish_link (void)
if (options.code.progsversion != PROG_ID_VERSION) { if (options.code.progsversion != PROG_ID_VERSION) {
pr_int_t param_size = type_size (&type_param); pr_int_t param_size = type_size (&type_param);
pr_int_t param_alignment = qfo_log2 (type_param.alignment); pr_int_t param_alignment = qfo_log2 (type_param.alignment);
linker_add_def (".param_size", &type_integer, flags, linker_add_def (".param_size", &type_int, flags,
&param_size); &param_size);
linker_add_def (".param_alignment", &type_integer, flags, linker_add_def (".param_alignment", &type_int, flags,
&param_alignment); &param_alignment);
linker_add_def (".xdefs", &type_xdefs, flags, 0); linker_add_def (".xdefs", &type_xdefs, flags, 0);
} }

View file

@ -113,7 +113,7 @@ FRAMEID {ID}(\.{ID})*
i = strtol (yytext + 2, 0, 2); i = strtol (yytext + 2, 0, 2);
else else
i = strtol (yytext, 0, 0); i = strtol (yytext, 0, 0);
qp_yylval.expr = new_integer_expr (i); qp_yylval.expr = new_int_expr (i);
return VALUE; return VALUE;
} }
@ -170,7 +170,7 @@ FRAMEID {ID}(\.{ID})*
"$"{s}*{FRAMEID} { "$"{s}*{FRAMEID} {
int ret = do_grab (yytext); int ret = do_grab (yytext);
if (ret >= 0) { if (ret >= 0) {
qp_yylval.expr = new_integer_expr (ret); qp_yylval.expr = new_int_expr (ret);
return VALUE; return VALUE;
} else { } else {
BEGIN (-ret); BEGIN (-ret);
@ -209,7 +209,7 @@ static keyword_t keywords[] = {
{"vector", TYPE, &type_vector}, {"vector", TYPE, &type_vector},
{"entity", TYPE, &type_entity}, {"entity", TYPE, &type_entity},
{"quaternion", TYPE, &type_quaternion}, {"quaternion", TYPE, &type_quaternion},
{"integer", TYPE, &type_integer}, {"integer", TYPE, &type_int},
{"program", PROGRAM, 0}, {"program", PROGRAM, 0},
{"var", VAR, 0}, {"var", VAR, 0},

View file

@ -148,7 +148,7 @@ build_dotmain (symbol_t *program)
expr_t *exitcode; expr_t *exitcode;
dotmain->params = 0; dotmain->params = 0;
dotmain->type = parse_params (&type_integer, 0); dotmain->type = parse_params (&type_int, 0);
dotmain->type = find_type (dotmain->type); dotmain->type = find_type (dotmain->type);
dotmain = function_symbol (dotmain, 0, 1); dotmain = function_symbol (dotmain, 0, 1);
@ -198,7 +198,7 @@ program_head
// FIXME need units and standard units // FIXME need units and standard units
{ {
symbol_t *sym = new_symbol ("ExitCode"); symbol_t *sym = new_symbol ("ExitCode");
sym->type = &type_integer; sym->type = &type_int;
initialize_def (sym, 0, current_symtab->space, sc_global); initialize_def (sym, 0, current_symtab->space, sc_global);
if (sym->s.def) { if (sym->s.def) {
sym->s.def->nosave = 1; sym->s.def->nosave = 1;
@ -245,7 +245,7 @@ type
: standard_type : standard_type
| ARRAY '[' VALUE RANGE VALUE ']' OF standard_type | ARRAY '[' VALUE RANGE VALUE ']' OF standard_type
{ {
$$ = based_array_type ($8, expr_integer ($3), expr_integer ($5)); $$ = based_array_type ($8, expr_int ($3), expr_int ($5));
} }
; ;
@ -480,7 +480,7 @@ name
{ {
if (!$1->table) { if (!$1->table) {
error (0, "%s undefined", $1->name); error (0, "%s undefined", $1->name);
$1->type = &type_integer; $1->type = &type_int;
symtab_addsymbol (current_symtab, $1); symtab_addsymbol (current_symtab, $1);
} }
$$ = new_symbol_expr ($1); $$ = new_symbol_expr ($1);

View file

@ -73,7 +73,7 @@ static const char *reloc_name[] = {
"rel_def_field_ofs", "rel_def_field_ofs",
}; };
#define RELOC(r) (r)->space->data[(r)->offset].integer_var #define RELOC(r) (r)->space->data[(r)->offset].int_var
void void
relocate_refs (reloc_t *reloc, int offset) relocate_refs (reloc_t *reloc, int offset)
@ -168,8 +168,8 @@ relocate_refs (reloc_t *reloc, int offset)
break; break;
case rel_def_field_ofs: case rel_def_field_ofs:
//FIXME what is correct here? //FIXME what is correct here?
//RELOC (reloc) += pr.data->data[offset].integer_var; //RELOC (reloc) += pr.data->data[offset].int_var;
RELOC (reloc) += pr.near_data->data[offset].integer_var; RELOC (reloc) += pr.near_data->data[offset].int_var;
break; break;
} }
reloc = reloc->next; reloc = reloc->next;

View file

@ -72,7 +72,7 @@ check_undefined (symbol_t *sym)
if (options.code.progsversion == PROG_ID_VERSION) if (options.code.progsversion == PROG_ID_VERSION)
sym->type = &type_float; sym->type = &type_float;
else else
sym->type = &type_integer; sym->type = &type_int;
} }
return sym; return sym;
} }

View file

@ -155,13 +155,13 @@ operand_string (operand_t *op)
case ev_field: case ev_field:
return va (0, "field %d", op->value->v.pointer.val); return va (0, "field %d", op->value->v.pointer.val);
case ev_entity: case ev_entity:
return va (0, "ent %d", op->value->v.integer_val); return va (0, "ent %d", op->value->v.int_val);
case ev_func: case ev_func:
return va (0, "func %d", op->value->v.integer_val); return va (0, "func %d", op->value->v.int_val);
case ev_integer: case ev_int:
return va (0, "int %d", op->value->v.integer_val); return va (0, "int %d", op->value->v.int_val);
case ev_uinteger: case ev_uint:
return va (0, "uint %u", op->value->v.uinteger_val); return va (0, "uint %u", op->value->v.uint_val);
case ev_long: case ev_long:
return va (0, "long %"PRIi64, op->value->v.long_val); return va (0, "long %"PRIi64, op->value->v.long_val);
case ev_ulong: case ev_ulong:
@ -237,11 +237,11 @@ _print_operand (operand_t *op)
break; break;
case ev_entity: case ev_entity:
case ev_func: case ev_func:
case ev_integer: case ev_int:
printf ("%d", op->value->v.integer_val); printf ("%d", op->value->v.int_val);
break; break;
case ev_uinteger: case ev_uint:
printf ("%u", op->value->v.uinteger_val); printf ("%u", op->value->v.uint_val);
break; break;
case ev_long: case ev_long:
printf ("%"PRIu64, op->value->v.long_val); printf ("%"PRIu64, op->value->v.long_val);
@ -804,7 +804,7 @@ expr_assign_copy (sblock_t *sblock, expr_t *e, operand_t **op, operand_t *src)
if ((src && src->op_type == op_nil) || src_expr->type == ex_nil) { if ((src && src->op_type == op_nil) || src_expr->type == ex_nil) {
// switch to memset because nil is type agnostic 0 and structures // switch to memset because nil is type agnostic 0 and structures
// can be any size // can be any size
src_expr = new_integer_expr (0); src_expr = new_int_expr (0);
sblock = statement_subexpr (sblock, src_expr, &src); sblock = statement_subexpr (sblock, src_expr, &src);
opcode_set = opcode_sets[1]; opcode_set = opcode_sets[1];
if (op) { if (op) {
@ -853,7 +853,7 @@ expr_assign_copy (sblock_t *sblock, expr_t *e, operand_t **op, operand_t *src)
if (count < (1 << 16)) { if (count < (1 << 16)) {
count_expr = expr_file_line (new_short_expr (count), e); count_expr = expr_file_line (new_short_expr (count), e);
} else { } else {
count_expr = expr_file_line (new_integer_expr (count), e); count_expr = expr_file_line (new_int_expr (count), e);
} }
sblock = statement_subexpr (sblock, count_expr, &size); sblock = statement_subexpr (sblock, count_expr, &size);
@ -1210,7 +1210,7 @@ expr_alias (sblock_t *sblock, expr_t *e, operand_t **op)
int offset = 0; int offset = 0;
if (e->e.alias.offset) { if (e->e.alias.offset) {
offset = expr_integer (e->e.alias.offset); offset = expr_int (e->e.alias.offset);
} }
type = e->e.alias.type; type = e->e.alias.type;
sblock = statement_subexpr (sblock, e->e.alias.expr, &aop); sblock = statement_subexpr (sblock, e->e.alias.expr, &aop);
@ -1473,9 +1473,9 @@ expr_nil (sblock_t *sblock, expr_t *e, operand_t **op)
if (nil_size < 0x10000) { if (nil_size < 0x10000) {
size_expr = new_short_expr (nil_size); size_expr = new_short_expr (nil_size);
} else { } else {
size_expr = new_integer_expr (nil_size); size_expr = new_int_expr (nil_size);
} }
sblock = statement_subexpr (sblock, new_integer_expr(0), &zero); sblock = statement_subexpr (sblock, new_int_expr(0), &zero);
sblock = statement_subexpr (sblock, size_expr, &size); sblock = statement_subexpr (sblock, size_expr, &size);
s = new_statement (st_memset, "<MEMSET>", e); s = new_statement (st_memset, "<MEMSET>", e);
@ -1737,12 +1737,12 @@ statement_memset (sblock_t *sblock, expr_t *e)
statement_t *s; statement_t *s;
if (is_constant (count)) { if (is_constant (count)) {
if (is_integer (get_type (count)) if (is_int (get_type (count))
&& (unsigned) expr_integer (count) < 0x10000) { && (unsigned) expr_int (count) < 0x10000) {
count = new_short_expr (expr_integer (count)); count = new_short_expr (expr_int (count));
} }
if (is_uinteger (get_type (count)) && expr_integer (count) < 0x10000) { if (is_uint (get_type (count)) && expr_int (count) < 0x10000) {
count = new_short_expr (expr_uinteger (count)); count = new_short_expr (expr_uint (count));
} }
} }
s = new_statement (st_move, opcode, e); s = new_statement (st_move, opcode, e);

View file

@ -235,17 +235,17 @@ add_enum (symbol_t *enm, symbol_t *name, expr_t *val)
name->type = enum_type; name->type = enum_type;
value = 0; value = 0;
if (enum_tab->symbols) if (enum_tab->symbols)
value = ((symbol_t *)(enum_tab->symtail))->s.value->v.integer_val + 1; value = ((symbol_t *)(enum_tab->symtail))->s.value->v.int_val + 1;
if (val) { if (val) {
convert_name (val); convert_name (val);
if (!is_constant (val)) if (!is_constant (val))
error (val, "non-constant initializer"); error (val, "non-constant initializer");
else if (!is_integer_val (val)) else if (!is_int_val (val))
error (val, "invalid initializer type"); error (val, "invalid initializer type");
else else
value = expr_integer (val); value = expr_int (val);
} }
name->s.value = new_integer_val (value); name->s.value = new_int_val (value);
symtab_addsymbol (enum_tab, name); symtab_addsymbol (enum_tab, name);
} }
@ -263,12 +263,12 @@ enum_as_bool (type_t *enm, expr_t **zero, expr_t **one)
for (sym = symtab->symbols; sym; sym = sym->next) { for (sym = symtab->symbols; sym; sym = sym->next) {
if (sym->sy_type != sy_const) if (sym->sy_type != sy_const)
continue; continue;
val = sym->s.value->v.integer_val; val = sym->s.value->v.int_val;
if (!val) { if (!val) {
zero_sym = sym; zero_sym = sym;
} else { } else {
if (one_sym) { if (one_sym) {
v = one_sym->s.value->v.integer_val; v = one_sym->s.value->v.int_val;
if (val * val > v * v) if (val * val > v * v)
continue; continue;
} }

View file

@ -136,14 +136,14 @@ case_label_expr (switch_block_t *switch_block, expr_t *value)
if (!type_assignable (type, get_type (value))) if (!type_assignable (type, get_type (value)))
return error (value, "type mismatch in case label"); return error (value, "type mismatch in case label");
if (is_integral (type) && is_integral (val_type)) { if (is_integral (type) && is_integral (val_type)) {
value = new_integer_expr (expr_integer (value)); value = new_int_expr (expr_int (value));
debug (value, "integeral label used in integral switch"); debug (value, "integeral label used in integral switch");
} else if (is_integral (type) && is_float (val_type)) { } else if (is_integral (type) && is_float (val_type)) {
warning (value, "float label used in integral switch"); warning (value, "float label used in integral switch");
value = new_integer_expr (expr_float (value)); value = new_int_expr (expr_float (value));
} else if (is_float (type) && is_integral (val_type)) { } else if (is_float (type) && is_integral (val_type)) {
debug (value, "integeral label used in float switch"); debug (value, "integeral label used in float switch");
value = new_float_expr (expr_integer (value)); value = new_float_expr (expr_int (value));
} else if (is_float (type) && is_float (val_type)) { } else if (is_float (type) && is_float (val_type)) {
value = new_float_expr (expr_float (value)); value = new_float_expr (expr_float (value));
debug (value, "float label used in float switch"); debug (value, "float label used in float switch");
@ -189,8 +189,8 @@ label_compare (const void *_a, const void *_b)
return strcmp (s1, s2); return strcmp (s1, s2);
} else if (is_float_val ((*a)->value)) { } else if (is_float_val ((*a)->value)) {
return expr_float ((*a)->value) - expr_float ((*b)->value); return expr_float ((*a)->value) - expr_float ((*b)->value);
} else if (is_integer_val ((*a)->value)) { } else if (is_int_val ((*a)->value)) {
return expr_integer ((*a)->value) - expr_integer ((*b)->value); return expr_int ((*a)->value) - expr_int ((*b)->value);
} }
internal_error (0, "in switch"); internal_error (0, "in switch");
} }
@ -210,9 +210,9 @@ new_case_node (expr_t *low, expr_t *high)
} else { } else {
int size; int size;
if (!is_integer_val (low)) if (!is_int_val (low))
internal_error (low, "switch"); internal_error (low, "switch");
size = expr_integer (high) - expr_integer (low) + 1; size = expr_int (high) - expr_int (low) + 1;
node->labels = calloc (size, sizeof (expr_t *)); node->labels = calloc (size, sizeof (expr_t *));
} }
node->left = node->right = 0; node->left = node->right = 0;
@ -253,18 +253,18 @@ build_case_tree (case_label_t **labels, int count, int range)
if (!nodes) if (!nodes)
Sys_Error ("out of memory"); Sys_Error ("out of memory");
if (range && is_integer_val (labels[0]->value)) { if (range && is_int_val (labels[0]->value)) {
for (i = 0; i < count - 1; i = j, num_nodes++) { for (i = 0; i < count - 1; i = j, num_nodes++) {
for (j = i + 1; j < count; j++) { for (j = i + 1; j < count; j++) {
if (expr_integer (labels[j]->value) if (expr_int (labels[j]->value)
- expr_integer (labels[j - 1]->value) > 1) - expr_int (labels[j - 1]->value) > 1)
break; break;
} }
nodes[num_nodes] = new_case_node (labels[i]->value, nodes[num_nodes] = new_case_node (labels[i]->value,
labels[j - 1]->value); labels[j - 1]->value);
for (k = i; k < j; k++) for (k = i; k < j; k++)
nodes[num_nodes]->labels[expr_integer (labels[k]->value) nodes[num_nodes]->labels[expr_int (labels[k]->value)
- expr_integer (labels[i]->value)] - expr_int (labels[i]->value)]
= labels[k]->label; = labels[k]->label;
} }
if (i < count) { if (i < count) {
@ -311,12 +311,12 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val,
append_expr (sw, test); append_expr (sw, test);
if (tree->low == tree->high) { if (tree->low == tree->high) {
branch = branch_expr (EQ, new_alias_expr (&type_integer, temp), branch = branch_expr (EQ, new_alias_expr (&type_int, temp),
tree->labels[0]); tree->labels[0]);
append_expr (sw, branch); append_expr (sw, branch);
if (tree->left) { if (tree->left) {
branch = branch_expr (GT, new_alias_expr (&type_integer, temp), branch = branch_expr (GT, new_alias_expr (&type_int, temp),
high_label); high_label);
append_expr (sw, branch); append_expr (sw, branch);
@ -329,8 +329,8 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val,
build_switch (sw, tree->right, op, sw_val, temp, default_label); build_switch (sw, tree->right, op, sw_val, temp, default_label);
} }
} else { } else {
int low = expr_integer (tree->low); int low = expr_int (tree->low);
int high = expr_integer (tree->high); int high = expr_int (tree->high);
symbol_t *table_sym; symbol_t *table_sym;
expr_t *table_expr; expr_t *table_expr;
expr_t *table_init; expr_t *table_init;
@ -346,7 +346,7 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val,
append_element (table_init, new_element (label, 0)); append_element (table_init, new_element (label, 0));
} }
table_sym = new_symbol_type (table_name, table_sym = new_symbol_type (table_name,
array_type (&type_integer, array_type (&type_int,
high - low + 1)); high - low + 1));
initialize_def (table_sym, table_init, pr.near_data, sc_static); initialize_def (table_sym, table_init, pr.near_data, sc_static);
table_expr = new_symbol_expr (table_sym); table_expr = new_symbol_expr (table_sym);
@ -355,8 +355,8 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val,
branch = branch_expr (LT, temp, low_label); branch = branch_expr (LT, temp, low_label);
append_expr (sw, branch); append_expr (sw, branch);
} }
test = binary_expr (GT, cast_expr (&type_uinteger, temp), test = binary_expr (GT, cast_expr (&type_uint, temp),
cast_expr (&type_uinteger, range)); cast_expr (&type_uint, range));
branch = branch_expr (NE, test, high_label); branch = branch_expr (NE, test, high_label);
append_expr (sw, branch); append_expr (sw, branch);
branch = jump_table_expr (table_expr, temp); branch = jump_table_expr (table_expr, temp);
@ -382,7 +382,7 @@ check_enum_switch (switch_block_t *switch_block)
for (enum_val = type->t.symtab->symbols; enum_val; for (enum_val = type->t.symtab->symbols; enum_val;
enum_val = enum_val->next) { enum_val = enum_val->next) {
cl.value = new_integer_expr (enum_val->s.value->v.integer_val); cl.value = new_int_expr (enum_val->s.value->v.int_val);
if (!Hash_FindElement (switch_block->labels, &cl)) { if (!Hash_FindElement (switch_block->labels, &cl)) {
warning (switch_block->test, warning (switch_block->test,
"enumeration value `%s' not handled in switch", "enumeration value `%s' not handled in switch",
@ -446,7 +446,7 @@ switch_expr (switch_block_t *switch_block, expr_t *break_label,
case_node_t *case_tree; case_node_t *case_tree;
if (is_string(type)) if (is_string(type))
temp = new_temp_def_expr (&type_integer); temp = new_temp_def_expr (&type_int);
else else
temp = new_temp_def_expr (type); temp = new_temp_def_expr (type);
case_tree = build_case_tree (labels, num_labels, is_integral (type)); case_tree = build_case_tree (labels, num_labels, is_integral (type));

View file

@ -75,8 +75,8 @@ type_t type_function = { ev_func, "function", 1, ty_basic,
type_t type_pointer = { ev_pointer, "pointer", 1, ty_basic, type_t type_pointer = { ev_pointer, "pointer", 1, ty_basic,
{{&type_void}} }; {{&type_void}} };
type_t type_quaternion = { ev_quat, "quaternion", 4 }; type_t type_quaternion = { ev_quat, "quaternion", 4 };
type_t type_integer = { ev_integer, "int", 1 }; type_t type_int = { ev_int, "int", 1 };
type_t type_uinteger = { ev_uinteger, "uint", 1 }; type_t type_uint = { ev_uint, "uint", 1 };
type_t type_short = { ev_short, "short", 1 }; type_t type_short = { ev_short, "short", 1 };
type_t type_double = { ev_double, "double", 2 }; type_t type_double = { ev_double, "double", 2 };
@ -106,8 +106,8 @@ type_t *ev_types[ev_type_count] = {
&type_function, &type_function,
&type_pointer, &type_pointer,
&type_quaternion, &type_quaternion,
&type_integer, &type_int,
&type_uinteger, &type_uint,
&type_short, &type_short,
&type_double, &type_double,
&type_invalid, &type_invalid,
@ -186,8 +186,8 @@ free_type (type_t *type)
case ev_entity: case ev_entity:
case ev_type_count: case ev_type_count:
case ev_quat: case ev_quat:
case ev_integer: case ev_int:
case ev_uinteger: case ev_uint:
case ev_long: case ev_long:
case ev_ulong: case ev_ulong:
case ev_short: case ev_short:
@ -228,8 +228,8 @@ copy_chain (type_t *type, type_t *append)
case ev_entity: case ev_entity:
case ev_type_count: case ev_type_count:
case ev_quat: case ev_quat:
case ev_integer: case ev_int:
case ev_uinteger: case ev_uint:
case ev_long: case ev_long:
case ev_ulong: case ev_ulong:
case ev_short: case ev_short:
@ -281,8 +281,8 @@ append_type (type_t *type, type_t *new)
case ev_entity: case ev_entity:
case ev_type_count: case ev_type_count:
case ev_quat: case ev_quat:
case ev_integer: case ev_int:
case ev_uinteger: case ev_uint:
case ev_long: case ev_long:
case ev_ulong: case ev_ulong:
case ev_short: case ev_short:
@ -660,8 +660,8 @@ print_type_str (dstring_t *str, const type_t *type)
case ev_vector: case ev_vector:
case ev_entity: case ev_entity:
case ev_quat: case ev_quat:
case ev_integer: case ev_int:
case ev_uinteger: case ev_uint:
case ev_long: case ev_long:
case ev_ulong: case ev_ulong:
case ev_short: case ev_short:
@ -822,10 +822,10 @@ encode_type (dstring_t *encoding, const type_t *type)
case ev_quat: case ev_quat:
dasprintf (encoding, "Q"); dasprintf (encoding, "Q");
return; return;
case ev_integer: case ev_int:
dasprintf (encoding, "i"); dasprintf (encoding, "i");
return; return;
case ev_uinteger: case ev_uint:
dasprintf (encoding, "I"); dasprintf (encoding, "I");
return; return;
case ev_long: case ev_long:
@ -863,23 +863,23 @@ is_enum (const type_t *type)
} }
int int
is_integer (const type_t *type) is_int (const type_t *type)
{ {
type = unalias_type (type); type = unalias_type (type);
etype_t t = type->type; etype_t t = type->type;
if (t == ev_integer) if (t == ev_int)
return 1; return 1;
return is_enum (type); return is_enum (type);
} }
int int
is_uinteger (const type_t *type) is_uint (const type_t *type)
{ {
type = unalias_type (type); type = unalias_type (type);
etype_t t = type->type; etype_t t = type->type;
if (t == ev_uinteger) if (t == ev_uint)
return 1; return 1;
return is_enum (type); return is_enum (type);
} }
@ -899,7 +899,7 @@ int
is_integral (const type_t *type) is_integral (const type_t *type)
{ {
type = unalias_type (type); type = unalias_type (type);
if (is_integer (type) || is_uinteger (type) || is_short (type)) if (is_int (type) || is_uint (type) || is_short (type))
return 1; return 1;
return is_enum (type); return is_enum (type);
} }
@ -1103,7 +1103,7 @@ type_size (const type_t *type)
case ty_enum: case ty_enum:
if (!type->t.symtab) if (!type->t.symtab)
return 0; return 0;
return type_size (&type_integer); return type_size (&type_int);
case ty_array: case ty_array:
return type->t.array.size * type_size (type->t.array.type); return type->t.array.size * type_size (type->t.array.type);
case ty_class: case ty_class:
@ -1138,8 +1138,8 @@ chain_basic_types (void)
chain_type (&type_floatfield); chain_type (&type_floatfield);
if (!options.traditional) { if (!options.traditional) {
chain_type (&type_quaternion); chain_type (&type_quaternion);
chain_type (&type_integer); chain_type (&type_int);
chain_type (&type_uinteger); chain_type (&type_uint);
chain_type (&type_short); chain_type (&type_short);
chain_type (&type_double); chain_type (&type_double);
} }
@ -1175,10 +1175,10 @@ init_types (void)
{"func_val", &type_function}, {"func_val", &type_function},
{"pointer_val", &type_pointer}, {"pointer_val", &type_pointer},
{"vector_val", &type_vector}, {"vector_val", &type_vector},
{"int_val", &type_integer}, {"int_val", &type_int},
{"uint_val", &type_uinteger}, {"uint_val", &type_uint},
{"integer_val", &type_integer}, {"int_val", &type_int},
{"uinteger_val", &type_uinteger}, {"uint_val", &type_uint},
{"quaternion_val", &type_quaternion}, {"quaternion_val", &type_quaternion},
{"double_val", &type_double}, {"double_val", &type_double},
{0, 0} {0, 0}
@ -1191,10 +1191,8 @@ init_types (void)
{"field_val", &type_field}, {"field_val", &type_field},
{"func_val", &type_function}, {"func_val", &type_function},
{"pointer_val", &type_pointer}, {"pointer_val", &type_pointer},
{"int_val", &type_integer}, {"int_val", &type_int},
{"uint_val", &type_uinteger}, {"uint_val", &type_uint},
{"integer_val", &type_integer},
{"uinteger_val", &type_uinteger},
{"quaternion_val", &type_quaternion}, {"quaternion_val", &type_quaternion},
{"double_val", &type_double}, {"double_val", &type_double},
{0, 0} {0, 0}
@ -1212,7 +1210,7 @@ init_types (void)
}; };
static struct_def_t type_encoding_struct[] = { static struct_def_t type_encoding_struct[] = {
{"types", &type_pointer}, {"types", &type_pointer},
{"size", &type_integer}, {"size", &type_int},
{0, 0} {0, 0}
}; };
static struct_def_t xdef_struct[] = { static struct_def_t xdef_struct[] = {
@ -1226,7 +1224,7 @@ init_types (void)
{0, 0} {0, 0}
}; };
static struct_def_t va_list_struct[] = { static struct_def_t va_list_struct[] = {
{"count", &type_integer}, {"count", &type_int},
{"list", 0}, // type will be filled in at runtime {"list", 0}, // type will be filled in at runtime
{0, 0} {0, 0}
}; };
@ -1234,7 +1232,7 @@ init_types (void)
chain_basic_types (); chain_basic_types ();
type_nil = &type_quaternion; type_nil = &type_quaternion;
type_default = &type_integer; type_default = &type_int;
if (options.code.progsversion == PROG_ID_VERSION) { if (options.code.progsversion == PROG_ID_VERSION) {
// vector can't be part of .zero for v6 progs because for v6 progs, // vector can't be part of .zero for v6 progs because for v6 progs,
// .zero is only one word wide. // .zero is only one word wide.

View file

@ -68,7 +68,7 @@ typedef struct {
int func_val; int func_val;
ex_pointer_t pointer; ex_pointer_t pointer;
float quaternion_val[4]; float quaternion_val[4];
int integer_val; int int_val;
double double_val; double double_val;
} i; } i;
} immediate_t; } immediate_t;
@ -224,22 +224,22 @@ new_quaternion_val (const float *quaternion_val)
} }
ex_value_t * ex_value_t *
new_integer_val (int integer_val) new_int_val (int int_val)
{ {
ex_value_t val; ex_value_t val;
memset (&val, 0, sizeof (val)); memset (&val, 0, sizeof (val));
set_val_type (&val, &type_integer); set_val_type (&val, &type_int);
val.v.integer_val = integer_val; val.v.int_val = int_val;
return find_value (&val); return find_value (&val);
} }
ex_value_t * ex_value_t *
new_uinteger_val (int uinteger_val) new_uint_val (int uint_val)
{ {
ex_value_t val; ex_value_t val;
memset (&val, 0, sizeof (val)); memset (&val, 0, sizeof (val));
set_val_type (&val, &type_uinteger); set_val_type (&val, &type_uint);
val.v.uinteger_val = uinteger_val; val.v.uint_val = uint_val;
return find_value (&val); return find_value (&val);
} }
@ -277,7 +277,7 @@ static hashtab_t *field_imm_defs;
static hashtab_t *func_imm_defs; static hashtab_t *func_imm_defs;
static hashtab_t *pointer_imm_defs; static hashtab_t *pointer_imm_defs;
static hashtab_t *quaternion_imm_defs; static hashtab_t *quaternion_imm_defs;
static hashtab_t *integer_imm_defs; static hashtab_t *int_imm_defs;
static hashtab_t *double_imm_defs; static hashtab_t *double_imm_defs;
static void static void
@ -296,15 +296,15 @@ imm_get_hash (const void *_imm, void *_tab)
const char *str = pr.strings->strings + imm->i.string_val; const char *str = pr.strings->strings + imm->i.string_val;
return str ? Hash_String (str) : 0; return str ? Hash_String (str) : 0;
} else if (tab == &float_imm_defs) { } else if (tab == &float_imm_defs) {
return imm->i.integer_val; return imm->i.int_val;
} else if (tab == &vector_imm_defs) { } else if (tab == &vector_imm_defs) {
return Hash_Buffer (&imm->i.vector_val, sizeof (&imm->i.vector_val)); return Hash_Buffer (&imm->i.vector_val, sizeof (&imm->i.vector_val));
} else if (tab == &entity_imm_defs) { } else if (tab == &entity_imm_defs) {
return imm->i.integer_val; return imm->i.int_val;
} else if (tab == &field_imm_defs) { } else if (tab == &field_imm_defs) {
return Hash_Buffer (&imm->i.pointer, sizeof (&imm->i.pointer)); return Hash_Buffer (&imm->i.pointer, sizeof (&imm->i.pointer));
} else if (tab == &func_imm_defs) { } else if (tab == &func_imm_defs) {
return imm->i.integer_val; return imm->i.int_val;
} else if (tab == &pointer_imm_defs) { } else if (tab == &pointer_imm_defs) {
return Hash_Buffer (&imm->i.pointer, sizeof (&imm->i.pointer)); return Hash_Buffer (&imm->i.pointer, sizeof (&imm->i.pointer));
} else if (tab == &quaternion_imm_defs) { } else if (tab == &quaternion_imm_defs) {
@ -312,8 +312,8 @@ imm_get_hash (const void *_imm, void *_tab)
sizeof (&imm->i.quaternion_val)); sizeof (&imm->i.quaternion_val));
} else if (tab == &double_imm_defs) { } else if (tab == &double_imm_defs) {
return Hash_Buffer (&imm->i.double_val, sizeof (&imm->i.double_val)); return Hash_Buffer (&imm->i.double_val, sizeof (&imm->i.double_val));
} else if (tab == &integer_imm_defs) { } else if (tab == &int_imm_defs) {
return imm->i.integer_val; return imm->i.int_val;
} else { } else {
internal_error (0, 0); internal_error (0, 0);
} }
@ -348,8 +348,8 @@ imm_compare (const void *_imm1, const void *_imm2, void *_tab)
return QuatCompare (imm1->i.quaternion_val, imm2->i.quaternion_val); return QuatCompare (imm1->i.quaternion_val, imm2->i.quaternion_val);
} else if (tab == &double_imm_defs) { } else if (tab == &double_imm_defs) {
return imm1->i.double_val == imm2->i.double_val; return imm1->i.double_val == imm2->i.double_val;
} else if (tab == &integer_imm_defs) { } else if (tab == &int_imm_defs) {
return imm1->i.integer_val == imm2->i.integer_val; return imm1->i.int_val == imm2->i.int_val;
} else { } else {
internal_error (0, 0); internal_error (0, 0);
} }
@ -364,10 +364,10 @@ ReuseString (const char *str)
static float static float
value_as_float (ex_value_t *value) value_as_float (ex_value_t *value)
{ {
if (value->lltype == ev_uinteger) if (value->lltype == ev_uint)
return value->v.uinteger_val; return value->v.uint_val;
if (value->lltype == ev_integer) if (value->lltype == ev_int)
return value->v.integer_val; return value->v.int_val;
if (value->lltype == ev_short) if (value->lltype == ev_short)
return value->v.short_val; return value->v.short_val;
if (value->lltype == ev_double) if (value->lltype == ev_double)
@ -380,10 +380,10 @@ value_as_float (ex_value_t *value)
static double static double
value_as_double (ex_value_t *value) value_as_double (ex_value_t *value)
{ {
if (value->lltype == ev_uinteger) if (value->lltype == ev_uint)
return value->v.uinteger_val; return value->v.uint_val;
if (value->lltype == ev_integer) if (value->lltype == ev_int)
return value->v.integer_val; return value->v.int_val;
if (value->lltype == ev_short) if (value->lltype == ev_short)
return value->v.short_val; return value->v.short_val;
if (value->lltype == ev_double) if (value->lltype == ev_double)
@ -396,10 +396,10 @@ value_as_double (ex_value_t *value)
static int static int
value_as_int (ex_value_t *value) value_as_int (ex_value_t *value)
{ {
if (value->lltype == ev_uinteger) if (value->lltype == ev_uint)
return value->v.uinteger_val; return value->v.uint_val;
if (value->lltype == ev_integer) if (value->lltype == ev_int)
return value->v.integer_val; return value->v.int_val;
if (value->lltype == ev_short) if (value->lltype == ev_short)
return value->v.short_val; return value->v.short_val;
if (value->lltype == ev_double) if (value->lltype == ev_double)
@ -412,10 +412,10 @@ value_as_int (ex_value_t *value)
static unsigned static unsigned
value_as_uint (ex_value_t *value) value_as_uint (ex_value_t *value)
{ {
if (value->lltype == ev_uinteger) if (value->lltype == ev_uint)
return value->v.uinteger_val; return value->v.uint_val;
if (value->lltype == ev_integer) if (value->lltype == ev_int)
return value->v.integer_val; return value->v.int_val;
if (value->lltype == ev_short) if (value->lltype == ev_short)
return value->v.short_val; return value->v.short_val;
if (value->lltype == ev_double) if (value->lltype == ev_double)
@ -441,13 +441,13 @@ convert_value (ex_value_t *value, type_t *type)
} else if (type->type == ev_short) { } else if (type->type == ev_short) {
int val = value_as_int (value); int val = value_as_int (value);
return new_short_val (val); return new_short_val (val);
} else if (type->type == ev_uinteger) { } else if (type->type == ev_uint) {
unsigned val = value_as_uint (value); unsigned val = value_as_uint (value);
return new_uinteger_val (val); return new_uint_val (val);
} else { } else {
//FIXME handle enums separately? //FIXME handle enums separately?
int val = value_as_int (value); int val = value_as_int (value);
return new_integer_val (val); return new_int_val (val);
} }
} }
@ -511,21 +511,21 @@ emit_value (ex_value_t *value, def_t *def)
tab = pointer_imm_defs; tab = pointer_imm_defs;
type = &type_pointer; type = &type_pointer;
break; break;
case ev_integer: case ev_int:
case ev_uinteger: case ev_uint:
if (!def || !is_float(def->type)) { if (!def || !is_float(def->type)) {
tab = integer_imm_defs; tab = int_imm_defs;
type = &type_integer; type = &type_int;
break; break;
} }
val.v.float_val = val.v.integer_val; val.v.float_val = val.v.int_val;
val.lltype = ev_float; val.lltype = ev_float;
case ev_float: case ev_float:
tab = float_imm_defs; tab = float_imm_defs;
type = &type_float; type = &type_float;
break; break;
case ev_string: case ev_string:
val.v.integer_val = ReuseString (val.v.string_val); val.v.int_val = ReuseString (val.v.string_val);
tab = string_imm_defs; tab = string_imm_defs;
type = &type_string; type = &type_string;
break; break;
@ -637,7 +637,7 @@ clear_immediates (void)
Hash_FlushTable (func_imm_defs); Hash_FlushTable (func_imm_defs);
Hash_FlushTable (pointer_imm_defs); Hash_FlushTable (pointer_imm_defs);
Hash_FlushTable (quaternion_imm_defs); Hash_FlushTable (quaternion_imm_defs);
Hash_FlushTable (integer_imm_defs); Hash_FlushTable (int_imm_defs);
Hash_FlushTable (double_imm_defs); Hash_FlushTable (double_imm_defs);
} else { } else {
value_table = Hash_NewTable (16381, 0, 0, 0, 0); value_table = Hash_NewTable (16381, 0, 0, 0, 0);
@ -675,9 +675,9 @@ clear_immediates (void)
&quaternion_imm_defs, 0); &quaternion_imm_defs, 0);
Hash_SetHashCompare (quaternion_imm_defs, imm_get_hash, imm_compare); Hash_SetHashCompare (quaternion_imm_defs, imm_get_hash, imm_compare);
integer_imm_defs = Hash_NewTable (16381, 0, imm_free, int_imm_defs = Hash_NewTable (16381, 0, imm_free,
&integer_imm_defs, 0); &int_imm_defs, 0);
Hash_SetHashCompare (integer_imm_defs, imm_get_hash, imm_compare); Hash_SetHashCompare (int_imm_defs, imm_get_hash, imm_compare);
double_imm_defs = Hash_NewTable (16381, 0, imm_free, double_imm_defs = Hash_NewTable (16381, 0, imm_free,
&double_imm_defs, 0); &double_imm_defs, 0);
@ -691,5 +691,5 @@ clear_immediates (void)
make_def_imm (def, float_imm_defs, &zero_val); make_def_imm (def, float_imm_defs, &zero_val);
make_def_imm (def, entity_imm_defs, &zero_val); make_def_imm (def, entity_imm_defs, &zero_val);
make_def_imm (def, pointer_imm_defs, &zero_val); make_def_imm (def, pointer_imm_defs, &zero_val);
make_def_imm (def, integer_imm_defs, &zero_val); make_def_imm (def, int_imm_defs, &zero_val);
} }

View file

@ -23,12 +23,12 @@ alias_printf (string fmt, ...)
{ {
int fail = 0; int fail = 0;
// this will fail on big-endian systems // this will fail on big-endian systems
fail = (@args.list[2].integer_val != 0x54442d18 fail = (@args.list[2].int_val != 0x54442d18
|| @args.list[1].integer_val != 0x400921fb); || @args.list[1].int_val != 0x400921fb);
printf ("%g %08x%08x\n", printf ("%g %08x%08x\n",
@args.list[0].integer_val, @args.list[0].int_val,
@args.list[2].integer_val, @args.list[2].int_val,
@args.list[1].integer_val); @args.list[1].int_val);
return fail; return fail;
} }

View file

@ -26,7 +26,7 @@ check_alias (string name, qfot_type_t *alias)
{ {
if (alias.meta != ty_basic || alias.type != ev_pointer if (alias.meta != ty_basic || alias.type != ev_pointer
|| alias.fldptr.aux_type.meta != ty_basic || alias.fldptr.aux_type.meta != ty_basic
|| alias.fldptr.aux_type.type != ev_integer) { || alias.fldptr.aux_type.type != ev_int) {
printf ("%s is not a *int alias\n", name); printf ("%s is not a *int alias\n", name);
return 0; return 0;
} }