Changeset d0febca in mainline for uspace/app/sbi/src/builtin.c


Ignore:
Timestamp:
2010-03-13T12:04:37Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7715994
Parents:
94d484a
Message:

Update SBI to rev. 100.

File:
1 edited

Legend:

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

    r94d484a rd0febca  
    2727 */
    2828
    29 /** @file Builtin functions. */
     29/** @file Builtin procedures. */
    3030
    3131#include <stdio.h>
     
    4242#include "builtin.h"
    4343
    44 static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, char *name);
    45 static void builtin_fun_add_arg(stree_symbol_t *fun_sym, char *name);
    46 static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, char *name);
     44static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, const char *name);
     45static void builtin_fun_add_arg(stree_symbol_t *fun_sym, const char *name);
     46static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, const char *name);
    4747
    4848static void builtin_write_line(run_t *run);
     
    5454/** Declare builtin symbols in the program.
    5555 *
    56  * Declares symbols that will be hooked to builtin interpreter functions.
     56 * Declares symbols that will be hooked to builtin interpreter procedures.
    5757 */
    5858void builtin_declare(stree_program_t *program)
     
    8080        list_append(&program->module->members, modm);
    8181
    82         /* Declare builtin functions. */
     82        /* Declare builtin procedures. */
    8383
    8484        bi_write_line = builtin_declare_fun(csi, "WriteLine");
     
    8989}
    9090
    91 void builtin_run_fun(run_t *run, stree_symbol_t *fun_sym)
     91void builtin_run_proc(run_t *run, stree_symbol_t *proc_sym)
    9292{
    9393#ifdef DEBUG_RUN_TRACE
    94         printf("Run builtin function.\n");
     94        printf("Run builtin procedure.\n");
    9595#endif
    96         if (fun_sym == bi_write_line) {
     96        if (proc_sym == bi_write_line) {
    9797                builtin_write_line(run);
    98         } else if (fun_sym == bi_exec) {
     98        } else if (proc_sym == bi_exec) {
    9999                builtin_exec(run);
    100100        } else {
     
    104104
    105105/** Declare a builtin function in @a csi. */
    106 static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, char *name)
     106static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, const char *name)
    107107{
    108108        stree_ident_t *ident;
     
    133133
    134134/** Add one formal parameter to function. */
    135 static void builtin_fun_add_arg(stree_symbol_t *fun_sym, char *name)
    136 {
    137         stree_fun_arg_t *fun_arg;
     135static void builtin_fun_add_arg(stree_symbol_t *fun_sym, const char *name)
     136{
     137        stree_proc_arg_t *proc_arg;
    138138        stree_fun_t *fun;
    139139
     
    141141        assert(fun != NULL);
    142142
    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);
    149149}
    150150
    151151/** Add variadic formal parameter to function. */
    152 static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, char *name)
    153 {
    154         stree_fun_arg_t *fun_arg;
     152static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, const char *name)
     153{
     154        stree_proc_arg_t *proc_arg;
    155155        stree_fun_t *fun;
    156156
     
    158158        assert(fun != NULL);
    159159
    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;
    166166}
    167167
Note: See TracChangeset for help on using the changeset viewer.