Main Page Class Hierarchy Compound List File List Compound Members File Members

# cmt_generator.cxx File Reference

`#include <errno.h>`
`#include <stdio.h>`
`#include <unistd.h>`
`#include "cmt_use.h"`
`#include "cmt_fragment.h"`
`#include "cmt_symbol.h"`
`#include "cmt_system.h"`
`#include "cmt.h"`
`#include "cmt_deps_builder.h"`
`#include "cmt_generator.h"`
`#include "cmt_constituent.h"`
`#include "cmt_language.h"`
`#include "cmt_awk.h"`

Include dependency graph for cmt_generator.cxx:

Go to the source code of this file.

## Compounds
class | DependencyFilter
class | MakefileGenerator
class | Packager
class | Prototyper
class | SourceFile
class | WinDefAwk
## Functions
Variable | DOCPATH ("DOCPATH")
Variable | PACKAGEPATH ("PACKAGEPATH")
Variable | PACKAGEPREFIX ("PACKAGEPREFIX")
Variable | PACKAGE ("PACKAGE")
Variable | VERSION ("VERSION")
Variable | MGRSTYLE ("MGRSTYLE")
Variable | TITLE ("TITLE")
Variable | GROUP ("GROUP")
Variable | CONSTITUENT ("CONSTITUENT")
Variable | CONSTITUENTSUFFIX ("CONSTITUENTSUFFIX")
Variable | LIBRARYSUFFIX ("LIBRARYSUFFIX")
Variable | USER ("USER")
Variable | DATE ("DATE")
Variable | PROTOTARGET ("PROTOTARGET")
Variable | OBJS ("OBJS")
Variable | CLASSES ("CLASSES")
Variable | PROTOSTAMPS ("PROTOSTAMPS")
Variable | NAME ("NAME")
Variable | FILEPATH ("FILEPATH")
Variable | FILESUFFIX ("FILESUFFIX")
Variable | SUFFIX ("SUFFIX")
Variable | FILENAME ("FILENAME")
Variable | LINKMACRO ("LINKMACRO")
Variable | LINE ("LINE")
Variable | ADDINCLUDE ("ADDINCLUDE")
Variable | FULLNAME ("FULLNAME")
Variable | OUTPUTNAME ("OUTPUTNAME")
Variable | ALLOS9SOURCES ("ALLOS9SOURCES")
Variable | NODEBUGUSELINKOPTS ("NODEBUGUSELINKOPTS")
Variable | DEBUGUSELINKOPTS ("DEBUGUSELINKOPTS")
Variable | USEINCLUDES ("USEINCLUDES")
FragmentHandle | buildproto_fragment ("buildproto")
FragmentHandle | dependencies_fragment ("dependencies")
FragmentHandle | dependencies_and_triggers_fragment ("dependencies_and_triggers")
FragmentHandle | make_header_fragment ("make_header")
FragmentHandle | library_header_fragment ("library_header")
FragmentHandle | application_header_fragment ("application_header")
FragmentHandle | document_header_fragment ("document_header")
FragmentHandle | java_header_fragment ("java_header")
FragmentHandle | jar_header_fragment ("jar_header")
FragmentHandle | protos_header_fragment ("protos_header")
FragmentHandle | library_fragment ("library")
FragmentHandle | library_no_share_fragment ("library_no_share")
FragmentHandle | application_fragment ("application")
FragmentHandle | jar_fragment ("jar")
FragmentHandle | java_fragment ("java")
FragmentHandle | cleanup_header_fragment ("cleanup_header")
FragmentHandle | cleanup_fragment ("cleanup")
FragmentHandle | cleanup_library_fragment ("cleanup_library")
FragmentHandle | cleanup_application_fragment ("cleanup_application")
FragmentHandle | cleanup_java_fragment ("cleanup_java")
FragmentHandle | cleanup_objects_fragment ("cleanup_objects")
FragmentHandle | dsw_header_fragment ("dsw_header")
FragmentHandle | dsw_project_fragment ("dsw_project")
FragmentHandle | dsw_all_project_header_fragment ("dsw_all_project_header")
FragmentHandle | dsw_all_project_dependency_fragment ("dsw_all_project_dependency")
FragmentHandle | dsw_all_project_trailer_fragment ("dsw_all_project_trailer")
FragmentHandle | dsw_trailer_fragment ("dsw_trailer")
FragmentHandle | dsp_all_fragment ("dsp_all")
FragmentHandle | dsp_library_header_fragment ("dsp_library_header")
FragmentHandle | dsp_application_header_fragment ("dsp_application_header")
FragmentHandle | dsp_windows_header_fragment ("dsp_windows_header")
FragmentHandle | dsp_contents_fragment ("dsp_contents")
FragmentHandle | dsp_trailer_fragment ("dsp_trailer")
FragmentHandle | make_setup_header_fragment ("make_setup_header")
FragmentHandle | make_setup_fragment ("make_setup")
FragmentHandle | constituents_header_fragment ("constituents_header")
FragmentHandle | group_fragment ("group")
FragmentHandle | constituent_fragment ("constituent")
FragmentHandle | constituents_trailer_fragment ("constituents_trailer")
FragmentHandle | readme_header_fragment ("readme_header")
FragmentHandle | readme_fragment ("readme")
FragmentHandle | readme_doc_fragment ("readme_doc")
FragmentHandle | readme_use_fragment ("readme_use")
FragmentHandle | readme_trailer_fragment ("readme_trailer")
FragmentHandle | check_application_fragment ("check_application")
FragmentHandle | check_java_fragment ("check_java")
FragmentHandle | check_application_header_fragment ("check_application_header")
void | filter_paths (cmt_string& text)
void | get_all_files (const cmt_string& full_name, CmtSystem::cmt_string_vector& files)
void | add_line_to_text (const cmt_string& line, cmt_string& text)
## Variables
MakefileGenerator | Context

