Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

fileloc.c File Reference

#include "lclintMacros.nf"
#include "llbasic.h"
#include "fileIdList.h"
#include "portab.h"

Go to the source code of this file.

Functions

fileloc fileloc_decColumn (fileloc f, int x)
fileloc fileloc_noColumn (fileloc f)
void fileloc_subColumn (fileloc f, int x)
fileloc fileloc_copy (fileloc f)
fileloc fileloc_update ( fileloc old, fileloc fnew)
fileloc fileloc_updateFileId ( fileloc old, fileId s)
void fileloc_free ( fileloc f)
void fileloc_reallyFree ( fileloc f)
cstring fileloc_getBase (fileloc f)
bool fileloc_equal (fileloc f1, fileloc f2)
int fileloc_compare (fileloc f1, fileloc f2)
bool fileloc_withinLines (fileloc f1, fileloc f2, int n)
bool fileloc_lessthan (fileloc f1, fileloc f2)
bool fileloc_notAfter (fileloc f1, fileloc f2)
bool fileloc_isStandardLibrary (fileloc f)
bool fileloc_sameFile (fileloc f1, fileloc f2)
bool fileloc_sameModule (fileloc f1, fileloc f2)
bool fileloc_sameBaseFile (fileloc f1, fileloc f2)
bool fileloc_isSystemFile (fileloc f1)
bool fileloc_almostSameFile (fileloc f1, fileloc f2)
fileloc fileloc_fromTok (ltoken t)
fileloc fileloc_createLib (cstring ln)
fileloc fileloc_createRc (cstring name)
fileloc fileloc_createExternal (void)
fileloc fileloc_getExternal (void)
fileloc fileloc_observeBuiltin ()
fileloc fileloc_getBuiltin ()
fileloc fileloc_makePreproc (fileloc loc)
fileloc fileloc_makePreprocPrevious (fileloc loc)
fileloc fileloc_createBuiltin ()
fileloc fileloc_createImport (cstring fname, int lineno)
fileloc fileloc_createSpec (fileId fid, int line, int col)
fileloc fileloc_create (fileId fid, int line, int col)
cstring fileloc_filename (fileloc f)
cstring fileloc_unparseFilename (fileloc f)
int fileloc_lineno (fileloc f)
int fileloc_column (fileloc f)
cstring fileloc_unparse (fileloc f)
cstring fileloc_unparseRaw (cstring fname, int lineno)
cstring fileloc_unparseRawCol (cstring fname, int lineno, int col)
bool fileloc_isSpecialFile (fileloc f)
bool fileloc_isHeader (fileloc f)
bool fileloc_isSpec (fileloc f)
bool fileloc_isRealSpec (fileloc f)
bool fileloc_isRealLib (fileloc f)
bool fileloc_isLib (fileloc f)
bool fileloc_isStandardLib (fileloc f)
cstring fileloc_unparseDirect (fileloc fl)
bool fileloc_isUser (fileloc f)


Function Documentation

bool fileloc_almostSameFile ( fileloc f1,
fileloc f2 )
 

Definition at line 373 of file fileloc.c.

Referenced by flagMarker_sameFile().

00374 {
00375   if ((fileloc_isUndefined (f1) || (fileloc_isUndefined (f2)) 
00376        || (fileloc_isLib (f1)) || (fileloc_isLib (f2))))
00377     {
00378       return FALSE;
00379     }
00380   else
00381     {
00382       if (fileId_baseEqual (f1->fid, f2->fid))
00383         {
00384           return TRUE;
00385         }
00386       else if (fileTable_isSystemFile (context_fileTable (), f1->fid)
00387                || fileTable_isSystemFile (context_fileTable (), f2->fid))
00388         {
00389           return TRUE;
00390         }
00391       else if (fileTable_isSpecialFile (context_fileTable (), f1->fid)
00392                || fileTable_isSpecialFile (context_fileTable (), f2->fid))
00393         {
00394           return (cstring_equal (fileloc_getBase (f1), 
00395                                  fileloc_getBase (f2)));
00396         }
00397       else 
00398         {
00399           return FALSE;
00400         }
00401     }
00402 }

