From f2efbb46ef89c7c1693400f7209113c50c959f02 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Wed, 13 Oct 2021 10:51:54 -0700 Subject: Feat(rc): working(ish) version of rc shell Removed compile commands --- sys/cmd/rc/exec.h | 53 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'sys/cmd/rc/exec.h') diff --git a/sys/cmd/rc/exec.h b/sys/cmd/rc/exec.h index 009684e..faf29a5 100644 --- a/sys/cmd/rc/exec.h +++ b/sys/cmd/rc/exec.h @@ -17,19 +17,24 @@ extern void Xerror1(char*); * word lists are in correct order, * i.e. word0->word1->word2->word3->0 */ -struct word{ +struct Word +{ char *word; - word *next; + Word *next; }; -struct list{ - word *words; - list *next; + +struct Words { + Word *words; + Words *next; }; -word *newword(char *, word *), *copywords(word *, word *); -struct redir{ + +Word *newword(char *, Word *), *copywords(Word *, Word *); + +struct Redir +{ char type; /* what to do */ short from, to; /* what to do it to */ - struct redir *next; /* what else to do (reverse order) */ + struct Redir *next; /* what else to do (reverse order) */ }; #define NSTATUS ERRMAX /* length of status (from plan 9) */ /* @@ -38,38 +43,40 @@ struct redir{ #define ROPEN 1 /* dup2(from, to); close(from); */ #define RDUP 2 /* dup2(from, to); */ #define RCLOSE 3 /* close(from); */ -struct thread{ - union code *code; /* code for this thread */ +struct Thread +{ + union Code *code; /* code for this thread */ int pc; /* code[pc] is the next instruction */ - struct list *argv; /* argument stack */ - struct redir *redir; /* redirection stack */ - struct redir *startredir; /* redir inheritance point */ - struct var *local; /* list of local variables */ + struct Words *argv; /* argument stack */ + struct Redir *redir; /* redirection stack */ + struct Redir *startredir; /* redir inheritance point */ + struct Var *local; /* list of local variables */ char *cmdfile; /* file name in Xrdcmd */ - struct io *cmdfd; /* file descriptor for Xrdcmd */ + struct Io *cmdfd; /* file descriptor for Xrdcmd */ int iflast; /* static `if not' checking */ int eof; /* is cmdfd at eof? */ int iflag; /* interactive? */ int lineno; /* linenumber */ int pid; /* process for Xpipewait to wait for */ char status[NSTATUS]; /* status for Xpipewait */ - tree *treenodes; /* tree nodes created by this process */ - thread *ret; /* who continues when this finishes */ + Tree *treenodes; /* tree nodes created by this process */ + Thread *ret; /* who continues when this finishes */ }; -code *codecopy(code*); +Code *codecopy(Code*); -extern thread *runq; -extern code *codebuf; /* compiler output */ +extern Thread *runq; +extern Code *codebuf; /* compiler output */ extern int ntrap; /* number of outstanding traps */ extern int trap[NSIG]; /* number of outstanding traps per type */ -struct builtin{ +struct Builtin +{ char *name; void (*fnc)(void); }; -extern struct builtin Builtin[]; +extern struct Builtin builtin[]; extern int eflagok; /* kludge flag so that -e doesn't exit in startup */ extern int havefork; @@ -78,4 +85,4 @@ void execcd(void), execwhatis(void), execeval(void), execexec(void); int execforkexec(void); void execexit(void), execshift(void); void execwait(void), execumask(void), execdot(void), execflag(void); -void execfunc(var*), execcmds(io *); +void execfunc(Var*), execcmds(Io *); -- cgit v1.2.1