## Function Documentation

Variable ADDINCLUDE ( | "ADDINCLUDE" )`[static]`

Variable ALLOS9SOURCES ( | "ALLOS9SOURCES" )`[static]`

Variable CLASSES ( | "CLASSES" )`[static]`

Variable CONSTITUENT ( | "CONSTITUENT" )`[static]`

Variable CONSTITUENTSUFFIX ( | "CONSTITUENTSUFFIX" )`[static]`

Variable DATE ( | "DATE" )`[static]`

Variable DEBUGUSELINKOPTS ( | "DEBUGUSELINKOPTS" )`[static]`

Variable DOCPATH ( | "DOCPATH" )`[static]`

Variable FILENAME ( | "FILENAME" )`[static]`

Variable FILEPATH ( | "FILEPATH" )`[static]`

Variable FILESUFFIX ( | "FILESUFFIX" )`[static]`

Variable FULLNAME ( | "FULLNAME" )`[static]`

Variable GROUP ( | "GROUP" )`[static]`

Variable LIBRARYSUFFIX ( | "LIBRARYSUFFIX" )`[static]`

Variable LINE ( | "LINE" )`[static]`

Variable LINKMACRO ( | "LINKMACRO" )`[static]`

Variable MGRSTYLE ( | "MGRSTYLE" )`[static]`

Variable NAME ( | "NAME" )`[static]`

Variable NODEBUGUSELINKOPTS ( | "NODEBUGUSELINKOPTS" )`[static]`

Variable OBJS ( | "OBJS" )`[static]`

Variable OUTPUTNAME ( | "OUTPUTNAME" )`[static]`

Variable PACKAGE ( | "PACKAGE" )`[static]`

Variable PACKAGEPATH ( | "PACKAGEPATH" )`[static]`

Variable PACKAGEPREFIX ( | "PACKAGEPREFIX" )`[static]`

Variable PROTOSTAMPS ( | "PROTOSTAMPS" )`[static]`

Variable PROTOTARGET ( | "PROTOTARGET" )`[static]`

Variable SUFFIX ( | "SUFFIX" )`[static]`

Variable TITLE ( | "TITLE" )`[static]`

Variable USEINCLUDES ( | "USEINCLUDES" )`[static]`

Variable USER ( | "USER" )`[static]`

Variable VERSION ( | "VERSION" )`[static]`

