Changes in uspace/app/sbi/src/builtin.c [051bc69a:c5cb943d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/builtin.c
r051bc69a rc5cb943d 42 42 #include "builtin/bi_boxed.h" 43 43 #include "builtin/bi_error.h" 44 #include "builtin/bi_char.h" 44 45 #include "builtin/bi_fun.h" 46 #include "builtin/bi_int.h" 45 47 #include "builtin/bi_textfile.h" 46 48 #include "builtin/bi_string.h" … … 52 54 #include "os/os.h" 53 55 #include "parse.h" 56 #include "rdata.h" 54 57 #include "run.h" 55 58 #include "stree.h" … … 89 92 90 93 bi_error_declare(bi); 94 bi_char_declare(bi); 91 95 bi_fun_declare(bi); 96 bi_int_declare(bi); 92 97 bi_textfile_declare(bi); 93 98 bi_string_declare(bi); … … 105 110 bi_boxed_bind(bi); 106 111 bi_error_bind(bi); 112 bi_char_bind(bi); 107 113 bi_fun_bind(bi); 114 bi_int_bind(bi); 108 115 bi_textfile_bind(bi); 109 116 bi_string_bind(bi); … … 250 257 { 251 258 stree_symbol_t *fun_sym; 252 builtin_t *bi;253 259 builtin_proc_t bproc; 254 260 … … 257 263 #endif 258 264 fun_sym = proc->outer_symbol; 259 bi = run->program->builtin;260 265 261 266 bproc = proc->bi_handler; … … 298 303 } 299 304 300 /** Declare a builtin function in @a csi. 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. 301 341 * 302 342 * Declare a builtin function member of CSI @a csi. Deprecated in favor … … 314 354 stree_csimbr_t *csimbr; 315 355 stree_symbol_t *fun_sym; 356 stree_symbol_attr_t *sym_attr; 316 357 317 358 ident = stree_ident_new(); … … 333 374 fun_sym->u.fun = fun; 334 375 fun_sym->outer_csi = csi; 376 377 sym_attr = stree_symbol_attr_new(sac_static); 378 list_append(&fun_sym->attr, sym_attr); 379 335 380 fun->symbol = fun_sym; 336 381 fun->proc->outer_symbol = fun_sym;
Note:
See TracChangeset
for help on using the changeset viewer.