mirror of https://github.com/CGAL/cgal
Release before handing over to Susan Hert.
This commit is contained in:
parent
730575e298
commit
5c0cd50a43
|
|
@ -1,7 +1,7 @@
|
||||||
INSTALLATION for the Specification and Manual Writing Tools
|
INSTALLATION for the Specification and Manual Writing Tools
|
||||||
for C++ Reference Manuals
|
for C++ Reference Manuals
|
||||||
===========================================================
|
===========================================================
|
||||||
03.08.1998 Zurich Lutz Kettner
|
24.08.1999 Zurich Lutz Kettner
|
||||||
|
|
||||||
|
|
||||||
Installation of the Supporting Tools:
|
Installation of the Supporting Tools:
|
||||||
|
|
@ -11,7 +11,7 @@ Installation of the Supporting Tools:
|
||||||
|
|
||||||
(1) System Requirements:
|
(1) System Requirements:
|
||||||
|
|
||||||
* C++ Compiler (Gnu g++ 2.8.1 and SGI CC 7.2 were tested)
|
* C++ Compiler (Gnu g++ 2.8.1, 2.95.1, Gnu egcs 1.1.2)
|
||||||
* C Compiler (Gnu gcc 2.6.3 or the usual system cc compiler)
|
* C Compiler (Gnu gcc 2.6.3 or the usual system cc compiler)
|
||||||
* flex and bison
|
* flex and bison
|
||||||
* perl 5
|
* perl 5
|
||||||
|
|
|
||||||
|
|
@ -94,20 +94,22 @@ all: $(ALL)
|
||||||
# modules
|
# modules
|
||||||
# --------------------
|
# --------------------
|
||||||
|
|
||||||
database.o : database.C database.h config.h
|
basic.o : basic.h
|
||||||
|
|
||||||
extract_lex.o : extract_syntax.tab.h database.h config.h
|
buffer.o : buffer.C buffer.h config.h basic.h
|
||||||
|
|
||||||
extract_syntax.o : extract_syntax.tab.h database.h config.h
|
extract_lex.o : extract_syntax.tab.h buffer.h config.h basic.h
|
||||||
|
|
||||||
cc_extract.o : database.h config.h
|
extract_syntax.o : extract_syntax.tab.h buffer.h config.h basic.h
|
||||||
|
|
||||||
cc_build_checker.o : database.h config.h
|
cc_extract.o : buffer.h config.h basic.h
|
||||||
|
|
||||||
|
cc_build_checker.o : buffer.h config.h basic.h
|
||||||
|
|
||||||
# program
|
# program
|
||||||
# --------------------
|
# --------------------
|
||||||
OBJ = extract_lex.o extract_syntax.o database.o
|
OBJ = extract_lex.o extract_syntax.o buffer.o basic.o
|
||||||
HEADER = extract_syntax.tab.h database.h config.h
|
HEADER = extract_syntax.tab.h buffer.h config.h basic.h
|
||||||
|
|
||||||
cc_extract : ${OBJ} ${HEADER} cc_extract.o
|
cc_extract : ${OBJ} ${HEADER} cc_extract.o
|
||||||
${CXX} ${CXXFLAGS} -o $@ $@.o ${OBJ} ${LDFLAGS}
|
${CXX} ${CXXFLAGS} -o $@ $@.o ${OBJ} ${LDFLAGS}
|
||||||
|
|
@ -132,7 +134,8 @@ cc_extract_html.o : cc_extract_html.C
|
||||||
# --------------------
|
# --------------------
|
||||||
OBJHTML = html_lex.o \
|
OBJHTML = html_lex.o \
|
||||||
html_syntax.o \
|
html_syntax.o \
|
||||||
database.o \
|
basic.o \
|
||||||
|
buffer.o \
|
||||||
macro_dictionary.o \
|
macro_dictionary.o \
|
||||||
internal_macros.o \
|
internal_macros.o \
|
||||||
html_error.o \
|
html_error.o \
|
||||||
|
|
@ -202,7 +205,8 @@ install: rminstall pathinstall cpinstall mvinstall refinstall gifinstall
|
||||||
|
|
||||||
DEPENDSRC = html_lex.C \
|
DEPENDSRC = html_lex.C \
|
||||||
html_syntax.C \
|
html_syntax.C \
|
||||||
database.C \
|
basic.C \
|
||||||
|
buffer.C \
|
||||||
macro_dictionary.C \
|
macro_dictionary.C \
|
||||||
internal_macros.C \
|
internal_macros.C \
|
||||||
html_error.C \
|
html_error.C \
|
||||||
|
|
@ -216,7 +220,7 @@ DEPENDSRC = html_lex.C \
|
||||||
|
|
||||||
depend: ${DEPENDSRC}
|
depend: ${DEPENDSRC}
|
||||||
# Works only with SunPro CC
|
# Works only with SunPro CC
|
||||||
CC -I. ${CPPFLAGS} ${CXXFLAGS} -xM1 ${DEPENDSRC} | grep -v "STL/SUN" | grep -v "ADT" | grep -v "opt/SUNWspro" | sort | uniq > Makefile_depend
|
CC -I. ${CPPFLAGS} ${CXXFLAGS} -xM1 ${DEPENDSRC} | grep -v "STL/SUN" | grep -v "opt/SUNWspro" | sort | uniq > Makefile_depend
|
||||||
|
|
||||||
|
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
cc_extract_html.C:
|
cc_extract_html.C:
|
||||||
cc_extract_html.o : ./database.h
|
cc_extract_html.o : ./basic.h
|
||||||
|
cc_extract_html.o : ./buffer.h
|
||||||
cc_extract_html.o : ./html_config.h
|
cc_extract_html.o : ./html_config.h
|
||||||
cc_extract_html.o : ./html_error.h
|
cc_extract_html.o : ./html_error.h
|
||||||
cc_extract_html.o : ./html_lex.h
|
cc_extract_html.o : ./html_lex.h
|
||||||
|
|
@ -13,7 +14,8 @@ cc_extract_html.o : ./string_conversion.h
|
||||||
cc_extract_html.o : cc_extract_html.C
|
cc_extract_html.o : cc_extract_html.C
|
||||||
cpp_formatting.C:
|
cpp_formatting.C:
|
||||||
cpp_formatting.o : ./cpp_formatting.h
|
cpp_formatting.o : ./cpp_formatting.h
|
||||||
cpp_formatting.o : ./database.h
|
cpp_formatting.o : ./basic.h
|
||||||
|
cpp_formatting.o : ./buffer.h
|
||||||
cpp_formatting.o : ./html_config.h
|
cpp_formatting.o : ./html_config.h
|
||||||
cpp_formatting.o : ./html_error.h
|
cpp_formatting.o : ./html_error.h
|
||||||
cpp_formatting.o : ./html_lex.h
|
cpp_formatting.o : ./html_lex.h
|
||||||
|
|
@ -23,18 +25,21 @@ cpp_formatting.o : ./mstring.h
|
||||||
cpp_formatting.o : ./output.h
|
cpp_formatting.o : ./output.h
|
||||||
cpp_formatting.o : ./string_conversion.h
|
cpp_formatting.o : ./string_conversion.h
|
||||||
cpp_formatting.o : cpp_formatting.C
|
cpp_formatting.o : cpp_formatting.C
|
||||||
database.C:
|
buffer.C:
|
||||||
database.o : ./database.h
|
buffer.o : ./basic.h
|
||||||
database.o : database.C
|
buffer.o : ./buffer.h
|
||||||
|
buffer.o : buffer.C
|
||||||
html_error.C:
|
html_error.C:
|
||||||
html_error.o : ./database.h
|
html_error.o : ./basic.h
|
||||||
|
html_error.o : ./buffer.h
|
||||||
html_error.o : ./html_config.h
|
html_error.o : ./html_config.h
|
||||||
html_error.o : ./html_error.h
|
html_error.o : ./html_error.h
|
||||||
html_error.o : ./lex_include.h
|
html_error.o : ./lex_include.h
|
||||||
html_error.o : ./mstring.h
|
html_error.o : ./mstring.h
|
||||||
html_error.o : html_error.C
|
html_error.o : html_error.C
|
||||||
html_lex.C:
|
html_lex.C:
|
||||||
html_lex.o : ./database.h
|
html_lex.o : ./basic.h
|
||||||
|
html_lex.o : ./buffer.h
|
||||||
html_lex.o : ./html_config.h
|
html_lex.o : ./html_config.h
|
||||||
html_lex.o : ./html_error.h
|
html_lex.o : ./html_error.h
|
||||||
html_lex.o : ./html_lex.h
|
html_lex.o : ./html_lex.h
|
||||||
|
|
@ -47,8 +52,9 @@ html_lex.o : ./mstring.h
|
||||||
html_lex.o : ./string_conversion.h
|
html_lex.o : ./string_conversion.h
|
||||||
html_lex.o : html_lex.C
|
html_lex.o : html_lex.C
|
||||||
html_syntax.C:
|
html_syntax.C:
|
||||||
|
html_syntax.o : ./basic.h
|
||||||
html_syntax.o : ./cpp_formatting.h
|
html_syntax.o : ./cpp_formatting.h
|
||||||
html_syntax.o : ./database.h
|
html_syntax.o : ./buffer.h
|
||||||
html_syntax.o : ./html_config.h
|
html_syntax.o : ./html_config.h
|
||||||
html_syntax.o : ./html_error.h
|
html_syntax.o : ./html_error.h
|
||||||
html_syntax.o : ./html_lex.h
|
html_syntax.o : ./html_lex.h
|
||||||
|
|
@ -60,8 +66,9 @@ html_syntax.o : ./mstring.h
|
||||||
html_syntax.o : ./string_conversion.h
|
html_syntax.o : ./string_conversion.h
|
||||||
html_syntax.o : html_syntax.C
|
html_syntax.o : html_syntax.C
|
||||||
internal_macros.C:
|
internal_macros.C:
|
||||||
|
internal_macros.o : ./basic.h
|
||||||
internal_macros.o : ./cpp_formatting.h
|
internal_macros.o : ./cpp_formatting.h
|
||||||
internal_macros.o : ./database.h
|
internal_macros.o : ./buffer.h
|
||||||
internal_macros.o : ./html_config.h
|
internal_macros.o : ./html_config.h
|
||||||
internal_macros.o : ./html_error.h
|
internal_macros.o : ./html_error.h
|
||||||
internal_macros.o : ./html_lex.h
|
internal_macros.o : ./html_lex.h
|
||||||
|
|
@ -73,7 +80,8 @@ internal_macros.o : ./output.h
|
||||||
internal_macros.o : ./string_conversion.h
|
internal_macros.o : ./string_conversion.h
|
||||||
internal_macros.o : internal_macros.C
|
internal_macros.o : internal_macros.C
|
||||||
macro_dictionary.C:
|
macro_dictionary.C:
|
||||||
macro_dictionary.o : ./database.h
|
macro_dictionary.o : ./basic.h
|
||||||
|
macro_dictionary.o : ./buffer.h
|
||||||
macro_dictionary.o : ./html_config.h
|
macro_dictionary.o : ./html_config.h
|
||||||
macro_dictionary.o : ./html_error.h
|
macro_dictionary.o : ./html_error.h
|
||||||
macro_dictionary.o : ./html_lex.h
|
macro_dictionary.o : ./html_lex.h
|
||||||
|
|
@ -83,8 +91,9 @@ macro_dictionary.o : ./mstring.h
|
||||||
macro_dictionary.o : ./string_conversion.h
|
macro_dictionary.o : ./string_conversion.h
|
||||||
macro_dictionary.o : macro_dictionary.C
|
macro_dictionary.o : macro_dictionary.C
|
||||||
output.C:
|
output.C:
|
||||||
|
output.o : ./basic.h
|
||||||
output.o : ./cpp_formatting.h
|
output.o : ./cpp_formatting.h
|
||||||
output.o : ./database.h
|
output.o : ./buffer.h
|
||||||
output.o : ./html_config.h
|
output.o : ./html_config.h
|
||||||
output.o : ./html_error.h
|
output.o : ./html_error.h
|
||||||
output.o : ./html_lex.h
|
output.o : ./html_lex.h
|
||||||
|
|
@ -94,7 +103,8 @@ output.o : ./output.h
|
||||||
output.o : ./string_conversion.h
|
output.o : ./string_conversion.h
|
||||||
output.o : output.C
|
output.o : output.C
|
||||||
string_conversion.C:
|
string_conversion.C:
|
||||||
string_conversion.o : ./database.h
|
string_conversion.o : ./basic.h
|
||||||
|
string_conversion.o : ./buffer.h
|
||||||
string_conversion.o : ./html_config.h
|
string_conversion.o : ./html_config.h
|
||||||
string_conversion.o : ./html_lex.h
|
string_conversion.o : ./html_lex.h
|
||||||
string_conversion.o : ./mstring.h
|
string_conversion.o : ./mstring.h
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
README for the Specification and Manual Writing Tools
|
README for the Specification and Manual Writing Tools
|
||||||
for C++ Reference Manuals
|
for C++ Reference Manuals
|
||||||
=====================================================
|
=====================================================
|
||||||
03.08.1998 Zurich Lutz Kettner kettner@acm.org
|
24.08.1999 Zurich Lutz Kettner kettner@acm.org
|
||||||
|
|
||||||
This is the directory containing the tools for extracting the
|
This is the directory containing the tools for extracting the
|
||||||
C++ declarations from a specification, to check the specification
|
C++ declarations from a specification, to check the specification
|
||||||
|
|
@ -12,7 +12,6 @@ The directory structure is:
|
||||||
INSTALLATION installation instructions.
|
INSTALLATION installation instructions.
|
||||||
|
|
||||||
RCS/ revision controlled files.
|
RCS/ revision controlled files.
|
||||||
ADT/ a list and a stack implementation.
|
|
||||||
latex_converter_config/ configuration files for the LaTeX converter.
|
latex_converter_config/ configuration files for the LaTeX converter.
|
||||||
test/ test suit.
|
test/ test suit.
|
||||||
test_html/ conversion example using multiple directories.
|
test_html/ conversion example using multiple directories.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
/**************************************************************************
|
||||||
|
|
||||||
|
basic.C
|
||||||
|
=============================================================
|
||||||
|
Project : CGAL merger tool for the specification task
|
||||||
|
Function : Assertions, indented output, etc.
|
||||||
|
System : C++ (g++)
|
||||||
|
Author : (c) 1995 Lutz Kettner
|
||||||
|
(c) 1999 Susan Hert
|
||||||
|
Revision : $Revision$
|
||||||
|
Date : $Date$
|
||||||
|
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include <basic.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
// Own assertion macro
|
||||||
|
// ================================================
|
||||||
|
|
||||||
|
void cc_assertion_error( char *cond, char *fname, int line) {
|
||||||
|
cerr << endl << "fatal error: assertion '" << cond << "' failed in line "
|
||||||
|
<< line << " of file '" << fname << "'." << endl;
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indented output, using global indentation counter
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
class Output_indentation {
|
||||||
|
int n;
|
||||||
|
int step;
|
||||||
|
public:
|
||||||
|
Output_indentation( int stepSize = 4) : n(0), step( stepSize) {}
|
||||||
|
void operator++(){ n += step;}
|
||||||
|
void operator--(){ n -= step;}
|
||||||
|
int indentation() { return n; }
|
||||||
|
};
|
||||||
|
|
||||||
|
ostream& operator<< (ostream& out, Output_indentation& ind) {
|
||||||
|
const char* s = " "; // 32 spaces !!!
|
||||||
|
int n = ind.indentation();
|
||||||
|
while ( n > 32) { // 32 !!!
|
||||||
|
n -= 32;
|
||||||
|
out << s;
|
||||||
|
}
|
||||||
|
if ( n > 0)
|
||||||
|
out << (s + 32 - n);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Output_indentation output_indentation;
|
||||||
|
|
||||||
|
ostream& indent( ostream& out){
|
||||||
|
++ output_indentation;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ostream& outdent( ostream& out){
|
||||||
|
-- output_indentation;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ostream& ind_newline( ostream& out){
|
||||||
|
out << endl << output_indentation;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ostream& ind_space( ostream& out){
|
||||||
|
out << output_indentation;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
int indentation_number() {
|
||||||
|
return output_indentation.indentation();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Substitute old style malloc, realloc, strdup ...
|
||||||
|
// ================================================
|
||||||
|
char* renew( char* old, size_t old_size, size_t new_size) {
|
||||||
|
CC_Assert( old_size == 0 || old != 0);
|
||||||
|
CC_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) {
|
||||||
|
CC_Assert( src);
|
||||||
|
if ( ! src)
|
||||||
|
return 0;
|
||||||
|
char* s = new char[ strlen( src) + 1];
|
||||||
|
strcpy( s, src);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// EOF //
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**************************************************************************
|
||||||
|
|
||||||
|
basic.h
|
||||||
|
=============================================================
|
||||||
|
Project : CGAL merger tool for the specification task
|
||||||
|
Function : Assertions, indented output, etc.
|
||||||
|
System : C++ (g++)
|
||||||
|
Author : (c) 1995 Lutz Kettner
|
||||||
|
(c) 1999 Susan Hert
|
||||||
|
Revision : $Revision$
|
||||||
|
Date : $Date$
|
||||||
|
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if ! defined( MODULE_BASIC)
|
||||||
|
#define MODULE_BASIC 1
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <iostream.h>
|
||||||
|
|
||||||
|
// Own assertion macro
|
||||||
|
// ================================================
|
||||||
|
|
||||||
|
void cc_assertion_error( char *cond, char *fname, int line);
|
||||||
|
|
||||||
|
#if !NDEBUG
|
||||||
|
#define CC_Assert( cond) {\
|
||||||
|
if (!( cond)) \
|
||||||
|
cc_assertion_error( #cond, __FILE__, __LINE__); \
|
||||||
|
}
|
||||||
|
#else // NDEBUG
|
||||||
|
#define CC_Assert( cond) (void)0
|
||||||
|
#endif // NDEBUG
|
||||||
|
|
||||||
|
|
||||||
|
// Indented output, using global indentation counter
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
ostream& indent( ostream&);
|
||||||
|
ostream& outdent( ostream&);
|
||||||
|
ostream& ind_newline( ostream&);
|
||||||
|
ostream& ind_space( ostream&);
|
||||||
|
int indentation_number();
|
||||||
|
|
||||||
|
// Substitute old style malloc, realloc, strdup ...
|
||||||
|
// ================================================
|
||||||
|
|
||||||
|
char* renew( char* old, size_t old_size, size_t new_size);
|
||||||
|
char* newstr( const char* src);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MODULE_BASIC //
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
||||||
database.C
|
buffer.C
|
||||||
=============================================================
|
=============================================================
|
||||||
Project : CGAL merger tool for the specification task
|
Project : CGAL merger tool for the specification task
|
||||||
Function : Datastructures for the database extracted from
|
Function : List of buffers (similar to strings) keeping the text
|
||||||
the TeX and C++ code mixed files.
|
parsed from the TeX input files.
|
||||||
System : C++ (g++)
|
System : C++ (g++)
|
||||||
Author : (c) 1995 Lutz Kettner
|
Author : (c) 1995 Lutz Kettner
|
||||||
Revision : $Revision$
|
Revision : $Revision$
|
||||||
|
|
@ -12,239 +12,12 @@
|
||||||
|
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// Other modules needed:
|
#include <buffer.h>
|
||||||
// =====================
|
|
||||||
#include <database.h>
|
|
||||||
#include <ADT/adtbase.cc>
|
|
||||||
|
|
||||||
|
void delete_list( Buffer_list* l) {
|
||||||
// Substitute old style malloc, realloc, strdup ...
|
for ( Buffer_iterator i = l->begin(); i != l->end(); ++i)
|
||||||
// ================================================
|
delete *i;
|
||||||
char* renew( char* old, size_t old_size, size_t new_size) {
|
delete l;
|
||||||
ADT_Assert( old_size == 0 || old != 0);
|
|
||||||
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)
|
|
||||||
return 0;
|
|
||||||
char* s = new char[ strlen( src) + 1];
|
|
||||||
strcpy( s, src);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Class definitions:
|
|
||||||
// ==============================================
|
|
||||||
int printComment( ostream &out, const Text& T, bool leadingLine, bool HTML) {
|
|
||||||
InListFIter< TextToken> words( (Text&)T);
|
|
||||||
int width = MaxTextWidth - indentation_number() - 3;
|
|
||||||
int w = width;
|
|
||||||
int state = 0; // 0 = start, 1 = after token, 2 = spaces
|
|
||||||
// 3 = one newline (and spaces), 4 = newlines
|
|
||||||
ForAll( words) {
|
|
||||||
switch ( state) {
|
|
||||||
case 0:
|
|
||||||
if ( !words->isSpace) {
|
|
||||||
if ( leadingLine)
|
|
||||||
out << endl;
|
|
||||||
out << indNewline << (HTML ? "" : "// ") << words->string;
|
|
||||||
w -= words->len;
|
|
||||||
state = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if ( !words->isSpace || words->len > 0) {
|
|
||||||
if ( !words->isSpace) {
|
|
||||||
if ((words->len > w) && (w != width)) {
|
|
||||||
w = width;
|
|
||||||
out << indNewline << (HTML ? "" : "// ");
|
|
||||||
}
|
|
||||||
out << words->string;
|
|
||||||
w -= words->len;
|
|
||||||
} else {
|
|
||||||
if ( words->string[0] == '\n')
|
|
||||||
state = 3;
|
|
||||||
else
|
|
||||||
state = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if ( !words->isSpace || words->len > 0) {
|
|
||||||
if ( !words->isSpace) {
|
|
||||||
if ((words->len >= w) && (w != width)) {
|
|
||||||
w = width;
|
|
||||||
out << indNewline << (HTML ? "" : "// ");
|
|
||||||
} else {
|
|
||||||
out << ' ';
|
|
||||||
w--;
|
|
||||||
}
|
|
||||||
out << words->string;
|
|
||||||
w -= words->len;
|
|
||||||
state = 1;
|
|
||||||
} else {
|
|
||||||
if ( words->string[0] == '\n')
|
|
||||||
state = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if ( !words->isSpace || words->len > 0) {
|
|
||||||
if ( !words->isSpace) {
|
|
||||||
if ((words->len >= w) && (w != width)) {
|
|
||||||
w = width;
|
|
||||||
out << indNewline << (HTML ? "" : "// ");
|
|
||||||
} else {
|
|
||||||
out << ' ';
|
|
||||||
w--;
|
|
||||||
}
|
|
||||||
out << words->string;
|
|
||||||
w -= words->len;
|
|
||||||
state = 1;
|
|
||||||
} else {
|
|
||||||
if ( words->string[0] == '\n')
|
|
||||||
state = 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
if ( !words->isSpace || words->len > 0) {
|
|
||||||
if ( !words->isSpace) {
|
|
||||||
if (HTML)
|
|
||||||
out << indNewline << "<P>";
|
|
||||||
out << indNewline << (HTML ? "" : "// ");
|
|
||||||
out << indNewline << (HTML ? "" : "// ");
|
|
||||||
w = width;
|
|
||||||
out << words->string;
|
|
||||||
w -= words->len;
|
|
||||||
state = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
int printTrueComment( ostream &out, const Text& T, bool leadingLine) {
|
|
||||||
InListFIter< TextToken> words( (Text&)T);
|
|
||||||
int state = 0; // 0 = start, 1 = spaces at start, 2 = at least one token
|
|
||||||
int spaces = 0;
|
|
||||||
ForAll( words) {
|
|
||||||
switch ( state) {
|
|
||||||
case 0:
|
|
||||||
if ( !words->isSpace) {
|
|
||||||
if ( leadingLine)
|
|
||||||
out << endl;
|
|
||||||
out << indNewline << "// " << words->string;
|
|
||||||
state = 1;
|
|
||||||
} else {
|
|
||||||
if ( words->string[0] != '\n') {
|
|
||||||
state = 1;
|
|
||||||
spaces = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if ( !words->isSpace) {
|
|
||||||
if ( leadingLine)
|
|
||||||
out << endl;
|
|
||||||
out << indNewline << "// ";
|
|
||||||
while ( spaces--)
|
|
||||||
out << ' ';
|
|
||||||
out << words->string;
|
|
||||||
} else {
|
|
||||||
if ( words->string[0] == '\n')
|
|
||||||
state = 0;
|
|
||||||
else
|
|
||||||
spaces++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if ( words->isSpace && ( words->string[0] == '\n'))
|
|
||||||
out << indNewline << "// ";
|
|
||||||
else
|
|
||||||
out << words->string;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ostream&
|
|
||||||
operator<< (ostream& out, const TextToken& t) {
|
|
||||||
out << t.isSpace << ", ";
|
|
||||||
printString( out, t.string, t.len);
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
istream&
|
|
||||||
operator>> (istream& in, TextToken& t) {
|
|
||||||
char c;
|
|
||||||
int e;
|
|
||||||
in >> e >> c; // c == ','
|
|
||||||
t.isSpace = bool( e);
|
|
||||||
delete[] t.string;
|
|
||||||
t.len = scanString( in, t.string);
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Auxiliary function definitions
|
|
||||||
// ==============================================
|
|
||||||
/* ...
|
|
||||||
char* catString( const char* r, const char* s, int l, int m) {
|
|
||||||
char *p;
|
|
||||||
if ( l < 0)
|
|
||||||
l = strlen( r);
|
|
||||||
if ( m < 0)
|
|
||||||
m = strlen( s);
|
|
||||||
p = (char *)malloc( l + m + 1);
|
|
||||||
ADT_Assert( p != NULL);
|
|
||||||
memcpy( p, r, l);
|
|
||||||
memcpy( p+l, s, m);
|
|
||||||
p[ l+m] = 0;
|
|
||||||
return( p);
|
|
||||||
}
|
|
||||||
... */
|
|
||||||
|
|
||||||
void printString( ostream &out, const char *s, int len) {
|
|
||||||
if ( len < 0)
|
|
||||||
len = strlen( s);
|
|
||||||
out << len;
|
|
||||||
if ( len > 0)
|
|
||||||
out << ", " << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
int scanString( istream &in, char*& s) {
|
|
||||||
int len;
|
|
||||||
int i;
|
|
||||||
in >> len;
|
|
||||||
if ( len > 0) {
|
|
||||||
s = new char[ len + 1];
|
|
||||||
ADT_Assert( s != NULL);
|
|
||||||
in.get( s[0]); // the comma
|
|
||||||
in.get( s[0]); // the space
|
|
||||||
for ( i=0; i<len; i++)
|
|
||||||
in.get( s[i]);
|
|
||||||
s[i] = 0;
|
|
||||||
} else {
|
|
||||||
s = NULL;
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// EOF //
|
// EOF //
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
||||||
database.h
|
buffer.h
|
||||||
=============================================================
|
=============================================================
|
||||||
Project : CGAL merger tool for the specification task
|
Project : CGAL merger tool for the specification task
|
||||||
Function : Datastructures for the database extracted from
|
Function : List of buffers (similar to strings) keeping the text
|
||||||
the TeX and C++ code mixed files.
|
parsed from the TeX input files.
|
||||||
System : C++ (g++)
|
System : C++ (g++)
|
||||||
Author : (c) 1995 Lutz Kettner
|
Author : (c) 1995 Lutz Kettner
|
||||||
Revision : $Revision$
|
Revision : $Revision$
|
||||||
|
|
@ -12,338 +12,74 @@
|
||||||
|
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if ! defined( MODULE_DATABASE)
|
#if ! defined( MODULE_BUFFER)
|
||||||
#define MODULE_DATABASE 1
|
#define MODULE_BUFFER 1
|
||||||
|
|
||||||
#define MaxTextWidth 74
|
|
||||||
|
|
||||||
// Other modules needed:
|
// Other modules needed:
|
||||||
// ==============================================
|
// ==============================================
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ADT/adtbase.h>
|
#include <list.h>
|
||||||
#undef LK_RestrictedOverloading
|
#include <vector.h>
|
||||||
#define LK_RestrictedOverloading 0
|
#include <basic.h>
|
||||||
#include <ADT/list.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
// Class declarations:
|
|
||||||
// ==============================================
|
|
||||||
class TextToken;
|
|
||||||
|
|
||||||
// Substitute old style malloc, realloc, strdup ...
|
|
||||||
// ================================================
|
|
||||||
|
|
||||||
char* renew( char* old, size_t old_size, size_t new_size);
|
|
||||||
char* newstr( const char* src);
|
|
||||||
|
|
||||||
|
|
||||||
// Class specifications:
|
// Class specifications:
|
||||||
// ==============================================
|
// ==============================================
|
||||||
|
|
||||||
// Auxiliary class:
|
|
||||||
// ------------------------------------
|
|
||||||
class Buffer {
|
class Buffer {
|
||||||
size_t fibo1; // fibonacci numbers to increase buffer in
|
typedef vector<char>::const_iterator const_iterator;
|
||||||
size_t fibo2; // the case of an overflow.
|
vector<char> buf;
|
||||||
size_t len;
|
|
||||||
char* data;
|
|
||||||
public:
|
public:
|
||||||
Buffer() {
|
Buffer() : buf( 1, '\0') {}
|
||||||
fibo1 = 610;
|
Buffer( char c) : buf( 2, '\0') { *(buf.begin()) = c; }
|
||||||
fibo2 = 987;
|
Buffer( const char* s, int l = -1) {
|
||||||
len = 0;
|
if (s)
|
||||||
data = new char[ fibo2];
|
buf.insert( 0, s, s + 1 + ((l<0) ? strlen(s) : l));
|
||||||
*data = '\0';
|
else
|
||||||
// Assert( data != NULL);
|
buf.push_back( '\0');
|
||||||
}
|
|
||||||
~Buffer() {
|
|
||||||
// ADT_Assert( fibo2 > fibo1); // SGI complains in the test_suit
|
|
||||||
// ADT_Assert( fibo2 > len); // Gnu complains in the test_suit
|
|
||||||
// ADT_Assert( data[ len] == '\0');
|
|
||||||
// ADT_Assert( strlen( data) == len);
|
|
||||||
delete[] data;
|
|
||||||
}
|
|
||||||
Buffer( const Buffer& t) {
|
|
||||||
ADT_Assert( t.data[ t.len] == '\0');
|
|
||||||
fibo1 = t.fibo1;
|
|
||||||
fibo2 = t.fibo2;
|
|
||||||
len = t.len;
|
|
||||||
ADT_Assert( fibo2 > fibo1);
|
|
||||||
ADT_Assert( fibo2 > len);
|
|
||||||
data = newstr( t.data); // ============== ?? FALSCH ERROR !!!!
|
|
||||||
cerr << "Error: Buffer copy constructor called." << endl;
|
|
||||||
exit( 6);
|
|
||||||
}
|
|
||||||
Buffer& operator=( const Buffer& t) {
|
|
||||||
if( this != &t) { // beware of this=t; see Stroustrup pp.238
|
|
||||||
delete[] data;
|
|
||||||
t.data[ t.len] = '\0';
|
|
||||||
fibo1 = t.fibo1;
|
|
||||||
fibo2 = t.fibo2;
|
|
||||||
len = t.len;
|
|
||||||
data = newstr( t.data);// ============== ?? FALSCH ERROR !!!!
|
|
||||||
} else {
|
|
||||||
fibo1 = 610;
|
|
||||||
fibo2 = 987;
|
|
||||||
len = 0;
|
|
||||||
data = new char[ fibo2];
|
|
||||||
}
|
|
||||||
ADT_Assert( fibo2 > fibo1);
|
|
||||||
ADT_Assert( fibo2 > len);
|
|
||||||
cerr << "Error: Buffer assignment operator called." << endl;
|
|
||||||
exit( 6);
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
void add( const char* s, int l = -1) {
|
void add( const char* s, int l = -1) {
|
||||||
ADT_Assert( data[ len] == '\0');
|
|
||||||
int tmp;
|
|
||||||
if ( l < 0)
|
if ( l < 0)
|
||||||
l = strlen( s);
|
l = strlen( s);
|
||||||
// ADT_Assert( l == (int)strlen( s)); // this is definitly wrong!
|
buf.insert( buf.end() - 1, s, s + l);
|
||||||
if ( len + l >= fibo2) { // increase buffer
|
|
||||||
do {
|
|
||||||
tmp = fibo2;
|
|
||||||
fibo2 += fibo1;
|
|
||||||
fibo1 = tmp;
|
|
||||||
} while ( len + l >= fibo2); // increase buffer
|
|
||||||
data = renew( data, fibo1, fibo2);
|
|
||||||
// Assert( data != NULL);
|
|
||||||
}
|
|
||||||
memcpy( data + len, s, l);
|
|
||||||
len += l;
|
|
||||||
data[ len] = '\0';
|
|
||||||
ADT_Assert( fibo2 > fibo1);
|
|
||||||
ADT_Assert( fibo2 > len);
|
|
||||||
}
|
|
||||||
void add( const Buffer& buf) {
|
|
||||||
add( buf.string(), buf.length());
|
|
||||||
}
|
|
||||||
void add( const Buffer* buf) {
|
|
||||||
add( buf->string(), buf->length());
|
|
||||||
}
|
}
|
||||||
|
void add( const Buffer& buf) { add( buf.begin(), buf.size() - 1); }
|
||||||
void add( char c) {
|
void add( char c) {
|
||||||
ADT_Assert( data[ len] == '\0');
|
buf.pop_back();
|
||||||
if ( len + 1 >= fibo2) { // increase buffer
|
buf.push_back(c);
|
||||||
int tmp = fibo2;
|
buf.push_back( '\0');
|
||||||
fibo2 += fibo1;
|
|
||||||
fibo1 = tmp;
|
|
||||||
data = renew( data, fibo1, fibo2);
|
|
||||||
// Assert( data != NULL);
|
|
||||||
}
|
|
||||||
data[ len++] = c;
|
|
||||||
data[ len] = '\0';
|
|
||||||
ADT_Assert( fibo2 > fibo1);
|
|
||||||
ADT_Assert( fibo2 > len);
|
|
||||||
}
|
}
|
||||||
void prepend( const char* s, int l = -1) {
|
void prepend( const char* s, int l = -1) {
|
||||||
ADT_Assert( s);
|
if ( l == 0 || s == 0)
|
||||||
ADT_Assert( data[ len] == '\0');
|
return;
|
||||||
int tmp;
|
|
||||||
if ( l < 0)
|
if ( l < 0)
|
||||||
l = strlen( s);
|
l = strlen( s);
|
||||||
ADT_Assert( l == (int)strlen( s));
|
buf.insert( buf.begin(), s, s + l);
|
||||||
if ( len + l >= fibo2) { // increase buffer
|
|
||||||
do {
|
|
||||||
tmp = fibo2;
|
|
||||||
fibo2 += fibo1;
|
|
||||||
fibo1 = tmp;
|
|
||||||
} while ( len + l >= fibo2); // increase buffer
|
|
||||||
data = renew( data, fibo1, fibo2);
|
|
||||||
// Assert( data != NULL);
|
|
||||||
}
|
}
|
||||||
// relocate current text
|
void prepend( const Buffer& t) { prepend( t.begin(), t.size() - 1);}
|
||||||
int i;
|
void prepend( char c) { buf.insert( buf.begin(), c); }
|
||||||
for ( i = len-1; i >= 0; i--)
|
char* begin() { return &*(buf.begin()); }
|
||||||
data[i+l] = data[ i];
|
const char* begin() const { return &*(buf.begin()); }
|
||||||
memcpy( data, s, l);
|
char* end() { return &*(buf.end()); }
|
||||||
len += l;
|
const char* end() const { return &*(buf.end()); }
|
||||||
data[ len] = '\0';
|
void set( int i, char c) { buf[i] = c; }
|
||||||
ADT_Assert( fibo2 > fibo1);
|
size_t size() const { return buf.size(); }
|
||||||
ADT_Assert( fibo2 > len);
|
void flush() { buf.erase( buf.begin(), buf.end()-1); }
|
||||||
}
|
bool is_space() const {
|
||||||
void prepend( char c) {
|
CC_Assert( buf.size() > 0);
|
||||||
ADT_Assert( data[ len] == '\0');
|
for ( const_iterator i = buf.begin(); i != buf.end() - 1; ++i)
|
||||||
if ( len + 1 >= fibo2) { // increase buffer
|
if ( *i > ' ')
|
||||||
int tmp = fibo2;
|
return false;
|
||||||
fibo2 += fibo1;
|
return true;
|
||||||
fibo1 = tmp;
|
|
||||||
data = renew( data, fibo1, fibo2);
|
|
||||||
// Assert( data != NULL);
|
|
||||||
}
|
|
||||||
// relocate current text
|
|
||||||
int i;
|
|
||||||
for ( i = len; i > 0; i--)
|
|
||||||
data[i] = data[ i-1];
|
|
||||||
data[ 0] = c;
|
|
||||||
len++;
|
|
||||||
data[ len] = '\0';
|
|
||||||
ADT_Assert( fibo2 > fibo1);
|
|
||||||
ADT_Assert( fibo2 > len);
|
|
||||||
}
|
|
||||||
void cut( int i) {
|
|
||||||
ADT_Assert( data[ len] == '\0');
|
|
||||||
ADT_Assert( i >= 0);
|
|
||||||
if ( (int)len >= i) {
|
|
||||||
len -= i;
|
|
||||||
}
|
|
||||||
data[ len] = '\0';
|
|
||||||
ADT_Assert( fibo2 > fibo1);
|
|
||||||
ADT_Assert( fibo2 > len);
|
|
||||||
}
|
|
||||||
const char* string() const {
|
|
||||||
ADT_Assert( data[ len] == '\0');
|
|
||||||
ADT_Assert( len < fibo2);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
void set( int i, char c) {
|
|
||||||
ADT_Assert( c != 0);
|
|
||||||
ADT_Assert( i >= 0);
|
|
||||||
ADT_Assert( size_t(i) < len);
|
|
||||||
data[i] = c;
|
|
||||||
}
|
|
||||||
int length() const {
|
|
||||||
ADT_Assert( data[ len] == '\0');
|
|
||||||
ADT_Assert( len < fibo2);
|
|
||||||
return (int)len;
|
|
||||||
}
|
|
||||||
void flush() {
|
|
||||||
ADT_Assert( data[ len] == '\0');
|
|
||||||
ADT_Assert( len < fibo2);
|
|
||||||
len = 0;
|
|
||||||
*data = '\0';
|
|
||||||
}
|
|
||||||
void capitalize() {
|
|
||||||
for ( size_t i = 0; i < len; i++)
|
|
||||||
data[i] = toupper( data[i]);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextToken : public ListLink{
|
typedef list< Buffer*> Buffer_list;
|
||||||
public:
|
typedef Buffer_list::iterator Buffer_iterator;
|
||||||
bool isSpace;
|
typedef Buffer_list::const_iterator Buffer_const_iterator;
|
||||||
int len;
|
|
||||||
char* string;
|
|
||||||
TextToken() {
|
|
||||||
isSpace = false;
|
|
||||||
len = 0;
|
|
||||||
string = newstr( "");
|
|
||||||
}
|
|
||||||
TextToken( const char* s, int l = -1, bool space = false) {
|
|
||||||
isSpace = space;
|
|
||||||
if ( s) {
|
|
||||||
if ( l < 0)
|
|
||||||
len = strlen( s);
|
|
||||||
else
|
|
||||||
len = l;
|
|
||||||
string = newstr( s);
|
|
||||||
} else {
|
|
||||||
string = newstr( "");
|
|
||||||
len = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TextToken( const TextToken& t) {
|
|
||||||
isSpace = t.isSpace;
|
|
||||||
len = t.len;
|
|
||||||
string = newstr( t.string);
|
|
||||||
}
|
|
||||||
~TextToken() {
|
|
||||||
ADT_Assert( (! string && len == 0) || (int)strlen( string) == len);
|
|
||||||
ADT_Assert( ! string || string[ len] == '\0');
|
|
||||||
delete[] string;
|
|
||||||
}
|
|
||||||
TextToken& operator=( const TextToken& t) {
|
|
||||||
if( this != &t) { // beware of this=t; see Stroustrup pp.238
|
|
||||||
delete[] string;
|
|
||||||
isSpace = t.isSpace;
|
|
||||||
len = t.len;
|
|
||||||
string = newstr( t.string);
|
|
||||||
}
|
|
||||||
ADT_Assert( (! string && len == 0) || (int)strlen( string) == len);
|
|
||||||
ADT_Assert( ! string || string[ len] == '\0');
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
TextToken& add( const TextToken& t) {
|
|
||||||
if ( t.len > 0) {
|
|
||||||
string = renew( string, len + 1, len + t.len + 1);
|
|
||||||
memcpy( string + len, t.string, t.len);
|
|
||||||
len += t.len;
|
|
||||||
string[len] = '\0';
|
|
||||||
isSpace = isSpace && t.isSpace;
|
|
||||||
}
|
|
||||||
ADT_Assert( (! string && len == 0) || (int)strlen( string) == len);
|
|
||||||
ADT_Assert( ! string || string[ len] == '\0');
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
TextToken& add( const char* s, int l = -1) {
|
|
||||||
if ( s == 0)
|
|
||||||
l = 0;
|
|
||||||
if ( l == -1)
|
|
||||||
l = strlen(s);
|
|
||||||
if ( l > 0) {
|
|
||||||
string = renew( string, len + 1, len + l + 1);
|
|
||||||
memcpy( string + len, s, l);
|
|
||||||
len += l;
|
|
||||||
string[len] = '\0';
|
|
||||||
isSpace = false;
|
|
||||||
}
|
|
||||||
ADT_Assert( (! string && len == 0) || (int)strlen( string) == len);
|
|
||||||
ADT_Assert( ! string || string[ len] == '\0');
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
TextToken& add( char c) {
|
|
||||||
string = renew( string, len + 1, len + 2);
|
|
||||||
string[ len] = c;
|
|
||||||
len ++;
|
|
||||||
string[ len] = '\0';
|
|
||||||
isSpace = isSpace && (( c == ' ') || ( c == '\t'));
|
|
||||||
ADT_Assert( (! string && len == 0) || (int)strlen( string) == len);
|
|
||||||
ADT_Assert( ! string || string[ len] == '\0');
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
TextToken& prepend( const TextToken& t) {
|
|
||||||
if ( t.len > 0) {
|
|
||||||
int i;
|
|
||||||
string = renew( string, len + 1, len + t.len + 1);
|
|
||||||
for( i=len; i>=0; i--) // 0 will also be copied
|
|
||||||
string[ i + t.len] = string[ i];
|
|
||||||
memcpy( string, t.string, t.len);
|
|
||||||
len += t.len;
|
|
||||||
isSpace = isSpace && t.isSpace;
|
|
||||||
}
|
|
||||||
ADT_Assert( (! string && len == 0) || (int)strlen( string) == len);
|
|
||||||
ADT_Assert( ! string || string[ len] == '\0');
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
TextToken& prepend( char c) {
|
|
||||||
int i;
|
|
||||||
string = renew( string, len + 1, len + 2);
|
|
||||||
for( i=len; i>=0; i--) // 0 will also be copied
|
|
||||||
string[ i + 1] = string[ i];
|
|
||||||
*string = c;
|
|
||||||
len ++;
|
|
||||||
isSpace = isSpace && (( c == ' ') || ( c == '\t'));
|
|
||||||
ADT_Assert( (! string && len == 0) || (int)strlen( string) == len);
|
|
||||||
ADT_Assert( ! string || string[ len] == '\0');
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ostream& operator<< (ostream& out, const TextToken& t);
|
void delete_list( Buffer_list* l);
|
||||||
istream& operator>> (istream& in, TextToken& t);
|
|
||||||
|
|
||||||
//class InList< TextToken>;
|
#endif // MODULE_BUFFER //
|
||||||
|
|
||||||
typedef InList< TextToken> Text;
|
|
||||||
|
|
||||||
int printComment( ostream& out, const Text& T,
|
|
||||||
bool leadingLine = false, bool HTML = false);
|
|
||||||
int printTrueComment( ostream& out, const Text& T, bool leadingLine = false);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void printString( ostream &out, const char* s, int len = -1);
|
|
||||||
int scanString( istream &in, char*& s);
|
|
||||||
|
|
||||||
|
|
||||||
#endif // MODULE_DATABASE //
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <stream.h>
|
#include <stream.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#define MaxParameters 1002
|
#define MaxParameters 1002
|
||||||
|
|
@ -450,8 +450,8 @@ void printPattern( ostream& out_pattern,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int i;
|
int i;
|
||||||
int l = err->length();
|
int l = err->size() - 1;
|
||||||
const char *str = err->string();
|
const char *str = err->begin();
|
||||||
if ( pat == 0) {
|
if ( pat == 0) {
|
||||||
pat = pattern;
|
pat = pattern;
|
||||||
pat->flush();
|
pat->flush();
|
||||||
|
|
@ -460,7 +460,7 @@ void printPattern( ostream& out_pattern,
|
||||||
pat->add( patternText( str[i], str[i+1]));
|
pat->add( patternText( str[i], str[i+1]));
|
||||||
pat->add( '"');
|
pat->add( '"');
|
||||||
}
|
}
|
||||||
printReducedPattern( out_pattern, pat->string(), pat->length());
|
printReducedPattern( out_pattern, pat->begin(), pat->size() - 1);
|
||||||
out_pattern << " {" << endl;
|
out_pattern << " {" << endl;
|
||||||
out_pattern << " tags[" << n_pattern << "] = -1;" << endl;
|
out_pattern << " tags[" << n_pattern << "] = -1;" << endl;
|
||||||
out_pattern << " count_newlines( yytext);" << endl;
|
out_pattern << " count_newlines( yytext);" << endl;
|
||||||
|
|
@ -498,8 +498,8 @@ void printFunctionPattern( ostream& out_pattern,
|
||||||
bool default_params = false;
|
bool default_params = false;
|
||||||
bool nonzero_param_list = false;
|
bool nonzero_param_list = false;
|
||||||
int nesting = 0;
|
int nesting = 0;
|
||||||
int l = err->length();
|
int l = err->size() - 1;
|
||||||
const char *str = err->string();
|
const char *str = err->begin();
|
||||||
if ( pat == 0) {
|
if ( pat == 0) {
|
||||||
pat = pattern;
|
pat = pattern;
|
||||||
pat->flush();
|
pat->flush();
|
||||||
|
|
@ -516,7 +516,7 @@ void printFunctionPattern( ostream& out_pattern,
|
||||||
pat->add( "\"{ws}*\"");
|
pat->add( "\"{ws}*\"");
|
||||||
pat2 = pattern2;
|
pat2 = pattern2;
|
||||||
pat2->flush();
|
pat2->flush();
|
||||||
pat2->add( pat);
|
pat2->add( * pat);
|
||||||
if ( nonzero_param_list)
|
if ( nonzero_param_list)
|
||||||
pat2->add( ',');
|
pat2->add( ',');
|
||||||
pat2->add( "\"{ws}*[^ \\n\\r\\t)]");
|
pat2->add( "\"{ws}*[^ \\n\\r\\t)]");
|
||||||
|
|
@ -534,14 +534,14 @@ void printFunctionPattern( ostream& out_pattern,
|
||||||
// if ( default_params)
|
// if ( default_params)
|
||||||
// pat2->add( '"');
|
// pat2->add( '"');
|
||||||
}
|
}
|
||||||
printReducedPattern( out_pattern, pat->string(), pat->length());
|
printReducedPattern( out_pattern, pat->begin(), pat->size() - 1);
|
||||||
out_pattern << " {" << endl;
|
out_pattern << " {" << endl;
|
||||||
out_pattern << " tags[" << n_pattern << "] = -1;" << endl;
|
out_pattern << " tags[" << n_pattern << "] = -1;" << endl;
|
||||||
out_pattern << " count_newlines( yytext);" << endl;
|
out_pattern << " count_newlines( yytext);" << endl;
|
||||||
out_pattern << " MD;" << endl;
|
out_pattern << " MD;" << endl;
|
||||||
out_pattern << " }" << endl;
|
out_pattern << " }" << endl;
|
||||||
if ( default_params || pat2 != 0) {
|
if ( default_params || pat2 != 0) {
|
||||||
printReducedPattern( out_pattern, pat2->string(), pat2->length());
|
printReducedPattern( out_pattern, pat2->begin(), pat2->size() - 1);
|
||||||
out_pattern << " {" << endl;
|
out_pattern << " {" << endl;
|
||||||
out_pattern << " if (tags[" << n_pattern << "] == 0) {" << endl;
|
out_pattern << " if (tags[" << n_pattern << "] == 0) {" << endl;
|
||||||
out_pattern << " tags[" << n_pattern << "] = line_number;"
|
out_pattern << " tags[" << n_pattern << "] = line_number;"
|
||||||
|
|
@ -628,11 +628,11 @@ void translateFunctionArgumentLists( const char* decl, Buffer *func) {
|
||||||
const char* current = decl;
|
const char* current = decl;
|
||||||
while ( *current != '(') {
|
while ( *current != '(') {
|
||||||
current++;
|
current++;
|
||||||
ADT_Assert( *current);
|
CC_Assert( *current);
|
||||||
}
|
}
|
||||||
ADT_Assert( *current == '(');
|
CC_Assert( *current == '(');
|
||||||
current++;
|
current++;
|
||||||
ADT_Assert( *current);
|
CC_Assert( *current);
|
||||||
func->add( decl, current - decl);
|
func->add( decl, current - decl);
|
||||||
|
|
||||||
/* the parsing starts here. It counts parenthesis. */
|
/* the parsing starts here. It counts parenthesis. */
|
||||||
|
|
@ -641,7 +641,7 @@ void translateFunctionArgumentLists( const char* decl, Buffer *func) {
|
||||||
const char* from = current;
|
const char* from = current;
|
||||||
const char* last_idfier = current - 1;
|
const char* last_idfier = current - 1;
|
||||||
while ( nesting > 0) {
|
while ( nesting > 0) {
|
||||||
ADT_Assert( *current);
|
CC_Assert( *current);
|
||||||
if ( nesting == 1 && *current == '=')
|
if ( nesting == 1 && *current == '=')
|
||||||
in_init = true;
|
in_init = true;
|
||||||
if ( nesting == 1
|
if ( nesting == 1
|
||||||
|
|
@ -658,7 +658,7 @@ void translateFunctionArgumentLists( const char* decl, Buffer *func) {
|
||||||
while( isalnum( *p) || *p == '_')
|
while( isalnum( *p) || *p == '_')
|
||||||
p--;
|
p--;
|
||||||
p++; /* points to idfier start */
|
p++; /* points to idfier start */
|
||||||
ADT_Assert( p - from >= 0);
|
CC_Assert( p - from >= 0);
|
||||||
if ( isTypeInFunctionArgument( from, p)) {
|
if ( isTypeInFunctionArgument( from, p)) {
|
||||||
func->add( from, p - from);
|
func->add( from, p - from);
|
||||||
func->add( IDFIER_TAG);
|
func->add( IDFIER_TAG);
|
||||||
|
|
@ -681,7 +681,7 @@ void translateFunctionArgumentLists( const char* decl, Buffer *func) {
|
||||||
case ')':
|
case ')':
|
||||||
case '>':
|
case '>':
|
||||||
nesting--;
|
nesting--;
|
||||||
ADT_Assert( nesting >= 1);
|
CC_Assert( nesting >= 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -694,8 +694,8 @@ void translateFunctionArgumentLists( const char* decl, Buffer *func) {
|
||||||
// if so, use the INLINE_TAG to add the regular expression for an optional
|
// if so, use the INLINE_TAG to add the regular expression for an optional
|
||||||
// inline keyword right after the template declaration.
|
// inline keyword right after the template declaration.
|
||||||
void checkTemplateKeyword( Buffer *decl){
|
void checkTemplateKeyword( Buffer *decl){
|
||||||
if( 0 == strncmp( "template", decl->string(), 8)) {
|
if( 0 == strncmp( "template", decl->begin(), 8)) {
|
||||||
const char* p = decl->string() + 8;
|
const char* p = decl->begin() + 8;
|
||||||
int nesting = 0;
|
int nesting = 0;
|
||||||
while( *p != '\0') {
|
while( *p != '\0') {
|
||||||
switch( *p) {
|
switch( *p) {
|
||||||
|
|
@ -709,7 +709,7 @@ void checkTemplateKeyword( Buffer *decl){
|
||||||
case '>':
|
case '>':
|
||||||
nesting --;
|
nesting --;
|
||||||
if ( nesting == 0) {
|
if ( nesting == 0) {
|
||||||
decl->set( p - decl->string(), INLINE_TAG);
|
decl->set( p - decl->begin(), INLINE_TAG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -723,11 +723,11 @@ void checkTemplateKeyword( Buffer *decl){
|
||||||
/* Taylored semantic functions used in syntax.y */
|
/* Taylored semantic functions used in syntax.y */
|
||||||
/* ============================================ */
|
/* ============================================ */
|
||||||
|
|
||||||
void handleMainComment( const Text& ) {
|
void handleMainComment( const Buffer_list& ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleComment( const Text& ) {
|
void handleComment( const Buffer_list& ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -857,7 +857,7 @@ void handleNestedType( const char* decl) {
|
||||||
void handleMethodDeclaration( const char* decl) {
|
void handleMethodDeclaration( const char* decl) {
|
||||||
translateFunctionArgumentLists( decl, function_decl);
|
translateFunctionArgumentLists( decl, function_decl);
|
||||||
checkTemplateKeyword( function_decl);
|
checkTemplateKeyword( function_decl);
|
||||||
decl = function_decl->string();
|
decl = function_decl->begin();
|
||||||
errmessage->flush();
|
errmessage->flush();
|
||||||
int l = strlen( decl);
|
int l = strlen( decl);
|
||||||
while ( l > 0 && decl[ l-1] == ' ') l--;
|
while ( l > 0 && decl[ l-1] == ' ') l--;
|
||||||
|
|
@ -873,7 +873,7 @@ void handleMethodDeclaration( const char* decl) {
|
||||||
void handleFunctionDeclaration( const char* decl) {
|
void handleFunctionDeclaration( const char* decl) {
|
||||||
translateFunctionArgumentLists( decl, function_decl);
|
translateFunctionArgumentLists( decl, function_decl);
|
||||||
checkTemplateKeyword( function_decl);
|
checkTemplateKeyword( function_decl);
|
||||||
decl = function_decl->string();
|
decl = function_decl->begin();
|
||||||
errmessage->flush();
|
errmessage->flush();
|
||||||
int l = strlen( decl);
|
int l = strlen( decl);
|
||||||
while ( l > 0 && decl[ l-1] == ' ') l--;
|
while ( l > 0 && decl[ l-1] == ' ') l--;
|
||||||
|
|
@ -888,7 +888,7 @@ void handleFunctionDeclaration( const char* decl) {
|
||||||
|
|
||||||
void handleFunctionTemplateDeclaration( const char* templ, const char* decl) {
|
void handleFunctionTemplateDeclaration( const char* templ, const char* decl) {
|
||||||
translateFunctionArgumentLists( decl, function_decl);
|
translateFunctionArgumentLists( decl, function_decl);
|
||||||
decl = function_decl->string();
|
decl = function_decl->begin();
|
||||||
errmessage->flush();
|
errmessage->flush();
|
||||||
pattern->flush();
|
pattern->flush();
|
||||||
pattern2->flush();
|
pattern2->flush();
|
||||||
|
|
@ -952,7 +952,7 @@ void handleFunctionTemplateDeclaration( const char* templ, const char* decl) {
|
||||||
if ( nesting == 0) {
|
if ( nesting == 0) {
|
||||||
default_params = true;
|
default_params = true;
|
||||||
pattern->add( "\"{ws}*\"");
|
pattern->add( "\"{ws}*\"");
|
||||||
pattern2->add( pattern);
|
pattern2->add( * pattern);
|
||||||
pattern2->add( ",\".*\"");
|
pattern2->add( ",\".*\"");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,12 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stream.h>
|
#include <stream.h>
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
// Max. width of the formatted output
|
||||||
|
#define MaxTextWidth 74
|
||||||
|
|
||||||
typedef char Switch;
|
typedef char Switch;
|
||||||
|
|
||||||
#define NO_SWITCH 0
|
#define NO_SWITCH 0
|
||||||
|
|
@ -31,7 +34,97 @@ Switch noc_switch = NO_SWITCH;
|
||||||
Switch nomc_switch = NO_SWITCH;
|
Switch nomc_switch = NO_SWITCH;
|
||||||
Switch nosc_switch = NO_SWITCH;
|
Switch nosc_switch = NO_SWITCH;
|
||||||
|
|
||||||
|
// Format comments
|
||||||
|
// ==========================
|
||||||
|
int printComment( ostream &out, const Buffer_list& T, bool leadingLine) {
|
||||||
|
int width = MaxTextWidth - indentation_number() - 3;
|
||||||
|
int w = width;
|
||||||
|
int state = 0; // 0 = start, 1 = after token, 2 = spaces
|
||||||
|
// 3 = one newline (and spaces), 4 = newlines
|
||||||
|
for ( Buffer_const_iterator words = T.begin(); words != T.end(); ++words) {
|
||||||
|
bool is_space = (*words)->is_space();
|
||||||
|
int len = int((*words)->size()) - 1;
|
||||||
|
switch ( state) {
|
||||||
|
case 0:
|
||||||
|
if ( ! is_space) {
|
||||||
|
if ( leadingLine)
|
||||||
|
out << endl;
|
||||||
|
out << ind_newline << "// " << (*words)->begin();
|
||||||
|
w -= len;
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if ( ! is_space || len > 0) {
|
||||||
|
if ( ! is_space) {
|
||||||
|
if ((len > w) && (w != width)) {
|
||||||
|
w = width;
|
||||||
|
out << ind_newline << "// ";
|
||||||
|
}
|
||||||
|
out << (*words)->begin();
|
||||||
|
w -= len;
|
||||||
|
} else {
|
||||||
|
if ( (*words)->begin()[0] == '\n')
|
||||||
|
state = 3;
|
||||||
|
else
|
||||||
|
state = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if ( ! is_space || len > 0) {
|
||||||
|
if ( ! is_space) {
|
||||||
|
if ((len >= w) && (w != width)) {
|
||||||
|
w = width;
|
||||||
|
out << ind_newline << "// ";
|
||||||
|
} else {
|
||||||
|
out << ' ';
|
||||||
|
w--;
|
||||||
|
}
|
||||||
|
out << (*words)->begin();
|
||||||
|
w -= len;
|
||||||
|
state = 1;
|
||||||
|
} else {
|
||||||
|
if ( (*words)->begin()[0] == '\n')
|
||||||
|
state = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if ( ! is_space || len > 0) {
|
||||||
|
if ( !is_space) {
|
||||||
|
if ((len >= w) && (w != width)) {
|
||||||
|
w = width;
|
||||||
|
out << ind_newline << "// ";
|
||||||
|
} else {
|
||||||
|
out << ' ';
|
||||||
|
w--;
|
||||||
|
}
|
||||||
|
out << (*words)->begin();
|
||||||
|
w -= len;
|
||||||
|
state = 1;
|
||||||
|
} else {
|
||||||
|
if ( (*words)->begin()[0] == '\n')
|
||||||
|
state = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if ( ! is_space || len > 0) {
|
||||||
|
if ( ! is_space) {
|
||||||
|
out << ind_newline << "// ";
|
||||||
|
out << ind_newline << "// ";
|
||||||
|
w = width;
|
||||||
|
out << (*words)->begin();
|
||||||
|
w -= len;
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
/* Declarations from syntax.y */
|
/* Declarations from syntax.y */
|
||||||
/* ========================== */
|
/* ========================== */
|
||||||
|
|
@ -54,7 +147,7 @@ const char* file_name = "<stdin>";
|
||||||
/* Taylored semantic functions used in syntax.y */
|
/* Taylored semantic functions used in syntax.y */
|
||||||
/* ============================================ */
|
/* ============================================ */
|
||||||
|
|
||||||
void handleMainComment( const Text& T) {
|
void handleMainComment( const Buffer_list& T) {
|
||||||
if ( noc_switch || nomc_switch)
|
if ( noc_switch || nomc_switch)
|
||||||
return;
|
return;
|
||||||
if ( indentation_number() > 0) {
|
if ( indentation_number() > 0) {
|
||||||
|
|
@ -66,7 +159,7 @@ void handleMainComment( const Text& T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleComment( const Text& T) {
|
void handleComment( const Buffer_list& T) {
|
||||||
if ( noc_switch || nosc_switch)
|
if ( noc_switch || nosc_switch)
|
||||||
return;
|
return;
|
||||||
cout << indent;
|
cout << indent;
|
||||||
|
|
@ -83,13 +176,13 @@ void handleClass( const char* classname) {
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
if ( *s == 0) {
|
if ( *s == 0) {
|
||||||
cout << indNewline;
|
cout << ind_newline;
|
||||||
cout << "class " << classname;
|
cout << "class " << classname;
|
||||||
} else {
|
} else {
|
||||||
global_template_params = global_classname;
|
global_template_params = global_classname;
|
||||||
while( *global_template_params && *global_template_params != '<')
|
while( *global_template_params && *global_template_params != '<')
|
||||||
++global_template_params;
|
++global_template_params;
|
||||||
cout << indNewline;
|
cout << ind_newline;
|
||||||
cout << "template < class ";
|
cout << "template < class ";
|
||||||
int nesting = 0;
|
int nesting = 0;
|
||||||
s++;
|
s++;
|
||||||
|
|
@ -118,7 +211,7 @@ void handleClass( const char* classname) {
|
||||||
}
|
}
|
||||||
if ( nesting >= 0)
|
if ( nesting >= 0)
|
||||||
printErrorMessage( MalformedTemplateParamError);
|
printErrorMessage( MalformedTemplateParamError);
|
||||||
cout << " >" << indNewline;
|
cout << " >" << ind_newline;
|
||||||
cout << "class ";
|
cout << "class ";
|
||||||
s = classname;
|
s = classname;
|
||||||
while ( *s != 0 && *s != '<') {
|
while ( *s != 0 && *s != '<') {
|
||||||
|
|
@ -126,8 +219,8 @@ void handleClass( const char* classname) {
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cout << " {" << indNewline;
|
cout << " {" << ind_newline;
|
||||||
cout << "public:" << indNewline;
|
cout << "public:" << ind_newline;
|
||||||
cout << indent;
|
cout << indent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,8 +230,8 @@ void handleClassEnd( void) {
|
||||||
free( global_classname);
|
free( global_classname);
|
||||||
global_classname = NULL;
|
global_classname = NULL;
|
||||||
cout << outdent;
|
cout << outdent;
|
||||||
cout << indNewline;
|
cout << ind_newline;
|
||||||
cout << "};" << indNewline;
|
cout << "};" << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleRefPage( const char* token) {
|
void handleRefPage( const char* token) {
|
||||||
|
|
@ -154,27 +247,27 @@ void handleRefPageEnd( void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleDeclaration( const char* decl) {
|
void handleDeclaration( const char* decl) {
|
||||||
cout << endl << indNewline;
|
cout << endl << ind_newline;
|
||||||
cout << decl;
|
cout << decl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleNestedType( const char* decl) {
|
void handleNestedType( const char* decl) {
|
||||||
cout << endl << indNewline;
|
cout << endl << ind_newline;
|
||||||
cout << "Nested type required: " << global_classname << "::" << decl;
|
cout << "Nested type required: " << global_classname << "::" << decl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleMethodDeclaration( const char* decl) {
|
void handleMethodDeclaration( const char* decl) {
|
||||||
cout << endl << indNewline;
|
cout << endl << ind_newline;
|
||||||
cout << decl;
|
cout << decl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleFunctionDeclaration( const char* decl) {
|
void handleFunctionDeclaration( const char* decl) {
|
||||||
cout << endl << indNewline;
|
cout << endl << ind_newline;
|
||||||
cout << decl;
|
cout << decl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleFunctionTemplateDeclaration( const char* templ, const char* decl) {
|
void handleFunctionTemplateDeclaration( const char* templ, const char* decl) {
|
||||||
cout << endl << indNewline;
|
cout << endl << ind_newline;
|
||||||
cout << "template < class ";
|
cout << "template < class ";
|
||||||
const char* s = templ;
|
const char* s = templ;
|
||||||
int nesting = 0;
|
int nesting = 0;
|
||||||
|
|
@ -203,7 +296,7 @@ void handleFunctionTemplateDeclaration( const char* templ, const char* decl) {
|
||||||
}
|
}
|
||||||
if ( nesting != 0)
|
if ( nesting != 0)
|
||||||
printErrorMessage( MalformedTemplateParamError);
|
printErrorMessage( MalformedTemplateParamError);
|
||||||
cout << " >" << indNewline;
|
cout << " >" << ind_newline;
|
||||||
cout << decl;
|
cout << decl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,13 @@
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
#include <strstream.h>
|
#include <strstream.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <mstring.h>
|
#include <mstring.h>
|
||||||
|
|
||||||
#include <lex_include.h>
|
#include <lex_include.h>
|
||||||
#include <macro_dictionary.h>
|
#include <macro_dictionary.h>
|
||||||
#include <internal_macros.h>
|
#include <internal_macros.h>
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
#include <html_config.h>
|
#include <html_config.h>
|
||||||
#include <html_syntax.h>
|
#include <html_syntax.h>
|
||||||
#include <html_error.h>
|
#include <html_error.h>
|
||||||
|
|
@ -121,44 +120,40 @@ void init_commandline_args() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int text_block_length( const Text& T) {
|
int text_block_length( const Buffer_list& T) {
|
||||||
int l = 0;
|
int l = 0;
|
||||||
InListFIter< TextToken> words( (Text&)T);
|
for ( Buffer_const_iterator words = T.begin(); words != T.end(); ++words) {
|
||||||
ForAll( words) {
|
if ( (*words)->is_space())
|
||||||
if ( words->isSpace)
|
|
||||||
++l;
|
++l;
|
||||||
else
|
else
|
||||||
l += (*words).len;
|
l += (*words)->size() - 1;
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* text_block_to_string( const Text& T) {
|
char* text_block_to_string( const Buffer_list& T) {
|
||||||
char* string = new char[ text_block_length( T) + 1];
|
char* string = new char[ text_block_length(T) + 1];
|
||||||
string[0] = '\0';
|
string[0] = '\0';
|
||||||
InListFIter< TextToken> words( (Text&)T);
|
for ( Buffer_const_iterator words = T.begin(); words != T.end(); ++words) {
|
||||||
ForAll( words) {
|
if ( (*words)->is_space())
|
||||||
if ( words->isSpace)
|
|
||||||
strcat( string, " ");
|
strcat( string, " ");
|
||||||
else
|
else
|
||||||
strcat( string, (*words).string);
|
strcat( string, (*words)->begin());
|
||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_text_block_empty( const Text& T) {
|
bool is_text_block_empty( const Buffer_list& T) {
|
||||||
InListFIter< TextToken> words( (Text&)T);
|
for ( Buffer_const_iterator words = T.begin(); words != T.end(); ++words) {
|
||||||
ForAll( words) {
|
if ( ! (*words)->is_space())
|
||||||
if ( !words->isSpace)
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_html_text_block( ostream &out, const Text& T) {
|
void print_html_text_block( ostream &out, const Buffer_list& T) {
|
||||||
InListFIter< TextToken> words( (Text&)T);
|
for ( Buffer_const_iterator words = T.begin(); words != T.end(); ++words) {
|
||||||
ForAll( words) {
|
const char* s = (*words)->begin();
|
||||||
const char* s = words->string;
|
|
||||||
while ( *s) {
|
while ( *s) {
|
||||||
if ( *s != SEPARATOR)
|
if ( *s != SEPARATOR)
|
||||||
out << *s;
|
out << *s;
|
||||||
|
|
@ -172,15 +167,15 @@ void print_html_text_block( ostream &out, const Text& T) {
|
||||||
/* Taylored semantic functions used in syntax.y */
|
/* Taylored semantic functions used in syntax.y */
|
||||||
/* ============================================ */
|
/* ============================================ */
|
||||||
|
|
||||||
void handleText( const Text& T) {
|
void handleText( const Buffer_list& T) {
|
||||||
if ( ! current_ostream)
|
if ( ! current_ostream)
|
||||||
return;
|
return;
|
||||||
print_html_text_block( *current_ostream, T);
|
print_html_text_block( *current_ostream, T);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTextToken( const TextToken& TT) {
|
void handleBuffer( const Buffer& TT) {
|
||||||
if ( current_ostream)
|
if ( current_ostream)
|
||||||
*current_ostream << TT.string;
|
*current_ostream << TT.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleString( const char* s) {
|
void handleString( const char* s) {
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,15 @@
|
||||||
#if ! defined( MODULE_CONFIG)
|
#if ! defined( MODULE_CONFIG)
|
||||||
#define MODULE_CONFIG 1
|
#define MODULE_CONFIG 1
|
||||||
|
|
||||||
|
#include <buffer.h>
|
||||||
|
|
||||||
// Global declarations that are implemented in the main module.
|
// Global declarations that are implemented in the main module.
|
||||||
// There they can be taylored to the specific application, i.e.
|
// There they can be taylored to the specific application, i.e.
|
||||||
// extraction or checker.
|
// extraction or checker.
|
||||||
|
|
||||||
void handleComment( const Text& T);
|
void handleComment( const Buffer_list& T);
|
||||||
void handleConstructorComment( const Text& T);
|
void handleConstructorComment( const Buffer_list& T);
|
||||||
void handleMainComment( const Text& T);
|
void handleMainComment( const Buffer_list& T);
|
||||||
|
|
||||||
void handleClass( const char* classname);
|
void handleClass( const char* classname);
|
||||||
void handleClassEnd( void);
|
void handleClassEnd( void);
|
||||||
|
|
|
||||||
|
|
@ -72,36 +72,36 @@ inline double estimate_html_size( const string& s) {
|
||||||
|
|
||||||
void three_cols_html_begin( ostream& out, bool big_col1) {
|
void three_cols_html_begin( ostream& out, bool big_col1) {
|
||||||
current_font = it_font;
|
current_font = it_font;
|
||||||
out << indent << indent << indNewline
|
out << indent << indent << ind_newline
|
||||||
<< "<!3><TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 WIDTH="
|
<< "<!3><TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 WIDTH="
|
||||||
<< table_width << ">" << indNewline
|
<< table_width << ">" << ind_newline
|
||||||
<< "<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH="
|
<< "<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH="
|
||||||
<< table_first_col + (big_col1 ? (table_second_col+table_third_col) :0)
|
<< table_first_col + (big_col1 ? (table_second_col+table_third_col) :0)
|
||||||
<< "%" << ( big_col1 ? " COLSPAN=3>" : " NOWRAP>")
|
<< "%" << ( big_col1 ? " COLSPAN=3>" : " NOWRAP>")
|
||||||
<< indNewline << "<I><NOBR>" << outdent << indNewline;
|
<< ind_newline << "<I><NOBR>" << outdent << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void three_cols_html_premature_end( ostream& out) {
|
void three_cols_html_premature_end( ostream& out) {
|
||||||
out << indent << indNewline << store_remember_font() << "</I></NOBR>"
|
out << indent << ind_newline << store_remember_font() << "</I></NOBR>"
|
||||||
<< indNewline << "</TD></TR>" << indNewline
|
<< ind_newline << "</TD></TR>" << ind_newline
|
||||||
<< "</TABLE><!3>" << outdent << outdent << indNewline;
|
<< "</TABLE><!3>" << outdent << outdent << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void three_cols_html_second( ostream& out, bool big_col1, bool big_col2) {
|
void three_cols_html_second( ostream& out, bool big_col1, bool big_col2) {
|
||||||
out << indent << indNewline << store_remember_font() << "</I></NOBR>"
|
out << indent << ind_newline << store_remember_font() << "</I></NOBR>"
|
||||||
<< indNewline << "</TD>";
|
<< ind_newline << "</TD>";
|
||||||
if ( big_col1)
|
if ( big_col1)
|
||||||
out << "</TR><TR><TD WIDTH=" << table_first_col << "% NOWRAP></TD>";
|
out << "</TR><TR><TD WIDTH=" << table_first_col << "% NOWRAP></TD>";
|
||||||
out << "<TD ALIGN=LEFT VALIGN=TOP WIDTH="
|
out << "<TD ALIGN=LEFT VALIGN=TOP WIDTH="
|
||||||
<< table_second_col + ( big_col2 ? table_third_col : 0)
|
<< table_second_col + ( big_col2 ? table_third_col : 0)
|
||||||
<< "% NOWRAP" << ( big_col2 ? " COLSPAN=2>" : ">")
|
<< "% NOWRAP" << ( big_col2 ? " COLSPAN=2>" : ">")
|
||||||
<< indNewline << "<I><NOBR>" << get_remember_font() << outdent
|
<< ind_newline << "<I><NOBR>" << get_remember_font() << outdent
|
||||||
<< indNewline;
|
<< ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void three_cols_html_third( ostream& out, bool big_col2, bool empty_col3) {
|
void three_cols_html_third( ostream& out, bool big_col2, bool empty_col3) {
|
||||||
out << indent << indNewline << store_remember_font() << "</I></NOBR>"
|
out << indent << ind_newline << store_remember_font() << "</I></NOBR>"
|
||||||
<< indNewline;
|
<< ind_newline;
|
||||||
if ( ! big_col2)
|
if ( ! big_col2)
|
||||||
out << "</TD>";
|
out << "</TD>";
|
||||||
if ( ! empty_col3) {
|
if ( ! empty_col3) {
|
||||||
|
|
@ -111,15 +111,15 @@ void three_cols_html_third( ostream& out, bool big_col2, bool empty_col3) {
|
||||||
<< "% NOWRAP></TD>";
|
<< "% NOWRAP></TD>";
|
||||||
out << "<TD ALIGN=LEFT VALIGN=TOP WIDTH=" << table_third_col << "%>";
|
out << "<TD ALIGN=LEFT VALIGN=TOP WIDTH=" << table_third_col << "%>";
|
||||||
}
|
}
|
||||||
out << outdent << indNewline;
|
out << outdent << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void three_cols_html_end( ostream& out, bool empty_col3) {
|
void three_cols_html_end( ostream& out, bool empty_col3) {
|
||||||
out << indent << indNewline;
|
out << indent << ind_newline;
|
||||||
if ( ! empty_col3)
|
if ( ! empty_col3)
|
||||||
out << "</TD>";
|
out << "</TD>";
|
||||||
out << "</TR>" << indNewline
|
out << "</TR>" << ind_newline
|
||||||
<< "</TABLE><!3>" << outdent << outdent << indNewline;
|
<< "</TABLE><!3>" << outdent << outdent << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void three_cols_html_new_closing( ostream& out) {
|
void three_cols_html_new_closing( ostream& out) {
|
||||||
|
|
@ -128,40 +128,40 @@ void three_cols_html_new_closing( ostream& out) {
|
||||||
|
|
||||||
void two_cols_html_begin( ostream& out) {
|
void two_cols_html_begin( ostream& out) {
|
||||||
current_font = it_font;
|
current_font = it_font;
|
||||||
out << indent << indent << indNewline
|
out << indent << indent << ind_newline
|
||||||
<< "<!2><TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 WIDTH="
|
<< "<!2><TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 WIDTH="
|
||||||
<< table_width << ">" << indNewline
|
<< table_width << ">" << ind_newline
|
||||||
<< "<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH="
|
<< "<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH="
|
||||||
<< table_2c_first_col + table_2c_second_col << "% NOWRAP COLSPAN=2>"
|
<< table_2c_first_col + table_2c_second_col << "% NOWRAP COLSPAN=2>"
|
||||||
<< indNewline << "<I><NOBR>" << outdent << indNewline;
|
<< ind_newline << "<I><NOBR>" << outdent << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void two_cols_html_premature_end( ostream& out) {
|
void two_cols_html_premature_end( ostream& out) {
|
||||||
out << indent << indNewline << store_remember_font() <<"</I></NOBR>"
|
out << indent << ind_newline << store_remember_font() <<"</I></NOBR>"
|
||||||
<< indNewline << "</TD></TR>" << indNewline
|
<< ind_newline << "</TD></TR>" << ind_newline
|
||||||
<< "</TABLE><!2>" << outdent << outdent << indNewline;
|
<< "</TABLE><!2>" << outdent << outdent << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void two_cols_html_second( ostream& out, bool empty_col2) {
|
void two_cols_html_second( ostream& out, bool empty_col2) {
|
||||||
out << indent << indNewline << store_remember_font() << "</I></NOBR>"
|
out << indent << ind_newline << store_remember_font() << "</I></NOBR>"
|
||||||
<< indNewline << "</TD></TR>";
|
<< ind_newline << "</TD></TR>";
|
||||||
if ( ! empty_col2)
|
if ( ! empty_col2)
|
||||||
out << "<TR><TD WIDTH=" << table_2c_first_col
|
out << "<TR><TD WIDTH=" << table_2c_first_col
|
||||||
<< "% NOWRAP></TD><TD ALIGN=LEFT VALIGN=TOP WIDTH="
|
<< "% NOWRAP></TD><TD ALIGN=LEFT VALIGN=TOP WIDTH="
|
||||||
<< table_2c_second_col << "%>";
|
<< table_2c_second_col << "%>";
|
||||||
out << outdent << indNewline;
|
out << outdent << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void two_cols_html_new_closing( ostream& out) {
|
void two_cols_html_new_closing( ostream& out) {
|
||||||
out << indent << indNewline << store_remember_font() << "</I></NOBR>"
|
out << indent << ind_newline << store_remember_font() << "</I></NOBR>"
|
||||||
<< indNewline << "</TD></TR>" << outdent << outdent;
|
<< ind_newline << "</TD></TR>" << outdent << outdent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void two_cols_html_end( ostream& out, bool empty_col2) {
|
void two_cols_html_end( ostream& out, bool empty_col2) {
|
||||||
out << indent << indNewline;
|
out << indent << ind_newline;
|
||||||
if ( ! empty_col2)
|
if ( ! empty_col2)
|
||||||
out << "</TD></TR>" << indNewline;
|
out << "</TD></TR>" << ind_newline;
|
||||||
out << "</TABLE><!2>" << outdent << outdent << indNewline;
|
out << "</TABLE><!2>" << outdent << outdent << ind_newline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1000,7 +1000,7 @@ void format_function( bool method, const char* signature,
|
||||||
! macroIsTrue( "\\ccAlternateThreeColumn"))
|
! macroIsTrue( "\\ccAlternateThreeColumn"))
|
||||||
*current_ostream << " COLSPAN=2";
|
*current_ostream << " COLSPAN=2";
|
||||||
*current_ostream << "><I>" << get_remember_font()
|
*current_ostream << "><I>" << get_remember_font()
|
||||||
<< indNewline;
|
<< ind_newline;
|
||||||
}
|
}
|
||||||
if ( method) {
|
if ( method) {
|
||||||
if ( ! definedMacro( "\\ccPureVar")) {
|
if ( ! definedMacro( "\\ccPureVar")) {
|
||||||
|
|
@ -1026,7 +1026,7 @@ void format_function( bool method, const char* signature,
|
||||||
<< " NOWRAP></TD>";
|
<< " NOWRAP></TD>";
|
||||||
*current_ostream << "<TD ALIGN=LEFT VALIGN=TOP "
|
*current_ostream << "<TD ALIGN=LEFT VALIGN=TOP "
|
||||||
"NOWRAP><I>";
|
"NOWRAP><I>";
|
||||||
*current_ostream << get_remember_font() << indNewline;
|
*current_ostream << get_remember_font() << ind_newline;
|
||||||
}
|
}
|
||||||
char* p = parameter_list;
|
char* p = parameter_list;
|
||||||
while ( n--) {
|
while ( n--) {
|
||||||
|
|
@ -1035,13 +1035,13 @@ void format_function( bool method, const char* signature,
|
||||||
if ( n) {
|
if ( n) {
|
||||||
*current_ostream << ", ";
|
*current_ostream << ", ";
|
||||||
if ( exp_size > dd_width)
|
if ( exp_size > dd_width)
|
||||||
*current_ostream << "<BR>" << indNewline;
|
*current_ostream << "<BR>" << ind_newline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*current_ostream << ")";
|
*current_ostream << ")";
|
||||||
if ( exp_size > dd_width) {
|
if ( exp_size > dd_width) {
|
||||||
*current_ostream << store_remember_font();
|
*current_ostream << store_remember_font();
|
||||||
*current_ostream << "</I></TD></TR></TABLE>" << indNewline;
|
*current_ostream << "</I></TD></TR></TABLE>" <<ind_newline;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
*current_ostream << " ()";
|
*current_ostream << " ()";
|
||||||
|
|
@ -1332,7 +1332,7 @@ void format_struct( const char* signature) {
|
||||||
"<TR><TD ALIGN=LEFT VALIGN=TOP NOWRAP";
|
"<TR><TD ALIGN=LEFT VALIGN=TOP NOWRAP";
|
||||||
//if ( tag_long_param_layout)
|
//if ( tag_long_param_layout)
|
||||||
//*current_ostream << " COLSPAN=2";
|
//*current_ostream << " COLSPAN=2";
|
||||||
*current_ostream << "><I>" << get_remember_font() << indNewline;
|
*current_ostream << "><I>" << get_remember_font() << ind_newline;
|
||||||
}
|
}
|
||||||
if ( return_value) {
|
if ( return_value) {
|
||||||
print_ascii_to_html_spc( *current_ostream, return_value);
|
print_ascii_to_html_spc( *current_ostream, return_value);
|
||||||
|
|
@ -1346,7 +1346,7 @@ void format_struct( const char* signature) {
|
||||||
if ( exp_size > table_width) {
|
if ( exp_size > table_width) {
|
||||||
*current_ostream << store_remember_font();
|
*current_ostream << store_remember_font();
|
||||||
*current_ostream << "</TD><TD ALIGN=LEFT VALIGN=TOP NOWRAP>";
|
*current_ostream << "</TD><TD ALIGN=LEFT VALIGN=TOP NOWRAP>";
|
||||||
*current_ostream << get_remember_font() << indNewline;
|
*current_ostream << get_remember_font() << ind_newline;
|
||||||
}
|
}
|
||||||
char* p = parameter_list;
|
char* p = parameter_list;
|
||||||
while ( n--) {
|
while ( n--) {
|
||||||
|
|
@ -1358,13 +1358,13 @@ void format_struct( const char* signature) {
|
||||||
if ( n) {
|
if ( n) {
|
||||||
*current_ostream << ", ";
|
*current_ostream << ", ";
|
||||||
if ( exp_size > table_width)
|
if ( exp_size > table_width)
|
||||||
*current_ostream << "<BR>" << indNewline;
|
*current_ostream << "<BR>" << ind_newline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*current_ostream << "};";
|
*current_ostream << "};";
|
||||||
if ( exp_size > table_width) {
|
if ( exp_size > table_width) {
|
||||||
*current_ostream << store_remember_font();
|
*current_ostream << store_remember_font();
|
||||||
*current_ostream << "</TD></TR></TABLE>" << indNewline;
|
*current_ostream << "</TD></TR></TABLE>" << ind_newline;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
*current_ostream << ';';
|
*current_ostream << ';';
|
||||||
|
|
@ -1504,7 +1504,7 @@ void format_enum( const char* signature) {
|
||||||
"<TR><TD ALIGN=LEFT VALIGN=TOP NOWRAP";
|
"<TR><TD ALIGN=LEFT VALIGN=TOP NOWRAP";
|
||||||
//if ( tag_long_param_layout)
|
//if ( tag_long_param_layout)
|
||||||
//*current_ostream << " COLSPAN=2";
|
//*current_ostream << " COLSPAN=2";
|
||||||
*current_ostream << "><I>" << get_remember_font() << indNewline;
|
*current_ostream << "><I>" << get_remember_font() << ind_newline;
|
||||||
}
|
}
|
||||||
if ( return_value) {
|
if ( return_value) {
|
||||||
print_ascii_to_html_spc( *current_ostream, return_value);
|
print_ascii_to_html_spc( *current_ostream, return_value);
|
||||||
|
|
@ -1518,7 +1518,7 @@ void format_enum( const char* signature) {
|
||||||
if ( exp_size > table_width) {
|
if ( exp_size > table_width) {
|
||||||
*current_ostream << store_remember_font();
|
*current_ostream << store_remember_font();
|
||||||
*current_ostream << "</TD><TD ALIGN=LEFT VALIGN=TOP NOWRAP>";
|
*current_ostream << "</TD><TD ALIGN=LEFT VALIGN=TOP NOWRAP>";
|
||||||
*current_ostream << get_remember_font() << indNewline;
|
*current_ostream << get_remember_font() << ind_newline;
|
||||||
}
|
}
|
||||||
char* p = parameter_list;
|
char* p = parameter_list;
|
||||||
while ( n--) {
|
while ( n--) {
|
||||||
|
|
@ -1580,13 +1580,13 @@ void format_enum( const char* signature) {
|
||||||
if ( n) {
|
if ( n) {
|
||||||
*current_ostream << ", ";
|
*current_ostream << ", ";
|
||||||
if ( exp_size > table_width)
|
if ( exp_size > table_width)
|
||||||
*current_ostream << "<BR>" << indNewline;
|
*current_ostream << "<BR>" << ind_newline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*current_ostream << "};";
|
*current_ostream << "};";
|
||||||
if ( exp_size > table_width) {
|
if ( exp_size > table_width) {
|
||||||
*current_ostream << store_remember_font();
|
*current_ostream << store_remember_font();
|
||||||
*current_ostream << "</TD></TR></TABLE>" << indNewline;
|
*current_ostream << "</TD></TR></TABLE>" << ind_newline;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
*current_ostream << ';';
|
*current_ostream << ';';
|
||||||
|
|
@ -1645,7 +1645,7 @@ void format_constructor( const char* signature) {
|
||||||
if ( macroIsTrue( "\\ccLongParamLayout") ||
|
if ( macroIsTrue( "\\ccLongParamLayout") ||
|
||||||
! macroIsTrue( "\\ccAlternateThreeColumn"))
|
! macroIsTrue( "\\ccAlternateThreeColumn"))
|
||||||
*current_ostream << " COLSPAN=2";
|
*current_ostream << " COLSPAN=2";
|
||||||
*current_ostream << "><I>" << get_remember_font() << indNewline;
|
*current_ostream << "><I>" << get_remember_font() << ind_newline;
|
||||||
}
|
}
|
||||||
// Of no use here!
|
// Of no use here!
|
||||||
// if ( scope)
|
// if ( scope)
|
||||||
|
|
@ -1666,7 +1666,7 @@ void format_constructor( const char* signature) {
|
||||||
<< " NOWRAP></TD>";
|
<< " NOWRAP></TD>";
|
||||||
*current_ostream << "<TD ALIGN=LEFT VALIGN=TOP "
|
*current_ostream << "<TD ALIGN=LEFT VALIGN=TOP "
|
||||||
"NOWRAP><I>";
|
"NOWRAP><I>";
|
||||||
*current_ostream << get_remember_font() << indNewline;
|
*current_ostream << get_remember_font() << ind_newline;
|
||||||
}
|
}
|
||||||
char* p = parameter_list;
|
char* p = parameter_list;
|
||||||
while ( n--) {
|
while ( n--) {
|
||||||
|
|
@ -1675,13 +1675,13 @@ void format_constructor( const char* signature) {
|
||||||
if ( n) {
|
if ( n) {
|
||||||
*current_ostream << ", ";
|
*current_ostream << ", ";
|
||||||
if ( exp_size > table_width)
|
if ( exp_size > table_width)
|
||||||
*current_ostream << "<BR>" << indNewline;
|
*current_ostream << "<BR>" << ind_newline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*current_ostream << ");";
|
*current_ostream << ");";
|
||||||
if ( exp_size > table_width) {
|
if ( exp_size > table_width) {
|
||||||
*current_ostream << store_remember_font();
|
*current_ostream << store_remember_font();
|
||||||
*current_ostream << "</I></TD></TR></TABLE>" << indNewline;
|
*current_ostream << "</I></TD></TR></TABLE>" << ind_newline;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
*current_ostream << ';';
|
*current_ostream << ';';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
#define CPP_FORMATTING_H 1
|
#define CPP_FORMATTING_H 1
|
||||||
|
|
||||||
#include <mstring.h>
|
#include <mstring.h>
|
||||||
#include <database.h>
|
|
||||||
|
|
||||||
extern string class_name;
|
extern string class_name;
|
||||||
extern string template_class_name;
|
extern string template_class_name;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <extract_syntax.tab.h>
|
#include <extract_syntax.tab.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ int yyerror( char *s);
|
||||||
|
|
||||||
/* Datastructures for the parser */
|
/* Datastructures for the parser */
|
||||||
/* ============================= */
|
/* ============================= */
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -56,8 +56,7 @@ int yyerror( char *s);
|
||||||
} string;
|
} string;
|
||||||
char character; /* a (meaningless) character */
|
char character; /* a (meaningless) character */
|
||||||
Buffer* pBuffer; /* Buffer for collected strings and characters */
|
Buffer* pBuffer; /* Buffer for collected strings and characters */
|
||||||
TextToken* pTextToken;
|
Buffer_list* pText;
|
||||||
Text* pText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Elementary data types */
|
/* Elementary data types */
|
||||||
|
|
@ -113,18 +112,24 @@ int yyerror( char *s);
|
||||||
%token LALRRESTRICTION
|
%token LALRRESTRICTION
|
||||||
|
|
||||||
%type <pBuffer> string
|
%type <pBuffer> string
|
||||||
%type <pBuffer> declaration classname template_params
|
%type <pBuffer> whitespace
|
||||||
%type <pBuffer> cc_stmts cc_stmt cc_stmts_skip_space
|
%type <pBuffer> cc_stmts
|
||||||
%type <pText> comment_group comment_sequence
|
%type <pBuffer> cc_stmt
|
||||||
%type <pText> nested_token_sequence nested_token
|
%type <pBuffer> cc_stmts_skip_space
|
||||||
%type <pText> compound_comment full_comment_sequence
|
%type <pBuffer> comment_token
|
||||||
|
%type <pBuffer> declaration
|
||||||
|
%type <pBuffer> classname
|
||||||
|
%type <pBuffer> template_params
|
||||||
|
|
||||||
|
%type <pText> whitespaces
|
||||||
|
%type <pText> optional_whitespaces
|
||||||
|
%type <pText> comment_group
|
||||||
|
%type <pText> comment_sequence
|
||||||
|
%type <pText> compound_comment
|
||||||
|
%type <pText> full_comment_sequence
|
||||||
%type <pText> non_empty_comment_sequence
|
%type <pText> non_empty_comment_sequence
|
||||||
|
%type <pText> nested_token_sequence
|
||||||
%type <pText> whitespaces optional_whitespaces
|
%type <pText> nested_token
|
||||||
|
|
||||||
%type <pTextToken> comment_token non_empty_token whitespace
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
/* Grammar: Top Level */
|
/* Grammar: Top Level */
|
||||||
|
|
@ -138,7 +143,7 @@ stmt: string { delete $1;}
|
||||||
| SPACE {}
|
| SPACE {}
|
||||||
| NEWLINE
|
| NEWLINE
|
||||||
| BEGINCLASS
|
| BEGINCLASS
|
||||||
classname { handleClass( $2->string());
|
classname { handleClass( $2->begin());
|
||||||
delete $2;}
|
delete $2;}
|
||||||
decl_sequence
|
decl_sequence
|
||||||
ENDCLASS
|
ENDCLASS
|
||||||
|
|
@ -148,8 +153,8 @@ stmt: string { delete $1;}
|
||||||
creationvariable = NULL;
|
creationvariable = NULL;
|
||||||
}
|
}
|
||||||
| BEGINREFCLASS
|
| BEGINREFCLASS
|
||||||
classname { handleClass( $2->string());
|
classname { handleClass( $2->begin());
|
||||||
handleRefPage( $2->string());
|
handleRefPage( $2->begin());
|
||||||
delete $2;}
|
delete $2;}
|
||||||
decl_sequence
|
decl_sequence
|
||||||
ENDREFCLASS
|
ENDREFCLASS
|
||||||
|
|
@ -161,9 +166,9 @@ stmt: string { delete $1;}
|
||||||
}
|
}
|
||||||
| BEGINREFCLASS
|
| BEGINREFCLASS
|
||||||
'[' nested_token_sequence ']'
|
'[' nested_token_sequence ']'
|
||||||
classname { handleClass( $5->string());
|
classname { handleClass( $5->begin());
|
||||||
handleRefPage( $5->string());
|
handleRefPage( $5->begin());
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
delete $5;}
|
delete $5;}
|
||||||
decl_sequence
|
decl_sequence
|
||||||
ENDREFCLASS
|
ENDREFCLASS
|
||||||
|
|
@ -174,21 +179,21 @@ stmt: string { delete $1;}
|
||||||
creationvariable = NULL;
|
creationvariable = NULL;
|
||||||
}
|
}
|
||||||
| BEGINREFPAGE
|
| BEGINREFPAGE
|
||||||
classname { handleRefPage( $2->string());
|
classname { handleRefPage( $2->begin());
|
||||||
delete $2; }
|
delete $2; }
|
||||||
| BEGINREFPAGE
|
| BEGINREFPAGE
|
||||||
'[' nested_token_sequence ']'
|
'[' nested_token_sequence ']'
|
||||||
classname { handleRefPage( $5->string());
|
classname { handleRefPage( $5->begin());
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
delete $5; }
|
delete $5; }
|
||||||
| ENDREFPAGE { handleRefPageEnd(); }
|
| ENDREFPAGE { handleRefPageEnd(); }
|
||||||
| CREATIONVARIABLE {}
|
| CREATIONVARIABLE {}
|
||||||
| CCSTYLE '{' nested_token_sequence '}' { set_INITIAL = 1;
|
| CCSTYLE '{' nested_token_sequence '}' { set_INITIAL = 1;
|
||||||
delete $3;
|
delete_list($3);
|
||||||
}
|
}
|
||||||
| HEADING '{' comment_sequence '}' { delete $3; }
|
| HEADING '{' comment_sequence '}' { delete_list($3); }
|
||||||
| INCLUDE '{' comment_sequence '}' { delete $3; }
|
| INCLUDE '{' comment_sequence '}' { delete_list($3); }
|
||||||
| COMMENTHEADING '{' comment_sequence '}' { delete $3; }
|
| COMMENTHEADING '{' comment_sequence '}' { delete_list($3); }
|
||||||
| gobble_parameters
|
| gobble_parameters
|
||||||
| GOBBLEAFTERONEPARAM reduced_group reduced_group
|
| GOBBLEAFTERONEPARAM reduced_group reduced_group
|
||||||
| global_tagged_declarator
|
| global_tagged_declarator
|
||||||
|
|
@ -221,11 +226,11 @@ reduced_statement:
|
||||||
| NEWLINE
|
| NEWLINE
|
||||||
| CREATIONVARIABLE {}
|
| CREATIONVARIABLE {}
|
||||||
| CCSTYLE '{' nested_token_sequence '}' { set_INITIAL = 1;
|
| CCSTYLE '{' nested_token_sequence '}' { set_INITIAL = 1;
|
||||||
delete $3;
|
delete_list($3);
|
||||||
}
|
}
|
||||||
| HEADING '{' comment_sequence '}' { delete $3; }
|
| HEADING '{' comment_sequence '}' { delete_list($3); }
|
||||||
| INCLUDE '{' comment_sequence '}' { delete $3; }
|
| INCLUDE '{' comment_sequence '}' { delete_list($3); }
|
||||||
| COMMENTHEADING '{' comment_sequence '}' { delete $3; }
|
| COMMENTHEADING '{' comment_sequence '}' { delete_list($3); }
|
||||||
| gobble_parameters
|
| gobble_parameters
|
||||||
| GOBBLEAFTERONEPARAM reduced_group reduced_group
|
| GOBBLEAFTERONEPARAM reduced_group reduced_group
|
||||||
| reduced_group
|
| reduced_group
|
||||||
|
|
@ -251,36 +256,31 @@ string: STRING {
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
non_empty_token: string { $$ = new TextToken(
|
optional_whitespaces: /* empty */ { $$ = new Buffer_list(); }
|
||||||
$1->string(), $1->length());
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
optional_whitespaces: /* empty */ { $$ = new Text( managed); }
|
|
||||||
| whitespaces { $$ = $1; }
|
| whitespaces { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
whitespaces: whitespace { $$ = new Text( * $1, managed); }
|
whitespaces: whitespace { $$ = new Buffer_list( 1, $1); }
|
||||||
| GOBBLEAFTERONEPARAM comment_group comment_group {
|
| GOBBLEAFTERONEPARAM comment_group comment_group {
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| whitespaces whitespace {
|
| whitespaces whitespace {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->append( * $2);
|
$$->push_back( $2);
|
||||||
}
|
}
|
||||||
| whitespaces GOBBLEAFTERONEPARAM comment_group comment_group {
|
| whitespaces GOBBLEAFTERONEPARAM comment_group
|
||||||
|
comment_group {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
delete $1;
|
delete_list( $1);
|
||||||
delete $4;
|
delete_list( $4);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
whitespace: SPACE { $$ = new TextToken( $1.text, $1.len, true); }
|
whitespace: SPACE { $$ = new Buffer( $1.text, $1.len); }
|
||||||
| NEWLINE { $$ = new TextToken( "\n", 1, true); }
|
| NEWLINE { $$ = new Buffer( "\n", 1); }
|
||||||
| gobble_parameters
|
| gobble_parameters
|
||||||
{ $$ = new TextToken( " ", 1, true); }
|
{ $$ = new Buffer( " ", 1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -289,39 +289,39 @@ whitespace: SPACE { $$ = new TextToken( $1.text, $1.len, true); }
|
||||||
/* =============================== */
|
/* =============================== */
|
||||||
decl_sequence: comment_sequence {
|
decl_sequence: comment_sequence {
|
||||||
handleMainComment( * $1);
|
handleMainComment( * $1);
|
||||||
delete $1;
|
delete_list($1);
|
||||||
}
|
}
|
||||||
| decl_sequence
|
| decl_sequence
|
||||||
tagged_declarator
|
tagged_declarator
|
||||||
comment_sequence {
|
comment_sequence {
|
||||||
handleMainComment( * $3);
|
handleMainComment( * $3);
|
||||||
delete $3;
|
delete_list($3);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
tagged_declarator:
|
tagged_declarator:
|
||||||
global_tagged_declarator
|
global_tagged_declarator
|
||||||
| CONSTRUCTOR declaration comment_group {
|
| CONSTRUCTOR declaration comment_group {
|
||||||
handleFunctionDeclaration( $2->string());
|
handleFunctionDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
handleComment( * $3);
|
handleComment( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| METHOD declaration comment_group {
|
| METHOD declaration comment_group {
|
||||||
handleMethodDeclaration( $2->string());
|
handleMethodDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
handleComment( * $3);
|
handleComment( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
global_tagged_declarator:
|
global_tagged_declarator:
|
||||||
error {}
|
error {}
|
||||||
| FUNCTION declaration comment_group {
|
| FUNCTION declaration comment_group {
|
||||||
handleFunctionDeclaration( $2->string());
|
handleFunctionDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
handleComment( * $3);
|
handleComment( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| FUNCTIONTEMPLATE
|
| FUNCTIONTEMPLATE
|
||||||
template_params
|
template_params
|
||||||
|
|
@ -329,46 +329,46 @@ global_tagged_declarator:
|
||||||
declaration
|
declaration
|
||||||
comment_group {
|
comment_group {
|
||||||
handleFunctionTemplateDeclaration(
|
handleFunctionTemplateDeclaration(
|
||||||
$2->string(),
|
$2->begin(),
|
||||||
$4->string());
|
$4->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
delete $4;
|
delete $4;
|
||||||
handleComment( * $5);
|
handleComment( * $5);
|
||||||
delete $5;
|
delete_list( $5);
|
||||||
}
|
}
|
||||||
| VARIABLE declaration comment_group {
|
| VARIABLE declaration comment_group {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
handleComment( * $3);
|
handleComment( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| TYPEDEF declaration comment_group {
|
| TYPEDEF declaration comment_group {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
handleComment( * $3);
|
handleComment( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| NESTEDTYPE declaration comment_group {
|
| NESTEDTYPE declaration comment_group {
|
||||||
handleNestedType( $2->string());
|
handleNestedType( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
handleComment( * $3);
|
handleComment( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| ENUM declaration comment_group {
|
| ENUM declaration comment_group {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
handleComment( * $3);
|
handleComment( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| STRUCT declaration comment_group {
|
| STRUCT declaration comment_group {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
handleComment( * $3);
|
handleComment( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| GLOBALFUNCTION declaration {
|
| GLOBALFUNCTION declaration {
|
||||||
handleFunctionDeclaration( $2->string());
|
handleFunctionDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| GLOBALFUNCTIONTEMPLATE
|
| GLOBALFUNCTIONTEMPLATE
|
||||||
|
|
@ -376,30 +376,30 @@ global_tagged_declarator:
|
||||||
optional_whitespaces
|
optional_whitespaces
|
||||||
declaration {
|
declaration {
|
||||||
handleFunctionTemplateDeclaration(
|
handleFunctionTemplateDeclaration(
|
||||||
$2->string(),
|
$2->begin(),
|
||||||
$4->string());
|
$4->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
delete $4;
|
delete $4;
|
||||||
}
|
}
|
||||||
| GLOBALVARIABLE declaration {
|
| GLOBALVARIABLE declaration {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| GLOBALTYPEDEF declaration {
|
| GLOBALTYPEDEF declaration {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| GLOBALENUM declaration {
|
| GLOBALENUM declaration {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| GLOBALSTRUCT declaration {
|
| GLOBALSTRUCT declaration {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| DECLARATION declaration {
|
| DECLARATION declaration {
|
||||||
handleDeclaration( $2->string());
|
handleDeclaration( $2->begin());
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
@ -408,55 +408,61 @@ global_tagged_declarator:
|
||||||
/* ===================================== */
|
/* ===================================== */
|
||||||
comment_group: optional_whitespaces '{' comment_sequence '}' {
|
comment_group: optional_whitespaces '{' comment_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
delete $1;
|
delete_list( $1);
|
||||||
}
|
}
|
||||||
| optional_whitespaces BLOCKINTRO comment_sequence '}' {
|
| optional_whitespaces BLOCKINTRO comment_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
delete $1;
|
delete_list( $1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
comment_sequence: optional_whitespaces { $$ = new Text(managed);
|
comment_sequence: optional_whitespaces { $$ = new Buffer_list();
|
||||||
delete $1;
|
delete_list( $1);
|
||||||
}
|
}
|
||||||
| optional_whitespaces
|
| optional_whitespaces
|
||||||
non_empty_comment_sequence
|
non_empty_comment_sequence
|
||||||
optional_whitespaces { $$ = $2;
|
optional_whitespaces { $$ = $2;
|
||||||
delete $1;
|
delete_list( $1);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
full_comment_sequence: /* empty */ { $$ = new Text(managed); }
|
full_comment_sequence: /* empty */ { $$ = new Buffer_list(); }
|
||||||
| whitespaces { $$ = $1; }
|
| whitespaces { $$ = $1; }
|
||||||
| optional_whitespaces
|
| optional_whitespaces
|
||||||
non_empty_comment_sequence
|
non_empty_comment_sequence
|
||||||
optional_whitespaces {
|
optional_whitespaces {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->append( * $2);
|
$$->insert($$->end(), $2->begin(),$2->end());
|
||||||
$$->append( * $3);
|
$$->insert($$->end(), $3->begin(),$3->end());
|
||||||
|
delete $2;
|
||||||
|
delete $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
non_empty_comment_sequence:
|
non_empty_comment_sequence:
|
||||||
comment_token { $$ = new Text( * $1, managed); }
|
comment_token { $$ = new Buffer_list( 1, $1); }
|
||||||
| compound_comment { $$ = $1; }
|
| compound_comment { $$ = $1; }
|
||||||
| non_empty_comment_sequence optional_whitespaces comment_token {
|
| non_empty_comment_sequence optional_whitespaces
|
||||||
|
comment_token {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->append( * $2);
|
$$->insert($$->end(), $2->begin(),$2->end());
|
||||||
$$->append( * $3);
|
delete $2;
|
||||||
|
$$->push_back( $3);
|
||||||
}
|
}
|
||||||
| non_empty_comment_sequence
|
| non_empty_comment_sequence
|
||||||
optional_whitespaces
|
optional_whitespaces
|
||||||
compound_comment {
|
compound_comment {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->append( * $2);
|
$$->insert($$->end(), $2->begin(),$2->end());
|
||||||
$$->append( * $3);
|
delete $2;
|
||||||
|
$$->insert($$->end(), $3->begin(),$3->end());
|
||||||
|
delete $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
comment_token: non_empty_token { $$ = $1; }
|
comment_token: string { $$ = $1; }
|
||||||
| comment_token non_empty_token {
|
| comment_token string {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->add( * $2);
|
$$->add( * $2);
|
||||||
delete $2;
|
delete $2;
|
||||||
|
|
@ -465,8 +471,8 @@ comment_token: non_empty_token { $$ = $1; }
|
||||||
|
|
||||||
compound_comment: '{' full_comment_sequence '}' {
|
compound_comment: '{' full_comment_sequence '}' {
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
$$->cons( *new TextToken( "{", 1));
|
$$->push_front( new Buffer( "{", 1));
|
||||||
$$->append( *new TextToken( "}", 1));
|
$$->push_back( new Buffer( "}", 1));
|
||||||
}
|
}
|
||||||
| BLOCKINTRO full_comment_sequence '}' {
|
| BLOCKINTRO full_comment_sequence '}' {
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
|
|
@ -474,140 +480,120 @@ compound_comment: '{' full_comment_sequence '}' {
|
||||||
| CCSTYLE '{' nested_token_sequence '}' {
|
| CCSTYLE '{' nested_token_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
set_INITIAL = 1;
|
set_INITIAL = 1;
|
||||||
if ( $$->head().isSpace) // should not
|
if ( $$->front()->is_space()) // should not
|
||||||
$$->cons( *new TextToken( "`", 1));
|
$$->push_front( new Buffer( "`", 1));
|
||||||
else
|
else
|
||||||
$$->head().prepend( "`");
|
$$->front()->prepend( "`");
|
||||||
InListFIter< TextToken> ix( * $$);
|
if ( $$->back()->is_space())
|
||||||
ForAll( ix) {
|
$$->push_back( new Buffer( "'", 1));
|
||||||
if ( ix.isLast())
|
|
||||||
if ( ix->isSpace)
|
|
||||||
$$->append( *new TextToken(
|
|
||||||
"'", 1));
|
|
||||||
else
|
else
|
||||||
ix->add( "'");
|
$$->back()->add( "'");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
| CCSECTION '{' comment_sequence '}' {
|
| CCSECTION '{' comment_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
$$->cons( *new TextToken( " ", 1, true));
|
$$->push_front( new Buffer( " ", 1));
|
||||||
$$->cons( *new TextToken( "SECTION:"));
|
$$->push_front( new Buffer( "SECTION:"));
|
||||||
$$->cons( *new TextToken( "\n", 1, true));
|
$$->push_front( new Buffer( "\n", 1));
|
||||||
$$->cons( *new TextToken( "\n", 1, true));
|
$$->push_front( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken(
|
$$->push_back( new Buffer(
|
||||||
"===================================="
|
"===================================="
|
||||||
"===================================="));
|
"===================================="));
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
}
|
}
|
||||||
| CCSUBSECTION '{' comment_sequence '}' {
|
| CCSUBSECTION '{' comment_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
$$->cons( *new TextToken( " ", 1, true));
|
$$->push_front( new Buffer( " ", 1));
|
||||||
$$->cons( *new TextToken( "Subsection:"));
|
$$->push_front( new Buffer( "Subsection:"));
|
||||||
$$->cons( *new TextToken( "\n", 1, true));
|
$$->push_front( new Buffer( "\n", 1));
|
||||||
$$->cons( *new TextToken( "\n", 1, true));
|
$$->push_front( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken(
|
$$->push_back( new Buffer(
|
||||||
"------------------------------------"
|
"------------------------------------"
|
||||||
"------------------------------------"));
|
"------------------------------------"));
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
}
|
}
|
||||||
| HEADING '{' comment_sequence '}' {
|
| HEADING '{' comment_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
}
|
}
|
||||||
| INCLUDE '{' comment_sequence '}' {
|
| INCLUDE '{' comment_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
$$->cons( *new TextToken( "<"));
|
$$->push_front( new Buffer( "<"));
|
||||||
$$->cons( *new TextToken( " ", 1, true));
|
$$->push_front( new Buffer( " ", 1));
|
||||||
$$->cons( *new TextToken( "#include"));
|
$$->push_front( new Buffer( "#include"));
|
||||||
$$->append( *new TextToken( ">"));
|
$$->push_back( new Buffer( ">"));
|
||||||
}
|
}
|
||||||
| COMMENTHEADING '{' comment_sequence '}' {
|
| COMMENTHEADING '{' comment_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
}
|
}
|
||||||
| CREATIONVARIABLE {
|
| CREATIONVARIABLE {
|
||||||
$$ = new Text( managed);
|
$$ = new Buffer_list();
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken(
|
$$->push_back( new Buffer(
|
||||||
"New creation variable is:"));
|
"New creation variable is:"));
|
||||||
$$->append( *new TextToken( " ", 1, true));
|
$$->push_back( new Buffer( " ", 1));
|
||||||
TextToken* t = new TextToken($1.text,$1.len);
|
Buffer* t = new Buffer( $1.text, $1.len);
|
||||||
t->prepend( "`");
|
t->prepend( "`");
|
||||||
t->add( "'");
|
t->add( "'");
|
||||||
$$->append( *t);
|
$$->push_back( t);
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
$$->append( *new TextToken( "\n", 1, true));
|
$$->push_back( new Buffer( "\n", 1));
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Parsing of a C++ expression/statement with nested expressions */
|
/* Parsing of a C++ expression/statement with nested expressions */
|
||||||
/* ============================================================= */
|
/* ============================================================= */
|
||||||
nested_token_sequence:
|
nested_token_sequence:
|
||||||
/* empty */ {
|
/* empty */ { $$ = new Buffer_list(); }
|
||||||
$$ = new Text(managed);
|
|
||||||
}
|
|
||||||
| nested_token_sequence nested_token
|
| nested_token_sequence nested_token
|
||||||
{
|
{
|
||||||
$1->append( * $2);
|
$1->insert($1->end(), $2->begin(),$2->end());
|
||||||
|
delete $2;
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
nested_token: string {
|
nested_token: string { $$ = new Buffer_list( 1, $1); }
|
||||||
$$ = new Text(*new TextToken(
|
|
||||||
$1->string(),
|
|
||||||
$1->length()),
|
|
||||||
managed);
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
| SPACE {
|
| SPACE {
|
||||||
$$ = new Text(*new TextToken(
|
$$ = new Buffer_list( 1,
|
||||||
$1.text,
|
new Buffer( $1.text, $1.len));
|
||||||
$1.len,
|
|
||||||
true),
|
|
||||||
managed);
|
|
||||||
}
|
}
|
||||||
| NEWLINE {
|
| NEWLINE {
|
||||||
$$ = new Text(*new TextToken( "\n", 1, true),
|
$$ = new Buffer_list( 1,
|
||||||
managed);
|
new Buffer( "\n", 1));
|
||||||
}
|
}
|
||||||
| '{' nested_token_sequence '}' {
|
| '{' nested_token_sequence '}' {
|
||||||
$2->cons( *new TextToken( "{", 1));
|
$2->push_front( new Buffer( "{", 1));
|
||||||
$2->append( *new TextToken( "}", 1));
|
$2->push_back( new Buffer( "}", 1));
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| BLOCKINTRO nested_token_sequence '}' {
|
| BLOCKINTRO nested_token_sequence '}' {
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| '[' nested_token_sequence ']' {
|
| '[' nested_token_sequence ']' {
|
||||||
$2->cons( *new TextToken( "[", 1));
|
$2->push_front( new Buffer( "[", 1));
|
||||||
$2->append( *new TextToken( "]", 1));
|
$2->push_back( new Buffer( "]", 1));
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| '(' nested_token_sequence ')' {
|
| '(' nested_token_sequence ')' {
|
||||||
$2->cons( *new TextToken( "(", 1));
|
$2->push_front( new Buffer( "(", 1));
|
||||||
$2->append( *new TextToken( ")", 1));
|
$2->push_back( new Buffer( ")", 1));
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| CCSTYLE '{' nested_token_sequence '}' {
|
| CCSTYLE '{' nested_token_sequence '}' {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
set_INITIAL = 1;
|
set_INITIAL = 1;
|
||||||
if ( $$->head().isSpace) // should not
|
if ( $$->front()->is_space()) // should not
|
||||||
$$->cons( *new TextToken( "`", 1));
|
$$->push_front( new Buffer( "`", 1));
|
||||||
else
|
else
|
||||||
$$->head().prepend( "`");
|
$$->front()->prepend( "`");
|
||||||
InListFIter< TextToken> ix( * $$);
|
if ( $$->back()->is_space())
|
||||||
ForAll( ix) {
|
$$->push_back( new Buffer( "'", 1));
|
||||||
if ( ix.isLast())
|
|
||||||
if ( ix->isSpace)
|
|
||||||
$$->append( *new TextToken(
|
|
||||||
"'", 1));
|
|
||||||
else
|
else
|
||||||
ix->add( "'");
|
$$->back()->add( "'");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -653,7 +639,7 @@ cc_stmts: /* empty */
|
||||||
{ $$ = new Buffer;}
|
{ $$ = new Buffer;}
|
||||||
| cc_stmts cc_stmt {
|
| cc_stmts cc_stmt {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->add( $2);
|
$$->add( * $2);
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
@ -680,7 +666,7 @@ cc_stmts_skip_space:
|
||||||
{ $$ = new Buffer;}
|
{ $$ = new Buffer;}
|
||||||
| string
|
| string
|
||||||
cc_stmts { $$ = $1;
|
cc_stmts { $$ = $1;
|
||||||
$$->add( $2);
|
$$->add( * $2);
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| SPACE cc_stmts { $$ = $2;}
|
| SPACE cc_stmts { $$ = $2;}
|
||||||
|
|
@ -692,7 +678,7 @@ cc_stmts_skip_space:
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
$$->prepend( '{');
|
$$->prepend( '{');
|
||||||
$$->add( '}');
|
$$->add( '}');
|
||||||
$$->add( $6);
|
$$->add( * $6);
|
||||||
delete $6;
|
delete $6;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#if ! defined( MODULE_CONFIG)
|
#if ! defined( MODULE_CONFIG)
|
||||||
#define MODULE_CONFIG 1
|
#define MODULE_CONFIG 1
|
||||||
|
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
#include <mstring.h>
|
#include <mstring.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -49,14 +49,14 @@ extern const string reference_icon;
|
||||||
|
|
||||||
|
|
||||||
// outdated
|
// outdated
|
||||||
int text_block_length( const Text& T);
|
int text_block_length( const Buffer_list& T);
|
||||||
char* text_block_to_string( const Text& T);
|
char* text_block_to_string( const Buffer_list& T);
|
||||||
bool is_text_block_empty( const Text& T);
|
bool is_text_block_empty( const Buffer_list& T);
|
||||||
void print_html_text_block( ostream &out, const Text& T);
|
void print_html_text_block( ostream &out, const Buffer_list& T);
|
||||||
|
|
||||||
|
|
||||||
void handleText( const Text& T);
|
void handleText( const Buffer_list& T);
|
||||||
void handleTextToken( const TextToken& TT);
|
void handleBuffer( const Buffer& TT);
|
||||||
void handleString( const char* s);
|
void handleString( const char* s);
|
||||||
void handleString( const string& s);
|
void handleString( const string& s);
|
||||||
void handleChar( char c);
|
void handleChar( char c);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
#include <html_config.h>
|
#include <html_config.h>
|
||||||
#include <string_conversion.h>
|
#include <string_conversion.h>
|
||||||
#include <internal_macros.h>
|
#include <internal_macros.h>
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <cpp_formatting.h>
|
#include <cpp_formatting.h>
|
||||||
#include <internal_macros.h>
|
#include <internal_macros.h>
|
||||||
|
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
#include <html_config.h>
|
#include <html_config.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -42,8 +42,8 @@ int yyerror( char *s);
|
||||||
const char* text; /* a chunk of zero terminated text */
|
const char* text; /* a chunk of zero terminated text */
|
||||||
char character; /* a character */
|
char character; /* a character */
|
||||||
int number; /* an integer */
|
int number; /* an integer */
|
||||||
TextToken* pTextToken;
|
Buffer* pBuffer;
|
||||||
Text* pText;
|
Buffer_list* pText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Elementary data types */
|
/* Elementary data types */
|
||||||
|
|
@ -81,8 +81,10 @@ int yyerror( char *s);
|
||||||
|
|
||||||
/* Type declarations for production rules */
|
/* Type declarations for production rules */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
%type <pTextToken> string_token
|
%type <pBuffer> string_token
|
||||||
%type <pText> comment_group comment_sequence comment_token
|
%type <pText> comment_group
|
||||||
|
%type <pText> comment_sequence
|
||||||
|
%type <pText> comment_token
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -98,13 +100,13 @@ stmt: error {}
|
||||||
| direct_string {}
|
| direct_string {}
|
||||||
| CHAPTER '{' comment_sequence '}' {
|
| CHAPTER '{' comment_sequence '}' {
|
||||||
handleChapter( * $3);
|
handleChapter( * $3);
|
||||||
delete $3;
|
delete_list( $3);
|
||||||
}
|
}
|
||||||
| BEGINCLASS { handleClassEnvironment(); }
|
| BEGINCLASS { handleClassEnvironment(); }
|
||||||
| ENDCLASS { handleClassEnd(); }
|
| ENDCLASS { handleClassEnd(); }
|
||||||
| HTMLBEGINCLASSFILE comment_group
|
| HTMLBEGINCLASSFILE comment_group
|
||||||
{ handleHtmlClassFile( cc_filename,*$2);
|
{ handleHtmlClassFile( cc_filename,*$2);
|
||||||
delete $2;
|
delete_list( $2);
|
||||||
}
|
}
|
||||||
| '{' input '}'
|
| '{' input '}'
|
||||||
;
|
;
|
||||||
|
|
@ -174,27 +176,27 @@ direct_string: STRING { handleString( $1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
string_token: STRING { $$ = new TextToken( $1); }
|
string_token: STRING { $$ = new Buffer( $1); }
|
||||||
| CHAR { $$ = new TextToken(); $$->add( $1); }
|
| CHAR { $$ = new Buffer( $1); }
|
||||||
| ASCIITOHTML PARAMETER {
|
| ASCIITOHTML PARAMETER {
|
||||||
char* s = convert_ascii_to_html($2);
|
char* s = convert_ascii_to_html($2);
|
||||||
$$ = new TextToken( s);
|
$$ = new Buffer( s);
|
||||||
delete[] $2;
|
delete[] $2;
|
||||||
delete[] s;
|
delete[] s;
|
||||||
set_old_state = 1;
|
set_old_state = 1;
|
||||||
}
|
}
|
||||||
| RAWOUTPUT PARAMETER {
|
| RAWOUTPUT PARAMETER {
|
||||||
$$ = new TextToken( $2);
|
$$ = new Buffer( $2);
|
||||||
delete[] $2;
|
delete[] $2;
|
||||||
set_old_state = 1;
|
set_old_state = 1;
|
||||||
}
|
}
|
||||||
| RAWOUTPUTN {
|
| RAWOUTPUTN {
|
||||||
$$ = new TextToken( $1);
|
$$ = new Buffer( $1);
|
||||||
delete[] $1;
|
delete[] $1;
|
||||||
set_old_state = 1;
|
set_old_state = 1;
|
||||||
}
|
}
|
||||||
| DEFWITHARGS PARAMETER {
|
| DEFWITHARGS PARAMETER {
|
||||||
$$ = new TextToken();
|
$$ = new Buffer();
|
||||||
if ( number_of_args < 1 ||
|
if ( number_of_args < 1 ||
|
||||||
number_of_args> 9)
|
number_of_args> 9)
|
||||||
printErrorMessage( NParamRangeError);
|
printErrorMessage( NParamRangeError);
|
||||||
|
|
@ -207,7 +209,7 @@ string_token: STRING { $$ = new TextToken( $1); }
|
||||||
set_old_state = 1;
|
set_old_state = 1;
|
||||||
}
|
}
|
||||||
| GDEFWITHARGS PARAMETER {
|
| GDEFWITHARGS PARAMETER {
|
||||||
$$ = new TextToken();
|
$$ = new Buffer();
|
||||||
if ( number_of_args < 1 ||
|
if ( number_of_args < 1 ||
|
||||||
number_of_args > 9)
|
number_of_args > 9)
|
||||||
printErrorMessage( NParamRangeError);
|
printErrorMessage( NParamRangeError);
|
||||||
|
|
@ -222,7 +224,7 @@ string_token: STRING { $$ = new TextToken( $1); }
|
||||||
set_old_state = 1;
|
set_old_state = 1;
|
||||||
}
|
}
|
||||||
| DEFWITHUNKNOWNARGS PARAMETER {
|
| DEFWITHUNKNOWNARGS PARAMETER {
|
||||||
$$ = new TextToken();
|
$$ = new Buffer();
|
||||||
if ( ! quiet_switch) {
|
if ( ! quiet_switch) {
|
||||||
cerr << endl
|
cerr << endl
|
||||||
<< "Unknown macro definition: "
|
<< "Unknown macro definition: "
|
||||||
|
|
@ -243,15 +245,15 @@ string_token: STRING { $$ = new TextToken( $1); }
|
||||||
comment_group: '{' comment_sequence '}' { $$ = $2; }
|
comment_group: '{' comment_sequence '}' { $$ = $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
comment_sequence: /* empty */ { $$ = new Text( managed); }
|
comment_sequence: /* empty */ { $$ = new Buffer_list(); }
|
||||||
| comment_sequence comment_token {
|
| comment_sequence comment_token {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->append( * $2);
|
$$->insert($$->end(), $2->begin(),$2->end());
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
comment_token: string_token { $$ = new Text( * $1, managed); }
|
comment_token: string_token { $$ = new Buffer_list( 1, $1); }
|
||||||
| comment_group { $$ = $1; }
|
| comment_group { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ static int next_class_link_last = 0;
|
||||||
|
|
||||||
string chapter_title;
|
string chapter_title;
|
||||||
|
|
||||||
void handleChapter( const Text& T) {
|
void handleChapter( const Buffer_list& T) {
|
||||||
next_class_link_last = 0;
|
next_class_link_last = 0;
|
||||||
//string new_main_filename = macroX( "\\lciInputPath")
|
//string new_main_filename = macroX( "\\lciInputPath")
|
||||||
// + macroX( "\\lciChapterPrefix")
|
// + macroX( "\\lciChapterPrefix")
|
||||||
|
|
@ -218,7 +218,7 @@ void handleChapter( const Text& T) {
|
||||||
<< "\">" << chapter_title << "</A>" << endl;
|
<< "\">" << chapter_title << "</A>" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleBiblio( const Text& T) {
|
void handleBiblio( const Buffer_list& T) {
|
||||||
ostream* out = open_file_for_write( tmp_path + macroX("\\lciBibFilename"));
|
ostream* out = open_file_for_write( tmp_path + macroX("\\lciBibFilename"));
|
||||||
istream* in = open_config_file( macroX( "\\lciBiblioHeader"));
|
istream* in = open_config_file( macroX( "\\lciBiblioHeader"));
|
||||||
filter_config_file( *in, *out);
|
filter_config_file( *in, *out);
|
||||||
|
|
@ -326,7 +326,7 @@ void handleClassEnd( void) {
|
||||||
handleClassFileEnd();
|
handleClassFileEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleHtmlClassFile( const string& filename, const Text& T) {
|
void handleHtmlClassFile( const string& filename, const Buffer_list& T) {
|
||||||
char* s = text_block_to_string( T);
|
char* s = text_block_to_string( T);
|
||||||
string p = string("<A HREF=\"") + filename + "\">" + s + "</A>";
|
string p = string("<A HREF=\"") + filename + "\">" + s + "</A>";
|
||||||
handleClassFile( filename, p);
|
handleClassFile( filename, p);
|
||||||
|
|
@ -395,18 +395,6 @@ undef( const string&, string param[], size_t n, size_t opt) {
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
|
||||||
optional_param_at_end( const string&, string param[], size_t n, size_t opt) {
|
|
||||||
NParamCheck( 2, 0);
|
|
||||||
string macroname( param[0]);
|
|
||||||
crop_string( macroname);
|
|
||||||
remove_separator( macroname);
|
|
||||||
string s( param[1]);
|
|
||||||
crop_string( s);
|
|
||||||
setMacroOptEnd( macroname, atoi(s.c_str()));
|
|
||||||
return string();
|
|
||||||
}
|
|
||||||
|
|
||||||
string
|
string
|
||||||
begin_scope( const string&, string param[], size_t n, size_t opt) {
|
begin_scope( const string&, string param[], size_t n, size_t opt) {
|
||||||
NParamCheck( 0, 0);
|
NParamCheck( 0, 0);
|
||||||
|
|
@ -700,8 +688,6 @@ void init_internal_macros() {
|
||||||
insertInternalGlobalMacro( "\\def", newcommand, 2);
|
insertInternalGlobalMacro( "\\def", newcommand, 2);
|
||||||
insertInternalGlobalMacro( "\\gdef", global_newcommand, 2);
|
insertInternalGlobalMacro( "\\gdef", global_newcommand, 2);
|
||||||
insertInternalGlobalMacro( "\\lciUndef", undef, 1);
|
insertInternalGlobalMacro( "\\lciUndef", undef, 1);
|
||||||
insertInternalGlobalMacro( "\\lciOptionalParameterAtEnd",
|
|
||||||
optional_param_at_end, 2);
|
|
||||||
insertInternalGlobalMacro( "\\lciBeginScope", begin_scope, 0);
|
insertInternalGlobalMacro( "\\lciBeginScope", begin_scope, 0);
|
||||||
insertInternalGlobalMacro( "\\lciEndScope", end_scope, 0);
|
insertInternalGlobalMacro( "\\lciEndScope", end_scope, 0);
|
||||||
insertInternalGlobalMacro( "\\lciIfDefined", if_defined, 1);
|
insertInternalGlobalMacro( "\\lciIfDefined", if_defined, 1);
|
||||||
|
|
@ -719,10 +705,8 @@ void init_internal_macros() {
|
||||||
insertInternalGlobalMacro( "\\lciStyle", cc_style, 1);
|
insertInternalGlobalMacro( "\\lciStyle", cc_style, 1);
|
||||||
insertInternalGlobalMacro( "\\lciCCParameter", cc_parameter, 0);
|
insertInternalGlobalMacro( "\\lciCCParameter", cc_parameter, 0);
|
||||||
|
|
||||||
insertInternalGlobalMacro( "\\lciTwoColumnLayout",
|
insertInternalGlobalMacro( "\\lciTwoColumnLayout", two_column_layout, 1);
|
||||||
two_column_layout, 1);
|
insertInternalGlobalMacro( "\\lciThreeColumnLayout",three_column_layout,2);
|
||||||
insertInternalGlobalMacro( "\\lciThreeColumnLayout",
|
|
||||||
three_column_layout, 2);
|
|
||||||
|
|
||||||
insertInternalGlobalMacro( "\\lciHtmlIndex", html_index, 2);
|
insertInternalGlobalMacro( "\\lciHtmlIndex", html_index, 2);
|
||||||
insertInternalGlobalMacro( "\\lciHtmlIndexC", html_index_C, 1);
|
insertInternalGlobalMacro( "\\lciHtmlIndexC", html_index_C, 1);
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,12 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <mstring.h>
|
#include <mstring.h>
|
||||||
#include <database.h>
|
#include <buffer.h>
|
||||||
|
|
||||||
void init_internal_macros();
|
void init_internal_macros();
|
||||||
|
|
||||||
void handleChapter( const Text& T);
|
void handleChapter( const Buffer_list& T);
|
||||||
void handleBiblio( const Text& T);
|
void handleBiblio( const Buffer_list& T);
|
||||||
|
|
||||||
void handleClassEnvironment();
|
void handleClassEnvironment();
|
||||||
void handleClassEnd();
|
void handleClassEnd();
|
||||||
|
|
@ -29,7 +29,7 @@ void handleClassEnd();
|
||||||
void handleClassNameEnd( void);
|
void handleClassNameEnd( void);
|
||||||
void handleClassFileEnd( void);
|
void handleClassFileEnd( void);
|
||||||
|
|
||||||
void handleHtmlClassFile( const string& filename, const Text& T);
|
void handleHtmlClassFile( const string& filename, const Buffer_list& T);
|
||||||
|
|
||||||
string handleHtmlIndexC( const string& category, const string& item);
|
string handleHtmlIndexC( const string& category, const string& item);
|
||||||
string handleHtmlIndex( const string& category, const string& item);
|
string handleHtmlIndex( const string& category, const string& item);
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,6 @@
|
||||||
\gdef{\lciIfHtmlRefLinks}{\lcTrue}%
|
\gdef{\lciIfHtmlRefLinks}{\lcTrue}%
|
||||||
\gdef{\lciIfHtmlRefIndex}{\lcTrue}%
|
\gdef{\lciIfHtmlRefIndex}{\lcTrue}%
|
||||||
}
|
}
|
||||||
\lciOptionalParameterAtEnd{\begin@ccRefDeclaration}{1}
|
|
||||||
\newcommand{\begin@ccRefDeclaration@mo}{%
|
\newcommand{\begin@ccRefDeclaration@mo}{%
|
||||||
\def\ccRefCategory{#C1}%
|
\def\ccRefCategory{#C1}%
|
||||||
\def\ccPureRefScope{#C2}%
|
\def\ccPureRefScope{#C2}%
|
||||||
|
|
@ -676,7 +675,6 @@
|
||||||
|
|
||||||
\newcommand{\ccHtmlIndexC}{%
|
\newcommand{\ccHtmlIndexC}{%
|
||||||
\newcommand{\lciLocalIndexCategory}{class}\lciParseCC{\lciIndexCParsed}}
|
\newcommand{\lciLocalIndexCategory}{class}\lciParseCC{\lciIndexCParsed}}
|
||||||
\lciOptionalParameterAtEnd{\ccHtmlIndexC}{1}
|
|
||||||
\newcommand{\ccHtmlIndexC@o}{%
|
\newcommand{\ccHtmlIndexC@o}{%
|
||||||
\newcommand{\lciLocalIndexCategory}{#C1}\lciParseCC{\lciIndexCParsed}}
|
\newcommand{\lciLocalIndexCategory}{#C1}\lciParseCC{\lciIndexCParsed}}
|
||||||
\newcommand{\lciIndexCParsed}{\lciIndexCParsedX{\lciLocalIndexCategory}}
|
\newcommand{\lciIndexCParsed}{\lciIndexCParsedX{\lciLocalIndexCategory}}
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,6 @@
|
||||||
%% newlines, except for tabbing and tabular environments.
|
%% newlines, except for tabbing and tabular environments.
|
||||||
\newcommand{\\}{\lcRawHtml{<BR>}}
|
\newcommand{\\}{\lcRawHtml{<BR>}}
|
||||||
\newcommand{\\*}{\lcRawHtml{<BR>}}
|
\newcommand{\\*}{\lcRawHtml{<BR>}}
|
||||||
\lciOptionalParameterAtEnd{\\}{1}
|
|
||||||
\lciOptionalParameterAtEnd{\\*}{1}
|
|
||||||
\newcommand{\\@o}{\lcRawHtml{<BR>}}
|
\newcommand{\\@o}{\lcRawHtml{<BR>}}
|
||||||
\newcommand{\\*@o}{\lcRawHtml{<BR>}}
|
\newcommand{\\*@o}{\lcRawHtml{<BR>}}
|
||||||
|
|
||||||
|
|
@ -239,7 +237,6 @@
|
||||||
\newcommand{\footnotemark}{%
|
\newcommand{\footnotemark}{%
|
||||||
\addtocounter{footnote}{1}%
|
\addtocounter{footnote}{1}%
|
||||||
\footnotemark[\thefootnote]}
|
\footnotemark[\thefootnote]}
|
||||||
\lciOptionalParameterAtEnd{\footnotemark}{1}
|
|
||||||
\newcommand{\footnotemark@o}{%
|
\newcommand{\footnotemark@o}{%
|
||||||
\lcRawHtml{<A HREF="##Footnote_#XC1"><SUP>#XC1</SUP></A>}}
|
\lcRawHtml{<A HREF="##Footnote_#XC1"><SUP>#XC1</SUP></A>}}
|
||||||
\newcommand{\footnotetext}[1]{%
|
\newcommand{\footnotetext}[1]{%
|
||||||
|
|
@ -1020,7 +1017,6 @@
|
||||||
\newcommand{\pagenumbering}[1]{}
|
\newcommand{\pagenumbering}[1]{}
|
||||||
|
|
||||||
\newcommand{\twocolumn}{}
|
\newcommand{\twocolumn}{}
|
||||||
\lciOptionalParameterAtEnd{\twocolumn}{1}
|
|
||||||
\newcommand{\twocolumn@o}{#1}
|
\newcommand{\twocolumn@o}{#1}
|
||||||
\newcommand{\onecolumn}{}
|
\newcommand{\onecolumn}{}
|
||||||
|
|
||||||
|
|
@ -1057,7 +1053,6 @@
|
||||||
\newenvironment{enumerate}{\lcRawHtml{<OL>}}{\lcRawHtml{</OL>}}
|
\newenvironment{enumerate}{\lcRawHtml{<OL>}}{\lcRawHtml{</OL>}}
|
||||||
\newenvironment{description}{\lcRawHtml{<DL>}}{\lcRawHtml{</DL>}}
|
\newenvironment{description}{\lcRawHtml{<DL>}}{\lcRawHtml{</DL>}}
|
||||||
\newcommand{\item}{\lcRawHtml{<LI>}}
|
\newcommand{\item}{\lcRawHtml{<LI>}}
|
||||||
\lciOptionalParameterAtEnd{\item}{1}
|
|
||||||
\newcommand{\item@o}{\lcRawHtml{<DT><B>}#1\lcRawHtml{</B><DD>}}
|
\newcommand{\item@o}{\lcRawHtml{<DT><B>}#1\lcRawHtml{</B><DD>}}
|
||||||
|
|
||||||
\newcommand{\lciLocalVerbatim}[1]{%
|
\newcommand{\lciLocalVerbatim}[1]{%
|
||||||
|
|
@ -1143,14 +1138,12 @@
|
||||||
|
|
||||||
\newcommand{\newtheorem}[2]{%
|
\newcommand{\newtheorem}[2]{%
|
||||||
\gdef{\begin@#C1}{{\bf #2}~~\lcRawHtml{<EM>}}%
|
\gdef{\begin@#C1}{{\bf #2}~~\lcRawHtml{<EM>}}%
|
||||||
\lciOptionalParameterAtEnd{\begin@#C1}{1}%
|
|
||||||
\gdef{\begin@#C1@o}{{\bf #2 (##1)}~~\lcRawHtml{<EM>}}%
|
\gdef{\begin@#C1@o}{{\bf #2 (##1)}~~\lcRawHtml{<EM>}}%
|
||||||
\gdef{\end#C1}{\lcRawHtml{</EM>}}%
|
\gdef{\end#C1}{\lcRawHtml{</EM>}}%
|
||||||
}
|
}
|
||||||
\newcommand{\newcounter}[1]{%
|
\newcommand{\newcounter}[1]{%
|
||||||
\gdef{\the#C1}{0}%
|
\gdef{\the#C1}{0}%
|
||||||
\gdef{\lciDependantCounter#C1}{}}
|
\gdef{\lciDependantCounter#C1}{}}
|
||||||
\lciOptionalParameterAtEnd{\newcounter}{1}
|
|
||||||
\newcommand{\newcounter@mo}{
|
\newcommand{\newcounter@mo}{
|
||||||
\gdef{\the#C1}{0}%
|
\gdef{\the#C1}{0}%
|
||||||
\gdef{\lciDependantCounter#C1}{}%
|
\gdef{\lciDependantCounter#C1}{}%
|
||||||
|
|
@ -1177,15 +1170,11 @@
|
||||||
|
|
||||||
\newenvironment{figure}{\newcommand{\lciLabelTitle}{{\bf Figure:~~}}}{}
|
\newenvironment{figure}{\newcommand{\lciLabelTitle}{{\bf Figure:~~}}}{}
|
||||||
\newenvironment{figure*}{\begin{figure}}{\end{figure}}
|
\newenvironment{figure*}{\begin{figure}}{\end{figure}}
|
||||||
\lciOptionalParameterAtEnd{\begin@figure}{1}
|
|
||||||
\lciOptionalParameterAtEnd{\begin@figure*}{1}
|
|
||||||
\newenvironment{figure@o}{\begin{figure}}{\end{figure}}
|
\newenvironment{figure@o}{\begin{figure}}{\end{figure}}
|
||||||
\newenvironment{figure*@o}{\begin{figure}}{\end{figure}}
|
\newenvironment{figure*@o}{\begin{figure}}{\end{figure}}
|
||||||
|
|
||||||
\newenvironment{table}{\newcommand{\lciLabelTitle}{{\bf Table:~~}}}{}
|
\newenvironment{table}{\newcommand{\lciLabelTitle}{{\bf Table:~~}}}{}
|
||||||
\newenvironment{table*}{\begin{table}}{\end{table}}
|
\newenvironment{table*}{\begin{table}}{\end{table}}
|
||||||
\lciOptionalParameterAtEnd{\begin@table}{1}
|
|
||||||
\lciOptionalParameterAtEnd{\begin@table*}{1}
|
|
||||||
\newenvironment{table@o}{\begin{table}}{\end{table}}
|
\newenvironment{table@o}{\begin{table}}{\end{table}}
|
||||||
\newenvironment{table*@o}{\begin{table}}{\end{table}}
|
\newenvironment{table*@o}{\begin{table}}{\end{table}}
|
||||||
|
|
||||||
|
|
@ -1193,7 +1182,6 @@
|
||||||
\newcommand{\caption@om}{\lciLabelTitle #1}
|
\newcommand{\caption@om}{\lciLabelTitle #1}
|
||||||
|
|
||||||
\newcommand{\suppressfloats}{}
|
\newcommand{\suppressfloats}{}
|
||||||
\lciOptionalParameterAtEnd{\suppressfloats}{1}
|
|
||||||
\newcommand{\suppressfloats@o}{}
|
\newcommand{\suppressfloats@o}{}
|
||||||
|
|
||||||
\newcommand{\marginpar}[1]{%
|
\newcommand{\marginpar}[1]{%
|
||||||
|
|
@ -1229,8 +1217,6 @@
|
||||||
\newcommand{\>}{\lciTabbingSkip}%
|
\newcommand{\>}{\lciTabbingSkip}%
|
||||||
\renewcommand{\\}{\lciTabbingNL}%
|
\renewcommand{\\}{\lciTabbingNL}%
|
||||||
\renewcommand{\\*}{\lciTabbingNL}%
|
\renewcommand{\\*}{\lciTabbingNL}%
|
||||||
\lciOptionalParameterAtEnd{\\}{1}%
|
|
||||||
\lciOptionalParameterAtEnd{\\*}{1}%
|
|
||||||
\renewcommand{\\@o}{\lciTabbingNL}%
|
\renewcommand{\\@o}{\lciTabbingNL}%
|
||||||
\renewcommand{\\*@o}{\lciTabbingNL}%
|
\renewcommand{\\*@o}{\lciTabbingNL}%
|
||||||
}
|
}
|
||||||
|
|
@ -1270,8 +1256,6 @@
|
||||||
\newcommand{&}{\lciTabularSkip}%
|
\newcommand{&}{\lciTabularSkip}%
|
||||||
\renewcommand{\\}{\lciTabularNL}%
|
\renewcommand{\\}{\lciTabularNL}%
|
||||||
\renewcommand{\\*}{\lciTabularNL}%
|
\renewcommand{\\*}{\lciTabularNL}%
|
||||||
\lciOptionalParameterAtEnd{\\}{1}%
|
|
||||||
\lciOptionalParameterAtEnd{\\*}{1}%
|
|
||||||
\renewcommand{\\@o}{\lciTabularNL}%
|
\renewcommand{\\@o}{\lciTabularNL}%
|
||||||
\renewcommand{\\*@o}{\lciTabularNL}%
|
\renewcommand{\\*@o}{\lciTabularNL}%
|
||||||
\lciTabularCountColumns #1\*%
|
\lciTabularCountColumns #1\*%
|
||||||
|
|
@ -1438,10 +1422,8 @@
|
||||||
% ###########################################################################
|
% ###########################################################################
|
||||||
|
|
||||||
\newcommand{\linebreak}{}
|
\newcommand{\linebreak}{}
|
||||||
\lciOptionalParameterAtEnd{\linebreak}{1}
|
|
||||||
\newcommand{\linebreak@o}{}
|
\newcommand{\linebreak@o}{}
|
||||||
\newcommand{\nolinebreak}{}
|
\newcommand{\nolinebreak}{}
|
||||||
\lciOptionalParameterAtEnd{\nolinebreak}{1}
|
|
||||||
\newcommand{\nolinebreak@o}{}
|
\newcommand{\nolinebreak@o}{}
|
||||||
|
|
||||||
\newcommand{\newline}{\\}
|
\newcommand{\newline}{\\}
|
||||||
|
|
@ -1453,10 +1435,8 @@
|
||||||
\newenvironment{sloppypar}{}{}
|
\newenvironment{sloppypar}{}{}
|
||||||
|
|
||||||
\newcommand{\pagebreak}{}
|
\newcommand{\pagebreak}{}
|
||||||
\lciOptionalParameterAtEnd{\pagebreak}{1}
|
|
||||||
\newcommand{\pagebreak@o}{}
|
\newcommand{\pagebreak@o}{}
|
||||||
\newcommand{\nopagebreak}{}
|
\newcommand{\nopagebreak}{}
|
||||||
\lciOptionalParameterAtEnd{\nopagebreak}{1}
|
|
||||||
\newcommand{\nopagebreak@o}{}
|
\newcommand{\nopagebreak@o}{}
|
||||||
|
|
||||||
\newcommand{\samepage}{}
|
\newcommand{\samepage}{}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
include(CONFIG_PATH/header.tex)
|
||||||
|
\begin{ccRefClass}SCOPE{PREFIX`'ITEM} %% add template arg's if necessary
|
||||||
|
|
||||||
|
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||||
|
%% \ccHtmlIndexC[class]{} %% add further `index' entries
|
||||||
|
|
||||||
|
\ccDefinition
|
||||||
|
|
||||||
|
The class \ccRefName\ does this and that.
|
||||||
|
|
||||||
|
\ccInclude{SUBDIR`'ITEM.h}
|
||||||
|
|
||||||
|
\ccIsModel
|
||||||
|
|
||||||
|
\ccc{Concept}
|
||||||
|
|
||||||
|
\ccTypes
|
||||||
|
|
||||||
|
\ccNestedType{TYPE}{some nested types}
|
||||||
|
|
||||||
|
\ccCreation
|
||||||
|
\ccCreationVariable{a} %% choose variable name
|
||||||
|
|
||||||
|
\ccConstructor{PREFIX`'ITEM`'();}{default constructor.}
|
||||||
|
|
||||||
|
\ccOperations
|
||||||
|
|
||||||
|
\ccMethod{void foo();}{some member functions}
|
||||||
|
|
||||||
|
\ccSeeAlso
|
||||||
|
|
||||||
|
\ccc{Some_other_class},
|
||||||
|
\ccc{some_other_function}.
|
||||||
|
|
||||||
|
\ccExample
|
||||||
|
|
||||||
|
A short example program.
|
||||||
|
Instead of a short program fragment, a full running program can be
|
||||||
|
included using the
|
||||||
|
\verb|\ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}|
|
||||||
|
macro. The program example would be part of the source code distribution and
|
||||||
|
also part of the automatic test suite.
|
||||||
|
|
||||||
|
\begin{ccExampleCode}
|
||||||
|
void your_example_code() {
|
||||||
|
}
|
||||||
|
\end{ccExampleCode}
|
||||||
|
|
||||||
|
%% \ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}
|
||||||
|
|
||||||
|
\end{ccRefClass}
|
||||||
|
|
||||||
|
include(CONFIG_PATH/footer.tex)
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
include(CONFIG_PATH/header.tex)
|
||||||
|
\begin{ccRefConcept}{ITEM}
|
||||||
|
|
||||||
|
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||||
|
%% \ccHtmlIndexC[concept]{} %% add further `index' entries
|
||||||
|
|
||||||
|
\ccDefinition
|
||||||
|
|
||||||
|
The concept \ccRefName\ does this and that.
|
||||||
|
|
||||||
|
\ccTypes
|
||||||
|
|
||||||
|
\ccNestedType{TYPE}{some nested types}
|
||||||
|
|
||||||
|
\ccCreation
|
||||||
|
\ccCreationVariable{a} %% choose variable name
|
||||||
|
|
||||||
|
\ccConstructor{ITEM`'();}{default constructor.}
|
||||||
|
|
||||||
|
\ccOperations
|
||||||
|
|
||||||
|
\ccMethod{void foo();}{some member functions}
|
||||||
|
|
||||||
|
\ccHasModels
|
||||||
|
|
||||||
|
\ccc{Some_class},
|
||||||
|
\ccc{Some_other_class}.
|
||||||
|
|
||||||
|
\ccSeeAlso
|
||||||
|
|
||||||
|
\ccc{Some_other_concept},
|
||||||
|
\ccc{some_other_function}.
|
||||||
|
|
||||||
|
\ccExample
|
||||||
|
|
||||||
|
A short example program.
|
||||||
|
Instead of a short program fragment, a full running program can be
|
||||||
|
included using the
|
||||||
|
\verb|\ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}|
|
||||||
|
macro. The program example would be part of the source code distribution and
|
||||||
|
also part of the automatic test suite.
|
||||||
|
|
||||||
|
\begin{ccExampleCode}
|
||||||
|
void your_example_code() {
|
||||||
|
}
|
||||||
|
\end{ccExampleCode}
|
||||||
|
|
||||||
|
%% \ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}
|
||||||
|
|
||||||
|
\end{ccRefConcept}
|
||||||
|
|
||||||
|
include(CONFIG_PATH/footer.tex)
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
include(CONFIG_PATH/header.tex)
|
||||||
|
\begin{ccRefEnum}SCOPE{PREFIX`'ITEM} %% add template arg's if necessary
|
||||||
|
|
||||||
|
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||||
|
%% \ccHtmlIndexC[enum]{} %% add further `index' entries
|
||||||
|
|
||||||
|
\ccDefinition
|
||||||
|
|
||||||
|
The enum \ccRefName\ does this and that.
|
||||||
|
|
||||||
|
\ccInclude{SUBDIR`'ITEM.h}
|
||||||
|
|
||||||
|
\ccGlobalEnum{enum PREFIX`'ITEM { tag1, tag2 };}
|
||||||
|
|
||||||
|
\ccIsModel
|
||||||
|
|
||||||
|
\ccc{Concept}
|
||||||
|
|
||||||
|
\ccSeeAlso
|
||||||
|
|
||||||
|
\ccc{Some_other_enum},
|
||||||
|
\ccc{some_other_function}.
|
||||||
|
|
||||||
|
\ccExample
|
||||||
|
|
||||||
|
A short example program.
|
||||||
|
Instead of a short program fragment, a full running program can be
|
||||||
|
included using the
|
||||||
|
\verb|\ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}|
|
||||||
|
macro. The program example would be part of the source code distribution and
|
||||||
|
also part of the automatic test suite.
|
||||||
|
|
||||||
|
\begin{ccExampleCode}
|
||||||
|
void your_example_code() {
|
||||||
|
}
|
||||||
|
\end{ccExampleCode}
|
||||||
|
|
||||||
|
%% \ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}
|
||||||
|
|
||||||
|
\end{ccRefEnum}
|
||||||
|
|
||||||
|
include(CONFIG_PATH/footer.tex)
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
include(CONFIG_PATH/header.tex)
|
||||||
|
\begin{ccRefFunction}SCOPE{PREFIX`'ITEM} %% add template arg's if necessary
|
||||||
|
|
||||||
|
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||||
|
%% \ccHtmlIndexC[function]{} %% add further `index' entries
|
||||||
|
|
||||||
|
\ccDefinition
|
||||||
|
|
||||||
|
The function \ccRefName\ does this and that.
|
||||||
|
|
||||||
|
\ccInclude{SUBDIR`'ITEM.h}
|
||||||
|
|
||||||
|
\ccGlobalFunction{void PREFIX`'ITEM`'();}
|
||||||
|
|
||||||
|
\ccIsModel
|
||||||
|
|
||||||
|
\ccc{Concept}
|
||||||
|
|
||||||
|
\ccSeeAlso
|
||||||
|
|
||||||
|
\ccc{Some_other_class},
|
||||||
|
\ccc{some_other_function}.
|
||||||
|
|
||||||
|
\ccExample
|
||||||
|
|
||||||
|
A short example program.
|
||||||
|
Instead of a short program fragment, a full running program can be
|
||||||
|
included using the
|
||||||
|
\verb|\ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}|
|
||||||
|
macro. The program example would be part of the source code distribution and
|
||||||
|
also part of the automatic test suite.
|
||||||
|
|
||||||
|
\begin{ccExampleCode}
|
||||||
|
void your_example_code() {
|
||||||
|
}
|
||||||
|
\end{ccExampleCode}
|
||||||
|
|
||||||
|
%% \ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}
|
||||||
|
|
||||||
|
\end{ccRefFunction}
|
||||||
|
|
||||||
|
include(CONFIG_PATH/footer.tex)
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
include(CONFIG_PATH/header.tex)
|
||||||
|
\begin{ccRefMacro}{PREFIX`'ITEM} %% add template arg's if necessary
|
||||||
|
|
||||||
|
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||||
|
%% \ccHtmlIndexC[macro]{} %% add further `index' entries
|
||||||
|
|
||||||
|
\ccDefinition
|
||||||
|
|
||||||
|
The macro \ccRefName\ does this and that.
|
||||||
|
|
||||||
|
\ccInclude{SUBDIR`'ITEM.h}
|
||||||
|
|
||||||
|
\ccc{PREFIX`'ITEM}
|
||||||
|
|
||||||
|
\ccIsModel
|
||||||
|
|
||||||
|
\ccc{Concept}
|
||||||
|
|
||||||
|
\ccSeeAlso
|
||||||
|
|
||||||
|
\ccc{Some_other_macro},
|
||||||
|
\ccc{some_other_function}.
|
||||||
|
|
||||||
|
\ccExample
|
||||||
|
|
||||||
|
A short example program.
|
||||||
|
Instead of a short program fragment, a full running program can be
|
||||||
|
included using the
|
||||||
|
\verb|\ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}|
|
||||||
|
macro. The program example would be part of the source code distribution and
|
||||||
|
also part of the automatic test suite.
|
||||||
|
|
||||||
|
\begin{ccExampleCode}
|
||||||
|
void your_example_code() {
|
||||||
|
}
|
||||||
|
\end{ccExampleCode}
|
||||||
|
|
||||||
|
%% \ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}
|
||||||
|
|
||||||
|
\end{ccRefMacro}
|
||||||
|
|
||||||
|
include(CONFIG_PATH/footer.tex)
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
include(CONFIG_PATH/header.tex)
|
||||||
|
\begin{ccRefVariable}SCOPE{PREFIX`'ITEM} %% add template arg's if necessary
|
||||||
|
|
||||||
|
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||||
|
%% \ccHtmlIndexC[variable]{} %% add further `index' entries
|
||||||
|
|
||||||
|
\ccDefinition
|
||||||
|
|
||||||
|
The variable \ccRefName\ does this and that.
|
||||||
|
|
||||||
|
\ccInclude{SUBDIR`'ITEM.h}
|
||||||
|
|
||||||
|
\ccGlobalVariable{type PREFIX`'ITEM = init_value;}
|
||||||
|
|
||||||
|
\ccIsModel
|
||||||
|
|
||||||
|
\ccc{Concept}
|
||||||
|
|
||||||
|
\ccSeeAlso
|
||||||
|
|
||||||
|
\ccc{Some_other_variable},
|
||||||
|
\ccc{some_other_function}.
|
||||||
|
|
||||||
|
\ccExample
|
||||||
|
|
||||||
|
A short example program.
|
||||||
|
Instead of a short program fragment, a full running program can be
|
||||||
|
included using the
|
||||||
|
\verb|\ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}|
|
||||||
|
macro. The program example would be part of the source code distribution and
|
||||||
|
also part of the automatic test suite.
|
||||||
|
|
||||||
|
\begin{ccExampleCode}
|
||||||
|
void your_example_code() {
|
||||||
|
}
|
||||||
|
\end{ccExampleCode}
|
||||||
|
|
||||||
|
%% \ccIncludeExampleCode{examples/PACKAGE/ITEM`'_prog.C}
|
||||||
|
|
||||||
|
\end{ccRefVariable}
|
||||||
|
|
||||||
|
include(CONFIG_PATH/footer.tex)
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <mstring.h>
|
#include <mstring.h>
|
||||||
#include <list.h>
|
#include <list.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,46 +84,46 @@ void insertMacro( const string& macro,
|
||||||
const string& filename,
|
const string& filename,
|
||||||
size_t line,
|
size_t line,
|
||||||
const string& body,
|
const string& body,
|
||||||
size_t n_param,
|
size_t n_param) {
|
||||||
size_t n_opt) {
|
|
||||||
if ( macro_def_switch) {
|
if ( macro_def_switch) {
|
||||||
cerr << "Macro definition: macro `" << macro << "' = `"
|
cerr << "Macro definition: macro `" << macro << "' = `"
|
||||||
<< body << "'." << endl;
|
<< body << "'." << endl;
|
||||||
}
|
}
|
||||||
assert( macro_dictionary.size() > 0);
|
CC_Assert( macro_dictionary.size() > 0);
|
||||||
if ( macro[0] != '\0' && macro[1] == '\0')
|
if ( macro[0] != '\0' && macro[1] == '\0')
|
||||||
set_active_char( macro[0], true);
|
set_active_char( macro[0], true);
|
||||||
|
checkMacroOptEnd( macro);
|
||||||
macro_dictionary.front()[ macro] =
|
macro_dictionary.front()[ macro] =
|
||||||
Macro_item( filename, line, body, n_param, n_opt);
|
Macro_item( filename, line, body, n_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertInternalMacro( const string& macro,
|
void insertInternalMacro( const string& macro,
|
||||||
ExpandFunction fct,
|
ExpandFunction fct,
|
||||||
size_t n_param,
|
size_t n_param) {
|
||||||
size_t n_opt) {
|
|
||||||
if ( macro_def_switch) {
|
if ( macro_def_switch) {
|
||||||
cerr << "Internal def. : macro `" << macro << "'." << endl;
|
cerr << "Internal def. : macro `" << macro << "'." << endl;
|
||||||
}
|
}
|
||||||
assert( macro_dictionary.size() > 0);
|
CC_Assert( macro_dictionary.size() > 0);
|
||||||
if ( macro[0] != '\0' && macro[1] == '\0')
|
if ( macro[0] != '\0' && macro[1] == '\0')
|
||||||
set_active_char( macro[0], true);
|
set_active_char( macro[0], true);
|
||||||
|
checkMacroOptEnd( macro);
|
||||||
macro_dictionary.front()[ macro] =
|
macro_dictionary.front()[ macro] =
|
||||||
Macro_item( "<internal macro>", 0, fct, n_param, n_opt);
|
Macro_item( "<internal macro>", 0, fct, n_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertInternalMacro( const string& macro,
|
void insertInternalMacro( const string& macro,
|
||||||
const string& body,
|
const string& body,
|
||||||
size_t n_param ,
|
size_t n_param ) {
|
||||||
size_t n_opt) {
|
|
||||||
if ( macro_def_switch) {
|
if ( macro_def_switch) {
|
||||||
cerr << "Internal def. : macro `" << macro << "' = `"
|
cerr << "Internal def. : macro `" << macro << "' = `"
|
||||||
<< body << "'." << endl;
|
<< body << "'." << endl;
|
||||||
}
|
}
|
||||||
assert( macro_dictionary.size() > 0);
|
CC_Assert( macro_dictionary.size() > 0);
|
||||||
if ( macro[0] != '\0' && macro[1] == '\0')
|
if ( macro[0] != '\0' && macro[1] == '\0')
|
||||||
set_active_char( macro[0], true);
|
set_active_char( macro[0], true);
|
||||||
|
checkMacroOptEnd( macro);
|
||||||
macro_dictionary.front()[ macro] =
|
macro_dictionary.front()[ macro] =
|
||||||
Macro_item( "<internal macro>", 0, body, n_param, n_opt);
|
Macro_item( "<internal macro>", 0, body, n_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -131,49 +131,49 @@ void insertGlobalMacro( const string& macro,
|
||||||
const string& filename,
|
const string& filename,
|
||||||
size_t line,
|
size_t line,
|
||||||
const string& body,
|
const string& body,
|
||||||
size_t n_param,
|
size_t n_param) {
|
||||||
size_t n_opt) {
|
|
||||||
if ( macro_def_switch) {
|
if ( macro_def_switch) {
|
||||||
cerr << "Macro global def: macro `" << macro << "' = `"
|
cerr << "Macro global def: macro `" << macro << "' = `"
|
||||||
<< body << "'." << endl;
|
<< body << "'." << endl;
|
||||||
}
|
}
|
||||||
assert( macro_dictionary.size() > 0);
|
CC_Assert( macro_dictionary.size() > 0);
|
||||||
localEraseMacro( macro);
|
localEraseMacro( macro);
|
||||||
if ( macro[0] != '\0' && macro[1] == '\0')
|
if ( macro[0] != '\0' && macro[1] == '\0')
|
||||||
set_all_active_char( macro[0], true);
|
set_all_active_char( macro[0], true);
|
||||||
|
checkMacroOptEnd( macro);
|
||||||
macro_dictionary.back()[ macro] =
|
macro_dictionary.back()[ macro] =
|
||||||
Macro_item( filename, line, body, n_param, n_opt);
|
Macro_item( filename, line, body, n_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertInternalGlobalMacro( const string& macro,
|
void insertInternalGlobalMacro( const string& macro,
|
||||||
ExpandFunction fct,
|
ExpandFunction fct,
|
||||||
size_t n_param,
|
size_t n_param) {
|
||||||
size_t n_opt) {
|
|
||||||
if ( macro_def_switch) {
|
if ( macro_def_switch) {
|
||||||
cerr << "Internal gdef. : macro `" << macro << "'." << endl;
|
cerr << "Internal gdef. : macro `" << macro << "'." << endl;
|
||||||
}
|
}
|
||||||
assert( macro_dictionary.size() > 0);
|
CC_Assert( macro_dictionary.size() > 0);
|
||||||
localEraseMacro( macro);
|
localEraseMacro( macro);
|
||||||
if ( macro[0] != '\0' && macro[1] == '\0')
|
if ( macro[0] != '\0' && macro[1] == '\0')
|
||||||
set_all_active_char( macro[0], true);
|
set_all_active_char( macro[0], true);
|
||||||
|
checkMacroOptEnd( macro);
|
||||||
macro_dictionary.back()[ macro] =
|
macro_dictionary.back()[ macro] =
|
||||||
Macro_item( "<internal macro>", 0, fct, n_param, n_opt);
|
Macro_item( "<internal macro>", 0, fct, n_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertInternalGlobalMacro( const string& macro,
|
void insertInternalGlobalMacro( const string& macro,
|
||||||
const string& body,
|
const string& body,
|
||||||
size_t n_param,
|
size_t n_param) {
|
||||||
size_t n_opt) {
|
|
||||||
if ( macro_def_switch) {
|
if ( macro_def_switch) {
|
||||||
cerr << "Internal gdef. : macro `" << macro << "' = `"
|
cerr << "Internal gdef. : macro `" << macro << "' = `"
|
||||||
<< body << "'." << endl;
|
<< body << "'." << endl;
|
||||||
}
|
}
|
||||||
assert( macro_dictionary.size() > 0);
|
CC_Assert( macro_dictionary.size() > 0);
|
||||||
localEraseMacro( macro);
|
localEraseMacro( macro);
|
||||||
if ( macro[0] != '\0' && macro[1] == '\0')
|
if ( macro[0] != '\0' && macro[1] == '\0')
|
||||||
set_all_active_char( macro[0], true);
|
set_all_active_char( macro[0], true);
|
||||||
|
checkMacroOptEnd( macro);
|
||||||
macro_dictionary.back()[ macro] =
|
macro_dictionary.back()[ macro] =
|
||||||
Macro_item( "<internal macro>", 0, body, n_param, n_opt);
|
Macro_item( "<internal macro>", 0, body, n_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -214,19 +214,6 @@ bool macroIsTrue( const string& macro) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMacroOptEnd( const string& macro, int n_opt) {
|
|
||||||
Macro_dictionary_scope::iterator j;
|
|
||||||
if ( queryMacro( macro, j)) {
|
|
||||||
(*j).second.n_opt_at_end = n_opt;
|
|
||||||
} else {
|
|
||||||
cerr << endl << "Unknown macro " << macro
|
|
||||||
<< " in `" << in_string->name()
|
|
||||||
<< " in line " << in_string->line() << "'.";
|
|
||||||
if ( stack_trace_switch)
|
|
||||||
printErrorMessage( MacroUndefinedError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void eraseMacro( const string& macro) {
|
void eraseMacro( const string& macro) {
|
||||||
if ( macro_def_switch) {
|
if ( macro_def_switch) {
|
||||||
cerr << "Macro erasion: macro `" << macro << "'." << endl;
|
cerr << "Macro erasion: macro `" << macro << "'." << endl;
|
||||||
|
|
@ -393,5 +380,35 @@ string expandMacro( const string& macro,
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkMacroOptEnd( const string& macro) {
|
||||||
|
if ( macro.size() > 2) {
|
||||||
|
int cnt = 0;
|
||||||
|
string::const_iterator i = macro.end();
|
||||||
|
-- i;
|
||||||
|
while ( i != macro.begin() && *i == 'o') {
|
||||||
|
-- i;
|
||||||
|
++ cnt;
|
||||||
|
}
|
||||||
|
while ( i != macro.begin() && (*i == 'o' || *i == 'm'))
|
||||||
|
--i;
|
||||||
|
if ( *i != '@' || cnt == 0)
|
||||||
|
return;
|
||||||
|
string basename( macro.begin(), i);
|
||||||
|
Macro_dictionary_scope::iterator j;
|
||||||
|
if ( queryMacro( basename, j)) {
|
||||||
|
if ( cnt > int((*j).second.n_opt_at_end))
|
||||||
|
(*j).second.n_opt_at_end = cnt;
|
||||||
|
} else {
|
||||||
|
cerr << endl << "Error: Define macro " << basename
|
||||||
|
<< " before defining optional arguments " << macro
|
||||||
|
<< " in `" << in_string->name()
|
||||||
|
<< " in line " << in_string->line() << "'.";
|
||||||
|
if ( stack_trace_switch)
|
||||||
|
printErrorMessage( MacroUndefinedError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// EOF //
|
// EOF //
|
||||||
|
|
|
||||||
|
|
@ -30,22 +30,20 @@ struct Macro_item {
|
||||||
size_t n_param;
|
size_t n_param;
|
||||||
size_t n_opt_at_end;
|
size_t n_opt_at_end;
|
||||||
ExpandFunction fct;
|
ExpandFunction fct;
|
||||||
Macro_item() : n_param(0), n_opt_at_end(false) {}
|
|
||||||
|
Macro_item() : n_param(0), n_opt_at_end(0) {}
|
||||||
Macro_item( const string& file,
|
Macro_item( const string& file,
|
||||||
size_t ln,
|
size_t ln,
|
||||||
const string& bdy,
|
const string& bdy,
|
||||||
size_t n_par = 0,
|
size_t n_par = 0)
|
||||||
size_t n_opt = 0)
|
|
||||||
: filename(file), line(ln), body(bdy), n_param(n_par),
|
: filename(file), line(ln), body(bdy), n_param(n_par),
|
||||||
n_opt_at_end(n_opt), fct(0)
|
n_opt_at_end(0), fct(0)
|
||||||
{}
|
{}
|
||||||
Macro_item( const string& file,
|
Macro_item( const string& file,
|
||||||
size_t ln,
|
size_t ln,
|
||||||
ExpandFunction f,
|
ExpandFunction f,
|
||||||
size_t n_par = 0,
|
size_t n_par = 0)
|
||||||
size_t n_opt = 0)
|
: filename(file), line(ln), n_param(n_par), n_opt_at_end(0), fct(f)
|
||||||
: filename(file), line(ln), n_param(n_par),
|
|
||||||
n_opt_at_end(n_opt), fct(f)
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -56,35 +54,29 @@ void insertMacro( const string& macro,
|
||||||
const string& filename,
|
const string& filename,
|
||||||
size_t line,
|
size_t line,
|
||||||
const string& body,
|
const string& body,
|
||||||
size_t n_param = 0,
|
size_t n_param = 0);
|
||||||
size_t n_opt = 0);
|
|
||||||
|
|
||||||
void insertInternalMacro( const string& macro,
|
void insertInternalMacro( const string& macro,
|
||||||
ExpandFunction fct,
|
ExpandFunction fct,
|
||||||
size_t n_param = 0,
|
size_t n_param = 0);
|
||||||
size_t n_opt = 0);
|
|
||||||
|
|
||||||
void insertInternalMacro( const string& macro,
|
void insertInternalMacro( const string& macro,
|
||||||
const string& body,
|
const string& body,
|
||||||
size_t n_param = 0,
|
size_t n_param = 0);
|
||||||
size_t n_opt = 0);
|
|
||||||
|
|
||||||
void insertGlobalMacro( const string& macro,
|
void insertGlobalMacro( const string& macro,
|
||||||
const string& filename,
|
const string& filename,
|
||||||
size_t line,
|
size_t line,
|
||||||
const string& body,
|
const string& body,
|
||||||
size_t n_param = 0,
|
size_t n_param = 0);
|
||||||
size_t n_opt = 0);
|
|
||||||
|
|
||||||
void insertInternalGlobalMacro( const string& macro,
|
void insertInternalGlobalMacro( const string& macro,
|
||||||
ExpandFunction fct,
|
ExpandFunction fct,
|
||||||
size_t n_param = 0,
|
size_t n_param = 0);
|
||||||
size_t n_opt = 0);
|
|
||||||
|
|
||||||
void insertInternalGlobalMacro( const string& macro,
|
void insertInternalGlobalMacro( const string& macro,
|
||||||
const string& body,
|
const string& body,
|
||||||
size_t n_param = 0,
|
size_t n_param = 0);
|
||||||
size_t n_opt = 0);
|
|
||||||
|
|
||||||
const Macro_item& fetchMacro( const string& macro);
|
const Macro_item& fetchMacro( const string& macro);
|
||||||
|
|
||||||
|
|
@ -113,8 +105,7 @@ bool definedMacro( const string& macro);
|
||||||
|
|
||||||
bool macroIsTrue( const string& macro);
|
bool macroIsTrue( const string& macro);
|
||||||
|
|
||||||
void setMacroOptEnd( const string& macro, int n_opt);
|
void checkMacroOptEnd( const string& macro);
|
||||||
|
|
||||||
|
|
||||||
#endif // MACRO_DICTIONARY_H //
|
#endif // MACRO_DICTIONARY_H //
|
||||||
// EOF //
|
// EOF //
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
#define MY_STRING_H 1
|
#define MY_STRING_H 1
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
// comment this for SGI 7.2
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
// provide hash function for string class of egcs 1.1.1
|
// provide hash function for string class of egcs 1.1.1
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <mstring.h>
|
#include <mstring.h>
|
||||||
|
#include <basic.h>
|
||||||
|
|
||||||
#define OUT(x) if ( m_out) *m_out << x; return *this
|
#define OUT(x) if ( m_out) *m_out << x; return *this
|
||||||
|
|
||||||
|
|
@ -31,7 +32,7 @@ public:
|
||||||
Output_file( ostream* out, const string& name)
|
Output_file( ostream* out, const string& name)
|
||||||
: m_out(out), m_name(name) {}
|
: m_out(out), m_name(name) {}
|
||||||
bool is_valid() const { return m_out != 0;}
|
bool is_valid() const { return m_out != 0;}
|
||||||
ostream& stream() const { assert( m_out != 0); return *m_out;}
|
ostream& stream() const { CC_Assert( m_out != 0); return *m_out;}
|
||||||
ostream* stream_ptr() const { return m_out;}
|
ostream* stream_ptr() const { return m_out;}
|
||||||
const string& name() const { return m_name;}
|
const string& name() const { return m_name;}
|
||||||
Output_file& operator<<( char c) { OUT(c);}
|
Output_file& operator<<( char c) { OUT(c);}
|
||||||
|
|
|
||||||
|
|
@ -527,8 +527,8 @@ const int max_tag_size = 20;
|
||||||
char font_tag_buffer[max_tag_size];
|
char font_tag_buffer[max_tag_size];
|
||||||
|
|
||||||
const char* font_changing_tags( Font old_font, Font new_font) {
|
const char* font_changing_tags( Font old_font, Font new_font) {
|
||||||
assert( old_font > unknown_font && old_font < end_font_array);
|
CC_Assert( old_font > unknown_font && old_font < end_font_array);
|
||||||
assert( new_font > unknown_font && new_font < end_font_array);
|
CC_Assert( new_font > unknown_font && new_font < end_font_array);
|
||||||
if ( old_font == new_font)
|
if ( old_font == new_font)
|
||||||
*font_tag_buffer = '\0';
|
*font_tag_buffer = '\0';
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue