Include files

Top  Previous  Next

Examples > Unit_dependence > Include files


Everything is prepared for the decisive step now. If the name of a unit was found and it wasn't searched for the corresponding file yet, by the function find_file the unit is lloked up in the include directories.


  vstr::cursor cr = m_vIncludeDirs.getCursor();



    str sPath;


       throw CTT_Error(cr.value() + " is not a directory");

    if(find_file(cr.value(), change_extension(sInclude, ".pas"), sPath))




With change_extension the pas-extension is appended at the name, as for Pascal files usual. As a precaution at first with is_directory is checked whether the directory is available on your computer. If you haven't modified the directory list (see above) or cannot because no Pascal is installed presumably, then the program is stopped in this place.


If the search was successful, then the reference variable sPath contains the wanted path. By means of load_file the file is loaded into the string buf now. It is the whole point now that the unit production like a normal function can be called to parse the new text. It serves as an "sub-parser" with that:


unit(buf, ++xiLevel, sInclude);


While the unit production has only two parameters in the main parser, it still gets the additional text parameter as sub-parser for the call in first place. In the sub-parser for further included units now is searched just the same as before in the main parser.



This page belongs to the TextTransformer Documentation

Home  Content  German