Annotation of OpenXM_contrib2/asir2000/parse/compile.c, Revision 1.9
1.2 noro 1: /*
2: * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
3: * All rights reserved.
4: *
5: * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
6: * non-exclusive and royalty-free license to use, copy, modify and
7: * redistribute, solely for non-commercial and non-profit purposes, the
8: * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
9: * conditions of this Agreement. For the avoidance of doubt, you acquire
10: * only a limited right to use the SOFTWARE hereunder, and FLL or any
11: * third party developer retains all rights, including but not limited to
12: * copyrights, in and to the SOFTWARE.
13: *
14: * (1) FLL does not grant you a license in any way for commercial
15: * purposes. You may use the SOFTWARE only for non-commercial and
16: * non-profit purposes only, such as academic, research and internal
17: * business use.
18: * (2) The SOFTWARE is protected by the Copyright Law of Japan and
19: * international copyright treaties. If you make copies of the SOFTWARE,
20: * with or without modification, as permitted hereunder, you shall affix
21: * to all such copies of the SOFTWARE the above copyright notice.
22: * (3) An explicit reference to this SOFTWARE and its copyright owner
23: * shall be made on your publication or presentation in any form of the
24: * results obtained by use of the SOFTWARE.
25: * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.3 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.2 noro 27: * for such modification or the source code of the modified part of the
28: * SOFTWARE.
29: *
30: * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
31: * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
32: * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
33: * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
34: * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
35: * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
36: * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
37: * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
38: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
39: * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
40: * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
41: * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
42: * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
43: * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
44: * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
45: * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
46: * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
47: *
1.9 ! kondoh 48: * $OpenXM: OpenXM_contrib2/asir2000/parse/compile.c,v 1.8 2018/03/29 01:32:54 noro Exp $
1.2 noro 49: */
1.1 noro 50: #include <ctype.h>
51: #include "ca.h"
52: #include "base.h"
53: #include "parse.h"
54: #if !defined(THINK_C)
55: #include <sys/types.h>
56: #include <sys/stat.h>
57: #endif
58:
59: extern jmp_buf timer_env;
60:
61: pointer bcompilef(), compilemapf();
62:
63: pointer compile(f)
64: FNODE f;
65: {
1.8 noro 66: LIST t;
67: STRING str;
68: pointer val = 0;
69: pointer a,a1,a2;
70: NODE tn,ind;
71: R s,u;
72: DP dp;
73: int pv,c;
74: FNODE f1;
75: Obj expired;
76: int interval;
77:
78: if ( !f )
79: return ( 0 );
80: switch ( f->id ) {
81: case I_BOP:
82: a1 = compile((FNODE)FA1(f)); a2 = compile((FNODE)FA2(f));
83: val = emit_bop(((ARF)FA0(f)),a1,a2);
84: break;
85: case I_COP:
86: a1 = compile((FNODE)FA1(f)); a2 = compile((FNODE)FA2(f));
87: val = emit_cop((cid)FA0(f),a1,a2);
88: break;
89: case I_AND:
90: a1 = compile((FNODE)FA0(f)); a2 = compile((FNODE)FA1(f));
91: val = emit_and(a1,a2);
92: break;
93: case I_OR:
94: a1 = compile((FNODE)FA0(f)); a2 = compile((FNODE)FA1(f));
95: val = emit_or(a1,a2);
96: break;
97: case I_NOT:
98: a1 = compile((FNODE)FA0(f));
99: val = emit_not(a1);
100: break;
101: case I_CE:
102: a1 = compile((FNODE)FA0(f)); a2 = compile((FNODE)FA1(f));
103: a3 = compile((FNODE)FA0(f));
104: emit_ce(a1,a2,a3);
105: break;
106: case I_FUNC:
107: val = compilef((FUNC)FA0(f),(FNODE)FA1(f)); break;
108: case I_PVAR:
109: pv = (int)FA0(f); ind = (NODE)FA1(f); GETPV(pv,a);
110: if ( !ind )
111: val = a;
112: else {
113: compilenodebody(ind,&tn); getarray(a,tn,&val);
114: }
115: break;
116: case I_ASSPVAR:
117: f1 = (FNODE)FA0(f);
118: if ( ID(f1) == I_PVAR ) {
119: pv = (int)FA0(f1); ind = (NODE)FA1(f1);
120: if ( !ind ) {
121: val = compile((FNODE)FA1(f)); ASSPV(pv,val);
122: } else {
123: GETPV(pv,a);
124: compilenodebody(ind,&tn);
125: putarray(a,tn,val = compile((FNODE)FA1(f)));
126: }
127: } else
128: val = compilepv(ID(f),(FNODE)FA0(f),FA1(f));
129: break;
130: case I_PRESELF:
131: f1 = (FNODE)FA1(f);
132: if ( ID(f1) == I_PVAR ) {
133: pv = (int)FA0(f1); ind = (NODE)FA1(f1); GETPV(pv,a);
134: if ( !ind ) {
135: (*((ARF)FA0(f))->fp)(CO,a,ONE,&val); ASSPV(pv,val);
136: } else if ( a ) {
137: compilenodebody(ind,&tn); getarray(a,tn,(pointer *)&u);
138: (*((ARF)FA0(f))->fp)(CO,u,ONE,&val); putarray(a,tn,val);
139: }
140: } else
141: val = compilepv(f->id,(FNODE)FA1(f),FA0(f));
142: break;
143: case I_POSTSELF:
144: f1 = (FNODE)FA1(f);
145: if ( ID(f1) == I_PVAR ) {
146: pv = (int)FA0(f1); ind = (NODE)FA1(f1); GETPV(pv,val);
147: if ( !ind ) {
148: (*((ARF)FA0(f))->fp)(CO,val,ONE,&u); ASSPV(pv,u);
149: } else if ( val ) {
150: compilenodebody(ind,&tn); getarray(val,tn,&a);
151: (*((ARF)FA0(f))->fp)(CO,a,ONE,&u); putarray(val,tn,(pointer)u);
152: val = a;
153: }
154: } else
155: val = compilepv(f->id,(FNODE)FA1(f),FA0(f));
156: break;
157: case I_STR:
158: MKSTR(str,FA0(f)); val = (pointer)str; break;
159: case I_FORMULA:
160: val = FA0(f); break;
161: case I_LIST:
162: compilenodebody((NODE)FA0(f),&tn); MKLIST(t,tn); val = (pointer)t; break;
163: case I_INDEX:
164: a = compile((FNODE)FA0(f)); ind = (NODE)FA1(f);
165: compilenodebody(ind,&tn); getarray(a,tn,&val);
166: break;
167: default:
168: fprintf(stderr,"compile: unknown id");
169: error("");
170: break;
171: }
172: return ( val );
1.1 noro 173: }
174:
175: pointer compilestat(f)
176: SNODE f;
177: {
1.8 noro 178: pointer val = 0,t,s,s1,u;
179: NODE tn;
180: int i,ac;
181: V *a;
182: char *buf;
183:
184: if ( !f )
185: return ( 0 );
186: if ( nextbp && nextbplevel <= 0 && f->id != S_CPLX ) {
187: nextbp = 0;
188: bp(f);
189: }
190: compilestatline = f->ln;
191:
192: switch ( f->id ) {
193: case S_BP:
194: if ( !nextbp && (!FA1(f) || compile((FNODE)FA1(f))) ) {
195: if ( (FNODE)FA2(f) ) {
1.4 ohara 196: #if defined(PARI)
1.8 noro 197: extern FILE *outfile;
198: outfile = stderr;
1.1 noro 199: #endif
1.8 noro 200: asir_out = stderr;
201: printexpr(CO,compile((FNODE)FA2(f)));
202: putc('\n',asir_out); fflush(asir_out);
1.4 ohara 203: #if defined(PARI)
1.8 noro 204: outfile = stdout;
1.1 noro 205: #endif
1.8 noro 206: asir_out = stdout;
207: } else {
208: nextbp = 1; nextbplevel = 0;
209: }
210: }
211: val = compilestat((SNODE)FA0(f));
212: break;
213: case S_PFDEF:
214: ac = argc(FA1(f)); a = (V *)MALLOC(ac*sizeof(V));
215: s = compile((FNODE)FA2(f));
216: buf = (char *)ALLOCA(BUFSIZ);
217: for ( i = 0, tn = (NODE)FA1(f); tn; tn = NEXT(tn), i++ ) {
218: t = compile((FNODE)tn->body); sprintf(buf,"_%s",NAME(VR((P)t)));
219: makevar(buf,&u); a[i] = VR((P)u);
220: substr(CO,0,(Obj)s,VR((P)t),(Obj)u,(Obj *)&s1); s = s1;
221: }
1.9 ! kondoh 222: #if defined(INTERVAL)
! 223: mkpf((char *)FA0(f),(Obj)s,ac,a,0,0,0,(PF *)&val); val = 0; break;
! 224: #else
1.8 noro 225: mkpf((char *)FA0(f),(Obj)s,ac,a,0,0,(PF *)&val); val = 0; break;
1.9 ! kondoh 226: #endif
1.8 noro 227: case S_SINGLE:
228: val = compile((FNODE)FA0(f)); break;
229: case S_CPLX:
230: for ( tn = (NODE)FA0(f); tn; tn = NEXT(tn) ) {
231: if ( BDY(tn) )
232: val = compilestat((SNODE)BDY(tn));
233: if ( f_break || f_return || f_continue )
234: break;
235: }
236: break;
237: case S_BREAK:
238: if ( GPVS != CPVS )
239: f_break = 1;
240: break;
241: case S_CONTINUE:
242: if ( GPVS != CPVS )
243: f_continue = 1;
244: break;
245: case S_RETURN:
246: if ( GPVS != CPVS ) {
247: val = compile((FNODE)FA0(f)); f_return = 1;
248: }
249: break;
250: case S_IFELSE:
251: if ( compilenode((NODE)FA1(f)) )
252: val = compilestat((SNODE)FA2(f));
253: else if ( FA3(f) )
254: val = compilestat((SNODE)FA3(f));
255: break;
256: case S_FOR:
257: compilenode((NODE)FA1(f));
258: while ( 1 ) {
259: if ( !compilenode((NODE)FA2(f)) )
260: break;
261: val = compilestat((SNODE)FA4(f));
262: if ( f_break || f_return )
263: break;
264: f_continue = 0;
265: compilenode((NODE)FA3(f));
266: }
267: f_break = 0; break;
268: case S_DO:
269: while ( 1 ) {
270: val = compilestat((SNODE)FA1(f));
271: if ( f_break || f_return )
272: break;
273: f_continue = 0;
274: if ( !compilenode((NODE)FA2(f)) )
275: break;
276: }
277: f_break = 0; break;
278: default:
279: fprintf(stderr,"compilestat: unknown id");
280: error("");
281: break;
282: }
283: return ( val );
1.1 noro 284: }
285:
286: pointer compilenode(node)
287: NODE node;
288: {
1.8 noro 289: NODE tn;
290: pointer val;
1.1 noro 291:
1.8 noro 292: for ( tn = node, val = 0; tn; tn = NEXT(tn) )
293: if ( BDY(tn) )
294: val = compile((FNODE)BDY(tn));
295: return ( val );
1.1 noro 296: }
297:
298: extern FUNC cur_binf;
299: extern NODE PVSS;
300:
301: pointer compilef(f,a)
302: FUNC f;
303: FNODE a;
304: {
1.8 noro 305: LIST args;
306: pointer val;
307: int i,n,level;
308: NODE tn,sn;
1.1 noro 309: VS pvs;
310:
1.8 noro 311: if ( f->id == A_UNDEF ) {
312: fprintf(stderr,"%s undefined",NAME(f));
313: error("");
314: }
315: if ( f->id != A_PARI ) {
316: for ( i = 0, tn = a?(NODE)FA0(a):0; tn; i++, tn = NEXT(tn) );
317: if ( ((n = f->argc)>= 0 && i != n) || (n < 0 && i > -n) ) {
318: fprintf(stderr,"argument mismatch in %s()",NAME(f));
319: error("");
320: }
321: }
322: switch ( f->id ) {
323: case A_BIN:
324: if ( !n ) {
325: cur_binf = f;
326: (*f->f.binf)(&val);
327: } else {
328: args = (LIST)compile(a);
329: cur_binf = f;
330: (*f->f.binf)(args?BDY(args):0,&val);
331: }
332: cur_binf = 0;
333: break;
334: case A_PARI:
335: args = (LIST)compile(a);
336: cur_binf = f;
337: val = compileparif(f,args?BDY(args):0);
338: cur_binf = 0;
339: break;
340: case A_USR:
341: args = (LIST)compile(a);
342: pvs = f->f.usrf->pvs;
343: if ( PVSS ) {
344: ((VS)BDY(PVSS))->at = compilestatline;
345: level = ((VS)BDY(PVSS))->level+1;
346: } else
347: level = 1;
348: MKNODE(tn,pvs,PVSS); PVSS = tn;
349: CPVS = (VS)ALLOCA(sizeof(struct oVS)); BDY(PVSS) = (pointer)CPVS;
350: CPVS->usrf = f; CPVS->n = CPVS->asize = pvs->n;
351: CPVS->level = level;
352: if ( CPVS->n ) {
353: CPVS->va = (struct oPV *)ALLOCA(CPVS->n*sizeof(struct oPV));
354: bcopy((char *)pvs->va,(char *)CPVS->va,
355: (int)(pvs->n*sizeof(struct oPV)));
356: }
357: if ( nextbp )
358: nextbplevel++;
359: for ( tn = f->f.usrf->args, sn = BDY(args);
360: sn; tn = NEXT(tn), sn = NEXT(sn) )
361: ASSPV((int)FA0((FNODE)BDY(tn)),BDY(sn));
362: val = compilestat((SNODE)BDY(f->f.usrf));
363: f_return = f_break = f_continue = 0; poppvs();
364: break;
365: case A_PURE:
366: val = compilepf(f->f.puref,a); break;
367: default:
368: fprintf(stderr,"%s undefined",NAME(f));
369: error("");
370: break;
371: }
372: return val;
1.1 noro 373: }
374:
375: pointer compilemapf(f,a)
376: FUNC f;
377: FNODE a;
378: {
1.8 noro 379: LIST args;
380: NODE node,rest,t,n,l,r,r0;
381: Obj head;
382: VECT v,rv;
383: MAT m,rm;
384: LIST rl;
385: int len,row,col,i,j;
386: pointer val;
387:
388: args = (LIST)compile(a);
389: node = BDY(args); head = (Obj)BDY(node); rest = NEXT(node);
390: switch ( OID(head) ) {
391: case O_VECT:
392: v = (VECT)head; len = v->len; MKVECT(rv,len);
393: for ( i = 0; i < len; i++ ) {
394: MKNODE(t,BDY(v)[i],rest); BDY(rv)[i] = bcompilef(f,t);
395: }
396: val = (pointer)rv;
397: break;
398: case O_MAT:
399: m = (MAT)head; row = m->row; col = m->col; MKMAT(rm,row,col);
400: for ( i = 0; i < row; i++ )
401: for ( j = 0; j < col; j++ ) {
402: MKNODE(t,BDY(m)[i][j],rest); BDY(rm)[i][j] = bcompilef(f,t);
403: }
404: val = (pointer)rm;
405: break;
406: case O_LIST:
407: n = BDY((LIST)head);
408: for ( r0 = r = 0; n; n = NEXT(n) ) {
409: NEXTNODE(r0,r); MKNODE(t,BDY(n),rest); BDY(r) = bcompilef(f,t);
410: }
411: if ( r0 )
412: NEXT(r) = 0;
413: MKLIST(rl,r0);
414: val = (pointer)rl;
415: break;
416: default:
417: val = bcompilef(f,node);
418: break;
419: }
420: return val;
1.1 noro 421: }
422:
423: pointer bcompilef(f,a)
424: FUNC f;
425: NODE a;
426: {
1.8 noro 427: LIST args;
428: pointer val;
429: int i,n;
430: NODE tn,sn;
1.1 noro 431: VS pvs;
432:
1.8 noro 433: if ( f->id == A_UNDEF ) {
434: fprintf(stderr,"%s undefined",NAME(f));
435: error("");
436: }
437: if ( f->id != A_PARI ) {
438: for ( i = 0, tn = a; tn; i++, tn = NEXT(tn) );
439: if ( ((n = f->argc)>= 0 && i != n) || (n < 0 && i > -n) ) {
440: fprintf(stderr,"argument mismatch in %s()",NAME(f));
441: error("");
442: }
443: }
444: switch ( f->id ) {
445: case A_BIN:
446: if ( !n ) {
447: cur_binf = f;
448: (*f->f.binf)(&val);
449: } else {
450: cur_binf = f;
451: (*f->f.binf)(a,&val);
452: }
453: cur_binf = 0;
454: break;
455: case A_PARI:
456: cur_binf = f;
457: val = compileparif(f,a);
458: cur_binf = 0;
459: break;
460: case A_USR:
461: pvs = f->f.usrf->pvs;
462: if ( PVSS )
463: ((VS)BDY(PVSS))->at = compilestatline;
464: MKNODE(tn,pvs,PVSS); PVSS = tn;
465: CPVS = (VS)ALLOCA(sizeof(struct oVS)); BDY(PVSS) = (pointer)CPVS;
466: CPVS->usrf = f; CPVS->n = CPVS->asize = pvs->n;
467: if ( CPVS->n ) {
468: CPVS->va = (struct oPV *)ALLOCA(CPVS->n*sizeof(struct oPV));
469: bcopy((char *)pvs->va,(char *)CPVS->va,
470: (int)(pvs->n*sizeof(struct oPV)));
471: }
472: if ( nextbp )
473: nextbplevel++;
474: for ( tn = f->f.usrf->args, sn = a;
475: sn; tn = NEXT(tn), sn = NEXT(sn) )
476: ASSPV((int)FA0((FNODE)BDY(tn)),BDY(sn));
477: val = compilestat((SNODE)BDY(f->f.usrf));
478: f_return = f_break = f_continue = 0; poppvs();
479: break;
480: default:
481: fprintf(stderr,"%s undefined",NAME(f));
482: error("");
483: break;
484: }
485: return val;
1.1 noro 486: }
487:
488: pointer compileif(f,a)
489: FNODE f,a;
490: {
1.8 noro 491: Obj g;
1.1 noro 492:
1.8 noro 493: g = (Obj)compile(f);
494: if ( g && (OID(g) == O_P) && (VR((P)g)->attr == (pointer)V_SR) )
495: return compilef((FUNC)VR((P)g)->priv,a);
496: else {
497: fprintf(stderr,"invalid function pointer");
498: error("");
499: }
1.1 noro 500: }
501:
502: pointer compilepf(pf,a)
503: PF pf;
504: FNODE a;
505: {
1.8 noro 506: LIST args;
507: pointer val;
508: Obj s,s1;
509: int i;
510: NODE node;
511: PFINS ins;
512: PFAD ad;
513:
514: for ( i = 0, node = a?(NODE)FA0(a):0; node; i++, node = NEXT(node) );
515: if ( pf->argc != i ) {
516: fprintf(stderr,"argument mismatch in %s()",NAME(pf));
517: error("");
518: }
519: args = (LIST)compile(a);
520: if ( !pf->body ) {
521: ins = (PFINS)CALLOC(1,sizeof(PF)+pf->argc*sizeof(struct oPFAD));
522: ins->pf = pf;
523: for ( i = 0, node = args->body, ad = ins->ad;
524: node; node = NEXT(node), i++ ) {
525: ad[i].d = 0; ad[i].arg = (Obj)node->body;
526: }
527: simplify_ins(ins,&s); return (pointer)s;
528: } else {
529: for ( i = 0, s = pf->body, node = args->body;
530: node; node = NEXT(node), i++ ) {
531: substr(CO,0,s,pf->args[i],(Obj)node->body,&s1); s = s1;
532: }
533: return (pointer)s;
534: }
1.1 noro 535: }
536:
537: void compilenodebody(sn,dnp)
538: NODE sn;
539: NODE *dnp;
540: {
1.8 noro 541: NODE n,n0,tn;
542: int line;
1.1 noro 543:
1.8 noro 544: if ( !sn ) {
545: *dnp = 0;
546: return;
547: }
548: line = compilestatline;
549: for ( tn = sn, n0 = 0; tn; tn = NEXT(tn) ) {
550: NEXTNODE(n0,n);
551: BDY(n) = compile((FNODE)BDY(tn));
552: compilestatline = line;
553: }
554: NEXT(n) = 0; *dnp = n0;
1.1 noro 555: }
556:
557: void searchf(fn,name,r)
558: NODE fn;
559: char *name;
560: FUNC *r;
561: {
1.8 noro 562: NODE tn;
1.1 noro 563:
1.8 noro 564: for ( tn = fn;
565: tn && strcmp(NAME((FUNC)BDY(tn)),name); tn = NEXT(tn) );
566: if ( tn ) {
567: *r = (FUNC)BDY(tn);
568: return;
569: }
570: *r = 0;
1.1 noro 571: }
572:
573: void appenduf(name,r)
574: char *name;
575: FUNC *r;
576: {
1.8 noro 577: NODE tn;
578: FUNC f;
1.1 noro 579:
1.8 noro 580: f=(FUNC)MALLOC(sizeof(struct oFUNC));
581: f->name = name; f->id = A_UNDEF; f->argc = 0; f->f.binf = 0;
582: MKNODE(tn,f,usrf); usrf = tn;
583: *r = f;
1.1 noro 584: }
585:
586: void mkparif(name,r)
587: char *name;
588: FUNC *r;
589: {
1.8 noro 590: NODE tn;
591: FUNC f;
1.1 noro 592:
1.8 noro 593: *r = f =(FUNC)MALLOC(sizeof(struct oFUNC));
594: f->name = name; f->id = A_PARI; f->argc = 0; f->f.binf = 0;
1.1 noro 595: }
596:
1.5 noro 597: void mkuf(name,fname,args,body,startl,endl,desc,module)
1.1 noro 598: char *name,*fname;
599: NODE args;
600: SNODE body;
601: int startl,endl;
602: char *desc;
1.5 noro 603: MODULE module;
1.1 noro 604: {
1.8 noro 605: FUNC f;
606: USRF t;
607: NODE sn,tn;
608: FNODE fn;
609: int argc;
610:
611: searchf(sysf,name,&f);
612: if ( f ) {
613: fprintf(stderr,"def : builtin function %s() cannot be redefined.\n",name);
614: CPVS = GPVS; return;
615: }
616: for ( argc = 0, sn = args; sn; argc++, sn = NEXT(sn) ) {
617: fn = (FNODE)BDY(sn);
618: if ( !fn || ID(fn) != I_PVAR ) {
619: fprintf(stderr,"illegal argument in %s()\n",name);
620: CPVS = GPVS; return;
621: }
622: }
623: for ( sn = usrf; sn && strcmp(NAME((FUNC)BDY(sn)),name); sn = NEXT(sn) );
624: if ( sn )
625: f = (FUNC)BDY(sn);
626: else {
627: f=(FUNC)MALLOC(sizeof(struct oFUNC));
628: f->name = name;
629: MKNODE(tn,f,usrf); usrf = tn;
630: }
631: if ( Verbose && f->id != A_UNDEF )
632: fprintf(stderr,"Warning : %s() redefined.\n",name);
633: /* else
634: fprintf(stderr,"%s() defined.\n",name); */
635: t=(USRF)MALLOC(sizeof(struct oUSRF));
636: t->args=args; BDY(t)=body; t->pvs = CPVS; t->fname = fname;
637: t->startl = startl; t->endl = endl;
638: t->desc = desc; t->module = module;
639: f->id = A_USR; f->argc = argc; f->f.usrf = t;
640: CPVS = GPVS;
641: clearbp(f);
1.1 noro 642: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>