1 /* 2 * proto.h -- function prototypes 3 * 4 * SOFTWARE RIGHTS 5 * 6 * We reserve no LEGAL rights to the Purdue Compiler Construction Tool 7 * Set (PCCTS) -- PCCTS is in the public domain. An individual or 8 * company may do whatever they wish with source code distributed with 9 * PCCTS or the code generated by PCCTS, including the incorporation of 10 * PCCTS, or its output, into commerical software. 11 * 12 * We encourage users to develop software with PCCTS. However, we do ask 13 * that credit is given to us for developing PCCTS. By "credit", 14 * we mean that if you incorporate our source code into one of your 15 * programs (commercial product, research project, or otherwise) that you 16 * acknowledge this fact somewhere in the documentation, research report, 17 * etc... If you like PCCTS and have developed a nice tool with the 18 * output, please mention that you developed it using PCCTS. In 19 * addition, we ask that this header remain intact in our source code. 20 * As long as these guidelines are kept, we expect to continue enhancing 21 * this system and expect to make other tools available as they are 22 * completed. 23 * 24 * ANTLR 1.33 25 * Terence Parr 26 * Parr Research Corporation 27 * with Purdue University and AHPCRC, University of Minnesota 28 * 1989-2001 29 */ 30 31 /* V a r i a b l e s */ 32 33 extern int tp; 34 extern Junction *SynDiag; 35 extern char Version[]; 36 extern char VersionDef[]; 37 #ifdef __cplusplus 38 extern void (*fpPrint[])(...); 39 #else 40 extern void (*fpPrint[])(); 41 #endif 42 #ifdef __cplusplus 43 extern struct _set (*fpReach[])(...); 44 #else 45 extern struct _set (*fpReach[])(); 46 #endif 47 #ifdef __cplusplus 48 extern struct _tree *(*fpTraverse[])(...); 49 #else 50 extern struct _tree *(*fpTraverse[])(); 51 #endif 52 #ifdef __cplusplus 53 extern void (**fpTrans)(...); 54 #else 55 extern void (**fpTrans)(); 56 #endif 57 #ifdef __cplusplus 58 extern void (**fpJTrans)(...); 59 #else 60 extern void (**fpJTrans)(); 61 #endif 62 #ifdef __cplusplus 63 extern void (*C_Trans[NumNodeTypes+1])(...); 64 #else 65 extern void (*C_Trans[])(); 66 #endif 67 #ifdef __cplusplus 68 extern void (*C_JTrans[NumJuncTypes+1])(...); 69 #else 70 extern void (*C_JTrans[])(); 71 #endif 72 extern int BlkLevel; 73 extern int CurFile; 74 extern char *CurPredName; 75 extern char *CurRule; 76 extern int CurRuleDebug; /* MR13 */ 77 extern Junction *CurRuleBlk; 78 extern RuleEntry *CurRuleNode; 79 extern ListNode *CurElementLabels; 80 extern ListNode *CurAstLabelsInActions; /* MR27 */ 81 extern ListNode *ContextGuardPredicateList; /* MR13 */ 82 extern ListNode *CurActionLabels; 83 extern int numericActionLabel; /* MR10 << ... $1 ... >> or << ... $1 ... >>? */ 84 extern ListNode *NumericPredLabels; /* MR10 << ... $1 ... >>? ONLY */ 85 extern char *FileStr[]; 86 extern int NumFiles; 87 extern int EpToken; 88 extern int WildCardToken; 89 extern Entry **Tname, 90 **Texpr, 91 **Rname, 92 **Fcache, 93 **Tcache, 94 **Elabel, 95 **Sname, 96 **Pname; /* MR11 */ 97 extern ListNode *ExprOrder; 98 extern ListNode **Cycles; 99 extern int TokenNum; 100 extern int LastTokenCounted; 101 extern ListNode *BeforeActions, *AfterActions, *LexActions; 102 103 /* MR1 */ 104 /* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */ 105 /* MR1 via #lexmember <<....>> & #lexprefix <<...>> */ 106 /* MR1 */ 107 108 extern ListNode *LexMemberActions; /* MR1 */ 109 extern ListNode *LexPrefixActions; /* MR1 */ 110 111 extern set *fset; /* for constrained search */ /* MR11 */ 112 extern int maxk; /* for constrained search */ /* MR11 */ 113 extern int Save_argc; /* MR10 */ 114 extern char **Save_argv; /* MR10 */ 115 extern ListNode *eclasses, *tclasses; 116 extern char *HdrAction; 117 extern char *FirstAction; /* MR11 */ 118 extern FILE *ErrFile; 119 extern char *RemapFileName; 120 extern char *ErrFileName; 121 extern char *DlgFileName; 122 extern char *DefFileName; 123 extern char *ModeFileName; 124 extern char *StdMsgName; 125 extern int NumRules; 126 extern Junction **RulePtr; 127 extern int LL_k; 128 extern int CLL_k; 129 extern char *decodeJType[]; 130 extern int PrintOut; 131 extern int PrintAnnotate; 132 extern int CodeGen; 133 extern int LexGen; 134 extern int esetnum; 135 extern int setnum; 136 extern int wordnum; 137 extern int GenAST; 138 extern int GenANSI; 139 extern int **FoStack; 140 extern int **FoTOS; 141 extern int GenExprSetsOpt; 142 extern FILE *DefFile; 143 extern int CannotContinue; 144 extern int GenCR; 145 extern int GenLineInfo; 146 extern int GenLineInfoMS; 147 extern int action_file, action_line; 148 extern int TraceGen; 149 extern int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile; 150 extern char *CurAmbigbtype; 151 extern int elevel; 152 extern int GenEClasseForRules; 153 extern FILE *input, *output; 154 extern char **TokenStr, **ExprStr; 155 extern int CurrentLexClass, NumLexClasses; 156 extern LClass lclass[]; 157 extern char LexStartSymbol[]; 158 extern char *CurRetDef; 159 extern char *CurParmDef; 160 extern int OutputLL_k; 161 extern int TreeResourceLimit; 162 extern int DemandLookahead; 163 extern char *RulePrefix; 164 extern int GenStdPccts; 165 extern char *stdpccts; 166 extern int ParseWithPredicates; 167 extern int ConstrainSearch; 168 extern int PURIFY; /* MR23 */ 169 170 extern set MR_CompromisedRules; /* MR14 */ 171 extern int MR_AmbSourceSearch; /* MR11 */ 172 extern int MR_SuppressSearch; /* MR13 */ 173 extern int MR_AmbSourceSearchGroup; /* MR11 */ 174 extern int MR_AmbSourceSearchChoice; /* MR11 */ 175 extern int MR_AmbSourceSearchLimit; /* MR11 */ 176 extern int MR_usingPredNames; /* MR11 */ 177 extern int MR_ErrorSetComputationActive; /* MR14 */ 178 extern char *MR_AmbAidRule; /* MR11 */ 179 extern int MR_AmbAidLine; /* MR11 */ 180 extern int MR_AmbAidMultiple; /* MR11 */ 181 extern int MR_AmbAidDepth; /* MR11 */ 182 extern int MR_skipped_e3_report; /* MR11 */ 183 extern int MR_matched_AmbAidRule; /* MR11 */ 184 extern int MR_Inhibit_Tokens_h_Gen; /* MR13 */ 185 extern int NewAST; /* MR13 */ 186 extern int tmakeInParser; /* MR23 */ 187 extern int AlphaBetaTrace; /* MR14 */ 188 extern int MR_BlkErr; /* MR21 */ 189 extern int MR_AlphaBetaWarning; /* MR14 */ 190 extern int MR_AlphaBetaMessageCount; /* MR14 */ 191 extern int MR_MaintainBackTrace; /* MR14 */ 192 extern int MR_BadExprSets; /* MR13 */ 193 extern int FoundGuessBlk; 194 extern int FoundException; 195 extern int FoundAtOperator; /* MR6 */ 196 extern int FoundExceptionGroup; /* MR6 */ 197 extern int WarningLevel; 198 extern int UseStdout; /* MR6 */ 199 extern int TabWidth; /* MR6 */ 200 extern int pLevel; 201 extern int pAlt1; 202 extern int pAlt2; 203 extern int AImode; 204 extern int HoistPredicateContext; 205 extern int MRhoisting; /* MR9 */ 206 extern int MRhoistingk; /* MR13 */ 207 extern int MR_debugGenRule; /* MR11 */ 208 extern int GenCC; 209 extern char *ParserName; 210 extern char *StandardSymbols[]; 211 extern char *ASTSymbols[]; 212 extern set reserved_positions; 213 extern set all_tokens; 214 extern set imag_tokens; 215 extern set tokclasses; 216 extern ListNode *ForcedTokens; 217 extern int *TokenInd; 218 extern FILE *Parser_h, *Parser_c; 219 extern char CurrentClassName[]; 220 extern int no_classes_found; 221 extern char Parser_h_Name[]; 222 extern char Parser_c_Name[]; 223 extern char MRinfoFile_Name[]; /* MR10 */ 224 extern FILE *MRinfoFile; /* MR10 */ 225 extern int MRinfo; /* MR10 */ 226 extern int MRinfoSeq; /* MR10 */ 227 extern int InfoP; /* MR10 */ 228 extern int InfoT; /* MR10 */ 229 extern int InfoF; /* MR10 */ 230 extern int InfoM; /* MR10 */ 231 extern int InfoO; /* MR12 */ 232 extern int PotentialSuppression; /* MR10 */ 233 extern int PotentialDummy; /* MR10 */ 234 extern int TnodesInUse; /* MR10 */ 235 extern int TnodesPeak; /* MR10 */ 236 extern int TnodesReportThreshold; /* MR11 */ 237 extern int TnodesAllocated; /* MR10 */ 238 extern char *ClassDeclStuff; /* MR10 */ 239 extern char *BaseClassName; /* MR22 */ 240 extern ListNode *class_before_actions, *class_after_actions; 241 extern char *UserTokenDefsFile; 242 extern int UserDefdTokens; 243 extern ListNode *MetaTokenNodes; 244 extern char *OutputDirectory; 245 extern int DontCopyTokens; 246 extern int LTinTokenAction; /* MR23 */ 247 extern set AST_nodes_refd_in_actions; 248 extern ListNode *CurExGroups; 249 extern int CurBlockID; 250 extern int CurAltNum; 251 extern Junction *CurAltStart; 252 extern Junction *OuterAltStart; /* chain exception groups MR7 */ 253 extern ExceptionGroup *DefaultExGroup; 254 extern int NumSignals; 255 extern int ContextGuardTRAV; 256 extern Junction *MR_RuleBlkWithHalt; /* MR10 */ 257 extern PointerStack MR_BackTraceStack; /* MR10 */ 258 extern PointerStack MR_PredRuleRefStack; /* MR10 */ 259 extern PointerStack MR_RuleBlkWithHaltStack; /* MR10 */ 260 261 /* */ 262 /* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */ 263 /* MR1 in DLG action */ 264 /* */ 265 extern int tokenActionActive; /* MR1 */ 266 267 extern char *PRED_OR_LIST; /* MR10 */ 268 extern char *PRED_AND_LIST; /* MR10 */ 269 270 #ifdef __VMS 271 #define STRICMP strcasecmp /* MR21 */ 272 #else 273 #define STRICMP stricmp /* MR21 */ 274 #endif 275 276 /* MR26 */ 277 #ifdef PCCTS_USE_STDARG 278 extern Tree *tmake(Tree *root, ...); 279 #else 280 extern Tree *tmake(); 281 #endif 282 283 #ifdef __USE_PROTOS 284 extern int STRICMP(const char*, const char*); 285 extern void istackreset(void); 286 extern int istacksize(void); 287 extern void pushint(int); 288 extern int popint( void ); 289 extern int istackempty( void ); 290 extern int topint( void ); 291 extern void NewSetWd( void ); 292 extern void DumpSetWd( void ); 293 extern void DumpSetWdForC( void ); 294 extern void DumpSetWdForCC( void ); 295 extern void NewSet( void ); 296 extern void FillSet( set ); 297 extern void ComputeErrorSets( void ); 298 extern void ComputeTokSets( void ); 299 extern void SubstErrorClass( set * ); 300 extern int DefErrSet( set *, int, char * ); 301 extern int DefErrSetForC( set *, int, char * ); 302 extern int DefErrSetForCC( set *, int, char * ); 303 extern int DefErrSet1(int, set *, int, char *); /* MR21 */ 304 extern int DefErrSetForC1(int, set *, int, char *, const char* ); /* MR21 */ 305 extern int DefErrSetForCC1(int, set *, int, char *, const char* ); /* MR21 */ 306 extern int DefErrSetWithSuffix(int, set *, int, char *, const char *); /* MR21 */ 307 extern void GenErrHdr( void ); 308 extern void dumpExpr( FILE *, char * ); 309 extern void addParm( Node *, char * ); 310 extern Graph buildAction( char *, int, int, int ); 311 extern Graph buildToken( char * ); 312 extern Graph buildWildCard( char * ); 313 extern Graph buildRuleRef( char * ); 314 extern Graph Or( Graph, Graph ); 315 extern Graph Cat( Graph, Graph ); 316 extern Graph makeOpt( Graph, int, char *); 317 extern Graph makeBlk( Graph, int, char *); 318 extern Graph makeLoop( Graph, int, char *); 319 extern Graph makePlus( Graph, int, char *); 320 extern Graph emptyAlt( void ); 321 extern Graph emptyAlt3( void ); 322 extern TokNode * newTokNode( void ); 323 extern RuleRefNode * newRNode( void ); 324 extern Junction * newJunction( void ); 325 extern ActionNode * newActionNode( void ); 326 extern char * makelocks( void ); 327 extern void preorder( Tree * ); 328 extern Tree * tnode( int ); 329 extern void _Tfree( Tree * ); 330 extern Tree * tdup( Tree * ); 331 extern int is_single_tuple( Tree * ); 332 extern Tree * tappend( Tree *, Tree * ); 333 extern void Tfree( Tree * ); 334 extern Tree * tlink( Tree *, Tree *, int ); 335 extern Tree * tshrink( Tree * ); 336 extern Tree * tflatten( Tree * ); 337 extern Tree * tJunc( Junction *, int, set * ); 338 extern Tree * tRuleRef( RuleRefNode *, int, set * ); 339 extern Tree * tToken( TokNode *, int, set * ); 340 extern Tree * tAction( ActionNode *, int, set * ); 341 extern int tmember( Tree *, Tree * ); 342 extern int tmember_constrained( Tree *, Tree * ); 343 extern Tree * tleft_factor( Tree * ); 344 extern Tree * trm_perm( Tree *, Tree * ); 345 extern void tcvt( set *, Tree * ); 346 extern Tree * permute( int, int ); 347 extern Tree * VerifyAmbig( Junction *, Junction *, unsigned **, set *, Tree **, Tree **, int * ); 348 extern set rJunc( Junction *, int, set * ); 349 extern set rRuleRef( RuleRefNode *, int, set * ); 350 extern set rToken( TokNode *, int, set * ); 351 extern set rAction( ActionNode *, int, set * ); 352 extern void HandleAmbiguity( Junction *, Junction *, Junction *, int ); 353 extern set First( Junction *, int, int, int * ); 354 extern void freeBlkFsets( Junction * ); 355 extern void genAction( ActionNode * ); 356 extern void genRuleRef( RuleRefNode * ); 357 extern void genToken( TokNode * ); 358 extern void genOptBlk( Junction * ); 359 extern void genLoopBlk( Junction *, Junction *, Junction *, int ); 360 extern void genLoopBegin( Junction * ); 361 extern void genPlusBlk( Junction * ); 362 extern void genSubBlk( Junction * ); 363 extern void genRule( Junction * ); 364 extern void genJunction( Junction * ); 365 extern void genEndBlk( Junction * ); 366 extern void genEndRule( Junction * ); 367 extern void genHdr( int ); 368 extern void genHdr1( int ); 369 extern void dumpAction( char *, FILE *, int, int, int, int ); 370 extern void dumpActionPlus(ActionNode*, char *, FILE *, int, int, int, int ); /* MR21 */ 371 extern Entry ** newHashTable( void ); 372 extern Entry * hash_add( Entry **, char *, Entry * ); 373 extern Entry * hash_get( Entry **, char * ); 374 extern void hashStat( Entry ** ); 375 extern char * mystrdup( char * ); 376 extern void genLexDescr( void ); 377 extern void dumpLexClasses( FILE * ); 378 extern void genDefFile( void ); 379 extern void DumpListOfParmNames( char *, FILE *, int ); /* MR5 janm 26-May-97 */ 380 extern int DumpNextNameInDef( char **, FILE * ); 381 extern void DumpOldStyleParms( char *, FILE * ); 382 extern void DumpType( char *, FILE * ); 383 extern int strmember( char *, char * ); 384 /* extern int HasComma( char * ); MR23 Replaced by hasMultipleOperands() */ 385 extern void DumpRetValStruct( FILE *, char *, int ); 386 extern char * StripQuotes( char * ); 387 extern int main( int, char *[] ); 388 extern void readDescr( void ); 389 extern FILE * NextFile( void ); 390 extern char * outnameX( char *, char *); 391 extern char * outname( char * ); 392 extern void fatalFL( char *, char *, int ); 393 extern void fatal_intern( char *, char *, int ); 394 extern void cleanUp( void ); 395 extern char * eMsg3( char *, char *, char *, char * ); 396 extern char * eMsgd( char *, int ); 397 extern char * eMsgd2( char *, int, int ); 398 extern void s_fprT( FILE *, set ); 399 extern char * TerminalString( int ); 400 extern void lexclass( char * ); 401 extern void lexmode( int ); 402 extern int LexClassIndex( char * ); 403 extern int hasAction( char * ); 404 extern void setHasAction( char *, char * ); 405 extern int addTname( char * ); 406 extern int addTexpr( char * ); 407 extern int Tnum( char * ); 408 extern void Tklink( char *, char * ); 409 extern Entry * newEntry( char *, int ); 410 extern void list_add( ListNode **, void * ); 411 extern void list_free( ListNode **, int freeData ); /* MR10 */ 412 extern void list_apply( ListNode *, void (*)(void *) ); 413 extern int list_search_cstring (ListNode *, char *); /* MR27 */ 414 extern char * Fkey( char *, int, int ); 415 extern void FoPush( char *, int ); 416 extern void FoPop( int ); 417 extern void RegisterCycle( char *, int ); 418 extern void ResolveFoCycles( int ); 419 extern void pJunc( Junction * ); 420 extern void pRuleRef( RuleRefNode * ); 421 extern void pToken( TokNode * ); 422 extern void pAction( ActionNode * ); 423 extern void FoLink( Node * ); 424 extern void addFoLink( Node *, char *, Junction * ); 425 extern void GenCrossRef( Junction * ); 426 extern void defErr( char *, long, long, long, long, long, long ); 427 extern void genStdPCCTSIncludeFile(FILE *,char *); /* MR10 */ 428 extern char * pcctsBaseName(char *); /* MR32 */ 429 extern Predicate *find_predicates(Node *); /* MR10 */ 430 extern Predicate *MR_find_predicates_and_supp(Node *); /* MR13 */ 431 extern int predicateLookaheadDepth(ActionNode *); /* MR10 */ 432 extern void predicate_free(Predicate *); /* MR10 */ 433 extern Predicate * predicate_dup(Predicate *); /* MR10 */ 434 extern Predicate * predicate_dup_without_context(Predicate *); /* MR11 */ 435 extern void GenRulePrototypes(FILE *, Junction *); 436 extern Junction *first_item_is_guess_block(Junction *); 437 extern Junction *first_item_is_guess_block_extra(Junction * q); /* MR30 */ 438 extern Junction *analysis_point(Junction *); 439 extern Tree *make_tree_from_sets(set *, set *); 440 extern Tree *tdup_chain(Tree *); 441 extern Tree *tdif(Tree *, Predicate *, set *, set *); 442 extern set covered_set(Predicate *); 443 extern void AmbiguityDialog(Junction *, int, Junction *, Junction *, int *, int *); 444 extern void dumpAmbigMsg(set *, FILE *, int); 445 extern void GenRuleFuncRedefs(FILE *, Junction *); 446 extern void GenPredefinedSymbolRedefs(FILE *); 447 extern void GenASTSymbolRedefs(FILE *); 448 extern void GenRemapFile(void); 449 extern void GenSetRedefs(FILE *); 450 extern ForcedToken *newForcedToken(char *, int); 451 extern void RemapForcedTokens(void); 452 extern char *TokenOrExpr(int); 453 extern void setUpperRange(TokNode *, char *); 454 extern void GenParser_c_Hdr(void); 455 extern void GenParser_h_Hdr(void); 456 extern void GenRuleMemberDeclarationsForCC(FILE *, Junction *); 457 extern int addForcedTname( char *, int ); 458 extern char *OutMetaName(char *); 459 extern void OutFirstSetSymbol(Junction *q, char *); /* MR21 */ 460 extern void warnNoFL(char *err); 461 extern void warnFL(char *err,char *f,int l); 462 extern void warn(char *err); 463 extern void warnNoCR( char *err ); 464 extern void errNoFL(char *err); 465 extern void errFL(char *err,char *f,int l); 466 extern void err(char *err); 467 extern void errNoCR( char *err ); 468 extern void genPredTree( Predicate *p, Node *j, int ,int); 469 extern UserAction *newUserAction(char *); 470 extern char *gate_symbol(char *name); 471 extern char *makeAltID(int blockid, int altnum); 472 extern void DumpRemainingTokSets(void); 473 extern void DumpANSIFunctionArgDef(FILE *f, Junction *q, int bInit); /* MR23 */ 474 extern void DumpFormals(FILE *, char *, int bInit); /* MR23 */ 475 extern char* hideDefaultArgs(const char* pdecl); /* MR22 VHS */ 476 extern Predicate *computePredFromContextGuard(Graph,int *msgDone); /* MR21 */ 477 extern void recomputeContextGuard(Predicate *); /* MR13 */ 478 extern Predicate *new_pred(void); 479 extern void chkGTFlag(void); 480 extern void leAdd(LabelEntry *); /* MR7 */ 481 extern void leFixup(void); /* MR7 */ 482 extern void egAdd(ExceptionGroup *); /* MR7 */ 483 extern void egFixup(void); /* MR7 */ 484 extern void altAdd(Junction *); /* MR7 */ 485 extern void altFixup(void); /* MR7 */ 486 extern Predicate * MR_find_in_aSubBlk(Junction *alt); /* MR10 */ 487 extern Predicate * MR_predFlatten(Predicate *p); /* MR10 */ 488 extern Predicate * MR_predSimplifyALL(Predicate *p); /* MR10 */ 489 extern Predicate * MR_predSimplifyALLX(Predicate *p,int skipPass3); /* MR10 */ 490 extern int MR_allPredLeaves(Predicate *p); /* MR10 */ 491 extern void MR_cleanup_pred_trees(Predicate *p); /* MR10 */ 492 extern int MR_predicate_context_completed(Predicate *p); /* MR10 */ 493 extern void MR_check_pred_too_long(Predicate *p,set completion); /* MR10 */ 494 extern Tree * MR_remove_epsilon_from_tree(Tree *t); /* MR10 */ 495 extern Tree * MR_computeTreeAND(Tree *l,Tree *r); /* MR10 */ 496 extern int MR_tree_equ(Tree *big, Tree *small); /* MR10 */ 497 extern set MR_First(int ck,Junction *j,set *incomplete); /* MR10 */ 498 extern set MR_compute_pred_set(Predicate *p); /* MR10 */ 499 extern Tree * MR_compute_pred_tree_context(Predicate *p); /* MR10 */ 500 extern int MR_pointerStackPush(PointerStack *,void *); /* MR10 */ 501 extern void * MR_pointerStackPop(PointerStack *); /* MR10 */ 502 extern void * MR_pointerStackTop(PointerStack *); /* MR10 */ 503 extern void MR_pointerStackReset(PointerStack *); /* MR10 */ 504 extern void MR_backTraceReport(void); /* MR10 */ 505 extern void MR_alphaBetaTraceReport(void); /* MR14 */ 506 extern void MR_dumpRuleSet(set); /* MR14 */ 507 extern void MR_predContextPresent(Predicate *p,int *,int *); /* MR10 */ 508 extern void MR_dumpPred(Predicate *p,int withContext); /* MR10 */ 509 extern void MR_dumpPred1(int,Predicate *p,int withContext); /* MR10 */ 510 extern void MR_xxxIndent(FILE *f,int depth); /* MR11 */ 511 extern void MR_outputIndent(int depth); /* MR11 */ 512 extern void MR_stderrIndent(int depth); /* MR11 */ 513 extern Junction * MR_ruleReferenced(RuleRefNode *rrn); /* MR10 */ 514 extern Junction * MR_nameToRuleBlk(char *); /* MR10 */ 515 extern void MR_releaseResourcesUsedInRule(Node *); /* MR10 */ 516 extern void MR_dumpTreeX(int depth,Tree *t,int across); /* MR10 */ 517 extern void MR_dumpTreeF(FILE *f,int depth,Tree *t,int across); /* MR10 */ 518 extern void DumpFcache(void); /* MR10 */ 519 extern void MR_dumpTokenSet(FILE *f,int depth,set s); /* MR10 */ 520 extern void MR_traceAmbSource(set *,Junction *,Junction *); /* MR11 */ 521 extern void MR_traceAmbSourceK(Tree *,Junction *a1,Junction *a2); /* MR11 */ 522 extern void MR_traceAmbSourceKclient(void); /* MR20 */ 523 extern Node *MR_advance(Node *); /* MR11 */ 524 extern int MR_offsetFromRule(Node *); /* MR11 */ 525 extern char *MR_ruleNamePlusOffset(Node *); /* MR11 */ 526 extern int MR_max_height_of_tree(Tree *); /* MR11 */ 527 extern int MR_all_leaves_same_height(Tree *,int); /* MR11 */ 528 extern void MR_projectTreeOntoSet(Tree *t,int k,set *); /* MR11 */ 529 extern Tree *MR_make_tree_from_set(set); /* MR11 */ 530 extern Predicate *MR_removeRedundantPredPass3(Predicate *); /* MR11 */ 531 extern void MR_pred_depth(Predicate *,int *); /* MR11 */ 532 extern int MR_comparePredicates(Predicate *,Predicate *); /* MR11 */ 533 extern Predicate * MR_unfold(Predicate *); /* MR11 */ 534 extern void MR_simplifyInverted(Predicate *,int); /* MR11 */ 535 extern int MR_secondPredicateUnreachable /* MR11 */ 536 (Predicate *first,Predicate *second); /* MR11 */ 537 extern void MR_clearPredEntry(Predicate *); /* MR11 */ 538 extern void MR_orphanRules(FILE *); /* MR12 */ 539 extern void MR_merge_contexts(Tree *); /* MR12 */ 540 extern int ci_strequ(char *,char *); /* MR12 */ 541 extern void MR_guardPred_plainSet(ActionNode *anode,Predicate *); /* MR12c */ 542 extern void MR_suppressSearchReport(void); /* MR12c */ 543 extern Predicate * MR_suppressK(Node *,Predicate *); /* MR13 */ 544 extern void MR_backTraceDumpItem(FILE *,int skip,Node *n); /* MR13 */ 545 extern void MR_backTraceDumpItemReset(void); /* MR13 */ 546 extern Junction * MR_junctionWithoutP2(Junction *); /* MR13 */ 547 extern void MR_setConstrainPointer(set *); /* MR18 */ 548 extern void BlockPreambleOption(Junction *q, char * pSymbol); /* MR23 */ 549 extern char* getInitializer(char *); /* MR23 */ 550 extern char *endFormal(char *pStart, /* MR23 */ 551 char **ppDataType, /* MR23 */ 552 char **ppSymbol, /* MR23 */ 553 char **ppEqualSign, /* MR23 */ 554 char **ppValue, /* MR23 */ 555 char **ppSeparator, /* MR23 */ 556 int *pNext); /* MR23 */ 557 extern char *strBetween(char *pStart, /* MR23 */ 558 char *pNext, /* MR23 */ 559 char *pStop); /* MR23 */ 560 extern int hasMultipleOperands(char *); /* MR23 */ 561 extern void DumpInitializers(FILE*, RuleEntry*, char*); /* MR23 */ 562 extern int isTermEntryTokClass(TermEntry *); /* MR23 */ 563 extern int isEmptyAlt(Node *, Node *); /* MR23 */ 564 #else 565 extern int STRICMP(); 566 extern void istackreset(); 567 extern int istacksize(); 568 extern void pushint(); 569 extern int popint(); 570 extern int istackempty(); 571 extern int topint(); 572 extern void NewSetWd(); 573 extern void DumpSetWd(); 574 extern void DumpSetWdForC(); 575 extern void DumpSetWdForCC(); 576 extern void NewSet(); 577 extern void FillSet(); 578 extern void ComputeErrorSets(); 579 extern void ComputeTokSets(); 580 extern void SubstErrorClass(); 581 extern int DefErrSet(); 582 extern int DefErrSetForC(); 583 extern int DefErrSetForCC(); 584 extern int DefErrSet1(); 585 extern int DefErrSetForC1(); 586 extern int DefErrSetForCC1(); 587 extern int DefErrSetWithSuffix(); /* MR21 */ 588 extern void GenErrHdr(); 589 extern void dumpExpr(); 590 extern void addParm(); 591 extern Graph buildAction(); 592 extern Graph buildToken(); 593 extern Graph buildWildCard(); 594 extern Graph buildRuleRef(); 595 extern Graph Or(); 596 extern Graph Cat(); 597 extern Graph makeOpt(); 598 extern Graph makeBlk(); 599 extern Graph makeLoop(); 600 extern Graph makePlus(); 601 extern Graph emptyAlt(); 602 extern Graph emptyAlt3(); 603 extern TokNode * newTokNode(); 604 extern RuleRefNode * newRNode(); 605 extern Junction * newJunction(); 606 extern ActionNode * newActionNode(); 607 extern char * makelocks(); 608 extern void preorder(); 609 extern Tree * tnode(); 610 extern void _Tfree(); 611 extern Tree * tdup(); 612 extern int is_single_tuple(); 613 extern Tree * tappend(); 614 extern void Tfree(); 615 extern Tree * tlink(); 616 extern Tree * tshrink(); 617 extern Tree * tflatten(); 618 extern Tree * tJunc(); 619 extern Tree * tRuleRef(); 620 extern Tree * tToken(); 621 extern Tree * tAction(); 622 extern int tmember(); 623 extern int tmember_constrained(); 624 extern Tree * tleft_factor(); 625 extern Tree * trm_perm(); 626 extern void tcvt(); 627 extern Tree * permute(); 628 extern Tree * VerifyAmbig(); 629 extern set rJunc(); 630 extern set rRuleRef(); 631 extern set rToken(); 632 extern set rAction(); 633 extern void HandleAmbiguity(); 634 extern set First(); 635 extern void freeBlkFsets(); 636 extern void genAction(); 637 extern void genRuleRef(); 638 extern void genToken(); 639 extern void genOptBlk(); 640 extern void genLoopBlk(); 641 extern void genLoopBegin(); 642 extern void genPlusBlk(); 643 extern void genSubBlk(); 644 extern void genRule(); 645 extern void genJunction(); 646 extern void genEndBlk(); 647 extern void genEndRule(); 648 extern void genHdr(); 649 extern void genHdr1(); 650 extern void dumpAction(); 651 extern void dumpActionPlus(); /* MR21 */ 652 extern Entry ** newHashTable(); 653 extern Entry * hash_add(); 654 extern Entry * hash_get(); 655 extern void hashStat(); 656 extern char * mystrdup(); 657 extern void genLexDescr(); 658 extern void dumpLexClasses(); 659 extern void genDefFile(); 660 extern void DumpListOfParmNames(); /* MR5 janm 26-May-97 */ 661 extern int DumpNextNameInDef(); 662 extern void DumpOldStyleParms(); 663 extern void DumpType(); 664 extern int strmember(); 665 /* extern int HasComma(); MR23 Replaced by hasMultipleOperands() */ 666 extern void DumpRetValStruct(); 667 extern char * StripQuotes(); 668 extern int main(); 669 extern void readDescr(); 670 extern FILE * NextFile(); 671 extern char * outnameX(); 672 extern char * outname(); 673 extern void fatalFL(); 674 extern void fatal_intern(); 675 extern void cleanUp(); 676 extern char * eMsg3(); 677 extern char * eMsgd(); 678 extern char * eMsgd2(); 679 extern void s_fprT(); 680 extern char * TerminalString(); 681 extern void lexclass(); 682 extern void lexmode(); 683 extern int LexClassIndex(); 684 extern int hasAction(); 685 extern void setHasAction(); 686 extern int addTname(); 687 extern int addTexpr(); 688 extern int Tnum(); 689 extern void Tklink(); 690 extern Entry * newEntry(); 691 extern void list_add(); 692 extern void list_free(); /* MR10 */ 693 extern void list_apply(); 694 extern int list_search_cstring (); /* MR27 */ 695 extern char * Fkey(); 696 extern void FoPush(); 697 extern void FoPop(); 698 extern void RegisterCycle(); 699 extern void ResolveFoCycles(); 700 extern void pJunc(); 701 extern void pRuleRef(); 702 extern void pToken(); 703 extern void pAction(); 704 extern void FoLink(); 705 extern void addFoLink(); 706 extern void GenCrossRef(); 707 extern void defErr(); 708 extern void genStdPCCTSIncludeFile(); 709 extern char * pcctsBaseName(); /* MR32 */ 710 extern Predicate *find_predicates(); 711 extern Predicate *MR_find_predicates_and_supp(); /* MR13 */ 712 extern int predicateLookaheadDepth(); /* MR10 */ 713 extern void predicate_free(); /* MR10 */ 714 extern Predicate * predicate_dup(); /* MR10 */ 715 extern Predicate * predicate_dup_without_context(); /* MR11 */ 716 extern void GenRulePrototypes(); 717 extern Junction *first_item_is_guess_block(); 718 extern Junction *first_item_is_guess_block_extra(); /* MR30 */ 719 extern Junction *analysis_point(); 720 extern Tree *make_tree_from_sets(); 721 extern Tree *tdup_chain(); 722 extern Tree *tdif(); 723 extern set covered_set(); 724 extern void AmbiguityDialog(); 725 extern void dumpAmbigMsg(); 726 extern void GenRuleFuncRedefs(); 727 extern void GenPredefinedSymbolRedefs(); 728 extern void GenASTSymbolRedefs(); 729 extern void GenRemapFile(); 730 extern void GenSetRedefs(); 731 extern ForcedToken *newForcedToken(); 732 extern void RemapForcedTokens(); 733 extern char *TokenOrExpr(); 734 extern void setUpperRange(); 735 extern void GenParser_c_Hdr(); 736 extern void GenParser_h_Hdr(); 737 extern void GenRuleMemberDeclarationsForCC(); 738 extern int addForcedTname(); 739 extern char *OutMetaName(); 740 extern void OutFirstSetSymbol(); /* MR21 */ 741 extern void warnNoFL(); 742 extern void warnFL(); 743 extern void warn(); 744 extern void warnNoCR(); 745 extern void errNoFL(); 746 extern void errFL(); 747 extern void err(); 748 extern void errNoCR(); 749 extern void genPredTree(); 750 extern UserAction *newUserAction(); 751 extern char *gate_symbol(); 752 extern char *makeAltID(); 753 extern void DumpRemainingTokSets(); 754 extern void DumpANSIFunctionArgDef(); 755 extern void DumpFormals(); /* MR23 */ 756 extern char* hideDefaultArgs(); /* MR22 VHS */ 757 extern Predicate *computePredFromContextGuard(); 758 extern void recomputeContextGuard(); /* MR13 */ 759 extern Predicate *new_pred(); 760 extern void chkGTFlag(); 761 extern void leAdd(); /* MR7 */ 762 extern void leFixup(); /* MR7 */ 763 extern void egAdd(); /* MR7 */ 764 extern void egFixup(); /* MR7 */ 765 extern void altAdd(); /* MR7 */ 766 extern void altFixup(); /* MR7 */ 767 extern Predicate * MR_find_in_aSubBlk(); /* MR10 */ 768 extern Predicate * MR_predFlatten(); /* MR10 */ 769 extern Predicate * MR_predSimplifyALL(); /* MR10 */ 770 extern Predicate * MR_predSimplifyALLX(); /* MR10 */ 771 extern void MR_cleanup_pred_trees(); /* MR10 */ 772 extern int MR_allPredLeaves(); /* MR10 */ 773 extern int MR_predicate_context_completed(); /* MR10 */ 774 extern void MR_check_pred_too_long(); /* MR10 */ 775 extern Tree * MR_remove_epsilon_from_tree(); /* MR10 */ 776 extern Tree * MR_computeTreeAND(); /* MR10 */ 777 extern int MR_tree_equ(); /* MR10 */ 778 extern set MR_First(); /* MR10 */ 779 extern set MR_compute_pred_set(); /* MR10 */ 780 extern Tree * MR_compute_pred_tree_context(); /* MR10 */ 781 extern int MR_pointerStackPush(); /* MR10 */ 782 extern void * MR_pointerStackPop(); /* MR10 */ 783 extern void * MR_pointerStackTop(); /* MR10 */ 784 extern void MR_pointerStackReset(); /* MR10 */ 785 extern void MR_backTraceReport(); /* MR10 */ 786 extern void MR_alphaBetaTraceReport(); /* MR14 */ 787 extern void MR_dumpRuleSet(); /* MR14 */ 788 extern void MR_predContextPresent(); /* MR10 */ 789 extern void MR_dumpPred(); /* MR10 */ 790 extern void MR_dumpPred1(); /* MR10 */ 791 extern void MR_xxxIndent(); /* MR11 */ 792 extern void MR_stderrIndent(); /* MR11 */ 793 extern void MR_outputIndent(); /* MR11 */ 794 extern Junction * MR_ruleReferenced(); /* MR10 */ 795 extern void MR_releaseResourcesUsedInRule(); /* MR10 */ 796 extern void MR_dumpTreeX(); /* MR10 */ 797 extern void MR_dumpTreeF(); /* MR10 */ 798 extern void DumpFcache(); /* MR10 */ 799 extern void MR_dumpTokenSet(); /* MR10 */ 800 extern void MR_traceAmbSource(); /* MR11 */ 801 extern Node *MR_advance(); /* MR11 */ 802 extern int MR_offsetFromRule(); /* MR11 */ 803 extern char *MR_ruleNamePlusOffset(); /* MR11 */ 804 extern void MR_traceAmbSourceK(); /* MR11 */ 805 extern void MR_traceAmbSourceKclient(); /* [i_a] added */ 806 extern int MR_max_height_of_tree(); /* MR11 */ 807 extern int MR_all_leaves_same_height(); /* MR11 */ 808 extern void MR_projectTreeOntoSet(); /* MR11 */ 809 extern Tree *MR_make_tree_from_set(); /* MR11 */ 810 extern Predicate *MR_removeRedundantPredPass3(); /* MR11 */ 811 extern void MR_pred_depth(); /* MR11 */ 812 extern int MR_comparePredicates(); /* MR11 */ 813 extern Predicate * MR_unfold(); /* MR11 */ 814 extern void MR_simplifyInverted(); /* MR11 */ 815 extern int MR_secondPredicateUnreachable(); /* MR11 */ 816 extern Junction * MR_nameToRuleBlk(); /* MR10 */ 817 extern void MR_clearPredEntry(); /* MR11 */ 818 extern void MR_orphanRules(); /* MR12 */ 819 extern void MR_merge_contexts(); /* MR12 */ 820 extern int ci_strequ(); /* MR12 */ 821 extern void MR_guardPred_plainSet(); /* MR12c */ 822 extern void MR_suppressSearchReport(); /* MR12c */ 823 extern Predicate * MR_suppressK(); /* MR13 */ 824 extern void MR_backTraceDumpItem(); /* MR13 */ 825 extern void MR_backTraceDumpItemReset(); /* MR13 */ 826 extern Junction * MR_junctionWithoutP2(); /* MR13 */ 827 extern void MR_setConstrainPointer(); /* MR18 */ 828 extern void BlockPreambleOption(); /* MR23 */ 829 extern char* getInitializer(); /* MR23 */ 830 extern int hasMultipleOperands(); /* MR23 */ 831 extern char *endFormal(); /* MR23 */ 832 extern char *strBetween(); /* MR23 */ 833 extern void DumpInitializers(); /* MR23 */ 834 extern int isTermEntryTokClass(); /* MR23 */ 835 extern int isEmptyAlt(); 836 837 #endif 838 839 #ifdef __USE_PROTOS 840 #include <stdlib.h> 841 #endif 842 843 /* MR20 G. Hobbelt Create proper externs for dlg variables */ 844 845 extern set attribsRefdFromAction; 846 extern int inAlt; 847 extern int UsedOldStyleAttrib; 848 extern int UsedNewStyleLabel; 849 850 #define MAX_BLK_LEVEL 100 /* MR23 */ 851 extern int CurBlockID_array[MAX_BLK_LEVEL]; /* MR23 */ 852 extern int CurAltNum_array[MAX_BLK_LEVEL]; /* MR23 */ 853