diff options
-rw-r--r-- | boot/boot_script.c | 27 | ||||
-rw-r--r-- | boot/boot_script.h | 5 |
2 files changed, 18 insertions, 14 deletions
diff --git a/boot/boot_script.c b/boot/boot_script.c index d0317520..cfc19c2b 100644 --- a/boot/boot_script.c +++ b/boot/boot_script.c @@ -19,7 +19,7 @@ struct sym int type; /* Symbol value. */ - int val; + integer_t val; /* For function symbols; type of value returned by function. */ int ret_type; @@ -46,7 +46,7 @@ struct arg int type; /* Argument value. */ - int val; + integer_t val; }; /* List of commands. */ @@ -93,9 +93,10 @@ prompt_resume_task (struct cmd *cmd, int *val) /* List of builtin symbols. */ static struct sym builtin_symbols[] = { - { "task-create", VAL_FUNC, (int) create_task, VAL_TASK, 0 }, - { "task-resume", VAL_FUNC, (int) resume_task, VAL_NONE, 1 }, - { "prompt-task-resume", VAL_FUNC, (int) prompt_resume_task, VAL_NONE, 1 }, + { "task-create", VAL_FUNC, (integer_t) create_task, VAL_TASK, 0 }, + { "task-resume", VAL_FUNC, (integer_t) resume_task, VAL_NONE, 1 }, + { "prompt-task-resume", + VAL_FUNC, (integer_t) prompt_resume_task, VAL_NONE, 1 }, }; #define NUM_BUILTIN (sizeof (builtin_symbols) / sizeof (builtin_symbols[0])) @@ -296,7 +297,8 @@ boot_script_parse_line (void *hook, char *cmdline) for (p += 2;;) { char c; - int i, val, type; + int i, type; + integer_t val; struct sym *s; /* Parse symbol name. */ @@ -351,7 +353,7 @@ boot_script_parse_line (void *hook, char *cmdline) if (! s->run_on_exec) { (error - = ((*((int (*) (struct cmd *, int *)) s->val)) + = ((*((int (*) (struct cmd *, integer_t *)) s->val)) (cmd, &val))); if (error) goto bad; @@ -373,7 +375,7 @@ boot_script_parse_line (void *hook, char *cmdline) else if (s->type == VAL_NONE) { type = VAL_SYM; - val = (int) s; + val = (integer_t) s; } else { @@ -643,7 +645,7 @@ boot_script_exec () for (i = 0; i < cmd->exec_funcs_index; i++) { struct sym *sym = cmd->exec_funcs[i]; - int error = ((*((int (*) (struct cmd *, int *)) sym->val)) + int error = ((*((int (*) (struct cmd *, integer_t *)) sym->val)) (cmd, 0)); if (error) { @@ -660,7 +662,7 @@ boot_script_exec () /* Create an entry for the variable NAME with TYPE and value VAL, in the symbol table. */ int -boot_script_set_variable (const char *name, int type, int val) +boot_script_set_variable (const char *name, int type, integer_t val) { struct sym *sym = sym_enter (name); @@ -676,14 +678,15 @@ boot_script_set_variable (const char *name, int type, int val) /* Define the function NAME, which will return type RET_TYPE. */ int boot_script_define_function (const char *name, int ret_type, - int (*func) (const struct cmd *cmd, int *val)) + int (*func) (const struct cmd *cmd, + integer_t *val)) { struct sym *sym = sym_enter (name); if (sym) { sym->type = VAL_FUNC; - sym->val = (int) func; + sym->val = (integer_t) func; sym->ret_type = ret_type; sym->run_on_exec = ret_type == VAL_NONE; } diff --git a/boot/boot_script.h b/boot/boot_script.h index c436ac21..62458693 100644 --- a/boot/boot_script.h +++ b/boot/boot_script.h @@ -102,11 +102,12 @@ int boot_script_exec (void); /* Create an entry in the symbol table for variable NAME, whose type is TYPE and value is VAL. Returns 0 on success, non-zero otherwise. */ -int boot_script_set_variable (const char *name, int type, int val); +int boot_script_set_variable (const char *name, int type, integer_t val); /* Define the function NAME, which will return type RET_TYPE. */ int boot_script_define_function (const char *name, int ret_type, - int (*func) (const struct cmd *cmd, int *val)); + int (*func) (const struct cmd *cmd, + integer_t *val)); /* Returns a string describing the error ERR. */ char *boot_script_error_string (int err); |