Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SourcePositionArchive Class Reference

SourcePositionArchive is the class held by the parsing code to create source position objects like SourcePosition and SourceFileNode. More...

#include <sparchive.h>

Collaboration diagram for SourcePositionArchive:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SourcePositionArchive (const TLString &path)
 ~SourcePositionArchive ()
SourcePosition GetPos (int line, int lpos=-1)
 Primary function: Request a SourcePosition for the passed location.

SourceFileNode IncludeFile (const TLString &path, int line, int lpos, filepos_t include_stmt_pos=-1, size_t include_stmt_len=0)
 Call when an include directive is read and reading continues in passed file.

SourceFileNode EndFile ()
 Call when EOF is reached to return to parent file.

SourceFileNode CurrentFile () const
 Get current file node:.

_InternalSourceFileNodeAllocISF (const TLString &path, SourceFileNode &parent)
void DestroyingISF (_InternalSourceFileNode *)
_InternalSourcePositionAllocISPNoCache (const SourceFileNode &fnode, int line, int lpos)
void DestroyingISP (_InternalSourcePosition *isp)

Private Member Functions

void _RecursiveDetachArchive (_InternalSourceFileNode *head)
 Recursively call _DetachArchive() for all InternalSourceFileNodes.

 SourcePositionArchive (const SourcePositionArchive &)
 NOT "C++-safe"; do not call these.

void operator= (const SourcePositionArchive &)

Private Attributes

SourceFileNode head
 Head of the input (include) file hierarchy.

SourceFileNode current
 The currently used SourceFileNode:.

int tot_file_nodes
int max_file_nodes
 Max number of file nodes allocated simultaniously:.

int curr_file_nodes
 Current number of file nodes:.

size_t tot_src_pos
 Some statistics about _InternalSourcePosition:.

size_t max_src_pos
size_t curr_src_pos

Detailed Description

SourcePositionArchive is the class held by the parsing code to create source position objects like SourcePosition and SourceFileNode.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
For more information, please read the comment in file sourcepos.h

This class is not 2C++-save", i.e. do not use copy constructor or assignment.

This class is not thread-safe; it is assumed that only one thread does the code scanning and hece needs a SourcePositionArchive to generate position information.

This class may be safely deleted after parsing is over; the generated objects all use reference counting and clean up themselves.

Definition at line 52 of file sparchive.h.


Constructor & Destructor Documentation

SourcePositionArchive::SourcePositionArchive const SourcePositionArchive  )  [private]
 

NOT "C++-safe"; do not call these.

SourcePositionArchive::SourcePositionArchive const TLString path  ) 
 

Definition at line 150 of file sparchive.cc.

References AllocISF(), curr_file_nodes, curr_src_pos, current, head, max_file_nodes, max_src_pos, SourceFileNode, tot_file_nodes, and tot_src_pos.

SourcePositionArchive::~SourcePositionArchive  ) 
 

Definition at line 168 of file sparchive.cc.

References _RecursiveDetachArchive(), current, head, max_file_nodes, max_src_pos, SourceFileNode, tot_file_nodes, and tot_src_pos.


Member Function Documentation

void SourcePositionArchive::_RecursiveDetachArchive _InternalSourceFileNode head  )  [private]
 

Recursively call _DetachArchive() for all InternalSourceFileNodes.

Definition at line 131 of file sparchive.cc.

References _InternalSourceFileNode::_DetachArchive(), _InternalSourceFileNode::down, LinkedList< _InternalSourceFileNode >::first(), LinkedListBase< _InternalSourceFileNode >::next, and SourceFileNode.

Referenced by ~SourcePositionArchive().

_InternalSourceFileNode * SourcePositionArchive::AllocISF const TLString path,
SourceFileNode parent
 

THESE ARE THOUGHT MAINLY FOR INTERNAL USE: Create an _InternalSourceFileNode / info about destruction.

Definition at line 25 of file sparchive.cc.

References curr_file_nodes, max_file_nodes, SourceFileNode, and tot_file_nodes.

Referenced by IncludeFile(), and SourcePositionArchive().

_InternalSourcePosition * SourcePositionArchive::AllocISPNoCache const SourceFileNode fnode,
int  line,
int  lpos
 

THESE ARE THOUGHT MAINLY FOR INTERNAL USE: Create _InternalSourcePosition / info about destruction.

Definition at line 54 of file sparchive.cc.

References curr_src_pos, max_src_pos, SourceFileNode, and tot_src_pos.

