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