* globals with no assignments are globals. Function body types
* are locals.
*/
-static inline bool asm_parse_type(const char *skip, size_t line, asm_state *state) {
+static GMQCC_INLINE bool asm_parse_type(const char *skip, size_t line, asm_state *state) {
if (!(strstr(skip, "FLOAT:") == &skip[0]) &&
(strstr(skip, "VECTOR:") == &skip[0]) &&
(strstr(skip, "ENTITY:") == &skip[0]) &&
* names among other things. Ensures valid name as well, and even
* internal engine function selection.
*/
-static inline bool asm_parse_func(const char *skip, size_t line, asm_state *state) {
+static GMQCC_INLINE bool asm_parse_func(const char *skip, size_t line, asm_state *state) {
if (*state == ASM_FUNCTION && (strstr(skip, "FUNCTION:") == &skip[0]))
return false;
* to determine this.
*/
if (strchr(name, ',')) {
+ prog_section_function function;
+ prog_section_def def;
+
char *find = strchr(name, ',') + 1;
/* skip whitespace */
* global (optional)
* name
*/
- code_functions_add((prog_section_function){
- -atoi(find), /* needs to be negated */
- 0, 0, 0,
- .name = code_chars_elements,
- 0, 0,{0}
- });
- code_defs_add((prog_section_def){
- .type = TYPE_FUNCTION,
- .offset = code_globals_elements,
- .name = code_chars_elements
- });
- code_globals_add(code_chars_elements);
-
- code_chars_put(name, strlen(name));
- code_chars_add('\0');
+ function.entry = -atoi(find);
+ function.firstlocal = 0;
+ function.profile = 0;
+ function.name = code_chars_elements;
+ function.file = 0;
+ function.nargs = 0;
+ def.type = TYPE_FUNCTION;
+ def.offset = code_globals_elements;
+ def.name = code_chars_elements;
+ code_functions_add(function);
+ code_defs_add (def);
+ code_globals_add (code_chars_elements);
+ code_chars_put (name, strlen(name));
+ code_chars_add ('\0');
/*
* Sanatize the numerical constant used to select the
printf("invalid internal function identifier, must be all numeric\n");
} else {
- /* TODO: function bodies */
+ printf("Found function %s\n", name);
}
mem_d(copy);