int fileloc_column ( fileloc f )
 

Definition at line 598 of file fileloc.c.

Referenced by filelocList_unparseUses().

00599 {
00600   return (fileloc_isDefined (f) ? f->column : -1);
00601 }

int fileloc_compare ( fileloc f1,
fileloc f2 )
 

Definition at line 224 of file fileloc.c.

00225 {
00226   if (fileloc_isUndefined (f1))
00227     {
00228       if (fileloc_isUndefined (f2)) return 0;
00229       return -1;
00230     }
00231   
00232   if (fileloc_isUndefined (f2))
00233     return 1;
00234 
00235   /*@access fileId@*/ 
00236   INTCOMPARERETURN (f1->fid, f2->fid); 
00237   /*@noaccess fileId@*/
00238 
00239   INTCOMPARERETURN (f1->column, f2->column);
00240   INTCOMPARERETURN (f1->lineno, f2->lineno); 
00241 
00242   return 0;
00243 }

fileloc fileloc_copy ( fileloc f )
 

Definition at line 104 of file fileloc.c.

Referenced by context_enterSuppressLine(), context_saveLocation(), declareCIter(), declareIter(), exprNode_createId(), exprNode_fromUIO(), exprNode_iterNewId(), fileloc_decColumn(), fileloc_noColumn(), fileloc_update(), flagMarker_createIgnoreCount(), flagMarker_createIgnoreOff(), flagMarker_createIgnoreOn(), flagMarker_createLocalSet(), flagMarker_createSuppress(), llbugaux(), o_fctInfo(), and uentry_nameCopy().

00105 {
00106   if (fileloc_isDefined (f))
00107     {
00108       if (fileloc_isBuiltin (f) || fileloc_isExternal (f))
00109         {
00110           /*
00111           ** Legitimate (spurious) errors reported since no copy
00112           ** is made.
00113           */
00114 
00115           /*@i3@*/ return f; /* No copy is necessary. */
00116         }
00117       else
00118         {
00119           return (fileloc_createPrim (f->kind, f->fid, f->lineno, f->column));
00120         }
00121     }
00122   else
00123     {
00124       return fileloc_undefined;
00125     }
00126 }

fileloc fileloc_create ( fileId fid,
int line,
int col )
 

Definition at line 557 of file fileloc.c.

Referenced by context_setFilename(), fileloc_fromTok(), and fileloc_updateFileId().

00558 {
00559   return (fileloc_createPrim (fileId_kind (fid), fid, line, col));
00560 }

fileloc fileloc_createBuiltin ( )
 

Definition at line 516 of file fileloc.c.

Referenced by main().

00517 {
00518   return (fileloc_createPrim (FL_BUILTIN, fileId_invalid, 0, 0)); 
00519 }

fileloc fileloc_createExternal ( void )
 

Definition at line 449 of file fileloc.c.

Referenced by coerceId(), uentry_makeUnrecognized(), uentry_mergeDefinition(), and uentry_reflectQualifiers().

00450 {
00451   /*@i@*/ return (fileloc_getExternal ()); 
00452 }

fileloc fileloc_createImport ( cstring fname,
int lineno )
 

Definition at line 523 of file fileloc.c.

Referenced by o_fctInfo().

00524 {
00525   fileId fid = fileTable_lookup (context_fileTable (), fname);
00526 
00527   if (!fileId_isValid (fid))
00528     {
00529       fid = fileTable_addImportFile (context_fileTable (), fname);
00530     }
00531 
00532   return (fileloc_createPrim (FL_IMPORT, fid, lineno, 0));
00533 }

fileloc fileloc_createLib ( cstring ln )
 

Definition at line 424 of file fileloc.c.

Referenced by loadStandardState(), and loadState().

