1
/* $Id: defs.h,v 1.22 2008/12/24 17:40:41 sgk Exp $ */
3
* Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
9
* Redistributions of source code and documentation must retain the above
10
* copyright notice, this list of conditions and the following disclaimer.
11
* Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditionsand the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
* All advertising materials mentioning features or use of this software
15
* must display the following acknowledgement:
16
* This product includes software developed or owned by Caldera
18
* Neither the name of Caldera International, Inc. nor the names of other
19
* contributors may be used to endorse or promote products derived from
20
* this software without specific prior written permission.
22
* USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23
* INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
* DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
27
* FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30
* HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
31
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
* POSSIBILITY OF SUCH DAMAGE.
42
#define MAXINCLUDES 10
43
#define MAXLITERALS 20
49
#define MAXLABLIST 100
51
typedef struct bigblock *bigptr;
52
typedef union chainedblock *chainp;
55
extern FILE *diagfile;
56
extern long int headoffset;
58
extern char token [ ];
63
extern struct labelblock *thislabel;
65
extern int mflag, tflag;
67
extern flag profileflag;
68
extern flag optimflag;
69
extern flag quietflag;
70
extern flag nowarnflag;
71
extern flag ftn66flag;
72
extern flag shiftcase;
73
extern flag undeftype;
74
extern flag shortsubs;
75
extern flag onetripflag;
76
extern flag checksubs;
77
extern flag debugflag;
83
extern flag headerdone;
87
extern int impltype[ ];
88
extern int implleng[ ];
89
extern int implstg[ ];
93
extern ftnint typesize[];
94
extern int typealign[];
97
extern char * procname;
98
extern int rtvlabel[ ];
99
extern int fudgelabel; /* to confuse the pdp11 optimizer */
100
extern struct bigblock *typeaddr;
101
extern struct bigblock *retslot;
105
extern int procclass;
106
extern ftnint procleng;
108
extern flag multitype;
110
extern int lastlabno;
111
extern int lastvarno;
112
extern int lastargslot;
114
extern ftnint autoleng;
115
extern ftnint bssleng;
117
extern int ret0label;
119
extern int regnum[ ];
120
extern bigptr regnamep[ ];
121
extern int maxregvar;
122
extern int highregvar;
124
extern chainp templist;
125
extern chainp holdtemps;
126
extern chainp entries;
127
extern chainp rpllist;
128
extern chainp curdtp;
129
extern ftnint curdtelt;
130
extern flag toomanyinit;
134
extern struct bigblock *ioblkp;
137
extern int nintnames;
138
extern int nextnames;
146
extern chainp chains;
151
unsigned dostepsign:8;
154
struct bigblock *donamep;
158
#define endlabel ctlabels[0]
159
#define elselabel ctlabels[1]
160
#define dobodylabel ctlabels[1]
161
#define doposlabel ctlabels[2]
162
#define doneglabel ctlabels[3]
163
extern struct ctlframe ctls[ ];
164
extern struct ctlframe *ctlstack;
165
extern struct ctlframe *lastctl;
178
extern struct extsym extsymtab[ ];
179
extern struct extsym *nextext;
180
extern struct extsym *lastext;
188
unsigned labdefined:1;
193
extern struct labelblock labeltab[ ];
194
extern struct labelblock *labtabend;
195
extern struct labelblock *highlabtab;
200
struct extsym *entryname;
209
struct bigblock *namep;
210
struct bigblock *argsp;
219
struct bigblock *varp;
221
extern struct hashentry hashtab[ ];
222
extern struct hashentry *lasthash;
224
struct intrpacked /* bits for intrinsic function description */
238
unsigned vprocclass:3;
242
chainp vstfdesc; /* points to (formals, expr) pair */
243
struct intrpacked intrdesc; /* bits for intrinsic function */
245
struct dimblock *vdim;
278
union constant fconst;
294
unsigned ntempelt:10;
319
struct impldoblock /* XXXX */
321
#define isactive vtype
322
#define isbusy vclass
323
struct bigblock *varnp;
324
struct bigblock *varvp;
334
struct rplblock /* name replacement block */
337
struct bigblock *rplnp;
339
struct bigblock *rplxp;
352
#define eqvleng eqvtop
354
extern struct equivblock eqvclass[ ];
367
struct entrypoint entrypoint;
368
struct rplblock rplblock;
369
struct eqvchain eqvchain;
380
struct exprblock _expr;
381
struct addrblock _addr;
382
struct constblock _const;
383
struct errorblock _error;
384
struct listblock _list;
385
struct primblock _prim;
386
struct nameblock _name;
387
struct paramblock _param;
388
struct impldoblock _impldo;
390
#define b_expr _u._expr
391
#define b_addr _u._addr
392
#define b_const _u._const
393
#define b_error _u._error
394
#define b_list _u._list
395
#define b_prim _u._prim
396
#define b_name _u._name
397
#define b_param _u._param
398
#define b_impldo _u._impldo
409
char litclen; /* small integer */
415
extern struct literal litpool[ ];
416
extern int nliterals;
422
/* popular functions with non integer return values */
423
#define expptr bigptr
424
#define tagptr bigptr
426
ptr cpblock(int ,void *);
429
char *varstr(int, char *), *nounder(int, char *), *varunder(int, char *);
430
char *copyn(int, char *), *copys(char *);
431
chainp hookup(chainp, chainp), mkchain(bigptr, chainp);
432
ftnint convci(int, char *), iarrlen(struct bigblock *q);
433
ftnint lmin(ftnint, ftnint), lmax(ftnint, ftnint);
434
ftnint simoffset(expptr *);
435
char *memname(int, int), *convic(ftnint), *setdoto(char *);
436
double convcd(int, char *);
437
struct extsym *mkext(char *),
438
*newentry(struct bigblock *),
439
*comblock(int, char *s);
440
struct bigblock *mkname(int, char *);
441
struct labelblock *mklabel(ftnint);
442
struct bigblock *addrof(expptr), *call1(int, char *, expptr),
443
*call2(int, char *, expptr, expptr),
444
*call3(int, char *, expptr, expptr, expptr),
445
*call4(int, char *, expptr, expptr, expptr, expptr);
446
struct bigblock *call0(int, char *), *mkexpr(int, bigptr, bigptr);
447
struct bigblock *callk(int, char *, bigptr);
449
struct bigblock *builtin(int, char *), *fmktemp(int, bigptr),
450
*mktmpn(int, int, bigptr), *nextdata(ftnint *, ftnint *),
451
*autovar(int, int, bigptr), *mklhs(struct bigblock *),
452
*mkaddr(struct bigblock *), *putconst(struct bigblock *),
453
*memversion(struct bigblock *);
454
struct bigblock *mkscalar(struct bigblock *np);
455
struct bigblock *realpart(struct bigblock *p);
456
struct bigblock *imagpart(struct bigblock *p);
458
struct bigblock *mkintcon(ftnint), *mkbitcon(int, int, char *),
459
*mklogcon(int), *mkaddcon(int), *mkrealcon(int, double),
460
*mkstrcon(int, char *), *mkcxcon(bigptr,bigptr);
461
bigptr mkconst(int t);
463
bigptr mklist(chainp p);
464
bigptr mkiodo(chainp, chainp);
467
bigptr mkconv(int, bigptr),
468
mkfunct(struct bigblock *), fixexpr(struct bigblock *),
472
bigptr cpexpr(bigptr), mkprim(bigptr, struct bigblock *, bigptr, bigptr);
473
struct bigblock *mkarg(int, int);
474
struct bigblock *errnode(void);
475
void initkey(void), prtail(void), puteof(void), done(int);
476
void fileinit(void), procinit(void), endproc(void), doext(void), preven(int);
477
int inilex(char *), yyparse(void), newlabel(void), lengtype(int, int);
478
void err(char *, ...), warn(char *, ...), fatal(char *, ...), enddcl(void);
479
void p2pass(char *s), frexpr(bigptr), execerr(char *, ...);
480
void setimpl(int, ftnint, int, int), setlog(void), newproc(void);
481
void prdbginfo(void), impldcl(struct bigblock *p);
482
void putbracket(void), enddcl(void), doequiv(void);
483
void puthead(char *), startproc(struct extsym *, int);
484
void dclerr(char *s, struct bigblock *v), putforce(int, bigptr);
485
void entrypt(int, int, ftnint, struct extsym *, chainp);
486
void settype(struct bigblock *, int, int), putlabel(int);
487
void putbranch(struct bigblock *p), goret(int), putrbrack(int);
488
void prolog(struct entrypoint *, struct bigblock *), prendproc(void);
489
void prlocvar(char *, ftnint), prext(char *, ftnint, int);
490
void vardcl(struct bigblock *v), frchain(chainp *p);
491
void frtemp(struct bigblock *p), incomm(struct extsym *, struct bigblock *);
492
void setintr(struct bigblock * v), setext(struct bigblock * v);
493
struct uux { expptr lb, ub; };
494
void setbound(struct bigblock *, int, struct uux []);
495
void setfmt(struct labelblock *lp), frdata(chainp), frrpl(void),
496
dataval(struct bigblock *, struct bigblock *),
497
consnegop(struct bigblock *p), exdo(int, chainp), exelse(void),
498
exendif(void), exif(bigptr), exelif(bigptr),
499
exequals(struct bigblock *, bigptr),
500
exassign(struct bigblock *, struct labelblock *),
501
exarif(bigptr, struct labelblock *, struct labelblock *,
502
struct labelblock *);
506
int intrfunct(char s[VL]), eqn(int, char *, char *);
507
int fmtstmt(struct labelblock *lp);
508
int cktype(int, int, int);
509
int yylex(void), inregister(struct bigblock *);
510
int inilex(char *), iocname(void);
511
int maxtype(int, int), flog2(ftnint), hextoi(int);
512
int cmpstr(char *, char *, ftnint, ftnint);
513
int enregister(struct bigblock *np);
514
int conssgn(bigptr p);
515
int fixargs(int, struct bigblock *);
516
int addressable(bigptr p);
519
void prconi(FILE *, int, ftnint);
521
void prconr(FILE *, int, double);
522
void prarif(bigptr, int, int, int);
523
void putstr(char *, ftnint);
524
NODE *putex1(bigptr p);
525
void puteq(bigptr, bigptr);
526
void popstack(chainp *p);
527
void consconv(int, union constant *, int, union constant *);
528
void yyerror(char *s);
530
void doinclude(char *);
532
void startioctl(void);
533
void endioctl(void), endio(void), ioclause(int, bigptr), doio(chainp);
534
void excall(struct bigblock *, struct bigblock *, int, struct labelblock *[]);
535
void exreturn(expptr p);
536
void exstop(int, expptr);
537
void exgoto(struct labelblock *);
538
void exasgoto(bigptr);
539
void putcmgo(expptr, int, struct labelblock *[]);
540
void putexpr(expptr p);
541
void putif(expptr, int);
543
void deregister(struct bigblock *np);
544
NODE *putx(expptr p);
545
void cpn(int, char *, char *);
546
void prcmgoto(expptr, int, int, int);
547
char *lexline(ftnint *n);
548
bigptr suboffset(struct bigblock *p);
549
struct bigblock *intraddr(struct bigblock *np);
550
struct bigblock *intrcall(bigptr, bigptr, int);
552
void prnloc(char *name);
553
void fprint(bigptr p, int indx);
554
void ckfree(void *p);