void add_line_to_text ( | const cmt_string & line,
| cmt_string & text )`[static]`

| Definition at line 2359 of file cmt_generator.cxx. Referenced by Generator::build_dependencies().
    02360 {
    02361   static const cmt_string empty;
    02362
    02363   int pos = line.find (" = ");
    02364   if (pos != cmt_string::npos)
    02365     {
    02366       static cmt_string key;
    02367       line.substr (0, pos + 3, key);
    02368       pos = text.find (key);
    02369       if (pos != cmt_string::npos)
    02370         {
    02371           // The key in line exists in text.
    02372           // Now check if the key is exactly the same.
    02373
    02374           if ((pos == 0) || (text[pos -1] == '\n'))
    02375             {
    02376               // The key is either in the first line or
    02377               // exactly matches '^key = ...'
    02378
    02379               int nl = text.find (pos, "\n");
    02380               if (nl != cmt_string::npos)
    02381                 {
    02382                   static cmt_string old;
    02383                   text.substr (pos, nl - pos + 1, old);
    02384                   text.replace (old, empty);
    02385                 }
    02386               else
    02387                 {
    02388                   text.erase (pos);
    02389                 }
    02390             }
    02391         }
    02392     }
    02393   if (line != "")
    02394     {
    02395       text += line;
    02396       text += "\n";
    02397     }
    02398 }

FragmentHandle application_fragment ( | "application" )`[static]`

FragmentHandle application_header_fragment ( | "application_header" )`[static]`

FragmentHandle buildproto_fragment ( | "buildproto" )`[static]`

FragmentHandle check_application_fragment ( | "check_application" )`[static]`

FragmentHandle check_application_header_fragment ( | "check_application_header" )`[static]`

FragmentHandle check_java_fragment ( | "check_java" )`[static]`

FragmentHandle cleanup_application_fragment ( | "cleanup_application" )`[static]`

FragmentHandle cleanup_fragment ( | "cleanup" )`[static]`

FragmentHandle cleanup_header_fragment ( | "cleanup_header" )`[static]`

FragmentHandle cleanup_java_fragment ( | "cleanup_java" )`[static]`

FragmentHandle cleanup_library_fragment ( | "cleanup_library" )`[static]`

FragmentHandle cleanup_objects_fragment ( | "cleanup_objects" )`[static]`

FragmentHandle constituent_fragment ( | "constituent" )`[static]`

FragmentHandle constituents_header_fragment ( | "constituents_header" )`[static]`

FragmentHandle constituents_trailer_fragment ( | "constituents_trailer" )`[static]`

FragmentHandle dependencies_and_triggers_fragment ( | "dependencies_and_triggers" )`[static]`

FragmentHandle dependencies_fragment ( | "dependencies" )`[static]`

FragmentHandle document_header_fragment ( | "document_header" )`[static]`

FragmentHandle dsp_all_fragment ( | "dsp_all" )`[static]`

FragmentHandle dsp_application_header_fragment ( | "dsp_application_header" )`[static]`

FragmentHandle dsp_contents_fragment ( | "dsp_contents" )`[static]`

FragmentHandle dsp_library_header_fragment ( | "dsp_library_header" )`[static]`

FragmentHandle dsp_trailer_fragment ( | "dsp_trailer" )`[static]`

FragmentHandle dsp_windows_header_fragment ( | "dsp_windows_header" )`[static]`

FragmentHandle dsw_all_project_dependency_fragment ( | "dsw_all_project_dependency" )`[static]`

FragmentHandle dsw_all_project_header_fragment ( | "dsw_all_project_header" )`[static]`

FragmentHandle dsw_all_project_trailer_fragment ( | "dsw_all_project_trailer" )`[static]`

FragmentHandle dsw_header_fragment ( | "dsw_header" )`[static]`

FragmentHandle dsw_project_fragment ( | "dsw_project" )`[static]`

FragmentHandle dsw_trailer_fragment ( | "dsw_trailer" )`[static]`

void filter_paths ( | cmt_string & text )`[static]`

