Skip to content

Commit

Permalink
Merge pull request #391 from olebole/protoize-ecl
Browse files Browse the repository at this point in the history
Protoize CL and ECL
  • Loading branch information
olebole committed Apr 15, 2024
2 parents 2dad58e + e082283 commit 0f82aa4
Show file tree
Hide file tree
Showing 55 changed files with 167 additions and 196 deletions.
4 changes: 2 additions & 2 deletions pkg/cl/binop.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ binop (int opcode)
first_char = o1.o_val.v_s[0];

/* Null patterns match any string. */
if (first_char == NULL) {
if (first_char == '\0') {
result.o_val.v_i = 1;
result.o_type = OT_INT;
goto pushresult;
Expand Down Expand Up @@ -368,7 +368,7 @@ binop (int opcode)
first_char = o1.o_val.v_s[0];

/* Null patterns match any string. */
if (first_char == NULL) {
if (first_char == '\0') {
result.o_val.v_i = 1;
result.o_type = OT_INT;
goto pushresult;
Expand Down
7 changes: 3 additions & 4 deletions pkg/cl/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ cl_locate (char *task_spec, int first_only)
}
}

if (found == NULL)
if (found == 0)
oprintf ("%s: task not found.\n", task_spec);
else
oprintf ("\n");
Expand Down Expand Up @@ -1900,7 +1900,6 @@ cledit (void)
char oscmd[SZ_LINE], os_filelist[SZ_LINE];
char osfn[SZ_PATHNAME];
struct operand o;
char *envget();
int n;

pfp = newtask->t_pfp;
Expand Down Expand Up @@ -2100,8 +2099,8 @@ setbuiltins (register struct package *pkp)
{
/* Debugging functions are in debug.c.
*/
extern void d_f(), d_l(), d_d(), d_off(), d_on(), d_p(), d_t();
extern void pr_listcache();
extern void d_f(void), d_l(void), d_d(void), d_off(void), d_on(void), d_p(void), d_t(void);
extern void pr_listcache(FILE *fp);

static struct builtin {
char *b_name;
Expand Down
2 changes: 1 addition & 1 deletion pkg/cl/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern char *nullstr;
extern int cldebug;
extern int cltrace;
static void dd_f();
static void dd_f(char *msg, char *fname);


/* D_STACK -- Go through the instruction stack, starting at locpc, printing
Expand Down
2 changes: 1 addition & 1 deletion pkg/cl/edcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/

static char ed_editorcmd[SZ_LINE+1];
static void map_escapes();
static void map_escapes(char *input, char *output);


/* EDTINIT -- Initialize the editor.
Expand Down
10 changes: 5 additions & 5 deletions pkg/cl/eparam.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int eh_standout = YES; /* ehist default for standout */
int eh_bol = NO; /* start ehist at beginning of line */
int eh_verify = NO; /* use ehist with history meta-chars */

char *e_tonextword(), *e_toprevword();
char *e_tonextword(register char *ip), *e_toprevword(char *ip, char *string);

int eparam (struct ep_context *cx, int *update, int *nextcmd, char *nextpset);

Expand Down Expand Up @@ -452,7 +452,7 @@ e_repaint (void)
* label columns (if desired).
*/
p = parmlist[keyid]->p_prompt;
if (p == NULL || *p == NULL)
if (p == NULL || *p == '\0')
p = static_prompt;

/* e_indent_prompt (p, promptbuf, startcol); */
Expand Down Expand Up @@ -705,7 +705,7 @@ e_check_vals (
char *string
)
{
char *gquery(); /* declare gquery as returning a pointer */
char *gquery(struct param *pp, char *string); /* declare gquery as returning a pointer */
char *errstr; /* pointer to the error string (or 0) */
char message[SZ_LINE+1];/* error message string */
int badnews; /* a flag if an array element is in error */
Expand All @@ -722,7 +722,7 @@ e_check_vals (

if (isarray) {
char outstring[G_MAXSTRING];
char *in, *e_getfield();
char *in, *e_getfield(register char *ip, char *outstr, int maxch);
int first, nelem, flen;

/* Get the length of the first dimension, and the starting point.
Expand Down Expand Up @@ -1141,7 +1141,7 @@ editstring (
int eparam /* flag to indicate eparam or ehis */
)
{
char oldchar; /* save old character after delete */
char oldchar = '\0'; /* save old character after delete */
char oldword[G_MAXSTRING]; /* save the deleted word */
char oldline[G_MAXSTRING]; /* save the deleted line */
char tempstr[G_MAXSTRING];
Expand Down
4 changes: 2 additions & 2 deletions pkg/cl/eparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ extern struct edit_commands command[MAX_COMMANDS];
extern char *cmdnames[MAX_COMMANDS];
extern int numcommands;

char *enumin(), *minmax();
char *host_editor();
char *enumin(register struct param *pp), *minmax(register struct param *pp);
char *host_editor(char *editor);
2 changes: 0 additions & 2 deletions pkg/cl/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ execnewtask (void)
static struct pfile *pfp;

struct param *pp;
FILE *fopen();

if (newtask == NULL)
/* if this ever happens, i don't want to know about it. */
Expand Down Expand Up @@ -684,7 +683,6 @@ findexe (
char root[SZ_FNAME+1], root_path[SZ_PATHNAME+1];
char bindir[SZ_FNAME+1], *ip = NULL, *arch = NULL;
char bin_root[SZ_PATHNAME+1];
char *envget();


memset (root, 0, SZ_FNAME);
Expand Down
6 changes: 0 additions & 6 deletions pkg/cl/gram.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extern int cldebug;

extern int inarglist; /* set by parser when in argument list */
extern int parenlevel; /* nesting level of parens */
extern int get_nscanval();
int pipetable[MAXPIPES]; /* for maintaining pipe temp files */
int nextpipe = 0;

Expand Down Expand Up @@ -862,7 +861,6 @@ char *
addpipe (void)
{
static int pipecode = 0;
char *pipefile();

if (pipecode == 0)
pipecode = c_getpid();
Expand Down Expand Up @@ -903,8 +901,6 @@ addpipe (void)
char *
getpipe (void)
{
char *pipefile();

if (nextpipe == 0)
cl_error (E_IERR, "Pipestack underflow");
return (pipefile (pipetable[nextpipe-1]));
Expand All @@ -919,7 +915,6 @@ void
delpipes (register int npipes)
{
register int pipe;
char *pipefile();

if (npipes == 0) {
while (nextpipe > 0)
Expand All @@ -942,7 +937,6 @@ pipefile (int pipecode)
{
static char fname[SZ_PIPEFILENAME+1];
char *dir;
char *envget();

/* Put pipefiles in 'pipes' or 'uparm' if defined, else use tmp. Do
* not put pipe files in current directory or pipe commands will fail
Expand Down
2 changes: 1 addition & 1 deletion pkg/cl/grammar.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ extern int parse_state; /* What are we parsing? */
extern int proc_script; /* In a procedure script? */
extern struct pfile *parse_pfile; /* Where parsed params are added. */

char *today(); /* returns pointer to todays date */
char *today(void); /* returns pointer to todays date */
5 changes: 1 addition & 4 deletions pkg/cl/grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ extern char cmdblk[SZ_CMDBLK+1]; /* Command buffer in history.c */
extern char *ip_cmdblk; /* Pointer to current char in command.*/
extern char *err_cmdblk; /* ip_cmdblk when error detected. */

struct param *initparam();
struct label *getlabel(), *setlabel();

/* arbitrary large number for bracelevel in a procedure script
*/
#define MAX_ERR 10
Expand Down Expand Up @@ -1192,7 +1189,7 @@ arg : /* nothing - compile a null posargset to bump nargs */
*/
breakout (stkop($1)->o_val.v_s, &pk, &t, &p, &f);
pfp = currentask->t_pfp;
if (*pk == NULL && *t == NULL &&
if (*pk == '\0' && *t == '\0' &&
pfp && paramfind(pfp,p,0,1)) {

sprintf (pname, "%s.%s",
Expand Down
6 changes: 3 additions & 3 deletions pkg/cl/history.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ int
get_history (int record, char *command, int maxch)
{
char *recptr;
char *find_history();
char *find_history(int record);

if ((recptr = find_history (record)) == NULL) {
*command = EOS;
Expand Down Expand Up @@ -884,7 +884,7 @@ show_history (FILE *fp, int max_commands)
char *recptr[MAX_SHOWHIST];
char cmdblk[SZ_CMDBLK+1];
int record;
char *find_history();
char *find_history(int record);

/* Flush the "history" command so that it shows up in the history. */
yy_startblock (LOG);
Expand Down Expand Up @@ -1082,7 +1082,7 @@ putlog (
register char *ip, *op, *otop;
register int n;
char msg[SZ_LOGBUF], job[5];
char *pkg, *tname, *today();
char *pkg, *tname, *today(void);
extern int bkgno; /* job number if bkg job */

if (!keeplog())
Expand Down
4 changes: 2 additions & 2 deletions pkg/cl/lexicon.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ lexicon (void)
char *bkgerr = "ERROR: cannot submit background job inside {}\n";
register int ch, cch;
register int token;
int stringtok, identifier, setlevel;
int stringtok = 1, identifier = 1, setlevel = 0;
int clswitch;
char *op;

Expand Down Expand Up @@ -646,7 +646,7 @@ etok_: if (!newtoken) {
/* LEXINIT -- Initialize the internal state variables of the lexical analyzer,
* e.g. when processing is interrupted by an interrupt.
*/
int
void
lexinit (void)
{
if (lexmodes() && !lex_cpumodeset (currentask->t_in)) {
Expand Down
10 changes: 5 additions & 5 deletions pkg/cl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ long cpustart, clkstart; /* starting cpu, clock times if bkg */
int logout_status = 0; /* optional status arg to logout() */


static void execute();
static void login(), logout();
static void startup(), shutdown();
static void execute(int mode);
static void login(char *cmd), logout(void);
static void startup(void), shutdown(void);

static void onint (int *vex, int (**next_handler)(void));
extern int yyparse();
extern int yyparse(void);


/* C_MAIN -- Called by the SPP procedure in cl.x to fire up the CL.
Expand Down Expand Up @@ -252,7 +252,7 @@ execute (int mode)
{
int parsestat;
XINT old_parhead;
char *curcmd();
char *curcmd(void);

alldone = 0;
gologout = 0;
Expand Down
4 changes: 2 additions & 2 deletions pkg/cl/mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ extern XINT pc; /* program counter */
*/
#define coderef(x) ((struct codeentry *)&stack[x])

extern char *memneed(); /* insures enough core, returns start */
extern char *comdstr(); /* compile string at topd, return start */
extern char *memneed(int incr); /* insures enough core, returns start */
extern char *comdstr(char *s); /* compile string at topd, return start */
9 changes: 4 additions & 5 deletions pkg/cl/modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ query (struct param *pp)
char buf[SZ_PROMPTBUF+1];
struct operand o;
int bastype, batch, arrflag, offset=0, n_ele, max_ele, fd;
char *nlp, *nextstr();
char *bkg_query(), *query_status;
char *nlp, *nextstr(char **pbuf, FILE *fp);
char *bkg_query(char *obuf, int maxch, register struct param *pp), *query_status;
char *abuf;

bastype = pp->p_type & OT_BASIC;
Expand Down Expand Up @@ -537,7 +537,7 @@ text_query: fd = spf_open (buf, SZ_PROMPTBUF);
char *
nextstr (char **pbuf, FILE *fp)
{
char *p, *nxtchr();
char *p, *nxtchr(char *p, FILE *fp);
static char tbuf[SZ_LINE];
char quote;
int cnt;
Expand Down Expand Up @@ -751,7 +751,7 @@ bkg_query (
{
char bqfile[SZ_PATHNAME], qrfile[SZ_PATHNAME];
int waitime, delay;
char *envget(), *fgets_status;
char *fgets_status;
FILE *fp, *in;

if (notify())
Expand Down Expand Up @@ -866,7 +866,6 @@ void
get_bkgqfiles (int bkgno, int pid, char *bkg_query_file, char *query_response_file)
{
int filecode;
char *envget();

if (envget (UPARM) == NULL)
cl_error (E_UERR,
Expand Down
8 changes: 4 additions & 4 deletions pkg/cl/opcodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
extern int cldebug;
extern char *nullstr;
int binpipe; /* last pipe binary or text ? */
char *comdstr();
extern struct param *ppfind(); /* search task psets for param */
char *comdstr(char *s);
extern struct param *ppfind(struct pfile *pfp, char *tn, char *pn, int pos, int abbrev); /* search task psets for param */

void
o_undefined (memel *argp)
Expand Down Expand Up @@ -973,7 +973,7 @@ o_doaddpipe (memel *argp)
char *ltname;
struct operand o;
struct ltask *ltp;
char *addpipe();
char *addpipe(void);

/* ADDPIPE is called immediately before REDIR and before EXEC so we
* do not have to worry about storing the pipefile name in the dict.
Expand Down Expand Up @@ -1005,7 +1005,7 @@ o_dogetpipe (
)
{
struct operand o;
char *getpipe(), *comdstr();
char *getpipe(void), *comdstr(char *s);

/* GETPIPE is called immediately before REDIRIN and before EXEC so we
* do not have to worry about storing the pipefile name in the dict.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cl/opcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct codeentry {
memel c_args; /* addr of this is addr of first arg */
};

extern void (*opcodetbl[])();
extern void (*opcodetbl[])(memel *arg);

/* manifest constant opcodes used in c_opcode.
* value is index into opcodetbl[].
Expand Down
7 changes: 3 additions & 4 deletions pkg/cl/operand.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ struct arr_desc {

extern char *truestr, *falsestr;

struct operand popop(), pushop();
struct operand makeop();
struct operand readlist(); /* read and return operand from list */
struct operand sexa(); /* convert n:n:n string to sexagesimal */
struct operand popop(void), pushop(struct operand *op);
struct operand makeop(char *str, int type);
struct operand sexa(char *); /* convert n:n:n string to sexagesimal */
2 changes: 1 addition & 1 deletion pkg/cl/param.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ paramsrch (char *pkname, char *ltname, char *pname)
{
register struct param *pp;
struct pfile *pfp;
struct param *lookup_param();
struct param *lookup_param(char *pkname, char *ltname, char *pname);

/* First search for a regular parameter. If this fails then we
* handle the case when currentask has no pfile.
Expand Down
Loading

0 comments on commit 0f82aa4

Please sign in to comment.