[1] | 1 | #ifndef __cmt_generator_h__ |
---|
| 2 | #define __cmt_generator_h__ |
---|
| 3 | |
---|
| 4 | #include "cmt_parser.h" |
---|
| 5 | #include "cmt_constituent.h" |
---|
| 6 | #include "cmt_language.h" |
---|
| 7 | #include "cmt_awk.h" |
---|
| 8 | #include "cmt_deps_builder.h" |
---|
| 9 | |
---|
| 10 | class Packager : public FAwk |
---|
| 11 | { |
---|
| 12 | public: |
---|
| 13 | void begin (); |
---|
| 14 | void filter (const cmt_string& line); |
---|
| 15 | cmt_string& package_name (); |
---|
| 16 | private: |
---|
| 17 | cmt_string m_package_name; |
---|
| 18 | }; |
---|
| 19 | |
---|
| 20 | class SourceFile |
---|
| 21 | { |
---|
| 22 | public: |
---|
| 23 | void set (const cmt_string name, Language& language, const cmt_string output); |
---|
| 24 | cmt_string name () const; |
---|
| 25 | Language& language () const; |
---|
| 26 | cmt_string output () const; |
---|
| 27 | |
---|
| 28 | private: |
---|
| 29 | cmt_string m_name; |
---|
| 30 | Language* m_language; |
---|
| 31 | cmt_string m_output; |
---|
| 32 | }; |
---|
| 33 | |
---|
| 34 | class CmtGenerator |
---|
| 35 | { |
---|
| 36 | public: |
---|
| 37 | |
---|
| 38 | CmtGenerator (); |
---|
| 39 | |
---|
| 40 | void reset (); |
---|
| 41 | bool prepare_output (const cmt_string& package, |
---|
| 42 | const Constituent& constituent); |
---|
| 43 | void commit (const cmt_string& name); |
---|
| 44 | static void check (const cmt_string& name); |
---|
| 45 | void terminate (); |
---|
| 46 | |
---|
| 47 | void fill_outputs (); |
---|
| 48 | |
---|
| 49 | void prepare_use_context (); |
---|
| 50 | |
---|
| 51 | void set_full_name (cmt_string& full_name, cmt_string& file); |
---|
| 52 | void filter_path (cmt_string& text); |
---|
| 53 | int get_all_files (const cmt_string& full_name, |
---|
| 54 | const cmt_vector<cmt_regexp>& exclude_exprs, |
---|
| 55 | const cmt_vector<cmt_regexp>& select_exprs, |
---|
| 56 | CmtSystem::cmt_string_vector& files); |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | public: |
---|
| 60 | cmt_string m_PACKINCLUDES; |
---|
| 61 | bool m_PACKOS9; |
---|
| 62 | |
---|
| 63 | cmt_string m_GENERATOR; |
---|
| 64 | |
---|
| 65 | bool is_library; |
---|
| 66 | bool is_application; |
---|
| 67 | |
---|
| 68 | cmt_string srcdir; |
---|
| 69 | cmt_string docdir; |
---|
| 70 | cmt_string cmtdir; |
---|
| 71 | cmt_string incdir; |
---|
| 72 | cmt_string src; |
---|
| 73 | cmt_string doc; |
---|
| 74 | cmt_string inc; |
---|
| 75 | cmt_string mgr; |
---|
| 76 | cmt_string cmt; |
---|
| 77 | cmt_string protos; |
---|
| 78 | cmt_string protonames; |
---|
| 79 | cmt_string os9sources; |
---|
| 80 | |
---|
| 81 | cmt_vector<SourceFile> m_source_files; |
---|
| 82 | |
---|
| 83 | cmt_string m_output_file_name; |
---|
| 84 | FILE* m_output_file; |
---|
| 85 | |
---|
| 86 | DepsBuilder m_deps_builder; |
---|
| 87 | |
---|
| 88 | Variable m_CONSTITUENT; |
---|
| 89 | Variable m_LINKMACRO; |
---|
| 90 | Variable m_DOCPATH; |
---|
| 91 | Variable m_PACKAGEPATH; |
---|
| 92 | Variable m_PACKAGEPREFIX; |
---|
| 93 | Variable m_PACKAGE; |
---|
| 94 | Variable m_VERSION; |
---|
| 95 | Variable m_MGRSTYLE; |
---|
| 96 | Variable m_TITLE; |
---|
| 97 | Variable m_GROUP; |
---|
| 98 | Variable m_CONSTITUENTSUFFIX; |
---|
| 99 | Variable m_LIBRARYSUFFIX; |
---|
| 100 | Variable m_USER; |
---|
| 101 | Variable m_DATE; |
---|
| 102 | Variable m_PROTOTARGET; |
---|
| 103 | Variable m_OBJS; |
---|
| 104 | Variable m_CLASSES; |
---|
| 105 | Variable m_PROTOSTAMPS; |
---|
| 106 | Variable m_NAME; |
---|
| 107 | Variable m_FILEPATH; |
---|
| 108 | Variable m_FILESUFFIX; |
---|
| 109 | Variable m_SUFFIX; |
---|
| 110 | Variable m_FILENAME; |
---|
| 111 | Variable m_LINE; |
---|
| 112 | Variable m_ADDINCLUDE; |
---|
| 113 | Variable m_FULLNAME; |
---|
| 114 | Variable m_DIRNAME; |
---|
| 115 | Variable m_OUTPUTNAME; |
---|
| 116 | Variable m_ALLOS9SOURCES; |
---|
| 117 | Variable m_NODEBUGUSELINKOPTS; |
---|
| 118 | Variable m_DEBUGUSELINKOPTS; |
---|
| 119 | Variable m_USEINCLUDES; |
---|
| 120 | }; |
---|
| 121 | |
---|
| 122 | class Generator |
---|
| 123 | { |
---|
| 124 | public: |
---|
| 125 | // Build the MSDEV workspace file |
---|
| 126 | static int build_msdev_workspace (const Constituent::ConstituentVector& constituents); |
---|
| 127 | |
---|
| 128 | // Build the MSDEV project file (one per constituent) |
---|
| 129 | static int build_msdev (const Constituent& constituent); |
---|
| 130 | |
---|
| 131 | // Build the VSNET workspace file |
---|
| 132 | static int build_vsnet_workspace (const Constituent::ConstituentVector& constituents); |
---|
| 133 | |
---|
| 134 | // Build the VSNET project file (one per constituent) |
---|
| 135 | static int build_vsnet (const Constituent& constituent); |
---|
| 136 | |
---|
| 137 | // Build the Make setup file |
---|
| 138 | static void build_make_setup (const cmt_string& package); |
---|
| 139 | |
---|
| 140 | // Build the constituents.make file |
---|
| 141 | static void build_constituents_makefile (const cmt_string& package); |
---|
| 142 | |
---|
| 143 | // Build the makefile fragment for one constituent |
---|
| 144 | static int build_constituent_makefile (const Constituent& constituent); |
---|
| 145 | static void build_constituent_makefile (const cmt_string& name); |
---|
| 146 | |
---|
| 147 | static void build_default_makefile (); |
---|
| 148 | |
---|
| 149 | // Build the dependencies for one module |
---|
| 150 | static void build_dependencies (const cmt_string& name, |
---|
| 151 | int argc, char* argv[]); |
---|
| 152 | |
---|
| 153 | // Build prototype file for one module |
---|
| 154 | static void build_prototype (const cmt_string& file_name); |
---|
| 155 | |
---|
| 156 | // Build README.html file |
---|
| 157 | static void build_readme (const CmtSystem::cmt_string_vector& arguments); |
---|
| 158 | |
---|
| 159 | // Build def files for Windows shared libraries |
---|
| 160 | static void build_windefs (const cmt_string& library_name); |
---|
| 161 | }; |
---|
| 162 | |
---|
| 163 | #endif |
---|