diff --git a/Packages/Manual_tools/src/cc_extract_html.C b/Packages/Manual_tools/src/cc_extract_html.C index 1b7ea026631..c557dcbf410 100644 --- a/Packages/Manual_tools/src/cc_extract_html.C +++ b/Packages/Manual_tools/src/cc_extract_html.C @@ -591,12 +591,6 @@ main( int argc, char **argv) { assert_file_write( *index_stream, macroX( "\\lciIndexFilename")); delete index_stream; - - if (macroIsTrue("\\lciIfMultipleParts")) { - *contents_stream << "" << endl; - *contents_stream << "" << endl; - } - if ( ! noheader_switch) copy_and_filter_config_file( macroX( "\\lciTocFooter"), diff --git a/Packages/Manual_tools/src/cc_index_link.C b/Packages/Manual_tools/src/cc_index_link.C index 1db7d2099d6..b52f2b57eea 100644 --- a/Packages/Manual_tools/src/cc_index_link.C +++ b/Packages/Manual_tools/src/cc_index_link.C @@ -4,9 +4,9 @@ cc_index_link.C ============================================================= Project : Tools for the CC manual writing task around cc_manual_index.sty. - Function :add links in HTML-index - System : bison, flex, C++ (g++) - Author : 2003 Lutz Kettner, Renata Krysta + Function :adds links in HTML-index (combines manual.ind with HREF) + System : C++ (g++) + Author : 2003 Renata Krysta Revision : $Revision$ Date : $Date$ @@ -16,7 +16,6 @@ #include #include #include -#include typedef struct Lines{ @@ -56,6 +55,7 @@ char* search(pList list, int number) { return list->text; } else list=list->next; } + return '\0'; } @@ -64,7 +64,10 @@ char* search(pList list, int number) { /* ------------------------------------------------------- */ main( int argc, char **argv) { - if (argc < 5) { +// argv[1] is a file with sorted index entries and their numbers +// argv[2] is a file with links and their numbers +// argv[3] is an output file + if (argc < 4) { cerr << "*** Error: program needs an additional parameter"<<'\n'; exit(1); } @@ -93,8 +96,8 @@ main( int argc, char **argv) { cerr<<"*** Error: cannot open file "<< file_name2 <<'\n'; - char ch; - + char ch; + char* out_link; char name_link[300]; bool end_name; @@ -103,7 +106,7 @@ main( int argc, char **argv) { if (in_file2.get(ch)) { if (ch=='?') { if (in_file2.get(ch)) { - if (ch=='?') { + if (ch=='?') { // if index entry end_name=0; char tmp[300]=""; bool page = 0; @@ -129,19 +132,22 @@ main( int argc, char **argv) { } } - if (page) { + if (page) { //if link in_file2 >> number; - out_file <<"" < "; - while (in_file2.get(ch) && ch!='<') { - if (ch=='|') { - in_file2 >> number; - out_file << "" - // << "\"reference\" "; - << "\"reference\" "; - } - } - out_file << ch; + out_link = search(list,number); + if (out_link) { + out_file <<"" < "; + } else out_file << tmp; + while (in_file2.get(ch) && ch!='<') { + if (ch=='|') { + in_file2 >> number; + if (out_link) { + out_file << "" + << "\"reference\" "; + } + } + } + out_file << ch; } else out_file << name_link; } else out_file << ch; diff --git a/Packages/Manual_tools/src/cc_manual_to_html b/Packages/Manual_tools/src/cc_manual_to_html index 8655170beda..7d901be6655 100755 --- a/Packages/Manual_tools/src/cc_manual_to_html +++ b/Packages/Manual_tools/src/cc_manual_to_html @@ -394,9 +394,9 @@ end if ( $?DEBUG) echo "# Converting the index." makeindex -s ${config_html}/html_index.mst ${new_tmp_path}/manual.hidx -cc_index_link ${new_tmp_path}/HREF ${new_tmp_path}/manual.ind ${new_tmp_path}/cc_index ${config_gif} -cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/cc_index ${new_tmp_path}/cc_index_footer > ${out_path}/manual_index.html - +cc_index_link ${new_tmp_path}/HREF ${new_tmp_path}/manual.ind ${new_tmp_path}/cc_index +\cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/cc_index ${new_tmp_path}/cc_index_footer > ${out_path}/manual_index.html +\cat ${config_gif}/index_arrow.gif > ${out_path}/gif/index_arrow.gif # Copy the necessary images to the manual. # ------------------------------------------------------- @@ -602,8 +602,9 @@ foreach f ($in_files $ref_files) \cat ${new_tmp_path}/$f:h/HREF >> ${new_tmp_path}/HREF end makeindex -s ${config_html}/html_index.mst ${new_tmp_path}/manual.hidx -cc_index_link ${new_tmp_path}/HREF ${new_tmp_path}/manual.ind ${new_tmp_path}/manual_index ${config_gif} -cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/manual_index ${new_tmp_path}/cc_index_footer > ${out_path}/manual_index.html +cc_index_link ${new_tmp_path}/HREF ${new_tmp_path}/manual.ind ${new_tmp_path}/manual_index +\cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/manual_index ${new_tmp_path}/cc_index_footer > ${out_path}/manual_index.html +\cat ${config_gif}/index_arrow.gif > ${out_path}/gif/index_arrow.gif # Copy the necessary images to the manual. diff --git a/Packages/Manual_tools/src/cpp_formatting.C b/Packages/Manual_tools/src/cpp_formatting.C index b40f37d545c..4bafec298fc 100644 --- a/Packages/Manual_tools/src/cpp_formatting.C +++ b/Packages/Manual_tools/src/cpp_formatting.C @@ -35,7 +35,7 @@ string template_class_name; // index // ======================================= -int HREF_counter; +int HREF_counter; // important for option -extended /* table size and font size constants */ @@ -913,7 +913,8 @@ void format_function( bool method, const char* signature, // --------- // index - if (!class_name.empty() && macroIsTrue( "\\ccIndex") && + if (!class_name.empty() && macroIsTrue( "\\ccIndex") && + macroIsTrue( "\\ccAutoIndex") && !(macroIsTrue( "\\ccIsRefFunction") && macroIsTrue( "\\ccIsFunctionTemplate"))) { char* formatted_function = convert_fontified_ascii_to_html( @@ -935,15 +936,12 @@ void format_function( bool method, const char* signature, } if ( !normal_operator && !method && macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\lciIfHtmlRefIndex") && macroIsTrue( "\\ccIndex") - && class_name.empty() && !(macroIsTrue( "\\ccIsRefFunction") && + && macroIsTrue( "\\ccAutoIndex") && class_name.empty() + && !(macroIsTrue( "\\ccIsRefFunction") && macroIsTrue( "\\ccIsFunctionTemplate"))) { char* formatted_function = convert_fontified_ascii_to_html( function_name); - - // Make only the function name a hyperlink. Types could be substituted - // according the rules. - make_index(formatted_function,"","",signature,'f'); delete[] formatted_function; @@ -959,7 +957,7 @@ void format_function( bool method, const char* signature, if ( conversion_operator) print_ascii_to_html_spc( *current_ostream, op_symbols); - char* tmp; + char* full_parameter_list; // handle function body or operation signature // first, estimate size @@ -970,7 +968,7 @@ void format_function( bool method, const char* signature, if ( conversion_operator) { exp_size += estimate_html_size( op_symbols); } else if ( parameter_list) { - tmp = strdup(parameter_list); + full_parameter_list = strdup(parameter_list); n = separate_parameter_list( parameter_list); char* p = parameter_list; int m = n; @@ -1041,13 +1039,18 @@ void format_function( bool method, const char* signature, print_ascii_to_html_spc( *current_ostream, postfix); } + // --------- + // index + + if (((! failed) || (! (macroIsTrue("\\ccTagOperatorLayout")))) && - macroIsTrue( "\\ccIndex") && !(macroIsTrue( "\\ccIsRefFunction") && + macroIsTrue( "\\ccIndex") && macroIsTrue( "\\ccAutoIndex") + && !(macroIsTrue( "\\ccIsRefFunction") && macroIsTrue( "\\ccIsFunctionTemplate"))) { p = parameter_list; if (!method) { - char* q = p; + char* q = full_parameter_list; char* s = q; bool found = false; while ((m--) && !(found)) { @@ -1090,7 +1093,7 @@ void format_function( bool method, const char* signature, make_index(op_symbols_for_index,token,"",signature,'f'); } else { - char* token = strtok(tmp, " \t"); + char* token = strtok(full_parameter_list, " \t"); make_index(op_symbols_for_index,token,"",signature,'f'); } } @@ -1099,6 +1102,10 @@ void format_function( bool method, const char* signature, convert_fontified_ascii_to_html(class_name),"", signature,'f'); } + // end index + // ---------- + + } @@ -1241,19 +1248,30 @@ void format_variable( const char* signature, } if ( macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\lciIfHtmlRefIndex") && - macroIsTrue( "\\ccIndex")) { + macroIsTrue( "\\ccIndex") && macroIsTrue( "\\ccAutoIndex")) { // index char p = (is_typedef ? 't' : 'v'); make_index(formatted_var,"","",variable_name,p); } } else if ( macroIsTrue( "\\lciIfHtmlClassIndex") && - macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex")) { + macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { // index char p = (is_typedef ? 't' : 'v'); make_index(string(variable_name),string(class_name),"", variable_name,p); } + + if ( !class_name.empty() && !macroIsTrue( "\\lciIfHtmlClassIndex") && + macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { + // index + char p = (is_typedef ? 't' : 'v'); + make_index(formatted_var,"","",variable_name,p); + } + + if ( macroIsTrue( "\\lciIfHtmlLinks") || macroIsTrue( "\\lciIfHtmlIndex")) { *current_ostream << " 1) { // generate a substitution rule for hyperlinking @@ -1335,12 +1352,14 @@ void format_class_declaration( const char* signature) { filter_for_index_anchor( *anchor_stream, struct_name); *anchor_stream << "\", yytext); }" << endl; } - if ( macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex")) { + if ( macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { // index make_index(formatted_struct,"","",struct_name,'s'); } } else if ( macroIsTrue( "\\lciIfHtmlClassIndex") && - macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex")) { + macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { // index make_index(string(struct_name),string(class_name),"", struct_name,'s'); @@ -1385,7 +1404,7 @@ void format_struct( const char* signature) { char* formatted_struct = convert_fontified_ascii_to_html( struct_name); two_cols_html_begin( *current_ostream); - if ( class_name.empty()) { + if ( class_name.empty() || (! macroIsTrue( "\\lciIfHtmlClassIndex"))) { if ( macroIsTrue( "\\lciIfHtmlLinks") && strlen(struct_name) > 1) { // generate a substitution rule for hyperlinking *anchor_stream << "[a-zA-Z0-9_]\"" << formatted_struct @@ -1396,12 +1415,14 @@ void format_struct( const char* signature) { filter_for_index_anchor( *anchor_stream, struct_name); *anchor_stream << "\", yytext); }" << endl; } - if ( macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex")) { + if ( macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { // index make_index(formatted_struct,"","",struct_name,'s'); } } else if ( macroIsTrue( "\\lciIfHtmlClassIndex") && - macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex")) { + macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { // index make_index(string(struct_name),string(class_name),"", struct_name,'s'); @@ -1495,7 +1516,8 @@ void format_nested_type( const char* nested_type_name) { two_cols_html_begin( *current_ostream); if ( macroIsTrue( "\\lciIfHtmlClassIndex") && - macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex")) { + macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { // index if ( ! template_class_name.empty()) make_index(string(nested_type_name),string(class_name),"", @@ -1544,8 +1566,7 @@ void format_enum( const char* signature) { char* formatted_enum = convert_fontified_ascii_to_html( enum_name); two_cols_html_begin( *current_ostream); - - if ( class_name.empty()) { + if ( class_name.empty() || !(macroIsTrue( "\\lciIfHtmlClassIndex"))) { if ( macroIsTrue( "\\lciIfHtmlLinks") && strlen( enum_name) > 1) { // generate a substitution rule for hyperlinking *anchor_stream << "[a-zA-Z0-9_]\"" << formatted_enum @@ -1556,7 +1577,8 @@ void format_enum( const char* signature) { filter_for_index_anchor( *anchor_stream, enum_name); *anchor_stream << "\", yytext); }" << endl; } - if ( macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex")) { + if ( macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { // index char* k = strdup(formatted_enum); k = strtok(k,"="); @@ -1567,7 +1589,8 @@ void format_enum( const char* signature) { delete[] k; } } else if ( macroIsTrue( "\\lciIfHtmlClassIndex") && - macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex")) { + macroIsTrue( "\\lciIfHtmlIndex") && macroIsTrue( "\\ccIndex") + && macroIsTrue( "\\ccAutoIndex")) { // index char* k = strdup(formatted_enum); k = strtok(k,"="); @@ -1639,7 +1662,10 @@ void format_enum( const char* signature) { ++p; print_ascii_to_html_spc( *current_ostream, p); - if ( class_name.empty()) { + if ( (class_name.empty() || + !(macroIsTrue( "\\lciIfHtmlClassIndex"))) && + macroIsTrue( "\\ccIndex") && + macroIsTrue( "\\ccAutoIndex")) { if ( macroIsTrue( "\\lciIfHtmlIndex")) { // index: print enum tags with (possible) initializers char* k = strdup(p); @@ -1675,7 +1701,8 @@ void format_enum( const char* signature) { } } else if ( macroIsTrue( "\\lciIfHtmlClassIndex") && macroIsTrue( "\\lciIfHtmlIndex") && - macroIsTrue( "\\ccIndex")) { + macroIsTrue( "\\ccIndex") && + macroIsTrue( "\\ccAutoIndex")) { // index: print enum tags with their (possible) initializers char* k = strdup(p); k = strtok(p,"="); diff --git a/Packages/Manual_tools/src/internal_macros.C b/Packages/Manual_tools/src/internal_macros.C index 2ddad4e8506..9fc04271031 100644 --- a/Packages/Manual_tools/src/internal_macros.C +++ b/Packages/Manual_tools/src/internal_macros.C @@ -32,69 +32,6 @@ // ====================================================================== -// ====================================================================== -// Index keys and sorting -// ====================================================================== - -// Sort keys for the index -// ---------------------------------- -// The index is organized in a set of fixed topics. - -// sort_keys are used to sort the index according to different sections. -// A sort_key is followed by a 0 to indicate the section title. -// A sort_key is followed by a 1 to indicate a normal entry. - - - -const string sort_key_concept = " 0) - txt[0] = tolower( txt[0]); - if ( txt == "concept") - return sort_key_concept; - if ( txt == "functionObjectConcept") - return sort_key_concept; - if ( txt == "class") - return sort_key_class; - if ( txt == "functionObjectClass") - return sort_key_class; - if ( txt == "struct") - return sort_key_struct; - if ( txt == "nested_type") - return sort_key_nested_type; - if ( txt == "enum") - return sort_key_enum; - if ( txt == "enum_tags") - return sort_key_enum_tags; - if ( txt == "typedef") - return sort_key_typedef; - if ( txt == "macro") - return sort_key_macro; - if ( txt == "variable") - return sort_key_variable; - if ( txt == "constant") - return sort_key_variable; - if ( txt == "function") - return sort_key_function; - if ( txt == "member_function") - return sort_key_member_function; - printErrorMessage( UnknownIndexCategoryError); - return sort_key_class; -} - static int index_anchor_counter = 0; static int cross_link_anchor_counter = 0; @@ -198,12 +135,7 @@ void handleChapter( const Buffer_list& T) { // table of contents - if (macroIsTrue("\\lciIfMultipleParts")) - *contents_stream << " "<< chapter_num <<" " << chapter_title << " " << endl; - else - *contents_stream << "
  • " << chapter_title << "" << endl; } @@ -214,26 +146,31 @@ void handlePart( const Buffer_list& T) { if (!part_title.empty()) // end previous part { - *contents_stream << " " << endl; + *contents_stream << "" << endl; *contents_stream << "" << endl; // chapter_num=0; } - else - { - *contents_stream << "
    " << endl; - } - + part_title = string( text_block_to_string( T)); // add new part title to table of contents *contents_stream << "" << endl; - *contents_stream << "" << endl; + *contents_stream << "

    " << part_title << "

    " << endl; if ( macroIsTrue( "\\lciIfNumberChaptersByPart") ) - chapter_num=0; + *contents_stream << "
      " << endl; + else + *contents_stream << "
        " << endl; } +// ======================================================================== +// Index +// ======================================================================== + string correct_name (string s) { +// corrects index entries for HTML (with <> and commands) so that +// the result is a correct command in HTML. +// Example: `` index'' is changed into `` index ''. string tab[20]; string search_item; @@ -279,13 +216,6 @@ string correct_name (string s) { if (!(tab[j]=="")) correct_s += ""; } -/* if (tab_item > 1) { - cerr << endl; - cerr << " ***Index Warning*** " << endl; - cerr << "Your indexing text contains formatting commands in the " - << " interior. I'll do what I canwith this, but" - << " you may be in trouble" << endl; - } */ return correct_s; } @@ -294,6 +224,7 @@ string correct_name (string s) { void mainTextParse(string s, string& index_name, string& modifier) { +// This function separates the normal entry and the modified entry from s. remove_leading_spaces(s); size_t i = 0; @@ -327,7 +258,7 @@ void OpenFileforIndex() { temp_current_filename = current_filename; string WhichItem = macroX("\\lciWhichItem"); - if (WhichItem=="MainItem") { + if (WhichItem=="MainItem" || WhichItem=="index") { new_main_filename = macroX("\\lciMainItemFile"); } else { @@ -364,6 +295,7 @@ void CloseFileforIndex() { string name_for_ordering(string s) { +// index entry without HTML commands string ord_s=""; size_t i = 0; @@ -380,6 +312,8 @@ string name_for_ordering(string s) { return ord_s; } +// list of modified entries + typedef struct Lines{ string text; int number; @@ -450,8 +384,7 @@ void handleIndex() { ord_sub_sub_index_name = name_for_ordering(sub_sub_index_name); ord_sub_sub_modifier = name_for_ordering(sub_sub_modifier); } - - + string sub_item=""; string sub_sub_item=""; @@ -518,24 +451,24 @@ void handleIndex2(string main_item, string sub_item, string sub_sub_item, int mo *index_stream <<"! " << sub_item; if (sub_sub_item!="") *index_stream <<"! " << sub_sub_item; } - - switch (modifier) { - case 0 : -//"" - *HREF_stream << HREF_counter << " HREF=\"" << current_filename - << "#Index_anchor_" << index_anchor_counter << "\"" - << endl; - break; - case 1 : - *HREF_stream << HREF_counter <<" HREF=\"" << current_filename - << "#Index_anchor_" << index_anchor_counter << "\"" - << endl; - break; - case 2 : - *HREF_stream << HREF_counter << " HREF=\"" << "#" << HREF_counter-2 - << "\"" << endl; - break; - } + if ( !macroIsTrue("\\lciIfSeeAlso")) { + switch (modifier) { + case 0 : + *HREF_stream << HREF_counter << " HREF=\"" << current_filename + << "#Index_anchor_" << index_anchor_counter << "\"" + << endl; + break; + case 1 : + *HREF_stream << HREF_counter <<" HREF=\"" << current_filename + << "#Index_anchor_" << index_anchor_counter << "\"" + << endl; + break; + case 2 : + *HREF_stream << HREF_counter << " HREF=\"" << "#" + << HREF_counter-2 << "\"" << endl; + break; + } + } else *current_ostream<<"NIE1"<
    \n" << endl; - else *main_stream << "
    • \n" << formatted_reference << ".
    \n" << endl; } // table of contents if ( macroIsTrue( "\\lciIfHtmlClassToc")) - if (macroIsTrue("\\lciIfMultipleParts")) - *contents_stream << "
    " << endl; - else - *contents_stream << "

    " << part_title << "

    • " << formatted_reference - << ".
    • " << formatted_reference - << "