#include "defs.h"Include dependency graph for pread.c:

Go to the source code of this file.
Defines | |
| #define | P_space 1 |
| #define | P_anum 2 |
| #define | P_delim 3 |
| #define | P_slash 4 |
| #define | TGULP 100 |
| #define | checklogical(n) |
Functions | |
| static void | trealloc (Void) |
| static void | badchar (int c) |
| static void | bad_type (Void) |
| static void | badflag (char *tname, char *option) |
| static void | detected (char *msg) |
| static void | checkreal (int k) |
| static void | Pnotboth (Extsym *e) |
| static int | numread (register FILE *pf, int *n) |
| static void argverify | Argdcl ((int, Extsym *)) |
| static void Pbadret | Argdcl ((int ftype, Extsym *p)) |
| static int | readref (register FILE *pf, Extsym *e, int ftype) |
| static int | comlen (register FILE *pf) |
| static int | Ptoken (FILE *pf, int canend) |
| static int | Pftype (Void) |
| static void | wanted (int i, char *what) |
| static int | Ptype (FILE *pf) |
| static char * | trimunder (Void) |
| static void | Pbadmsg (char *msg, Extsym *p) |
| static void | Pbadret (int ftype, Extsym *p) |
| static void | argverify (int ftype, Extsym *p) |
| static void | newarg (int ftype, Extsym *p) |
| static int | Pfile (char *fname) |
| void | read_Pfiles (char **ffiles) |
Variables | |
| static char | Ptok [128] |
| static char | Pct [Table_size] |
| static char * | Pfname |
| static long | Plineno |
| static int | Pbad |
| static int * | tfirst |
| static int * | tlast |
| static int * | tnext |
| static int | tmax |
| #define checklogical | ( | n | ) |
| #define P_anum 2 |
| #define TGULP 100 |
Definition at line 755 of file pread.c.
References Argtype(), Argtypes::atypes, Argtypes::changes, j, Argtypes::nargs, p, Pbadmsg(), Pbadret(), t, tfirst, tnext, Atype::type, type_fixup(), TYSUBR, and TYUNKNOWN.
Referenced by Pfile().
00757 { 00758 Argtypes *at; 00759 register Atype *aty; 00760 int i, j, k; 00761 register int *t, *te; 00762 char buf1[32], buf2[32]; 00763 00764 at = p->arginfo; 00765 if (at->nargs < 0) 00766 return; 00767 if (p->extype != ftype) { 00768 Pbadret(ftype, p); 00769 return; 00770 } 00771 t = tfirst; 00772 te = tnext; 00773 i = te - t; 00774 if (at->nargs != i) { 00775 j = at->nargs; 00776 Pbadmsg("differing numbers of arguments",p); 00777 fprintf(stderr, "here %d, previously %d\n", 00778 i, j); 00779 return; 00780 } 00781 for(aty = at->atypes; t < te; t++, aty++) { 00782 if (*t == aty->type) 00783 continue; 00784 j = aty->type; 00785 k = *t; 00786 if (k >= 300 || k == j) 00787 continue; 00788 if (j >= 300) { 00789 if (k >= 200) { 00790 if (k == TYUNKNOWN + 200) 00791 continue; 00792 if (j % 100 != k - 200 00793 && k != TYSUBR + 200 00794 && j != TYUNKNOWN + 300 00795 && !type_fixup(at,aty,k)) 00796 goto badtypes; 00797 } 00798 else if (j % 100 % TYSUBR != k % TYSUBR 00799 && !type_fixup(at,aty,k)) 00800 goto badtypes; 00801 } 00802 else if (k < 200 || j < 200) 00803 goto badtypes; 00804 else if (k == TYUNKNOWN+200) 00805 continue; 00806 else if (j != TYUNKNOWN+200) 00807 { 00808 badtypes: 00809 Pbadmsg("differing calling sequences",p); 00810 i = t - tfirst + 1; 00811 fprintf(stderr, 00812 "arg %d: here %s, prevously %s\n", 00813 i, Argtype(k,buf1), Argtype(j,buf2)); 00814 return; 00815 } 00816 /* We've subsequently learned the right type, 00817 as in the call on zoo below... 00818 00819 subroutine foo(x, zap) 00820 external zap 00821 call goo(zap) 00822 x = zap(3) 00823 call zoo(zap) 00824 end 00825 */ 00826 aty->type = k; 00827 at->changes = 1; 00828 } 00829 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void bad_type | ( | Void | ) | [static] |
| static void badchar | ( | int | c | ) | [static] |
Definition at line 59 of file pread.c.
References Pfname, and Plineno.
Referenced by Pfile(), Ptoken(), and Ptype().
00061 { 00062 fprintf(stderr, 00063 "unexpected character 0x%.2x = '%c' on line %ld of %s\n", 00064 c, c, Plineno, Pfname); 00065 exit(2); 00066 }
Here is the caller graph for this function:

| static void badflag | ( | char * | tname, | |
| char * | option | |||
| ) | [static] |
| static void checkreal | ( | int | k | ) | [static] |
Definition at line 151 of file pread.c.
References badflag(), detected(), and forcedouble.
Referenced by Pftype().
00153 { 00154 static int warned = 0; 00155 static int seen[2] = {0,0}; 00156 00157 seen[k] = 1; 00158 if (seen[1-k]) { 00159 if (warned < 2) 00160 detected("Illegal mixture of -R and -!R "); 00161 warned = 2; 00162 return; 00163 } 00164 if (k == forcedouble || warned) 00165 return; 00166 warned = 1; 00167 badflag("REAL return", (char*)(k ? "!R" : "R")); 00168 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int comlen | ( | register FILE * | pf | ) | [static] |
Definition at line 297 of file pread.c.
References buf, Extsym::extstg, L, Extsym::maxleng, mkext1(), P_anum, Pct, Pfname, Plineno, Pnotboth(), readref(), s, STGCOMMON, STGUNKNOWN, and ungetc().
Referenced by Ptoken().
00299 { 00300 register int c; 00301 register char *s, *se; 00302 char buf[128], cbuf[128]; 00303 int refread; 00304 long L; 00305 Extsym *e; 00306 00307 if ((c = getc(pf)) == EOF) 00308 return 1; 00309 if (c == ' ') { 00310 refread = 0; 00311 s = "comlen "; 00312 } 00313 else if (c == ':') { 00314 refread = 1; 00315 s = "ref: "; 00316 } 00317 else { 00318 ret0: 00319 if (c == '*') 00320 ungetc(c,pf); 00321 return 0; 00322 } 00323 while(*s) { 00324 if ((c = getc(pf)) == EOF) 00325 return 1; 00326 if (c != *s++) 00327 goto ret0; 00328 } 00329 s = buf; 00330 se = buf + sizeof(buf) - 1; 00331 for(;;) { 00332 if ((c = getc(pf)) == EOF) 00333 return 1; 00334 if (c == ' ') 00335 break; 00336 if (s >= se || Pct[c] != P_anum) 00337 goto ret0; 00338 *s++ = c; 00339 } 00340 *s-- = 0; 00341 if (s <= buf || *s != '_') 00342 return 0; 00343 strcpy(cbuf,buf); 00344 *s-- = 0; 00345 if (*s == '_') { 00346 *s-- = 0; 00347 if (s <= buf) 00348 return 0; 00349 } 00350 for(L = 0;;) { 00351 if ((c = getc(pf)) == EOF) 00352 return 1; 00353 if (c == ' ') 00354 break; 00355 if (c < '0' && c > '9') 00356 goto ret0; 00357 L = 10*L + c - '0'; 00358 } 00359 if (!L && !refread) 00360 return 0; 00361 e = mkext1(buf, cbuf); 00362 if (refread) 00363 return readref(pf, e, (int)L); 00364 if (e->extstg == STGUNKNOWN) { 00365 e->extstg = STGCOMMON; 00366 e->maxleng = L; 00367 } 00368 else if (e->extstg != STGCOMMON) 00369 Pnotboth(e); 00370 else if (e->maxleng != L) { 00371 fprintf(stderr, 00372 "incompatible lengths for common block %s (line %ld of %s)\n", 00373 buf, Plineno, Pfname); 00374 if (e->maxleng < L) 00375 e->maxleng = L; 00376 } 00377 return 0; 00378 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void detected | ( | char * | msg | ) | [static] |
Definition at line 837 of file pread.c.
References Argtypes::atypes, Argtypes::changes, Atype::cp, Argtypes::defined, Argtypes::dnargs, gmem(), Argtypes::nargs, p, Pnotboth(), STGCOMMON, STGEXT, t, tfirst, tnext, and Atype::type.
Referenced by Pfile().
00839 { 00840 Argtypes *at; 00841 register Atype *aty; 00842 register int *t, *te; 00843 int i, k; 00844 00845 if (p->extstg == STGCOMMON) { 00846 Pnotboth(p); 00847 return; 00848 } 00849 p->extstg = STGEXT; 00850 p->extype = ftype; 00851 p->exproto = 1; 00852 t = tfirst; 00853 te = tnext; 00854 i = te - t; 00855 k = sizeof(Argtypes) + (i-1)*sizeof(Atype); 00856 at = p->arginfo = (Argtypes *)gmem(k,1); 00857 at->dnargs = at->nargs = i; 00858 at->defined = at->changes = 0; 00859 for(aty = at->atypes; t < te; aty++) { 00860 aty->type = *t++; 00861 aty->cp = 0; 00862 } 00863 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 193 of file pread.c.
Referenced by readref().
00195 { 00196 register int c, k; 00197 00198 if ((c = getc(pf)) < '0' || c > '9') 00199 return c; 00200 k = c - '0'; 00201 for(;;) { 00202 if ((c = getc(pf)) == ' ') { 00203 *n = k; 00204 return c; 00205 } 00206 if (c < '0' || c > '9') 00207 break; 00208 k = 10*k + c - '0'; 00209 } 00210 return c; 00211 }
Here is the caller graph for this function:

| static void Pbadmsg | ( | char * | msg, | |
| Extsym * | p | |||
| ) | [static] |
Definition at line 723 of file pread.c.
References p, Pbad, Pfname, and Plineno.
Referenced by argverify(), and Pbadret().
00725 { 00726 Pbad++; 00727 fprintf(stderr, "%s for %s (line %ld of %s):\n\t", msg, 00728 p->fextname, Plineno, Pfname); 00729 p->arginfo->nargs = -1; 00730 }
Here is the caller graph for this function:

Definition at line 738 of file pread.c.
References Argtype(), p, and Pbadmsg().
Referenced by argverify(), and readref().
00740 { 00741 char buf1[32], buf2[32]; 00742 00743 Pbadmsg("inconsistent types",p); 00744 fprintf(stderr, "here %s, previously %s\n", 00745 Argtype(ftype+200,buf1), 00746 Argtype(p->extype+200,buf2)); 00747 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int Pfile | ( | char * | fname | ) | [static] |
Definition at line 870 of file pread.c.
References argverify(), badchar(), getname(), mkext1(), newarg(), p, P_anum, P_delim, P_slash, P_space, Pct, Pfname, Pftype(), Plineno, Ptok, Ptoken(), Ptype(), s, textread, tfirst, tlast, tnext, trealloc(), trimunder(), and wanted().
Referenced by read_Pfiles().
00872 { 00873 char *s; 00874 int ftype, i; 00875 FILE *pf; 00876 Extsym *p; 00877 00878 for(s = fname; *s; s++); 00879 if (s - fname < 2 00880 || s[-2] != '.' 00881 || (s[-1] != 'P' && s[-1] != 'p')) 00882 return 0; 00883 00884 if (!(pf = fopen(fname, textread))) { 00885 fprintf(stderr, "can't open %s\n", fname); 00886 exit(2); 00887 } 00888 Pfname = fname; 00889 Plineno = 1; 00890 if (!Pct[' ']) { 00891 for(s = " \t\n\r\v\f"; *s; s++) 00892 Pct[*s] = P_space; 00893 for(s = "*,();"; *s; s++) 00894 Pct[*s] = P_delim; 00895 for(i = '0'; i <= '9'; i++) 00896 Pct[i] = P_anum; 00897 for(s = "abcdefghijklmnopqrstuvwxyz"; i = *s; s++) 00898 Pct[i] = Pct[i+'A'-'a'] = P_anum; 00899 Pct['_'] = P_anum; 00900 Pct['/'] = P_slash; 00901 } 00902 00903 for(;;) { 00904 if (!(i = Ptoken(pf,1))) 00905 break; 00906 if (i != P_anum 00907 || !strcmp(Ptok, "extern") && (i = Ptoken(pf,0)) != P_anum) 00908 badchar(i); 00909 ftype = Pftype(); 00910 getname: 00911 if ((i = Ptoken(pf,0)) != P_anum) 00912 badchar(i); 00913 p = mkext1(trimunder(), Ptok); 00914 00915 if ((i = Ptoken(pf,0)) != '(') 00916 badchar(i); 00917 tnext = tfirst; 00918 while(i = Ptype(pf)) { 00919 if (tnext >= tlast) 00920 trealloc(); 00921 *tnext++ = i; 00922 } 00923 if (p->arginfo) { 00924 argverify(ftype, p); 00925 if (p->arginfo->nargs < 0) 00926 newarg(ftype, p); 00927 } 00928 else 00929 newarg(ftype, p); 00930 p->arginfo->defined = 1; 00931 i = Ptoken(pf,0); 00932 switch(i) { 00933 case ';': 00934 break; 00935 case ',': 00936 goto getname; 00937 default: 00938 wanted(i, "\";\" or \",\""); 00939 } 00940 } 00941 fclose(pf); 00942 return 1; 00943 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int Pftype | ( | Void | ) | [static] |
Definition at line 463 of file pread.c.
References bad_type(), checklogical, checkreal(), Ptok, TYCHAR, TYCOMPLEX, TYDCOMPLEX, TYDREAL, TYINT1, TYLOGICAL, TYLOGICAL1, TYLOGICAL2, TYLONG, TYQUAD, TYREAL, TYSHORT, and TYSUBR.
Referenced by Pfile().
00464 { 00465 switch(Ptok[0]) { 00466 case 'C': 00467 if (!strcmp(Ptok+1, "_f")) 00468 return TYCOMPLEX; 00469 break; 00470 case 'E': 00471 if (!strcmp(Ptok+1, "_f")) { 00472 /* TYREAL under forcedouble */ 00473 checkreal(1); 00474 return TYREAL; 00475 } 00476 break; 00477 case 'H': 00478 if (!strcmp(Ptok+1, "_f")) 00479 return TYCHAR; 00480 break; 00481 case 'Z': 00482 if (!strcmp(Ptok+1, "_f")) 00483 return TYDCOMPLEX; 00484 break; 00485 case 'd': 00486 if (!strcmp(Ptok+1, "oublereal")) 00487 return TYDREAL; 00488 break; 00489 case 'i': 00490 if (!strcmp(Ptok+1, "nt")) 00491 return TYSUBR; 00492 if (!strcmp(Ptok+1, "nteger")) 00493 return TYLONG; 00494 if (!strcmp(Ptok+1, "nteger1")) 00495 return TYINT1; 00496 break; 00497 case 'l': 00498 if (!strcmp(Ptok+1, "ogical")) { 00499 checklogical(1); 00500 return TYLOGICAL; 00501 } 00502 if (!strcmp(Ptok+1, "ogical1")) 00503 return TYLOGICAL1; 00504 #ifdef TYQUAD 00505 if (!strcmp(Ptok+1, "ongint")) 00506 return TYQUAD; 00507 #endif 00508 break; 00509 case 'r': 00510 if (!strcmp(Ptok+1, "eal")) { 00511 checkreal(0); 00512 return TYREAL; 00513 } 00514 break; 00515 case 's': 00516 if (!strcmp(Ptok+1, "hortint")) 00517 return TYSHORT; 00518 if (!strcmp(Ptok+1, "hortlogical")) { 00519 checklogical(0); 00520 return TYLOGICAL2; 00521 } 00522 break; 00523 } 00524 bad_type(); 00525 /* NOT REACHED */ 00526 return 0; 00527 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void Pnotboth | ( | Extsym * | e | ) | [static] |
Definition at line 175 of file pread.c.
References Extsym::curno, Extsym::fextname, Pbad, Pfname, and Plineno.
Referenced by comlen(), newarg(), and readref().
00177 { 00178 if (e->curno) 00179 return; 00180 Pbad++; 00181 e->curno = 1; 00182 fprintf(stderr, 00183 "%s cannot be both a procedure and a common block (line %ld of %s)\n", 00184 e->fextname, Plineno, Pfname); 00185 }
Here is the caller graph for this function:

Definition at line 386 of file pread.c.
References badchar(), comlen(), P_anum, P_delim, P_slash, P_space, Pct, Pfname, Plineno, Ptok, s, top, and ungetc().
Referenced by Pfile(), and Ptype().
00388 { 00389 register int c; 00390 register char *s, *se; 00391 00392 top: 00393 for(;;) { 00394 c = getc(pf); 00395 if (c == EOF) { 00396 if (canend) 00397 return 0; 00398 goto badeof; 00399 } 00400 if (Pct[c] != P_space) 00401 break; 00402 if (c == '\n') 00403 Plineno++; 00404 } 00405 switch(Pct[c]) { 00406 case P_anum: 00407 if (c == '_') 00408 badchar(c); 00409 s = Ptok; 00410 se = s + sizeof(Ptok) - 1; 00411 do { 00412 if (s < se) 00413 *s++ = c; 00414 if ((c = getc(pf)) == EOF) { 00415 badeof: 00416 fprintf(stderr, 00417 "unexpected end of file in %s\n", 00418 Pfname); 00419 exit(2); 00420 } 00421 } 00422 while(Pct[c] == P_anum); 00423 ungetc(c,pf); 00424 *s = 0; 00425 return P_anum; 00426 00427 case P_delim: 00428 return c; 00429 00430 case P_slash: 00431 if ((c = getc(pf)) != '*') { 00432 if (c == EOF) 00433 goto badeof; 00434 badchar('/'); 00435 } 00436 if (canend && comlen(pf)) 00437 goto badeof; 00438 for(;;) { 00439 while((c = getc(pf)) != '*') { 00440 if (c == EOF) 00441 goto badeof; 00442 if (c == '\n') 00443 Plineno++; 00444 } 00445 slashseek: 00446 switch(getc(pf)) { 00447 case '/': 00448 goto top; 00449 case EOF: 00450 goto badeof; 00451 case '*': 00452 goto slashseek; 00453 } 00454 } 00455 default: 00456 badchar(c); 00457 } 00458 /* NOT REACHED */ 00459 return 0; 00460 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int Ptype | ( | FILE * | pf | ) | [static] |
Definition at line 552 of file pread.c.
References bad_type(), badchar(), checklogical, P_anum, Ptok, Ptoken(), tfirst, tnext, TYCHAR, TYCOMPLEX, TYDCOMPLEX, TYDREAL, TYFTNLEN, TYINT1, TYLOGICAL, TYLOGICAL1, TYLOGICAL2, TYLONG, TYQUAD, TYREAL, TYSHORT, TYSUBR, TYUNKNOWN, ungetc(), and wanted().
Referenced by Pfile().
00554 { 00555 int i, rv; 00556 00557 i = Ptoken(pf,0); 00558 if (i == ')') 00559 return 0; 00560 if (i != P_anum) 00561 badchar(i); 00562 00563 rv = 0; 00564 switch(Ptok[0]) { 00565 case 'C': 00566 if (!strcmp(Ptok+1, "_fp")) 00567 rv = TYCOMPLEX+200; 00568 break; 00569 case 'D': 00570 if (!strcmp(Ptok+1, "_fp")) 00571 rv = TYDREAL+200; 00572 break; 00573 case 'E': 00574 case 'R': 00575 if (!strcmp(Ptok+1, "_fp")) 00576 rv = TYREAL+200; 00577 break; 00578 case 'H': 00579 if (!strcmp(Ptok+1, "_fp")) 00580 rv = TYCHAR+200; 00581 break; 00582 case 'I': 00583 if (!strcmp(Ptok+1, "_fp")) 00584 rv = TYLONG+200; 00585 else if (!strcmp(Ptok+1, "1_fp")) 00586 rv = TYINT1+200; 00587 #ifdef TYQUAD 00588 else if (!strcmp(Ptok+1, "8_fp")) 00589 rv = TYQUAD+200; 00590 #endif 00591 break; 00592 case 'J': 00593 if (!strcmp(Ptok+1, "_fp")) 00594 rv = TYSHORT+200; 00595 break; 00596 case 'K': 00597 checklogical(0); 00598 goto Logical; 00599 case 'L': 00600 checklogical(1); 00601 Logical: 00602 if (!strcmp(Ptok+1, "_fp")) 00603 rv = TYLOGICAL+200; 00604 else if (!strcmp(Ptok+1, "1_fp")) 00605 rv = TYLOGICAL1+200; 00606 else if (!strcmp(Ptok+1, "2_fp")) 00607 rv = TYLOGICAL2+200; 00608 break; 00609 case 'S': 00610 if (!strcmp(Ptok+1, "_fp")) 00611 rv = TYSUBR+200; 00612 break; 00613 case 'U': 00614 if (!strcmp(Ptok+1, "_fp")) 00615 rv = TYUNKNOWN+300; 00616 break; 00617 case 'Z': 00618 if (!strcmp(Ptok+1, "_fp")) 00619 rv = TYDCOMPLEX+200; 00620 break; 00621 case 'c': 00622 if (!strcmp(Ptok+1, "har")) 00623 rv = TYCHAR; 00624 else if (!strcmp(Ptok+1, "omplex")) 00625 rv = TYCOMPLEX; 00626 break; 00627 case 'd': 00628 if (!strcmp(Ptok+1, "oublereal")) 00629 rv = TYDREAL; 00630 else if (!strcmp(Ptok+1, "oublecomplex")) 00631 rv = TYDCOMPLEX; 00632 break; 00633 case 'f': 00634 if (!strcmp(Ptok+1, "tnlen")) 00635 rv = TYFTNLEN+100; 00636 break; 00637 case 'i': 00638 if (!strncmp(Ptok+1, "nteger", 6)) { 00639 if (!Ptok[7]) 00640 rv = TYLONG; 00641 else if (Ptok[7] == '1' && !Ptok[8]) 00642 rv = TYINT1; 00643 } 00644 break; 00645 case 'l': 00646 if (!strncmp(Ptok+1, "ogical", 6)) { 00647 if (!Ptok[7]) { 00648 checklogical(1); 00649 rv = TYLOGICAL; 00650 } 00651 else if (Ptok[7] == '1' && !Ptok[8]) 00652 rv = TYLOGICAL1; 00653 } 00654 #ifdef TYQUAD 00655 else if (!strcmp(Ptok+1,"ongint")) 00656 rv = TYQUAD; 00657 #endif 00658 break; 00659 case 'r': 00660 if (!strcmp(Ptok+1, "eal")) 00661 rv = TYREAL; 00662 break; 00663 case 's': 00664 if (!strcmp(Ptok+1, "hortint")) 00665 rv = TYSHORT; 00666 else if (!strcmp(Ptok+1, "hortlogical")) { 00667 checklogical(0); 00668 rv = TYLOGICAL2; 00669 } 00670 break; 00671 case 'v': 00672 if (tnext == tfirst && !strcmp(Ptok+1, "oid")) { 00673 if ((i = Ptoken(pf,0)) != /*(*/ ')') 00674 wanted(i, /*(*/ "\")\""); 00675 return 0; 00676 } 00677 } 00678 if (!rv) 00679 bad_type(); 00680 if (rv < 100 && (i = Ptoken(pf,0)) != '*') 00681 wanted(i, "\"*\""); 00682 if ((i = Ptoken(pf,0)) == P_anum) 00683 i = Ptoken(pf,0); /* skip variable name */ 00684 switch(i) { 00685 case ')': 00686 ungetc(i,pf); 00687 break; 00688 case ',': 00689 break; 00690 default: 00691 wanted(i, "\",\" or \")\""); 00692 } 00693 return rv; 00694 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void read_Pfiles | ( | char ** | ffiles | ) |
Definition at line 950 of file pread.c.
References Extsym::arginfo, Argtypes::changes, Extsym::extstg, extsymtab, free(), Argtypes::nargs, nextext, Pbad, Pfile(), retcode, s, STGEXT, tfirst, tlast, tmax, and tnext.
Referenced by main().
00952 { 00953 char **f1files, **f1files0, *s; 00954 int k; 00955 register Extsym *e, *ee; 00956 register Argtypes *at; 00957 extern int retcode; 00958 00959 f1files0 = f1files = ffiles; 00960 while(s = *ffiles++) 00961 if (!Pfile(s)) 00962 *f1files++ = s; 00963 if (Pbad) 00964 retcode = 8; 00965 if (tfirst) { 00966 free((char *)tfirst); 00967 /* following should be unnecessary, as we won't be back here */ 00968 tfirst = tnext = tlast = 0; 00969 tmax = 0; 00970 } 00971 *f1files = 0; 00972 if (f1files == f1files0) 00973 f1files[1] = 0; 00974 00975 k = 0; 00976 ee = nextext; 00977 for (e = extsymtab; e < ee; e++) 00978 if (e->extstg == STGEXT 00979 && (at = e->arginfo)) { 00980 if (at->nargs < 0 || at->changes) 00981 k++; 00982 at->changes = 2; 00983 } 00984 if (k) { 00985 fprintf(diagfile, 00986 "%d prototype%s updated while reading prototypes.\n", k, 00987 k > 1 ? "s" : ""); 00988 } 00989 fflush(diagfile); 00990 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 223 of file pread.c.
References a, Extsym::arginfo, Argtypes::atypes, Argtypes::changes, Argtypes::dnargs, Extsym::extstg, Extsym::extype, gmem(), i, Argtypes::nargs, numread(), Pbadret(), Pnotboth(), STGEXT, STGUNKNOWN, t, tfirst, tlast, tnext, trealloc(), TYFTNLEN, type, and TYSUBR.
Referenced by comlen().
00225 { 00226 register int c, *t; 00227 int i, nargs, type; 00228 Argtypes *at; 00229 Atype *a, *ae; 00230 00231 if (ftype > TYSUBR) 00232 return 0; 00233 if ((c = numread(pf, &nargs)) != ' ') { 00234 if (c != ':') 00235 return c == EOF; 00236 /* just a typed external */ 00237 if (e->extstg == STGUNKNOWN) { 00238 at = 0; 00239 goto justsym; 00240 } 00241 if (e->extstg == STGEXT) { 00242 if (e->extype != ftype) 00243 Pbadret(ftype, e); 00244 } 00245 else 00246 Pnotboth(e); 00247 return 0; 00248 } 00249 00250 tnext = tfirst; 00251 for(i = 0; i < nargs; i++) { 00252 if ((c = numread(pf, &type)) != ' ' 00253 || type >= 500 00254 || type != TYFTNLEN + 100 && type % 100 > TYSUBR) 00255 return c == EOF; 00256 if (tnext >= tlast) 00257 trealloc(); 00258 *tnext++ = type; 00259 } 00260 00261 if (e->extstg == STGUNKNOWN) { 00262 save_at: 00263 at = (Argtypes *) 00264 gmem(sizeof(Argtypes) + (nargs-1)*sizeof(Atype), 1); 00265 at->dnargs = at->nargs = nargs; 00266 at->changes = 0; 00267 t = tfirst; 00268 a = at->atypes; 00269 for(ae = a + nargs; a < ae; a++) { 00270 a->type = *t++; 00271 a->cp = 0; 00272 } 00273 justsym: 00274 e->extstg = STGEXT; 00275 e->extype = ftype; 00276 e->arginfo = at; 00277 } 00278 else if (e->extstg != STGEXT) { 00279 Pnotboth(e); 00280 } 00281 else if (!e->arginfo) { 00282 if (e->extype != ftype) 00283 Pbadret(ftype, e); 00284 else 00285 goto save_at; 00286 } 00287 else 00288 argverify(ftype, e); 00289 return 0; 00290 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void trealloc | ( | Void | ) | [static] |
Definition at line 40 of file pread.c.
References realloc(), tfirst, TGULP, tlast, tmax, and tnext.
Referenced by Pfile(), and readref().
00041 { 00042 int k = tmax; 00043 tfirst = (int *)realloc((char *)tfirst, 00044 (tmax += TGULP)*sizeof(int)); 00045 if (!tfirst) { 00046 fprintf(stderr, 00047 "Pfile: realloc failure!\n"); 00048 exit(2); 00049 } 00050 tlast = tfirst + tmax; 00051 tnext = tfirst + k; 00052 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static char* trimunder | ( | Void | ) | [static] |
Definition at line 697 of file pread.c.
References buf, Pfname, Plineno, Ptok, and s.
Referenced by Pfile().
00698 { 00699 register char *s; 00700 register int n; 00701 static char buf[128]; 00702 00703 s = Ptok + strlen(Ptok) - 1; 00704 if (*s != '_') { 00705 fprintf(stderr, 00706 "warning: %s does not end in _ (line %ld of %s)\n", 00707 Ptok, Plineno, Pfname); 00708 return Ptok; 00709 } 00710 if (s[-1] == '_') 00711 s--; 00712 strncpy(buf, Ptok, n = s - Ptok); 00713 buf[n] = 0; 00714 return buf; 00715 }
Here is the caller graph for this function:

| static void wanted | ( | int | i, | |
| char * | what | |||
| ) | [static] |
Definition at line 535 of file pread.c.
References P_anum, Pfname, Plineno, and Ptok.
Referenced by Pfile(), and Ptype().
00537 { 00538 if (i != P_anum) { 00539 Ptok[0] = i; 00540 Ptok[1] = 0; 00541 } 00542 fprintf(stderr,"Error: expected %s, not \"%s\" (line %ld of %s)\n", 00543 what, Ptok, Plineno, Pfname); 00544 exit(2); 00545 }
Here is the caller graph for this function:

Definition at line 29 of file pread.c.
Referenced by badflag(), detected(), Pbadmsg(), Pnotboth(), and read_Pfiles().
char Pct[Table_size] [static] |
char* Pfname [static] |
Definition at line 27 of file pread.c.
Referenced by bad_type(), badchar(), badflag(), comlen(), detected(), Pbadmsg(), Pfile(), Pnotboth(), Ptoken(), trimunder(), and wanted().
Definition at line 28 of file pread.c.
Referenced by bad_type(), badchar(), badflag(), comlen(), detected(), Pbadmsg(), Pfile(), Pnotboth(), Ptoken(), trimunder(), and wanted().
char Ptok[128] [static] |
Definition at line 26 of file pread.c.
Referenced by bad_type(), Pfile(), Pftype(), Ptoken(), Ptype(), trimunder(), and wanted().
Definition at line 30 of file pread.c.
Referenced by argverify(), newarg(), Pfile(), Ptype(), read_Pfiles(), readref(), and trealloc().
Definition at line 30 of file pread.c.
Referenced by Pfile(), read_Pfiles(), readref(), and trealloc().
Definition at line 30 of file pread.c.
Referenced by argverify(), newarg(), Pfile(), Ptype(), read_Pfiles(), readref(), and trealloc().
1.5.1