Changeset 1ebc1a62 in mainline for uspace/app/sbi/src/run.c


Ignore:
Timestamp:
2010-03-29T20:30:29Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a95310e
Parents:
5da468e
Message:

Update SBI to rev. 157.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sbi/src/run.c

    r5da468e r1ebc1a62  
    4848
    4949static void run_block(run_t *run, stree_block_t *block);
    50 static void run_exps(run_t *run, stree_exps_t *exps);
     50static void run_exps(run_t *run, stree_exps_t *exps, rdata_item_t **res);
    5151static void run_vdecl(run_t *run, stree_vdecl_t *vdecl);
    5252static void run_if(run_t *run, stree_if_t *if_s);
     
    196196        while (node != NULL) {
    197197                stat = list_node_data(node, stree_stat_t *);
    198                 run_stat(run, stat);
     198                run_stat(run, stat, NULL);
    199199
    200200                if (run->thread_ar->bo_mode != bm_none)
     
    214214}
    215215
    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 */
     226void run_stat(run_t *run, stree_stat_t *stat, rdata_item_t **res)
    218227{
    219228#ifdef DEBUG_RUN_TRACE
    220229        printf("Executing one statement %p.\n", stat);
    221230#endif
     231
     232        if (res != NULL)
     233                *res = NULL;
    222234
    223235        switch (stat->sc) {
    224236        case st_exps:
    225                 run_exps(run, stat->u.exp_s);
     237                run_exps(run, stat->u.exp_s, res);
    226238                break;
    227239        case st_vdecl:
     
    251263}
    252264
    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 */
     274static void run_exps(run_t *run, stree_exps_t *exps, rdata_item_t **res)
    255275{
    256276        rdata_item_t *rexpr;
     
    261281        run_expr(run, exps->expr, &rexpr);
    262282
    263         if (rexpr != NULL) {
    264                 printf("Warning: Expression value ignored.\n");
    265         }
     283        if (res != NULL)
     284                *res = rexpr;
    266285}
    267286
     
    504523        return tdata_is_csi_derived_from_ti(payload_o->class_sym->u.csi,
    505524            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 */
     531void 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. */
     538rdata_item_t *run_recovery_item(run_t *run)
     539{
     540        (void) run;
     541        return NULL;
    506542}
    507543
     
    11361172        if (addr_var->vref == NULL) {
    11371173                printf("Error: Accessing null reference.\n");
    1138                 exit(1);
     1174                run_raise_error(run);
     1175                *ritem = run_recovery_item(run);
     1176                return;
    11391177        }
    11401178
     
    11441182        *ritem = item;
    11451183}
    1146 
    11471184
    11481185run_thread_ar_t *run_thread_ar_new(void)
Note: See TracChangeset for help on using the changeset viewer.