Major extensions for the HTML support.

This commit is contained in:
Lutz Kettner 1997-05-08 00:49:11 +00:00
parent c7c5db9b84
commit ed69838c0e
10 changed files with 1397 additions and 321 deletions

View File

@ -21,6 +21,18 @@
// Substitute old style malloc, realloc, strdup ...
// ================================================
char* renew( char* old, size_t old_size, size_t new_size) {
ADT_Assert( old);
ADT_Assert( new_size > old_size);
char* cpy = new char[ new_size];
if ( old && old_size > 0) {
size_t min = ( old_size < new_size ? old_size : new_size);
memcpy( cpy, old, min);
delete[] old;
}
return cpy;
}
char* newstr( const char* src) {
ADT_Assert( src);
if ( ! src)

View File

@ -25,6 +25,7 @@
#define LK_RestrictedOverloading 0
#include <ADT/list.h>
#include <string.h>
#include <ctype.h>
// Class declarations:
// ==============================================
@ -40,23 +41,8 @@ class TextToken;
// Substitute old style malloc, realloc, strdup ...
// ================================================
template < class T, class I>
T* renew( T* old, I old_size, I new_size);
template < class T, class I>
T* renew( T* old, I old_size, I new_size) {
ADT_Assert( old);
ADT_Assert( strlen( old) == size_t(old_size - 1));
ADT_Assert( new_size > old_size);
T* cpy = new T[ size_t(new_size)];
if ( old && old_size > 0) {
size_t min = ( old_size < new_size ? old_size : new_size);
memcpy( cpy, old, min * sizeof( T));
delete[] old;
}
return cpy;
}
char* renew( char* old, size_t old_size, size_t new_size);
char* newstr( const char* src);
@ -235,6 +221,10 @@ public:
len = 0;
*data = '\0';
}
void capitalize() {
for ( int i = 0; i < len; i++)
data[i] = toupper( data[i]);
}
};
class TextToken : public ListLink{

View File

@ -747,6 +747,7 @@ void handleClass( const char* classname) {
void handleClassEnd( void) {
if ( global_classname)
free( global_classname);
global_classname = NULL;
return;
}
@ -821,6 +822,7 @@ void handleClassTemplateEnd( void) {
global_template_params = 0;
if ( global_classname)
free( global_classname);
global_classname = NULL;
return;
}

View File

@ -86,6 +86,7 @@ void handleClass( const char* classname) {
void handleClassEnd( void) {
if ( global_classname)
free( global_classname);
global_classname = NULL;
cout << outdent;
cout << indNewline;
cout << "};" << indNewline;
@ -149,6 +150,7 @@ void handleClassTemplateEnd( void) {
global_template_params = 0;
if ( global_classname)
free( global_classname);
global_classname = 0;
cout << outdent;
cout << indNewline;
cout << "};" << indNewline;

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,14 @@ set DEFAULT_DATE = `date +"%a, %B %e, %Y"`
set DEFAULT_AUTHOR = "The <A HREF="http://www.cs.ruu.nl/CGAL/"><TT>CGAL</TT> Project</A>"
set DEFAULT_TITLE = "The CGAL Kernel Manual"
# The header files within the \ccInclude macro can be linked to the original
# header files if the -cgal_dir option is given to the cc_extract_html program.
# The environment variable CGAL_INCL_DIR is used as default. If it is not
# set, the default setting is empty and include files are not linked.
set cgal_dir = ""
if ($?CGAL_INCL_DIR) set cgal_dir = "-cgal_dir ${CGAL_INCL_DIR}/"
# =======================================================
# Installation: Nothing else below this line.
# =======================================================
@ -60,13 +68,17 @@ if ($?TMP) then
if (-d ${TMP}) set tmp_path = $TMP
endif
set aux_file = ""
set bbl_file = ""
set out_path = "."
set config_path = ${HTML_DEFAULT_PATH}
set DEFAULT_RELEASE =
set default_switch = 0
set default_switch = 0
set show_main_switch = 0
set extended_switch = 0
# Parse command line parameters
# -----------------------------
@ -85,6 +97,12 @@ while ($#argv > 0)
break
endif
if ( "$1" == "-extended") then
set extended_switch = 1
shift
continue
endif
if ( "$1" == "-show_main") then
set show_main_switch = 1;
shift
@ -132,6 +150,20 @@ while ($#argv > 0)
shift
continue
endif
if ( "$1" == "-cgal_dir") then
shift
if ( $#argv < 1) then
echo "error: switch -cgal_dir needs an additional parameter."
goto usage
endif
if ( ! -d $1) then
echo "error: switch -cgal_dir needs a valid directory as parameter."
goto usage
endif
set cgal_dir = "-cgal_dir $1"
shift
continue
endif
if ( "$1" == "-date") then
shift
if ( $#argv < 1) then
@ -173,6 +205,29 @@ while ($#argv > 0)
continue
endif
if ( "$1" == "-aux") then
shift
if ( $#argv < 1 || ! -r $1) then
echo "error: switch -aux needs a filename as additional parameter."
goto usage
endif
set aux_file = "${tmp_path}/aux_tmp_file.`date +%M%S`.tex"
grep "\\bibcite[{]" $1 > $aux_file
shift
continue
endif
if ( "$1" == "-bbl") then
shift
if ( $#argv < 1 || ! -r $1) then
echo "error: switch -bbl needs a filename as additional parameter."
goto usage
endif
set bbl_file = "$1"
shift
continue
endif
set in_files = "$in_files $1"
shift
end
@ -186,8 +241,11 @@ if ( $?DEBUG || $default_switch == 1) then
echo " DEFAULT_RELEASE = ${DEFAULT_RELEASE}"
echo " tmp_path = ${tmp_path}"
echo " out_path = ${out_path}"
echo " cgal_dir = ${cgal_dir}"
echo " config_path = ${config_path}"
echo " input_files = ${in_files}"
echo " aux_file = ${aux_file}"
echo " bbl_file = ${bbl_file}"
echo ""
endif
if ( $default_switch) goto end_of_script
@ -208,15 +266,19 @@ endif
mkdir ${new_tmp_path}
if ( $extended_switch) goto extended_conversion
# Step 1: convert each LaTeX file into an HTML file.
# --------------------------------------------------
set options = "${cgal_dir} -config ${config_path}/ -tmp ${new_tmp_path}/ ${aux_file} ${bbl_file}"
if ( $?DEBUG) echo "# Step 1: convert each LaTeX file into an HTML file."
if ($show_main_switch) then
if ( $?DEBUG) echo "cc_extract_html -date "'"'"${DEFAULT_DATE}"'"'" -release "'"'"${DEFAULT_RELEASE}"'"'" -title "'"'"${DEFAULT_TITLE}"'"'" -author "'"'"${DEFAULT_AUTHOR}"'"'" -config ${config_path}/ -tmp ${new_tmp_path}/ ${in_files}"
cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" -config ${config_path}/ -tmp ${new_tmp_path}/ ${in_files}
if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} ${in_files}"
cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} ${in_files}
else
if ( $?DEBUG) echo "cc_extract_html -date "'"'"${DEFAULT_DATE}"'"'" -release "'"'"${DEFAULT_RELEASE}"'"'" -title "'"'"${DEFAULT_TITLE}"'"'" -author "'"'"${DEFAULT_AUTHOR}"'"'" -config ${config_path}/ -tmp ${new_tmp_path}/ ${in_files} >/dev/null"
cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" -config ${config_path}/ -tmp ${new_tmp_path}/ ${in_files} >/dev/null
if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} ${in_files} >/dev/null"
cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} ${in_files} >/dev/null
endif
# Step 2: generate the hyperlinks. The anchor filter.
@ -254,16 +316,16 @@ cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/cc_index_sorted ${new_tmp_pa
if ( $?DEBUG) echo "${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/cc_index > ${out_path}/manual_index.html"
${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/cc_index > ${out_path}/manual_index.html
conversion_done:
# Copy the images for the advanced section to the manual.
# -------------------------------------------------------
if ( -r ${HTML_DEFAULT_PATH}/cc_advanced_begin.gif) then
cp ${HTML_DEFAULT_PATH}/cc_advanced_begin.gif ${out_path}
if ( $?DEBUG) echo "cp ${HTML_DEFAULT_PATH}/cc_advanced_begin.gif ${out_path}"
endif
if ( -r ${HTML_DEFAULT_PATH}/cc_advanced_end.gif) then
cp ${HTML_DEFAULT_PATH}/cc_advanced_end.gif ${out_path}
if ( $?DEBUG) echo "cp ${HTML_DEFAULT_PATH}/cc_advanced_end.gif ${out_path}"
endif
foreach f (${HTML_DEFAULT_PATH}/*.gif)
if ( -r $f ) then
cp $f ${out_path}
if ( $?DEBUG) echo "cp $f ${out_path}"
endif
end
# Cleanup
# -------
@ -277,18 +339,168 @@ endif
end_of_script:
exit
# Extended Conversion of multiple manual parts
# --------------------------------------------
extended_conversion:
# Step 0: create subdirectories.
# ------------------------------
if ( $?DEBUG) echo "# Step 0: create subdirectories."
foreach f ($in_files)
if ( $?DEBUG) echo "mkdir ${new_tmp_path}/$f:h"
mkdir ${new_tmp_path}/$f:h
if ( ! -d ${out_path}/$f:h) then
if ( $?DEBUG) echo "mkdir ${out_path}/$f:h"
mkdir ${out_path}/$f:h
endif
end
# Step 1: convert each LaTeX file into an HTML file.
# --------------------------------------------------
if ( $?DEBUG) echo "# Step 1: convert each LaTeX file into an HTML file."
foreach f ($in_files)
set options = "${cgal_dir} -config ${config_path}/ -tmp ${new_tmp_path}/$f:h/ -noheader"
if ( $?DEBUG) echo "cd $f:h"
cd $f:h
if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} $f:t >/dev/null"
cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} $f:t >/dev/null
if ( $?DEBUG) echo "cd .."
cd ..
end
# Step 2: generate the local hyperlinks. The anchor filter.
# ---------------------------------------------------------
if ( $?DEBUG) echo "# Step 2: generate the hyperlinks. The anchor filter"
foreach f ($in_files)
if ( $?DEBUG) echo "cat ${config_path}/cc_anchor_header ${new_tmp_path}/$f:h/cc_anchor_rules ${config_path}/cc_anchor_footer > ${new_tmp_path}/cc_anchor_filter.yy"
cat ${config_path}/cc_anchor_header ${new_tmp_path}/$f:h/cc_anchor_rules ${config_path}/cc_anchor_footer > ${new_tmp_path}/cc_anchor_filter.yy
if ( $?DEBUG) echo "flex -t -8 ${new_tmp_path}/cc_anchor_filter.yy > ${new_tmp_path}/cc_anchor_filter.c"
flex -t -8 ${new_tmp_path}/cc_anchor_filter.yy > ${new_tmp_path}/cc_anchor_filter.c
if ( $?DEBUG) echo "${CC} -o ${new_tmp_path}/cc_anchor_filter ${new_tmp_path}/cc_anchor_filter.c"
${CC} -o ${new_tmp_path}/cc_anchor_filter ${new_tmp_path}/cc_anchor_filter.c
if (-r cc_anchor_filter.o) rm cc_anchor_filter.o
# Filtering all HTML files locally.
# ---------------------------------
if ( $?DEBUG) echo "# Filtering all HTML files locally."
mv ${new_tmp_path}/$f:h/cc_index_body ${new_tmp_path}/$f:h/cc_index_body.bak
${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/$f:h/cc_index_body.bak > ${new_tmp_path}/$f:h/cc_index_body
rm ${new_tmp_path}/$f:h/cc_index_body.bak
foreach ff (${new_tmp_path}/$f:h/*.html)
mv $ff $ff.bak
${new_tmp_path}/cc_anchor_filter < $ff.bak > $ff
rm $ff.bak
end
setenv CC__LOC_F "$f:h/"
if ( $?DEBUG) echo "cc_patch_anchor_toc_index ${new_tmp_path}/$f:h/cc_index_body ${new_tmp_path}/$f:h/contents.html"
cc_patch_anchor_toc_index ${new_tmp_path}/$f:h/cc_index_body ${new_tmp_path}/$f:h/contents.html
setenv CC__LOC_F ../$f:h/
if ( $?DEBUG) echo "cc_patch_anchor_filter ${new_tmp_path}/$f:h/cc_anchor_rules"
cc_patch_anchor_filter ${new_tmp_path}/$f:h/cc_anchor_rules
end
# Step 3: convert bibliography (if any) and .aux file.
# -----------------------------------------------------------
if ( $?DEBUG) echo "# Step 3: convert bibliography (if any) and .aux file."
set options = "${cgal_dir} -config ${config_path}/ -tmp ${new_tmp_path}/ -noheader ${aux_file} ${bbl_file}"
touch ${new_tmp_path}/cc_index_body
if ( "${aux_file}" == "" && "${bbl_file}" == "") then
if ( $?DEBUG) echo "touch ${new_tmp_path}/cc_anchor_rules"
touch ${new_tmp_path}/cc_anchor_rules
else
if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} >/dev/null"
cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} >/dev/null
endif
# Step 4: generate the global hyperlinks. The anchor filter.
# -----------------------------------------------------------
if ( $?DEBUG) echo "# Step 4: generate the global hyperlinks. The anchor filter"
if ( $?DEBUG) echo "cat ${config_path}/cc_anchor_header ${new_tmp_path}/cc_anchor_rules > ${new_tmp_path}/cc_anchor_filter.yy"
cat ${config_path}/cc_anchor_header ${new_tmp_path}/cc_anchor_rules > ${new_tmp_path}/cc_anchor_filter.yy
foreach f ($in_files)
if ( $?DEBUG) echo "cat ${new_tmp_path}/$f:h/cc_anchor_rules >> ${new_tmp_path}/cc_anchor_filter.yy"
cat ${new_tmp_path}/$f:h/cc_anchor_rules >> ${new_tmp_path}/cc_anchor_filter.yy
end
if ( $?DEBUG) echo "cat ${config_path}/cc_anchor_footer >> ${new_tmp_path}/cc_anchor_filter.yy"
cat ${config_path}/cc_anchor_footer >> ${new_tmp_path}/cc_anchor_filter.yy
if ( $?DEBUG) echo "flex -t -8 ${new_tmp_path}/cc_anchor_filter.yy > ${new_tmp_path}/cc_anchor_filter.c"
flex -t -8 ${new_tmp_path}/cc_anchor_filter.yy > ${new_tmp_path}/cc_anchor_filter.c
if ( $?DEBUG) echo "${CC} -o ${new_tmp_path}/cc_anchor_filter ${new_tmp_path}/cc_anchor_filter.c"
${CC} -o ${new_tmp_path}/cc_anchor_filter ${new_tmp_path}/cc_anchor_filter.c
if (-r cc_anchor_filter.o) rm cc_anchor_filter.o
foreach f ($in_files)
# Filtering all HTML files globally.
# ----------------------------------
if ( $?DEBUG) echo "# Filtering all HTML files globally."
foreach ff (${new_tmp_path}/$f:h/*.html)
${new_tmp_path}/cc_anchor_filter < $ff > ${out_path}/$f:h/$ff:t
cc_patch_anchor_pages ${out_path}/$f:h/$ff:t
end
rm ${out_path}/$f:h/contents.html
end
# Converting the index, table of contents, and the bibliography.
# --------------------------------------------------------------
if ( $?DEBUG) echo "${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/biblio.html > ${out_path}/biblio.html"
${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/biblio.html > ${out_path}/biblio.html
if ( $?DEBUG) echo "# Converting the index."
mv ${new_tmp_path}/cc_index_body ${new_tmp_path}/cc_index_body.bak
set options = "${cgal_dir} -config ${config_path}/ -tmp ${new_tmp_path}/ -onlyheader cc_toc_footer cc_toc_header cc_index_footer cc_index_header"
if ( $?DEBUG) echo "cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} >/dev/null"
cc_extract_html -date "${DEFAULT_DATE}" -release "${DEFAULT_RELEASE}" -title "${DEFAULT_TITLE}" -author "${DEFAULT_AUTHOR}" ${options} >/dev/null
if ( $?DEBUG) echo "cat ${new_tmp_path}/cc_toc_header > ${new_tmp_path}/contents.html"
cat ${new_tmp_path}/cc_toc_header > ${new_tmp_path}/contents.html
cat ${new_tmp_path}/cc_index_body.bak >> ${new_tmp_path}/cc_index_body
foreach f ($in_files)
if ( $?DEBUG) echo "cat ${new_tmp_path}/$f:h/cc_index_body >> ${new_tmp_path}/cc_index_body"
cat ${new_tmp_path}/$f:h/cc_index_body >> ${new_tmp_path}/cc_index_body
if ( $?DEBUG) echo "cat ${new_tmp_path}/$f:h/contents.html >> ${new_tmp_path}/contents.html"
cat ${new_tmp_path}/$f:h/contents.html >> ${new_tmp_path}/contents.html
end
if ( $?DEBUG) echo "cat ${new_tmp_path}/cc_toc_footer >> ${new_tmp_path}/contents.html"
cat ${new_tmp_path}/cc_toc_footer >> ${new_tmp_path}/contents.html
if ( $?DEBUG) echo "cc_index_sort -ger ${new_tmp_path}/cc_index_body | sed 's/[<][\!]sort[^\!]*[\!][>]//' > ${new_tmp_path}/cc_index_sorted"
cc_index_sort -ger ${new_tmp_path}/cc_index_body | sed 's/[<][\!]sort[^\!]*[\!][>]//' > ${new_tmp_path}/cc_index_sorted
if ( $?DEBUG) echo "cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/cc_index_sorted ${new_tmp_path}/cc_index_footer > ${new_tmp_path}/cc_index"
cat ${new_tmp_path}/cc_index_header ${new_tmp_path}/cc_index_sorted ${new_tmp_path}/cc_index_footer > ${new_tmp_path}/cc_index
if ( $?DEBUG) echo "${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/cc_index > ${out_path}/manual_index.html"
${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/cc_index > ${out_path}/manual_index.html
if ( $?DEBUG) echo "${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/contents.html > ${out_path}/contents.html"
${new_tmp_path}/cc_anchor_filter < ${new_tmp_path}/contents.html > ${out_path}/contents.html
goto conversion_done
usage:
echo "$0 "'$Revision$'" (c) Lutz Kettner"
echo "Usage: $0 [<options>] <tex-files...>"
echo " -defaults show the settings of the internal variables."
echo " -show_main show the translation result for the main file."
echo " -date <text> set a date for the manual."
echo " -release <text> set a release number for the manual."
echo " -title <text> set a title text for the manual."
echo " -author <text> set an author address (email) for the manual."
echo " -config <dir> set the path where to find the config files."
echo " -tmp <dir> set the path where to put intermediate files."
echo " "
echo " -o <dir> output directory for the generated HTML manual"
echo " -defaults show the settings of the internal variables."
echo " -extended extended organization among multiple dir's."
echo " -show_main show the translation result for the main file."
echo " -date <text> set a date for the manual."
echo " -release <text> set a release number for the manual."
echo " -title <text> set a title text for the manual."
echo " -author <text> set an author address (email) for the manual."
echo " -config <dir> set the path where to find the config files."
echo " -tmp <dir> set the path where to put intermediate files."
echo " -cgal_dir <dir> set the path where the CGAL headers are."
echo " -o <dir> output directory for the generated HTML manual"
echo " -aux <file> auxiliary file where the \\bibcite's are in."
echo " -bbl <file> bibliography file produced by bibtex."
exit (1)

View File

@ -46,6 +46,8 @@ char* global_template_params = 0;
#define YY_SKIP_YYWRAP 1
#define yywrap() 1
void skipspaces( void);
%}
/* The normal scanning mode parses TeX conventions. */
@ -281,7 +283,7 @@ blockintro [\{][\\]((tt)|(em)|(it)|(sc)|(sl))
yylval.string.len = strlen( global_classname);
} else {
printErrorMessage( ClassnameUsedError);
yylval.string.text = "Unknown classname";
yylval.string.text = "[Unknown classname]";
yylval.string.len = strlen( yylval.string.text);
}
return STRING;
@ -529,6 +531,44 @@ blockintro [\{][\\]((tt)|(em)|(it)|(sc)|(sl))
return ENDHTMLONLY;
}
/* Flexibility for HTML class files. */
/* -------------------------------------------------------------- */
<INITIAL,NestingMode>[\\]ccHtmlNoClassLinks/{noletter} {
skipspaces();
}
<INITIAL,NestingMode>[\\]ccHtmlNoClassFile/{noletter} {
skipspaces();
}
<INITIAL,NestingMode>[\\]ccHtmlNoClassIndex/{noletter} {
skipspaces();
}
[\\]begin{w}[\{]ccHtmlClassFile[\}]{w} {
return GOBBLETWOPARAMS;
}
[\\]end{w}[\{]ccHtmlClassFile[\}] {
skipspaces();
}
[\\]ccHtmlIndex/{noletter} {
skipspaces();
return GOBBLEONEPARAM;
}
[\\]ccHtmlIndex[\[][^\]][\]]/{noletter} {
skipspaces();
return GOBBLEONEPARAM;
}
[\\]ccHtmlIndexC/{noletter} {
skipspaces();
return GOBBLEONEPARAM;
}
[\\]ccHtmlIndexC[\[][^\]][\]]/{noletter} {
skipspaces();
return GOBBLEONEPARAM;
}
[\\]ccHtmlCrossLink/{noletter} {
skipspaces();
return GOBBLEONEPARAM;
}
/* make the $ delimiters for math mode disappear: */
/* -------------------------------------------------------------- */
[$] {}
@ -633,6 +673,13 @@ blockintro [\{][\\]((tt)|(em)|(it)|(sc)|(sl))
}
%%
void skipspaces( void) {
int c = yyinput();
while( c && c <= ' ')
c = yyinput();
unput( c);
}
void init_scanner( FILE* in){
line_number = 1;
set_CCMode = 0;

View File

@ -23,6 +23,61 @@ extern const char* prog_name;
extern char* current_filename;
extern char* cgal_lib_dir;
/* An object storing the current font */
/* ================================== */
/* It is only used within CCMode at the moment */
enum Font { unknown_font = -1,
rm_font,
tt_font,
bf_font,
it_font,
sl_font,
sc_font,
sf_font,
var_font,
math_font,
end_font_array};
extern Font current_font;
const char* font_changing_tags( Font old_font, Font new_font);
const char* new_font_tags( Font new_font);
const char* lazy_new_font_tags( Font new_font);
// Index sorting.
// ==============
// sort_keys are used to sort the index according to different sections.
// A sort_key is followed by a 0 to indicate the section title.
// A sort_key is followed by a 1 to indicate a normal entry.
extern const char* sort_key_class;
extern const char* sort_key_nested_type;
extern const char* sort_key_struct;
extern const char* sort_key_enum;
extern const char* sort_key_enum_tags;
extern const char* sort_key_typedef;
extern const char* sort_key_variable;
extern const char* sort_key_function;
extern const char* sort_key_member_function;
const char* find_sort_key( const char* txt);
/* Flexibility for HTML class files. */
/* ================================= */
extern bool html_no_class_links;
extern bool html_no_class_file;
extern bool html_no_class_index;
extern bool html_inline_classes;
void handleHtmlClassFile( const char* filename, const Text& T);
void handleHtmlClassFileEnd();
const char* handleHtmlIndexC( const char* category, const char* item);
const char* handleHtmlIndex( const char* category, const char* item);
const char* handleHtmlCrossLink( const char* key, bool tmpl_class = false);
/* Functions to manage footnotes. */
/* ============================== */
void insertFootnote( char* s);
@ -86,7 +141,9 @@ void handleString( const char* s);
void handleChar( char c);
void handleBiblio( const Text& T);
Buffer* handleCite( const char* l);
Buffer* handleCite( const char* cite_keys, const char* option = 0);
// Defines a mapping between cite keys and the visible item for a cite.
Buffer* handleBibCite( const char* key, const char* item);
// for an empty item name use the key name as item name
Buffer* handleBibItem( const char* key_name, const char* item_name = 0);
@ -95,6 +152,9 @@ void handleClassEnd( void);
void handleClassTemplate( const char* classname);
void handleClassTemplateEnd( void);
void handleClassNameEnd( void);
void handleClassFileEnd( void);
void handleDeclaration( const char* decl);
void handleMethodDeclaration( const char* decl,
@ -134,7 +194,8 @@ enum ErrorNumber {
SemicolonMissingError,
IncludeNestingTooDeepError,
IncludeOpenError,
ChapterStructureError
ChapterStructureError,
UnknownIndexCategoryError
};

View File

@ -46,6 +46,15 @@ int set_INITIAL = 0;
int set_HTMLMODE = 0;
int set_MMODE = 0;
/* Store an old state like MMODE before treating macros like ccAnchor */
/* Some constants for this purpose. */
const int state_INITIAL = 0;
const int state_MMODE = 1;
const int state_NestingMode = 2;
int set_old_state = 0;
int old_state = state_INITIAL;
/* Tag to mark whenever the unchecked keyword occurs. */
int unchecked_tag = 0;
@ -103,7 +112,9 @@ int stack_ptr = 0;
/* The NestingMode parses only (){}[] nested expressions */
/* The VerbMode parses LaTeX \verb"..." statements as */
/* a sequence of characters */
/* ccStyleMode parses only ccStyle expressions. */
%x CCMode
%x ccStyleMode
%x NestingMode
%x VerbMode
%x CPROGMode
@ -121,7 +132,7 @@ CCletter [a-zA-Z_]
idfier {letter}+
texmacro [\\]{idfier}
CCidfier ({CCletter}({CCletter}|{digit})*)
filename [^ \t\n/\\\{\}\[\]()]+
filename [^ \t\n\\\{\}\[\]()]+
space [\t ]
w {space}*
ws {space}+
@ -135,11 +146,14 @@ expNumber ({floatNumber}|{signNumber}){exp}{signNumber}
No ({signNumber}|{floatNumber}|{expNumber})
operator [^a-zA-Z_0-9\n\r\t \\]
measure {signNumber}{letter}{letter}
ttblockintro [\{][\\](tt)
emblockintro [\{][\\](em)
itblockintro [\{][\\]((it)|(sl))
scblockintro [\{][\\](sc)
bfblockintro [\{][\\](bf)
rmblockintro ([\{][\\](rm))|([\\]((text)|(math))rm[\{])
ttblockintro ([\{][\\](tt))|([\\]((text)|(math))tt[\{])
emblockintro ([\{][\\](em))|([\\]emph[\{])
itblockintro ([\{][\\]((it)|(sl)))|([\\]((text)|(math))((it)|(sl))[\{])
scblockintro ([\{][\\](sc))|([\\]textsc[\{])
sfblockintro ([\{][\\](sf))|([\\]((text)|(math))sf[\{])
bfblockintro ([\{][\\]((bf)|(mathbold)))|([\\]((text)|(math))bf[\{])
calblockintro ([\{][\\](cal))|([\\]mathcal[\{])
%%
/* Mode switching can be triggered from the parser */
@ -164,16 +178,30 @@ bfblockintro [\{][\\](bf)
BEGIN( MMODE);
set_MMODE = 0;
}
if (set_old_state) {
switch ( old_state) {
case state_INITIAL:
BEGIN( INITIAL);
break;
case state_MMODE:
BEGIN( MMODE);
break;
case state_NestingMode:
BEGIN( NestingMode);
break;
}
set_old_state = 0;
}
/* Count line numbers in all modes for better error messages */
/* --------------------------------------------------------- */
<INITIAL,CCMode,NestingMode,CPROGMode,MMODE,ITEMMODE,TEXONLYMODE,HTMLMODE,HTMLGROUPMode>[\n] {
<INITIAL,CCMode,NestingMode,ccStyleMode,CPROGMode,MMODE,ITEMMODE,TEXONLYMODE,HTMLMODE,HTMLGROUPMode>[\n] {
line_number++;
if ( line_switch)
cerr << "src-line " << line_number << endl;
return NEWLINE;
}
<INITIAL,MMODE,NestingMode>[\\]"\n" {
<INITIAL,MMODE,NestingMode,ccStyleMode>[\\]"\n" {
line_number++;
if ( line_switch)
cerr << "src-line " << line_number << endl;
@ -254,11 +282,11 @@ bfblockintro [\{][\\](bf)
/* Rules for TeX conventions */
/* ------------------------- */
<INITIAL,MMODE>[\\]"%" { /* Avoid the quoted comment symbol */
<INITIAL,MMODE>[\\]"%" { /* Avoid the quoted comment symbol */
yylval.character = '%';
return CHAR;
}
<INITIAL,MMODE>"%".*[\n]{w} { /* Match one line TeX comments */
<INITIAL,MMODE>"%".*[\n]{w} { /* Match one line TeX comments */
/* remove spaces in next line */
unput( '\n');
}
@ -326,6 +354,7 @@ bfblockintro [\{][\\](bf)
/* ------------------------------------------------------------------ */
[\\]begin{w}[\{]ccClass[\}]{w} {
BEGIN( CCMode);
current_font = it_font;
return BEGINCLASS;
}
[\\]end{w}[\{]ccClass[\}] {
@ -333,6 +362,7 @@ bfblockintro [\{][\\](bf)
}
[\\]begin{w}[\{]ccClassTemplate[\}]{w} {
BEGIN( CCMode);
current_font = it_font;
return BEGINCLASSTEMPLATE;
}
[\\]end{w}[\{]ccClassTemplate[\}] {
@ -355,98 +385,115 @@ bfblockintro [\{][\\](bf)
delete[] formatted_creationvariable;
creationvariable = newstr( r);
formatted_creationvariable = new char[ strlen(
creationvariable) + 12];
strcpy( formatted_creationvariable, "<VAR>");
creationvariable) + 8];
strcpy( formatted_creationvariable, "<I>");
strcat( formatted_creationvariable, creationvariable);
strcat( formatted_creationvariable, "</VAR>");
strcat( formatted_creationvariable, "</I>");
yylval.string.text = r;
yylval.string.len = s - r + 1;
return CREATIONVARIABLE;
}
[\\]ccConstructor/{noletter} { /* constructor declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return CONSTRUCTOR;
}
[\\]ccMemberFunction/{noletter} { /* method declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return METHOD;
}
[\\]ccMethod/{noletter} { /* method declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return METHOD;
}
[\\]ccFunction/{noletter} { /* function declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return FUNCTION;
}
[\\]ccFunctionTemplate/{noletter} { /* function template declaration:
change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return FUNCTIONTEMPLATE;
}
[\\]ccVariable/{noletter} { /* variable declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return VARIABLE;
}
[\\]ccTypedef/{noletter} { /* typedef declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return TYPEDEF;
}
[\\]ccNestedType/{noletter} { /* nested type declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return NESTEDTYPE;
}
[\\]ccEnum/{noletter} { /* enum declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return ENUM;
}
[\\]ccStruct/{noletter} { /* struct declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return STRUCT;
}
[\\]ccGlobalFunction/{noletter} { /* function declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return GLOBALFUNCTION;
}
[\\]ccGlobalFunctionTemplate/{noletter} { /* function template declaration:
change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return GLOBALFUNCTIONTEMPLATE;
}
[\\]ccGlobalVariable/{noletter} { /* variable declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return GLOBALVARIABLE;
}
[\\]ccGlobalTypedef/{noletter} { /* typedef declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return GLOBALTYPEDEF;
}
[\\]ccGlobalEnum/{noletter} { /* enum declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return GLOBALENUM;
}
[\\]ccGlobalStruct/{noletter} { /* struct declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return GLOBALSTRUCT;
}
[\\]ccDeclaration/{noletter} { /* general declaration: change to CCMode */
skipspaces();
current_font = it_font;
BEGIN( CCMode);
return DECLARATION;
}
@ -480,20 +527,42 @@ bfblockintro [\{][\\](bf)
}
[\\]"begin{ccHtmlOnly}" {
old_state = state_INITIAL;
BEGIN( HTMLGROUPMode);
return HTMLBEGIN;
}
<MMODE>[\\]"begin{ccHtmlOnly}" {
old_state = state_MMODE;
BEGIN( HTMLGROUPMode);
return HTMLBEGIN;
}
<NestingMode>[\\]"begin{ccHtmlOnly}" {
old_state = state_NestingMode;
BEGIN( HTMLGROUPMode);
return HTMLBEGIN;
}
<HTMLGROUPMode>[\\]"end{ccHtmlOnly}" {
BEGIN( INITIAL);
set_old_state = 1;
return HTMLEND;
}
[\\]"begin{ccTexOnly}" {
old_state = state_INITIAL;
BEGIN( TEXONLYMODE);
return TEXONLYBEGIN;
}
<MMODE>[\\]"begin{ccTexOnly}" {
old_state = state_MMODE;
BEGIN( TEXONLYMODE);
return TEXONLYBEGIN;
}
<NestingMode>[\\]"begin{ccTexOnly}" {
old_state = state_NestingMode;
BEGIN( TEXONLYMODE);
return TEXONLYBEGIN;
}
<TEXONLYMODE>[\\]"end{ccTexOnly}" {
BEGIN( INITIAL);
set_old_state = 1;
return TEXONLYEND;
}
<TEXONLYMODE>. {
@ -501,29 +570,105 @@ bfblockintro [\{][\\](bf)
return CHAR;
}
[\\]ccTexHtml{w}[\{] {
old_state = state_INITIAL;
return LATEXHTML;
}
<MMODE>[\\]ccTexHtml{w}[\{] {
old_state = state_MMODE;
return LATEXHTML;
}
<NestingMode>[\\]ccTexHtml{w}[\{] {
old_state = state_NestingMode;
return LATEXHTML;
}
[\\]ccAnchor{w}[\{] {
/* The first parameter is the URL, the second is the */
/* message that will be highlighted */
old_state = state_INITIAL;
BEGIN( HTMLMODE);
return ANCHOR;
}
<MMODE>[\\]ccAnchor{w}[\{] {
old_state = state_MMODE;
BEGIN( HTMLMODE);
return ANCHOR;
}
<NestingMode>[\\]ccAnchor{w}[\{] {
old_state = state_NestingMode;
BEGIN( HTMLMODE);
return ANCHOR;
}
<HTMLMODE>[\}] {
BEGIN( INITIAL);
set_old_state = 1;
return '}';
}
<HTMLMODE,HTMLGROUPMode>. {
yylval.character = yytext[0];
return CHAR;
}
<INITIAL,MMODE,NestingMode>[\\]path[|][^|]*[|] {
yylval.string.text = yytext + 6;
yylval.string.len = -1;
return HTMLPATH;
}
/* Flexibility for HTML class files. */
/* -------------------------------------------------------------- */
<INITIAL,MMODE,NestingMode>[\\]ccHtmlNoClassLinks/{noletter} {
skipspaces();
html_no_class_links = true;
}
<INITIAL,MMODE,NestingMode>[\\]ccHtmlNoClassFile/{noletter} {
skipspaces();
html_no_class_file = true;
}
<INITIAL,MMODE,NestingMode>[\\]ccHtmlNoClassIndex/{noletter} {
skipspaces();
html_no_class_index = true;
}
[\\]begin{w}[\{]ccHtmlClassFile[\}]{w} {
BEGIN( CCMode);
return HTMLBEGINCLASSFILE;
}
[\\]end{w}[\{]ccHtmlClassFile[\}] {
skipspaces();
return HTMLENDCLASSFILE;
}
[\\]ccHtmlIndex/{noletter} {
skipspaces();
yylval.string.text = sort_key_class;
return HTMLINDEX;
}
[\\]ccHtmlIndex[\[][^\]][\]]/{noletter} {
skipspaces();
yylval.string.text = find_sort_key( yytext + 13);
return HTMLINDEX;
}
[\\]ccHtmlIndexC/{noletter} {
skipspaces();
yylval.string.text = sort_key_class;
BEGIN( CCMode);
return HTMLINDEXC;
}
[\\]ccHtmlIndexC[\[][^\]][\]]/{noletter} {
skipspaces();
yylval.string.text = find_sort_key( yytext + 14);
BEGIN( CCMode);
return HTMLINDEXC;
}
[\\]ccHtmlCrossLink/{noletter} {
skipspaces();
BEGIN( CCMode);
return HTMLCROSSLINK;
}
/* Specialized keywords from the manual style */
/* -------------------------------------------------------------- */
[\\]cc((Style)|(c))/{noletter} {
/* CCstyle formatting: change to NestingMode */
/* CCstyle formatting: change to ccStyleMode */
skipspaces();
BEGIN( NestingMode);
BEGIN( ccStyleMode);
current_font = it_font;
return CCSTYLE;
}
<INITIAL,MMODE,NestingMode>[\\]ccVar/{noletter} {
@ -772,21 +917,22 @@ bfblockintro [\{][\\](bf)
}
[\\]begin[\{]ccAdvanced[\}] {
skipspaces();
yylval.string.text = "<br><img border=0 src=\""
"./cc_advanced_begin.gif\" alt=\"begin of advanced "
"section\"><br>";
yylval.string.text = "<BR><IMG BORDER=0 SRC=\""
"cc_advanced_begin.gif\" ALT=\"begin of advanced "
"section\"><BR>";
yylval.string.len = -1;
return STRING;
}
[\\]end[\{]ccAdvanced[\}] {
skipspaces();
yylval.string.text = "<br><img border=0 src=\""
"./cc_advanced_end.gif\" alt=\"end of advanced "
"section\"><br>";
yylval.string.text = "<BR><IMG BORDER=0 SRC=\""
"cc_advanced_end.gif\" ALT=\"end of advanced "
"section\"><BR>";
yylval.string.len = -1;
return STRING;
}
[\\]ccInclude/{noletter} {
current_font = it_font;
return INCLUDE;
}
[\\]ccHeading/{noletter} {
@ -964,7 +1110,7 @@ bfblockintro [\{][\\](bf)
yylval.string.len = 3;
return STRING;
}
<INITIAL,MMODE,NestingMode>[\\]ldots/{noletter} {
<INITIAL,MMODE,NestingMode,ccStyleMode>[\\](l?)dots/{noletter} {
skipspaces();
yylval.string.text = "...";
yylval.string.len = 3;
@ -991,17 +1137,17 @@ bfblockintro [\{][\\](bf)
[\\]((big)|(med))skip/{noletter} {
return NEWLINE;
}
<INITIAL,MMODE,NestingMode>[\\]"&" {
<INITIAL,MMODE,NestingMode,ccStyleMode>[\\]"&" {
yylval.string.text = "&amp;";
yylval.string.len = 5;
return STRING;
}
<INITIAL,MMODE,NestingMode>[\\][_^#$~%] {
<INITIAL,MMODE,NestingMode,ccStyleMode>[\\][_^#$~%] {
yylval.character = yytext[1];
return CHAR;
}
<INITIAL,MMODE,NestingMode>[~] |
<INITIAL,MMODE,NestingMode>[\\]{space} {
<INITIAL,MMODE,NestingMode,ccStyleMode>[\\]{space} {
yylval.string.text = " ";
yylval.string.len = 1;
return SPACE;
@ -1057,7 +1203,6 @@ bfblockintro [\{][\\](bf)
}
/* yet not supported characters ...
<MMODE>[\\]times/{noletter} { SET( "&times;"); return STRING;}
<MMODE>[\\]delta/{noletter} { SET( "&delta;"); return STRING;}
<MMODE>[\\]epsilon/{noletter} { SET( "&epsi;"); return STRING;}
<MMODE>[\\]varepsilon/{noletter} { SET( "&epsi;"); return STRING;}
@ -1079,7 +1224,8 @@ bfblockintro [\{][\\](bf)
<INITIAL,NestingMode>[\\]"^"a { SET( "&acirc;"); return STRING;}
<INITIAL,NestingMode>[\\]"^"e { SET( "&ecirc;"); return STRING;}
<INITIAL,NestingMode>[\\]ss[\{][\}] { SET( "&szlig;"); return STRING;}
<MMODE>[\\]times/{noletter} { SET( "x"); return STRING;}
<MMODE>[\\]times/{noletter} { SET( "&times;"); return STRING;}
<MMODE>[\\]in/{noletter} { SET( " is in "); return STRING;}
<MMODE>[\\]alpha/{noletter} { SET( "&alpha;"); return STRING;}
<MMODE>[\\]beta/{noletter} { SET( "&beta;"); return STRING;}
<MMODE>[\\]gamma/{noletter} { SET( "&gamma;"); return STRING;}
@ -1121,6 +1267,34 @@ bfblockintro [\{][\\](bf)
<MMODE>[\\]Psi/{noletter} { SET( "&Psi;"); return STRING;}
<MMODE>[\\]Omega/{noletter} { SET( "&Omega;"); return STRING;}
/* math symbols */
/* ------------ */
<MMODE>[\\]((arc)?)|((tan)|(sin)|(cos))/{noletter} {
yylval.string.text = yytext+1;
yylval.string.len = yyleng-1;
return STRING;
}
<MMODE>[\\]((arg)|(cosh)|(sinh)|(cot)|(coth)|(csc)|(deg)|(det))/{noletter} {
yylval.string.text = yytext+1;
yylval.string.len = yyleng-1;
return STRING;
}
<MMODE>[\\]((dim)|(exp)|(gcd)|(hom)|(inf)|(ker)|(lg)|(lim))/{noletter} {
yylval.string.text = yytext+1;
yylval.string.len = yyleng-1;
return STRING;
}
<MMODE>[\\]((liminf)|(limsup)|(ln)|(log)|(max)|(min)|(Pr)|(sec))/{noletter} {
yylval.string.text = yytext+1;
yylval.string.len = yyleng-1;
return STRING;
}
<MMODE>[\\]((sinh)|(sup)|(tanh)|(bmod)|(pmod))/{noletter} {
yylval.string.text = yytext+1;
yylval.string.len = yyleng-1;
return STRING;
}
/* keywords from TeX/LaTeX that should vanish in HTML */
/* -------------------------------------------------------------- */
@ -1173,7 +1347,7 @@ bfblockintro [\{][\\](bf)
BEGIN( INITIAL);
return MBOX;
}
<INITIAL,MMODE,NestingMode>[\\][,;:!] {}
<INITIAL,MMODE,NestingMode,ccStyleMode>[\\][,;:!] {}
@ -1199,11 +1373,14 @@ bfblockintro [\{][\\](bf)
return ENDBIBLIO;
}
[\\]newblock/{noletter} {}
[\\]cite{w}([\[][^\]]*[\]])?[\{][^\}]*[\}] {
yylval.string.text = yytext;
yylval.string.len = yyleng;
[\\]cite{w}/{noletter} {
BEGIN( NestingMode);
return CITE;
}
[\\]bibcite{w}/{noletter} {
BEGIN( NestingMode);
return BIBCITE;
}
[\\]bibitem{w}/{noletter} {
BEGIN( NestingMode);
return BIBITEM;
@ -1212,11 +1389,11 @@ bfblockintro [\{][\\](bf)
/* Grouping symbols */
/* ---------------- */
<INITIAL,MMODE,NestingMode>[\\][\{] {
<INITIAL,MMODE,NestingMode,ccStyleMode>[\\][\{] {
yylval.character = '{';
return CHAR;
}
<INITIAL,MMODE,NestingMode>[\\][\}] {
<INITIAL,MMODE,NestingMode,ccStyleMode>[\\][\}] {
yylval.character = '}';
return CHAR;
}
@ -1228,20 +1405,43 @@ bfblockintro [\{][\\](bf)
yylval.character = yytext[6];
return CHAR;
}
<INITIAL,CCMode,NestingMode>[\{] {
<INITIAL,CCMode,NestingMode,ccStyleMode>[\{] {
return '{';
}
<INITIAL,CCMode,NestingMode>[\}] {
<INITIAL,CCMode,NestingMode,ccStyleMode>[\}] {
return '}';
}
{ttblockintro} { /* A couple of TeX styles like {\tt ... */
<INITIAL,MMODE,NestingMode>{ttblockintro} { /* TeX styles like {\tt ... */
return TTBLOCKINTRO;
}
{emblockintro} { return EMBLOCKINTRO; }
{itblockintro} { return ITBLOCKINTRO; }
{scblockintro} { return SCBLOCKINTRO; }
{bfblockintro} { return BFBLOCKINTRO; }
<INITIAL,MMODE,NestingMode>{emblockintro} { return EMBLOCKINTRO; }
<INITIAL,MMODE,NestingMode>{itblockintro} { return ITBLOCKINTRO; }
<INITIAL,MMODE,NestingMode>{scblockintro} { return SCBLOCKINTRO; }
<INITIAL,MMODE,NestingMode>{bfblockintro} { return BFBLOCKINTRO; }
<INITIAL,MMODE,NestingMode>{rmblockintro} { return RMBLOCKINTRO; }
<INITIAL,MMODE,NestingMode>{sfblockintro} { return SFBLOCKINTRO; }
<INITIAL,MMODE,NestingMode>{calblockintro} { return CALBLOCKINTRO; }
<CCMode,ccStyleMode>[\\]tt/{noletter} {
skipspaces();
yylval.string.text = "\\T\\";
yylval.string.len = -1;
return STRING;
}
<CCMode,ccStyleMode>[\\]ccFont/{noletter} {
skipspaces();
yylval.string.text = "\\I\\";
yylval.string.len = -1;
return STRING;
}
<CCMode,ccStyleMode>[\\](l?)dots/{noletter} {
skipspaces();
yylval.string.text = "...";
yylval.string.len = 3;
return STRING;
}
<CCMode,ccStyleMode>[\\]ccEndFont/{noletter} {}
<NestingMode>[\[] {
return '[';
@ -1257,6 +1457,19 @@ bfblockintro [\{][\\](bf)
return ')';
}
<INITIAL,MMODE,NestingMode>"---" {
skipspaces();
yylval.string.text = " - ";
yylval.string.len = 3;
return STRING;
}
<INITIAL,MMODE,NestingMode>"--" {
yylval.string.text = "-";
yylval.string.len = 1;
return STRING;
}
/* TeX macros */
/* -------------------------------------- */
<INITIAL,MMODE,NestingMode>[\\]((ref)|(ccTrue)|(ccFalse)|(kill)|(parskip)|(parindent))/{noletter} { // copy without warning
@ -1264,7 +1477,7 @@ bfblockintro [\{][\\](bf)
yylval.string.len = -1;
return STRING;
}
<INITIAL,MMODE,NestingMode>{texmacro} {
<INITIAL,MMODE,NestingMode,ccStyleMode>{texmacro} {
if (actual_defining) {
yylval.string.text = yytext;
} else {
@ -1298,7 +1511,7 @@ bfblockintro [\{][\\](bf)
}
return SPACE;
}
<CCMode,NestingMode>{ws} {
<CCMode,NestingMode,ccStyleMode>{ws} {
yylval.string.text = yytext;
yylval.string.len = yyleng;
return SPACE;
@ -1307,7 +1520,7 @@ bfblockintro [\{][\\](bf)
yylval.character = yytext[0];
return CHAR;
}
<INITIAL,NestingMode>[\\][/] {}
<INITIAL,NestingMode,ccStyleMode>[\\][/] {}
<INITIAL,MMODE,NestingMode>[&] {
if ( tab_tag) {
yylval.string.text =
@ -1320,7 +1533,7 @@ bfblockintro [\{][\\](bf)
return STRING;
}
<INITIAL,NestingMode,MMODE,CPROGMode>. {
<INITIAL,NestingMode,MMODE,CPROGMode,ccStyleMode>. {
yylval.character = yytext[0];
if ( is_html_multi_character( yylval.character)) {
yylval.string.text = html_multi_character(

View File

@ -27,6 +27,7 @@ extern int set_INITIAL;
extern int set_HTMLMODE;
extern int set_MMODE;
extern int line_number;
extern int set_old_state;
extern const char* in_filename;
extern char* creationvariable;
@ -70,6 +71,7 @@ extern bool actual_defining;
/* ============== */
int yyerror( char *s);
Text* blockintroProcessing( const char* text, int len, Text* t);
Buffer* blockintroProcessing( const char* text, int len, Buffer* t);
extern bool mbox_within_math;
@ -101,7 +103,8 @@ extern bool mbox_within_math;
%token SUBSUBSECTION
%token BEGINBIBLIO
%token ENDBIBLIO
%token <string> BIBITEM
%token BIBCITE
%token BIBITEM
%token <string> CITE
%token <string> LABEL
%token BEGINCLASS
@ -137,8 +140,14 @@ extern bool mbox_within_math;
%token TEXONLYEND
%token LATEXHTML
%token ANCHOR
%token <string> HTMLPATH
%token HTMLBEGIN
%token HTMLEND
%token HTMLBEGINCLASSFILE
%token HTMLENDCLASSFILE
%token <string> HTMLINDEX
%token <string> HTMLINDEXC
%token HTMLCROSSLINK
%token CCSTYLE
%token CCSECTION
@ -162,6 +171,9 @@ extern bool mbox_within_math;
%token ITBLOCKINTRO
%token SCBLOCKINTRO
%token BFBLOCKINTRO
%token RMBLOCKINTRO
%token SFBLOCKINTRO
%token CALBLOCKINTRO
%token MBOX
%token FOOTNOTEMARK
@ -223,6 +235,7 @@ stmt: string { handleBuffer( * $1);
}
| BEGINCLASS
classname { handleClass( $2->string());
current_font = unknown_font;
delete $2;
}
decl_sequence
@ -234,6 +247,7 @@ stmt: string { handleBuffer( * $1);
}
| BEGINCLASSTEMPLATE
classname { handleClassTemplate( $2->string());
current_font = unknown_font;
delete $2;
}
decl_sequence
@ -243,18 +257,41 @@ stmt: string { handleBuffer( * $1);
delete[] creationvariable;
creationvariable = NULL;
}
| HTMLBEGINCLASSFILE
classname { set_NestingMode = 1; }
comment_group
{ handleHtmlClassFile( $2->string(),
* $4);
set_INITIAL = 1;
delete $2;
delete $4;
}
input
HTMLENDCLASSFILE {
handleHtmlClassFileEnd();
}
| CREATIONVARIABLE {}
| CCSTYLE '{' nested_token_sequence '}' {
set_INITIAL = 1;
handleString( "<VAR>");
handleString( "<I>");
handleText( * $3);
handleString( "</VAR>");
handleString( "</I>");
current_font = unknown_font;
delete $3;
}
| INCLUDE '{' comment_sequence '}' {
handleString( "<EM>#include &lt;");
handleText( * $3);
handleString( "&gt;</EM>");
handleString( "<I>#include &lt;");
if (cgal_lib_dir) {
handleString( "<A HREF=\"");
handleString( cgal_lib_dir);
handleText( * $3);
handleString( "\">");
handleText( * $3);
handleString( "</A>");
} else
handleText( * $3);
handleString( "&gt;</I>");
current_font = unknown_font;
delete $3;
}
| HEADING '{' comment_sequence '}' {
@ -302,6 +339,10 @@ blockintro: TTBLOCKINTRO { $$.text = "<TT>\0</TT>"; $$.len = 4; }
| ITBLOCKINTRO { $$.text = "<I>\0</I>"; $$.len = 3; }
| SCBLOCKINTRO { $$.text = "<TT>\0</TT>"; $$.len = -1; }
| BFBLOCKINTRO { $$.text = "<B>\0</B>"; $$.len = 3; }
/* Sorry: \rm not supported. TT might be fine. */
| RMBLOCKINTRO { $$.text = "<TT>\0</TT>"; $$.len = 4; }
| SFBLOCKINTRO { $$.text = "<TT>\0</TT>"; $$.len = 4; }
| CALBLOCKINTRO { $$.text = "<TT>\0</TT>"; $$.len = 4; }
;
@ -351,7 +392,60 @@ string_token: STRING {
$$->add( $1.text, $1.len);
$$->add( "\"></A>");
}
| CITE { $$ = handleCite( $1.text); }
| HTMLINDEX '{' nested_token_sequence '}' {
char* s = text_block_to_string(* $3);
delete $3;
const char* p = handleHtmlIndex( $1.text, s);
delete[] s;
$$ = new Buffer;
$$->add( p);
}
| HTMLINDEXC '{' nested_token_sequence '}' {
set_INITIAL = 1;
char* s = text_block_to_string(* $3);
delete $3;
const char* p = handleHtmlIndexC( $1.text,s);
delete[] s;
$$ = new Buffer;
$$->add( p);
}
| HTMLCROSSLINK '{' nested_token_sequence '}' {
set_INITIAL = 1;
char* s = text_block_to_string(* $3);
delete $3;
const char* p = handleHtmlCrossLink( s);
delete[] s;
$$ = new Buffer;
$$->add( p);
}
| CITE '{' nested_token_sequence '}' {
set_INITIAL = 1;
char* s = text_block_to_string(* $3);
$$ = handleCite( s);
delete[] s;
delete $3;
}
| CITE '[' nested_token_sequence ']'
'{' nested_token_sequence '}' {
set_INITIAL = 1;
char* s = text_block_to_string(* $3);
char* p = text_block_to_string(* $6);
$$ = handleCite( p, s);
delete[] s;
delete[] p;
delete $3;
delete $6;
}
| BIBCITE '{' nested_token_sequence '}'
'{' nested_token_sequence '}' {
set_INITIAL = 1;
char* s = text_block_to_string(* $3);
char* p = text_block_to_string(* $6);
$$ = handleBibCite( s, p);
delete[] p;
delete[] s;
delete $3;
}
| BIBITEM '{' nested_token_sequence '}' {
set_INITIAL = 1;
char* s = text_block_to_string(* $3);
@ -757,18 +851,19 @@ compound_comment: '{' full_comment_sequence '}' {
set_INITIAL = 1;
if ( $$->isEmpty() ||
$$->head().isSpace) // should not
$$->cons( *new TextToken( "<VAR>", 1));
$$->cons( *new TextToken( "<I>", 1));
else
$$->head().prepend( "<VAR>");
$$->head().prepend( "<I>");
InListFIter< TextToken> ix( * $$);
ForAll( ix) {
if ( ix.isLast())
if ( ix->isSpace)
$$->append( *new TextToken(
"</VAR>", 1));
"</I>", 1));
else
ix->add( "</VAR>");
ix->add( "</I>");
}
current_font = unknown_font;
}
| verbatim_style {
$$ = new Text( managed);
@ -798,10 +893,20 @@ compound_comment: '{' full_comment_sequence '}' {
}
| INCLUDE '{' comment_sequence '}' {
$$ = $3;
if (cgal_lib_dir) {
char* s = text_block_to_string(* $3);
$$->cons( *new TextToken("\">"));
$$->cons( *new TextToken(s));
$$->cons( *new TextToken(cgal_lib_dir));
$$->cons( *new TextToken("<A HREF=\""));
$$->append( *new TextToken( "</A>"));
delete[] s;
}
$$->cons( *new TextToken( "&lt;"));
$$->cons( *new TextToken( " ", 1, true));
$$->cons( *new TextToken( "<EM>#include"));
$$->append( *new TextToken( "&gt;</EM>"));
$$->cons( *new TextToken( "<I>#include"));
$$->append( *new TextToken( "&gt;</I>"));
current_font = unknown_font;
}
| HEADING '{' comment_sequence '}' {
$$ = $3;
@ -897,6 +1002,7 @@ declaration: '{' {
'}' {
set_INITIAL = 1;
CCMode = 0;
current_font = unknown_font;
$$ = $3;
}
;
@ -1010,6 +1116,14 @@ verbatim_style: CPROGBEGIN string_with_nl_or_mt CPROGEND {
delete[] s;
delete $4;
}
| HTMLPATH {
$$ = new Buffer;
$$->add( "<A HREF=\"");
$$->add( $1.text, strlen( $1.text) - 1);
$$->add( "\">");
$$->add( $1.text, strlen( $1.text) - 1);
$$->add( "</A>");
}
;
texonly_style: TEXONLYBEGIN string_with_nl TEXONLYEND {
delete $2;
@ -1040,6 +1154,11 @@ math_token:
{
$$ = $2;
}
| blockintro math_sequence '}' {
$$ = blockintroProcessing( $1.text,
$1.len,
$2);
}
| SINGLESUBSCRIPT
{
$$ = new Buffer;
@ -1119,6 +1238,8 @@ const char* errorMessage( ErrorNumber n) {
return "Cannot open include file";
case ChapterStructureError:
return "Malformed chapter structure: one chapter per file";
case UnknownIndexCategoryError:
return "Unknown index category in optional argument of \\ccHtmlIndex";
}
return "UNKNOWN ERROR MESSAGE NUMBER";
}
@ -1152,3 +1273,14 @@ Text* blockintroProcessing( const char* text, int len, Text* t) {
return t;
}
Buffer* blockintroProcessing( const char* text, int len, Buffer* t) {
if ( len < 0) { /* Hack! Here we know that t has to get capitalized.*/
len = 4;
t->capitalize();
}
t->prepend( text, len);
/* Hack! ptr arithmetic points to the closing tag text */
t->add( text + len + 1);
return t;
}