| Definition at line 223 of file cmt_generator.cxx. Referenced by MakefileGenerator::analyze_document_file(), Generator::build_dependencies(), MakefileGenerator::build_document_makefile(), MakefileGenerator::build_library_makefile(), MakefileGenerator::module_file_action(), and MakefileGenerator::proto_file_action().
    00224 {
    00225   static CmtSystem::cmt_string_vector ps;
    00226
    00227   CmtSystem::split (text, " ", ps);
    00228
    00229   text = "";
    00230
    00231   for (int i = 0; i < ps.size (); i++)
    00232     {
    00233       cmt_string& s = ps[i];
    00234
    00235       CmtSystem::compress_path (s);
    00236
    00237         //cout << "   filter_paths " << s << endl;
    00238
    00239       if (i > 0) text += " ";
    00240       text += s;
    00241     }
    00242
    00243   text.replace_all ("./../src/", "$(src)");
    00244   text.replace_all (".\\..\\src\\", "$(src)");
    00245   text.replace_all ("../src/", "$(src)");
    00246   text.replace_all ("..\\src\\", "$(src)");
    00247   text.replace_all ("../doc/", "$(doc)");
    00248   text.replace_all ("..\\doc\\", "$(doc)");
    00249   text.replace_all ("$(src)$(src)", "$(src)");
    00250 }

void get_all_files ( | const cmt_string & full_name,
| CmtSystem::cmt_string_vector & files )`[static]`

| Definition at line 252 of file cmt_generator.cxx. Referenced by Generator::build_dependencies(), MakefileGenerator::build_document_makefile(), MakefileGenerator::build_library_makefile(), and Generator::build_msdev().
    00254 {
    00255   static cmt_string suffix;
    00256   static cmt_string name;
    00257
    00258   suffix = "";
    00259   name = "";
    00260
    00261   files.clear ();
    00262
    00263   CmtSystem::get_dot_suffix (full_name, suffix);
    00264
    00265   if (full_name.find ('*') != cmt_string::npos)
    00266     {
    00267       CmtSystem::scan_dir (full_name, files);
    00268
    00269       if (Cmt::get_debug ())
    00270         {
    00271           cout << "CMT> full_name=" << full_name <<
    00272             " pwd=" << CmtSystem::pwd () << endl;
    00273           cout << "CMT> files.size=" <<  files.size () << endl;
    00274         }
    00275
    00276       for (int j = 0; j < files.size (); j++)
    00277         {
    00278           cmt_string& n = files[j];
    00279           static cmt_string s;
    00280
    00281           CmtSystem::get_dot_suffix (n, s);
    00282           if (s != suffix)
    00283             {
    00284               n = "";
    00285             }
    00286         }
    00287     }
    00288   else
    00289     {
    00290       cmt_string& n = files.add ();
    00291
    00292       n = full_name;
    00293     }
    00294 }

FragmentHandle group_fragment ( | "group" )`[static]`

FragmentHandle jar_fragment ( | "jar" )`[static]`

FragmentHandle jar_header_fragment ( | "jar_header" )`[static]`

FragmentHandle java_fragment ( | "java" )`[static]`

FragmentHandle java_header_fragment ( | "java_header" )`[static]`

FragmentHandle library_fragment ( | "library" )`[static]`

FragmentHandle library_header_fragment ( | "library_header" )`[static]`

FragmentHandle library_no_share_fragment ( | "library_no_share" )`[static]`

FragmentHandle make_header_fragment ( | "make_header" )`[static]`

FragmentHandle make_setup_fragment ( | "make_setup" )`[static]`

FragmentHandle make_setup_header_fragment ( | "make_setup_header" )`[static]`

FragmentHandle protos_header_fragment ( | "protos_header" )`[static]`

FragmentHandle readme_doc_fragment ( | "readme_doc" )`[static]`

FragmentHandle readme_fragment ( | "readme" )`[static]`

FragmentHandle readme_header_fragment ( | "readme_header" )`[static]`

FragmentHandle readme_trailer_fragment ( | "readme_trailer" )`[static]`

FragmentHandle readme_use_fragment ( | "readme_use" )`[static]`

## Variable Documentation

MakefileGenerator Context`[static]`

| Definition at line 151 of file cmt_generator.cxx.