00425 {
00426   flkind fk = FL_LIB;
00427   fileId fid = fileTable_lookup (context_fileTable (), ln);
00428 
00429   if (!fileId_isValid (fid))
00430     {
00431       fid = fileTable_addLibraryFile (context_fileTable (), ln);
00432     }
00433 
00434   if (cstring_equalPrefix (ln, SYSTEM_LIBDIR))
00435     {
00436       fk = FL_STDLIB;
00437     }
00438 
00439   return (fileloc_createPrim (fk, fid, 0, 0));
00440 }

fileloc fileloc_createRc ( cstring name )
 

Definition at line 442 of file fileloc.c.

Referenced by main().

00443 {
00444   fileId fid = fileTable_addFile (context_fileTable (), name);
00445 
00446   return (fileloc_createPrim (FL_RC, fid, 0, 0));
00447 }

fileloc fileloc_createSpec ( fileId fid,
int line,
int col )
 

Definition at line 551 of file fileloc.c.

00552 {
00553   return (fileloc_createPrim (FL_SPEC, fid, line, col));
00554 }

fileloc fileloc_decColumn ( fileloc f,
int x )
 

Definition at line 62 of file fileloc.c.

Referenced by fixModifiesId(), and fixSpecClausesId().

00063 {
00064   fileloc ret = fileloc_copy (f);
00065   if (x > 0 && fileloc_isDefined (ret))
00066     {
00067       llassertprint (ret->column > x, ("decColumn: %d", x));
00068       ret->column -= x;
00069     }
00070 
00071   return ret;
00072 }

bool fileloc_equal ( fileloc f1,
fileloc f2 )
 

Definition at line 215 of file fileloc.c.

Referenced by context_suppressFlagMsg(), uentry_mergeDefinition(), uentry_setDefined(), and uentry_showDefSpecInfo().

00216 {
00217   return ((f1 == f2)
00218           || (fileloc_isDefined (f1) && fileloc_isDefined (f2) 
00219               && ((f1->column == f2->column) && 
00220                   (f1->lineno == f2->lineno) && fileloc_sameFile (f1, f2))));
00221 }

cstring fileloc_filename ( fileloc f )
 

Definition at line 563 of file fileloc.c.

Referenced by usymtab_allUsed().

00564 {
00565   return (fileloc_isDefined (f)
00566           ? rootFileName (f->fid) : cstring_makeLiteralTemp ("<unknown>"));
00567 }

void fileloc_free ( fileloc f )
 

Definition at line 168 of file fileloc.c.

Referenced by context_destroyMod(), context_enterSuppressLine(), context_pushLoc(), context_saveLocation(), exprNode_createId(), exprNode_free(), exprNode_freeShallow(), exprNode_iterNewId(), filelocList_free(), filelocStack_clear(), filelocStack_free(), filelocStack_popPushFile(), fileloc_update(), fixModifiesId(), fixSpecClausesId(), lcllib_isSkipHeader(), llbugaux(), lltok_release(), main(), o_fctInfo(), uentry_checkDecl(), uentry_clearDecl(), uentry_makeUnrecognized(), uentry_makeVarFunction(), uentry_reflectQualifiers(), uentry_setDeclaredForceOnly(), and uentry_setDeclaredOnly().

00169 {
00170   if (fileloc_isDefined (f))
00171     {
00172       if (f != g_currentloc)
00173         {
00174           if (fileloc_isBuiltin (f) || fileloc_isExternal (f))
00175             {
00176               ; /* don't free */
00177             }
00178           else
00179             {
00180                       sfree (f);  
00181               /*@-branchstate@*/ 
00182             } 
00183         }
00184       else
00185         {
00186                 }
00187       /*@=branchstate@*/
00188     }
00189 }

fileloc fileloc_fromTok ( ltoken t )
 

Definition at line 406 of file fileloc.c.

Referenced by declareIter(), doDeclareConstant(), and doDeclareVar().

