Changeset d0febca in mainline for uspace/app/sbi/src/builtin.c
- Timestamp:
- 2010-03-13T12:04:37Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7715994
- Parents:
- 94d484a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/builtin.c
r94d484a rd0febca 27 27 */ 28 28 29 /** @file Builtin functions. */29 /** @file Builtin procedures. */ 30 30 31 31 #include <stdio.h> … … 42 42 #include "builtin.h" 43 43 44 static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, c har *name);45 static void builtin_fun_add_arg(stree_symbol_t *fun_sym, c har *name);46 static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, c har *name);44 static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, const char *name); 45 static void builtin_fun_add_arg(stree_symbol_t *fun_sym, const char *name); 46 static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, const char *name); 47 47 48 48 static void builtin_write_line(run_t *run); … … 54 54 /** Declare builtin symbols in the program. 55 55 * 56 * Declares symbols that will be hooked to builtin interpreter functions.56 * Declares symbols that will be hooked to builtin interpreter procedures. 57 57 */ 58 58 void builtin_declare(stree_program_t *program) … … 80 80 list_append(&program->module->members, modm); 81 81 82 /* Declare builtin functions. */82 /* Declare builtin procedures. */ 83 83 84 84 bi_write_line = builtin_declare_fun(csi, "WriteLine"); … … 89 89 } 90 90 91 void builtin_run_ fun(run_t *run, stree_symbol_t *fun_sym)91 void builtin_run_proc(run_t *run, stree_symbol_t *proc_sym) 92 92 { 93 93 #ifdef DEBUG_RUN_TRACE 94 printf("Run builtin function.\n");94 printf("Run builtin procedure.\n"); 95 95 #endif 96 if ( fun_sym == bi_write_line) {96 if (proc_sym == bi_write_line) { 97 97 builtin_write_line(run); 98 } else if ( fun_sym == bi_exec) {98 } else if (proc_sym == bi_exec) { 99 99 builtin_exec(run); 100 100 } else { … … 104 104 105 105 /** Declare a builtin function in @a csi. */ 106 static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, c har *name)106 static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, const char *name) 107 107 { 108 108 stree_ident_t *ident; … … 133 133 134 134 /** Add one formal parameter to function. */ 135 static void builtin_fun_add_arg(stree_symbol_t *fun_sym, c har *name)136 { 137 stree_ fun_arg_t *fun_arg;135 static void builtin_fun_add_arg(stree_symbol_t *fun_sym, const char *name) 136 { 137 stree_proc_arg_t *proc_arg; 138 138 stree_fun_t *fun; 139 139 … … 141 141 assert(fun != NULL); 142 142 143 fun_arg = stree_fun_arg_new();144 fun_arg->name = stree_ident_new();145 fun_arg->name->sid = strtab_get_sid(name);146 fun_arg->type = NULL; /* XXX */147 148 list_append(&fun->args, fun_arg);143 proc_arg = stree_proc_arg_new(); 144 proc_arg->name = stree_ident_new(); 145 proc_arg->name->sid = strtab_get_sid(name); 146 proc_arg->type = NULL; /* XXX */ 147 148 list_append(&fun->args, proc_arg); 149 149 } 150 150 151 151 /** Add variadic formal parameter to function. */ 152 static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, c har *name)153 { 154 stree_ fun_arg_t *fun_arg;152 static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, const char *name) 153 { 154 stree_proc_arg_t *proc_arg; 155 155 stree_fun_t *fun; 156 156 … … 158 158 assert(fun != NULL); 159 159 160 fun_arg = stree_fun_arg_new();161 fun_arg->name = stree_ident_new();162 fun_arg->name->sid = strtab_get_sid(name);163 fun_arg->type = NULL; /* XXX */164 165 fun->varg = fun_arg;160 proc_arg = stree_proc_arg_new(); 161 proc_arg->name = stree_ident_new(); 162 proc_arg->name->sid = strtab_get_sid(name); 163 proc_arg->type = NULL; /* XXX */ 164 165 fun->varg = proc_arg; 166 166 } 167 167
Note:
See TracChangeset
for help on using the changeset viewer.