diff --git a/Makefile b/Makefile index 14ad258..d5ada54 100644 --- a/Makefile +++ b/Makefile @@ -145,8 +145,9 @@ ebind.o: ebind.c ebind.h basic.h bind.h edef.h buffer.h crypt.h line.h \ eval.o: eval.c eval.h estruct.h retcode.h basic.h bind.h edef.h buffer.h \ crypt.h line.h utf8.h display.h exec.h flook.h input.h random.h search.h \ termio.h version.h window.h defines.h -exec.o: exec.c exec.h buffer.h crypt.h line.h utf8.h estruct.h retcode.h \ - bind.h edef.h display.h eval.h file.h flook.h input.h window.h defines.h +exec.o: exec.c exec.h buffer.h crypt.h line.h utf8.h bind.h edef.h \ + estruct.h retcode.h display.h eval.h file.h flook.h input.h window.h \ + defines.h execute.o: execute.c edef.h buffer.h crypt.h line.h utf8.h estruct.h \ retcode.h bind.h random.h display.h file.h window.h defines.h file.o: file.c file.h crypt.h retcode.h buffer.h line.h utf8.h defines.h \ diff --git a/estruct.h b/estruct.h index 744eceb..94d0cf1 100644 --- a/estruct.h +++ b/estruct.h @@ -160,7 +160,9 @@ #define MAGIC 1 /* include regular expression matching? */ #endif #define AEDIT 1 /* advanced editing options: en/detabbing */ +#if 0 #define PROC 1 /* named procedures */ +#endif #define CLEAN 0 /* de-alloc memory on exit */ #define ASCII 1 /* always using ASCII char sequences for now */ @@ -250,27 +252,6 @@ #include "retcode.h" -#if 0 -#define STOP 0 /* keyboard macro not in use */ -#define PLAY 1 /* playing */ -#define RECORD 2 /* recording */ -#endif - -/* Directive definitions */ - -#define DIF 0 -#define DELSE 1 -#define DENDIF 2 -#define DGOTO 3 -#define DRETURN 4 -#define DENDM 5 -#define DWHILE 6 -#define DENDWHILE 7 -#define DBREAK 8 -#define DFORCE 9 - -#define NUMDIRS 10 - /* * PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for * the scan routines. @@ -465,21 +446,6 @@ struct variable_description { int v_num; /* Ordinal pointer to variable in list. */ }; -/* The !WHILE directive in the execution language needs to - * stack references to pending whiles. These are stored linked - * to each currently open procedure via a linked list of - * the following structure. -*/ -struct while_block { - struct line *w_begin; /* ptr to !while statement */ - struct line *w_end; /* ptr to the !endwhile statement */ - int w_type; /* block type */ - struct while_block *w_next; /* next while */ -}; - -#define BTWHILE 1 -#define BTBREAK 2 - /* * Incremental search defines. */ diff --git a/exec.c b/exec.c index 2a6fa25..58ce976 100644 --- a/exec.c +++ b/exec.c @@ -24,6 +24,36 @@ #include "line.h" #include "window.h" +/* Directive definitions */ + +#define DIF 0 +#define DELSE 1 +#define DENDIF 2 +#define DGOTO 3 +#define DRETURN 4 +#define DENDM 5 +#define DWHILE 6 +#define DENDWHILE 7 +#define DBREAK 8 +#define DFORCE 9 + +#define NUMDIRS 10 + +/* The !WHILE directive in the execution language needs to + * stack references to pending whiles. These are stored linked + * to each currently open procedure via a linked list of + * the following structure. +*/ +struct while_block { + struct line *w_begin; /* ptr to !while statement */ + struct line *w_end; /* ptr to the !endwhile statement */ + int w_type; /* block type */ + struct while_block *w_next; /* next while */ +}; + +#define BTWHILE 1 +#define BTBREAK 2 + /* directive name table: This holds the names of all the directives.... */ @@ -34,6 +64,9 @@ static const char *dname[] = { "force" }; +static int dobuf( struct buffer *bp) ; +static void freewhile( struct while_block *wp) ; + /* * Execute a named command even if it is not bound. */ @@ -436,7 +469,7 @@ int execbuf(int f, int n) * * struct buffer *bp; buffer to execute */ -int dobuf(struct buffer *bp) +static int dobuf(struct buffer *bp) { int status; /* status return */ struct line *lp; /* pointer to line to execute */ @@ -853,7 +886,7 @@ int dobuf(struct buffer *bp) * * struct while_block *wp; head of structure to free */ -void freewhile(struct while_block *wp) +static void freewhile(struct while_block *wp) { if (wp == NULL) return; diff --git a/exec.h b/exec.h index e0604c7..56939b4 100644 --- a/exec.h +++ b/exec.h @@ -1,8 +1,12 @@ #ifndef _EXEC_H_ #define _EXEC_H_ -#include "buffer.h" -#include "estruct.h" +#define PROC 1 /* named procedures */ + +#if PROC +int storeproc( int f, int n) ; +int execproc( int f, int n) ; +#endif int namedcmd( int f, int n) ; int execcmd( int f, int n) ; @@ -11,11 +15,7 @@ char *token( char *src, char *tok, int size) ; int macarg( char *tok) ; int nextarg( const char *prompt, char *buffer, int size, int terminator) ; int storemac( int f, int n) ; -int storeproc( int f, int n) ; -int execproc( int f, int n) ; int execbuf( int f, int n) ; -int dobuf( struct buffer *bp) ; -void freewhile( struct while_block *wp) ; int execfile( int f, int n) ; int dofile( char *fname) ; int cbuf( int f, int n, int bufnum) ;