00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "sourcefile.h"
00019 #include "spcache.h"
00020 #include "sparchive.h"
00021
00022
00023 TLString _InternalSourceFileNode::IncludeHierarchyStr() const
00024 {
00025 if(!this) return TLString();
00026
00027
00028 if(!up) return TLString();
00029
00030 TLString str;
00031 str+="In file \""+_path+"\" [is the following correct?? FIMXE?]";
00032
00033 for(const _InternalSourceFileNode *i=this; i->up; i=i->up)
00034 {
00035 str+=",\n\tincluded from "+i->up->_path;
00036 TLString loc;
00037 if(i->parent_include_line>=0 && i->parent_include_lpos>=0)
00038 { loc.sprintf(":%d:%d",i->parent_include_line,i->parent_include_lpos); }
00039 else if(i->parent_include_line>=0)
00040 { loc.sprintf(":%d",i->parent_include_line); }
00041 else if(i->parent_include_lpos>=0)
00042 { loc.sprintf(":???:%d",i->parent_include_lpos); }
00043 str+=loc;
00044 }
00045
00046 str+=":\n";
00047
00048 return(str);
00049 }
00050
00051
00052 SourceFileNode _InternalSourceFileNode::CreateSingleNode(const TLString &path)
00053 {
00054 _InternalSourceFileNode *ifn=new _InternalSourceFileNode(path,NULL,NULL);
00055 return(SourceFileNode(ifn));
00056 }
00057
00058
00059 void _InternalSourceFileNode::_DestroyPosCache()
00060 {
00061 if(!this) return;
00062
00063
00064
00065 DELETE(pos_cache);
00066 }
00067
00068
00069 _InternalSourceFileNode::_InternalSourceFileNode(const TLString &xpath,
00070 _InternalSourceFileNode *parent,SourcePositionArchive *_pos_archive) :
00071 InternalRefNodeBase_ThreadSave(),
00072 LinkedListBase<_InternalSourceFileNode>(),
00073 _path(xpath),
00074 down()
00075 {
00076 up=parent;
00077
00078 pos_archive=_pos_archive;
00079
00080 parent_include_line=-1;
00081 parent_include_lpos=-1;
00082 include_stmt_pos=-1;
00083 include_stmt_len=0;
00084
00085 if(pos_archive)
00086 { pos_cache=new SourcePositionCache(); }
00087 else
00088 { pos_cache=NULL; }
00089
00090 if(up)
00091 { up->_AddChild(this); }
00092 }
00093
00094 _InternalSourceFileNode::~_InternalSourceFileNode()
00095 {
00096
00097
00098 CritAssert(down.IsEmpty());
00099
00100
00101 if(up)
00102 {
00103 up->_DelChild(this);
00104 up=NULL;
00105 }
00106
00107
00108 DELETE(pos_cache);
00109
00110
00111 if(pos_archive)
00112 { pos_archive->DestroyingISF(this); }
00113 }