Changes in uspace/app/sbi/src/builtin.c [c5cb943d:051bc69a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/builtin.c
rc5cb943d r051bc69a 42 42 #include "builtin/bi_boxed.h" 43 43 #include "builtin/bi_error.h" 44 #include "builtin/bi_char.h"45 44 #include "builtin/bi_fun.h" 46 #include "builtin/bi_int.h"47 45 #include "builtin/bi_textfile.h" 48 46 #include "builtin/bi_string.h" … … 54 52 #include "os/os.h" 55 53 #include "parse.h" 56 #include "rdata.h"57 54 #include "run.h" 58 55 #include "stree.h" … … 92 89 93 90 bi_error_declare(bi); 94 bi_char_declare(bi);95 91 bi_fun_declare(bi); 96 bi_int_declare(bi);97 92 bi_textfile_declare(bi); 98 93 bi_string_declare(bi); … … 110 105 bi_boxed_bind(bi); 111 106 bi_error_bind(bi); 112 bi_char_bind(bi);113 107 bi_fun_bind(bi); 114 bi_int_bind(bi);115 108 bi_textfile_bind(bi); 116 109 bi_string_bind(bi); … … 257 250 { 258 251 stree_symbol_t *fun_sym; 252 builtin_t *bi; 259 253 builtin_proc_t bproc; 260 254 … … 263 257 #endif 264 258 fun_sym = proc->outer_symbol; 259 bi = run->program->builtin; 265 260 266 261 bproc = proc->bi_handler; … … 303 298 } 304 299 305 /** Return string value from builtin procedure. 306 * 307 * Makes it easy for a builtin procedure to return value of type @c string. 308 * 309 * @param run Runner object 310 * @param str String value. Must be allocated from heap and its 311 * ownership is hereby given up. 312 */ 313 void builtin_return_string(run_t *run, const char *astr) 314 { 315 rdata_string_t *rstring; 316 rdata_var_t *rvar; 317 rdata_value_t *rval; 318 rdata_item_t *ritem; 319 320 run_proc_ar_t *proc_ar; 321 322 #ifdef DEBUG_RUN_TRACE 323 printf("Return string '%s' from builtin function.\n", astr); 324 #endif 325 rstring = rdata_string_new(); 326 rstring->value = astr; 327 328 rvar = rdata_var_new(vc_string); 329 rvar->u.string_v = rstring; 330 rval = rdata_value_new(); 331 rval->var = rvar; 332 333 ritem = rdata_item_new(ic_value); 334 ritem->u.value = rval; 335 336 proc_ar = run_get_current_proc_ar(run); 337 proc_ar->retval = ritem; 338 } 339 340 /** Declare a static builtin function in @a csi. 300 /** Declare a builtin function in @a csi. 341 301 * 342 302 * Declare a builtin function member of CSI @a csi. Deprecated in favor … … 354 314 stree_csimbr_t *csimbr; 355 315 stree_symbol_t *fun_sym; 356 stree_symbol_attr_t *sym_attr;357 316 358 317 ident = stree_ident_new(); … … 374 333 fun_sym->u.fun = fun; 375 334 fun_sym->outer_csi = csi; 376 377 sym_attr = stree_symbol_attr_new(sac_static);378 list_append(&fun_sym->attr, sym_attr);379 380 335 fun->symbol = fun_sym; 381 336 fun->proc->outer_symbol = fun_sym;
Note:
See TracChangeset
for help on using the changeset viewer.