Referenced by GetPos().

SourceFileNode SourcePositionArchive::CurrentFile  )  const [inline]
 

Get current file node:.

Definition at line 123 of file sparchive.h.

References current, and SourceFileNode.

void SourcePositionArchive::DestroyingISF _InternalSourceFileNode  ) 
 

Definition at line 39 of file sparchive.cc.

References curr_file_nodes.

Referenced by _InternalSourceFileNode::~_InternalSourceFileNode().

void SourcePositionArchive::DestroyingISP _InternalSourcePosition isp  ) 
 

Definition at line 67 of file sparchive.cc.

References curr_src_pos.

SourceFileNode SourcePositionArchive::EndFile  ) 
 

Call when EOF is reached to return to parent file.

See also:
IncludeFile().
Returns:
new (current) source file node; normally not needed by caller.

Definition at line 94 of file sparchive.cc.

References Assert, current, and SourceFileNode.

SourcePosition SourcePositionArchive::GetPos int  line,
int  lpos = -1
 

Primary function: Request a SourcePosition for the passed location.

Parameters:
line,lpos: Position in the current FILE; use the constructor and IncludeFile()/EndFile() to set/change the current file.
Use lpos=-1 if not using lpos.

line<0 will return a NULL ref as position.

Definition at line 108 of file sparchive.cc.

References AllocISPNoCache(), Assert, current, and SourcePosition.

Referenced by _InternalFlexScannerBase::_MakeCurrEndLoc(), and _InternalFlexScannerBase::_MakeCurrLoc().

SourceFileNode SourcePositionArchive::IncludeFile const TLString path,
int  line,
int  lpos,
filepos_t  include_stmt_pos = -1,
size_t  include_stmt_len = 0
 

Call when an include directive is read and reading continues in passed file.

Use EndFile() when EOF is reached to return to parent file.

Parameters:
path: included file (path)
line,lpos: position of include directive in current file
include_stmt_pos,include_stmt_len: offset position and length of include directive (if needed)
Returns:
new (current) source file node; normally not needed by caller.

Definition at line 76 of file sparchive.cc.

References AllocISF(), Assert, current, filepos_t, _InternalSourceFileNode::include_stmt_len, _InternalSourceFileNode::include_stmt_pos, _InternalSourceFileNode::parent_include_line, _InternalSourceFileNode::parent_include_lpos, and SourceFileNode.

void SourcePositionArchive::operator= const SourcePositionArchive  )  [private]
 


Member Data Documentation

int SourcePositionArchive::curr_file_nodes [private]
 

Current number of file nodes:.

Definition at line 66 of file sparchive.h.

Referenced by AllocISF(), DestroyingISF(), and SourcePositionArchive().

size_t SourcePositionArchive::curr_src_pos [private]
 

Definition at line 71 of file sparchive.h.

Referenced by AllocISPNoCache(), DestroyingISP(), and SourcePositionArchive().

SourceFileNode SourcePositionArchive::current [private]
 

The currently used SourceFileNode:.

Definition at line 58 of file sparchive.h.

Referenced by CurrentFile(), EndFile(), GetPos(), IncludeFile(), SourcePositionArchive(), and ~SourcePositionArchive().

SourceFileNode SourcePositionArchive::head [private]
 

Head of the input (include) file hierarchy.

Definition at line 56 of file sparchive.h.

Referenced by SourcePositionArchive(), and ~SourcePositionArchive().

int SourcePositionArchive::max_file_nodes [private]
 

Max number of file nodes allocated simultaniously:.

Definition at line 64 of file sparchive.h.

Referenced by AllocISF(), SourcePositionArchive(), and ~SourcePositionArchive().

size_t SourcePositionArchive::max_src_pos [private]
 

Definition at line 70 of file sparchive.h.

Referenced by AllocISPNoCache(), SourcePositionArchive(), and ~SourcePositionArchive().

int SourcePositionArchive::tot_file_nodes [private]
 

Some statistics about SourceFileNode: Total amount of allocated file nodes:

Definition at line 62 of file sparchive.h.

Referenced by AllocISF(), SourcePositionArchive(), and ~SourcePositionArchive().

size_t SourcePositionArchive::tot_src_pos [private]
 

Some statistics about _InternalSourcePosition:.

Definition at line 69 of file sparchive.h.

Referenced by AllocISPNoCache(), SourcePositionArchive(), and ~SourcePositionArchive().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:35:39 2005 for Ray by doxygen 1.3.5