Doxygen Source Code Documentation
misc.c File Reference
#include "defs.h"
#include "limits.h"
Go to the source code of this file.
Functions | |
int | oneof_stg (Namep name, int stg, int mask) |
int | op_assign (int opcode) |
char * | Alloc (int n) |
void | cpn (register int n, register char *a, register char *b) |
int | eqn (register int n, register char *a, register char *b) |
int | cmpstr (register char *a, register char *b, ftnint la, ftnint lb) |
chainp | hookup (register chainp x, register chainp y) |
Listblock * | mklist (chainp p) |
chainp | mkchain (register char *p, register chainp q) |
chainp | revchain (register chainp next) |
char * | addunder (register char *s) |
char * | copyn (register int n, register char *s) |
char * | copys (char *s) |
ftnint | convci (register int n, register char *s) |
char * | convic (ftnint n) |
Namep | mkname (register char *s) |
Labelblock * | mklabel (ftnint l) |
long | newlabel (Void) |
Labelblock * | execlab (ftnint stateno) |
Extsym * | mkext1 (char *f, char *s) |
Extsym * | mkext (char *f, char *s) |
Addrp | builtin (int t, char *s, int dbi) |
void | add_extern_to_list (Addrp addr, chainp *list_store) |
void | frchain (register chainp *p) |
void | frexchain (register chainp *p) |
tagptr | cpblock (register int n, register char *p) |
ftnint | lmax (ftnint a, ftnint b) |
ftnint | lmin (ftnint a, ftnint b) |
maxtype (int t1, int t2) | |
int | log_2 (ftnint n) |
void | frrpl (Void) |
expptr | callk (int type, char *name, chainp args) |
expptr | call4 (int type, char *name, expptr arg1, expptr arg2, expptr arg3, expptr arg4) |
expptr | call3 (int type, char *name, expptr arg1, expptr arg2, expptr arg3) |
expptr | call2 (int type, char *name, expptr arg1, expptr arg2) |
expptr | call1 (int type, char *name, expptr arg) |
expptr | call0 (int type, char *name) |
Impldoblock * | mkiodo (chainp dospec, chainp list) |
ptr | ckalloc (register int n) |
int | isaddr (register expptr p) |
int | isstatic (register expptr p) |
int | addressable (register expptr p) |
int | isnegative_const (struct Constblock *cp) |
void | negate_const (Constp cp) |
void | ffilecopy (FILE *infp, FILE *outfp) |
int | in_vector (char *str, char **keywds, register int n) |
int | is_negatable (Constp Const) |
void | backup (char *fname, char *bname) |
int | struct_eq (chainp s1, chainp s2) |
Variables | |
int | callk_kludge |
Function Documentation
|
Definition at line 643 of file misc.c. References CHNULL, cpexpr(), mkchain(), Chain::nextp, TADDR, and UNAM_EXTERN. Referenced by builtin().
00645 { 00646 chainp last = CHNULL; 00647 chainp list; 00648 int memno; 00649 00650 if (list_store == (chainp *) NULL || addr == (Addrp) NULL) 00651 return; 00652 00653 list = *list_store; 00654 memno = addr -> memno; 00655 00656 for (;list; last = list, list = list -> nextp) { 00657 Addrp thisAddr = (Addrp) (list -> datap); 00658 00659 if (thisAddr -> tag == TADDR && thisAddr -> uname_tag == UNAM_EXTERN && 00660 thisAddr -> memno == memno) 00661 return; 00662 } /* for */ 00663 00664 if (*list_store == CHNULL) 00665 *list_store = mkchain((char *)cpexpr((expptr)addr), CHNULL); 00666 else 00667 last->nextp = mkchain((char *)cpexpr((expptr)addr), CHNULL); 00668 00669 } /* add_extern_to_list */ |
|
Definition at line 1047 of file misc.c. References TADDR, Listblock::tag, and TCONST. Referenced by exarif(), Inline(), putcx1(), and putmnmx().
01049 { 01050 switch(p->tag) 01051 { 01052 case TCONST: 01053 return(YES); 01054 01055 case TADDR: 01056 return( addressable(p->addrblock.memoffset) ); 01057 01058 default: 01059 return(NO); 01060 } 01061 } |
|
Definition at line 285 of file misc.c. Referenced by dobss(), mkaddr(), mkfunct(), and newentry().
|
|
Definition at line 85 of file misc.c. References Fatal(), and malloc.
|
|
Definition at line 1266 of file misc.c. References ffilecopy(), and warn1(). Referenced by list_init_data().
01268 { 01269 FILE *b, *f; 01270 static char couldnt[] = "Couldn't open %.80s"; 01271 01272 if (!(f = fopen(fname, binread))) { 01273 warn1(couldnt, fname); 01274 return; 01275 } 01276 if (!(b = fopen(bname, binwrite))) { 01277 warn1(couldnt, bname); 01278 return; 01279 } 01280 ffilecopy(f, b); 01281 fclose(f); 01282 fclose(b); 01283 } |
|
Definition at line 600 of file misc.c. References add_extern_to_list(), ALLOC, CLPROC, Addrblock::dbl_builtin, errstr(), Extsym::extstg, Addrblock::memno, mkext(), STGEXT, STGUNKNOWN, TADDR, Addrblock::tag, UNAM_EXTERN, used_builtins, Addrblock::vclass, Addrblock::vstg, and Addrblock::vtype. Referenced by callk(), intraddr(), intrcall(), mkfunct(), and NI_do().
00602 { 00603 register Extsym *p; 00604 register Addrp q; 00605 extern chainp used_builtins; 00606 00607 p = mkext(s,s); 00608 if(p->extstg == STGUNKNOWN) 00609 p->extstg = STGEXT; 00610 else if(p->extstg != STGEXT) 00611 { 00612 errstr("improper use of builtin %s", s); 00613 return(0); 00614 } 00615 00616 q = ALLOC(Addrblock); 00617 q->tag = TADDR; 00618 q->vtype = t; 00619 q->vclass = CLPROC; 00620 q->vstg = STGEXT; 00621 q->memno = p - extsymtab; 00622 q->dbl_builtin = dbi; 00623 00624 /* A NULL pointer here tells you to use memno to check the external 00625 symbol table */ 00626 00627 q -> uname_tag = UNAM_EXTERN; 00628 00629 /* Add to the list of used builtins */ 00630 00631 if (dbi >= 0) 00632 add_extern_to_list (q, &used_builtins); 00633 return(q); 00634 } |
|
Definition at line 926 of file misc.c. References callk(), CHNULL, and name. Referenced by doio().
|
|
Definition at line 913 of file misc.c. References callk(), CHNULL, mkchain(), mklist(), and name. Referenced by dofclose(), dofinquire(), dofmove(), dofopen(), exstop(), and startrw().
|
|
Definition at line 894 of file misc.c. References callk(), CHNULL, mkchain(), mklist(), and name. Referenced by fixexpr(), mkpower(), putchcmp(), putcheq(), and putio().
|
|
Definition at line 872 of file misc.c. References callk(), CHNULL, mkchain(), mklist(), and name. Referenced by putio().
|
|
Definition at line 849 of file misc.c. References callk(), CHNULL, mkchain(), mklist(), and name. Referenced by putcat(), putio(), and subcheck().
|
|
Definition at line 825 of file misc.c. References builtin(), callk_kludge, Expression::exprblock, mkexpr(), name, OPCALL, and Exprblock::vtype. Referenced by call0(), call1(), call2(), call3(), and call4().
|
|
Definition at line 963 of file misc.c. References calloc, and Fatal(). Referenced by argsort(), consconv(), count_args(), cpblock(), fileinit(), fold(), initkey(), main(), mkstrcon(), putentries(), and set_tmp_names().
|
|
Definition at line 145 of file misc.c. References a. Referenced by fold().
00148 { 00149 register char *aend, *bend; 00150 aend = a + la; 00151 bend = b + lb; 00152 00153 00154 if(la <= lb) 00155 { 00156 while(a < aend) 00157 if(*a != *b) 00158 return( *a - *b ); 00159 else 00160 { 00161 ++a; 00162 ++b; 00163 } 00164 00165 while(b < bend) 00166 if(*b != ' ') 00167 return(' ' - *b); 00168 else 00169 ++b; 00170 } 00171 00172 else 00173 { 00174 while(b < bend) 00175 if(*a != *b) 00176 return( *a - *b ); 00177 else 00178 { 00179 ++a; 00180 ++b; 00181 } 00182 while(a < aend) 00183 if(*a != ' ') 00184 return(*a - ' '); 00185 else 00186 ++a; 00187 } 00188 return(0); 00189 } |
|
Definition at line 352 of file misc.c. Referenced by yyparse().
00354 { 00355 ftnint sum, t; 00356 char buff[100], *s0; 00357 int n0; 00358 00359 s0 = s; 00360 n0 = n; 00361 sum = 0; 00362 while(n-- > 0) { 00363 /* sum = 10*sum + (*s++ - '0'); */ 00364 t = *s++ - '0'; 00365 if (sum > LONG_MAX/10) { 00366 ovfl: 00367 if (n0 > 60) 00368 n0 = 60; 00369 sprintf(buff, "integer constant %.*s truncated.", 00370 n0, s0); 00371 err(buff); 00372 return LONG_MAX; 00373 } 00374 sum *= 10; 00375 if (sum > LONG_MAX - t) 00376 goto ovfl; 00377 sum += t; 00378 } 00379 return(sum); 00380 } |
|
Definition at line 389 of file misc.c. Referenced by endproc(), execlab(), exstop(), and yyparse().
00391 { 00392 static char s[20]; 00393 register char *t; 00394 00395 s[19] = '\0'; 00396 t = s+19; 00397 00398 do { 00399 *--t = '0' + n%10; 00400 n /= 10; 00401 } while(n > 0); 00402 00403 return(t); 00404 } |
|
Definition at line 315 of file misc.c. References Alloc. Referenced by copys(), cpexpr(), doinclude(), exstop(), and yyparse().
|
|
Definition at line 335 of file misc.c. References copyn(). Referenced by c_name(), main(), and putconst().
00337 { 00338 return( copyn( strlen(s)+1 , s) ); 00339 } |
|
Definition at line 721 of file misc.c. References ckalloc(). Referenced by cpexpr().
|
|
Definition at line 108 of file misc.c. References a. Referenced by copy_data().
00110 { 00111 while(--n >= 0) 00112 *b++ = *a++; 00113 } |
|
Definition at line 123 of file misc.c. References a. Referenced by AFNI_setenv(), gettok(), main(), and PBAR_define_bigmap().
00125 { 00126 while(--n >= 0) 00127 if(*a++ != *b++) 00128 return(NO); 00129 return(YES); 00130 } |
|
Definition at line 519 of file misc.c. References Labelblock::blklevel, convic(), err, execerr(), Labelblock::labdefined, LABEXEC, LABFORMAT, Labelblock::labinacc, Labelblock::labtype, mklabel(), NO, and warn1(). Referenced by endio(), endioctl(), putiocall(), and yyparse().
00521 { 00522 register struct Labelblock *lp; 00523 00524 if(lp = mklabel(stateno)) 00525 { 00526 if(lp->labinacc) 00527 warn1("illegal branch to inner block, statement label %s", 00528 convic(stateno) ); 00529 else if(lp->labdefined == NO) 00530 lp->blklevel = blklevel; 00531 if(lp->labtype == LABFORMAT) 00532 err("may not branch to a format"); 00533 else 00534 lp->labtype = LABEXEC; 00535 } 00536 else 00537 execerr("illegal label %s", convic(stateno)); 00538 00539 return(lp); 00540 } |
|
Definition at line 1172 of file misc.c. References c. Referenced by backup(), main(), and start_formatting().
|
|
Definition at line 677 of file misc.c. References Chain::nextp. Referenced by argsort(), atype_squawk(), do_p1_head(), doiolist(), enddcl(), exdo(), frdata(), frexpr(), hashclear(), intrcall(), length_comp(), mkprim(), out_call(), p1_expr(), pop_datastack(), procinit(), prolog(), putentries(), putmnmx(), stfcall(), wr_equiv_init(), wr_one_init(), yyparse(), and zap_changes().
|
|
Definition at line 697 of file misc.c. References Chain::datap, frexpr(), Chain::nextp, and r. Referenced by procinit().
|
|
Definition at line 800 of file misc.c. References charptr, free, and Rplblock::rplnextp. Referenced by yyparse().
|
|
Definition at line 200 of file misc.c. References Chain::nextp, and p. Referenced by putcall(), and yyparse().
|
|
Definition at line 1195 of file misc.c. References n1. Referenced by mkname().
01197 { 01198 register char **K = keywds; 01199 register int n1, t; 01200 01201 do { 01202 n1 = n >> 1; 01203 if (!(t = strcmp(str, K[n1]))) 01204 return K - keywds + n1; 01205 if (t < 0) 01206 n = n1; 01207 else { 01208 n -= ++n1; 01209 K += n1; 01210 } 01211 } 01212 while(n > 0); 01213 01214 return -1; 01215 } /* in_vector */ |
|
Definition at line 1223 of file misc.c. References BIGGEST_CHAR, BIGGEST_LONG, BIGGEST_SHORT, retval(), and TYQUAD. Referenced by mkexpr(), and output_binary().
01225 { 01226 int retval = 0; 01227 if (Const != (Constp) NULL) 01228 switch (Const -> vtype) { 01229 case TYINT1: 01230 retval = Const -> Const.ci >= -BIGGEST_CHAR; 01231 break; 01232 case TYSHORT: 01233 retval = Const -> Const.ci >= -BIGGEST_SHORT; 01234 break; 01235 case TYLONG: 01236 #ifdef TYQUAD 01237 case TYQUAD: 01238 #endif 01239 retval = Const -> Const.ci >= -BIGGEST_LONG; 01240 break; 01241 case TYREAL: 01242 case TYDREAL: 01243 case TYCOMPLEX: 01244 case TYDCOMPLEX: 01245 retval = 1; 01246 break; 01247 case TYLOGICAL1: 01248 case TYLOGICAL2: 01249 case TYLOGICAL: 01250 case TYCHAR: 01251 case TYSUBR: 01252 default: 01253 retval = 0; 01254 break; 01255 } /* switch */ 01256 01257 return retval; 01258 } /* is_negatable */ |
|
Definition at line 981 of file misc.c. References OPASSIGN, OPASSIGNI, OPBITANDEQ, OPBITOREQ, OPBITXOREQ, OPCOMMA, OPLSHIFTEQ, OPMINUSEQ, OPMODEQ, OPPLUSEQ, OPRSHIFTEQ, OPSLASHEQ, TADDR, Listblock::tag, and TEXPR.
00983 { 00984 if(p->tag == TADDR) 00985 return(YES); 00986 if(p->tag == TEXPR) 00987 switch(p->exprblock.opcode) 00988 { 00989 case OPCOMMA: 00990 return( isaddr(p->exprblock.rightp) ); 00991 00992 case OPASSIGN: 00993 case OPASSIGNI: 00994 case OPPLUSEQ: 00995 case OPMINUSEQ: 00996 case OPSLASHEQ: 00997 case OPMODEQ: 00998 case OPLSHIFTEQ: 00999 case OPRSHIFTEQ: 01000 case OPBITANDEQ: 01001 case OPBITXOREQ: 01002 case OPBITOREQ: 01003 return( isaddr(p->exprblock.leftp) ); 01004 } 01005 return(NO); 01006 } |
|
Definition at line 1072 of file misc.c. References Constant::cd, Constant::cds, Constblock::Const, retval(), TYQUAD, and Constblock::vstg. Referenced by output_binary().
01074 { 01075 int retval; 01076 01077 if (cp == NULL) 01078 return 0; 01079 01080 switch (cp -> vtype) { 01081 case TYINT1: 01082 case TYSHORT: 01083 case TYLONG: 01084 #ifdef TYQUAD 01085 case TYQUAD: 01086 #endif 01087 retval = cp -> Const.ci < 0; 01088 break; 01089 case TYREAL: 01090 case TYDREAL: 01091 retval = cp->vstg ? *cp->Const.cds[0] == '-' 01092 : cp->Const.cd[0] < 0.0; 01093 break; 01094 default: 01095 01096 retval = 0; 01097 break; 01098 } /* switch */ 01099 01100 return retval; 01101 } /* isnegative_const */ |
|
Definition at line 1015 of file misc.c. References ISCONST, MSKSTATIC, ONEOF, TADDR, Listblock::tag, TCONST, and useauto. Referenced by startrw().
01017 { 01018 extern int useauto; 01019 if(p->headblock.vleng && !ISCONST(p->headblock.vleng)) 01020 return(NO); 01021 01022 switch(p->tag) 01023 { 01024 case TCONST: 01025 return(YES); 01026 01027 case TADDR: 01028 if(ONEOF(p->addrblock.vstg,MSKSTATIC) && 01029 ISCONST(p->addrblock.memoffset) && !useauto) 01030 return(YES); 01031 01032 default: 01033 return(NO); 01034 } 01035 } |
|
Definition at line 738 of file misc.c. References a. Referenced by doequiv(), eqveqv(), main(), SUMA_Find_IminImax(), and SUMA_Find_IminImax_Avg().
|
|
Definition at line 750 of file misc.c. References a. Referenced by doequiv(), eqveqv(), SUMA_Find_IminImax(), and SUMA_Find_IminImax_Avg().
|
|
Definition at line 783 of file misc.c. Referenced by putx().
00785 { 00786 int k; 00787 00788 /* trick based on binary representation */ 00789 00790 if(n<=0 || (n & (n-1))!=0) 00791 return(-1); 00792 00793 for(k = 0 ; n >>= 1 ; ++k) 00794 ; 00795 return(k); 00796 } |
|
Definition at line 764 of file misc.c. Referenced by cast_args(), cktype(), fold(), intrcall(), and mkpower().
00766 { 00767 int t; 00768 00769 t = t1 >= t2 ? t1 : t2; 00770 if(t==TYCOMPLEX && (t1==TYDREAL || t2==TYDREAL) ) 00771 t = TYDCOMPLEX; 00772 return(t); 00773 } |
|
Definition at line 239 of file misc.c. References ALLOC, Chain::datap, Chain::nextp, and r. Referenced by add_extern_to_list(), argsort(), call1(), call2(), call3(), call4(), cpexpr(), data_value(), declare_new_addr(), do_init_data(), do_p1_list(), docommon(), doentry(), doequiv(), exassign(), fmtname(), frtemp(), I_args(), incomm(), intrcall(), length_comp(), mkfunct(), mkstfunct(), p1_label(), pad_common(), putcall(), subskept(), typekludge(), wr_equiv_init(), and yyparse().
|
|
Definition at line 584 of file misc.c. References errstr(), Extsym::extstg, mkext1(), and STGCOMMON. Referenced by builtin(), dobss(), mkaddr(), mkfunct(), and newentry().
|
|
Definition at line 551 of file misc.c. References Extsym::cextname, gmem(), many(), and STGUNKNOWN. Referenced by comblock(), comlen(), mkext(), and Pfile().
00553 { 00554 Extsym *p; 00555 00556 for(p = extsymtab ; p<nextext ; ++p) 00557 if(!strcmp(s,p->cextname)) 00558 return( p ); 00559 00560 if(nextext >= lastext) 00561 many("external symbols", 'x', maxext); 00562 00563 nextext->fextname = strcpy(gmem(strlen(f)+1,0), f); 00564 nextext->cextname = f == s 00565 ? nextext->fextname 00566 : strcpy(gmem(strlen(s)+1,0), s); 00567 nextext->extstg = STGUNKNOWN; 00568 nextext->extp = 0; 00569 nextext->allextp = 0; 00570 nextext->extleng = 0; 00571 nextext->maxleng = 0; 00572 nextext->extinit = 0; 00573 nextext->curno = nextext->maxno = 0; 00574 return( nextext++ ); 00575 } |
|
Definition at line 940 of file misc.c. References ALLOC, Impldoblock::datalist, Impldoblock::impdospec, Impldoblock::tag, and TIMPLDO. Referenced by yyparse().
00942 { 00943 register struct Impldoblock *q; 00944 00945 q = ALLOC(Impldoblock); 00946 q->tag = TIMPLDO; 00947 q->impdospec = dospec; 00948 q->datalist = list; 00949 return(q); 00950 } |
|
Definition at line 478 of file misc.c. References Labelblock::blklevel, Labelblock::fmtlabused, Labelblock::fmtstring, Labelblock::labdefined, Labelblock::labelno, Labelblock::labinacc, Labelblock::labtype, LABUNKNOWN, Labelblock::labused, many(), newlabel(), NO, and Labelblock::stateno. Referenced by execlab(), newiolabel(), startrw(), and yyparse().
00480 { 00481 register struct Labelblock *lp; 00482 00483 if(l <= 0) 00484 return(NULL); 00485 00486 for(lp = labeltab ; lp < highlabtab ; ++lp) 00487 if(lp->stateno == l) 00488 return(lp); 00489 00490 if(++highlabtab > labtabend) 00491 many("statement labels", 's', maxstno); 00492 00493 lp->stateno = l; 00494 lp->labelno = (int)newlabel(); 00495 lp->blklevel = 0; 00496 lp->labused = NO; 00497 lp->fmtlabused = NO; 00498 lp->labdefined = NO; 00499 lp->labinacc = NO; 00500 lp->labtype = LABUNKNOWN; 00501 lp->fmtstring = 0; 00502 return(lp); 00503 } |
|
Definition at line 221 of file misc.c. References ALLOC, Listblock::listp, Listblock::tag, and TLIST. Referenced by call1(), call2(), call3(), call4(), putcall(), and yyparse().
|
|
Definition at line 416 of file misc.c. References ALLOC, c, errext(), Hashentry::hashval, i, in_vector(), many(), mem(), TNAME, and Hashentry::varp. Referenced by doentry(), entrypt(), startproc(), and yyparse().
00418 { 00419 struct Hashentry *hp; 00420 register Namep q; 00421 register int c, hash, i; 00422 register char *t; 00423 char *s0; 00424 char errbuf[64]; 00425 00426 hash = i = 0; 00427 s0 = s; 00428 while(c = *s++) { 00429 hash += c; 00430 if (c == '_') 00431 i = 2; 00432 } 00433 if (!i && in_vector(s0,c_keywords,n_keywords) >= 0) 00434 i = 2; 00435 hash %= maxhash; 00436 00437 /* Add the name to the closed hash table */ 00438 00439 hp = hashtab + hash; 00440 00441 while(q = hp->varp) 00442 if( hash == hp->hashval && !strcmp(s0,q->fvarname) ) 00443 return(q); 00444 else if(++hp >= lasthash) 00445 hp = hashtab; 00446 00447 if(++nintnames >= maxhash-1) 00448 many("names", 'n', maxhash); /* Fatal error */ 00449 hp->varp = q = ALLOC(Nameblock); 00450 hp->hashval = hash; 00451 q->tag = TNAME; /* TNAME means the tag type is NAME */ 00452 c = s - s0; 00453 if (c > 7 && noextflag) { 00454 sprintf(errbuf, "\"%.35s%s\" over 6 characters long", s0, 00455 c > 36 ? "..." : ""); 00456 errext(errbuf); 00457 } 00458 q->fvarname = strcpy(mem(c,0), s0); 00459 t = q->cvarname = mem(c + i + 1, 0); 00460 s = s0; 00461 /* add __ to the end of any name containing _ and to any C keyword */ 00462 while(*t = *s++) 00463 t++; 00464 if (i) { 00465 do *t++ = '_'; 00466 while(--i > 0); 00467 *t = 0; 00468 } 00469 return(q); 00470 } |
|
Definition at line 1108 of file misc.c. References Constant::cd, Constant::cds, Constblock::Const, erri(), TYQUAD, and Constblock::vstg. Referenced by output_binary().
01110 { 01111 if (cp == (struct Constblock *) NULL) 01112 return; 01113 01114 switch (cp -> vtype) { 01115 case TYINT1: 01116 case TYSHORT: 01117 case TYLONG: 01118 #ifdef TYQUAD 01119 case TYQUAD: 01120 #endif 01121 cp -> Const.ci = - cp -> Const.ci; 01122 break; 01123 case TYCOMPLEX: 01124 case TYDCOMPLEX: 01125 if (cp->vstg) 01126 switch(*cp->Const.cds[1]) { 01127 case '-': 01128 ++cp->Const.cds[1]; 01129 break; 01130 case '0': 01131 break; 01132 default: 01133 --cp->Const.cds[1]; 01134 } 01135 else 01136 cp->Const.cd[1] = -cp->Const.cd[1]; 01137 /* no break */ 01138 case TYREAL: 01139 case TYDREAL: 01140 if (cp->vstg) 01141 switch(*cp->Const.cds[0]) { 01142 case '-': 01143 ++cp->Const.cds[0]; 01144 break; 01145 case '0': 01146 break; 01147 default: 01148 --cp->Const.cds[0]; 01149 } 01150 else 01151 cp->Const.cd[0] = -cp->Const.cd[0]; 01152 break; 01153 case TYCHAR: 01154 case TYLOGICAL1: 01155 case TYLOGICAL2: 01156 case TYLOGICAL: 01157 erri ("negate_const: can't negate type '%d'", cp -> vtype); 01158 break; 01159 default: 01160 erri ("negate_const: bad type '%d'", 01161 cp -> vtype); 01162 break; 01163 } /* switch */ 01164 } /* negate_const */ |
|
Definition at line 506 of file misc.c. Referenced by doentry(), doiolist(), fmtstmt(), mklabel(), and putconst().
00507 {
00508 return ++lastlabno;
00509 }
|
|
Definition at line 34 of file misc.c. References M, name, ONEOF, STGCOMMON, and STGEQUIV. Referenced by out_addr(), out_call(), and p1_addr().
00036 { 00037 if (stg == STGCOMMON && name) { 00038 if ((mask & M(STGEQUIV))) 00039 return name->vcommequiv; 00040 if ((mask & M(STGCOMMON))) 00041 return !name->vcommequiv; 00042 } 00043 return ONEOF(stg, mask); 00044 } |
|
Definition at line 55 of file misc.c. References erri(), OPBITAND, OPBITANDEQ, OPBITOR, OPBITOREQ, OPBITXOR, OPBITXOREQ, OPLSHIFT, OPLSHIFTEQ, OPMINUS, OPMINUSEQ, OPMOD, OPMODEQ, OPPLUS, OPPLUSEQ, OPRSHIFT, OPRSHIFTEQ, OPSLASH, OPSLASHEQ, OPSTAR, OPSTAREQ, and retval(). Referenced by expr_out().
00057 { 00058 int retval = -1; 00059 00060 switch (opcode) { 00061 case OPPLUS: retval = OPPLUSEQ; break; 00062 case OPMINUS: retval = OPMINUSEQ; break; 00063 case OPSTAR: retval = OPSTAREQ; break; 00064 case OPSLASH: retval = OPSLASHEQ; break; 00065 case OPMOD: retval = OPMODEQ; break; 00066 case OPLSHIFT: retval = OPLSHIFTEQ; break; 00067 case OPRSHIFT: retval = OPRSHIFTEQ; break; 00068 case OPBITAND: retval = OPBITANDEQ; break; 00069 case OPBITXOR: retval = OPBITXOREQ; break; 00070 case OPBITOR: retval = OPBITOREQ; break; 00071 default: 00072 erri ("op_assign: bad opcode '%d'", opcode); 00073 break; 00074 } /* switch */ 00075 00076 return retval; 00077 } /* op_assign */ |
|
Definition at line 262 of file misc.c. References Chain::nextp. Referenced by docommon(), enddcl(), entrypt(), fix_entry_returns(), I_args(), length_comp(), putcall(), wr_common_decls(), wr_equiv_init(), wr_one_init(), write_assigned_fmts(), write_char_init(), write_ioblocks(), and yyparse().
|
|
Definition at line 1295 of file misc.c. References CHNULL, Nameblock::fvarname, Dimblock::nelt, Chain::nextp, NO, TCONST, TNAME, v1, Nameblock::vclass, Nameblock::vdim, Nameblock::vtype, and YES. Referenced by docommon().
01297 { 01298 struct Dimblock *d1, *d2; 01299 Constp cp1, cp2; 01300 01301 if (s1 == CHNULL && s2 == CHNULL) 01302 return YES; 01303 for(; s1 && s2; s1 = s1->nextp, s2 = s2->nextp) { 01304 register Namep v1 = (Namep) s1 -> datap; 01305 register Namep v2 = (Namep) s2 -> datap; 01306 01307 if (v1 == (Namep) NULL || v1 -> tag != TNAME || 01308 v2 == (Namep) NULL || v2 -> tag != TNAME) 01309 return NO; 01310 01311 if (v1->vtype != v2->vtype || v1->vclass != v2->vclass 01312 || strcmp(v1->fvarname, v2->fvarname)) 01313 return NO; 01314 01315 /* compare dimensions (needed for comparing COMMON blocks) */ 01316 01317 if (d1 = v1->vdim) { 01318 if (!(cp1 = (Constp)d1->nelt) || cp1->tag != TCONST 01319 || !(d2 = v2->vdim) 01320 || !(cp2 = (Constp)d2->nelt) || cp2->tag != TCONST 01321 || cp1->Const.ci != cp2->Const.ci) 01322 return NO; 01323 } 01324 else if (v2->vdim) 01325 return NO; 01326 } /* while s1 != CHNULL && s2 != CHNULL */ 01327 01328 return s1 == CHNULL && s2 == CHNULL; 01329 } /* struct_eq */ |
Variable Documentation
|
|