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 2691 of file cmt_generator.cxx. 02691 : 02692 m_static_functions(static_functions) 02693 { 02694 if (m_static_functions) 02695 { 02696 m_suffix = "_static.phnew"; 02697 m_define_suffix = "_static_ph"; 02698 } 02699 else 02700 { 02701 m_suffix = ".phnew"; 02702 m_define_suffix = "_ph"; 02703 } 02704 } |
|
Reimplemented from Awk. Definition at line 2706 of file cmt_generator.cxx. 02707 { 02708 m_running = false; 02709 02710 static cmt_string suffix; 02711 static cmt_string name; 02712 02713 CmtSystem::get_dot_suffix (m_file_name, suffix); 02714 CmtSystem::basename (m_file_name, suffix, name); 02715 02716 m_out_file_name = ""; 02717 02718 if (m_dir_name != "") 02719 { 02720 m_out_file_name = m_dir_name; 02721 m_out_file_name += CmtSystem::file_separator (); 02722 } 02723 02724 m_out_file_name += name; 02725 m_out_file_name += m_suffix; 02726 02727 CmtSystem::basename (m_file_name, suffix, m_file_name); 02728 02729 m_output = fopen (m_out_file_name.c_str (), "wb"); 02730 02731 if (m_output != 0) 02732 { 02733 fprintf (m_output, "#ifndef __%s%s__\n", m_file_name.c_str (), 02734 m_define_suffix.c_str ()); 02735 fprintf (m_output, "#define __%s%s__\n", m_file_name.c_str (), 02736 m_define_suffix.c_str ()); 02737 02738 fprintf (m_output, "\n"); 02739 fprintf (m_output, "#ifdef __cplusplus\n"); 02740 fprintf (m_output, "extern \"C\" {\n"); 02741 fprintf (m_output, "#endif\n"); 02742 fprintf (m_output, "\n"); 02743 } 02744 else 02745 { 02746 stop (); 02747 } 02748 } |
|
Reimplemented from Awk. Definition at line 2818 of file cmt_generator.cxx. 02819 { 02820 if (m_output != 0) 02821 { 02822 fprintf (m_output, "\n"); 02823 fprintf (m_output, "#ifdef __cplusplus\n"); 02824 fprintf (m_output, "}\n"); 02825 fprintf (m_output, "#endif\n"); 02826 fprintf (m_output, "\n"); 02827 fprintf (m_output, "#endif\n"); 02828 fprintf (m_output, "\n"); 02829 02830 fclose (m_output); 02831 } 02832 02833 Generator::check (m_out_file_name); 02834 } |
|
Reimplemented from Awk. Definition at line 2750 of file cmt_generator.cxx. 02751 { 02752 char c = line[0]; 02753 02754 if (!m_running) 02755 { 02756 if ((c == ' ') || 02757 (c == '/') || 02758 (c == '|') || 02759 (c == '\t') || 02760 (c == '#')) return; 02761 if (line.find ('(') == cmt_string::npos) 02762 { 02763 m_prev_line = line; 02764 return; 02765 } 02766 02767 m_running = true; 02768 m_full_line = line; 02769 m_full_line.replace ("(", " ("); 02770 02771 static CmtSystem::cmt_string_vector words; 02772 02773 CmtSystem::split (m_full_line, " \t", words); 02774 02775 const cmt_string& second = words[1]; 02776 if (second[0] == '(') 02777 { 02778 m_full_line = m_prev_line; 02779 m_full_line += " "; 02780 m_full_line += line; 02781 02782 m_prev_line = ""; 02783 } 02784 } 02785 else 02786 { 02787 m_full_line += line; 02788 } 02789 if (line.find (')') == cmt_string::npos) return; 02790 m_running = false; 02791 02792 if (m_full_line.find (';') != cmt_string::npos) return; 02793 if (m_full_line.find ("::") != cmt_string::npos) return; 02794 if (m_full_line.find ('<') != cmt_string::npos) return; 02795 if (m_full_line.find ('>') != cmt_string::npos) return; 02796 if (m_full_line.find ('{') != cmt_string::npos) return; 02797 if (m_full_line.find ('}') != cmt_string::npos) return; 02798 if (m_full_line.find ("typedef") != cmt_string::npos) return; 02799 if (m_full_line.find ("yy") != cmt_string::npos) return; 02800 if (m_full_line.find ("YY") != cmt_string::npos) return; 02801 if (m_static_functions) 02802 { 02803 if (m_full_line.find ("static") == cmt_string::npos) return; 02804 } 02805 else 02806 { 02807 if (m_full_line.find ("static") != cmt_string::npos) return; 02808 } 02809 02810 m_full_line += ";"; 02811 02812 if (m_output != 0) 02813 { 02814 fprintf (m_output, "%s\n", m_full_line.c_str ()); 02815 } 02816 } |
|
Definition at line 2844 of file cmt_generator.cxx. |
|
Definition at line 2841 of file cmt_generator.cxx. |
|
Definition at line 2838 of file cmt_generator.cxx. |
|
Definition at line 2839 of file cmt_generator.cxx. |
|
Definition at line 2842 of file cmt_generator.cxx. |
|
Definition at line 2837 of file cmt_generator.cxx. |
|
Definition at line 2840 of file cmt_generator.cxx. |
|
Definition at line 2843 of file cmt_generator.cxx. |