00407 {
00408   cstring fname = ltoken_fileName (t);
00409   fileId fid = fileTable_lookup (context_fileTable (), fname);
00410   fileloc fl;
00411 
00412   if (!fileId_isValid (fid))
00413     {
00414       fid = fileTable_addLCLFile (context_fileTable (), fname);
00415     }
00416   
00417   fl = fileloc_create (fid, (int) ltoken_getLine (t), (int) ltoken_getCol (t));
00418   
00419   return (fl);
00420 }

cstring fileloc_getBase ( fileloc f )
 

Definition at line 207 of file fileloc.c.

Referenced by context_addFileAccessType(), context_moduleName(), fileloc_almostSameFile(), fileloc_isStandardLibrary(), fileloc_sameModule(), macrocache_processFileElements(), and usymtab_exportLocal().

00208 {
00209   llassert (fileloc_isDefined (f));
00210 
00211   return (fileNameBase (f->fid));
00212 }

fileloc fileloc_getBuiltin ( )
 

Definition at line 471 of file fileloc.c.

Referenced by exprNode_initMod(), fileloc_observeBuiltin(), uentry_makeBoolDatatype(), and usymtab_initBool().

00472 {
00473   static /*@owned@*/ fileloc res = fileloc_undefined;
00474 
00475   if (res == fileloc_undefined)
00476     {
00477       res = fileloc_createPrim (FL_BUILTIN, fileId_invalid, 0, 0); 
00478     }
00479 
00480   return res;
00481 }

fileloc fileloc_getExternal ( void )
 

Definition at line 454 of file fileloc.c.

Referenced by fileloc_createExternal(), and processNamedDecl().

00455 {
00456   static /*@owned@*/ fileloc res = fileloc_undefined;
00457 
00458   if (res == fileloc_undefined) 
00459     {
00460       res = fileloc_createPrim (FL_EXTERNAL, fileId_invalid, 0, 0);
00461     }
00462 
00463   return res;
00464 }

bool fileloc_isHeader ( fileloc f )
 

Definition at line 741 of file fileloc.c.

Referenced by exprChecks_checkExport(), flagMarkerList_add(), and usymtab_exportHeader().

00742 {
00743   /* returns true if is not a .c file */
00744 
00745   return (fileloc_isDefined (f) && fileId_isValid (f->fid)
00746           && fileId_isHeader (f->fid));
00747 }

bool fileloc_isLib ( fileloc f )
 

Definition at line 765 of file fileloc.c.

Referenced by exprChecks_checkExport(), exprChecks_checkUsedGlobs(), exprNode_checkAllMods(), fileloc_almostSameFile(), fileloc_sameFile(), flagMarkerList_inIgnore(), flagMarkerList_suppressError(), macrocache_processUndefinedElements(), sRef_showNullInfo(), uentry_mergeDefinition(), uentry_setDeclared(), uentry_setDeclaredOnly(), uentry_setDefined(), uentry_showWhereLast(), usymtab_allDefined(), usymtab_allUsed(), and usymtab_displayAllUses().

00766 {
00767   return (fileloc_isDefined (f) 
00768           && (f->kind == FL_LIB || f->kind == FL_STDHDR || f->kind == FL_STDLIB));
00769 }

bool fileloc_isRealLib ( fileloc f )
 

Definition at line 760 of file fileloc.c.

Referenced by llbugaux().

00761 {
00762   return (fileloc_isDefined (f) && f->kind == FL_LIB);
00763 }

bool fileloc_isRealSpec ( fileloc f )
 

Definition at line 755 of file fileloc.c.

00756 {
00757   return (fileloc_isDefined (f) && (f->kind == FL_SPEC));
00758 }

bool fileloc_isSpec ( fileloc f )
 

Definition at line 749 of file fileloc.c.

Referenced by uentry_makeVariable().

00750 {
00751   return (fileloc_isDefined (f) && 
00752           (f->kind == FL_LIB || f->kind == FL_STDLIB || f->kind == FL_SPEC));
00753 }

bool fileloc_isSpecialFile ( fileloc f )
 

Definition at line 728 of file fileloc.c.

