/* This file is for functions dealing with execution of commands, command lines, buffers, files and startup files written 1986 by Daniel Lawrence */ #include #include "estruct.h" #include "edef.h" #if MEGAMAX & ST520 overlay "exec" #endif #if DEBUGM char outline[NSTRING]; /* global string to hold debug line text */ #endif /* namedcmd: execute a named command even if it is not bound */ namedcmd(f, n) int f, n; /* command arguments [passed through to command executed] */ { register (*kfunc)(); /* ptr to the requexted function to bind to */ int (*getname())(); /* prompt the user to type a named command */ mlwrite(": "); /* and now get the function name to execute */ kfunc = getname(); if (kfunc == NULL) { mlwrite("[No such function]"); return(FALSE); } /* and then execute the command */ return((*kfunc)(f, n)); } /* execcmd: Execute a command line command to be typed in by the user */ execcmd(f, n) int f, n; /* default Flag and Numeric argument */ { register int status; /* status return */ char cmdstr[NSTRING]; /* string holding command to execute */ /* get the line wanted */ if ((status = mlreply(": ", cmdstr, NSTRING)) != TRUE) return(status); execlevel = 0; return(docmd(cmdstr)); } /* docmd: take a passed string as a command line and translate it to be executed as a command. This function will be used by execute-command-line and by all source and startup files. Lastflag/thisflag is also updated. format of the command line is: {# arg} {} Directives start with a "!" and include: !endm End a macro !if (cond) conditional execution !else !endif !return Return (terminating current macro) !goto