#include "defs.h"#include "output.h"#include "iob.h"Include dependency graph for init.c:

Go to the source code of this file.
| void fileinit | ( | Void | ) |
Definition at line 297 of file init.c.
References ALLOCN, ckalloc(), ctls, ctlstack, dfltproc, dflttype, eqvclass, extsymtab, ff, fmt_init(), forcedouble, hextoi, hextoi_tab, highlabtab, i, infile, j, labarray, labeltab, labtabend, lastctl, lastext, lasthash, lastiolabno, lastlabno, lastvarno, Letters, litpool, main_alias, maxctl, maxequiv, maxext, maxhash, maxlablist, maxliterals, maxstno, maxtoklen, mem_init(), memset(), nerr, nextext, nliterals, np_init(), out_init(), s, token, TYDREAL, tyint, TYREAL, and tyreal.
Referenced by main().
00298 { 00299 register char *s; 00300 register int i, j; 00301 00302 lastiolabno = 100000; 00303 lastlabno = 0; 00304 lastvarno = 0; 00305 nliterals = 0; 00306 nerr = 0; 00307 00308 infile = stdin; 00309 00310 maxtoklen = 502; 00311 token = (char *)ckalloc(maxtoklen+2); 00312 memset(dflttype, tyreal, 26); 00313 memset(dflttype + ('i' - 'a'), tyint, 6); 00314 memset(hextoi_tab, 16, sizeof(hextoi_tab)); 00315 for(i = 0, s = "0123456789abcdef"; *s; i++, s++) 00316 hextoi(*s) = i; 00317 for(i = 10, s = "ABCDEF"; *s; i++, s++) 00318 hextoi(*s) = i; 00319 for(j = 0, s = "abcdefghijklmnopqrstuvwxyz"; i = *s++; j++) 00320 Letters[i] = Letters[i+'A'-'a'] = j; 00321 #ifdef TYQUAD 00322 /* Older C compilers may not understand UL suffixes. */ 00323 /* It would be much simpler to use 0xffffffffUL some places... */ 00324 ff = 0xffff; 00325 ff = (ff << 16) | ff; 00326 #endif 00327 ctls = ALLOCN(maxctl+1, Ctlframe); 00328 extsymtab = ALLOCN(maxext, Extsym); 00329 eqvclass = ALLOCN(maxequiv, Equivblock); 00330 hashtab = ALLOCN(maxhash, Hashentry); 00331 labeltab = ALLOCN(maxstno, Labelblock); 00332 litpool = ALLOCN(maxliterals, Literal); 00333 labarray = (struct Labelblock **)ckalloc(maxlablist* 00334 sizeof(struct Labelblock *)); 00335 fmt_init(); 00336 mem_init(); 00337 np_init(); 00338 00339 ctlstack = ctls++; 00340 lastctl = ctls + maxctl; 00341 nextext = extsymtab; 00342 lastext = extsymtab + maxext; 00343 lasthash = hashtab + maxhash; 00344 labtabend = labeltab + maxstno; 00345 highlabtab = labeltab; 00346 main_alias[0] = '\0'; 00347 if (forcedouble) 00348 dfltproc[TYREAL] = dfltproc[TYDREAL]; 00349 00350 /* Initialize the routines for providing C output */ 00351 00352 out_init (); 00353 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void hashclear | ( | Void | ) |
Definition at line 356 of file init.c.
References Dimblock::dimexpr, Dimblock::dims, Dimblock::dimsize, frexpr(), i, lasthash, ndim, p, and Hashentry::varp.
Referenced by procinit().
00357 { 00358 register struct Hashentry *hp; 00359 register Namep p; 00360 register struct Dimblock *q; 00361 register int i; 00362 00363 for(hp = hashtab ; hp < lasthash ; ++hp) 00364 if(p = hp->varp) 00365 { 00366 frexpr(p->vleng); 00367 if(q = p->vdim) 00368 { 00369 for(i = 0 ; i < q->ndim ; ++i) 00370 { 00371 frexpr(q->dims[i].dimsize); 00372 frexpr(q->dims[i].dimexpr); 00373 } 00374 frexpr(q->nelt); 00375 frexpr(q->baseoffset); 00376 frexpr(q->basexpr); 00377 free( (charptr) q); 00378 } 00379 if(p->vclass == CLNAMELIST) 00380 frchain( &(p->varxptr.namelist) ); 00381 free( (charptr) p); 00382 hp->varp = NULL; 00383 } 00384 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void procinit | ( | Void | ) |
Definition at line 390 of file init.c.
References allargs, assigned_fmts, autonum, blklevel, chlgslot, chslot, CLUNKNOWN, ctls, ctlstack, curmemblock, cxslot, Chain::datap, dcomplex_seen, dorange, earlylabs, ei_first, ei_last, ei_next, entries, eqvstart, firstmemblock, frchain(), free(), frexchain(), frexpr(), hashclear(), headerdone, highlabtab, highregvar, holdtemps, i, inioctl, io_structs, iob_list, labeltab, labtabend, lastargslot, lp, multitype, nallargs, nallchargs, needkwd, nentry, nequiv, new_vars, Chain::nextp, nintnames, NO, nregvar, NTYPES0, NULL, nwarn, OUTSIDE, parstate, procclass, procleng, procname, proctype, retslot, rpllist, rtvlabel, saveall, setimpl(), STGBSS, substars, templist, thislabel, TYADDR, tyint, tyreal, TYUNKNOWN, TYVOID, undeftype, used_builtins, wh_first, wh_last, wh_next, and xretslot.
Referenced by endproc(), and main().
00391 { 00392 register struct Labelblock *lp; 00393 struct Chain *cp; 00394 int i; 00395 struct memblock; 00396 00397 curmemblock = firstmemblock; 00398 mem_next = mem_first; 00399 mem_last = mem0_last; 00400 ei_next = ei_first = ei_last = 0; 00401 wh_next = wh_first = wh_last = 0; 00402 iob_list = 0; 00403 for(i = 0; i < 9; i++) 00404 io_structs[i] = 0; 00405 00406 parstate = OUTSIDE; 00407 headerdone = NO; 00408 blklevel = 1; 00409 saveall = NO; 00410 substars = NO; 00411 nwarn = 0; 00412 thislabel = NULL; 00413 needkwd = 0; 00414 00415 proctype = TYUNKNOWN; 00416 procname = "MAIN_"; 00417 procclass = CLUNKNOWN; 00418 nentry = 0; 00419 nallargs = nallchargs = 0; 00420 multitype = NO; 00421 retslot = NULL; 00422 for(i = 0; i < NTYPES0; i++) { 00423 frexpr((expptr)xretslot[i]); 00424 xretslot[i] = 0; 00425 } 00426 cxslot = -1; 00427 chslot = -1; 00428 chlgslot = -1; 00429 procleng = 0; 00430 blklevel = 1; 00431 lastargslot = 0; 00432 00433 for(lp = labeltab ; lp < labtabend ; ++lp) 00434 lp->stateno = 0; 00435 00436 hashclear(); 00437 00438 /* Clear the list of newly generated identifiers from the previous 00439 function */ 00440 00441 frexchain(&new_vars); 00442 frexchain(&used_builtins); 00443 frchain(&assigned_fmts); 00444 frchain(&allargs); 00445 frchain(&earlylabs); 00446 00447 nintnames = 0; 00448 highlabtab = labeltab; 00449 00450 ctlstack = ctls - 1; 00451 for(i = TYADDR; i < TYVOID; i++) { 00452 for(cp = templist[i]; cp ; cp = cp->nextp) 00453 free( (charptr) (cp->datap) ); 00454 frchain(templist + i); 00455 autonum[i] = 0; 00456 } 00457 holdtemps = NULL; 00458 dorange = 0; 00459 nregvar = 0; 00460 highregvar = 0; 00461 entries = NULL; 00462 rpllist = NULL; 00463 inioctl = NO; 00464 eqvstart += nequiv; 00465 nequiv = 0; 00466 dcomplex_seen = 0; 00467 00468 for(i = 0 ; i<NTYPES0 ; ++i) 00469 rtvlabel[i] = 0; 00470 00471 if(undeftype) 00472 setimpl(TYUNKNOWN, (ftnint) 0, 'a', 'z'); 00473 else 00474 { 00475 setimpl(tyreal, (ftnint) 0, 'a', 'z'); 00476 setimpl(tyint, (ftnint) 0, 'i', 'n'); 00477 } 00478 setimpl(-STGBSS, (ftnint) 0, 'a', 'z'); /* set class */ 00479 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 491 of file init.c.
References err, i, implleng, implstg, impltype, lengtype(), letter, TYCHAR, and TYLONG.
Referenced by procinit(), and yyparse().
00493 { 00494 int i; 00495 char buff[100]; 00496 00497 if(c1==0 || c2==0) 00498 return; 00499 00500 if(c1 > c2) { 00501 sprintf(buff, "characters out of order in implicit:%c-%c", c1, c2); 00502 err(buff); 00503 } 00504 else { 00505 c1 = letter(c1); 00506 c2 = letter(c2); 00507 if(type < 0) 00508 for(i = c1 ; i<=c2 ; ++i) 00509 implstg[i] = - type; 00510 else { 00511 type = lengtype(type, length); 00512 if(type == TYCHAR) { 00513 if (length < 0) { 00514 err("length (*) in implicit"); 00515 length = 1; 00516 } 00517 } 00518 else if (type != TYLONG) 00519 length = 0; 00520 for(i = c1 ; i<=c2 ; ++i) { 00521 impltype[i] = type; 00522 implleng[i] = length; 00523 } 00524 } 00525 } 00526 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 42 of file init.c.
Referenced by doentry(), fix_entry_returns(), length_comp(), list_arg_types(), list_decls(), listargs(), procinit(), procode(), and putentries().
| chainp assigned_fmts = CHNULL |
Definition at line 41 of file init.c.
Referenced by fmtname(), procinit(), and write_assigned_fmts().
| char* av_pfix[TYVOID] |
Definition at line 51 of file init.c.
Referenced by def_commons(), done(), endproc(), ind_printf(), main(), start_formatting(), and wr_common_decls().
| char* casttypes[TYSUBR+1] |
Initial value:
{
"U_fp", "??bug??", "I1_fp",
"J_fp", "I_fp",
"Q_fp",
"R_fp", "D_fp", "C_fp", "Z_fp",
"L1_fp", "L2_fp", "L_fp", "H_fp", "S_fp"
}
Definition at line 141 of file init.c.
Referenced by list_arg_types(), and set_externs().
| char* cm_fmt_string |
Definition at line 237 of file init.c.
Referenced by enddo(), endproc(), exenddo(), fileinit(), popctl(), procinit(), and yyparse().
Definition at line 238 of file init.c.
Referenced by enddo(), endproc(), exdo(), exelif(), exelse(), exenddo(), exendif(), fileinit(), new_endif(), popctl(), procinit(), pushctl(), and yyparse().
| struct memblock* curmemblock |
| char* db_fmt_string |
| char* dcm_fmt_string |
char* dflt0proc[] [static] |
Initial value:
{
0, 0, "(integer1 (*)())0",
"(shortint (*)())0", "(integer (*)())0",
"(longint (*)())0",
"(real (*)())0",
"(doublereal (*)())0", "(complex (*)())0", "(doublecomplex (*)())0",
"(logical1 (*)())0", "(shortlogical (*)())0",
"(logical (*)())0", "(char (*)())0", "(int (*)())0"
}
| char* dflt1proc[] |
| char* dfltarg[] |
Initial value:
{
0, 0, "(integer1 *)0",
"(shortint *)0", "(integer *)0",
"(longint *)0",
"(real *)0",
"(doublereal *)0", "(complex *)0", "(doublecomplex *)0",
"(logical1 *)0","(shortlogical *)0", "(logical *)0", "(char *)0"
}
Definition at line 152 of file init.c.
Referenced by putentries().
| char dflttype[26] |
Definition at line 49 of file init.c.
Referenced by doinclude(), entrypt(), err(), Fatal(), main(), omit_non_f(), set_tmp_names(), startproc(), warn(), and yyparse().
Definition at line 73 of file init.c.
Referenced by dim_finish(), out_addr(), output_binary(), putmnmx(), and setbound().
| char* ei_first |
| char * ei_last |
| char * ei_next |
Definition at line 288 of file init.c.
Referenced by do_p1_elseifstart(), procinit(), putif(), and start_formatting().
| struct Entrypoint* entries = NULL |
| struct Equivblock* eqvclass |
Definition at line 251 of file init.c.
Referenced by do_uninit_equivs(), doequiv(), eqvcommon(), eqveqv(), fileinit(), wr_equiv_init(), write_char_init(), and yyparse().
Definition at line 59 of file init.c.
Referenced by dataval(), doinclude(), popinclude(), and yyparse().
Definition at line 246 of file init.c.
Referenced by builtin(), changedtype(), comm2dcl(), commonprotos(), def_commons(), do_p1_extern(), docomleng(), docommon(), doentry(), endproc(), entry_goto(), eqvcommon(), fileinit(), fixexttype(), get_argtypes(), ioseta(), memname(), mkaddr(), mkext1(), mkfunct(), newentry(), out_addr(), out_call(), out_name(), p1_addr(), read_Pfiles(), settype(), start_formatting(), typekludge(), user_label(), wr_abbrevs(), wr_common_decls(), wr_equiv_init(), and yyparse().
| struct memblock * firstmemblock |
| char* fl_fmt_string |
| char* ftn_types[] |
Initial value:
{ "external", "??", "integer*1",
"integer*2", "integer",
"integer*8",
"real",
"double precision", "complex", "double complex",
"logical*1", "logical*2",
"logical", "character", "subroutine",
Bug,Bug,Bug,Bug,Bug,Bug,Bug,Bug,Bug, "ftnlen"
}
Definition at line 189 of file init.c.
Referenced by Argtype(), changedtype(), mixed_type(), and write_typedefs().
| flag headerdone = NO |
| unsigned char hextoi_tab[Table_size] |
| struct Labelblock* highlabtab |
Definition at line 260 of file init.c.
Referenced by fileinit(), mklabel(), poplab(), procinit(), and write_formats().
Definition at line 74 of file init.c.
Referenced by impldcl(), inferdcl(), setimpl(), and wronginf().
Definition at line 48 of file init.c.
Referenced by doinclude(), fileinit(), getcd(), popinclude(), and start_formatting().
| char* infname |
Definition at line 62 of file init.c.
Referenced by c_name(), doinclude(), err(), Fatal(), getcd(), getcds(), list_init_data(), popinclude(), putlineno(), and warn().
Definition at line 274 of file init.c.
Referenced by endioctl(), procinit(), startioctl(), and yyparse().
Initial value:
{ 0,0,0,0,0,0,0,
0,
1, 1, 0, 0, 0, 2}
Definition at line 201 of file init.c.
Referenced by length_comp().
Definition at line 275 of file init.c.
Referenced by doiolist(), endio(), endioctl(), ioclause(), iocname(), startrw(), and yyparse().
| struct Labelblock** labarray |
| struct Labelblock* labeltab |
Definition at line 258 of file init.c.
Referenced by do_p1_label(), endio(), endproc(), fileinit(), mklabel(), poplab(), procinit(), write_formats(), and yyparse().
| struct Labelblock* labtabend |
Definition at line 259 of file init.c.
Referenced by endproc(), fileinit(), mklabel(), and procinit().
Definition at line 255 of file init.c.
Referenced by dobss(), donmlist(), fileinit(), hashclear(), memno2info(), mkname(), and write_namelists().
Definition at line 225 of file init.c.
Referenced by fileinit(), startrw(), vardcl(), write_char_init(), and yyparse().
| unsigned char Letters[Table_size] |
Definition at line 60 of file init.c.
Referenced by contmax(), dataval(), do_p1_set_line(), doinclude(), enddcl(), err(), Fatal(), getcd(), getcds(), mkexpr(), popinclude(), setdata(), subcheck(), warn(), write_indent(), and yyparse().
Definition at line 283 of file init.c.
Referenced by addrlit(), fileinit(), findconst(), output_literal(), putconst(), and wr_globals().
| char main_alias[52] |
Definition at line 221 of file init.c.
Referenced by do_p1_head(), do_p1_subr_ret(), doentry(), epicode(), fix_entry_returns(), list_arg_types(), listargs(), out_addr(), procinit(), and putentries().
Definition at line 219 of file init.c.
Referenced by count_args(), doentry(), procinit(), and putentries().
Definition at line 218 of file init.c.
Referenced by do_p1_head(), doentry(), endproc(), parse(), procinit(), procode(), prolog(), and run().
Definition at line 277 of file init.c.
Referenced by do_uninit_equivs(), doequiv(), list_decls(), procinit(), write_char_init(), and yyparse().
Definition at line 65 of file init.c.
Referenced by docommon(), err(), err66(), errext(), expr_out(), fileinit(), main(), and overlapping().
Definition at line 34 of file init.c.
Referenced by declare_new_addr(), list_decls(), memno2info(), procinit(), and setbound().
Definition at line 247 of file init.c.
Referenced by comm2dcl(), commonprotos(), def_commons(), docomleng(), docommon(), endproc(), fileinit(), mkext1(), read_Pfiles(), start_formatting(), and wr_common_decls().
Definition at line 284 of file init.c.
Referenced by addrlit(), fileinit(), findconst(), output_literal(), putconst(), and wr_globals().
Definition at line 70 of file init.c.
Referenced by dataval(), enddcl(), endproc(), entrypt(), exequals(), main(), mkexpr(), newproc(), p1_label(), procinit(), settype(), and yyparse().
Definition at line 52 of file init.c.
Referenced by done(), main(), p1_const(), p1_line_number(), p1put(), p1putd(), p1putdd(), p1putddd(), p1putdds(), p1putds(), p1putn(), p1puts(), putif(), putwhile(), start_formatting(), and westart().
Definition at line 217 of file init.c.
Referenced by doentry(), entrypt(), epicode(), exreturn(), newproc(), procinit(), prolog(), setdata(), settype(), startproc(), and yyparse().
| char* procname |
Definition at line 208 of file init.c.
Referenced by entrypt(), procinit(), startproc(), and subcheck().
Definition at line 207 of file init.c.
Referenced by do_p1_head(), doentry(), entrypt(), epicode(), exreturn(), list_arg_types(), listargs(), procinit(), and putentries().
| char* protorettypes[] |
Initial value:
{
"?", "??", "integer1", "shortint", "integer",
"longint",
"real", "doublereal",
"C_f", "Z_f", "logical1", "shortlogical", "logical", "H_f", "int"
}
Definition at line 132 of file init.c.
Referenced by protowrite(), and set_externs().
Definition at line 210 of file init.c.
Referenced by doentry(), exreturn(), procinit(), and retval().
Definition at line 263 of file init.c.
Referenced by frrpl(), mkplace(), nextdata(), procinit(), and stfcall().
| struct Labelblock* thislabel = NULL |
| char* token |
Definition at line 57 of file init.c.
Referenced by adjtoklen(), fileinit(), get_p1_token(), gettok(), hexcheck(), iocname(), TCL_ArrayDim(), and yyparse().
Definition at line 78 of file init.c.
Referenced by fileinit(), fold(), intraddr(), intrcall(), lengtype(), mkintcon(), mkintqcon(), mkpower(), opconv_fudge(), procinit(), putcat(), putconst(), putcx1(), putiocall(), and set_externs().
Definition at line 80 of file init.c.
Referenced by intrcall(), lengtype(), mklogcon(), and set_externs().
| int type_choice[4] = { TYDREAL, TYSHORT, TYLONG, TYSHORT } |
Definition at line 105 of file init.c.
Referenced by fill_type(), pad_common(), and wr_equiv_init().
Initial value:
{ 0, 0, 3, 5, 7,
10,
8, 11, 9, 12, 1, 4, 6, 2 }
Definition at line 126 of file init.c.
Referenced by docommon(), and doequiv().
Initial value:
{
1, ALIADDR, 1, ALISHORT, ALILONG,
ALIDOUBLE,
ALILONG, ALIDOUBLE,
ALILONG, ALIDOUBLE, 1, ALISHORT, ALILONG, 1, 1, 1,
ALILONG, ALILONG, ALILONG, ALILONG, ALILONG, ALILONG}
Definition at line 96 of file init.c.
Referenced by docommon(), set_externs(), and wr_equiv_init().
| char* Typename[] |
Initial value:
{
"<<unknown>>",
"address",
"integer1",
"shortint",
"integer",
"longint",
"real",
"doublereal",
"complex",
"doublecomplex",
"logical1",
"shortlogical",
"logical",
"char"
}
Definition at line 107 of file init.c.
Referenced by c_type_decl(), fill_dcl(), out_call(), putio(), and wr_equiv_init().
Initial value:
{
1, SZADDR, 1, SZSHORT, SZLONG,
2*SZLONG,
SZLONG, 2*SZLONG,
2*SZLONG, 4*SZLONG, 1, SZSHORT, SZLONG, 1, 1, 0,
4*SZLONG + SZADDR,
4*SZLONG + 2*SZADDR,
4*SZLONG + 5*SZADDR,
2*SZLONG + SZADDR,
2*SZLONG,
11*SZLONG + 15*SZADDR
}
Definition at line 81 of file init.c.
Referenced by autovar(), commlen(), do_uninit_equivs(), docommon(), fill_type(), fixexpr(), get_fill(), iarrlen(), lengtype(), mkscalar(), nextdata(), opconv_fudge(), out_addr(), pad_common(), putct1(), putcx1(), set_externs(), setdata(), suboffset(), wr_array_init(), wr_equiv_init(), write_char_init(), and yyparse().
| chainp used_builtins = CHNULL |
| char* usedcasts[TYSUBR+1] |
| char* wh_first |
Definition at line 289 of file init.c.
Referenced by procinit(), putwhile(), and start_formatting().
| char * wh_last |
| char * wh_next |
Definition at line 289 of file init.c.
Referenced by do_p1_1while(), do_p1_2while(), procinit(), putwhile(), and start_formatting().
Definition at line 213 of file init.c.
Referenced by doentry(), fix_entry_returns(), list_arg_types(), listargs(), mkaddr(), out_addr(), out_name(), procinit(), putentries(), and settype().
1.5.1