Changeset 1ebc1a62 in mainline for uspace/app/sbi/src/run.c
- Timestamp:
- 2010-03-29T20:30:29Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a95310e
- Parents:
- 5da468e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/run.c
r5da468e r1ebc1a62 48 48 49 49 static void run_block(run_t *run, stree_block_t *block); 50 static void run_exps(run_t *run, stree_exps_t *exps );50 static void run_exps(run_t *run, stree_exps_t *exps, rdata_item_t **res); 51 51 static void run_vdecl(run_t *run, stree_vdecl_t *vdecl); 52 52 static void run_if(run_t *run, stree_if_t *if_s); … … 196 196 while (node != NULL) { 197 197 stat = list_node_data(node, stree_stat_t *); 198 run_stat(run, stat );198 run_stat(run, stat, NULL); 199 199 200 200 if (run->thread_ar->bo_mode != bm_none) … … 214 214 } 215 215 216 /** Run statement. */ 217 void run_stat(run_t *run, stree_stat_t *stat) 216 /** Run statement. 217 * 218 * Executes a statement. If @a res is not NULL and the statement is an 219 * expression statement with a value, the value item will be stored to 220 * @a res. 221 * 222 * @param run Runner object. 223 * @param stat Statement to run. 224 * @param res Place to store exps result or NULL if not interested. 225 */ 226 void run_stat(run_t *run, stree_stat_t *stat, rdata_item_t **res) 218 227 { 219 228 #ifdef DEBUG_RUN_TRACE 220 229 printf("Executing one statement %p.\n", stat); 221 230 #endif 231 232 if (res != NULL) 233 *res = NULL; 222 234 223 235 switch (stat->sc) { 224 236 case st_exps: 225 run_exps(run, stat->u.exp_s );237 run_exps(run, stat->u.exp_s, res); 226 238 break; 227 239 case st_vdecl: … … 251 263 } 252 264 253 /** Run expression statement. */ 254 static void run_exps(run_t *run, stree_exps_t *exps) 265 /** Run expression statement. 266 * 267 * Executes an expression statement. If @a res is not NULL then the value 268 * of the expression (or NULL if it has no value) will be stored to @a res. 269 * 270 * @param run Runner object. 271 * @param exps Expression statement to run. 272 * @param res Place to store exps result or NULL if not interested. 273 */ 274 static void run_exps(run_t *run, stree_exps_t *exps, rdata_item_t **res) 255 275 { 256 276 rdata_item_t *rexpr; … … 261 281 run_expr(run, exps->expr, &rexpr); 262 282 263 if (rexpr != NULL) { 264 printf("Warning: Expression value ignored.\n"); 265 } 283 if (res != NULL) 284 *res = rexpr; 266 285 } 267 286 … … 504 523 return tdata_is_csi_derived_from_ti(payload_o->class_sym->u.csi, 505 524 etype); 525 } 526 527 /** Raise an irrecoverable run-time error, start bailing out. 528 * 529 * Raises an error that cannot be handled by the user program. 530 */ 531 void run_raise_error(run_t *run) 532 { 533 run->thread_ar->bo_mode = bm_error; 534 run->thread_ar->error = b_true; 535 } 536 537 /** Construct a special recovery item. */ 538 rdata_item_t *run_recovery_item(run_t *run) 539 { 540 (void) run; 541 return NULL; 506 542 } 507 543 … … 1136 1172 if (addr_var->vref == NULL) { 1137 1173 printf("Error: Accessing null reference.\n"); 1138 exit(1); 1174 run_raise_error(run); 1175 *ritem = run_recovery_item(run); 1176 return; 1139 1177 } 1140 1178 … … 1144 1182 *ritem = item; 1145 1183 } 1146 1147 1184 1148 1185 run_thread_ar_t *run_thread_ar_new(void)
Note:
See TracChangeset
for help on using the changeset viewer.