Implement OF_interpret.

Obtained from:	netbsd
This commit is contained in:
Jake Burkholder 2003-06-07 18:34:04 +00:00
parent 498c24eea5
commit 2c7df6a555
2 changed files with 34 additions and 2 deletions

View File

@ -127,6 +127,38 @@ OF_test(char *name)
return args.missing;
}
int
OF_interpret(char *cmd, int nreturns, ...)
{
va_list ap;
static struct {
cell_t name;
cell_t nargs;
cell_t nreturns;
cell_t slot[16];
} args = {
(cell_t)"interpret",
1
};
cell_t status;
int i = 0;
args.nreturns = ++nreturns;
args.slot[i++] = (cell_t)cmd;
va_start(ap, nreturns);
while (i < 1)
args.slot[i++] = va_arg(ap, cell_t);
if (openfirmware(&args) == -1) {
va_end(ap);
return (-1);
}
status = args.slot[i++];
while (i < 1 + nreturns)
*va_arg(ap, cell_t *) = args.slot[i++];
va_end(ap);
return (status);
}
/* Return firmware millisecond count. */
int
OF_milliseconds()

View File

@ -128,9 +128,9 @@ void OF_exit(void) __attribute__((noreturn));
void OF_chain(void *, u_int,
void (*)(void *, u_int, void *, void *, u_int), void *, u_int);
#if 0
/* User interface functions */
/* OF_interpret */
int OF_interpret(char *, int, ...);
#if 0
void *OF_set_callback(void *);
void OF_set_symbol_lookup(void *, void *);
#endif