Allow more procedure parameters
This commit is contained in:
parent
3e80ca51fc
commit
d9d6cc127f
|
@ -57,7 +57,7 @@ unsigned codegen(codep,ply,toplevel,costlimit,forced) byte *codep; unsigned cost
|
|||
#endif
|
||||
unsigned totalcost = 0;
|
||||
int inscoerc=0;
|
||||
int procarg[2];
|
||||
int procarg[MAXPROCARG];
|
||||
#ifdef ALLOW_NEXTEM
|
||||
static int paniced;
|
||||
char *savebp = 0;
|
||||
|
@ -149,9 +149,13 @@ unsigned codegen(codep,ply,toplevel,costlimit,forced) byte *codep; unsigned cost
|
|||
#endif
|
||||
n = *bp++;
|
||||
if (n==0) { /* "procedure" */
|
||||
int j, nargs;
|
||||
getint(i,bp);
|
||||
getint(procarg[0],bp);
|
||||
getint(procarg[1],bp);
|
||||
getint(nargs,bp);
|
||||
assert(nargs < MAXPROCARGS);
|
||||
for (j = 0; j < nargs; j++) {
|
||||
getint(procarg[j],bp);
|
||||
}
|
||||
bp= &pattern[i];
|
||||
n = *bp++;
|
||||
DEBUG("PROC_CALL");
|
||||
|
@ -677,7 +681,7 @@ normalfailed: if (stackpad!=tokpatlen) {
|
|||
if (toplevel) {
|
||||
swtxt();
|
||||
if (stringno>10000) {
|
||||
assert(stringno== 10001 || stringno== 10002);
|
||||
assert(stringno < 100001 + MAXPROCARG);
|
||||
genstr(procarg[stringno-10001]);
|
||||
} else
|
||||
genstr(stringno);
|
||||
|
|
|
@ -98,7 +98,7 @@ iocc_t iops[20];
|
|||
%type <yy_str> opt_par_string optstring
|
||||
%type <yy_int> register propno att_list_el_type tokenset_no
|
||||
%type <yy_int> adornlist optstar optuses optregvar regvartype optregvartype
|
||||
%type <yy_int> emarg tokarg subreg allreg optsecondstring
|
||||
%type <yy_int> emarg tokarg subreg allreg
|
||||
%type <yy_expr> expr regvarexpr
|
||||
%type <yy_iocc> tokeninstance
|
||||
%type <yy_int> optexpr optexact optstack
|
||||
|
@ -671,22 +671,23 @@ patterns
|
|||
if (npatterns>maxrule)
|
||||
maxrule=npatterns;
|
||||
}
|
||||
| CALL IDENT '(' STRING optsecondstring ')'
|
||||
| CALL IDENT '(' stringlist ')'
|
||||
{ register symbol *sy_p;
|
||||
saferulefound=1;
|
||||
sy_p=lookup($2,symproc,mustexist);
|
||||
callproc=sy_p->sy_value.syv_procoff;
|
||||
procarg[0] = strlookup($4);
|
||||
procarg[1] = $5;
|
||||
free($2);
|
||||
free($4);
|
||||
if (nprocargs > maxprocargs) maxprocargs = nprocargs;
|
||||
}
|
||||
;
|
||||
optsecondstring
|
||||
: /* empty */
|
||||
{ $$ = 0; }
|
||||
| ',' STRING
|
||||
{ $$ = strlookup($2); free($2); }
|
||||
|
||||
stringlist
|
||||
: STRING
|
||||
{ nprocargs = 1; procarg[0] = strlookup($1); free($1); }
|
||||
| stringlist ',' STRING
|
||||
{ NEXT(nprocargs, MAXPROCARG, "Procedure argument list");
|
||||
procarg[nprocargs-1] = strlookup($3); free($3);
|
||||
}
|
||||
;
|
||||
|
||||
onepattern
|
||||
|
|
|
@ -30,11 +30,12 @@ extern int cursetno;
|
|||
extern int allsetno;
|
||||
extern int inproc;
|
||||
extern int callproc;
|
||||
extern int procarg[2];
|
||||
extern int procarg[];
|
||||
extern int fc1,fc2,fc3,fc4;
|
||||
extern int maxmembers;
|
||||
extern int regclass;
|
||||
extern int maxtokensize;
|
||||
extern int nprocargs, maxprocargs;
|
||||
|
||||
extern char *mystrcpy();
|
||||
extern char *myalloc();
|
||||
|
|
|
@ -184,8 +184,8 @@ outpatterns() {
|
|||
} else {
|
||||
patbyte(0);
|
||||
pat(callproc);
|
||||
pat(procarg[0]);
|
||||
pat(procarg[1]);
|
||||
pat(nprocargs);
|
||||
for (i = 0; i < nprocargs; i++) pat(procarg[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,6 +585,7 @@ outdefs() {
|
|||
cdef("MAXPATLEN",maxtokpatlen);
|
||||
cdef("MAXREPLLEN",maxtokrepllen);
|
||||
cdef("MAXEMREPLLEN",maxemrepllen);
|
||||
cdef("MAXPROCARG",maxprocargs);
|
||||
cdef("MAXRULE",maxrule<16 ? 16 : maxrule);
|
||||
if (nsplit>0) {
|
||||
cdef("MAXSPLIT",maxsplit);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define MAXPATBYTES BORS(14000,7000)
|
||||
#define MAXREGVAR 10
|
||||
#define MAXSOURCELINES 6000
|
||||
#define MAXPROCARG 10
|
||||
|
||||
/* end of tunable constants */
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ int cursetno = -1;
|
|||
int allsetno;
|
||||
int inproc=0; /* scanning "procedure" */
|
||||
int callproc=0;
|
||||
int procarg[2];
|
||||
int fc1=1,fc2=1,fc3=1,fc4=1;
|
||||
int maxmembers=0;
|
||||
int regclass=1;
|
||||
|
@ -42,6 +41,8 @@ int rvused=0;
|
|||
int nregvar[4];
|
||||
int rvsize[4];
|
||||
int rvnumbers[4][MAXREGVAR];
|
||||
int procarg[MAXPROCARG];
|
||||
int maxprocargs, nprocargs;
|
||||
|
||||
reginfo l_regs[MAXREGS];
|
||||
propinfo l_props[MAXPROPS];
|
||||
|
|
Loading…
Reference in a new issue