Referenced by context_setFilename(), filelocStack_includeDepth(), filelocStack_printIncludes(), usymtab_allUsed(), usymtab_exportHeader(), and usymtab_exportLocal().

00729 {
00730   if (fileloc_isDefined (f) 
00731       && fileId_isValid (f->fid))
00732     {
00733       return (fileTable_isSpecialFile (context_fileTable (), f->fid));
00734     }
00735   else
00736     {
00737       return FALSE;
00738     }
00739 }

bool fileloc_isStandardLib ( fileloc f )
 

Definition at line 771 of file fileloc.c.

00772 {
00773   return (fileloc_isDefined (f) && f->kind == FL_STDLIB);
00774 }

bool fileloc_isStandardLibrary ( fileloc f )
 

Definition at line 288 of file fileloc.c.

00289 {
00290   cstring s = fileloc_getBase (f);
00291 
00292   return (cstring_equalLit (s, LLSTDLIBS_NAME)
00293           || cstring_equalLit (s, LLSTRICTLIBS_NAME)
00294           || cstring_equalLit (s, LLUNIXLIBS_NAME)
00295           || cstring_equalLit (s, LLUNIXSTRICTLIBS_NAME)
00296           || cstring_equalLit (s, LLPOSIXSTRICTLIBS_NAME)
00297           || cstring_equalLit (s, LLPOSIXLIBS_NAME));
00298 }

bool fileloc_isSystemFile ( fileloc f1 )
 

Definition at line 360 of file fileloc.c.

Referenced by checkAnsiName().

00361 {
00362   if (fileloc_isDefined (f1)
00363       && !fileloc_isBuiltin (f1)
00364       && !fileloc_isExternal (f1))
00365     {
00366       return (fileTable_isSystemFile (context_fileTable (), f1->fid));
00367     }
00368 
00369   return FALSE;
00370 }

bool fileloc_isUser ( fileloc f )
 

Definition at line 790 of file fileloc.c.

Referenced by uentry_mergeDefinition(), uentry_showDefSpecInfo(), usymtab_allDefined(), and usymtab_allUsed().

00791 {
00792   return (fileloc_isDefined (f) 
00793           && f->kind == FL_NORMAL);
00794 }

bool fileloc_lessthan ( fileloc f1,
fileloc f2 )
 

Definition at line 257 of file fileloc.c.

00258 {
00259   /*@access fileId*/
00260   return ((fileloc_isDefined (f1) && fileloc_isDefined (f2))
00261           && ((f1->fid < f2->fid)
00262               || ((f1->fid == f2->fid)
00263                   && ((f1->lineno < f2->lineno)
00264                       || ((f1->lineno == f2->lineno)
00265                           && (f1->column < f2->column))))));
00266   /*@noaccess fileId*/
00267 }

int fileloc_lineno ( fileloc f )
 

Definition at line 592 of file fileloc.c.

00593 {
00594   return (fileloc_isDefined (f) ? f->lineno : -1);
00595 }

fileloc fileloc_makePreproc ( fileloc loc )
 

Definition at line 484 of file fileloc.c.

00485 {
00486   if (fileloc_isDefined (loc))
00487     {
00488       return (fileloc_createPrim (FL_PREPROC, loc->fid, 
00489                                   loc->lineno, loc->column));
00490     }
00491 
00492   return (fileloc_createPrim (FL_PREPROC, fileId_invalid, 0, 0));
00493 }

fileloc fileloc_makePreprocPrevious ( fileloc loc )
 

Definition at line 496 of file fileloc.c.

Referenced by lcllib_isSkipHeader().

00497 {
00498   if (fileloc_isDefined (loc))
00499     {
00500       if (loc->lineno > 1)
00501         {
00502           return (fileloc_createPrim (FL_PREPROC, loc->fid,
00503                                       loc->lineno - 1, 0));
00504         }
00505       else
00506         {
00507           return (fileloc_createPrim (FL_PREPROC, loc->fid,
00508                                       loc->lineno, 0));
00509         }
00510     }
00511 
00512   return (fileloc_createPrim (FL_PREPROC, fileId_invalid, 0, 0));
00513 }

