Containers and parameters

Top  Previous  Next

Examples > Unit_dependence > Containers and parameters

 

At first the program must be told, in which directories the units have to be to looked up.  So a Vector container is defined on the page for the class elements

 

vstr m_vIncludeDirs

 

The user has to add the according directories to this vector, before he starts the program. E.G.

 

m_vIncludeDirs.push_back("C:\\Programme\\Borland\\BDS\\4.0\\source\\Win32");

 

 

The found files must be noticed someplace. So a mstrstr container is defined:

 

mstrstr m_mUnitPaths

 

To every name of a unit as a key the accompanying path as value can be stored in this map. Then later can be found out easily whether a unit already was searched, when it appears again in another unit.

 

if(!m_mUnitPaths.containsKey(sInclude)

...

 

The case that the path isn't found also must be noticed to not look for it once more. Therefore there is a second map:

 

mstrnode m_mNotFoundUnits

 

Mstrnode is chosen here as a container type. Two strings which could be of interest can be stored to the node value at once: the unit, in which the not found unit was listed and a level parameter, which tells how many files must be opened to come to the unit from the original source file.

 

To attain these two information, the productions mentioned above must be provided with corresponding parameters.

 

int xiLevel, const str& xsLookedUpWhere

 

The first unit production is then called with the current values in the start rule:

 

unit_dependence ::=

{{

str sWhereFound = basename(SourceName());

}}

unit[0, sWhereFound]

 

 

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German