diff --git a/Packages/Manual_tools/src/buffer.C b/Packages/Manual_tools/src/buffer.C index bd6d034581e..388fe5f8e6a 100644 --- a/Packages/Manual_tools/src/buffer.C +++ b/Packages/Manual_tools/src/buffer.C @@ -21,6 +21,18 @@ // Substitute old style malloc, realloc, strdup ... // ================================================ +char* renew( char* old, size_t old_size, size_t new_size) { + ADT_Assert( old); + ADT_Assert( new_size > old_size); + char* cpy = new char[ new_size]; + if ( old && old_size > 0) { + size_t min = ( old_size < new_size ? old_size : new_size); + memcpy( cpy, old, min); + delete[] old; + } + return cpy; +} + char* newstr( const char* src) { ADT_Assert( src); if ( ! src) diff --git a/Packages/Manual_tools/src/buffer.h b/Packages/Manual_tools/src/buffer.h index 79c91053615..a28bbbeee94 100644 --- a/Packages/Manual_tools/src/buffer.h +++ b/Packages/Manual_tools/src/buffer.h @@ -25,6 +25,7 @@ #define LK_RestrictedOverloading 0 #include #include +#include // Class declarations: // ============================================== @@ -40,23 +41,8 @@ class TextToken; // Substitute old style malloc, realloc, strdup ... // ================================================ -template < class T, class I> -T* renew( T* old, I old_size, I new_size); - -template < class T, class I> -T* renew( T* old, I old_size, I new_size) { - ADT_Assert( old); - ADT_Assert( strlen( old) == size_t(old_size - 1)); - ADT_Assert( new_size > old_size); - T* cpy = new T[ size_t(new_size)]; - if ( old && old_size > 0) { - size_t min = ( old_size < new_size ? old_size : new_size); - memcpy( cpy, old, min * sizeof( T)); - delete[] old; - } - return cpy; -} +char* renew( char* old, size_t old_size, size_t new_size); char* newstr( const char* src); @@ -235,6 +221,10 @@ public: len = 0; *data = '\0'; } + void capitalize() { + for ( int i = 0; i < len; i++) + data[i] = toupper( data[i]); + } }; class TextToken : public ListLink{ diff --git a/Packages/Manual_tools/src/cc_build_checker.C b/Packages/Manual_tools/src/cc_build_checker.C index ea81a3703fa..99087e53ff2 100644 --- a/Packages/Manual_tools/src/cc_build_checker.C +++ b/Packages/Manual_tools/src/cc_build_checker.C @@ -747,6 +747,7 @@ void handleClass( const char* classname) { void handleClassEnd( void) { if ( global_classname) free( global_classname); + global_classname = NULL; return; } @@ -821,6 +822,7 @@ void handleClassTemplateEnd( void) { global_template_params = 0; if ( global_classname) free( global_classname); + global_classname = NULL; return; } diff --git a/Packages/Manual_tools/src/cc_extract.C b/Packages/Manual_tools/src/cc_extract.C index 73c47152ca2..06c89d8234d 100644 --- a/Packages/Manual_tools/src/cc_extract.C +++ b/Packages/Manual_tools/src/cc_extract.C @@ -86,6 +86,7 @@ void handleClass( const char* classname) { void handleClassEnd( void) { if ( global_classname) free( global_classname); + global_classname = NULL; cout << outdent; cout << indNewline; cout << "};" << indNewline; @@ -149,6 +150,7 @@ void handleClassTemplateEnd( void) { global_template_params = 0; if ( global_classname) free( global_classname); + global_classname = 0; cout << outdent; cout << indNewline; cout << "};" << indNewline; diff --git a/Packages/Manual_tools/src/cc_extract_html.C b/Packages/Manual_tools/src/cc_extract_html.C index 770eeb89d7c..a3f63c4aa30 100644 --- a/Packages/Manual_tools/src/cc_extract_html.C +++ b/Packages/Manual_tools/src/cc_extract_html.C @@ -40,6 +40,22 @@ const char* prog_name = "cc_extract_html"; const char* prog_release = "$Revision$"; +/* Flexibility for HTML class files. */ +/* ================================= */ +bool html_no_class_links = false; +bool html_no_class_file = false; +bool html_no_class_index = false; + +bool html_inline_classes = false; + + +/* Constant string used for referencing. */ +/* ===================================== */ +/* This constant must be doubly quoted since it is subject of another */ +/* C compiler pass during generation of the link generator. */ +const char* reference_icon = ""; + /* Configurable command line options */ /* ================================= */ typedef char Switch; @@ -55,6 +71,107 @@ Switch config_switch = NO_SWITCH; Switch warn_switch = NO_SWITCH; Switch macro_switch = NO_SWITCH; +Switch noheader_switch = NO_SWITCH; +Switch onlyheader_switch = NO_SWITCH; + +char* cgal_lib_dir = NULL; + + +/* An object storing the current font */ +/* ================================== */ +/* It is only used within CCMode at the moment */ + +Font current_font = rm_font; + +/* HTML Tags to set and reset a specific font. */ +const char* html_font_opening[ end_font_array] = { + "", + "", + "", + "", + "", + "", + "", + "", + "" +}; +const char* html_font_closing[ end_font_array] = { + "", + "", + "", + "", + "", + "", + "", + "", + "" +}; + +const int max_tag_size = 20; +char font_tag_buffer[max_tag_size]; + +const char* font_changing_tags( Font old_font, Font new_font) { + ADT_Assert( old_font > unknown_font && old_font < end_font_array); + ADT_Assert( new_font > unknown_font && new_font < end_font_array); + if ( old_font == new_font) + *font_tag_buffer = '\0'; + else { + strcpy( font_tag_buffer, html_font_closing[ old_font]); + strcat( font_tag_buffer, html_font_opening[ new_font]); + } + return font_tag_buffer; +} + +const char* new_font_tags( Font new_font) { + const char* s = font_changing_tags( current_font, new_font); + current_font = new_font; + return s; +} + +const char* lazy_new_font_tags( Font new_font) { + char* s = font_tag_buffer; + *s = '\0'; + if ( current_font == unknown_font && new_font == unknown_font) + return s; + if ( current_font == unknown_font) + strcpy( s, html_font_opening[ new_font]); + else if ( new_font == unknown_font) + strcpy( s, html_font_closing[ current_font]); + else + return new_font_tags( new_font); + current_font = new_font; + return s; +} + + +/* The following is used to remember the font that was used in the */ +/* previous column and to restore it in the next column. */ +Font remember_font = it_font; // default for program code. + +inline const char* new_remember_font( Font new_font) { + return new_font_tags( new_font); +} +const char* new_remember_font( char c) { + switch (c) { + case 'T': + return new_remember_font( tt_font); + case 'I': + return new_remember_font( it_font); + default: + font_tag_buffer[0] = '\\'; + font_tag_buffer[1] = c; + font_tag_buffer[2] = '\\'; + font_tag_buffer[3] = '\0'; + } + return font_tag_buffer; +} +inline const char* store_remember_font() { + remember_font = current_font; + return new_font_tags( it_font); +} +inline const char* get_remember_font() { + return new_remember_font( remember_font); +} /* Two queues to manage footnotes. */ /* =============================== */ @@ -354,6 +471,30 @@ const char* sort_key_variable = "

  • Classes

    " << endl; out << sort_key_nested_type << "0 !>

  • Nested Types

    " << endl; @@ -444,6 +585,21 @@ char* addSuffix( const char* name, const char* suffix) { return fullname; } +char* convert_filename( char* name) { + char* fullname = new char[ strlen( name) + 1]; + char* p = name; + char* q = fullname; + while ( *p) { + if ( *p == '\\' && isupper( p[1]) && p[2] == '\\') + p+=3; + else + *q++ = *p++; + } + *q = '\0'; + delete[] name; + return fullname; +} + // return the position of a suffix dot `.'. Return the terminating // zero `\0' position if no dot `.' is in the whole filename. int suffixPosition( const char* name) { @@ -473,6 +629,29 @@ char* addPrefix( const char* prefix, const char* name) { return fullname; } +// If name has already a path-prefix, insert the new prefix before +// the filename, not before the path. +char* addNamePrefix( const char* prefix, const char* name) { + char *fullname = new char[ strlen( name) + strlen( prefix) + 1]; + const char* p = NULL; + const char* s = name; + while( *s) { + if ( *s == '/') + p = s; + s++; + } + if ( p != NULL) { + p++; + strncpy( fullname, name, p-name); + strcat( fullname, prefix); + strcat( fullname, p); + } else { + strcpy( fullname, prefix); + strcat( fullname, name); + } + return fullname; +} + /* Auxiliary functions for stream handling */ /* ======================================= */ @@ -719,6 +898,12 @@ void copy_config_file( const char* name){ void filter_for_index_comment( ostream& out, const char* text) { while( *text) { switch (*text) { + case '\\': + if ( isupper(text[1]) && text[2] == '\\') + text+=2; + else + out << *text; + break; case '<': out << '('; break; @@ -739,6 +924,12 @@ void filter_for_index_comment( ostream& out, const char* text) { void filter_for_index_anchor( ostream& out, const char* text) { while( *text) { switch ( *text) { + case '\\': + if ( isupper(text[1]) && text[2] == '\\') + text+=2; + else + out << '_'; + break; case '<': case '(': case '[': @@ -802,7 +993,10 @@ const char* html_multi_character( char c) { void print_ascii_to_html( ostream& out, const char* txt) { while( *txt) { - if ( is_html_multi_character( *txt)) + if ( *txt == '\\' && isupper(txt[1]) && txt[2] == '\\') { + out << new_remember_font( txt[1]); + txt += 2; + } else if ( is_html_multi_character( *txt)) out << html_multi_character( *txt); else out << *txt; @@ -812,7 +1006,10 @@ void print_ascii_to_html( ostream& out, const char* txt) { void print_ascii_len_to_html( ostream& out, const char* txt, int n) { while( n) { - if ( is_html_multi_character( *txt)) + if ( *txt == '\\' && isupper(txt[1]) && txt[2] == '\\') { + out << new_remember_font( txt[1]); + txt += 2; + } else if ( is_html_multi_character( *txt)) out << html_multi_character( *txt); else out << *txt; @@ -824,7 +1021,10 @@ void print_ascii_len_to_html( ostream& out, const char* txt, int n) { // This version eliminates multiple spaces. void print_ascii_to_html_spc( ostream& out, const char* txt) { while( *txt) { - if ( is_html_multi_character( *txt)) + if ( *txt == '\\' && isupper(txt[1]) && txt[2] == '\\') { + out << new_remember_font( txt[1]); + txt += 2; + } else if ( is_html_multi_character( *txt)) out << html_multi_character( *txt); else if ( *txt > ' ' || (*txt > '\0' && txt[1] > ' ')) @@ -836,7 +1036,10 @@ void print_ascii_to_html_spc( ostream& out, const char* txt) { int strlen_ascii_to_html( const char* txt) { int len = 0; while( *txt) { - if ( is_html_multi_character( *txt)) + if ( *txt == '\\' && isupper(txt[1]) && txt[2] == '\\') { + len += 13; // upper bound, see . + txt += 2; + } else if ( is_html_multi_character( *txt)) len += strlen( html_multi_character( *txt)); else len++; @@ -854,7 +1057,12 @@ char* convert_ascii_to_html( const char* txt) { char* s = new char[ strlen_ascii_to_html( txt) + 1]; char* p = s; while( *txt) { - if ( is_html_multi_character( *txt)) { + if ( *txt == '\\' && isupper(txt[1]) && txt[2] == '\\') { + const char* q = new_remember_font( txt[1]); + while ( *q) + *p++ = *q++; + txt += 2; + } else if ( is_html_multi_character( *txt)) { const char* q = html_multi_character( *txt); while ( *q) *p++ = *q++; @@ -866,6 +1074,19 @@ char* convert_ascii_to_html( const char* txt) { return s; } +char* convert_C_to_html( const char* txt) { + current_font = it_font; + char* tmp = convert_ascii_to_html( txt); + const char* end_font = new_font_tags( it_font); + char* formatted = new char[ strlen( tmp) + strlen( end_font) + 8]; + strcpy( formatted, ""); + strcat( formatted, tmp); + strcat( formatted, end_font); + strcat( formatted, ""); + delete[] tmp; + return formatted; +} + // A scope operator is also appended char* convert_ascii_to_scrambled_html( const char* txt) { char* s = new char[ strlen_ascii_to_html( txt) + 3 @@ -873,7 +1094,12 @@ char* convert_ascii_to_scrambled_html( const char* txt) { char* p = s; bool tag = true; while( *txt) { - if ( is_html_multi_character( *txt)) { + if ( *txt == '\\' && isupper(txt[1]) && txt[2] == '\\') { + const char* q = new_remember_font( txt[1]); + while ( *q) + *p++ = *q++; + txt += 2; + } else if ( is_html_multi_character( *txt)) { const char* q = html_multi_character( *txt); while ( *q) *p++ = *q++; @@ -893,10 +1119,36 @@ char* convert_ascii_to_scrambled_html( const char* txt) { return s; } +char* convert_C_to_scrambled_html( const char* txt) { + current_font = it_font; + char* tmp = convert_ascii_to_scrambled_html( txt); + const char* end_font = new_font_tags( it_font); + char* formatted = new char[ strlen( tmp) + strlen( end_font) + 8]; + strcpy( formatted, ""); + strcat( formatted, tmp); + strcat( formatted, end_font); + strcat( formatted, ""); + delete[] tmp; + return formatted; +} + +char* wrap_anchor( const char* filename, const char* contents) { + char* formatted = new char[ strlen( filename) + strlen( contents) + + strlen("") + 1]; + strcpy( formatted, ""); + strcat( formatted, contents); + strcat( formatted, ""); + return formatted; +} + double estimate_html_size( const char* s) { int n = 0; while ( *s) { - if ( *s > ' ' || (*s > '\0' && s[1] > ' ')) + if ( *s == '\\' && isupper(s[1]) && s[2] == '\\') { + s += 2; + } else if ( *s > ' ' || (*s > '\0' && s[1] > ' ')) n++; ++s; } @@ -905,31 +1157,34 @@ double estimate_html_size( const char* s) { void three_cols_html_begin( ostream& out, bool big_col1) { + current_font = it_font; out << indent << indent << indNewline << "" << indNewline << ""; - out << "" << indNewline + out << indent << indNewline << store_remember_font() << "" + << indNewline << "" << indNewline << "
    " : ">") - << indNewline << "" << outdent << indNewline; + << indNewline << "" << outdent << indNewline; } void three_cols_html_premature_end( ostream& out) { - out << indent << indNewline <<"" << indNewline << "
    " << outdent << outdent << indNewline; } void three_cols_html_second( ostream& out, bool big_col1, bool big_col2) { - out << indent << indNewline <<"" << indNewline << ""; + out << indent << indNewline << store_remember_font() << "" + << indNewline << ""; if ( big_col1) out << ""; out << "" : ">") - << indNewline << "" << outdent << indNewline; + << indNewline << "" << get_remember_font() << outdent << indNewline; } void three_cols_html_third( ostream& out, bool big_col2, bool empty_col3) { - out << indent << indNewline << "" << indNewline << ""; + out << indent << indNewline << store_remember_font() << "" + << indNewline << ""; if ( big_col2 && ! empty_col3) out << ""; @@ -946,22 +1201,24 @@ void three_cols_html_end( ostream& out, bool big_col2, bool empty_col3) { } void two_cols_html_begin( ostream& out) { + current_font = it_font; out << indent << indent << indNewline << "" << indNewline << ""; - out << "" << indNewline + out << indent << indNewline << store_remember_font() <<"" + << indNewline << "" << indNewline << "
    " - << indNewline << "" << outdent << indNewline; + << indNewline << "" << outdent << indNewline; } void two_cols_html_premature_end( ostream& out) { - out << indent << indNewline <<"" << indNewline << "
    " << outdent << outdent << indNewline; } void two_cols_html_second( ostream& out, bool empty_col2) { - out << indent << indNewline << "" << indNewline << ""; + out << indent << indNewline << store_remember_font() << "" + << indNewline << ""; if ( ! empty_col2) out << " 0) { @@ -1332,7 +1589,7 @@ void split_variable_declaration( const char* signature, } // skip possible operator symbols and white spaces - while ( s != s_end && ( ! isalnum( *s)) && ( *s != '_')) + while ( s != s_end && ( ! isalnum( *s)) && ( *s != '_') && ( *s != '\\')) --s; const char* p = s + 1; while ( *p > 0 && *p <= ' ') @@ -1352,7 +1609,7 @@ void split_variable_declaration( const char* signature, // scan function name // parse first identifier for the function_name - while ( s != s_end && ( isalnum( *s) || *s == '_')) + while ( s != s_end && ( isalnum( *s) || *s == '_' || *s == '\\')) --s; if ( q - s) { variable_name = new char[ q - s + 1]; @@ -1369,7 +1626,7 @@ void split_variable_declaration( const char* signature, s -= 2; while ( s != s_end && *s <= ' ') --s; - while ( s != s_end && ( isalnum( *s) || *s == '_')) + while ( s != s_end && ( isalnum( *s) || *s == '_' || *s == '\\')) --s; } if ( q - s > 0) { @@ -1539,6 +1796,7 @@ bool format_operators( int n, int& modifiable_n, const char*& postfix, double& exp_size, bool& ignore_params) { + current_font = it_font; // Assume that the syntax is not malformed (error messages are // provided elsewhere, namely compiler or cc_manual.sty). // Non matching operators are printed in functional notation. @@ -1693,7 +1951,10 @@ bool format_operators( int n, int& modifiable_n, void print_rest( ostream& out, const char* txt){ out << ' '; while( *txt && *txt != ';') { - if ( is_html_multi_character( *txt)) + if ( *txt == '\\' && isupper(txt[1]) && txt[2] == '\\') { + out << new_remember_font( txt[1]); + txt += 2; + } else if ( is_html_multi_character( *txt)) out << html_multi_character( *txt); else if ( *txt > ' ' || (*txt > '\0' && txt[1] > ' ')) @@ -1703,6 +1964,7 @@ void print_rest( ostream& out, const char* txt){ } void format_function( bool method, const char* signature, const Text& T) { + current_font = it_font; char* return_value; char* scope; char* function_name; @@ -1760,13 +2022,13 @@ void format_function( bool method, const char* signature, const Text& T) { filter_for_index_comment( *index_stream, function_name); *index_stream << ' '; filter_for_index_comment( *index_stream, signature); - *index_stream << "!>

    • " + *index_stream << "!>
      • " << formatted_return << ' ' << formatted_scope << "" << formatted_function << "" << "( " << formatted_params << ")" << formatted_rest - << "
      " << endl; + << "
    " << endl; *current_stream << "" << endl; @@ -1869,10 +2131,12 @@ void format_function( bool method, const char* signature, const Text& T) { } else { double dd_width = table_width * ( 1.0 - table_first_col / 100.0); dd_width /= stretch_factor; - if ( exp_size > dd_width && parameter_list) + if ( exp_size > dd_width && parameter_list) { + *current_stream << store_remember_font(); *current_stream<<"" - "
    " - << indNewline; + "
    "; + *current_stream << get_remember_font() << indNewline; + } if ( method) { print_ascii_to_html_spc( *current_stream, creationvariable); *current_stream << '.'; @@ -1882,9 +2146,12 @@ void format_function( bool method, const char* signature, const Text& T) { print_ascii_to_html_spc( *current_stream, function_name); if ( parameter_list) { *current_stream << " ( "; - if ( exp_size > dd_width) - *current_stream <<"" - << indNewline; + if ( exp_size > dd_width) { + *current_stream << store_remember_font(); + *current_stream << ""; + *current_stream << get_remember_font() << indNewline; + } char* p = parameter_list; while ( n--) { print_ascii_to_html_spc( *current_stream, p); @@ -1896,8 +2163,10 @@ void format_function( bool method, const char* signature, const Text& T) { } } *current_stream << ")"; - if ( exp_size > dd_width) - *current_stream << "
    " << indNewline; + if ( exp_size > dd_width) { + *current_stream << store_remember_font(); + *current_stream << "" << indNewline; + } } else *current_stream << " ()"; } @@ -1921,6 +2190,7 @@ void format_function( bool method, const char* signature, const Text& T) { void format_variable( const char* signature, const Text& T, bool is_typedef = false) { + current_font = it_font; char* return_value; char* scope; char* variable_name; @@ -1961,8 +2231,8 @@ void format_variable( const char* signature, *index_stream << (is_typedef ? sort_key_typedef : sort_key_variable) << '1'; filter_for_index_comment( *index_stream, variable_name); - *index_stream << "!>
    • " << formatted_var - << "
    " << endl; + *index_stream << "!>
    • " << formatted_var + << "
    " << endl; } else { // index char* scrambled_var = convert_ascii_to_scrambled_html( variable_name); @@ -1975,8 +2245,8 @@ void format_variable( const char* signature, << current_filename << (is_typedef ? "#Typedef_" : "#Var_" ) << variable_name - << "\">" << scrambled_template_class_name - << scrambled_var << "" << endl; + << "\">" << scrambled_template_class_name + << scrambled_var << "" << endl; delete[] scrambled_var; } *current_stream << " table_width && parameter_list) + if ( exp_size > table_width && parameter_list) { + *current_stream << store_remember_font(); *current_stream << "" - "
    " - << indNewline; - + "
    " ; + *current_stream << get_remember_font() << indNewline; + } if ( scope) print_ascii_to_html_spc( *current_stream, scope); print_ascii_to_html_spc( *current_stream, template_class_name); @@ -2074,9 +2346,11 @@ void format_constructor( const char* signature, const Text& T) { if ( parameter_list) { *current_stream << " ( "; - if ( exp_size > table_width) - *current_stream << "" - << indNewline; + if ( exp_size > table_width) { + *current_stream << store_remember_font(); + *current_stream << ""; + *current_stream << get_remember_font() << indNewline; + } char* p = parameter_list; while ( n--) { print_ascii_to_html_spc( *current_stream, p); @@ -2088,8 +2362,10 @@ void format_constructor( const char* signature, const Text& T) { } } *current_stream << ");"; - if ( exp_size > table_width) + if ( exp_size > table_width) { + *current_stream << store_remember_font(); *current_stream << "
    " << indNewline; + } } else *current_stream << ';'; @@ -2105,6 +2381,7 @@ void format_constructor( const char* signature, const Text& T) { } void format_nested_type( const char* nested_type_name, const Text& T) { + current_font = it_font; char* formatted_type = convert_ascii_to_html( nested_type_name); char* scrambled_type = convert_ascii_to_scrambled_html( nested_type_name); two_cols_html_begin( *current_stream); @@ -2116,8 +2393,8 @@ void format_nested_type( const char* nested_type_name, const Text& T) { filter_for_index_comment( *index_stream, nested_type_name); *index_stream << "!>
    " << endl; + << "\">" << scrambled_template_class_name + << scrambled_type << "" << endl; *current_stream << "" << endl; // end index @@ -2142,6 +2419,7 @@ void format_nested_type( const char* nested_type_name, const Text& T) { } void format_enum( const char* signature, const Text& T) { + current_font = it_font; char* return_value; char* scope; char* enum_name; @@ -2175,8 +2453,8 @@ void format_enum( const char* signature, const Text& T) { // index *index_stream << sort_key_enum << '1'; filter_for_index_comment( *index_stream, enum_name); - *index_stream << "!>
    • " << formatted_enum - << "
    " << endl; + *index_stream << "!>
    • " << formatted_enum + << "
    " << endl; } else { // index char* scrambled_enum = convert_ascii_to_scrambled_html( enum_name); @@ -2186,8 +2464,8 @@ void format_enum( const char* signature, const Text& T) { filter_for_index_comment( *index_stream, enum_name); *index_stream << "!>" << endl; + << "\">" << scrambled_template_class_name + << scrambled_enum << "" << endl; delete[] scrambled_enum; } *current_stream << "" << endl; @@ -2215,11 +2493,12 @@ void format_enum( const char* signature, const Text& T) { } } exp_size *= stretch_factor; - if ( exp_size > table_width && parameter_list) + if ( exp_size > table_width && parameter_list) { + *current_stream << store_remember_font(); *current_stream << "" - "
    " - << indNewline; - + "
    "; + *current_stream << get_remember_font() << indNewline; + } if ( return_value) { print_ascii_to_html_spc( *current_stream, return_value); *current_stream << ' '; @@ -2229,9 +2508,11 @@ void format_enum( const char* signature, const Text& T) { *current_stream << formatted_enum; if ( parameter_list) { *current_stream << " { "; - if ( exp_size > table_width) - *current_stream << "" - << indNewline; + if ( exp_size > table_width) { + *current_stream << store_remember_font(); + *current_stream << ""; + *current_stream << get_remember_font() << indNewline; + } char* p = parameter_list; while ( n--) { while ( *p && *p <= ' ') @@ -2241,9 +2522,9 @@ void format_enum( const char* signature, const Text& T) { if ( class_name == NULL) { // index: print enum tags with their (possible) initializers *index_stream << sort_key_enum_tags << '1' << p - << "!>
    • "; + << "!>
      • "; print_ascii_to_html_spc( *index_stream, p); - *index_stream << "
      " << endl; + *index_stream << "
    " << endl; // generate a substitution rule for hyperlinking // Here, the initializer has to be suppressed @@ -2271,9 +2552,9 @@ void format_enum( const char* signature, const Text& T) { // index: print enum tags with their (possible) initializers char* scrambled_tag = convert_ascii_to_scrambled_html( p); *index_stream << sort_key_enum_tags << '1' << p - << "!>
    • "; + << "!>
      • "; print_ascii_to_html_spc( *index_stream, p); - *index_stream << "
      " << endl; + *index_stream << "
    " << endl; *index_stream << sort_key_enum_tags << '1'; filter_for_index_comment( *index_stream, template_class_name); @@ -2281,8 +2562,8 @@ void format_enum( const char* signature, const Text& T) { filter_for_index_comment( *index_stream, p); *index_stream << "!>" << endl; + << "\">" << scrambled_template_class_name + << scrambled_tag << "" << endl; delete[] scrambled_tag; } @@ -2294,8 +2575,10 @@ void format_enum( const char* signature, const Text& T) { } } *current_stream << "};"; - if ( exp_size > table_width) + if ( exp_size > table_width) { + *current_stream << store_remember_font(); *current_stream << "
    " << indNewline; + } } else *current_stream << ';'; @@ -2313,6 +2596,7 @@ void format_enum( const char* signature, const Text& T) { void format_struct( const char* signature, const Text& T) { + current_font = it_font; char* return_value; char* scope; char* struct_name; @@ -2344,8 +2628,8 @@ void format_struct( const char* signature, const Text& T) { // index *index_stream << sort_key_struct << '1'; filter_for_index_comment( *index_stream, struct_name); - *index_stream << "!>
    • " << formatted_struct - << "
    " << endl; + *index_stream << "!>
    • " << formatted_struct + << "
    " << endl; } else { // index char* scrambled_struct = convert_ascii_to_scrambled_html( struct_name); @@ -2355,8 +2639,8 @@ void format_struct( const char* signature, const Text& T) { filter_for_index_comment( *index_stream, struct_name); *index_stream << "!>" << endl; + << "\">" << scrambled_template_class_name + << scrambled_struct << "" << endl; delete[] scrambled_struct; } *current_stream << "" << endl; @@ -2384,11 +2668,12 @@ void format_struct( const char* signature, const Text& T) { } } exp_size *= stretch_factor; - if ( exp_size > table_width && parameter_list) + if ( exp_size > table_width && parameter_list) { + *current_stream << store_remember_font(); *current_stream << "" - "
    " - << indNewline; - + "
    "; + *current_stream << get_remember_font() << indNewline; + } if ( return_value) { print_ascii_to_html_spc( *current_stream, return_value); *current_stream << ' '; @@ -2398,9 +2683,11 @@ void format_struct( const char* signature, const Text& T) { *current_stream << formatted_struct; if ( parameter_list) { *current_stream << " { "; - if ( exp_size > table_width) - *current_stream << "" - << indNewline; + if ( exp_size > table_width) { + *current_stream << store_remember_font(); + *current_stream << ""; + *current_stream << get_remember_font() << indNewline; + } char* p = parameter_list; while ( n--) { while ( *p && *p <= ' ') @@ -2415,8 +2702,10 @@ void format_struct( const char* signature, const Text& T) { } } *current_stream << "};"; - if ( exp_size > table_width) + if ( exp_size > table_width) { + *current_stream << store_remember_font(); *current_stream << "
    " << indNewline; + } } else *current_stream << ';'; @@ -2455,7 +2744,7 @@ void handleMainComment( const Text& T) { void handleChapter( const Text& T) { char* tmp_name = replaceSuffix( in_filename, html_suffix); - char* new_main_filename = addPrefix( chapter_prefix, tmp_name); + char* new_main_filename = addNamePrefix( chapter_prefix, tmp_name); delete[] tmp_name; if ( strcmp( new_main_filename, main_filename) == 0) { printErrorMessage( ChapterStructureError); @@ -2466,7 +2755,7 @@ void handleChapter( const Text& T) { printFootnotes( *class_stream); if ( chapter_title) // navigation footer - *class_stream << "
    Return to chapter: Return to chapter: " << chapter_title << "" << endl; close_html( *class_stream); @@ -2524,25 +2813,13 @@ void handleBiblio( const Text& T) { delete out; } -Buffer* handleCite( const char* l) { +Buffer* handleCite( const char* cite_keys, const char* option) { Buffer* buf = new Buffer; buf->add( '['); - while ( *l != '{' && *l != '[') - ++l; - const char* comment = 0; - const char* end_comment = 0; - if ( *l == '[') { - comment = l + 1; - while ( *l != ']') - ++l; - end_comment = l; - while ( *l != '{') - ++l; - } - ++l; - while( *l != '}') { + const char* l = cite_keys; + while( *l) { const char* p = l; - while ( *p != '}' && *p != ',') + while ( *p && *p != ',') ++p; buf->add( "add( bib_filename); @@ -2561,38 +2838,49 @@ Buffer* handleCite( const char* l) { buf->add( ", "); } } - if ( comment) - while ( comment != end_comment) - buf->add( *comment++); + if ( option) + while ( *option) + buf->add( *option++); buf->add( ']'); return buf; } +Buffer* handleBibCite( const char* key, const char* item) { + // A rule to substitute key by item in the bibliography. + *anchor_stream << "\"[" << key + << "]\" { fputs( \"[" << item + << "]\", stdout); }" + << endl; + // A rule to substitute key by item for cite's in the main text. + *anchor_stream << "\"" << key + << "\" { fputs( \"" << item + << "\", stdout); }" + << endl; + return new Buffer; +} + // for an empty item name use the key name as item name -Buffer* handleBibItem( const char* key_name, const char* item_name) { - const char* name = key_name; - if ( item_name) - name = item_name; - Buffer* buf = new Buffer; +Buffer* handleBibItem( const char* key, const char* item) { + Buffer* buf; + if ( item) + buf = handleBibCite( key, item); + else + buf = new Buffer; if ( ! first_bibitem) { first_bibitem = false; buf->add( ""); } buf->add( "add( key_name); + buf->add( key); buf->add( "\">["); - buf->add( name); + buf->add( key); buf->add( "]"); - if ( item_name) { - *anchor_stream << "\"#Biblio_" << key_name - << "\"[\"]\">" << key_name - << "\" { fputs( \"#Biblio_" - << key_name << "\\\">" << item_name - << "\", stdout); }" - << endl; - } return buf; } @@ -2620,18 +2908,19 @@ void handleLabel( const char* l) { *anchor_stream << "[\\\\](page)?ref[ \\t]*\"" << l << "\" { fputs( \"here\", stdout); }" << endl; + << "#" << l << "\\\">" << reference_icon + << "\", stdout); }" << endl; // There are two special ref commands defined within the manual *anchor_stream << "[\\\\]Chapter[ \\t]*\"" << l - << "\" { fputs( \"This Chapter\", stdout); }" - << endl; + << "#" << l << "\\\">" << reference_icon + << "\", stdout); }" << endl; *anchor_stream << "[\\\\]Section[ \\t]*\"" << l - << "\" { fputs( \"This Section\", stdout); }" - << endl; + << "#" << l << "\\\">" << reference_icon + << "\", stdout); }" << endl; } void handleText( const Text& T, bool check_nlnl) { @@ -2670,102 +2959,164 @@ void handleChar( char c) { *current_stream << c; } - -void handleClasses( const char* classname, const char* template_cls) { - if ( template_cls) - template_class_name = newstr( template_cls); - else - template_class_name = newstr( classname); - assert( template_class_name); - char* t_tmp_name = convert_ascii_to_html( template_class_name); - formatted_template_class_name = new char[ strlen( t_tmp_name) + 12]; - strcpy( formatted_template_class_name, ""); - strcat( formatted_template_class_name, t_tmp_name); - strcat( formatted_template_class_name, ""); - delete[] t_tmp_name; - t_tmp_name = convert_ascii_to_scrambled_html( template_class_name); - scrambled_template_class_name = new char[ strlen( t_tmp_name) + 12]; - strcpy( scrambled_template_class_name, ""); - strcat( scrambled_template_class_name, t_tmp_name); - strcat( scrambled_template_class_name, ""); - delete[] t_tmp_name; - +// Opens a new classfile. Only a filename and a HTML formatted reference +// text are given. +void handleClassFile( char* filename, const char* formatted_reference) { if ( class_stream != 0) { printFootnotes( *class_stream); // navigation footer - *class_stream << "
    Next class declaration: " - << formatted_template_class_name << endl; + *class_stream << "
    Next: " << formatted_reference << endl; close_html( *class_stream); assert_file_write( *class_stream, class_filename); delete class_stream; delete[] class_filename; class_stream = 0; } - class_name = newstr( classname); footnotes = &class_footnotes; footnote_counter = &class_footnote_counter; - char *tmp_name = convert_ascii_to_html( classname); - formatted_class_name = new char[ strlen( tmp_name) + 12]; - strcpy( formatted_class_name, ""); - strcat( formatted_class_name, tmp_name); - strcat( formatted_class_name, ""); - - class_filename = addSuffix( classname, html_suffix); + class_filename = filename; class_stream = open_file_with_path_for_write( tmp_path, class_filename); open_html( *class_stream); // Make a hyperlink in the chapter to the class file. if ( main_stream != &cout) { - *main_stream << "
    • \nClass declaration for " - << formatted_template_class_name + *main_stream << "
      • \n" << formatted_reference << ".
      \n" << endl; } // table of contents - *contents_stream << "
      • Class declaration of " - << formatted_template_class_name << "
      " << endl; - - // index - *index_stream << sort_key_class << '1'; - filter_for_index_comment( *index_stream, template_class_name); - *index_stream << "!>
      • " << formatted_template_class_name - << "
      " << endl; + *contents_stream << "
      • " << formatted_reference + << "
      " << endl; current_stream = class_stream; current_filename = class_filename; +} - // generate a substitution rule for hyperlinking - *anchor_stream << '"' << class_filename - << "\" { ECHO; }" << endl; +const int index_anchor_len = 200; +char index_anchor_buffer[ index_anchor_len]; +int index_anchor_counter = 0; + +const char* handleHtmlIndex( const char* category, + const char* sort_key, + const char* formatted_reference) { + *index_stream << category << '1'; + filter_for_index_comment( *index_stream, sort_key); + *index_stream << "!>" << endl; + ostrstream out( index_anchor_buffer, index_anchor_len); + out << "\n\n\0"; + return index_anchor_buffer; +} + +const char* handleHtmlIndexC( const char* category, const char* item) { + char* formatted_reference = convert_C_to_html( item); + const char* s = handleHtmlIndex( category, item, formatted_reference); + delete[] formatted_reference; + return s; +} + +const char* handleHtmlIndex( const char* category, const char* item) { + char* formatted_reference = convert_ascii_to_html( item); + const char* s = handleHtmlIndex( category, item, formatted_reference); + delete[] formatted_reference; + return s; +} + +const int cross_link_anchor_len = 200; +char cross_link_anchor_buffer[ cross_link_anchor_len]; +int cross_link_anchor_counter = 0; + +const char* handleHtmlCrossLink( const char* key, bool tmpl_class) { + char *tmp_name = convert_ascii_to_html( key); *anchor_stream << "[a-zA-Z0-9_]\"" << tmp_name << "\" { ECHO; }" << endl; *anchor_stream << "\"" << tmp_name << "\"[a-zA-Z0-9_] { ECHO; }" << endl; - if ( template_cls) { + *anchor_stream << '"' << tmp_name + << "\" { fputs( \"" + << tmp_name << "\", stdout); }" + << endl; + if ( tmpl_class) { *anchor_stream << '"' << tmp_name << "\"[ ]*\"<\" {\n" << " fputs( \"\", stdout);\n" + << current_filename << "#Cross_link_anchor_" + << cross_link_anchor_counter << "\\\">\", stdout);\n" << " nesting = 1;\n" << " yymore();\n" << " BEGIN( PARAMMODE); }\n" << endl; } - *anchor_stream << '"' << tmp_name - << "\" { fputs( \"" - << tmp_name << "\", stdout); }" - << endl; delete[] tmp_name; - creationvariable = newstr( "this"); - formatted_creationvariable = newstr( "this"); + + ostrstream out( cross_link_anchor_buffer, cross_link_anchor_len); + out << "\n\n\0"; + return cross_link_anchor_buffer; +} + +void handleClasses( const char* classname, const char* template_cls) { + // Name manipulation. + if ( template_cls) + template_class_name = newstr( template_cls); + else + template_class_name = newstr( classname); + assert( template_class_name); + formatted_template_class_name = + convert_C_to_html( template_class_name); + scrambled_template_class_name = + convert_C_to_scrambled_html( template_class_name); + class_name = newstr( classname); + creationvariable = newstr( "*this"); + formatted_creationvariable = newstr( "*this"); + formatted_class_name = convert_C_to_html( classname); + + if ( ! html_inline_classes && ! html_no_class_file) { + // Start a new class file. + char* filename = convert_filename( addSuffix( classname, html_suffix)); + char* fname = wrap_anchor( filename, formatted_template_class_name); + char* contents = new char[ strlen(fname) + + strlen(" Class declaration of ") + 1]; + strcpy( contents, " Class declaration of "); + strcat( contents, fname); + handleClassFile( filename, contents); + delete[] contents; + delete[] fname; + // Don't delete filename! It's assigned to class_filename. + } + + if ( ! html_no_class_index) // Index. + *current_stream << handleHtmlIndex( sort_key_class, + template_class_name, + formatted_template_class_name); + + if ( ! html_no_class_links) // Cross links. + // Generate a substitution rule for hyperlinking. + *current_stream << handleHtmlCrossLink( classname, + template_cls != NULL); } void handleClass( const char* classname) { handleClasses( classname, 0); } -void handleClassEnd( void) { +void handleClassFileEnd( void) { + /* ... Hack to implement the link from one class to the next class + close_html( *class_stream); + delete class_stream; + delete[] class_filename; + class_stream = 0; + class_filename = 0; + ... */ + current_stream = main_stream; + current_filename = main_filename; +} + +void handleClassNameEnd( void) { delete[] class_name; delete[] template_class_name; delete[] formatted_class_name; @@ -2776,32 +3127,32 @@ void handleClassEnd( void) { template_class_name = 0; formatted_template_class_name = 0; scrambled_template_class_name = 0; - /* ... Hack to implement the link from one class to the next class - close_html( *class_stream); - if ( ! *class_stream) { - cerr << ' ' << endl - << prog_name << ": error: cannot write to file `" - << class_filename << "'." << endl; - exit(1); - } - delete class_stream; - delete[] class_filename; - class_stream = 0; - class_filename = 0; - ... */ - current_stream = main_stream; - current_filename = main_filename; +} + +void handleClassEnd( void) { + handleClassNameEnd(); + if ( ! html_inline_classes && ! html_no_class_file) + handleClassFileEnd(); + html_no_class_links = false; + html_no_class_file = false; + html_no_class_index = false; +} + +char* templateClassBaseName( const char* classname) { + const char* s = classname; + while ( *s != 0 && *s != '<') + s++; + if ( *s == 0) + printErrorMessage( TemplateParamExpectedError); + size_t len = s - classname; + char* p = new char[ len + 1]; + strncpy( p, classname, len); + p[len] = '\0'; + return p; } void handleClassTemplate( const char* classname) { - char* s = (char *)classname; - while ( *s != 0 && *s != '<') s++; - if ( *s == 0) - printErrorMessage( TemplateParamExpectedError); - char c_tmp = *s; - *s = 0; - char *classname_tmp = newstr( classname); - *s = c_tmp; + char* classname_tmp = templateClassBaseName(classname); handleClasses( classname_tmp, classname); delete[] classname_tmp; } @@ -2810,6 +3161,21 @@ void handleClassTemplateEnd( void) { handleClassEnd(); } +void handleHtmlClassFile( const char* filename, const Text& T) { + char* s = text_block_to_string( T); + char* p = convert_ascii_to_html( s); + delete[] s; + s = wrap_anchor( filename, p); + delete[] p; + handleClassFile( newstr(filename), s); + delete[] s; + html_inline_classes = true; +} + +void handleHtmlClassFileEnd() { + handleClassFileEnd(); + html_inline_classes = false; +} void handleDeclaration( const char* ) {} @@ -2971,10 +3337,29 @@ main( int argc, char **argv) { nParameters = ErrParameters; } endDetect(); + detectSwitch( dummy_switch, "cgal_dir"); + i++; + if ( i < argc) { + cgal_lib_dir = argv[i]; + if ( cgal_lib_dir[ strlen( cgal_lib_dir) - 1] != '/') { + cerr << "error: option -cgal_dir: a path must terminate " + "with a /" << endl; + nParameters = ErrParameters; + } + } else { + cerr << "error: option -cgal_dir needs an additional parameter" + << endl; + nParameters = ErrParameters; + } + endDetect(); detectSwitch( warn_switch, "warn"); endDetect(); detectSwitch( macro_switch, "macro"); endDetect(); + detectSwitch( noheader_switch, "noheader"); + endDetect(); + detectSwitch( onlyheader_switch, "onlyheader"); + endDetect(); detectSwitch( help_switch, "h"); endDetect(); @@ -3001,36 +3386,53 @@ main( int argc, char **argv) { << endl; cerr << "Usage: " << prog_name << " [] " << endl; - cerr << " -date set a date for the manual." << endl; - cerr << " -release set a release number for the " - "manual." << endl; - cerr << " -title set a title text for the manual." + cerr << " -date set a date for the manual." < set a release number for the " + "manual." << endl; + cerr << " -title set a title text for the manual." << endl; - cerr << " -author set an author address (email) for " - "the manual." << endl; - cerr << " -config set the path where to find the " - "config files." << endl; - cerr << " -tmp set the path where to put the " - "output files." << endl; - cerr << " -warn warn about unknown macros" << endl; - cerr << " -macro trace macro definitions" << endl; - cerr << " -trace set `yydebug' for bison to true" + cerr << " -author set an author address (email) for " + "the manual." << endl; + cerr << " -config set the path where to find the " + "config files." << endl; + cerr << " -tmp set the path where to put the " + "output files." << endl; + cerr << " -cgal_dir set the path to the CGAL " + "header files." << endl; + cerr << " -warn warn about unknown macros" << endl; + cerr << " -macro trace macro definitions" << endl; + cerr << " -noheader no header for contents.html and " + "index" << endl; + cerr << " -onlyheader convert config files instead of " + "TeX-files" << endl; + cerr << " -trace set `yydebug' for bison to true" << endl; - cerr << " -line echo currently parsed line " - "numbers to cerr" << endl; + cerr << " -line echo currently parsed line " + "numbers to cerr" << endl; cerr << "(TeX-files with suffix: .tex or .bbl possible.)" << endl; exit(1); } + if ( onlyheader_switch) { + for ( i = 0; i < nParameters; i++) + copy_config_file( parameters[i]); + index_stream = open_file_with_path_for_write(tmp_path, index_filename); + write_headers_to_index( *index_stream); + assert_file_write( *index_stream, index_filename); + delete index_stream; + return 0; + } // Initialization tag_defaults(); main_stream = &cout; - // Filter config files for the index. - copy_config_file( cc_index_header); - copy_config_file( cc_index_footer); + if ( ! noheader_switch) { + // Filter config files for the index. + copy_config_file( cc_index_header); + copy_config_file( cc_index_footer); + } // Prepare several streams: // anchor_stream = new ofstream( anchor_filename, ios::out | ios::app); @@ -3038,9 +3440,11 @@ main( int argc, char **argv) { anchor_filename); contents_stream = open_file_with_path_for_write( tmp_path, contents_filename); - copy_and_filter_config_file( cc_toc_header, *contents_stream); + if ( ! noheader_switch) + copy_and_filter_config_file( cc_toc_header, *contents_stream); index_stream = open_file_with_path_for_write( tmp_path, index_filename); - write_headers_to_index( *index_stream); + if ( ! noheader_switch) + write_headers_to_index( *index_stream); for ( i = 0; i < nParameters; i++) { FILE* in; @@ -3086,7 +3490,8 @@ main( int argc, char **argv) { assert_file_write( *index_stream, index_filename); delete index_stream; - copy_and_filter_config_file( cc_toc_footer, *contents_stream); + if ( ! noheader_switch) + copy_and_filter_config_file( cc_toc_footer, *contents_stream); assert_file_write( *contents_stream, contents_filename); delete contents_stream; diff --git a/Packages/Manual_tools/src/cc_manual_to_html b/Packages/Manual_tools/src/cc_manual_to_html index ec5b5fced31..21c9bb8829f 100755 --- a/Packages/Manual_tools/src/cc_manual_to_html +++ b/Packages/Manual_tools/src/cc_manual_to_html @@ -43,6 +43,14 @@ set DEFAULT_DATE = `date +"%a, %B %e, %Y"` set DEFAULT_AUTHOR = "The CGAL Project" set DEFAULT_TITLE = "The CGAL Kernel Manual" +# The header files within the \ccInclude macro can be linked to the original +# header files if the -cgal_dir option is given to the cc_extract_html program. +# The environment variable CGAL_INCL_DIR is used as default. If it is not +# set, the default setting is empty and include files are not linked. +set cgal_dir = "" +if ($?CGAL_INCL_DIR) set cgal_dir = "-cgal_dir ${CGAL_INCL_DIR}/" + + # ======================================================= # Installation: Nothing else below this line. # ======================================================= @@ -60,13 +68,17 @@ if ($?TMP) then if (-d ${TMP}) set tmp_path = $TMP endif +set aux_file = "" +set bbl_file = "" + set out_path = "." set config_path = ${HTML_DEFAULT_PATH} set DEFAULT_RELEASE = -set default_switch = 0 +set default_switch = 0 set show_main_switch = 0 +set extended_switch = 0 # Parse command line parameters # ----------------------------- @@ -85,6 +97,12 @@ while ($#argv > 0) break endif + if ( "$1" == "-extended") then + set extended_switch = 1 + shift + continue + endif + if ( "$1" == "-show_main") then set show_main_switch = 1; shift @@ -132,6 +150,20 @@ while ($#argv > 0) shift continue endif + if ( "$1" == "-cgal_dir") then + shift + if ( $#argv < 1) then + echo "error: switch -cgal_dir needs an additional parameter." + goto usage + endif + if ( ! -d $1) then + echo "error: switch -cgal_dir needs a valid directory as parameter." + goto usage + endif + set cgal_dir = "-cgal_dir $1" + shift + continue + endif if ( "$1" == "-date") then shift if ( $#argv < 1) then @@ -173,6 +205,29 @@ while ($#argv > 0) continue endif + if ( "$1" == "-aux") then + shift + if ( $#argv < 1 || ! -r $1) then + echo "error: switch -aux needs a filename as additional parameter." + goto usage + endif + set aux_file = "${tmp_path}/aux_tmp_file.`date +%M%S`.tex" + grep "\\bibcite[{]" $1 > $aux_file + shift + continue + endif + + if ( "$1" == "-bbl") then + shift + if ( $#argv < 1 || ! -r $1) then + echo "error: switch -bbl needs a filename as additional parameter." + goto usage + endif + set bbl_file = "$1" + shift + continue + endif + set in_files = "$in_files $1" shift end @@ -186,8 +241,11 @@ if ( $?DEBUG || $default_switch == 1) then echo " DEFAULT_RELEASE = ${DEFAULT_RELEASE}" echo " tmp_path = ${tmp_path}" echo " out_path = ${out_path}" + echo " cgal_dir = ${cgal_dir}" echo " config_path = ${config_path}" echo " input_files = ${in_files}" + echo " aux_file = ${aux_file}" + echo " bbl_file = ${bbl_file}" echo "" endif if ( $default_switch) goto end_of_script @@ -208,15 +266,19 @@ endif mkdir ${new_tmp_path} +if ( $extended_switch) goto extended_conversion + # Step 1: convert each LaTeX file into an HTML file. # -------------------------------------------------- +set options = "${cgal_dir} -config ${config_path}/ -tmp ${new_tmp_path}/ ${aux_file} ${bbl_file}" + if ( $?DEBUG) echo "# Step 1: convert each LaTeX file into an HTML file." if ($show_main_switch) then - if ( $?DEBUG) echo "cc_extract_html -date "'"'"${DEFAULT_DATE}"'"'" -release "'"'"${DEFAULT_RELEASE}"'"'" -title "'"'"${DEFAULT_TITLE}"'"'" -author "'"'"${DEFAULT_AUTHOR}"'"'" -config ${config_path}/ -tmp ${new_tmp_path}/ ${in_files}" - cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" -config ${config_path}/ -tmp ${new_tmp_path}/ ${in_files} + if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} ${in_files}" + cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} ${in_files} else - if ( $?DEBUG) echo "cc_extract_html -date "'"'"${DEFAULT_DATE}"'"'" -release "'"'"${DEFAULT_RELEASE}"'"'" -title "'"'"${DEFAULT_TITLE}"'"'" -author "'"'"${DEFAULT_AUTHOR}"'"'" -config ${config_path}/ -tmp ${new_tmp_path}/ ${in_files} >/dev/null" - cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" -config ${config_path}/ -tmp ${new_tmp_path}/ ${in_files} >/dev/null + if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} ${in_files} >/dev/null" + cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} ${in_files} >/dev/null endif # Step 2: generate the hyperlinks. The anchor filter. @@ -254,16 +316,16 @@ cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/cc_index_sorted ${new_tmp_pa if ( $?DEBUG) echo "${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/cc_index > ${out_path}/manual_index.html" ${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/cc_index > ${out_path}/manual_index.html + +conversion_done: # Copy the images for the advanced section to the manual. # ------------------------------------------------------- -if ( -r ${HTML_DEFAULT_PATH}/cc_advanced_begin.gif) then - cp ${HTML_DEFAULT_PATH}/cc_advanced_begin.gif ${out_path} - if ( $?DEBUG) echo "cp ${HTML_DEFAULT_PATH}/cc_advanced_begin.gif ${out_path}" -endif -if ( -r ${HTML_DEFAULT_PATH}/cc_advanced_end.gif) then - cp ${HTML_DEFAULT_PATH}/cc_advanced_end.gif ${out_path} - if ( $?DEBUG) echo "cp ${HTML_DEFAULT_PATH}/cc_advanced_end.gif ${out_path}" -endif +foreach f (${HTML_DEFAULT_PATH}/*.gif) + if ( -r $f ) then + cp $f ${out_path} + if ( $?DEBUG) echo "cp $f ${out_path}" + endif +end # Cleanup # ------- @@ -277,18 +339,168 @@ endif end_of_script: exit +# Extended Conversion of multiple manual parts +# -------------------------------------------- +extended_conversion: + +# Step 0: create subdirectories. +# ------------------------------ +if ( $?DEBUG) echo "# Step 0: create subdirectories." +foreach f ($in_files) + if ( $?DEBUG) echo "mkdir ${new_tmp_path}/$f:h" + mkdir ${new_tmp_path}/$f:h + if ( ! -d ${out_path}/$f:h) then + if ( $?DEBUG) echo "mkdir ${out_path}/$f:h" + mkdir ${out_path}/$f:h + endif +end + +# Step 1: convert each LaTeX file into an HTML file. +# -------------------------------------------------- +if ( $?DEBUG) echo "# Step 1: convert each LaTeX file into an HTML file." +foreach f ($in_files) + set options = "${cgal_dir} -config ${config_path}/ -tmp ${new_tmp_path}/$f:h/ -noheader" + if ( $?DEBUG) echo "cd $f:h" + cd $f:h + if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} $f:t >/dev/null" + cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} $f:t >/dev/null + if ( $?DEBUG) echo "cd .." + cd .. +end + + +# Step 2: generate the local hyperlinks. The anchor filter. +# --------------------------------------------------------- +if ( $?DEBUG) echo "# Step 2: generate the hyperlinks. The anchor filter" +foreach f ($in_files) + if ( $?DEBUG) echo "cat ${config_path}/cc_anchor_header ${new_tmp_path}/$f:h/cc_anchor_rules ${config_path}/cc_anchor_footer > ${new_tmp_path}/cc_anchor_filter.yy" + cat ${config_path}/cc_anchor_header ${new_tmp_path}/$f:h/cc_anchor_rules ${config_path}/cc_anchor_footer > ${new_tmp_path}/cc_anchor_filter.yy + + if ( $?DEBUG) echo "flex -t -8 ${new_tmp_path}/cc_anchor_filter.yy > ${new_tmp_path}/cc_anchor_filter.c" + flex -t -8 ${new_tmp_path}/cc_anchor_filter.yy > ${new_tmp_path}/cc_anchor_filter.c + + if ( $?DEBUG) echo "${CC} -o ${new_tmp_path}/cc_anchor_filter ${new_tmp_path}/cc_anchor_filter.c" + ${CC} -o ${new_tmp_path}/cc_anchor_filter ${new_tmp_path}/cc_anchor_filter.c + if (-r cc_anchor_filter.o) rm cc_anchor_filter.o + + # Filtering all HTML files locally. + # --------------------------------- + if ( $?DEBUG) echo "# Filtering all HTML files locally." + mv ${new_tmp_path}/$f:h/cc_index_body ${new_tmp_path}/$f:h/cc_index_body.bak + ${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/$f:h/cc_index_body.bak > ${new_tmp_path}/$f:h/cc_index_body + rm ${new_tmp_path}/$f:h/cc_index_body.bak + foreach ff (${new_tmp_path}/$f:h/*.html) + mv $ff $ff.bak + ${new_tmp_path}/cc_anchor_filter < $ff.bak > $ff + rm $ff.bak + end + setenv CC__LOC_F "$f:h/" + if ( $?DEBUG) echo "cc_patch_anchor_toc_index ${new_tmp_path}/$f:h/cc_index_body ${new_tmp_path}/$f:h/contents.html" + cc_patch_anchor_toc_index ${new_tmp_path}/$f:h/cc_index_body ${new_tmp_path}/$f:h/contents.html + setenv CC__LOC_F ../$f:h/ + if ( $?DEBUG) echo "cc_patch_anchor_filter ${new_tmp_path}/$f:h/cc_anchor_rules" + cc_patch_anchor_filter ${new_tmp_path}/$f:h/cc_anchor_rules +end + + +# Step 3: convert bibliography (if any) and .aux file. +# ----------------------------------------------------------- +if ( $?DEBUG) echo "# Step 3: convert bibliography (if any) and .aux file." +set options = "${cgal_dir} -config ${config_path}/ -tmp ${new_tmp_path}/ -noheader ${aux_file} ${bbl_file}" +touch ${new_tmp_path}/cc_index_body +if ( "${aux_file}" == "" && "${bbl_file}" == "") then + if ( $?DEBUG) echo "touch ${new_tmp_path}/cc_anchor_rules" + touch ${new_tmp_path}/cc_anchor_rules +else + if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} >/dev/null" + cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} >/dev/null +endif + + +# Step 4: generate the global hyperlinks. The anchor filter. +# ----------------------------------------------------------- +if ( $?DEBUG) echo "# Step 4: generate the global hyperlinks. The anchor filter" +if ( $?DEBUG) echo "cat ${config_path}/cc_anchor_header ${new_tmp_path}/cc_anchor_rules > ${new_tmp_path}/cc_anchor_filter.yy" +cat ${config_path}/cc_anchor_header ${new_tmp_path}/cc_anchor_rules > ${new_tmp_path}/cc_anchor_filter.yy +foreach f ($in_files) + if ( $?DEBUG) echo "cat ${new_tmp_path}/$f:h/cc_anchor_rules >> ${new_tmp_path}/cc_anchor_filter.yy" + cat ${new_tmp_path}/$f:h/cc_anchor_rules >> ${new_tmp_path}/cc_anchor_filter.yy +end +if ( $?DEBUG) echo "cat ${config_path}/cc_anchor_footer >> ${new_tmp_path}/cc_anchor_filter.yy" +cat ${config_path}/cc_anchor_footer >> ${new_tmp_path}/cc_anchor_filter.yy + +if ( $?DEBUG) echo "flex -t -8 ${new_tmp_path}/cc_anchor_filter.yy > ${new_tmp_path}/cc_anchor_filter.c" +flex -t -8 ${new_tmp_path}/cc_anchor_filter.yy > ${new_tmp_path}/cc_anchor_filter.c + +if ( $?DEBUG) echo "${CC} -o ${new_tmp_path}/cc_anchor_filter ${new_tmp_path}/cc_anchor_filter.c" +${CC} -o ${new_tmp_path}/cc_anchor_filter ${new_tmp_path}/cc_anchor_filter.c + +if (-r cc_anchor_filter.o) rm cc_anchor_filter.o + +foreach f ($in_files) + # Filtering all HTML files globally. + # ---------------------------------- + if ( $?DEBUG) echo "# Filtering all HTML files globally." + foreach ff (${new_tmp_path}/$f:h/*.html) + ${new_tmp_path}/cc_anchor_filter < $ff > ${out_path}/$f:h/$ff:t + cc_patch_anchor_pages ${out_path}/$f:h/$ff:t + end + rm ${out_path}/$f:h/contents.html +end + +# Converting the index, table of contents, and the bibliography. +# -------------------------------------------------------------- + +if ( $?DEBUG) echo "${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/biblio.html > ${out_path}/biblio.html" +${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/biblio.html > ${out_path}/biblio.html + +if ( $?DEBUG) echo "# Converting the index." +mv ${new_tmp_path}/cc_index_body ${new_tmp_path}/cc_index_body.bak +set options = "${cgal_dir} -config ${config_path}/ -tmp ${new_tmp_path}/ -onlyheader cc_toc_footer cc_toc_header cc_index_footer cc_index_header" +if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} >/dev/null" +cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} >/dev/null +if ( $?DEBUG) echo "cat ${new_tmp_path}/cc_toc_header > ${new_tmp_path}/contents.html" +cat ${new_tmp_path}/cc_toc_header > ${new_tmp_path}/contents.html +cat ${new_tmp_path}/cc_index_body.bak >> ${new_tmp_path}/cc_index_body + +foreach f ($in_files) + if ( $?DEBUG) echo "cat ${new_tmp_path}/$f:h/cc_index_body >> ${new_tmp_path}/cc_index_body" + cat ${new_tmp_path}/$f:h/cc_index_body >> ${new_tmp_path}/cc_index_body + if ( $?DEBUG) echo "cat ${new_tmp_path}/$f:h/contents.html >> ${new_tmp_path}/contents.html" + cat ${new_tmp_path}/$f:h/contents.html >> ${new_tmp_path}/contents.html +end + +if ( $?DEBUG) echo "cat ${new_tmp_path}/cc_toc_footer >> ${new_tmp_path}/contents.html" +cat ${new_tmp_path}/cc_toc_footer >> ${new_tmp_path}/contents.html +if ( $?DEBUG) echo "cc_index_sort -ger ${new_tmp_path}/cc_index_body | sed 's/[<][\!]sort[^\!]*[\!][>]//' > ${new_tmp_path}/cc_index_sorted" +cc_index_sort -ger ${new_tmp_path}/cc_index_body | sed 's/[<][\!]sort[^\!]*[\!][>]//' > ${new_tmp_path}/cc_index_sorted + +if ( $?DEBUG) echo "cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/cc_index_sorted ${new_tmp_path}/cc_index_footer > ${new_tmp_path}/cc_index" +cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/cc_index_sorted ${new_tmp_path}/cc_index_footer > ${new_tmp_path}/cc_index + +if ( $?DEBUG) echo "${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/cc_index > ${out_path}/manual_index.html" +${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/cc_index > ${out_path}/manual_index.html +if ( $?DEBUG) echo "${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/contents.html > ${out_path}/contents.html" +${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/contents.html > ${out_path}/contents.html + +goto conversion_done + + usage: echo "$0 "'$Revision$'" (c) Lutz Kettner" echo "Usage: $0 [] " -echo " -defaults show the settings of the internal variables." -echo " -show_main show the translation result for the main file." -echo " -date set a date for the manual." -echo " -release set a release number for the manual." -echo " -title set a title text for the manual." -echo " -author set an author address (email) for the manual." -echo " -config set the path where to find the config files." -echo " -tmp set the path where to put intermediate files." -echo " " -echo " -o output directory for the generated HTML manual" +echo " -defaults show the settings of the internal variables." +echo " -extended extended organization among multiple dir's." +echo " -show_main show the translation result for the main file." +echo " -date set a date for the manual." +echo " -release set a release number for the manual." +echo " -title set a title text for the manual." +echo " -author set an author address (email) for the manual." +echo " -config set the path where to find the config files." +echo " -tmp set the path where to put intermediate files." +echo " -cgal_dir set the path where the CGAL headers are." +echo " -o output directory for the generated HTML manual" +echo " -aux auxiliary file where the \\bibcite's are in." +echo " -bbl bibliography file produced by bibtex." exit (1) diff --git a/Packages/Manual_tools/src/extract_lex.yy b/Packages/Manual_tools/src/extract_lex.yy index 50d09f53588..df596cccdcc 100644 --- a/Packages/Manual_tools/src/extract_lex.yy +++ b/Packages/Manual_tools/src/extract_lex.yy @@ -46,6 +46,8 @@ char* global_template_params = 0; #define YY_SKIP_YYWRAP 1 #define yywrap() 1 +void skipspaces( void); + %} /* The normal scanning mode parses TeX conventions. */ @@ -281,7 +283,7 @@ blockintro [\{][\\]((tt)|(em)|(it)|(sc)|(sl)) yylval.string.len = strlen( global_classname); } else { printErrorMessage( ClassnameUsedError); - yylval.string.text = "Unknown classname"; + yylval.string.text = "[Unknown classname]"; yylval.string.len = strlen( yylval.string.text); } return STRING; @@ -529,6 +531,44 @@ blockintro [\{][\\]((tt)|(em)|(it)|(sc)|(sl)) return ENDHTMLONLY; } + /* Flexibility for HTML class files. */ + /* -------------------------------------------------------------- */ +[\\]ccHtmlNoClassLinks/{noletter} { + skipspaces(); +} +[\\]ccHtmlNoClassFile/{noletter} { + skipspaces(); +} +[\\]ccHtmlNoClassIndex/{noletter} { + skipspaces(); +} +[\\]begin{w}[\{]ccHtmlClassFile[\}]{w} { + return GOBBLETWOPARAMS; +} +[\\]end{w}[\{]ccHtmlClassFile[\}] { + skipspaces(); +} +[\\]ccHtmlIndex/{noletter} { + skipspaces(); + return GOBBLEONEPARAM; +} +[\\]ccHtmlIndex[\[][^\]][\]]/{noletter} { + skipspaces(); + return GOBBLEONEPARAM; +} +[\\]ccHtmlIndexC/{noletter} { + skipspaces(); + return GOBBLEONEPARAM; +} +[\\]ccHtmlIndexC[\[][^\]][\]]/{noletter} { + skipspaces(); + return GOBBLEONEPARAM; +} +[\\]ccHtmlCrossLink/{noletter} { + skipspaces(); + return GOBBLEONEPARAM; +} + /* make the $ delimiters for math mode disappear: */ /* -------------------------------------------------------------- */ [$] {} @@ -633,6 +673,13 @@ blockintro [\{][\\]((tt)|(em)|(it)|(sc)|(sl)) } %% +void skipspaces( void) { + int c = yyinput(); + while( c && c <= ' ') + c = yyinput(); + unput( c); +} + void init_scanner( FILE* in){ line_number = 1; set_CCMode = 0; diff --git a/Packages/Manual_tools/src/html_config.h b/Packages/Manual_tools/src/html_config.h index e439fc426c1..e06d75ae999 100644 --- a/Packages/Manual_tools/src/html_config.h +++ b/Packages/Manual_tools/src/html_config.h @@ -23,6 +23,61 @@ extern const char* prog_name; extern char* current_filename; +extern char* cgal_lib_dir; + +/* An object storing the current font */ +/* ================================== */ +/* It is only used within CCMode at the moment */ +enum Font { unknown_font = -1, + rm_font, + tt_font, + bf_font, + it_font, + sl_font, + sc_font, + sf_font, + var_font, + math_font, + end_font_array}; + +extern Font current_font; +const char* font_changing_tags( Font old_font, Font new_font); +const char* new_font_tags( Font new_font); +const char* lazy_new_font_tags( Font new_font); + +// Index sorting. +// ============== +// 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. + +extern const char* sort_key_class; +extern const char* sort_key_nested_type; +extern const char* sort_key_struct; +extern const char* sort_key_enum; +extern const char* sort_key_enum_tags; +extern const char* sort_key_typedef; +extern const char* sort_key_variable; +extern const char* sort_key_function; +extern const char* sort_key_member_function; + +const char* find_sort_key( const char* txt); + +/* Flexibility for HTML class files. */ +/* ================================= */ +extern bool html_no_class_links; +extern bool html_no_class_file; +extern bool html_no_class_index; + +extern bool html_inline_classes; + +void handleHtmlClassFile( const char* filename, const Text& T); +void handleHtmlClassFileEnd(); + +const char* handleHtmlIndexC( const char* category, const char* item); +const char* handleHtmlIndex( const char* category, const char* item); +const char* handleHtmlCrossLink( const char* key, bool tmpl_class = false); + /* Functions to manage footnotes. */ /* ============================== */ void insertFootnote( char* s); @@ -86,7 +141,9 @@ void handleString( const char* s); void handleChar( char c); void handleBiblio( const Text& T); -Buffer* handleCite( const char* l); +Buffer* handleCite( const char* cite_keys, const char* option = 0); +// Defines a mapping between cite keys and the visible item for a cite. +Buffer* handleBibCite( const char* key, const char* item); // for an empty item name use the key name as item name Buffer* handleBibItem( const char* key_name, const char* item_name = 0); @@ -95,6 +152,9 @@ void handleClassEnd( void); void handleClassTemplate( const char* classname); void handleClassTemplateEnd( void); +void handleClassNameEnd( void); +void handleClassFileEnd( void); + void handleDeclaration( const char* decl); void handleMethodDeclaration( const char* decl, @@ -134,7 +194,8 @@ enum ErrorNumber { SemicolonMissingError, IncludeNestingTooDeepError, IncludeOpenError, - ChapterStructureError + ChapterStructureError, + UnknownIndexCategoryError }; diff --git a/Packages/Manual_tools/src/html_lex.yy b/Packages/Manual_tools/src/html_lex.yy index 710d07b44cd..2b0cc79f9c1 100644 --- a/Packages/Manual_tools/src/html_lex.yy +++ b/Packages/Manual_tools/src/html_lex.yy @@ -46,6 +46,15 @@ int set_INITIAL = 0; int set_HTMLMODE = 0; int set_MMODE = 0; +/* Store an old state like MMODE before treating macros like ccAnchor */ +/* Some constants for this purpose. */ +const int state_INITIAL = 0; +const int state_MMODE = 1; +const int state_NestingMode = 2; + +int set_old_state = 0; +int old_state = state_INITIAL; + /* Tag to mark whenever the unchecked keyword occurs. */ int unchecked_tag = 0; @@ -103,7 +112,9 @@ int stack_ptr = 0; /* The NestingMode parses only (){}[] nested expressions */ /* The VerbMode parses LaTeX \verb"..." statements as */ /* a sequence of characters */ +/* ccStyleMode parses only ccStyle expressions. */ %x CCMode +%x ccStyleMode %x NestingMode %x VerbMode %x CPROGMode @@ -121,7 +132,7 @@ CCletter [a-zA-Z_] idfier {letter}+ texmacro [\\]{idfier} CCidfier ({CCletter}({CCletter}|{digit})*) -filename [^ \t\n/\\\{\}\[\]()]+ +filename [^ \t\n\\\{\}\[\]()]+ space [\t ] w {space}* ws {space}+ @@ -135,11 +146,14 @@ expNumber ({floatNumber}|{signNumber}){exp}{signNumber} No ({signNumber}|{floatNumber}|{expNumber}) operator [^a-zA-Z_0-9\n\r\t \\] measure {signNumber}{letter}{letter} -ttblockintro [\{][\\](tt) -emblockintro [\{][\\](em) -itblockintro [\{][\\]((it)|(sl)) -scblockintro [\{][\\](sc) -bfblockintro [\{][\\](bf) +rmblockintro ([\{][\\](rm))|([\\]((text)|(math))rm[\{]) +ttblockintro ([\{][\\](tt))|([\\]((text)|(math))tt[\{]) +emblockintro ([\{][\\](em))|([\\]emph[\{]) +itblockintro ([\{][\\]((it)|(sl)))|([\\]((text)|(math))((it)|(sl))[\{]) +scblockintro ([\{][\\](sc))|([\\]textsc[\{]) +sfblockintro ([\{][\\](sf))|([\\]((text)|(math))sf[\{]) +bfblockintro ([\{][\\]((bf)|(mathbold)))|([\\]((text)|(math))bf[\{]) +calblockintro ([\{][\\](cal))|([\\]mathcal[\{]) %% /* Mode switching can be triggered from the parser */ @@ -164,16 +178,30 @@ bfblockintro [\{][\\](bf) BEGIN( MMODE); set_MMODE = 0; } + if (set_old_state) { + switch ( old_state) { + case state_INITIAL: + BEGIN( INITIAL); + break; + case state_MMODE: + BEGIN( MMODE); + break; + case state_NestingMode: + BEGIN( NestingMode); + break; + } + set_old_state = 0; + } /* Count line numbers in all modes for better error messages */ /* --------------------------------------------------------- */ -[\n] { +[\n] { line_number++; if ( line_switch) cerr << "src-line " << line_number << endl; return NEWLINE; } -[\\]"\n" { +[\\]"\n" { line_number++; if ( line_switch) cerr << "src-line " << line_number << endl; @@ -254,11 +282,11 @@ bfblockintro [\{][\\](bf) /* Rules for TeX conventions */ /* ------------------------- */ -[\\]"%" { /* Avoid the quoted comment symbol */ +[\\]"%" { /* Avoid the quoted comment symbol */ yylval.character = '%'; return CHAR; } -"%".*[\n]{w} { /* Match one line TeX comments */ +"%".*[\n]{w} { /* Match one line TeX comments */ /* remove spaces in next line */ unput( '\n'); } @@ -326,6 +354,7 @@ bfblockintro [\{][\\](bf) /* ------------------------------------------------------------------ */ [\\]begin{w}[\{]ccClass[\}]{w} { BEGIN( CCMode); + current_font = it_font; return BEGINCLASS; } [\\]end{w}[\{]ccClass[\}] { @@ -333,6 +362,7 @@ bfblockintro [\{][\\](bf) } [\\]begin{w}[\{]ccClassTemplate[\}]{w} { BEGIN( CCMode); + current_font = it_font; return BEGINCLASSTEMPLATE; } [\\]end{w}[\{]ccClassTemplate[\}] { @@ -355,98 +385,115 @@ bfblockintro [\{][\\](bf) delete[] formatted_creationvariable; creationvariable = newstr( r); formatted_creationvariable = new char[ strlen( - creationvariable) + 12]; - strcpy( formatted_creationvariable, ""); + creationvariable) + 8]; + strcpy( formatted_creationvariable, ""); strcat( formatted_creationvariable, creationvariable); - strcat( formatted_creationvariable, ""); + strcat( formatted_creationvariable, ""); yylval.string.text = r; yylval.string.len = s - r + 1; return CREATIONVARIABLE; } [\\]ccConstructor/{noletter} { /* constructor declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return CONSTRUCTOR; } [\\]ccMemberFunction/{noletter} { /* method declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return METHOD; } [\\]ccMethod/{noletter} { /* method declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return METHOD; } [\\]ccFunction/{noletter} { /* function declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return FUNCTION; } [\\]ccFunctionTemplate/{noletter} { /* function template declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return FUNCTIONTEMPLATE; } [\\]ccVariable/{noletter} { /* variable declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return VARIABLE; } [\\]ccTypedef/{noletter} { /* typedef declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return TYPEDEF; } [\\]ccNestedType/{noletter} { /* nested type declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return NESTEDTYPE; } [\\]ccEnum/{noletter} { /* enum declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return ENUM; } [\\]ccStruct/{noletter} { /* struct declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return STRUCT; } [\\]ccGlobalFunction/{noletter} { /* function declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return GLOBALFUNCTION; } [\\]ccGlobalFunctionTemplate/{noletter} { /* function template declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return GLOBALFUNCTIONTEMPLATE; } [\\]ccGlobalVariable/{noletter} { /* variable declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return GLOBALVARIABLE; } [\\]ccGlobalTypedef/{noletter} { /* typedef declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return GLOBALTYPEDEF; } [\\]ccGlobalEnum/{noletter} { /* enum declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return GLOBALENUM; } [\\]ccGlobalStruct/{noletter} { /* struct declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return GLOBALSTRUCT; } [\\]ccDeclaration/{noletter} { /* general declaration: change to CCMode */ skipspaces(); + current_font = it_font; BEGIN( CCMode); return DECLARATION; } @@ -480,20 +527,42 @@ bfblockintro [\{][\\](bf) } [\\]"begin{ccHtmlOnly}" { + old_state = state_INITIAL; + BEGIN( HTMLGROUPMode); + return HTMLBEGIN; + } +[\\]"begin{ccHtmlOnly}" { + old_state = state_MMODE; + BEGIN( HTMLGROUPMode); + return HTMLBEGIN; + } +[\\]"begin{ccHtmlOnly}" { + old_state = state_NestingMode; BEGIN( HTMLGROUPMode); return HTMLBEGIN; } [\\]"end{ccHtmlOnly}" { - BEGIN( INITIAL); + set_old_state = 1; return HTMLEND; } [\\]"begin{ccTexOnly}" { + old_state = state_INITIAL; + BEGIN( TEXONLYMODE); + return TEXONLYBEGIN; + } +[\\]"begin{ccTexOnly}" { + old_state = state_MMODE; + BEGIN( TEXONLYMODE); + return TEXONLYBEGIN; + } +[\\]"begin{ccTexOnly}" { + old_state = state_NestingMode; BEGIN( TEXONLYMODE); return TEXONLYBEGIN; } [\\]"end{ccTexOnly}" { - BEGIN( INITIAL); + set_old_state = 1; return TEXONLYEND; } . { @@ -501,29 +570,105 @@ bfblockintro [\{][\\](bf) return CHAR; } [\\]ccTexHtml{w}[\{] { + old_state = state_INITIAL; + return LATEXHTML; + } +[\\]ccTexHtml{w}[\{] { + old_state = state_MMODE; + return LATEXHTML; + } +[\\]ccTexHtml{w}[\{] { + old_state = state_NestingMode; return LATEXHTML; } [\\]ccAnchor{w}[\{] { /* The first parameter is the URL, the second is the */ /* message that will be highlighted */ + old_state = state_INITIAL; + BEGIN( HTMLMODE); + return ANCHOR; + } +[\\]ccAnchor{w}[\{] { + old_state = state_MMODE; + BEGIN( HTMLMODE); + return ANCHOR; + } +[\\]ccAnchor{w}[\{] { + old_state = state_NestingMode; BEGIN( HTMLMODE); return ANCHOR; } [\}] { - BEGIN( INITIAL); + set_old_state = 1; return '}'; } . { yylval.character = yytext[0]; return CHAR; } +[\\]path[|][^|]*[|] { + yylval.string.text = yytext + 6; + yylval.string.len = -1; + return HTMLPATH; +} + + /* Flexibility for HTML class files. */ + /* -------------------------------------------------------------- */ +[\\]ccHtmlNoClassLinks/{noletter} { + skipspaces(); + html_no_class_links = true; +} +[\\]ccHtmlNoClassFile/{noletter} { + skipspaces(); + html_no_class_file = true; +} +[\\]ccHtmlNoClassIndex/{noletter} { + skipspaces(); + html_no_class_index = true; +} +[\\]begin{w}[\{]ccHtmlClassFile[\}]{w} { + BEGIN( CCMode); + return HTMLBEGINCLASSFILE; +} +[\\]end{w}[\{]ccHtmlClassFile[\}] { + skipspaces(); + return HTMLENDCLASSFILE; +} +[\\]ccHtmlIndex/{noletter} { + skipspaces(); + yylval.string.text = sort_key_class; + return HTMLINDEX; +} +[\\]ccHtmlIndex[\[][^\]][\]]/{noletter} { + skipspaces(); + yylval.string.text = find_sort_key( yytext + 13); + return HTMLINDEX; +} +[\\]ccHtmlIndexC/{noletter} { + skipspaces(); + yylval.string.text = sort_key_class; + BEGIN( CCMode); + return HTMLINDEXC; +} +[\\]ccHtmlIndexC[\[][^\]][\]]/{noletter} { + skipspaces(); + yylval.string.text = find_sort_key( yytext + 14); + BEGIN( CCMode); + return HTMLINDEXC; +} +[\\]ccHtmlCrossLink/{noletter} { + skipspaces(); + BEGIN( CCMode); + return HTMLCROSSLINK; +} /* Specialized keywords from the manual style */ /* -------------------------------------------------------------- */ [\\]cc((Style)|(c))/{noletter} { - /* CCstyle formatting: change to NestingMode */ + /* CCstyle formatting: change to ccStyleMode */ skipspaces(); - BEGIN( NestingMode); + BEGIN( ccStyleMode); + current_font = it_font; return CCSTYLE; } [\\]ccVar/{noletter} { @@ -772,21 +917,22 @@ bfblockintro [\{][\\](bf) } [\\]begin[\{]ccAdvanced[\}] { skipspaces(); - yylval.string.text = "
      \"begin
      "; + yylval.string.text = "
      \"begin
      "; yylval.string.len = -1; return STRING; } [\\]end[\{]ccAdvanced[\}] { skipspaces(); - yylval.string.text = "
      \"end
      "; + yylval.string.text = "
      \"end
      "; yylval.string.len = -1; return STRING; } [\\]ccInclude/{noletter} { + current_font = it_font; return INCLUDE; } [\\]ccHeading/{noletter} { @@ -964,7 +1110,7 @@ bfblockintro [\{][\\](bf) yylval.string.len = 3; return STRING; } -[\\]ldots/{noletter} { +[\\](l?)dots/{noletter} { skipspaces(); yylval.string.text = "..."; yylval.string.len = 3; @@ -991,17 +1137,17 @@ bfblockintro [\{][\\](bf) [\\]((big)|(med))skip/{noletter} { return NEWLINE; } -[\\]"&" { +[\\]"&" { yylval.string.text = "&"; yylval.string.len = 5; return STRING; } -[\\][_^#$~%] { +[\\][_^#$~%] { yylval.character = yytext[1]; return CHAR; } [~] | -[\\]{space} { +[\\]{space} { yylval.string.text = " "; yylval.string.len = 1; return SPACE; @@ -1057,7 +1203,6 @@ bfblockintro [\{][\\](bf) } /* yet not supported characters ... - [\\]times/{noletter} { SET( "×"); return STRING;} [\\]delta/{noletter} { SET( "δ"); return STRING;} [\\]epsilon/{noletter} { SET( "ε"); return STRING;} [\\]varepsilon/{noletter} { SET( "ε"); return STRING;} @@ -1079,7 +1224,8 @@ bfblockintro [\{][\\](bf) [\\]"^"a { SET( "â"); return STRING;} [\\]"^"e { SET( "ê"); return STRING;} [\\]ss[\{][\}] { SET( "ß"); return STRING;} -[\\]times/{noletter} { SET( "x"); return STRING;} +[\\]times/{noletter} { SET( "×"); return STRING;} +[\\]in/{noletter} { SET( " is in "); return STRING;} [\\]alpha/{noletter} { SET( "α"); return STRING;} [\\]beta/{noletter} { SET( "β"); return STRING;} [\\]gamma/{noletter} { SET( "γ"); return STRING;} @@ -1121,6 +1267,34 @@ bfblockintro [\{][\\](bf) [\\]Psi/{noletter} { SET( "Ψ"); return STRING;} [\\]Omega/{noletter} { SET( "Ω"); return STRING;} + /* math symbols */ + /* ------------ */ + +[\\]((arc)?)|((tan)|(sin)|(cos))/{noletter} { + yylval.string.text = yytext+1; + yylval.string.len = yyleng-1; + return STRING; +} +[\\]((arg)|(cosh)|(sinh)|(cot)|(coth)|(csc)|(deg)|(det))/{noletter} { + yylval.string.text = yytext+1; + yylval.string.len = yyleng-1; + return STRING; +} +[\\]((dim)|(exp)|(gcd)|(hom)|(inf)|(ker)|(lg)|(lim))/{noletter} { + yylval.string.text = yytext+1; + yylval.string.len = yyleng-1; + return STRING; +} +[\\]((liminf)|(limsup)|(ln)|(log)|(max)|(min)|(Pr)|(sec))/{noletter} { + yylval.string.text = yytext+1; + yylval.string.len = yyleng-1; + return STRING; +} +[\\]((sinh)|(sup)|(tanh)|(bmod)|(pmod))/{noletter} { + yylval.string.text = yytext+1; + yylval.string.len = yyleng-1; + return STRING; +} /* keywords from TeX/LaTeX that should vanish in HTML */ /* -------------------------------------------------------------- */ @@ -1173,7 +1347,7 @@ bfblockintro [\{][\\](bf) BEGIN( INITIAL); return MBOX; } -[\\][,;:!] {} +[\\][,;:!] {} @@ -1199,11 +1373,14 @@ bfblockintro [\{][\\](bf) return ENDBIBLIO; } [\\]newblock/{noletter} {} -[\\]cite{w}([\[][^\]]*[\]])?[\{][^\}]*[\}] { - yylval.string.text = yytext; - yylval.string.len = yyleng; +[\\]cite{w}/{noletter} { + BEGIN( NestingMode); return CITE; } +[\\]bibcite{w}/{noletter} { + BEGIN( NestingMode); + return BIBCITE; + } [\\]bibitem{w}/{noletter} { BEGIN( NestingMode); return BIBITEM; @@ -1212,11 +1389,11 @@ bfblockintro [\{][\\](bf) /* Grouping symbols */ /* ---------------- */ -[\\][\{] { +[\\][\{] { yylval.character = '{'; return CHAR; } -[\\][\}] { +[\\][\}] { yylval.character = '}'; return CHAR; } @@ -1228,20 +1405,43 @@ bfblockintro [\{][\\](bf) yylval.character = yytext[6]; return CHAR; } -[\{] { +[\{] { return '{'; } -[\}] { +[\}] { return '}'; } -{ttblockintro} { /* A couple of TeX styles like {\tt ... */ +{ttblockintro} { /* TeX styles like {\tt ... */ return TTBLOCKINTRO; } -{emblockintro} { return EMBLOCKINTRO; } -{itblockintro} { return ITBLOCKINTRO; } -{scblockintro} { return SCBLOCKINTRO; } -{bfblockintro} { return BFBLOCKINTRO; } +{emblockintro} { return EMBLOCKINTRO; } +{itblockintro} { return ITBLOCKINTRO; } +{scblockintro} { return SCBLOCKINTRO; } +{bfblockintro} { return BFBLOCKINTRO; } +{rmblockintro} { return RMBLOCKINTRO; } +{sfblockintro} { return SFBLOCKINTRO; } +{calblockintro} { return CALBLOCKINTRO; } + +[\\]tt/{noletter} { + skipspaces(); + yylval.string.text = "\\T\\"; + yylval.string.len = -1; + return STRING; + } +[\\]ccFont/{noletter} { + skipspaces(); + yylval.string.text = "\\I\\"; + yylval.string.len = -1; + return STRING; + } +[\\](l?)dots/{noletter} { + skipspaces(); + yylval.string.text = "..."; + yylval.string.len = 3; + return STRING; + } +[\\]ccEndFont/{noletter} {} [\[] { return '['; @@ -1257,6 +1457,19 @@ bfblockintro [\{][\\](bf) return ')'; } +"---" { + skipspaces(); + yylval.string.text = " - "; + yylval.string.len = 3; + return STRING; + } + +"--" { + yylval.string.text = "-"; + yylval.string.len = 1; + return STRING; + } + /* TeX macros */ /* -------------------------------------- */ [\\]((ref)|(ccTrue)|(ccFalse)|(kill)|(parskip)|(parindent))/{noletter} { // copy without warning @@ -1264,7 +1477,7 @@ bfblockintro [\{][\\](bf) yylval.string.len = -1; return STRING; } -{texmacro} { +{texmacro} { if (actual_defining) { yylval.string.text = yytext; } else { @@ -1298,7 +1511,7 @@ bfblockintro [\{][\\](bf) } return SPACE; } -{ws} { +{ws} { yylval.string.text = yytext; yylval.string.len = yyleng; return SPACE; @@ -1307,7 +1520,7 @@ bfblockintro [\{][\\](bf) yylval.character = yytext[0]; return CHAR; } -[\\][/] {} +[\\][/] {} [&] { if ( tab_tag) { yylval.string.text = @@ -1320,7 +1533,7 @@ bfblockintro [\{][\\](bf) return STRING; } -. { +. { yylval.character = yytext[0]; if ( is_html_multi_character( yylval.character)) { yylval.string.text = html_multi_character( diff --git a/Packages/Manual_tools/src/html_syntax.y b/Packages/Manual_tools/src/html_syntax.y index eb7e53b2304..3fad7f52a8f 100644 --- a/Packages/Manual_tools/src/html_syntax.y +++ b/Packages/Manual_tools/src/html_syntax.y @@ -27,6 +27,7 @@ extern int set_INITIAL; extern int set_HTMLMODE; extern int set_MMODE; extern int line_number; +extern int set_old_state; extern const char* in_filename; extern char* creationvariable; @@ -70,6 +71,7 @@ extern bool actual_defining; /* ============== */ int yyerror( char *s); Text* blockintroProcessing( const char* text, int len, Text* t); +Buffer* blockintroProcessing( const char* text, int len, Buffer* t); extern bool mbox_within_math; @@ -101,7 +103,8 @@ extern bool mbox_within_math; %token SUBSUBSECTION %token BEGINBIBLIO %token ENDBIBLIO -%token BIBITEM +%token BIBCITE +%token BIBITEM %token CITE %token LABEL %token BEGINCLASS @@ -137,8 +140,14 @@ extern bool mbox_within_math; %token TEXONLYEND %token LATEXHTML %token ANCHOR +%token HTMLPATH %token HTMLBEGIN %token HTMLEND +%token HTMLBEGINCLASSFILE +%token HTMLENDCLASSFILE +%token HTMLINDEX +%token HTMLINDEXC +%token HTMLCROSSLINK %token CCSTYLE %token CCSECTION @@ -162,6 +171,9 @@ extern bool mbox_within_math; %token ITBLOCKINTRO %token SCBLOCKINTRO %token BFBLOCKINTRO +%token RMBLOCKINTRO +%token SFBLOCKINTRO +%token CALBLOCKINTRO %token MBOX %token FOOTNOTEMARK @@ -223,6 +235,7 @@ stmt: string { handleBuffer( * $1); } | BEGINCLASS classname { handleClass( $2->string()); + current_font = unknown_font; delete $2; } decl_sequence @@ -234,6 +247,7 @@ stmt: string { handleBuffer( * $1); } | BEGINCLASSTEMPLATE classname { handleClassTemplate( $2->string()); + current_font = unknown_font; delete $2; } decl_sequence @@ -243,18 +257,41 @@ stmt: string { handleBuffer( * $1); delete[] creationvariable; creationvariable = NULL; } + | HTMLBEGINCLASSFILE + classname { set_NestingMode = 1; } + comment_group + { handleHtmlClassFile( $2->string(), + * $4); + set_INITIAL = 1; + delete $2; + delete $4; + } + input + HTMLENDCLASSFILE { + handleHtmlClassFileEnd(); + } | CREATIONVARIABLE {} | CCSTYLE '{' nested_token_sequence '}' { set_INITIAL = 1; - handleString( ""); + handleString( ""); handleText( * $3); - handleString( ""); + handleString( ""); + current_font = unknown_font; delete $3; } | INCLUDE '{' comment_sequence '}' { - handleString( "#include <"); - handleText( * $3); - handleString( ">"); + handleString( "#include <"); + if (cgal_lib_dir) { + handleString( ""); + handleText( * $3); + handleString( ""); + } else + handleText( * $3); + handleString( ">"); + current_font = unknown_font; delete $3; } | HEADING '{' comment_sequence '}' { @@ -302,6 +339,10 @@ blockintro: TTBLOCKINTRO { $$.text = "\0"; $$.len = 4; } | ITBLOCKINTRO { $$.text = "\0"; $$.len = 3; } | SCBLOCKINTRO { $$.text = "\0"; $$.len = -1; } | BFBLOCKINTRO { $$.text = "\0"; $$.len = 3; } + /* Sorry: \rm not supported. TT might be fine. */ + | RMBLOCKINTRO { $$.text = "\0"; $$.len = 4; } + | SFBLOCKINTRO { $$.text = "\0"; $$.len = 4; } + | CALBLOCKINTRO { $$.text = "\0"; $$.len = 4; } ; @@ -351,7 +392,60 @@ string_token: STRING { $$->add( $1.text, $1.len); $$->add( "\">"); } - | CITE { $$ = handleCite( $1.text); } + | HTMLINDEX '{' nested_token_sequence '}' { + char* s = text_block_to_string(* $3); + delete $3; + const char* p = handleHtmlIndex( $1.text, s); + delete[] s; + $$ = new Buffer; + $$->add( p); + } + | HTMLINDEXC '{' nested_token_sequence '}' { + set_INITIAL = 1; + char* s = text_block_to_string(* $3); + delete $3; + const char* p = handleHtmlIndexC( $1.text,s); + delete[] s; + $$ = new Buffer; + $$->add( p); + } + | HTMLCROSSLINK '{' nested_token_sequence '}' { + set_INITIAL = 1; + char* s = text_block_to_string(* $3); + delete $3; + const char* p = handleHtmlCrossLink( s); + delete[] s; + $$ = new Buffer; + $$->add( p); + } + | CITE '{' nested_token_sequence '}' { + set_INITIAL = 1; + char* s = text_block_to_string(* $3); + $$ = handleCite( s); + delete[] s; + delete $3; + } + | CITE '[' nested_token_sequence ']' + '{' nested_token_sequence '}' { + set_INITIAL = 1; + char* s = text_block_to_string(* $3); + char* p = text_block_to_string(* $6); + $$ = handleCite( p, s); + delete[] s; + delete[] p; + delete $3; + delete $6; + } + | BIBCITE '{' nested_token_sequence '}' + '{' nested_token_sequence '}' { + set_INITIAL = 1; + char* s = text_block_to_string(* $3); + char* p = text_block_to_string(* $6); + $$ = handleBibCite( s, p); + delete[] p; + delete[] s; + delete $3; + } | BIBITEM '{' nested_token_sequence '}' { set_INITIAL = 1; char* s = text_block_to_string(* $3); @@ -757,18 +851,19 @@ compound_comment: '{' full_comment_sequence '}' { set_INITIAL = 1; if ( $$->isEmpty() || $$->head().isSpace) // should not - $$->cons( *new TextToken( "", 1)); + $$->cons( *new TextToken( "", 1)); else - $$->head().prepend( ""); + $$->head().prepend( ""); InListFIter< TextToken> ix( * $$); ForAll( ix) { if ( ix.isLast()) if ( ix->isSpace) $$->append( *new TextToken( - "", 1)); + "", 1)); else - ix->add( ""); + ix->add( ""); } + current_font = unknown_font; } | verbatim_style { $$ = new Text( managed); @@ -798,10 +893,20 @@ compound_comment: '{' full_comment_sequence '}' { } | INCLUDE '{' comment_sequence '}' { $$ = $3; + if (cgal_lib_dir) { + char* s = text_block_to_string(* $3); + $$->cons( *new TextToken("\">")); + $$->cons( *new TextToken(s)); + $$->cons( *new TextToken(cgal_lib_dir)); + $$->cons( *new TextToken("append( *new TextToken( "")); + delete[] s; + } $$->cons( *new TextToken( "<")); $$->cons( *new TextToken( " ", 1, true)); - $$->cons( *new TextToken( "#include")); - $$->append( *new TextToken( ">")); + $$->cons( *new TextToken( "#include")); + $$->append( *new TextToken( ">")); + current_font = unknown_font; } | HEADING '{' comment_sequence '}' { $$ = $3; @@ -897,6 +1002,7 @@ declaration: '{' { '}' { set_INITIAL = 1; CCMode = 0; + current_font = unknown_font; $$ = $3; } ; @@ -1010,6 +1116,14 @@ verbatim_style: CPROGBEGIN string_with_nl_or_mt CPROGEND { delete[] s; delete $4; } + | HTMLPATH { + $$ = new Buffer; + $$->add( "add( $1.text, strlen( $1.text) - 1); + $$->add( "\">"); + $$->add( $1.text, strlen( $1.text) - 1); + $$->add( ""); + } ; texonly_style: TEXONLYBEGIN string_with_nl TEXONLYEND { delete $2; @@ -1040,6 +1154,11 @@ math_token: { $$ = $2; } + | blockintro math_sequence '}' { + $$ = blockintroProcessing( $1.text, + $1.len, + $2); + } | SINGLESUBSCRIPT { $$ = new Buffer; @@ -1119,6 +1238,8 @@ const char* errorMessage( ErrorNumber n) { return "Cannot open include file"; case ChapterStructureError: return "Malformed chapter structure: one chapter per file"; + case UnknownIndexCategoryError: + return "Unknown index category in optional argument of \\ccHtmlIndex"; } return "UNKNOWN ERROR MESSAGE NUMBER"; } @@ -1152,3 +1273,14 @@ Text* blockintroProcessing( const char* text, int len, Text* t) { return t; } +Buffer* blockintroProcessing( const char* text, int len, Buffer* t) { + if ( len < 0) { /* Hack! Here we know that t has to get capitalized.*/ + len = 4; + t->capitalize(); + } + t->prepend( text, len); + /* Hack! ptr arithmetic points to the closing tag text */ + t->add( text + len + 1); + return t; +} +