fileloc fileloc_noColumn ( fileloc f )
 

Definition at line 75 of file fileloc.c.

00076 {
00077   if (fileloc_isDefined (f))
00078     {
00079       fileloc ret = fileloc_copy (f);
00080 
00081       if (fileloc_isDefined (ret))
00082         {
00083           ret->column = 0;
00084         }
00085 
00086       return ret;
00087     }
00088   else
00089     {
00090       return fileloc_undefined;
00091     }
00092 }

bool fileloc_notAfter ( fileloc f1,
fileloc f2 )
 

Definition at line 275 of file fileloc.c.

Referenced by flagMarkerList_add(), and flagMarker_beforeMarker().

00276 {
00277   /*@access fileId*/
00278   return ((fileloc_isDefined (f1) && fileloc_isDefined (f2))
00279           && ((f1->fid != f2->fid)
00280               || ((f1->lineno < f2->lineno)
00281                   || ((f1->lineno == f2->lineno)
00282                       && (f1->column <= f2->column)))));
00283   /*@noaccess fileId@*/
00284 }

fileloc fileloc_observeBuiltin ( )
 

Definition at line 466 of file fileloc.c.

00467 {
00468   /*@-onlytrans@*/ return (fileloc_getBuiltin ()); /*@=onlytrans@*/
00469 }

void fileloc_reallyFree ( fileloc f )
 

Definition at line 192 of file fileloc.c.

Referenced by loadStandardState(), loadState(), and main().

00193 {
00194   if (fileloc_isDefined (f))
00195     {
00196       if (fileloc_isBuiltin (f) || fileloc_isExternal (f))
00197         {
00198           ; /* don't free */
00199         }
00200       else
00201         {
00202           sfree (f);  
00203         /*@-branchstate@*/ } /*@=branchstate@*/
00204     }
00205 }

bool fileloc_sameBaseFile ( fileloc f1,
fileloc f2 )
 

Definition at line 344 of file fileloc.c.

Referenced by filelocStack_popPushFile().

00345 {
00346   if (fileloc_isUndefined (f1))
00347     {
00348       return (fileloc_isUndefined (f2));
00349     }
00350   else if (fileloc_isUndefined (f2))
00351     {
00352       return (FALSE);
00353     }
00354   else
00355     {
00356       return (fileId_baseEqual (f1->fid, f2->fid));
00357     }
00358 }

bool fileloc_sameFile ( fileloc f1,
fileloc f2 )
 

Definition at line 302 of file fileloc.c.

Referenced by fileloc_equal(), fileloc_sameModule(), fileloc_withinLines(), flagMarkerList_add(), and macrocache_processUndefinedElements().

00303 {
00304   if ((fileloc_isUndefined (f1) || (fileloc_isUndefined (f2)) 
00305        || (fileloc_isLib (f1)) || (fileloc_isLib (f2))))
00306     {
00307       return FALSE;
00308     }
00309   else
00310     {
00311       return (fileId_equal (f1->fid, f2->fid));
00312     }
00313 }

bool fileloc_sameModule ( fileloc f1,
fileloc f2 )
 

Definition at line 316 of file fileloc.c.

Referenced by filelocList_addDifferentFile(), and usymtab_exportLocal().

00317 {
00318   if (fileloc_isUndefined (f1))
00319     {
00320       return (fileloc_isUndefined (f2));
00321     }
00322   else if (fileloc_isUndefined (f2))
00323     {
00324       return (FALSE);
00325     }
00326   else
00327     {
00328       if (fileloc_isBuiltin (f1) || fileloc_isBuiltin (f2)
00329           || fileloc_isExternal (f1) || fileloc_isExternal (f2))
00330         {
00331           return fileloc_sameFile (f1, f2);
00332         }
00333       else
00334         {
00335           cstring s1 = fileloc_getBase (f1);
00336           cstring s2 = fileloc_getBase (f2);
00337           
00338           return (cstring_equal (s1, s2));
00339         }
00340     }
00341 }

