Public Methods |
|
| ? | Prototyper (bool static_functions=false) |
| void? | begin () |
| void? | filter (const cmt_string &line) |
| void? | end () |
Private Attributes |
|
| bool? | m_running |
| cmt_string? | m_out_file_name |
| FILE *? | m_output |
| bool? | m_static_functions |
| cmt_string? | m_full_line |
| cmt_string? | m_prev_line |
| cmt_string? | m_suffix |
| cmt_string? | m_define_suffix |
|
| ? |
Definition at line 1232 of file cmt_generators.cxx. References m_define_suffix, m_static_functions, and m_suffix. 01232 : 01233 m_static_functions(static_functions) 01234 { 01235 if (m_static_functions) 01236 { 01237 m_suffix = "_static.phnew"; 01238 m_define_suffix = "_static_ph"; 01239 } 01240 else 01241 { 01242 m_suffix = ".phnew"; 01243 m_define_suffix = "_ph"; 01244 } 01245 } |
|
| ? |
Reimplemented from Awk. Definition at line 1247 of file cmt_generators.cxx. References CmtSystem::basename(), cmt_string::c_str(), CmtSystem::file_separator(), CmtSystem::get_dot_suffix(), m_define_suffix, FAwk::m_dir_name, FAwk::m_file_name, m_out_file_name, m_output, m_running, m_suffix, and Awk::stop(). 01248 {
01249 m_running = false;
01250
01251 static cmt_string suffix;
01252 static cmt_string name;
01253
01254 CmtSystem::get_dot_suffix (m_file_name, suffix);
01255 CmtSystem::basename (m_file_name, suffix, name);
01256
01257 m_out_file_name = "";
01258
01259 if (m_dir_name != "")
01260 {
01261 m_out_file_name = m_dir_name;
01262 m_out_file_name += CmtSystem::file_separator ();
01263 }
01264
01265 m_out_file_name += name;
01266 m_out_file_name += m_suffix;
01267
01268 CmtSystem::basename (m_file_name, suffix, m_file_name);
01269
01270 m_output = fopen (m_out_file_name.c_str (), "wb");
01271
01272 if (m_output != 0)
01273 {
01274 fprintf (m_output, "#ifndef __%s%s__\n", m_file_name.c_str (),
01275 m_define_suffix.c_str ());
01276 fprintf (m_output, "#define __%s%s__\n", m_file_name.c_str (),
01277 m_define_suffix.c_str ());
01278
01279 fprintf (m_output, "\n");
01280 fprintf (m_output, "#ifdef __cplusplus\n");
01281 fprintf (m_output, "extern \"C\" {\n");
01282 fprintf (m_output, "#endif\n");
01283 fprintf (m_output, "\n");
01284 }
01285 else
01286 {
01287 stop ();
01288 }
01289 }
|
|
| ? |
Reimplemented from Awk. Definition at line 1359 of file cmt_generators.cxx. References CmtGenerator::check(), m_out_file_name, and m_output. 01360 {
01361 if (m_output != 0)
01362 {
01363 fprintf (m_output, "\n");
01364 fprintf (m_output, "#ifdef __cplusplus\n");
01365 fprintf (m_output, "}\n");
01366 fprintf (m_output, "#endif\n");
01367 fprintf (m_output, "\n");
01368 fprintf (m_output, "#endif\n");
01369 fprintf (m_output, "\n");
01370
01371 fclose (m_output);
01372 }
01373
01374 CmtGenerator::check (m_out_file_name);
01375 }
|
|
| ? |
Reimplemented from Awk. Definition at line 1291 of file cmt_generators.cxx. References cmt_string::c_str(), cmt_string::find(), m_full_line, m_output, m_prev_line, m_running, cmt_string::npos, cmt_string::replace(), and CmtSystem::split(). 01292 {
01293 char c = line[0];
01294
01295 if (!m_running)
01296 {
01297 if ((c == ' ') ||
01298 (c == '/') ||
01299 (c == '|') ||
01300 (c == '\t') ||
01301 (c == '#')) return;
01302 if (line.find ('(') == cmt_string::npos)
01303 {
01304 m_prev_line = line;
01305 return;
01306 }
01307
01308 m_running = true;
01309 m_full_line = line;
01310 m_full_line.replace ("(", " (");
01311
01312 static CmtSystem::cmt_string_vector words;
01313
01314 CmtSystem::split (m_full_line, " \t", words);
01315
01316 const cmt_string& second = words[1];
01317 if (second[0] == '(')
01318 {
01319 m_full_line = m_prev_line;
01320 m_full_line += " ";
01321 m_full_line += line;
01322
01323 m_prev_line = "";
01324 }
01325 }
01326 else
01327 {
01328 m_full_line += line;
01329 }
01330 if (line.find (')') == cmt_string::npos) return;
01331 m_running = false;
01332
01333 if (m_full_line.find (';') != cmt_string::npos) return;
01334 if (m_full_line.find ("::") != cmt_string::npos) return;
01335 if (m_full_line.find ('<') != cmt_string::npos) return;
01336 if (m_full_line.find ('>') != cmt_string::npos) return;
01337 if (m_full_line.find ('{') != cmt_string::npos) return;
01338 if (m_full_line.find ('}') != cmt_string::npos) return;
01339 if (m_full_line.find ("typedef") != cmt_string::npos) return;
01340 if (m_full_line.find ("yy") != cmt_string::npos) return;
01341 if (m_full_line.find ("YY") != cmt_string::npos) return;
01342 if (m_static_functions)
01343 {
01344 if (m_full_line.find ("static") == cmt_string::npos) return;
01345 }
01346 else
01347 {
01348 if (m_full_line.find ("static") != cmt_string::npos) return;
01349 }
01350
01351 m_full_line += ";";
01352
01353 if (m_output != 0)
01354 {
01355 fprintf (m_output, "%s\n", m_full_line.c_str ());
01356 }
01357 }
|
|
| ? |
Definition at line 1385 of file cmt_generators.cxx. Referenced by begin(), and Prototyper(). |
|
| ? |
Definition at line 1382 of file cmt_generators.cxx. Referenced by filter(). |
|
| ? |
Definition at line 1379 of file cmt_generators.cxx. |
|
| ? |
Definition at line 1380 of file cmt_generators.cxx. |
|
| ? |
Definition at line 1383 of file cmt_generators.cxx. Referenced by filter(). |
|
| ? |
Definition at line 1378 of file cmt_generators.cxx. |
|
| ? |
Definition at line 1381 of file cmt_generators.cxx. Referenced by Prototyper(). |
|
| ? |
Definition at line 1384 of file cmt_generators.cxx. Referenced by begin(), and Prototyper(). |