void fileloc_subColumn ( fileloc f,
int x )
 

Definition at line 95 of file fileloc.c.

00096 {
00097   if (x > 0 && fileloc_isDefined (f))
00098     {
00099       llassert (f->column > x);
00100       f->column -= x;
00101     }
00102 }

cstring fileloc_unparse ( fileloc f )
 

Definition at line 604 of file fileloc.c.

Referenced by context_unparse(), filelocList_unparseUses(), llgenindentmsg(), llgenmsg(), uentry_unparseFull(), and usymtab_displayAllUses().

00605 {
00606   bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); 
00607 
00608   if (fileloc_isDefined (f))
00609     {
00610       switch (f->kind)
00611         {
00612         case FL_LIB:
00613           return (message ("load file %s", rootFileName (f->fid)));
00614         case FL_BUILTIN:
00615           return (cstring_makeLiteral ("Command Line"));
00616         case FL_IMPORT:
00617           if (parenFormat)
00618             {
00619               return (message ("import file %s(%d)", rootFileName (f->fid), f->lineno));
00620             }
00621           else
00622             {
00623               return (message ("import file %s:%d", rootFileName (f->fid), f->lineno));
00624             }
00625         case FL_PREPROC:
00626           if (parenFormat)
00627             {
00628               return (message ("%s(%d)", rootFileName (f->fid), f->lineno));
00629             }
00630           else
00631             {
00632               return (message ("%s:%d", rootFileName (f->fid), f->lineno));
00633             }
00634         case FL_EXTERNAL:
00635           return (cstring_makeLiteral ("<external>"));
00636         default:
00637           if (context_getFlag (FLG_SHOWCOL))
00638             {
00639               if (fileloc_linenoDefined (f))
00640                 {
00641                   if (fileloc_columnDefined (f))
00642                     {
00643                       if (parenFormat)
00644                         {
00645                           return (message ("%s(%d,%d)", 
00646                                            rootFileName (f->fid),
00647                                            f->lineno, f->column));
00648                         }
00649                       else
00650                         {
00651                           return (message ("%s:%d:%d", 
00652                                            rootFileName (f->fid),
00653                                            f->lineno, f->column));
00654                         }
00655                     }
00656                   else
00657                     {
00658                       if (parenFormat)
00659                         {
00660                           return (message ("%s(%d)", rootFileName (f->fid), f->lineno));
00661                         }
00662                       else
00663                         {
00664                           return (message ("%s:%d", rootFileName (f->fid), f->lineno));
00665                         }
00666                     }
00667                 }
00668               return (cstring_copy (rootFileName (f->fid)));
00669             }
00670           else if (fileloc_linenoDefined (f))
00671             {
00672               if (parenFormat)
00673                 {
00674                   return (message ("%s(%d)",
00675                                    rootFileName (f->fid), f->lineno));
00676                 }
00677               else
00678                 {
00679                   return (message ("%s:%d", rootFileName (f->fid), f->lineno));
00680                 }
00681             }
00682           else
00683             {
00684               return (cstring_copy (rootFileName (f->fid)));
00685             }
00686         }
00687     }
00688   return (cstring_makeLiteral ("< Location unknown >"));
00689 }

cstring fileloc_unparseDirect ( fileloc fl )
 

Definition at line 776 of file fileloc.c.

00777 {
00778   if (fileloc_isDefined (fl))
00779     {
00780       return (message ("%d:%d:%d",
00781                        /*@access fileId@*/ (int) fl->fid, /*@noaccess fileId@*/
00782                        fl->lineno, fl->column));
00783     }
00784   else
00785     {
00786       return (cstring_makeLiteral ("<undef>"));
00787     }
00788 }

cstring fileloc_unparseFilename ( fileloc f )
 

Definition at line 570 of file fileloc.c.

00571 {
00572   if (fileloc_isDefined (f))
00573     {
00574       switch (f->kind)
00575         {
00576         case FL_LIB:
00577           return (message ("load file %s", fileloc_filename (f)));
00578         case FL_BUILTIN:
00579           return (cstring_makeLiteral ("# builtin #"));
00580         case FL_IMPORT:
00581           return (message ("import file %s", fileloc_filename (f)));
00582         case FL_EXTERNAL:
00583           return (cstring_makeLiteral ("<external>"));
00584         default: 
00585           return (cstring_copy (fileloc_filename (f)));
00586         }
00587     }
00588   return cstring_undefined;
00589 }

cstring fileloc_unparseRaw ( cstring fname,
int lineno )
 

Definition at line 692 of file fileloc.c.

Referenced by fileloc_unparseRawCol(), llbugaux(), llquietbugaux(), o_fctInfo(), and printCodePoint().

00693 {
00694   bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); 
00695 
00696   if (parenFormat)
00697     {
00698       return (message ("%s(%d)", fname, lineno));
00699     }
00700   else
00701     {
00702       return (message ("%s:%d", fname, lineno));
00703     }
00704 }

cstring fileloc_unparseRawCol ( cstring fname,
int lineno,
int col )
 

Definition at line 707 of file fileloc.c.

00708 {
00709   if (context_getFlag (FLG_SHOWCOL)) 
00710     {
00711       bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); 
00712       
00713       if (parenFormat)
00714         {
00715           return (message ("%s(%d,%d)", fname, lineno, col));
00716         }
00717       else
00718         {
00719           return (message ("%s:%d:%d", fname, lineno, col));
00720         }
00721     }
00722   else
00723     {
00724       return fileloc_unparseRaw (fname, lineno);
00725     }
00726 }

fileloc fileloc_update ( fileloc old,
fileloc fnew )
 

Definition at line 128 of file fileloc.c.

Referenced by context_popLoc(), exprNode_addParens(), exprNode_assign(), exprNode_cast(), exprNode_concat(), exprNode_ifelse(), exprNode_makeInitBlock(), exprNode_postOp(), exprNode_preOp(), exprNode_switch(), exprNode_updateLocation(), uentry_clearDefined(), uentry_makeForwardFunction(), uentry_mergeDefinition(), uentry_setDeclared(), uentry_setDeclaredForce(), uentry_setDefined(), and uentry_setFunctionDefined().

00129 {
00130   if (fileloc_isUndefined (fnew))
00131     {
00132       fileloc_free (old);
00133       return fileloc_undefined;
00134     }
00135   else if (fileloc_isUndefined (old) || fileloc_isBuiltin (old) || fileloc_isExternal (old))
00136     {
00137       return (fileloc_copy (fnew));
00138     }
00139   else
00140     {
00141       old->kind   = fnew->kind;
00142       old->fid    = fnew->fid; 
00143       old->lineno = fnew->lineno;
00144       old->column = fnew->column;
00145 
00146       return old;
00147     }
00148 }

fileloc fileloc_updateFileId ( fileloc old,
fileId s )
 

Definition at line 150 of file fileloc.c.

Referenced by context_setFileId().

00151 {
00152   if (fileloc_isUndefined (old) || fileloc_isBuiltin (old) || fileloc_isExternal (old))
00153     {
00154       return (fileloc_create (s, 1, 1));
00155     }
00156   else
00157     {
00158       old->kind   = fileId_kind (s);
00159       old->fid    = s; 
00160       old->lineno = 1;
00161       old->column = 1;
00162 
00163       return old;
00164     }
00165 }

bool fileloc_withinLines ( fileloc f1,
fileloc f2,
int n )
 

Definition at line 246 of file fileloc.c.

Referenced by checkParseError(), and llbugaux().

00247 {
00248   
00249   return (fileloc_isDefined (f1) && 
00250           fileloc_isDefined (f2) &&
00251           ((f2->lineno <= f1->lineno + n) 
00252            && (f2->lineno >= f1->lineno)
00253            && fileloc_sameFile (f1, f2)));
00254 }


Generated at Fri Nov 3 18:57:58 2000 for LCLint by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000