diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/C++2LaTeX-1_1pl1 |
Initial commit
Diffstat (limited to 'support/C++2LaTeX-1_1pl1')
22 files changed, 7121 insertions, 0 deletions
diff --git a/support/C++2LaTeX-1_1pl1/COPYING b/support/C++2LaTeX-1_1pl1/COPYING new file mode 100644 index 0000000000..e3027aeac3 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/COPYING @@ -0,0 +1,190 @@ + GNU GENERAL PUBLIC LICENSE + Version 1, February 1989 + + Copyright (C) 1989 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The license agreements of most software companies try to keep users +at the mercy of those companies. By contrast, our General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. The +General Public License applies to the Free Software Foundation's +software and to any other program whose authors commit to using it. +You can use it for your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Specifically, the General Public License is designed to make +sure that you have the freedom to give away or sell copies of free +software, that you receive source code or can get it if you want it, +that you can change the software or use pieces of it in new free +programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of a such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must tell them their rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any program or other work which +contains a notice placed by the copyright holder saying it may be +distributed under the terms of this General Public License. The +"Program", below, refers to any such program or work, and a "work based +on the Program" means either the Program or any work containing the +Program or a portion of it, either verbatim or with modifications. Each +licensee is addressed as "you". + + 1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this +General Public License and to the absence of any warranty; and give any +other recipients of the Program a copy of this General Public License +along with the Program. You may charge a fee for the physical act of +transferring a copy. + + 2. You may modify your copy or copies of the Program or any portion of +it, and copy and distribute such modifications under the terms of Paragraph +1 above, provided that you also do the following: + + a) cause the modified files to carry prominent notices stating that + you changed the files and the date of any change; and + + b) cause the whole of any work that you distribute or publish, that + in whole or in part contains the Program or any part thereof, either + with or without modifications, to be licensed at no charge to all + third parties under the terms of this General Public License (except + that you may choose to grant warranty protection to some or all + third parties, at your option). + + c) If the modified program normally reads commands interactively when + run, you must cause it, when started running for such interactive use + in the simplest and most usual way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this General + Public License. + + d) You may charge a fee for the physical act of transferring a + copy, and you may at your option offer warranty protection in + exchange for a fee. + +Mere aggregation of another independent work with the Program (or its +derivative) on a volume of a storage or distribution medium does not bring +the other work under the scope of these terms. + + 3. You may copy and distribute the Program (or a portion or derivative of +it, under Paragraph 2) in object code or executable form under the terms of +Paragraphs 1 and 2 above provided that you also do one of the following: + + a) accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of + Paragraphs 1 and 2 above; or, + + b) accompany it with a written offer, valid for at least three + years, to give any third party free (except for a nominal charge + for the cost of distribution) a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of + Paragraphs 1 and 2 above; or, + + c) accompany it with the information you received as to where the + corresponding source code may be obtained. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form alone.) + +Source code for a work means the preferred form of the work for making +modifications to it. For an executable file, complete source code means +all the source code for all modules it contains; but, as a special +exception, it need not include source code for modules which are standard +libraries that accompany the operating system on which the executable +file runs, or for standard header files or definitions files that +accompany that operating system. + + 4. You may not copy, modify, sublicense, distribute or transfer the +Program except as expressly provided under this General Public License. +Any attempt otherwise to copy, modify, sublicense, distribute or transfer +the Program is void, and will automatically terminate your rights to use +the Program under this License. However, parties who have received +copies, or rights to use copies, from you under this General Public +License will not have their licenses terminated so long as such parties +remain in full compliance. + + 5. By copying, distributing or modifying the Program (or any work based +on the Program) you indicate your acceptance of this license to do so, +and all its terms and conditions. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the original +licensor to copy, distribute or modify the Program subject to these +terms and conditions. You may not impose any further restrictions on the +recipients' exercise of the rights granted herein. + + 7. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of the license which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +the license, you may choose any version ever published by the Free Software +Foundation. + + 8. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/support/C++2LaTeX-1_1pl1/ChangeLog b/support/C++2LaTeX-1_1pl1/ChangeLog new file mode 100644 index 0000000000..914ed57fc1 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/ChangeLog @@ -0,0 +1,39 @@ +Sat Sep 02 14:04:00 1995 Sascha Ziemann (szi@nt.e-technik.uni-dortmund.de) + + * Version 1.1 Patchlevel 1 released + Some code inserted to produce a \hfill between c-code and a comment + +Mon Apr 23 09:53:23 1990 Norbert Kiesel (norbert at rwthi3) + + * Version 1.1 Patchlevel 0 released + + * USE-NAME, ANSI-C and C-PLUSPLUS macros for input mode selection + + * new option [-p,+c-plusplus] for C++ input selection + + * allow whitespace in CPP-directrives + + * leading whitespace in block comments and strings preserved + + * "--" outputs "-{}-" + + * strdup substituted by malloc/strcpy (seems to be more portable) + +Fri Apr 6 13:05:34 1990 Norbert Kiesel (norbert at rwthi3) + + * Version 1.0 Patchlevel 2 released + Some minor bugs in c++2latex.l removed. Also print's #included + fileames in string-font (def.: tt) (both <xx.h> and "xx.h"). + + * Version 1.0 Patchlevel 1 released + It includes changes to c++2latex.l, version.c, a flexed version + of c++2latex.l, a ChangeLog and the fancyheadings.sty from Piet + van Oostrum. + + * c++2latex.l: Some changes to the flex part (<,>,empty lines) + +Thu Apr 5 14:22:15 1990 Norbert Kiesel (norbert at rwthi3) + + * c++2latex.l: Inserted missing \\mbox{} in <BCOMMNET>"\n" + + diff --git a/support/C++2LaTeX-1_1pl1/Makefile b/support/C++2LaTeX-1_1pl1/Makefile new file mode 100644 index 0000000000..f154512af1 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/Makefile @@ -0,0 +1,30 @@ +FLAVOR = + +CC = gcc +CFLAGS = -g $(FLAVOR) +LEX = flex + + +.PHONY: all workaround C_PLUSPLUS ANSI_C HAS_NAME + +all: c++2latex + +C_PLUSPLUS: make c++2latex FLAVOR=-DC_PLUSPLUS + +ANSI_C: + make c2latex FLAVOR=-DANSI_C + +USE_NAME: + make c++2latex FLAVOR=-DUSE_NAME + +workaround: c++2latex.l + mv -f c++2latex.l c++2latex.full + sed > c++2latex.l -e '/^###/w c++2latex.copyright' \ + -e '/^###/d' c++2latex.full + +c2latex.c: c++2latex.c + mv c++2latex.c c2latex.c + +c++2latex: c++2latex.o getopt1.o getopt.o version.o + +c2latex: c2latex.o getopt1.o getopt.o version.o diff --git a/support/C++2LaTeX-1_1pl1/README b/support/C++2LaTeX-1_1pl1/README new file mode 100644 index 0000000000..4e903cacac --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/README @@ -0,0 +1,53 @@ +This is the README for C++2LaTeX Version 1.1 Patchlevel 0. + +See ChangeLog for a list of changes from Version 1.0. + +The program c++2latex converts ANSI-C/C++ programs into LaTeX source. + +It requires flex which can be found on various ftp sites, + e.g. prep.ai.mit.edu. For those without flex and without the possibility +to get one, I can email the flex'ed program. + +Contrary to the manual, flex (2.1-beta and 2.2-alpha) doesn't ignore lines +starting with '#' in the definition section. Either patch your flex with +the unofficial patch flex-patch or first type `make workaround'. This will +strip the comment lines from c++2latex.l. + +There are three mutually exclusive compile options for c++2latex: + + C_PLUSPLUS generates a converter called c++2latex that expects + C++ input. + + ANSI_C generates a converter called c2latex that expects + ANSI-C input. + + USE_NAME generates a converter called c++2latex that expects + C++ input if the program name (i.e. the name under + which the converter is called) contains a '+', else + it expects ANSI-C input. This saves disk-space as + you can 'ln c++2latex c2latex' and get virtually + the same result as with the two other options + (which create two independent binaries). However, + this is not the default option as changing the + behavior (even only the default behavoir) of a + program by reaming it might be confusing. + +Please note that these options only specify the default behavoir +which can be overridden by the run-time options [-a,+ansi-c] and +[-p,+c-plusplus]. + +The default option is C_PLUSPLUS. This can be changed by calling +either ``make ANSI_C'' or make ``USE_NAME''. Simply calling ``make'' +is the same as calling ``make C_PLUSPLUS''. + + +The resulting program c{,++}2latex is standalone and uses no environment +variables. It can be installed in your default location without any +problems. + +Please notice that this program is under GNU Copyleft. + +have fun + + Norbert + diff --git a/support/C++2LaTeX-1_1pl1/c++2latex b/support/C++2LaTeX-1_1pl1/c++2latex Binary files differnew file mode 100755 index 0000000000..87c2d9eda6 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/c++2latex diff --git a/support/C++2LaTeX-1_1pl1/c++2latex.1 b/support/C++2LaTeX-1_1pl1/c++2latex.1 new file mode 100644 index 0000000000..3d095792c6 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/c++2latex.1 @@ -0,0 +1,124 @@ +.TH C++2LATEX 1 "2 April 1990" "Version 1.0" +.SH NAME +c++2latex - C/C++ to LaTeX converter +.SH SYNOPSIS +.B c++2latex +.B [-a] [-c] [-h] [-i length] [-o path] [-s size] [-t] [-C font] +.B [-H font] [-K font] [-P font] [-S font] [-T wide] [-V] +.B [+ansi-c] [+complete-file] [+header] [+indentation length] +.B [+output path] [+font-size size] [+pipe] [+comment-font font] +.B [+keyword-font font] [+cpp-font font] [+header-font font] +.B [+string-font font] [+tabstop wide] [+version] [path] +.SH DESCRIPTION +.I c++2latex +is a tool for generating +.I LateX +source from ANSI-C or C++ programs. +It recogizes all keywords, strings, and comments. These recognized parts +can be set in different fonts. +.I c++2latex +can generate complete \fILaTeX\fR files which can directly passed +through latex(1) or parts of +.I LaTeX +files which can be included in other files (either direct or by the +.B \\\\input +or +.B \\\\include +commands). +.LP +The output filename is searched in various steps. First, if the +{-o,+output} flag is given, the output is written to the file pointed +to by the value of this flag. If the {-t,+pipe} option is given, the +output is written to stdout. (It is an error to specify both options +together.) If none of this options but an input pathname is given, the +output is written to a file who's name is the last component of the +input pathname with the substituted or else added suffix '.tex'. If +the input is read from stdin and none of the above options is given, +the output is written to '<program-name>.tex' with <program-name> being +the name of this program. +.SH OPTIONS +.I c++2latex +has the following options: +.TP +.B {-a,+ansi-c} +The input is an ANSI-C program. Default is C++, so \fBdon't\fR give this option +for C++ programs and \fBalways\fR give this option for ANSI-C programs. +.TP +.B {-c,+complete-file} +The output is enveloped in +commands which produce a complete +.I LaTeX +source. +.TP +.B {-h,+header} +Each page of output has a header giving the input file name and the +date the file was produced. This option implies the +{-c,+complete-file} option. +.TP +.B {-i,+indentation} length +Gives the amount of indentation for each leading blank (tabs are +converted to blanks). Default is `0.5em'. +.TP +.B {-o,+output} \fIpath\fR +The output is written in the file pointed to by \fIpath\fR. +.TP +.B {-s,+font-size} \fIsize\fR +The LaTeX source is set in \fIsize\fRpt. Default is `11'. +.TP +.B {-t,+pipe} +The output is written to stdout. +.TP +.B {-C,+comment-font} \fIfont\fR +The comments are set in the given font. Default is `it'. +.TP +.B {-H,+header-font} \fIfont\fR +The headers are set in the given font. Default is `sl'. +.TP +.B {-K,+keyword-font} \fIfont\fR +The keywords are set in the given font. Default is `bf'. +.TP +.B {-P,+cpp-font} \fIfont\fR +The preprocessor directives are set in the given font. Default is `tt'. +.TP +.B {-S,+string-font} \fIfont\fR +The string and character constants are set in the given font. Default is `tt'. +.TP +.B {-T,+tabstop} \fIwide\fR +The wide of tabs is \fIwide\fR. Default is `8'. +.TP +.B {-V,+version} +Prints the version number on stderr. +.SH OPTION SUMMARY +.TP +To give no oprion at all is the same as to give the options +-i 0.5em -s 11 -C it -H sl -K bf -P tt -S tt -T 8 +.SH "SEE ALSO" +.LP +latex(1). +.SH DIAGNOSTICS +.TP +.I Can't use {-t,+pipe} and {-o,+output} together. +At most one of this options may be given. +.LP +.TP +.I Can't open `<path>' for reading +The program failed to open <path> for reading. +.LP +.TP +.I Can't open `%s' for writing +The program failed to open <path> for writing. All output is written +in the current directory if not explicitly changed by {-o,+output}. +.LP +.TP +.I Virtual memory exhausted +The program failed to allocate storage. As this is only done for the +construction of pathnames, this error will normally indicate a +program error. +.SH AUTHOR +Norbert Kiesel. +.LP +.SH DEFICIENCIES / BUGS +.LP +.LP +The program should be completly rewitten to understand language +descriptions ala tgrind. diff --git a/support/C++2LaTeX-1_1pl1/c++2latex.c b/support/C++2LaTeX-1_1pl1/c++2latex.c new file mode 100644 index 0000000000..86c164cee3 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/c++2latex.c @@ -0,0 +1,2512 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/flex-2.4.7/RCS/flex.skl,v 1.2 94/08/03 11:13:24 vern Exp $ + */ + +#define FLEX_SCANNER + +#include <stdio.h> + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include <stdlib.h> +#include <unistd.h> + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#ifdef __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + + +#ifdef __TURBOC__ +#define YY_USE_CONST +#endif + + +#ifndef YY_USE_CONST +#ifndef const +#define const +#endif +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. + */ +#define YY_START ((yy_start - 1) / 2) + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". Now included + * only for backward compatibility with previous versions of flex. + */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#ifdef __cplusplus +extern "C" { +#endif + extern int yywrap YY_PROTO(( void )); +#ifdef __cplusplus + } +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +void yyrestart YY_PROTO(( FILE *input_file )); +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); + +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +static void yy_push_state YY_PROTO(( int new_state )); +static void yy_pop_state YY_PROTO(( void )); +static int yy_top_state YY_PROTO(( void )); + +static void *yy_flex_alloc YY_PROTO(( unsigned int )); +static void *yy_flex_realloc YY_PROTO(( void *, unsigned int )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define INITIAL 0 +#define STRING 1 +#define BCOMMENT 2 +#define INCLUDE 3 +#define CPLUSPLUS 4 +typedef unsigned char YY_CHAR; +typedef int yy_state_type; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +extern char *yytext; +#define yytext_ptr yytext + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); +#endif + +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( const char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = yy_cp - yy_bp; \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_END_OF_BUFFER 140 +static const short int yy_accept[537] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 140, 139, 136, 138, 137, 95, 116, 139, 86, 85, + 139, 103, 104, 73, 97, 92, 96, 93, 77, 127, + 127, 90, 94, 78, 91, 79, 89, 109, 109, 105, + 139, 106, 74, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 83, 75, + 84, 72, 135, 77, 122, 120, 119, 122, 121, 115, + 113, 115, 114, 14, 12, 13, 14, 14, 108, 96, + 93, 90, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + + 108, 108, 136, 137, 64, 0, 0, 0, 0, 0, + 81, 80, 82, 0, 0, 67, 100, 101, 87, 102, + 59, 0, 123, 111, 98, 124, 127, 127, 0, 127, + 0, 60, 62, 99, 63, 61, 109, 116, 0, 134, + 70, 109, 109, 109, 109, 109, 109, 43, 109, 109, + 109, 109, 109, 109, 44, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 71, 65, 135, 110, + 118, 117, 121, 112, 114, 12, 0, 11, 0, 10, + 108, 59, 88, 107, 108, 108, 108, 108, 108, 108, + 108, 108, 43, 108, 108, 108, 108, 108, 108, 108, + + 44, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 0, + 0, 0, 4, 0, 0, 128, 0, 128, 0, 0, + 66, 0, 123, 123, 0, 124, 127, 0, 125, 133, + 68, 69, 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 36, 109, 17, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, + 109, 76, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 36, 108, 108, 108, 17, + 108, 47, 108, 108, 108, 108, 108, 108, 108, 108, + + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 0, 0, 0, 0, 0, 0, 0, + 0, 129, 130, 0, 0, 0, 125, 123, 0, 126, + 133, 15, 109, 23, 27, 109, 109, 109, 109, 20, + 24, 109, 109, 40, 21, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 38, 109, 109, 15, + 108, 23, 27, 108, 108, 108, 108, 108, 108, 20, + 24, 108, 108, 108, 40, 108, 21, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 49, 108, 108, 108, 108, 38, 108, 108, 0, 7, + + 8, 0, 0, 0, 0, 0, 0, 131, 0, 19, + 31, 109, 109, 109, 109, 32, 109, 109, 33, 109, + 109, 109, 109, 109, 109, 30, 109, 109, 46, 19, + 51, 31, 108, 108, 108, 108, 108, 32, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 33, 108, 108, + 108, 108, 108, 108, 30, 108, 108, 108, 46, 0, + 9, 5, 0, 0, 3, 109, 109, 16, 28, 109, + 29, 37, 41, 45, 18, 22, 109, 109, 109, 108, + 108, 48, 16, 28, 56, 57, 108, 108, 108, 108, + 52, 108, 29, 37, 41, 45, 18, 22, 108, 108, + + 108, 108, 2, 6, 0, 109, 39, 109, 26, 109, + 109, 108, 39, 108, 108, 54, 108, 108, 26, 108, + 55, 108, 1, 35, 25, 34, 42, 35, 50, 58, + 108, 25, 34, 42, 53, 0 + } ; + +static const int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, + 22, 22, 22, 22, 22, 23, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 31, 31, 31, 32, 33, + 34, 34, 34, 34, 34, 35, 34, 34, 34, 34, + 34, 34, 34, 34, 36, 34, 34, 34, 34, 34, + 37, 38, 39, 40, 34, 30, 41, 42, 43, 44, + + 45, 46, 47, 48, 49, 34, 50, 51, 52, 53, + 54, 55, 34, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const int yy_meta[69] = + { 0, + 1, 1, 1, 1, 2, 2, 3, 2, 4, 2, + 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, + 6, 6, 7, 2, 2, 2, 2, 2, 3, 2, + 7, 7, 7, 8, 8, 8, 2, 3, 2, 2, + 6, 6, 7, 7, 7, 6, 8, 8, 8, 8, + 8, 8, 9, 8, 8, 9, 8, 9, 8, 9, + 8, 9, 8, 8, 2, 2, 2, 2 + } ; + +static const short int yy_base[550] = + { 0, + 0, 67, 67, 73, 68, 79, 83, 90, 108, 94, + 976, 977, 96, 977, 972, 947, 977, 129, 946, 62, + 934, 977, 977, 944, 75, 977, 85, 85, 95, 170, + 163, 977, 977, 92, 943, 93, 977, 0, 116, 977, + 966, 977, 941, 908, 910, 142, 70, 84, 79, 911, + 83, 910, 918, 152, 899, 908, 906, 911, 977, 111, + 977, 977, 143, 160, 977, 977, 977, 197, 174, 977, + 977, 938, 192, 977, 214, 977, 950, 928, 0, 199, + 215, 931, 945, 211, 172, 91, 215, 216, 198, 224, + 194, 219, 231, 202, 232, 203, 236, 235, 243, 233, + + 245, 249, 262, 977, 977, 266, 908, 26, 236, 899, + 977, 977, 977, 939, 283, 977, 977, 977, 977, 977, + 977, 931, 286, 977, 977, 301, 319, 337, 345, 977, + 0, 922, 977, 977, 977, 921, 0, 977, 909, 977, + 977, 888, 900, 887, 902, 889, 895, 881, 882, 879, + 879, 882, 879, 876, 0, 875, 879, 230, 877, 226, + 257, 881, 874, 263, 225, 879, 977, 977, 298, 977, + 977, 977, 312, 977, 324, 325, 920, 977, 898, 977, + 0, 910, 977, 977, 915, 270, 326, 292, 307, 334, + 330, 335, 341, 344, 348, 353, 356, 365, 367, 368, + + 914, 371, 370, 375, 380, 382, 381, 376, 384, 378, + 386, 383, 385, 388, 389, 394, 390, 396, 399, 876, + 355, 877, 362, 877, 875, 977, 906, 905, 437, 0, + 977, 439, 977, 431, 449, 977, 977, 452, 457, 433, + 977, 977, 862, 874, 869, 857, 356, 871, 869, 865, + 857, 863, 866, 0, 852, 0, 858, 855, 844, 846, + 848, 855, 841, 839, 839, 851, 841, 845, 849, 851, + 840, 977, 429, 400, 411, 431, 472, 476, 477, 479, + 480, 481, 484, 482, 487, 881, 485, 486, 488, 880, + 491, 879, 489, 490, 492, 493, 496, 494, 495, 497, + + 502, 499, 498, 500, 503, 501, 504, 506, 508, 505, + 522, 507, 511, 838, 840, 840, 835, 838, 838, 830, + 835, 977, 977, 520, 867, 546, 549, 977, 552, 555, + 977, 0, 828, 0, 0, 819, 827, 816, 823, 0, + 0, 817, 814, 0, 0, 814, 814, 811, 823, 813, + 817, 822, 821, 819, 809, 814, 0, 802, 814, 849, + 514, 848, 847, 526, 530, 516, 541, 570, 571, 846, + 845, 573, 572, 578, 844, 580, 843, 575, 576, 577, + 581, 583, 582, 584, 585, 589, 587, 586, 593, 594, + 842, 598, 592, 597, 588, 841, 590, 601, 796, 977, + + 977, 802, 801, 801, 786, 798, 831, 977, 830, 0, + 0, 788, 789, 794, 785, 0, 779, 783, 0, 791, + 788, 790, 774, 783, 785, 0, 776, 779, 0, 818, + 817, 816, 596, 599, 606, 608, 602, 815, 610, 611, + 600, 603, 604, 595, 616, 605, 612, 814, 643, 614, + 652, 615, 655, 657, 813, 658, 659, 660, 812, 775, + 977, 977, 773, 774, 977, 758, 758, 0, 0, 762, + 0, 0, 0, 0, 0, 0, 760, 758, 746, 661, + 663, 782, 722, 721, 705, 701, 662, 665, 667, 666, + 699, 668, 698, 696, 695, 692, 690, 689, 669, 672, + + 671, 674, 977, 977, 652, 651, 0, 637, 0, 646, + 644, 673, 677, 670, 675, 512, 682, 676, 510, 679, + 419, 683, 977, 0, 0, 0, 0, 410, 408, 393, + 685, 293, 237, 171, 116, 977, 732, 741, 750, 758, + 762, 771, 780, 786, 792, 799, 803, 805, 808 + } ; + +static const short int yy_def[550] = + { 0, + 536, 1, 537, 537, 538, 538, 539, 539, 1, 9, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 540, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 541, 541, 536, + 536, 536, 536, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 542, 543, 544, 536, + 536, 536, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + + 545, 545, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 546, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 547, 536, 536, 536, 536, 536, 541, 536, 540, 536, + 536, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 542, 536, 543, 536, + 544, 536, 536, 536, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 548, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 547, + 536, 536, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 536, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 549, 536, 536, 536, 536, 536, + 536, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 536, 536, + + 536, 536, 536, 536, 536, 536, 536, 536, 536, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, + 536, 536, 536, 536, 536, 541, 541, 541, 541, 541, + 541, 541, 541, 541, 541, 541, 541, 541, 541, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, + + 545, 545, 536, 536, 536, 541, 541, 541, 541, 541, + 541, 545, 545, 545, 545, 545, 545, 545, 545, 545, + 545, 545, 536, 541, 541, 541, 541, 545, 545, 545, + 545, 545, 545, 545, 545, 0, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536 + } ; + +static const short int yy_nxt[1046] = + { 0, + 12, 13, 14, 15, 13, 16, 17, 18, 12, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 31, 32, 33, 34, 35, 36, 37, 12, + 38, 38, 38, 38, 39, 38, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 38, 51, 38, + 52, 38, 38, 38, 38, 53, 54, 55, 56, 57, + 58, 38, 38, 38, 59, 60, 61, 62, 63, 66, + 71, 63, 112, 67, 69, 66, 221, 69, 222, 67, + 73, 71, 72, 73, 75, 76, 64, 75, 113, 77, + 117, 75, 76, 72, 75, 63, 77, 103, 63, 181, + + 103, 118, 119, 122, 68, 123, 123, 123, 78, 124, + 68, 120, 121, 64, 147, 78, 79, 132, 133, 135, + 136, 125, 138, 148, 181, 80, 81, 139, 155, 152, + 106, 82, 153, 106, 149, 156, 150, 167, 83, 83, + 83, 83, 84, 83, 169, 151, 187, 169, 85, 86, + 87, 88, 89, 90, 91, 83, 92, 83, 93, 83, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 83, + 83, 83, 107, 108, 170, 173, 168, 109, 173, 181, + 181, 126, 144, 128, 128, 128, 125, 110, 126, 145, + 127, 127, 128, 175, 129, 146, 175, 130, 130, 159, + + 160, 129, 181, 171, 130, 130, 181, 129, 171, 161, + 181, 181, 162, 130, 129, 176, 119, 138, 176, 181, + 130, 130, 139, 181, 181, 120, 182, 181, 130, 183, + 186, 131, 181, 122, 172, 123, 123, 123, 171, 181, + 181, 181, 171, 181, 181, 181, 204, 200, 194, 171, + 195, 181, 171, 181, 171, 188, 171, 181, 207, 196, + 192, 208, 189, 103, 201, 190, 103, 106, 191, 193, + 106, 202, 261, 269, 197, 270, 258, 198, 181, 199, + 209, 223, 210, 211, 203, 216, 205, 259, 224, 262, + 214, 206, 212, 217, 228, 213, 219, 263, 218, 169, + + 181, 181, 169, 229, 229, 215, 123, 123, 123, 107, + 108, 267, 264, 173, 109, 181, 173, 232, 233, 268, + 233, 234, 234, 234, 110, 175, 176, 273, 175, 176, + 232, 233, 235, 236, 181, 236, 233, 126, 181, 127, + 127, 128, 181, 181, 230, 235, 236, 276, 275, 181, + 129, 236, 181, 237, 237, 126, 181, 128, 128, 128, + 238, 181, 238, 129, 181, 239, 239, 239, 129, 237, + 274, 130, 130, 181, 277, 181, 181, 237, 181, 181, + 279, 129, 278, 181, 181, 280, 181, 130, 181, 181, + 181, 181, 181, 181, 181, 130, 181, 181, 181, 281, + + 282, 181, 181, 315, 181, 318, 283, 181, 181, 285, + 284, 316, 336, 337, 319, 287, 181, 297, 181, 181, + 286, 289, 291, 303, 293, 288, 294, 181, 290, 295, + 298, 300, 301, 305, 296, 292, 306, 181, 304, 181, + 361, 299, 308, 307, 311, 310, 312, 313, 323, 302, + 309, 234, 234, 234, 326, 362, 326, 324, 324, 327, + 327, 327, 129, 328, 329, 328, 329, 331, 331, 330, + 330, 330, 239, 239, 239, 129, 328, 239, 239, 239, + 181, 328, 360, 331, 181, 181, 363, 181, 181, 181, + 181, 331, 181, 181, 181, 181, 181, 181, 181, 181, + + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 367, 181, 181, + 181, 369, 181, 368, 181, 370, 372, 373, 364, 374, + 181, 323, 365, 366, 181, 371, 376, 377, 181, 375, + 407, 407, 383, 387, 378, 379, 382, 397, 392, 181, + 381, 380, 385, 384, 386, 388, 394, 391, 389, 393, + 390, 398, 395, 430, 433, 396, 327, 327, 327, 327, + 327, 327, 330, 330, 330, 330, 330, 330, 181, 181, + 181, 181, 431, 181, 181, 181, 181, 432, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 434, + + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 441, 181, 443, 181, 181, + 181, 436, 181, 181, 181, 444, 442, 435, 437, 438, + 439, 445, 440, 449, 451, 452, 453, 490, 446, 447, + 450, 454, 448, 456, 455, 459, 457, 458, 480, 481, + 482, 181, 483, 485, 484, 486, 488, 487, 491, 495, + 181, 489, 492, 181, 493, 181, 181, 181, 181, 181, + 181, 181, 497, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 494, 181, 527, 526, + 181, 181, 525, 181, 496, 524, 523, 181, 181, 501, + + 181, 499, 498, 181, 181, 515, 181, 181, 502, 181, + 500, 516, 518, 181, 519, 514, 520, 528, 530, 512, + 513, 521, 533, 517, 522, 529, 531, 534, 535, 181, + 181, 532, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 114, + 114, 114, 114, 114, 114, 114, 114, 137, 137, 137, + 137, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 181, + 181, 181, 181, 181, 181, 185, 511, 185, 185, 185, + + 185, 227, 510, 227, 227, 509, 508, 227, 240, 240, + 325, 325, 409, 409, 409, 507, 506, 505, 504, 503, + 181, 181, 181, 181, 181, 181, 181, 479, 478, 477, + 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, + 466, 408, 323, 465, 464, 463, 462, 461, 460, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 429, 428, + 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, + 417, 416, 415, 414, 413, 412, 411, 410, 408, 406, + 405, 404, 403, 402, 401, 400, 399, 181, 181, 181, + 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, + + 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, + 339, 338, 335, 334, 333, 332, 322, 322, 321, 320, + 317, 314, 181, 181, 272, 180, 178, 271, 266, 265, + 260, 257, 256, 255, 254, 253, 252, 251, 250, 249, + 248, 247, 246, 245, 244, 243, 115, 242, 241, 231, + 226, 225, 220, 181, 184, 180, 178, 174, 166, 165, + 164, 163, 158, 157, 154, 143, 142, 141, 140, 134, + 116, 115, 111, 105, 104, 536, 11, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536 + } ; + +static const short int yy_chk[1046] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 5, 2, 20, 3, 4, 4, 108, 4, 108, 4, + 6, 6, 5, 6, 7, 7, 2, 7, 20, 7, + 25, 8, 8, 6, 8, 10, 8, 13, 10, 86, + + 13, 25, 27, 28, 3, 28, 28, 28, 7, 29, + 4, 27, 27, 10, 47, 8, 9, 34, 34, 36, + 36, 29, 39, 47, 535, 9, 9, 39, 51, 49, + 18, 9, 49, 18, 48, 51, 48, 60, 9, 9, + 9, 9, 9, 9, 63, 48, 86, 63, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 18, 18, 64, 69, 60, 18, 69, 534, + 85, 31, 46, 31, 31, 31, 64, 18, 30, 46, + 30, 30, 30, 73, 31, 46, 73, 31, 31, 54, + + 54, 30, 91, 68, 30, 30, 89, 31, 68, 54, + 94, 96, 54, 31, 30, 75, 80, 84, 75, 84, + 30, 31, 84, 87, 88, 80, 80, 92, 30, 81, + 85, 30, 90, 81, 68, 81, 81, 81, 68, 93, + 95, 100, 68, 98, 97, 533, 94, 91, 89, 68, + 89, 99, 68, 101, 68, 87, 68, 102, 96, 89, + 88, 96, 87, 103, 92, 87, 103, 106, 87, 88, + 106, 92, 160, 165, 90, 165, 158, 90, 186, 90, + 97, 109, 98, 98, 93, 100, 95, 158, 109, 160, + 99, 95, 98, 101, 115, 98, 102, 161, 101, 169, + + 188, 532, 169, 115, 115, 99, 123, 123, 123, 106, + 106, 164, 161, 173, 106, 189, 173, 123, 123, 164, + 123, 126, 126, 126, 106, 175, 176, 186, 175, 176, + 123, 123, 126, 126, 187, 126, 123, 127, 191, 127, + 127, 127, 190, 192, 115, 126, 126, 189, 188, 193, + 127, 126, 194, 127, 127, 128, 195, 128, 128, 128, + 129, 196, 129, 127, 197, 129, 129, 129, 128, 127, + 187, 128, 128, 198, 190, 199, 200, 127, 203, 202, + 192, 128, 191, 204, 208, 192, 210, 128, 205, 207, + 206, 212, 209, 213, 211, 128, 214, 215, 217, 193, + + 194, 530, 216, 221, 218, 223, 195, 219, 274, 197, + 196, 221, 247, 247, 223, 199, 529, 208, 528, 275, + 198, 202, 203, 212, 205, 200, 206, 521, 202, 207, + 209, 210, 211, 213, 207, 204, 214, 273, 212, 276, + 274, 209, 216, 215, 218, 217, 218, 219, 229, 211, + 216, 234, 234, 234, 232, 275, 232, 229, 229, 232, + 232, 232, 234, 234, 235, 234, 235, 240, 240, 235, + 235, 235, 238, 238, 238, 234, 234, 239, 239, 239, + 277, 234, 273, 240, 278, 279, 276, 280, 281, 282, + 284, 240, 283, 287, 288, 285, 289, 293, 294, 291, + + 295, 296, 298, 299, 297, 300, 303, 302, 304, 306, + 301, 305, 307, 310, 308, 312, 309, 279, 519, 313, + 516, 281, 361, 280, 366, 282, 284, 285, 277, 287, + 311, 324, 278, 278, 364, 283, 289, 291, 365, 288, + 324, 324, 298, 302, 293, 294, 297, 312, 307, 367, + 296, 295, 300, 299, 301, 303, 309, 306, 304, 308, + 305, 313, 310, 361, 366, 311, 326, 326, 326, 327, + 327, 327, 329, 329, 329, 330, 330, 330, 368, 369, + 373, 372, 364, 378, 379, 380, 374, 365, 376, 381, + 383, 382, 384, 385, 388, 387, 395, 386, 397, 367, + + 393, 389, 390, 444, 433, 394, 392, 434, 441, 398, + 437, 442, 443, 446, 435, 378, 436, 380, 439, 440, + 447, 369, 450, 452, 445, 381, 379, 368, 372, 373, + 374, 382, 376, 386, 388, 389, 390, 444, 383, 384, + 387, 392, 385, 394, 393, 398, 395, 397, 433, 434, + 435, 449, 436, 439, 437, 440, 442, 441, 445, 450, + 451, 443, 446, 453, 447, 454, 456, 457, 458, 480, + 487, 481, 452, 488, 490, 489, 492, 499, 514, 501, + 500, 512, 502, 515, 518, 513, 449, 520, 511, 510, + 517, 522, 508, 531, 451, 506, 505, 498, 497, 457, + + 496, 454, 453, 495, 494, 488, 493, 491, 458, 486, + 456, 489, 492, 485, 499, 487, 500, 512, 515, 480, + 481, 501, 520, 490, 502, 514, 517, 522, 531, 484, + 483, 518, 537, 537, 537, 537, 537, 537, 537, 537, + 537, 538, 538, 538, 538, 538, 538, 538, 538, 538, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 540, + 540, 540, 540, 540, 540, 540, 540, 541, 541, 541, + 541, 542, 542, 542, 542, 542, 542, 542, 542, 542, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 544, + 482, 544, 544, 544, 544, 545, 479, 545, 545, 545, + + 545, 546, 478, 546, 546, 477, 470, 546, 547, 547, + 548, 548, 549, 549, 549, 467, 466, 464, 463, 460, + 459, 455, 448, 438, 432, 431, 430, 428, 427, 425, + 424, 423, 422, 421, 420, 418, 417, 415, 414, 413, + 412, 409, 407, 406, 405, 404, 403, 402, 399, 396, + 391, 377, 375, 371, 370, 363, 362, 360, 359, 358, + 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, + 346, 343, 342, 339, 338, 337, 336, 333, 325, 321, + 320, 319, 318, 317, 316, 315, 314, 292, 290, 286, + 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, + + 261, 260, 259, 258, 257, 255, 253, 252, 251, 250, + 249, 248, 246, 245, 244, 243, 228, 227, 225, 224, + 222, 220, 201, 185, 182, 179, 177, 166, 163, 162, + 159, 157, 156, 154, 153, 152, 151, 150, 149, 148, + 147, 146, 145, 144, 143, 142, 139, 136, 132, 122, + 114, 110, 107, 83, 82, 78, 77, 72, 58, 57, + 56, 55, 53, 52, 50, 45, 44, 43, 41, 35, + 24, 21, 19, 16, 15, 11, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 536, 536 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +char *yytext; +# line 1 "c++2latex.l" +# line 6 "c++2latex.l" +int hfillon = 0; + +#define KEY printf ("{\\%s %s}", keyword_font, yytext); hfillon = 1 +#define CPP printf ("{\\%s \\%s}", cpp_font, yytext); hfillon = 1 +#define SYM(x) printf ("$\\%s$", x); hfillon = 1 +#define OUT(x) printf ("%s", x); hfillon = 1 +#define SUB(x) substitute(x) +#define IND indent(yytext); hfillon = 0 + +#include <stdio.h> + +#ifdef ANSI_C + #ifdef C_PLUSPLUS + #error ANSI_C and C_PLUSPLUS are mutually exclusive + #else + int cplusplus_mode = 0; + #endif +#else /* CPLUSPLUS or default */ + int cplusplus_mode = 1; +#endif + +int complete_file = 0; +int header = 0; +int tabtotab = 8; +int piped = 0; +char * font_size = "11"; +char * indentation = "0.5em"; +char * comment_font = "it"; +char * keyword_font = "bf"; +char * header_font = "sl"; +char * cpp_font = "tt"; +char * string_font = "tt"; +void substitute(const char *); +void indent(const char *); +void newpage(int); +void usage(const char *); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include <stdlib.h> +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = getc( yyin ); \ + result = c == EOF ? 0 : 1; \ + buf[0] = (char) c; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +# line 44 "c++2latex.l" + + + if (cplusplus_mode) + BEGIN (CPLUSPLUS); + + + if ( yy_init ) + { +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( yy_current_buffer ) + yy_init_buffer( yy_current_buffer, yyin ); + else + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + + yy_init = 0; + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + if ( yy_bp[-1] == '\n' ) + ++yy_current_state; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 537 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 977 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_USER_ACTION +# line 49 "c++2latex.l" +{ CPP; BEGIN (INCLUDE); } + YY_BREAK +case 2: +# line 51 "c++2latex.l" +case 3: +# line 52 "c++2latex.l" +case 4: +# line 53 "c++2latex.l" +case 5: +# line 54 "c++2latex.l" +case 6: +# line 55 "c++2latex.l" +case 7: +# line 56 "c++2latex.l" +case 8: +# line 57 "c++2latex.l" +case 9: +YY_USER_ACTION +# line 57 "c++2latex.l" +CPP; + YY_BREAK +case 10: +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ +yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_USER_ACTION +# line 59 "c++2latex.l" +{ OUT ("$<${\\"); OUT (string_font); + OUT ("{}"); SUB (yytext+1); OUT ("}$>$"); + input(); BEGIN (INITIAL); } + YY_BREAK +case 11: +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ +yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_USER_ACTION +# line 62 "c++2latex.l" +{ OUT ("\"{\\"); OUT (string_font); + OUT ("{}"); SUB (yytext+1); OUT ("}\""); + input(); BEGIN (INITIAL); } + YY_BREAK +case 12: +YY_USER_ACTION +# line 65 "c++2latex.l" +ECHO; + YY_BREAK +case 13: +YY_USER_ACTION +# line 66 "c++2latex.l" +OUT ("\\mbox{}\\\\\n"); + YY_BREAK +case 14: +YY_USER_ACTION +# line 67 "c++2latex.l" +{ yyless (0); BEGIN (INITIAL); } + YY_BREAK +case 15: +# line 70 "c++2latex.l" +case 16: +# line 71 "c++2latex.l" +case 17: +# line 72 "c++2latex.l" +case 18: +# line 73 "c++2latex.l" +case 19: +# line 74 "c++2latex.l" +case 20: +# line 75 "c++2latex.l" +case 21: +# line 76 "c++2latex.l" +case 22: +# line 77 "c++2latex.l" +case 23: +# line 78 "c++2latex.l" +case 24: +# line 79 "c++2latex.l" +case 25: +# line 80 "c++2latex.l" +case 26: +# line 81 "c++2latex.l" +case 27: +# line 82 "c++2latex.l" +case 28: +# line 83 "c++2latex.l" +case 29: +# line 84 "c++2latex.l" +case 30: +# line 85 "c++2latex.l" +case 31: +# line 86 "c++2latex.l" +case 32: +# line 87 "c++2latex.l" +case 33: +# line 88 "c++2latex.l" +case 34: +# line 89 "c++2latex.l" +case 35: +# line 90 "c++2latex.l" +case 36: +# line 91 "c++2latex.l" +case 37: +# line 92 "c++2latex.l" +case 38: +# line 93 "c++2latex.l" +case 39: +# line 94 "c++2latex.l" +case 40: +# line 95 "c++2latex.l" +case 41: +# line 96 "c++2latex.l" +case 42: +# line 97 "c++2latex.l" +case 43: +# line 98 "c++2latex.l" +case 44: +# line 99 "c++2latex.l" +case 45: +# line 100 "c++2latex.l" +case 46: +# line 101 "c++2latex.l" +case 47: +# line 102 "c++2latex.l" +case 48: +# line 103 "c++2latex.l" +case 49: +# line 104 "c++2latex.l" +case 50: +# line 105 "c++2latex.l" +case 51: +# line 106 "c++2latex.l" +case 52: +# line 107 "c++2latex.l" +case 53: +# line 108 "c++2latex.l" +case 54: +# line 109 "c++2latex.l" +case 55: +# line 110 "c++2latex.l" +case 56: +# line 111 "c++2latex.l" +case 57: +# line 112 "c++2latex.l" +case 58: +YY_USER_ACTION +# line 112 "c++2latex.l" +KEY; + YY_BREAK +case 59: +YY_USER_ACTION +# line 113 "c++2latex.l" +SYM ("rightarrow"); + YY_BREAK +case 60: +YY_USER_ACTION +# line 114 "c++2latex.l" +SYM ("ll"); + YY_BREAK +case 61: +YY_USER_ACTION +# line 115 "c++2latex.l" +SYM ("gg"); + YY_BREAK +case 62: +YY_USER_ACTION +# line 116 "c++2latex.l" +SYM ("leq"); + YY_BREAK +case 63: +YY_USER_ACTION +# line 117 "c++2latex.l" +SYM ("geq"); + YY_BREAK +case 64: +YY_USER_ACTION +# line 118 "c++2latex.l" +SYM ("neq"); + YY_BREAK +case 65: +YY_USER_ACTION +# line 119 "c++2latex.l" +SYM ("mid\\mid"); + YY_BREAK +case 66: +YY_USER_ACTION +# line 120 "c++2latex.l" +SYM ("ldots"); + YY_BREAK +case 67: +YY_USER_ACTION +# line 121 "c++2latex.l" +SYM ("ast="); + YY_BREAK +case 68: +YY_USER_ACTION +# line 122 "c++2latex.l" +SYM ("ll="); + YY_BREAK +case 69: +YY_USER_ACTION +# line 123 "c++2latex.l" +SYM ("gg="); + YY_BREAK +case 70: +YY_USER_ACTION +# line 124 "c++2latex.l" +SYM ("vee="); + YY_BREAK +case 71: +YY_USER_ACTION +# line 125 "c++2latex.l" +SYM ("mid="); + YY_BREAK +case 72: +YY_USER_ACTION +# line 126 "c++2latex.l" +SYM ("sim"); + YY_BREAK +case 73: +YY_USER_ACTION +# line 127 "c++2latex.l" +SYM ("ast"); + YY_BREAK +case 74: +YY_USER_ACTION +# line 128 "c++2latex.l" +SYM ("wedge"); + YY_BREAK +case 75: +YY_USER_ACTION +# line 129 "c++2latex.l" +SYM ("mid"); + YY_BREAK +case 76: +YY_USER_ACTION +# line 130 "c++2latex.l" +SYM ("rightarrow\\ast"); + YY_BREAK +case 77: +YY_USER_ACTION +# line 131 "c++2latex.l" +OUT ("$/$"); + YY_BREAK +case 78: +YY_USER_ACTION +# line 132 "c++2latex.l" +OUT ("$<$"); + YY_BREAK +case 79: +YY_USER_ACTION +# line 133 "c++2latex.l" +OUT ("$>$"); + YY_BREAK +case 80: +YY_USER_ACTION +# line 134 "c++2latex.l" +OUT ("\\&\\&"); + YY_BREAK +case 81: +YY_USER_ACTION +# line 135 "c++2latex.l" +OUT ("\\%="); + YY_BREAK +case 82: +YY_USER_ACTION +# line 136 "c++2latex.l" +OUT ("\\&="); + YY_BREAK +case 83: +YY_USER_ACTION +# line 137 "c++2latex.l" +OUT ("\\{"); + YY_BREAK +case 84: +YY_USER_ACTION +# line 138 "c++2latex.l" +OUT ("\\}"); + YY_BREAK +case 85: +YY_USER_ACTION +# line 139 "c++2latex.l" +OUT ("\\&"); + YY_BREAK +case 86: +YY_USER_ACTION +# line 140 "c++2latex.l" +OUT ("\\%"); + YY_BREAK +case 87: +YY_USER_ACTION +# line 141 "c++2latex.l" +OUT ("-{}-"); + YY_BREAK +case 88: +YY_USER_ACTION +# line 142 "c++2latex.l" +OUT (".$\\ast$"); + YY_BREAK +case 89: +# line 144 "c++2latex.l" +case 90: +# line 145 "c++2latex.l" +case 91: +# line 146 "c++2latex.l" +case 92: +# line 147 "c++2latex.l" +case 93: +# line 148 "c++2latex.l" +case 94: +# line 149 "c++2latex.l" +case 95: +# line 150 "c++2latex.l" +case 96: +# line 151 "c++2latex.l" +case 97: +# line 152 "c++2latex.l" +case 98: +# line 153 "c++2latex.l" +case 99: +# line 154 "c++2latex.l" +case 100: +# line 155 "c++2latex.l" +case 101: +# line 156 "c++2latex.l" +case 102: +# line 157 "c++2latex.l" +case 103: +# line 158 "c++2latex.l" +case 104: +# line 159 "c++2latex.l" +case 105: +# line 160 "c++2latex.l" +case 106: +# line 161 "c++2latex.l" +case 107: +YY_USER_ACTION +# line 161 "c++2latex.l" +ECHO; + YY_BREAK +case 108: +# line 164 "c++2latex.l" +case 109: +YY_USER_ACTION +# line 164 "c++2latex.l" +SUB (yytext); + YY_BREAK +case 110: +YY_USER_ACTION +# line 166 "c++2latex.l" +{ BEGIN (BCOMMENT); + OUT ("{$/\\ast$\\"); + OUT (comment_font); OUT ("{}"); } + YY_BREAK +case 111: +YY_USER_ACTION +# line 169 "c++2latex.l" +{ BEGIN (BCOMMENT); + if (hfillon==1) { OUT ("\\hfill"); } + OUT ("{$/\\ast$\\"); + OUT (comment_font); OUT ("{}"); } + YY_BREAK +case 112: +YY_USER_ACTION +# line 173 "c++2latex.l" +{ BEGIN (INITIAL); OUT ("$\\ast/$}"); } + YY_BREAK +case 113: +YY_USER_ACTION +# line 174 "c++2latex.l" +OUT ("\\mbox{}\\\\\n"); + YY_BREAK +case 114: +YY_USER_ACTION +# line 175 "c++2latex.l" +IND; + YY_BREAK +case 115: +YY_USER_ACTION +# line 176 "c++2latex.l" +SUB (yytext); + YY_BREAK +case 116: +YY_USER_ACTION +# line 179 "c++2latex.l" +{ BEGIN (STRING); OUT ("{\\"); + OUT (string_font); OUT ("\""); } + YY_BREAK +case 117: +YY_USER_ACTION +# line 181 "c++2latex.l" +OUT ("$\\backslash\\backslash$"); + YY_BREAK +case 118: +YY_USER_ACTION +# line 182 "c++2latex.l" +{ OUT ("$\\backslash$"); SUB (yytext+1); } + YY_BREAK +case 119: +YY_USER_ACTION +# line 183 "c++2latex.l" +{ BEGIN (INITIAL); OUT ("\"}"); } + YY_BREAK +case 120: +YY_USER_ACTION +# line 184 "c++2latex.l" +OUT ("\\mbox{}\\\\\n"); + YY_BREAK +case 121: +YY_USER_ACTION +# line 185 "c++2latex.l" +IND; + YY_BREAK +case 122: +YY_USER_ACTION +# line 186 "c++2latex.l" +SUB (yytext); + YY_BREAK +case 123: +# line 189 "c++2latex.l" +case 124: +# line 190 "c++2latex.l" +case 125: +# line 191 "c++2latex.l" +case 126: +YY_USER_ACTION +# line 191 "c++2latex.l" +ECHO; + YY_BREAK +case 127: +YY_USER_ACTION +# line 193 "c++2latex.l" +ECHO; + YY_BREAK +case 128: +YY_USER_ACTION +# line 195 "c++2latex.l" +SUB (yytext); + YY_BREAK +case 129: +# line 197 "c++2latex.l" +case 130: +# line 198 "c++2latex.l" +case 131: +YY_USER_ACTION +# line 198 "c++2latex.l" +ECHO; + YY_BREAK +case 132: +YY_USER_ACTION +# line 200 "c++2latex.l" +ECHO; + YY_BREAK +case 133: +YY_USER_ACTION +# line 202 "c++2latex.l" +ECHO; + YY_BREAK +case 134: +YY_USER_ACTION +# line 204 "c++2latex.l" +OUT ("$\\backslash$\\\\\n"); + YY_BREAK +case 135: +YY_USER_ACTION +# line 205 "c++2latex.l" +IND; + YY_BREAK +case 136: +YY_USER_ACTION +# line 206 "c++2latex.l" +ECHO; + YY_BREAK +case 137: +YY_USER_ACTION +# line 207 "c++2latex.l" +OUT ("\\newpage\n"); + YY_BREAK +case 138: +YY_USER_ACTION +# line 208 "c++2latex.l" +OUT ("\\mbox{}\\\\\n"); + YY_BREAK +case 139: +YY_USER_ACTION +# line 210 "c++2latex.l" +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(STRING): +case YY_STATE_EOF(BCOMMENT): +case YY_STATE_EOF(INCLUDE): +case YY_STATE_EOF(CPLUSPLUS): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr - 1; /* copy prev. char, too */ + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = yy_c_buf_p - yytext_ptr; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf; + + b->yy_buf_size *= 2; + b->yy_ch_buf = (char *) + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size ); + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move - YY_MORE_ADJ == 1 ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + /* yytext begins at the second character in yy_ch_buf; the first + * character is the one which preceded it before reading in the latest + * buffer; it needs to be kept around in case it's a newline, so + * yy_get_previous_state() will have with '^' rules active. + */ + + yytext_ptr = &yy_current_buffer->yy_ch_buf[1]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + register char *yy_bp = yytext_ptr; + + yy_current_state = yy_start; + if ( yy_bp[-1] == '\n' ) + ++yy_current_state; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 537 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 537 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 536); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += dest - source; + yy_bp += dest - source; + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) + yy_cp[-2] = '\n'; + + *--yy_cp = (char) c; + + + /* Note: the formal parameter *must* be called "yy_bp" for this + * macro to now work correctly. + */ + YY_DO_BEFORE_ACTION; /* set up yytext again */ + } + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } + + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( + "unexpected last match in input()" ); +#endif + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + yy_flex_free( (void *) b->yy_ch_buf ); + yy_flex_free( (void *) b ); + } + + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + { + b->yy_input_file = file; + + /* We put in the '\n' and start reading from [1] so that an + * initial match-at-newline will be true. + */ + + b->yy_ch_buf[0] = '\n'; + b->yy_n_chars = 1; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[1]; + + b->yy_is_interactive = file ? isatty( fileno(file) ) : 0; + + b->yy_fill_buffer = 1; + + b->yy_buffer_status = YY_BUFFER_NEW; + } + + +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + int new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } + + +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } + + +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } + + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( const char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( 1 ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, const char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +const char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( unsigned int size ) +#else +static void *yy_flex_alloc( size ) +unsigned int size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, unsigned int size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +unsigned int size; +#endif + { + return (void *) realloc( ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } +# line 210 "c++2latex.l" + + +void substitute (const char * input) +{ + while (*input) + { + switch (*input) + { + case '_': + case '&': + case '#': + case '$': + case '%': + case '{': + case '}': + printf ("\\%c", *input); + break; + case '+': + case '=': + case '<': + case '>': + printf ("$%c$", *input); + break; + case '*': + printf ("$\\ast$"); + break; + case '|': + printf ("$\\mid$"); + break; + case '\\': + printf ("$\\backslash$"); + break; + case '^': + printf ("$\\wedge$"); + break; + case '~': + printf ("$\\sim$"); + break; + default: + printf ("%c", *input); + break; + } + input++; + } +} + +void +indent(const char * blanks) +{ + int i; + + i = 0; + while (*blanks) + { + if (*blanks == ' ') + { + i++; + } + else /* *blanks == '\t' */ + { + while (++i % tabtotab) ; + } + blanks++; + } + printf ("\\hspace*{%d\\indentation}", i); +} + +#include "getopt.h" +#include <string.h> +#include <fcntl.h> +#include <malloc.h> + +extern char * version_string; + +static struct option opts[] = +{ + {"ansi-c", 0, 0, 'a'}, + {"c-plusplus", 0, 0, 'p'}, + {"complete-file", 0, 0, 'c'}, + {"font-size", 1, 0, 's'}, + {"indentation", 1, 0, 'i'}, + {"header", 0, 0, 'h'}, + {"piped", 0, 0, 't'}, + {"output", 1, 0, 'o'}, + {"tabstop", 1, 0, 'T'}, + {"comment-font", 1, 0, 'C'}, + {"string-font", 1, 0, 'S'}, + {"keyword-font", 1, 0, 'K'}, + {"header-font", 1, 0, 'H'}, + {"cpp-font", 1, 0, 'P'}, + {"version", 0, 0, 'V'}, + {0, 0, 0, 0} +}; + + +main (int argc, char** argv) +{ + int c; + int index; + int i; + int has_filename; + char * input_name; + char * output_name; + char * program_name; + + input_name = "Standard Input"; + output_name = 0; + + program_name = strrchr (argv[0], '/'); + if (program_name == NULL) /* no pathname */ + { + program_name = argv[0]; + } + else + { + program_name++; + } + +#ifdef USE_NAME +#if defined(ANSI_C) || defined(C_PLUSPLUS) +#error USE_NAME, ANSI_C and C_PLUSPLUS are mutually exclusive +#else + /* simple heuristic: '+' in name means C++ */ + cplusplus_mode = (strchr (program_name, '+') != 0); +#endif +#endif + + while ((c = getopt_long (argc, argv, + "acpo:s:i:thT:C:H:S:K:P:V", opts, &index)) + != EOF) + { + if (c == 0) /* Long option */ + { + c = opts[index].val; + } + switch (c) + { + case 'a': + cplusplus_mode = 0; + break; + case 'p': + cplusplus_mode = 1; + break; + case 'c': + complete_file = 1; + break; + case 'o': + if (piped) + { + fprintf (stderr, + "%s: Can't use {-t,+pipe} and {-o,+output} together\n", + program_name); + exit(5); + } + output_name = optarg; + break; + case 's': + font_size = optarg; + break; + case 'i': + indentation = optarg; + break; + case 'T': + tabtotab = atoi(optarg); + break; + case 't': + if (output_name != 0) + { + fprintf (stderr, + "%s: Can't use {-t,+pipe} and {-o,+output} together\n", + program_name); + exit(5); + } + piped = 1; + break; + case 'h': + header = 1; + complete_file = 1; /* header implies complete-file */ + break; + case 'C': + comment_font = optarg; + break; + case 'H': + header_font = optarg; + break; + case 'P': + cpp_font = optarg; + break; + case 'S': + string_font = optarg; + break; + case 'K': + keyword_font = optarg; + break; + case 'V': + fprintf (stderr, "%s\n", version_string); + break; + default: + usage(program_name); + } + } + has_filename = (argc - optind == 1); + if (has_filename) /* last argument is input file name */ + { + input_name = argv[optind]; + if (freopen (input_name, "r", stdin) == NULL) + { + fprintf (stderr, "%s: Can't open `%s' for reading\n", + program_name, input_name); + exit (2); + } + } + if ((output_name == 0) && !piped) + { + char * tmp; + if (has_filename) + { + char * point; + + point = strrchr (input_name, '/'); + if (point == 0) /* plain filename */ + { + point = input_name; + } + else + { + point++; + } + tmp = malloc (strlen (point) + 1); + if (tmp == 0) + { + fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); + exit (3); + } + strcpy (tmp, point); + point = strrchr (tmp, '.'); + if (point != 0) + { + *point = '\0'; + } + } + else + { + tmp = program_name; + } + output_name = malloc (strlen (tmp) + 4); + if (output_name == 0) + { + fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); + exit (3); + } + strcpy (output_name, tmp); + strcat (output_name, ".tex"); + } + if (!piped) + { + if (freopen (output_name, "w", stdout) == NULL) + { + fprintf (stderr, "%s: Can't open `%s' for writing\n", + program_name, output_name); + exit (4); + } + } + printf ("\ +%%\n\ +%% This file was automatically produced at " __DATE__ ", " __TIME__" by\n\ +%% %s", program_name); + for (i = 1; i < argc; i++) + { + printf(" %s", argv[i]); + } + if (!has_filename) + { + printf(" (from Standard Input)"); + } + printf("\n%%\n"); + if (complete_file) + { + if (header) + { + if (strcmp (font_size, "10") == 0) + { + printf ("\\documentstyle[fancyheadings]{article}\n"); + } + else + { + printf ("\\documentstyle[%spt,fancyheadings]{article}\n", + font_size); + } + } + else + { + if (strcmp (font_size, "10") == 0) + { + printf ("\\documentstyle{article}\n"); + } + else + { + printf ("\\documentstyle[%spt]{article}\n", font_size); + } + } + printf ("\\setlength{\\textwidth}{15cm}\n"); + printf ("\\setlength{\\textheight}{22.5cm}\n"); + printf ("\\setlength{\\hoffset}{-2cm}\n"); + printf ("\\setlength{\\voffset}{-2cm}\n"); + if (header) + { + printf ("\\chead{\\%s Produced from ", header_font); + substitute(input_name); + printf (" at " __DATE__ ", " __TIME__"}\n"); + printf ("\\cfoot{\\rm\\thepage}\n"); + printf ("\\addtolength{\\headheight}{14pt}\n"); + printf ("\\pagestyle{fancy}\n"); + } + printf ("\\begin{document}\n"); + } + printf ("\\expandafter\\ifx\\csname indentation\\endcsname\\relax%\n"); + printf ("\\newlength{\\indentation}\\fi\n"); + printf ("\\setlength{\\indentation}{%s}\n", indentation); + printf ("\\begin{flushleft}\n"); + yylex(); + printf ("\\end{flushleft}\n"); + if (complete_file) + { + printf ("\\end{document}\n"); + } +} + +void +usage(const char * name) +{ + fprintf (stderr, "%s\n", version_string); + fprintf (stderr, "\ +Usage: %s [-a] [-c] [-h] [-i length] [-o path] [-p] [-s size] [-t]\n\ + [-C font][-H font] [-K font] [-P font] [-S font] [-T wide] [-V]\n\ + [+ansi-c] [+complete-file] [+header] [+indentation length]\n\ + [+output path] [+c-plusplus] [+font-size size] [+pipe]\n\ + [+comment-font font] [+keyword-font font] [+cpp-font font]\n\ + [+header-font font] [+string-font font] [+tabstop wide]\n\ + [+version] [path]\n", name); + exit (1); +} + +yywrap(){} diff --git a/support/C++2LaTeX-1_1pl1/c++2latex.c.rebuild b/support/C++2LaTeX-1_1pl1/c++2latex.c.rebuild new file mode 100644 index 0000000000..5a215fc318 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/c++2latex.c.rebuild @@ -0,0 +1,2104 @@ +/* A lexical scanner generated by flex */ + +/* scanner skeleton version: + * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.10 90/03/27 12:03:55 vern Exp $ + */ + +#define FLEX_SCANNER + +#include <stdio.h> + + +#ifdef __cplusplus +#include <stdlib.h> +#include <osfcn.h> + +/* use prototypes in function declarations */ +#define YY_USE_PROTOS + +/* the "const" storage-class-modifier is valid */ +#define YY_USE_CONST + +#endif + +#ifdef __STDC__ +#define YY_USE_PROTOS +#define YY_USE_CONST +#endif + +#ifdef __TURBOC__ +#define YY_USE_CONST +#endif + + +#ifndef YY_USE_CONST +#define const +#endif + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +char *malloc( unsigned size ); +int free( char * ); +#else +#define YY_PROTO(proto) () +/* there's no standard place to get these definitions */ +char *malloc(); +int free(); +int read(); +#endif + +/* amount of stuff to slurp up with each read */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* returned upon end-of-file */ +#define YY_END_TOK 0 + +/* copy whatever the last rule matched to the standard output */ + +/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */ +/* this used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite() + */ +#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout ) + +/* gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#define YY_INPUT(buf,result,max_size) \ + if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "read() in flex scanner failed" ); +#define YY_NULL 0 + +/* no semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#define yyterminate() return ( YY_NULL ) + +/* report a fatal error */ +#define YY_FATAL_ERROR(msg) \ + { \ + (void) fputs( msg, stderr ); \ + (void) putc( '\n', stderr ); \ + exit( 1 ); \ + } + +/* default yywrap function - always treat EOF as an EOF */ +#define yywrap() 1 + +/* enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN + */ +#define BEGIN yy_start = 1 + 2 * + +/* action number for EOF rule of a given start state */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* special action meaning "start processing a new file" */ +#define YY_NEW_FILE { \ + yy_init_buffer( yy_current_buffer, yyin ); \ + yy_load_buffer_state(); \ + } + +/* default declaration of generated scanner - a define so the user can + * easily add parameters + */ +#define YY_DECL int yylex YY_PROTO(( void )) + +/* code executed at the end of each rule */ +#define YY_BREAK break; + +#define YY_END_OF_BUFFER_CHAR 0 + +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */ +#endif + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +#define YY_CHAR char +# line 1 "c++2latex.l" +#define INITIAL 0 +#define STRING 1 +#define BCOMMENT 2 +#define INCLUDE 3 +#define CPLUSPLUS 4 +# line 39 "c++2latex.l" +#define KEY printf ("{\\%s %s}", keyword_font, yytext) +#define CPP printf ("{\\%s \\%s}", cpp_font, yytext) +#define SYM(x) printf ("$\\%s$", x) +#define OUT(x) printf ("%s", x) +#define SUB(x) substitute(x) +#define IND indent(yytext) + +#include <stdio.h> + +#ifdef ANSI_C + #ifdef C_PLUSPLUS + #error ANSI_C and C_PLUSPLUS are mutually exclusive + #else + int cplusplus_mode = 0; + #endif +#else /* CPLUSPLUS or default */ + int cplusplus_mode = 1; +#endif + +int complete_file = 0; +int header = 0; +int tabtotab = 8; +int piped = 0; +char * font_size = "11"; +char * indentation = "0.5em"; +char * comment_font = "it"; +char * keyword_font = "bf"; +char * header_font = "sl"; +char * cpp_font = "tt"; +char * string_font = "tt"; +void substitute(const char *); +void indent(const char *); +void newpage(int); +void usage(const char *); +# line 75 "c++2latex.l" + +/* done after the current pattern has been matched and before the + * corresponding action - sets up yytext + */ +#define YY_DO_BEFORE_ACTION \ + yytext = yy_bp; \ + yyleng = yy_cp - yy_bp; \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* return all but the first 'n' matched characters back to the input stream */ +#define yyless(n) \ + { \ + /* undo effects of setting up yytext */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } + +#define unput(c) yyunput( c, yytext ) + + +struct yy_buffer_state + { + FILE *yy_input_file; + + YY_CHAR *yy_ch_buf; /* input buffer */ + YY_CHAR *yy_buf_pos; /* current position in input buffer */ + + /* size of input buffer in bytes, not including room for EOB characters*/ + int yy_buf_size; + + /* number of characters read into yy_ch_buf, not including EOB characters */ + int yy_n_chars; + + int yy_eof_status; /* whether we've seen an EOF on this buffer */ +#define EOF_NOT_SEEN 0 + /* "pending" happens when the EOF has been seen but there's still + * some text process + */ +#define EOF_PENDING 1 +#define EOF_DONE 2 + }; + +static YY_BUFFER_STATE yy_current_buffer; + +/* we provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state" + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed */ +static YY_CHAR yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + + +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +extern YY_CHAR *yytext; +extern int yyleng; +extern FILE *yyin, *yyout; + +YY_CHAR *yytext; +int yyleng; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +#define YY_END_OF_BUFFER 139 +typedef int yy_state_type; +static const short int yy_accept[535] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 139, 138, 135, 137, 136, 95, 115, 138, 86, 85, + 138, 103, 104, 73, 97, 92, 96, 93, 77, 126, + 126, 90, 94, 78, 91, 79, 89, 109, 109, 105, + 138, 106, 74, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 83, 75, + 84, 72, 134, 121, 119, 118, 121, 120, 114, 112, + 114, 113, 14, 12, 13, 14, 14, 108, 96, 93, + 90, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + + 108, 135, 136, 64, 0, 0, 0, 0, 0, 81, + 80, 82, 0, 0, 67, 100, 101, 87, 102, 59, + 0, 122, 110, 98, 123, 126, 126, 0, 126, 0, + 60, 62, 99, 63, 61, 109, 115, 0, 133, 70, + 109, 109, 109, 109, 109, 109, 43, 109, 109, 109, + 109, 109, 109, 44, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 71, 65, 134, 117, 116, + 120, 111, 113, 12, 0, 11, 0, 10, 108, 59, + 88, 107, 108, 108, 108, 108, 108, 108, 108, 108, + 43, 108, 108, 108, 108, 108, 108, 108, 44, 108, + + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 0, 0, 0, + 4, 0, 0, 127, 0, 127, 0, 0, 66, 0, + 122, 122, 0, 123, 126, 0, 124, 132, 68, 69, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, + 109, 36, 109, 17, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 76, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 36, 108, 108, 108, 17, 108, 47, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 129, 0, 0, 0, 124, 122, 0, 125, 132, 15, + 109, 23, 27, 109, 109, 109, 109, 20, 24, 109, + 109, 40, 21, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 38, 109, 109, 15, 108, 23, + 27, 108, 108, 108, 108, 108, 108, 20, 24, 108, + 108, 108, 40, 108, 21, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 49, 108, + 108, 108, 108, 38, 108, 108, 0, 7, 8, 0, + + 0, 0, 0, 0, 0, 130, 0, 19, 31, 109, + 109, 109, 109, 32, 109, 109, 33, 109, 109, 109, + 109, 109, 109, 30, 109, 109, 46, 19, 51, 31, + 108, 108, 108, 108, 108, 32, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 33, 108, 108, 108, 108, + 108, 108, 30, 108, 108, 108, 46, 0, 9, 5, + 0, 0, 3, 109, 109, 16, 28, 109, 29, 37, + 41, 45, 18, 22, 109, 109, 109, 108, 108, 48, + 16, 28, 56, 57, 108, 108, 108, 108, 52, 108, + 29, 37, 41, 45, 18, 22, 108, 108, 108, 108, + + 2, 6, 0, 109, 39, 109, 26, 109, 109, 108, + 39, 108, 108, 54, 108, 108, 26, 108, 55, 108, + 1, 35, 25, 34, 42, 35, 50, 58, 108, 25, + 34, 42, 53, 0 + } ; + +static const YY_CHAR yy_ec[128] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, + 22, 22, 22, 22, 22, 23, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 31, 31, 31, 32, 33, + 34, 34, 34, 34, 34, 35, 34, 34, 34, 34, + 34, 34, 34, 34, 36, 34, 34, 34, 34, 34, + 37, 38, 39, 40, 34, 30, 41, 42, 43, 44, + + 45, 46, 47, 48, 49, 34, 50, 51, 52, 53, + 54, 55, 34, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 1 + } ; + +static const YY_CHAR yy_meta[69] = + { 0, + 1, 1, 1, 1, 2, 2, 3, 2, 4, 2, + 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, + 6, 6, 7, 2, 2, 2, 2, 2, 3, 2, + 7, 7, 7, 8, 8, 8, 2, 3, 2, 2, + 6, 6, 7, 7, 7, 6, 8, 8, 8, 8, + 8, 8, 9, 8, 8, 9, 8, 9, 8, 9, + 8, 9, 8, 8, 2, 2, 2, 2 + } ; + +static const short int yy_base[548] = + { 0, + 0, 67, 67, 73, 68, 79, 83, 90, 108, 94, + 972, 973, 96, 973, 968, 943, 973, 129, 942, 62, + 930, 973, 973, 940, 75, 973, 85, 85, 95, 170, + 163, 973, 973, 88, 939, 91, 973, 0, 113, 973, + 962, 973, 937, 904, 906, 82, 79, 84, 94, 907, + 75, 906, 914, 152, 895, 904, 902, 907, 973, 111, + 973, 973, 174, 973, 973, 973, 197, 178, 973, 973, + 934, 185, 973, 192, 973, 946, 924, 0, 189, 204, + 927, 941, 221, 70, 91, 211, 202, 187, 215, 194, + 222, 209, 225, 227, 232, 228, 235, 237, 233, 245, + + 203, 256, 973, 973, 262, 904, 221, 244, 895, 973, + 973, 973, 935, 280, 973, 973, 973, 973, 973, 973, + 927, 282, 973, 973, 302, 322, 340, 348, 973, 0, + 918, 973, 973, 973, 917, 0, 973, 905, 973, 973, + 884, 896, 883, 898, 885, 891, 877, 878, 875, 875, + 878, 875, 872, 0, 871, 875, 231, 873, 213, 239, + 877, 870, 259, 230, 875, 973, 973, 307, 973, 973, + 308, 973, 317, 324, 916, 973, 894, 973, 0, 906, + 973, 973, 911, 321, 311, 289, 309, 327, 329, 342, + 330, 323, 331, 340, 343, 322, 346, 351, 910, 356, + + 365, 368, 374, 375, 377, 383, 385, 387, 391, 392, + 378, 393, 394, 395, 397, 396, 401, 872, 359, 873, + 368, 873, 871, 973, 902, 901, 401, 0, 973, 438, + 973, 441, 449, 973, 973, 413, 456, 445, 973, 973, + 858, 870, 865, 853, 382, 867, 865, 861, 853, 859, + 862, 0, 848, 0, 854, 851, 840, 842, 844, 851, + 837, 835, 835, 847, 837, 841, 845, 847, 836, 973, + 415, 442, 421, 402, 428, 437, 448, 466, 459, 473, + 475, 479, 481, 877, 484, 482, 488, 876, 491, 875, + 489, 490, 493, 494, 496, 499, 497, 498, 504, 505, + + 500, 501, 503, 506, 510, 508, 516, 511, 507, 523, + 517, 834, 836, 836, 831, 834, 834, 826, 831, 973, + 973, 509, 863, 512, 518, 973, 521, 549, 973, 0, + 824, 0, 0, 815, 823, 812, 819, 0, 0, 813, + 810, 0, 0, 810, 810, 807, 819, 809, 813, 818, + 817, 815, 805, 810, 0, 798, 810, 845, 540, 844, + 843, 519, 550, 557, 514, 558, 566, 842, 841, 565, + 568, 569, 840, 570, 839, 571, 573, 572, 574, 576, + 575, 577, 578, 582, 580, 579, 586, 587, 838, 591, + 584, 592, 583, 837, 585, 593, 792, 973, 973, 798, + + 797, 797, 782, 794, 827, 973, 826, 0, 0, 784, + 785, 790, 781, 0, 775, 779, 0, 787, 784, 786, + 770, 779, 781, 0, 772, 775, 0, 814, 813, 812, + 588, 589, 600, 601, 594, 811, 605, 606, 590, 596, + 595, 609, 611, 598, 602, 810, 622, 635, 648, 649, + 650, 651, 809, 652, 653, 654, 808, 771, 973, 973, + 769, 770, 973, 754, 754, 0, 0, 766, 0, 0, + 0, 0, 0, 0, 764, 764, 749, 655, 658, 790, + 787, 781, 775, 712, 656, 659, 661, 660, 695, 663, + 693, 692, 690, 688, 686, 684, 665, 664, 662, 666, + + 973, 973, 647, 645, 0, 633, 0, 643, 639, 667, + 673, 668, 671, 670, 674, 669, 419, 676, 408, 677, + 973, 0, 0, 0, 0, 406, 267, 236, 679, 172, + 166, 78, 68, 973, 725, 734, 743, 751, 755, 764, + 773, 779, 785, 792, 796, 798, 801 + } ; + +static const short int yy_def[548] = + { 0, + 534, 1, 535, 535, 536, 536, 537, 537, 1, 9, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 538, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 539, 539, 534, + 534, 534, 534, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 539, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 540, 541, 542, 534, 534, + 534, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + + 543, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 544, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 545, + 534, 534, 534, 534, 534, 539, 534, 538, 534, 534, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 540, 534, 541, 534, 542, 534, + 534, 534, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 546, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 545, 534, 534, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 534, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 547, 534, 534, 534, 534, 534, 534, 539, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 534, 534, 534, 534, + + 534, 534, 534, 534, 534, 534, 534, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 534, 534, 534, + 534, 534, 534, 539, 539, 539, 539, 539, 539, 539, + 539, 539, 539, 539, 539, 539, 539, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + + 534, 534, 534, 539, 539, 539, 539, 539, 539, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 534, 539, 539, 539, 539, 543, 543, 543, 543, 543, + 543, 543, 543, 0, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534 + } ; + +static const short int yy_nxt[1042] = + { 0, + 12, 13, 14, 15, 13, 16, 17, 18, 12, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 31, 32, 33, 34, 35, 36, 37, 12, + 38, 38, 38, 38, 39, 38, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 38, 51, 38, + 52, 38, 38, 38, 38, 53, 54, 55, 56, 57, + 58, 38, 38, 38, 59, 60, 61, 62, 63, 65, + 70, 63, 111, 66, 68, 65, 179, 68, 179, 66, + 72, 70, 71, 72, 74, 75, 179, 74, 112, 76, + 116, 74, 75, 71, 74, 63, 76, 102, 63, 179, + + 102, 117, 118, 121, 67, 122, 122, 122, 77, 123, + 67, 119, 120, 131, 132, 77, 78, 134, 135, 137, + 154, 124, 143, 146, 138, 79, 80, 155, 184, 144, + 105, 81, 147, 105, 148, 145, 149, 166, 82, 82, + 82, 82, 83, 82, 151, 150, 185, 152, 84, 85, + 86, 87, 88, 89, 90, 82, 91, 82, 92, 82, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 82, + 82, 82, 106, 107, 179, 168, 167, 108, 168, 171, + 179, 125, 171, 127, 127, 127, 173, 109, 125, 173, + 126, 126, 127, 174, 128, 179, 174, 129, 129, 158, + + 159, 128, 179, 169, 129, 129, 118, 128, 169, 160, + 179, 179, 161, 129, 128, 119, 180, 179, 181, 179, + 129, 129, 121, 179, 122, 122, 122, 137, 129, 179, + 179, 130, 138, 179, 170, 179, 179, 192, 169, 193, + 179, 179, 169, 179, 179, 179, 190, 198, 194, 169, + 217, 186, 169, 179, 169, 191, 169, 102, 187, 259, + 102, 188, 201, 105, 189, 195, 105, 199, 196, 202, + 197, 219, 207, 220, 200, 179, 260, 256, 267, 261, + 268, 203, 208, 209, 212, 214, 204, 205, 257, 221, + 206, 226, 210, 215, 262, 211, 222, 179, 216, 213, + + 227, 227, 122, 122, 122, 106, 107, 265, 168, 171, + 108, 168, 171, 230, 231, 266, 231, 179, 173, 179, + 109, 173, 232, 232, 232, 174, 230, 231, 174, 179, + 179, 179, 231, 233, 234, 179, 234, 179, 179, 179, + 125, 228, 126, 126, 127, 273, 233, 234, 179, 274, + 179, 179, 234, 128, 179, 272, 235, 235, 125, 179, + 127, 127, 127, 236, 179, 236, 128, 275, 237, 237, + 237, 128, 235, 179, 129, 129, 179, 284, 271, 280, + 235, 276, 179, 179, 128, 179, 179, 277, 279, 281, + 129, 179, 278, 179, 285, 179, 283, 282, 129, 179, + + 179, 179, 179, 179, 179, 179, 287, 313, 286, 179, + 179, 316, 321, 288, 179, 314, 179, 289, 291, 292, + 317, 322, 322, 179, 295, 293, 303, 179, 290, 179, + 294, 296, 301, 237, 237, 237, 179, 299, 334, 335, + 298, 304, 297, 306, 309, 179, 310, 302, 305, 311, + 179, 307, 308, 324, 300, 324, 179, 361, 325, 325, + 325, 232, 232, 232, 327, 360, 327, 179, 358, 328, + 328, 328, 128, 326, 179, 326, 237, 237, 237, 329, + 329, 179, 359, 179, 362, 128, 326, 179, 365, 179, + 179, 326, 179, 363, 364, 329, 179, 179, 179, 179, + + 367, 179, 179, 329, 179, 179, 179, 179, 179, 179, + 366, 179, 179, 179, 179, 179, 179, 368, 179, 179, + 321, 371, 179, 370, 179, 179, 369, 179, 372, 405, + 405, 179, 325, 325, 325, 373, 374, 375, 325, 325, + 325, 328, 328, 328, 376, 377, 380, 381, 179, 385, + 394, 379, 378, 383, 390, 382, 384, 386, 179, 387, + 388, 391, 389, 395, 392, 179, 179, 396, 393, 328, + 328, 328, 432, 179, 179, 429, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 428, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, + + 179, 179, 179, 179, 179, 431, 179, 430, 179, 179, + 179, 439, 441, 179, 179, 433, 434, 179, 442, 179, + 435, 437, 438, 440, 443, 436, 447, 449, 450, 451, + 179, 444, 445, 448, 452, 446, 453, 457, 454, 479, + 478, 455, 456, 179, 480, 481, 482, 485, 483, 486, + 484, 488, 487, 489, 491, 490, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 492, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, + 493, 179, 179, 525, 179, 179, 524, 179, 523, 522, + 494, 521, 179, 499, 179, 497, 179, 496, 179, 513, + + 179, 179, 500, 179, 498, 514, 495, 516, 518, 512, + 517, 526, 519, 510, 528, 511, 520, 515, 529, 531, + 179, 532, 533, 527, 530, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 113, 113, 113, 113, 113, 113, 113, 113, + 136, 136, 136, 136, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 179, 179, 179, 179, 179, 179, 183, 179, + 183, 183, 183, 183, 225, 179, 225, 225, 179, 509, + + 225, 238, 238, 323, 323, 407, 407, 407, 508, 507, + 506, 505, 504, 503, 502, 501, 179, 179, 179, 179, + 179, 179, 179, 477, 476, 475, 474, 473, 472, 471, + 470, 469, 468, 467, 466, 465, 464, 406, 321, 463, + 462, 461, 460, 459, 458, 179, 179, 179, 179, 179, + 179, 179, 179, 179, 427, 426, 425, 424, 423, 422, + 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, + 411, 410, 409, 408, 406, 404, 403, 402, 401, 400, + 399, 398, 397, 179, 179, 179, 357, 356, 355, 354, + 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, + + 343, 342, 341, 340, 339, 338, 337, 336, 333, 332, + 331, 330, 320, 320, 319, 318, 315, 312, 179, 179, + 270, 178, 176, 269, 264, 263, 258, 255, 254, 253, + 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 114, 240, 239, 229, 224, 223, 218, 179, + 182, 178, 176, 172, 165, 164, 163, 162, 157, 156, + 153, 142, 141, 140, 139, 133, 115, 114, 110, 104, + 103, 534, 11, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534 + } ; + +static const short int yy_chk[1042] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 5, 2, 20, 3, 4, 4, 533, 4, 84, 4, + 6, 6, 5, 6, 7, 7, 532, 7, 20, 7, + 25, 8, 8, 6, 8, 10, 8, 13, 10, 85, + + 13, 25, 27, 28, 3, 28, 28, 28, 7, 29, + 4, 27, 27, 34, 34, 8, 9, 36, 36, 39, + 51, 29, 46, 47, 39, 9, 9, 51, 84, 46, + 18, 9, 47, 18, 48, 46, 48, 60, 9, 9, + 9, 9, 9, 9, 49, 48, 85, 49, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 18, 18, 531, 63, 60, 18, 63, 68, + 530, 31, 68, 31, 31, 31, 72, 18, 30, 72, + 30, 30, 30, 74, 31, 88, 74, 31, 31, 54, + + 54, 30, 90, 67, 30, 30, 79, 31, 67, 54, + 87, 101, 54, 31, 30, 79, 79, 92, 80, 86, + 30, 31, 80, 89, 80, 80, 80, 83, 30, 83, + 91, 30, 83, 93, 67, 94, 96, 88, 67, 88, + 95, 99, 67, 97, 528, 98, 87, 90, 88, 67, + 101, 86, 67, 100, 67, 87, 67, 102, 86, 159, + 102, 86, 92, 105, 86, 89, 105, 91, 89, 93, + 89, 107, 96, 107, 91, 527, 159, 157, 164, 160, + 164, 94, 97, 97, 98, 99, 94, 95, 157, 108, + 95, 114, 97, 100, 160, 97, 108, 186, 100, 98, + + 114, 114, 122, 122, 122, 105, 105, 163, 168, 171, + 105, 168, 171, 122, 122, 163, 122, 187, 173, 185, + 105, 173, 125, 125, 125, 174, 122, 122, 174, 184, + 196, 192, 122, 125, 125, 188, 125, 189, 191, 193, + 126, 114, 126, 126, 126, 186, 125, 125, 194, 187, + 190, 195, 125, 126, 197, 185, 126, 126, 127, 198, + 127, 127, 127, 128, 200, 128, 126, 188, 128, 128, + 128, 127, 126, 201, 127, 127, 202, 196, 184, 192, + 126, 189, 203, 204, 127, 205, 211, 190, 191, 193, + 127, 206, 190, 207, 197, 208, 195, 194, 127, 209, + + 210, 212, 213, 214, 216, 215, 200, 219, 198, 217, + 274, 221, 227, 200, 526, 219, 519, 201, 203, 204, + 221, 227, 227, 271, 206, 205, 211, 517, 202, 273, + 205, 207, 210, 236, 236, 236, 275, 209, 245, 245, + 208, 212, 207, 214, 216, 276, 216, 210, 213, 217, + 272, 214, 215, 230, 209, 230, 277, 274, 230, 230, + 230, 232, 232, 232, 233, 273, 233, 279, 271, 233, + 233, 233, 232, 232, 278, 232, 237, 237, 237, 238, + 238, 280, 272, 281, 275, 232, 232, 282, 277, 283, + 286, 232, 285, 276, 276, 238, 287, 291, 292, 289, + + 279, 293, 294, 238, 295, 297, 298, 296, 301, 302, + 278, 303, 299, 300, 304, 309, 306, 280, 305, 308, + 322, 283, 365, 282, 307, 311, 281, 362, 285, 322, + 322, 310, 324, 324, 324, 286, 287, 289, 325, 325, + 325, 327, 327, 327, 291, 292, 295, 296, 359, 300, + 309, 294, 293, 298, 305, 297, 299, 301, 363, 302, + 303, 306, 304, 310, 307, 364, 366, 311, 308, 328, + 328, 328, 365, 370, 367, 362, 371, 372, 374, 376, + 378, 377, 379, 381, 380, 382, 383, 386, 385, 359, + 384, 393, 391, 395, 387, 388, 431, 432, 439, 390, + + 392, 396, 435, 441, 440, 364, 444, 363, 433, 434, + 445, 376, 378, 437, 438, 366, 367, 442, 379, 443, + 370, 372, 374, 377, 380, 371, 384, 386, 387, 388, + 447, 381, 382, 385, 390, 383, 391, 396, 392, 432, + 431, 393, 395, 448, 433, 434, 435, 439, 437, 440, + 438, 442, 441, 443, 445, 444, 449, 450, 451, 452, + 454, 455, 456, 478, 485, 447, 479, 486, 488, 487, + 499, 490, 498, 497, 500, 510, 512, 516, 514, 513, + 448, 511, 515, 509, 518, 520, 508, 529, 506, 504, + 449, 503, 496, 455, 495, 452, 494, 451, 493, 486, + + 492, 491, 456, 489, 454, 487, 450, 490, 498, 485, + 497, 510, 499, 478, 513, 479, 500, 488, 515, 518, + 484, 520, 529, 512, 516, 535, 535, 535, 535, 535, + 535, 535, 535, 535, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 537, 537, 537, 537, 537, 537, 537, + 537, 537, 538, 538, 538, 538, 538, 538, 538, 538, + 539, 539, 539, 539, 540, 540, 540, 540, 540, 540, + 540, 540, 540, 541, 541, 541, 541, 541, 541, 541, + 541, 541, 542, 483, 542, 542, 542, 542, 543, 482, + 543, 543, 543, 543, 544, 481, 544, 544, 480, 477, + + 544, 545, 545, 546, 546, 547, 547, 547, 476, 475, + 468, 465, 464, 462, 461, 458, 457, 453, 446, 436, + 430, 429, 428, 426, 425, 423, 422, 421, 420, 419, + 418, 416, 415, 413, 412, 411, 410, 407, 405, 404, + 403, 402, 401, 400, 397, 394, 389, 375, 373, 369, + 368, 361, 360, 358, 357, 356, 354, 353, 352, 351, + 350, 349, 348, 347, 346, 345, 344, 341, 340, 337, + 336, 335, 334, 331, 323, 319, 318, 317, 316, 315, + 314, 313, 312, 290, 288, 284, 269, 268, 267, 266, + 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, + + 255, 253, 251, 250, 249, 248, 247, 246, 244, 243, + 242, 241, 226, 225, 223, 222, 220, 218, 199, 183, + 180, 177, 175, 165, 162, 161, 158, 156, 155, 153, + 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, + 142, 141, 138, 135, 131, 121, 113, 109, 106, 82, + 81, 77, 76, 71, 58, 57, 56, 55, 53, 52, + 50, 45, 44, 43, 41, 35, 24, 21, 19, 16, + 15, 11, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534 + } ; + +/* the intent behind this definition is that it'll catch + * any uses of REJECT which flex missed + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 + +/* these variables are all declared out here so that section 3 code can + * manipulate them + */ +/* points to current character in buffer */ +static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +static yy_state_type yy_last_accepting_state; +static YY_CHAR *yy_last_accepting_cpos; + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr )); +void yyrestart YY_PROTO(( FILE *input_file )); +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); + +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif + +YY_DECL + { + register yy_state_type yy_current_state; + register YY_CHAR *yy_cp, *yy_bp; + register int yy_act; + + + + if (cplusplus_mode) + BEGIN (CPLUSPLUS); + + + + if ( yy_init ) + { + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( yy_current_buffer ) + yy_init_buffer( yy_current_buffer, yyin ); + else + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + + yy_init = 0; + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* support of yytext */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of the + * current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + if ( yy_bp[-1] == '\n' ) + ++yy_current_state; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[*yy_cp]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = yy_def[yy_current_state]; + if ( yy_current_state >= 535 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 534 ); + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + YY_USER_ACTION; + +do_action: /* this label is used only to access EOF actions */ + + + switch ( yy_act ) + { + case 0: /* must backtrack */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +# line 81 "c++2latex.l" +{ CPP; BEGIN (INCLUDE); } + YY_BREAK +case 2: +# line 83 "c++2latex.l" +case 3: +# line 84 "c++2latex.l" +case 4: +# line 85 "c++2latex.l" +case 5: +# line 86 "c++2latex.l" +case 6: +# line 87 "c++2latex.l" +case 7: +# line 88 "c++2latex.l" +case 8: +# line 89 "c++2latex.l" +case 9: +# line 89 "c++2latex.l" +CPP; + YY_BREAK +case 10: +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ +yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +# line 91 "c++2latex.l" +{ OUT ("$<${\\"); OUT (string_font); + OUT ("{}"); SUB (yytext+1); OUT ("}$>$"); + input(); BEGIN (INITIAL); } + YY_BREAK +case 11: +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ +yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +# line 94 "c++2latex.l" +{ OUT ("\"{\\"); OUT (string_font); + OUT ("{}"); SUB (yytext+1); OUT ("}\""); + input(); BEGIN (INITIAL); } + YY_BREAK +case 12: +# line 97 "c++2latex.l" +ECHO; + YY_BREAK +case 13: +# line 98 "c++2latex.l" +OUT ("\\mbox{}\\\\\n"); + YY_BREAK +case 14: +# line 99 "c++2latex.l" +{ yyless (0); BEGIN (INITIAL); } + YY_BREAK +case 15: +# line 102 "c++2latex.l" +case 16: +# line 103 "c++2latex.l" +case 17: +# line 104 "c++2latex.l" +case 18: +# line 105 "c++2latex.l" +case 19: +# line 106 "c++2latex.l" +case 20: +# line 107 "c++2latex.l" +case 21: +# line 108 "c++2latex.l" +case 22: +# line 109 "c++2latex.l" +case 23: +# line 110 "c++2latex.l" +case 24: +# line 111 "c++2latex.l" +case 25: +# line 112 "c++2latex.l" +case 26: +# line 113 "c++2latex.l" +case 27: +# line 114 "c++2latex.l" +case 28: +# line 115 "c++2latex.l" +case 29: +# line 116 "c++2latex.l" +case 30: +# line 117 "c++2latex.l" +case 31: +# line 118 "c++2latex.l" +case 32: +# line 119 "c++2latex.l" +case 33: +# line 120 "c++2latex.l" +case 34: +# line 121 "c++2latex.l" +case 35: +# line 122 "c++2latex.l" +case 36: +# line 123 "c++2latex.l" +case 37: +# line 124 "c++2latex.l" +case 38: +# line 125 "c++2latex.l" +case 39: +# line 126 "c++2latex.l" +case 40: +# line 127 "c++2latex.l" +case 41: +# line 128 "c++2latex.l" +case 42: +# line 129 "c++2latex.l" +case 43: +# line 130 "c++2latex.l" +case 44: +# line 131 "c++2latex.l" +case 45: +# line 132 "c++2latex.l" +case 46: +# line 133 "c++2latex.l" +case 47: +# line 134 "c++2latex.l" +case 48: +# line 135 "c++2latex.l" +case 49: +# line 136 "c++2latex.l" +case 50: +# line 137 "c++2latex.l" +case 51: +# line 138 "c++2latex.l" +case 52: +# line 139 "c++2latex.l" +case 53: +# line 140 "c++2latex.l" +case 54: +# line 141 "c++2latex.l" +case 55: +# line 142 "c++2latex.l" +case 56: +# line 143 "c++2latex.l" +case 57: +# line 144 "c++2latex.l" +case 58: +# line 144 "c++2latex.l" +KEY; + YY_BREAK +case 59: +# line 145 "c++2latex.l" +SYM ("rightarrow"); + YY_BREAK +case 60: +# line 146 "c++2latex.l" +SYM ("ll"); + YY_BREAK +case 61: +# line 147 "c++2latex.l" +SYM ("gg"); + YY_BREAK +case 62: +# line 148 "c++2latex.l" +SYM ("leq"); + YY_BREAK +case 63: +# line 149 "c++2latex.l" +SYM ("geq"); + YY_BREAK +case 64: +# line 150 "c++2latex.l" +SYM ("neq"); + YY_BREAK +case 65: +# line 151 "c++2latex.l" +SYM ("mid\\mid"); + YY_BREAK +case 66: +# line 152 "c++2latex.l" +SYM ("ldots"); + YY_BREAK +case 67: +# line 153 "c++2latex.l" +SYM ("ast="); + YY_BREAK +case 68: +# line 154 "c++2latex.l" +SYM ("ll="); + YY_BREAK +case 69: +# line 155 "c++2latex.l" +SYM ("gg="); + YY_BREAK +case 70: +# line 156 "c++2latex.l" +SYM ("vee="); + YY_BREAK +case 71: +# line 157 "c++2latex.l" +SYM ("mid="); + YY_BREAK +case 72: +# line 158 "c++2latex.l" +SYM ("sim"); + YY_BREAK +case 73: +# line 159 "c++2latex.l" +SYM ("ast"); + YY_BREAK +case 74: +# line 160 "c++2latex.l" +SYM ("wedge"); + YY_BREAK +case 75: +# line 161 "c++2latex.l" +SYM ("mid"); + YY_BREAK +case 76: +# line 162 "c++2latex.l" +SYM ("rightarrow\\ast"); + YY_BREAK +case 77: +# line 163 "c++2latex.l" +OUT ("$/$"); + YY_BREAK +case 78: +# line 164 "c++2latex.l" +OUT ("$<$"); + YY_BREAK +case 79: +# line 165 "c++2latex.l" +OUT ("$>$"); + YY_BREAK +case 80: +# line 166 "c++2latex.l" +OUT ("\\&\\&"); + YY_BREAK +case 81: +# line 167 "c++2latex.l" +OUT ("\\%="); + YY_BREAK +case 82: +# line 168 "c++2latex.l" +OUT ("\\&="); + YY_BREAK +case 83: +# line 169 "c++2latex.l" +OUT ("\\{"); + YY_BREAK +case 84: +# line 170 "c++2latex.l" +OUT ("\\}"); + YY_BREAK +case 85: +# line 171 "c++2latex.l" +OUT ("\\&"); + YY_BREAK +case 86: +# line 172 "c++2latex.l" +OUT ("\\%"); + YY_BREAK +case 87: +# line 173 "c++2latex.l" +OUT ("-{}-"); + YY_BREAK +case 88: +# line 174 "c++2latex.l" +OUT (".$\\ast$"); + YY_BREAK +case 89: +# line 176 "c++2latex.l" +case 90: +# line 177 "c++2latex.l" +case 91: +# line 178 "c++2latex.l" +case 92: +# line 179 "c++2latex.l" +case 93: +# line 180 "c++2latex.l" +case 94: +# line 181 "c++2latex.l" +case 95: +# line 182 "c++2latex.l" +case 96: +# line 183 "c++2latex.l" +case 97: +# line 184 "c++2latex.l" +case 98: +# line 185 "c++2latex.l" +case 99: +# line 186 "c++2latex.l" +case 100: +# line 187 "c++2latex.l" +case 101: +# line 188 "c++2latex.l" +case 102: +# line 189 "c++2latex.l" +case 103: +# line 190 "c++2latex.l" +case 104: +# line 191 "c++2latex.l" +case 105: +# line 192 "c++2latex.l" +case 106: +# line 193 "c++2latex.l" +case 107: +# line 193 "c++2latex.l" +ECHO; + YY_BREAK +case 108: +# line 196 "c++2latex.l" +case 109: +# line 196 "c++2latex.l" +SUB (yytext); + YY_BREAK +case 110: +# line 198 "c++2latex.l" +{ BEGIN (BCOMMENT); OUT ("{$/\\ast$\\"); + OUT (comment_font); OUT ("{}"); } + YY_BREAK +case 111: +# line 200 "c++2latex.l" +{ BEGIN (INITIAL); OUT ("$\\ast/$}"); } + YY_BREAK +case 112: +# line 201 "c++2latex.l" +OUT ("\\mbox{}\\\\\n"); + YY_BREAK +case 113: +# line 202 "c++2latex.l" +IND; + YY_BREAK +case 114: +# line 203 "c++2latex.l" +SUB (yytext); + YY_BREAK +case 115: +# line 206 "c++2latex.l" +{ BEGIN (STRING); OUT ("{\\"); + OUT (string_font); OUT ("\""); } + YY_BREAK +case 116: +# line 208 "c++2latex.l" +OUT ("$\\backslash\\backslash$"); + YY_BREAK +case 117: +# line 209 "c++2latex.l" +{ OUT ("$\\backslash$"); SUB (yytext+1); } + YY_BREAK +case 118: +# line 210 "c++2latex.l" +{ BEGIN (INITIAL); OUT ("\"}"); } + YY_BREAK +case 119: +# line 211 "c++2latex.l" +OUT ("\\mbox{}\\\\\n"); + YY_BREAK +case 120: +# line 212 "c++2latex.l" +IND; + YY_BREAK +case 121: +# line 213 "c++2latex.l" +SUB (yytext); + YY_BREAK +case 122: +# line 216 "c++2latex.l" +case 123: +# line 217 "c++2latex.l" +case 124: +# line 218 "c++2latex.l" +case 125: +# line 218 "c++2latex.l" +ECHO; + YY_BREAK +case 126: +# line 220 "c++2latex.l" +ECHO; + YY_BREAK +case 127: +# line 222 "c++2latex.l" +SUB (yytext); + YY_BREAK +case 128: +# line 224 "c++2latex.l" +case 129: +# line 225 "c++2latex.l" +case 130: +# line 225 "c++2latex.l" +ECHO; + YY_BREAK +case 131: +# line 227 "c++2latex.l" +ECHO; + YY_BREAK +case 132: +# line 229 "c++2latex.l" +ECHO; + YY_BREAK +case 133: +# line 231 "c++2latex.l" +OUT ("$\\backslash$\\\\\n"); + YY_BREAK +case 134: +# line 232 "c++2latex.l" +IND; + YY_BREAK +case 135: +# line 233 "c++2latex.l" +ECHO; + YY_BREAK +case 136: +# line 234 "c++2latex.l" +OUT ("\\newpage\n"); + YY_BREAK +case 137: +# line 235 "c++2latex.l" +OUT ("\\mbox{}\\\\\n"); + YY_BREAK +case 138: +# line 237 "c++2latex.l" +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(STRING): +case YY_STATE_EOF(BCOMMENT): +case YY_STATE_EOF(INCLUDE): +case YY_STATE_EOF(CPLUSPLUS): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* amount of text matched not including the EOB char */ + int yy_amount_of_matched_text = yy_cp - yytext - 1; + + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + + /* note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the end- + * of-buffer state). Contrast this with the test in yyinput(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* this was really a NUL */ + { + yy_state_type yy_next_state; + + yy_c_buf_p = yytext + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* okay, we're now positioned to make the + * NUL transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we + * don't want to build jamming into it because + * then it will run more slowly) + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* consume the NUL */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + /* note: because we've taken care in + * yy_get_next_buffer() to have set up yytext, + * we can now set up yy_c_buf_p so that if some + * total hoser (like flex itself) wants + * to call the scanner after we return the + * YY_NULL, it'll still work - another YY_NULL + * will get returned. + */ + yy_c_buf_p = yytext + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF((yy_start - 1) / 2); + goto do_action; + } + + else + YY_NEW_FILE; + } + break; + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: +#ifdef FLEX_DEBUG + printf( "action # %d\n", yy_act ); +#endif + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } + } + } + + +/* yy_get_next_buffer - try to read in a new buffer + * + * synopsis + * int yy_get_next_buffer(); + * + * returns a code representing an action + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + + { + register YY_CHAR *dest = yy_current_buffer->yy_ch_buf; + register YY_CHAR *source = yytext - 1; /* copy prev. char, too */ + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + /* try to read more data */ + + /* first move last chars to start of buffer */ + number_to_move = yy_c_buf_p - yytext; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + else if ( num_to_read <= 0 ) + YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); + + /* read in more data */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == 1 ) + { + ret_val = EOB_ACT_END_OF_FILE; + yy_current_buffer->yy_eof_status = EOF_DONE; + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_eof_status = EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + /* yytext begins at the second character in yy_ch_buf; the first + * character is the one which preceded it before reading in the latest + * buffer; it needs to be kept around in case it's a newline, so + * yy_get_previous_state() will have with '^' rules active + */ + + yytext = &yy_current_buffer->yy_ch_buf[1]; + + return ( ret_val ); + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached + * + * synopsis + * yy_state_type yy_get_previous_state(); + */ + +static yy_state_type yy_get_previous_state() + + { + register yy_state_type yy_current_state; + register YY_CHAR *yy_cp; + + register YY_CHAR *yy_bp = yytext; + + yy_current_state = yy_start; + if ( yy_bp[-1] == '\n' ) + ++yy_current_state; + + for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = yy_def[yy_current_state]; + if ( yy_current_state >= 535 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return ( yy_current_state ); + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +register yy_state_type yy_current_state; +#endif + + { + register int yy_is_jam; + register YY_CHAR *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = yy_def[yy_current_state]; + if ( yy_current_state >= 535 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 534); + + return ( yy_is_jam ? 0 : yy_current_state ); + } + + +#ifdef YY_USE_PROTOS +static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp ) +#else +static void yyunput( c, yy_bp ) +YY_CHAR c; +register YY_CHAR *yy_bp; +#endif + + { + register YY_CHAR *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ + register YY_CHAR *dest = + &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; + register YY_CHAR *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += dest - source; + yy_bp += dest - source; + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) + yy_cp[-2] = '\n'; + + *--yy_cp = c; + + /* note: the formal parameter *must* be called "yy_bp" for this + * macro to now work correctly + */ + YY_DO_BEFORE_ACTION; /* set up yytext again */ + } + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + + { + int c; + YY_CHAR *yy_cp = yy_c_buf_p; + + *yy_cp = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* this was really a NUL */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = yytext + YY_MORE_ADJ; + return ( EOF ); + } + + YY_NEW_FILE; + +#ifdef __cplusplus + return ( yyinput() ); +#else + return ( input() ); +#endif + } + break; + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( "unexpected last match in input()" ); +#endif + } + } + } + + c = *yy_c_buf_p; + yy_hold_char = *++yy_c_buf_p; + + return ( c ); + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + + { + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* flush out information for old buffer */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); + + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + yy_init_buffer( b, file ); + + return ( b ); + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + free( (char *) b->yy_ch_buf ); + free( (char *) b ); + } + + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + { + b->yy_input_file = file; + + /* we put in the '\n' and start reading from [1] so that an + * initial match-at-newline will be true. + */ + + b->yy_ch_buf[0] = '\n'; + b->yy_n_chars = 1; + + /* we always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[1]; + + b->yy_eof_status = EOF_NOT_SEEN; + } +# line 237 "c++2latex.l" + + +void substitute (const char * input) +{ + while (*input) + { + switch (*input) + { + case '_': + case '&': + case '#': + case '$': + case '%': + case '{': + case '}': + printf ("\\%c", *input); + break; + case '+': + case '=': + case '<': + case '>': + printf ("$%c$", *input); + break; + case '*': + printf ("$\\ast$"); + break; + case '|': + printf ("$\\mid$"); + break; + case '\\': + printf ("$\\backslash$"); + break; + case '^': + printf ("$\\wedge$"); + break; + case '~': + printf ("$\\sim$"); + break; + default: + printf ("%c", *input); + break; + } + input++; + } +} + +void +indent(const char * blanks) +{ + int i; + + i = 0; + while (*blanks) + { + if (*blanks == ' ') + { + i++; + } + else /* *blanks == '\t' */ + { + while (++i % tabtotab) ; + } + blanks++; + } + printf ("\\hspace*{%d\\indentation}", i); +} + +#include "getopt.h" +#include <string.h> +#include <fcntl.h> +#include <malloc.h> + +extern char * version_string; + +static struct option opts[] = +{ + {"ansi-c", 0, 0, 'a'}, + {"c-plusplus", 0, 0, 'p'}, + {"complete-file", 0, 0, 'c'}, + {"font-size", 1, 0, 's'}, + {"indentation", 1, 0, 'i'}, + {"header", 0, 0, 'h'}, + {"piped", 0, 0, 't'}, + {"output", 1, 0, 'o'}, + {"tabstop", 1, 0, 'T'}, + {"comment-font", 1, 0, 'C'}, + {"string-font", 1, 0, 'S'}, + {"keyword-font", 1, 0, 'K'}, + {"header-font", 1, 0, 'H'}, + {"cpp-font", 1, 0, 'P'}, + {"version", 0, 0, 'V'}, + {0, 0, 0, 0} +}; + + +main (int argc, char** argv) +{ + int c; + int index; + int i; + int has_filename; + char * input_name; + char * output_name; + char * program_name; + + input_name = "Standard Input"; + output_name = 0; + + program_name = strrchr (argv[0], '/'); + if (program_name == NULL) /* no pathname */ + { + program_name = argv[0]; + } + else + { + program_name++; + } + +#ifdef USE_NAME +#if defined(ANSI_C) || defined(C_PLUSPLUS) +#error USE_NAME, ANSI_C and C_PLUSPLUS are mutually exclusive +#else + /* simple heuristic: '+' in name means C++ */ + cplusplus_mode = (strchr (program_name, '+') != 0); +#endif +#endif + + while ((c = getopt_long (argc, argv, + "acpo:s:i:thT:C:H:S:K:P:V", opts, &index)) + != EOF) + { + if (c == 0) /* Long option */ + { + c = opts[index].val; + } + switch (c) + { + case 'a': + cplusplus_mode = 0; + break; + case 'p': + cplusplus_mode = 1; + break; + case 'c': + complete_file = 1; + break; + case 'o': + if (piped) + { + fprintf (stderr, + "%s: Can't use {-t,+pipe} and {-o,+output} together\n", + program_name); + exit(5); + } + output_name = optarg; + break; + case 's': + font_size = optarg; + break; + case 'i': + indentation = optarg; + break; + case 'T': + tabtotab = atoi(optarg); + break; + case 't': + if (output_name != 0) + { + fprintf (stderr, + "%s: Can't use {-t,+pipe} and {-o,+output} together\n", + program_name); + exit(5); + } + piped = 1; + break; + case 'h': + header = 1; + complete_file = 1; /* header implies complete-file */ + break; + case 'C': + comment_font = optarg; + break; + case 'H': + header_font = optarg; + break; + case 'P': + cpp_font = optarg; + break; + case 'S': + string_font = optarg; + break; + case 'K': + keyword_font = optarg; + break; + case 'V': + fprintf (stderr, "%s\n", version_string); + break; + default: + usage(program_name); + } + } + has_filename = (argc - optind == 1); + if (has_filename) /* last argument is input file name */ + { + input_name = argv[optind]; + if (freopen (input_name, "r", stdin) == NULL) + { + fprintf (stderr, "%s: Can't open `%s' for reading\n", + program_name, input_name); + exit (2); + } + } + if ((output_name == 0) && !piped) + { + char * tmp; + if (has_filename) + { + char * point; + + point = strrchr (input_name, '/'); + if (point == 0) /* plain filename */ + { + point = input_name; + } + else + { + point++; + } + tmp = malloc (strlen (point) + 1); + if (tmp == 0) + { + fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); + exit (3); + } + strcpy (tmp, point); + point = strrchr (tmp, '.'); + if (point != 0) + { + *point = '\0'; + } + } + else + { + tmp = program_name; + } + output_name = malloc (strlen (tmp) + 4); + if (output_name == 0) + { + fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); + exit (3); + } + strcpy (output_name, tmp); + strcat (output_name, ".tex"); + } + if (!piped) + { + if (freopen (output_name, "w", stdout) == NULL) + { + fprintf (stderr, "%s: Can't open `%s' for writing\n", + program_name, output_name); + exit (4); + } + } + printf ("\ +%%\n\ +%% This file was automatically produced at " __DATE__ ", " __TIME__" by\n\ +%% %s", program_name); + for (i = 1; i < argc; i++) + { + printf(" %s", argv[i]); + } + if (!has_filename) + { + printf(" (from Standard Input)"); + } + printf("\n%%\n"); + if (complete_file) + { + if (header) + { + if (strcmp (font_size, "10") == 0) + { + printf ("\\documentstyle[fancyheadings]{article}\n"); + } + else + { + printf ("\\documentstyle[%spt,fancyheadings]{article}\n", + font_size); + } + } + else + { + if (strcmp (font_size, "10") == 0) + { + printf ("\\documentstyle{article}\n"); + } + else + { + printf ("\\documentstyle[%spt]{article}\n", font_size); + } + } + printf ("\\setlength{\\textwidth}{15cm}\n"); + printf ("\\setlength{\\textheight}{22.5cm}\n"); + printf ("\\setlength{\\hoffset}{-2cm}\n"); + printf ("\\setlength{\\voffset}{-2cm}\n"); + if (header) + { + printf ("\\chead{\\%s Produced from ", header_font); + substitute(input_name); + printf (" at " __DATE__ ", " __TIME__"}\n"); + printf ("\\cfoot{\\rm\\thepage}\n"); + printf ("\\addtolength{\\headheight}{14pt}\n"); + printf ("\\pagestyle{fancy}\n"); + } + printf ("\\begin{document}\n"); + } + printf ("\\expandafter\\ifx\\csname indentation\\endcsname\\relax%\n"); + printf ("\\newlength{\\indentation}\\fi\n"); + printf ("\\setlength{\\indentation}{%s}\n", indentation); + printf ("\\begin{flushleft}\n"); + yylex(); + printf ("\\end{flushleft}\n"); + if (complete_file) + { + printf ("\\end{document}\n"); + } +} + +void +usage(const char * name) +{ + fprintf (stderr, "%s\n", version_string); + fprintf (stderr, "\ +Usage: %s [-a] [-c] [-h] [-i length] [-o path] [-p] [-s size] [-t]\n\ + [-C font][-H font] [-K font] [-P font] [-S font] [-T wide] [-V]\n\ + [+ansi-c] [+complete-file] [+header] [+indentation length]\n\ + [+output path] [+c-plusplus] [+font-size size] [+pipe]\n\ + [+comment-font font] [+keyword-font font] [+cpp-font font]\n\ + [+header-font font] [+string-font font] [+tabstop wide]\n\ + [+version] [path]\n", name); + exit (1); +} diff --git a/support/C++2LaTeX-1_1pl1/c++2latex.l b/support/C++2LaTeX-1_1pl1/c++2latex.l new file mode 100644 index 0000000000..ab8d836b59 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/c++2latex.l @@ -0,0 +1,553 @@ + +%x STRING BCOMMENT INCLUDE +%s CPLUSPLUS + +%{ +int hfillon = 0; + +#define KEY printf ("{\\%s %s}", keyword_font, yytext); hfillon = 1 +#define CPP printf ("{\\%s \\%s}", cpp_font, yytext); hfillon = 1 +#define SYM(x) printf ("$\\%s$", x); hfillon = 1 +#define OUT(x) printf ("%s", x); hfillon = 1 +#define SUB(x) substitute(x) +#define IND indent(yytext); hfillon = 0 + +#include <stdio.h> + +#ifdef ANSI_C + #ifdef C_PLUSPLUS + #error ANSI_C and C_PLUSPLUS are mutually exclusive + #else + int cplusplus_mode = 0; + #endif +#else /* CPLUSPLUS or default */ + int cplusplus_mode = 1; +#endif + +int complete_file = 0; +int header = 0; +int tabtotab = 8; +int piped = 0; +char * font_size = "11"; +char * indentation = "0.5em"; +char * comment_font = "it"; +char * keyword_font = "bf"; +char * header_font = "sl"; +char * cpp_font = "tt"; +char * string_font = "tt"; +void substitute(const char *); +void indent(const char *); +void newpage(int); +void usage(const char *); +%} + +%% + + if (cplusplus_mode) + BEGIN (CPLUSPLUS); + +"#"[ \t]*"include" { CPP; BEGIN (INCLUDE); } +"#"[ \t]*"define" | +"#"[ \t]*"undef" | +"#"[ \t]*"if" | +"#"[ \t]*"ifdef" | +"#"[ \t]*"ifndef" | +"#"[ \t]*"elif" | +"#"[ \t]*"else" | +"#"[ \t]*"endif" CPP; + +<INCLUDE>"<"[^>]*/">" { OUT ("$<${\\"); OUT (string_font); + OUT ("{}"); SUB (yytext+1); OUT ("}$>$"); + input(); BEGIN (INITIAL); } +<INCLUDE>\"[^\"]*/\" { OUT ("\"{\\"); OUT (string_font); + OUT ("{}"); SUB (yytext+1); OUT ("}\""); + input(); BEGIN (INITIAL); } +<INCLUDE>[ \t]+ ECHO; +<INCLUDE>[\n] OUT ("\\mbox{}\\\\\n"); +<INCLUDE>. { yyless (0); BEGIN (INITIAL); } + +"auto" | +"double" | +"int" | +"struct" | +"break" | +"else" | +"long" | +"switch" | +"case" | +"enum" | +"register" | +"typedef" | +"char" | +"extern" | +"return" | +"union" | +"const" | +"float" | +"short" | +"unsigned" | +"continue" | +"for" | +"signed" | +"void" | +"default" | +"goto" | +"sizeof" | +"volatile" | +"do" | +"if" | +"static" | +"while" | +<CPLUSPLUS>"new" | +<CPLUSPLUS>"delete" | +<CPLUSPLUS>"this" | +<CPLUSPLUS>"operator" | +<CPLUSPLUS>"class" | +<CPLUSPLUS>"public" | +<CPLUSPLUS>"protected" | +<CPLUSPLUS>"private" | +<CPLUSPLUS>"virtual" | +<CPLUSPLUS>"friend" | +<CPLUSPLUS>"inline" | +<CPLUSPLUS>"overload" KEY; +"->" SYM ("rightarrow"); +"<<" SYM ("ll"); +">>" SYM ("gg"); +"<=" SYM ("leq"); +">=" SYM ("geq"); +"!=" SYM ("neq"); +"||" SYM ("mid\\mid"); +"..." SYM ("ldots"); +"*=" SYM ("ast="); +"<<=" SYM ("ll="); +">>=" SYM ("gg="); +"^=" SYM ("vee="); +"|=" SYM ("mid="); +"~" SYM ("sim"); +"*" SYM ("ast"); +"^" SYM ("wedge"); +"|" SYM ("mid"); +<CPLUSPLUS>"->*" SYM ("rightarrow\\ast"); +"/" OUT ("$/$"); +"<" OUT ("$<$"); +">" OUT ("$>$"); +"&&" OUT ("\\&\\&"); +"%=" OUT ("\\%="); +"&=" OUT ("\\&="); +"{" OUT ("\\{"); +"}" OUT ("\\}"); +"&" OUT ("\\&"); +"%" OUT ("\\%"); +"--" OUT ("-{}-"); +<CPLUSPLUS>".*" OUT (".$\\ast$"); +"?" | +":" | +"=" | +"," | +"." | +";" | +"!" | +"-" | +"+" | +"/=" | +"==" | +"++" | +"+=" | +"-=" | +"(" | +")" | +"[" | +"]" | +<CPLUSPLUS>"::" ECHO; + +<CPLUSPLUS>[a-zA-Z_$][a-zA-Z_$0-9]* | +[a-zA-Z_][a-zA-Z_0-9]* SUB (yytext); + +^"/*" { BEGIN (BCOMMENT); + OUT ("{$/\\ast$\\"); + OUT (comment_font); OUT ("{}"); } +"/*" { BEGIN (BCOMMENT); + if (hfillon==1) { OUT ("\\hfill"); } + OUT ("{$/\\ast$\\"); + OUT (comment_font); OUT ("{}"); } +<BCOMMENT>"*/" { BEGIN (INITIAL); OUT ("$\\ast/$}"); } +<BCOMMENT>"\n" OUT ("\\mbox{}\\\\\n"); +<BCOMMENT>^[ \t]+ IND; +<BCOMMENT>. SUB (yytext); + + +L?\" { BEGIN (STRING); OUT ("{\\"); + OUT (string_font); OUT ("\""); } +<STRING>\\\\ OUT ("$\\backslash\\backslash$"); +<STRING>\\[bfnrtv'"] { OUT ("$\\backslash$"); SUB (yytext+1); } +<STRING>\" { BEGIN (INITIAL); OUT ("\"}"); } +<STRING>"\n" OUT ("\\mbox{}\\\\\n"); +<STRING>^[ \t]+ IND; +<STRING>. SUB (yytext); + +([0-9]*\.[0-9]+[fFlL]?) | +([0-9]+\.[0-9]*[fFlL]?) | +([0-9]*\.?[0-9]+[eE][+-]?[0-9]+) | +([0-9]+\.?[0-9]*[eE][+-]?[0-9]+) ECHO; + +[0-9]+[uUlL]? ECHO; + +L?'[ -~]' SUB (yytext); +L?'\\[ntvbrfa\\?'"]' | +L?'\\[0-7]{1,3}' | +L?'\\x[0-9a-fA-F]{1,2}' ECHO; + +0[0-7]+[uUlL]? ECHO; + +0x[0-9a-fA-F]+[uUlL]? ECHO; + +"\\\n" OUT ("$\\backslash$\\\\\n"); +^[ \t]+ IND; +[ \t]+ ECHO; +"\f"[\n]? OUT ("\\newpage\n"); +"\n" OUT ("\\mbox{}\\\\\n"); + +%% + +void substitute (const char * input) +{ + while (*input) + { + switch (*input) + { + case '_': + case '&': + case '#': + case '$': + case '%': + case '{': + case '}': + printf ("\\%c", *input); + break; + case '+': + case '=': + case '<': + case '>': + printf ("$%c$", *input); + break; + case '*': + printf ("$\\ast$"); + break; + case '|': + printf ("$\\mid$"); + break; + case '\\': + printf ("$\\backslash$"); + break; + case '^': + printf ("$\\wedge$"); + break; + case '~': + printf ("$\\sim$"); + break; + default: + printf ("%c", *input); + break; + } + input++; + } +} + +void +indent(const char * blanks) +{ + int i; + + i = 0; + while (*blanks) + { + if (*blanks == ' ') + { + i++; + } + else /* *blanks == '\t' */ + { + while (++i % tabtotab) ; + } + blanks++; + } + printf ("\\hspace*{%d\\indentation}", i); +} + +#include "getopt.h" +#include <string.h> +#include <fcntl.h> +#include <malloc.h> + +extern char * version_string; + +static struct option opts[] = +{ + {"ansi-c", 0, 0, 'a'}, + {"c-plusplus", 0, 0, 'p'}, + {"complete-file", 0, 0, 'c'}, + {"font-size", 1, 0, 's'}, + {"indentation", 1, 0, 'i'}, + {"header", 0, 0, 'h'}, + {"piped", 0, 0, 't'}, + {"output", 1, 0, 'o'}, + {"tabstop", 1, 0, 'T'}, + {"comment-font", 1, 0, 'C'}, + {"string-font", 1, 0, 'S'}, + {"keyword-font", 1, 0, 'K'}, + {"header-font", 1, 0, 'H'}, + {"cpp-font", 1, 0, 'P'}, + {"version", 0, 0, 'V'}, + {0, 0, 0, 0} +}; + + +main (int argc, char** argv) +{ + int c; + int index; + int i; + int has_filename; + char * input_name; + char * output_name; + char * program_name; + + input_name = "Standard Input"; + output_name = 0; + + program_name = strrchr (argv[0], '/'); + if (program_name == NULL) /* no pathname */ + { + program_name = argv[0]; + } + else + { + program_name++; + } + +#ifdef USE_NAME +#if defined(ANSI_C) || defined(C_PLUSPLUS) +#error USE_NAME, ANSI_C and C_PLUSPLUS are mutually exclusive +#else + /* simple heuristic: '+' in name means C++ */ + cplusplus_mode = (strchr (program_name, '+') != 0); +#endif +#endif + + while ((c = getopt_long (argc, argv, + "acpo:s:i:thT:C:H:S:K:P:V", opts, &index)) + != EOF) + { + if (c == 0) /* Long option */ + { + c = opts[index].val; + } + switch (c) + { + case 'a': + cplusplus_mode = 0; + break; + case 'p': + cplusplus_mode = 1; + break; + case 'c': + complete_file = 1; + break; + case 'o': + if (piped) + { + fprintf (stderr, + "%s: Can't use {-t,+pipe} and {-o,+output} together\n", + program_name); + exit(5); + } + output_name = optarg; + break; + case 's': + font_size = optarg; + break; + case 'i': + indentation = optarg; + break; + case 'T': + tabtotab = atoi(optarg); + break; + case 't': + if (output_name != 0) + { + fprintf (stderr, + "%s: Can't use {-t,+pipe} and {-o,+output} together\n", + program_name); + exit(5); + } + piped = 1; + break; + case 'h': + header = 1; + complete_file = 1; /* header implies complete-file */ + break; + case 'C': + comment_font = optarg; + break; + case 'H': + header_font = optarg; + break; + case 'P': + cpp_font = optarg; + break; + case 'S': + string_font = optarg; + break; + case 'K': + keyword_font = optarg; + break; + case 'V': + fprintf (stderr, "%s\n", version_string); + break; + default: + usage(program_name); + } + } + has_filename = (argc - optind == 1); + if (has_filename) /* last argument is input file name */ + { + input_name = argv[optind]; + if (freopen (input_name, "r", stdin) == NULL) + { + fprintf (stderr, "%s: Can't open `%s' for reading\n", + program_name, input_name); + exit (2); + } + } + if ((output_name == 0) && !piped) + { + char * tmp; + if (has_filename) + { + char * point; + + point = strrchr (input_name, '/'); + if (point == 0) /* plain filename */ + { + point = input_name; + } + else + { + point++; + } + tmp = malloc (strlen (point) + 1); + if (tmp == 0) + { + fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); + exit (3); + } + strcpy (tmp, point); + point = strrchr (tmp, '.'); + if (point != 0) + { + *point = '\0'; + } + } + else + { + tmp = program_name; + } + output_name = malloc (strlen (tmp) + 4); + if (output_name == 0) + { + fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); + exit (3); + } + strcpy (output_name, tmp); + strcat (output_name, ".tex"); + } + if (!piped) + { + if (freopen (output_name, "w", stdout) == NULL) + { + fprintf (stderr, "%s: Can't open `%s' for writing\n", + program_name, output_name); + exit (4); + } + } + printf ("\ +%%\n\ +%% This file was automatically produced at " __DATE__ ", " __TIME__" by\n\ +%% %s", program_name); + for (i = 1; i < argc; i++) + { + printf(" %s", argv[i]); + } + if (!has_filename) + { + printf(" (from Standard Input)"); + } + printf("\n%%\n"); + if (complete_file) + { + if (header) + { + if (strcmp (font_size, "10") == 0) + { + printf ("\\documentstyle[fancyheadings]{article}\n"); + } + else + { + printf ("\\documentstyle[%spt,fancyheadings]{article}\n", + font_size); + } + } + else + { + if (strcmp (font_size, "10") == 0) + { + printf ("\\documentstyle{article}\n"); + } + else + { + printf ("\\documentstyle[%spt]{article}\n", font_size); + } + } + printf ("\\setlength{\\textwidth}{15cm}\n"); + printf ("\\setlength{\\textheight}{22.5cm}\n"); + printf ("\\setlength{\\hoffset}{-2cm}\n"); + printf ("\\setlength{\\voffset}{-2cm}\n"); + if (header) + { + printf ("\\chead{\\%s Produced from ", header_font); + substitute(input_name); + printf (" at " __DATE__ ", " __TIME__"}\n"); + printf ("\\cfoot{\\rm\\thepage}\n"); + printf ("\\addtolength{\\headheight}{14pt}\n"); + printf ("\\pagestyle{fancy}\n"); + } + printf ("\\begin{document}\n"); + } + printf ("\\expandafter\\ifx\\csname indentation\\endcsname\\relax%\n"); + printf ("\\newlength{\\indentation}\\fi\n"); + printf ("\\setlength{\\indentation}{%s}\n", indentation); + printf ("\\begin{flushleft}\n"); + yylex(); + printf ("\\end{flushleft}\n"); + if (complete_file) + { + printf ("\\end{document}\n"); + } +} + +void +usage(const char * name) +{ + fprintf (stderr, "%s\n", version_string); + fprintf (stderr, "\ +Usage: %s [-a] [-c] [-h] [-i length] [-o path] [-p] [-s size] [-t]\n\ + [-C font][-H font] [-K font] [-P font] [-S font] [-T wide] [-V]\n\ + [+ansi-c] [+complete-file] [+header] [+indentation length]\n\ + [+output path] [+c-plusplus] [+font-size size] [+pipe]\n\ + [+comment-font font] [+keyword-font font] [+cpp-font font]\n\ + [+header-font font] [+string-font font] [+tabstop wide]\n\ + [+version] [path]\n", name); + exit (1); +} + +yywrap(){} diff --git a/support/C++2LaTeX-1_1pl1/c++2latex.o b/support/C++2LaTeX-1_1pl1/c++2latex.o Binary files differnew file mode 100644 index 0000000000..6683ad41d2 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/c++2latex.o diff --git a/support/C++2LaTeX-1_1pl1/flex-patch b/support/C++2LaTeX-1_1pl1/flex-patch new file mode 100644 index 0000000000..dc15f90e12 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/flex-patch @@ -0,0 +1,19 @@ +*** scan.l~ Tue Mar 20 20:38:59 1990 +--- scan.l Fri Mar 30 13:13:58 1990 +*************** +*** 89,95 **** + Char nmdef[MAXLINE], myesc(); + + ^{WS} indented_code = true; BEGIN(CODEBLOCK); +! ^#.*\n ++linenum; ECHO; /* treat as a comment */ + ^"/*" ECHO; BEGIN(C_COMMENT); + ^"%s"{NAME}? return ( SCDECL ); + ^"%x"{NAME}? return ( XSCDECL ); +--- 89,95 ---- + Char nmdef[MAXLINE], myesc(); + + ^{WS} indented_code = true; BEGIN(CODEBLOCK); +! ^#.*\n ++linenum; /* treat as a comment */ + ^"/*" ECHO; BEGIN(C_COMMENT); + ^"%s"{NAME}? return ( SCDECL ); + ^"%x"{NAME}? return ( XSCDECL ); diff --git a/support/C++2LaTeX-1_1pl1/getopt.aux b/support/C++2LaTeX-1_1pl1/getopt.aux new file mode 100644 index 0000000000..f23e54680b --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt.aux @@ -0,0 +1 @@ +\relax diff --git a/support/C++2LaTeX-1_1pl1/getopt.c b/support/C++2LaTeX-1_1pl1/getopt.c new file mode 100644 index 0000000000..9a0b48b8c2 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt.c @@ -0,0 +1,565 @@ +/* Getopt for GNU. + Copyright (C) 1987, 1989 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of `argv' so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable _POSIX_OPTION_ORDER disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include <stdio.h> + +/* If compiled with GNU C, use the built-in alloca */ +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not __GNUC__ */ +#ifdef sparc +#include <alloca.h> +#else +char *alloca (); +#endif +#endif /* not __GNUC__ */ + +#ifdef USG +#define bcopy(s, d, l) memcpy((d), (s), (l)) +#define index strchr +#endif + +char *getenv (); +char *index (); +char *malloc (); + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = 0; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + _POSIX_OPTION_ORDER is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options. + Stop option processing when the first non-option is seen. + This is what Unix does. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code one. + Using `-' as the first character of the list of option characters + requests this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; + +/* Describe the long-named options requested by the application. + _GETOPT_LONG_OPTIONS is a vector of `struct option' terminated by an + element containing a name which is zero. + The field `has_arg' is 1 if the option takes an argument, + 2 if it takes an optional argument. */ + +struct option +{ + char *name; + int has_arg; + int *flag; + int val; +}; + +struct option *_getopt_long_options; + +int _getopt_long_only = 0; + +#if 0 +/* This is an ugly kludge. Programs should use the opt_index argument + to getopt_long instead. */ +/* Name of long-named option actually found. */ + +char *_getopt_option_name; +#endif + +/* Index in _GETOPT_LONG_OPTIONS of the long-named option actually found. + Only valid when a long-named option was found. */ + +int option_index; + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +static void +exchange (argv) + char **argv; +{ + int nonopts_size + = (last_nonopt - first_nonopt) * sizeof (char *); + char **temp = (char **) alloca (nonopts_size); + + /* Interchange the two blocks of data in argv. */ + + bcopy (&argv[first_nonopt], temp, nonopts_size); + bcopy (&argv[last_nonopt], &argv[first_nonopt], + (optind - last_nonopt) * sizeof (char *)); + bcopy (temp, &argv[first_nonopt + optind - last_nonopt], + nonopts_size); + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-', it requests a different method of handling the + non-option ARGV-elements. See the comments about RETURN_IN_ORDER, above. + + Long-named options begin with `+' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + `getopt' returns 0 when it finds a long-named option. */ + +int +getopt (argc, argv, optstring) + int argc; + char **argv; + char *optstring; +{ + optarg = 0; + + /* Initialize the internal data when the first call is made. + Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + if (optind == 0) + { + first_nonopt = last_nonopt = optind = 1; + + nextchar = 0; + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + ordering = RETURN_IN_ORDER; + else if (getenv ("_POSIX_OPTION_ORDER") != 0) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + } + + if (nextchar == 0 || *nextchar == 0) + { + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange (argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Now skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc + && (argv[optind][0] != '-' + || argv[optind][1] == 0) + && (_getopt_long_options == 0 + || argv[optind][0] != '+' + || argv[optind][1] == 0)) + optind++; + last_nonopt = optind; + } + + /* Special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange (argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if ((argv[optind][0] != '-' || argv[optind][1] == 0) + && (_getopt_long_options == 0 + || argv[optind][0] != '+' || argv[optind][1] == 0)) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; +#if 0 + _getopt_option_name = 0; +#endif + return 1; + } + + /* We have found another option-ARGV-element. + Start decoding its characters. */ + + nextchar = argv[optind] + 1; + } + + if (_getopt_long_options != 0 + && (argv[optind][0] == '+' + || (_getopt_long_only && argv[optind][0] == '-')) + ) + { + struct option *p; + char *s = nextchar; + int exact = 0; + int ambig = 0; + struct option *pfound = 0; + int indfound; + + while (*s && *s != '=') s++; + + /* Test all options for either exact match or abbreviated matches. */ + for (p = _getopt_long_options, option_index = 0; p->name; + p++, option_index++) + if (!strncmp (p->name, nextchar, s - nextchar)) + { + if (s - nextchar == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == 0) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + fprintf (stderr, "%s: option `%s' is ambiguous\n", + argv[0], argv[optind]); + nextchar += strlen (nextchar); + return '?'; + } + + if (pfound != 0) + { + option_index = indfound; + optind++; + if (*s) + { + if (pfound->has_arg > 0) + optarg = s + 1; + else + { + fprintf (stderr, + "%s: option `%c%s' doesn't allow an argument\n", + argv[0], argv[optind - 1][0], pfound->name); + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg) + { + if (optind < argc) + optarg = argv[optind++]; + else if (pfound->has_arg != 2) + { + fprintf (stderr, "%s: option `%s' requires an argument\n", + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return '?'; + } + } +#if 0 + _getopt_option_name = pfound->name; +#endif + nextchar += strlen (nextchar); + if (pfound->flag) + *(pfound->flag) = pfound->val; + return 0; + } + /* Can't find it as a long option. If this is getopt_long_only, + and the option starts with '-' and is a valid short + option, then interpret it as a short option. Otherwise it's + an error. */ + if (_getopt_long_only == 0 || argv[optind][0] == '+' || + index (optstring, *nextchar) == 0) + { + if (opterr != 0) + fprintf (stderr, "%s: unrecognized option `%c%s'\n", + argv[0], argv[optind][0], nextchar); + nextchar += strlen (nextchar); + return '?'; + } + } + + /* Look at and handle the next option-character. */ + + { + char c = *nextchar++; + char *temp = index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == 0) + optind++; + + if (temp == 0 || c == ':') + { + if (opterr != 0) + { + if (c < 040 || c >= 0177) + fprintf (stderr, "%s: unrecognized option, character code 0%o\n", + argv[0], c); + else + fprintf (stderr, "%s: unrecognized option `-%c'\n", + argv[0], c); + } + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != 0) + { + optarg = nextchar; + optind++; + } + else + optarg = 0; + nextchar = 0; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != 0) + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr != 0) + fprintf (stderr, "%s: option `-%c' requires an argument\n", + argv[0], c); + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = 0; + } + } + return c; + } +} + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + char c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind; + if ((c = getopt (argc, argv, "abc:d:0123456789")) == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + return 0; +} + +#endif /* TEST */ diff --git a/support/C++2LaTeX-1_1pl1/getopt.dvi b/support/C++2LaTeX-1_1pl1/getopt.dvi Binary files differnew file mode 100644 index 0000000000..4f179be785 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt.dvi diff --git a/support/C++2LaTeX-1_1pl1/getopt.h b/support/C++2LaTeX-1_1pl1/getopt.h new file mode 100644 index 0000000000..6f179255c7 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt.h @@ -0,0 +1,92 @@ +/* declarations for getopt + Copyright (C) 1989 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Describe the long-named options requested by the application. + _GETOPT_LONG_OPTIONS is a vector of `struct option' terminated by an + element containing a name which is zero. + The field `has_arg' is: + 0 if the option does not take an argument, + 1 if the option requires an argument, + 2 if the option takes an optional argument. + If the field `flag' is nonzero, it points to a variable that is set to + the value given in the field `val' when the option is found, but + left unchanged if the option is not found. */ + +struct option +{ + char *name; + int has_arg; + int *flag; + int val; +}; + +extern struct option *_getopt_long_options; + +/* If nonzero, tell getopt that '-' means a long option. + Set by getopt_long_only. */ +extern int _getopt_long_only; + +#if 0 +/* Name of long-named option actually found. + Only changed when a long-named option is found. + Set to zero when returning a non-option arg in `optarg'. */ + +extern char *_getopt_option_name; +#endif + +/* The index in GETOPT_LONG_OPTIONS of the long-named option found. + Only valid when a long-named option has been found by the most + recent call to `getopt'. */ + +extern int option_index; + +#ifdef __STDC__ +int getopt (int, char **, char *); +int getopt_long (int, char **, char *, struct option *, int *); +int getopt_long_only (int, char **, char *, struct option *, int *); +#else +int getopt (); +int getopt_long (); +int getopt_long_only (); +#endif diff --git a/support/C++2LaTeX-1_1pl1/getopt.log b/support/C++2LaTeX-1_1pl1/getopt.log new file mode 100644 index 0000000000..7b0496f414 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt.log @@ -0,0 +1,112 @@ +This is TeX, Version 3.1415 (C version 6.1) (format=latex 95.6.13) 2 SEP 1995 14:14 +**getopt.tex +(getopt.tex +LaTeX2e <1994/06/01> patch level 4 +Hyphenation patterns for english, german, loaded. +(/usr/tetex/texmf/tex/latex/base/latex209.def +File: latex209.def 1994/09/23 Standard LaTeX file + +Entering LaTeX 2.09 compatibility mode. +\footheight=\dimen102 +\@maxsep=\dimen103 +\@dblmaxsep=\dimen104 +(/usr/tetex/texmf/tex/latex/base/tracefnt.sty +Package: tracefnt 1994/05/29 v2.3k Standard LaTeX package (font tracing) +\tracingfonts=\count82 +LaTeX Info: Redefining \selectfont on input line 113. +) +\symbold=\mathgroup4 +\symsans=\mathgroup5 +\symtypewriter=\mathgroup6 +\symitalic=\mathgroup7 +\symsmallcaps=\mathgroup8 +\symslanted=\mathgroup9 +LaTeX Font Info: Redeclaring math alphabet \mathbf on input line 180. +LaTeX Font Info: Redeclaring math alphabet \mathsf on input line 181. +LaTeX Font Info: Redeclaring math alphabet \mathtt on input line 182. +LaTeX Font Info: Redeclaring math alphabet \mathit on input line 188. +LaTeX Info: Redefining \em on input line 198. + +(/usr/tetex/texmf/tex/latex/base/latexsym.sty +Package: latexsym 1994/05/27 v2.1e Standard LaTeX package (lasy symbols) +\symlasy=\mathgroup10 +LaTeX Font Info: Overwriting symbol font `lasy' in version `bold' +(Font) U/lasy/m/n --> U/lasy/b/n on input line 47. +) +LaTeX Font Info: Redeclaring math delimiter \lgroup on input line 263. +LaTeX Font Info: Redeclaring math delimiter \rgroup on input line 265. +LaTeX Font Info: Redeclaring math delimiter \bracevert on input line 267. + +(/usr/tetex/texmf/tex/latex/local/latex209.cfg +(/usr/tetex/texmf/tex/latex/tools/rawfonts.sty +Compatibility mode: package `' requested, but `rawfonts' provided. +Package: rawfonts 1994/05/08 Low-level LaTeX 2.09 font compatibility + +(/usr/tetex/texmf/tex/latex/tools/somedefs.sty +Package: somedefs 1994/06/01 Toolkit for optional definitions +) +LaTeX Font Info: Try loading font information for U+lasy on input line 30. + +(/usr/tetex/texmf/tex/latex/base/Ulasy.fd +File: Ulasy.fd 1994/05/27 v2.1eLaTeX symbol font definitions +)))) +(/usr/tetex/texmf/tex/latex/base/article.cls +Document Class: article 1994/07/13 v1.2u Standard LaTeX document class +(/usr/tetex/texmf/tex/latex/base/size11.clo +File: size11.clo 1994/07/13 v1.2u Standard LaTeX file (size option) +) +\c@part=\count83 +\c@section=\count84 +\c@subsection=\count85 +\c@subsubsection=\count86 +\c@paragraph=\count87 +\c@subparagraph=\count88 +\c@figure=\count89 +\c@table=\count90 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +Compatibility mode: definition of \rm ignored. +Compatibility mode: definition of \sf ignored. +Compatibility mode: definition of \tt ignored. +Compatibility mode: definition of \bf ignored. +Compatibility mode: definition of \it ignored. +Compatibility mode: definition of \sl ignored. +Compatibility mode: definition of \sc ignored. +\bibindent=\dimen105 +) (getopt.aux) +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 10. +LaTeX Font Info: ... okay on input line 10. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 10. +LaTeX Font Info: ... okay on input line 10. +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 10. +LaTeX Font Info: ... okay on input line 10. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 10. +LaTeX Font Info: ... okay on input line 10. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 10. +LaTeX Font Info: ... okay on input line 10. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 10. +LaTeX Font Info: ... okay on input line 10. +LaTeX Info: Redefining \" on input line 10. +LaTeX Info: Redefining \" on input line 10. +\indentation=\skip43 +LaTeX Font Info: No math setup on input line 15. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <10.95> on input line 15. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line 15. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line 15. + [1 + +] [2] [3] [4] +[5] [6] [7] [8] [9] [10] [11] [12] [13] [14] (getopt.aux) ) +Here is how much of TeX's memory you used: + 513 strings out of 11020 + 5146 string characters out of 74434 + 50615 words of memory out of 262141 + 3312 multiletter control sequences out of 9500 + 22500 words of font info for 84 fonts, out of 100000 for 255 + 14 hyphenation exceptions out of 607 + 21i,5n,21p,306b,199s stack positions out of 300i,40n,60p,3000b,4000s + +Output written on getopt.dvi (14 pages, 25328 bytes). diff --git a/support/C++2LaTeX-1_1pl1/getopt.o b/support/C++2LaTeX-1_1pl1/getopt.o Binary files differnew file mode 100644 index 0000000000..1e7d1f62f5 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt.o diff --git a/support/C++2LaTeX-1_1pl1/getopt.tex b/support/C++2LaTeX-1_1pl1/getopt.tex new file mode 100644 index 0000000000..58150eaab4 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt.tex @@ -0,0 +1,581 @@ +% +% This file was automatically produced at Sep 2 1995, 14:00:28 by +% c++2latex -c getopt.c +% +\documentstyle[11pt]{article} +\setlength{\textwidth}{15cm} +\setlength{\textheight}{22.5cm} +\setlength{\hoffset}{-2cm} +\setlength{\voffset}{-2cm} +\begin{document} +\expandafter\ifx\csname indentation\endcsname\relax +\newlength{\indentation}\fi +\setlength{\indentation}{0.5em} +\begin{flushleft} +{$/\ast$\it{} Getopt for GNU.\mbox{}\\ +\hspace*{3\indentation}Copyright (C) 1987, 1989 Free Software Foundation, Inc.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}This program is free software; you can redistribute it and/or modify\mbox{}\\ +\hspace*{3\indentation}it under the terms of the GNU General Public License as published by\mbox{}\\ +\hspace*{3\indentation}the Free Software Foundation; either version 1, or (at your option)\mbox{}\\ +\hspace*{3\indentation}any later version.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}This program is distributed in the hope that it will be useful,\mbox{}\\ +\hspace*{3\indentation}but WITHOUT ANY WARRANTY; without even the implied warranty of\mbox{}\\ +\hspace*{3\indentation}MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\mbox{}\\ +\hspace*{3\indentation}GNU General Public License for more details.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}You should have received a copy of the GNU General Public License\mbox{}\\ +\hspace*{3\indentation}along with this program; if not, write to the Free Software\mbox{}\\ +\hspace*{3\indentation}Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $\ast/$}\mbox{}\\ +\newpage +{$/\ast$\it{} This version of `getopt' appears to the caller like standard Unix `getopt'\mbox{}\\ +\hspace*{3\indentation}but it behaves differently for the user, since it allows the user\mbox{}\\ +\hspace*{3\indentation}to intersperse the options with the other arguments.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}As `getopt' works, it permutes the elements of `argv' so that,\mbox{}\\ +\hspace*{3\indentation}when it is done, all the options precede everything else. Thus\mbox{}\\ +\hspace*{3\indentation}all application programs are extended to handle flexible argument order.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}Setting the environment variable \_POSIX\_OPTION\_ORDER disables permutation.\mbox{}\\ +\hspace*{3\indentation}Then the behavior is completely standard.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}GNU application programs can use a third alternative mode in which\mbox{}\\ +\hspace*{3\indentation}they can distinguish the relative order of options and other arguments. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\tt \#include} $<${\tt{}stdio.h}$>$\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} If compiled with GNU C, use the built-in alloca $\ast/$}\mbox{}\\ +{\tt \#ifdef} \_\_GNUC\_\_\mbox{}\\ +{\tt \#define} alloca \_\_builtin\_alloca\mbox{}\\ +{\tt \#else} \hfill{$/\ast$\it{} not \_\_GNUC\_\_ $\ast/$}\mbox{}\\ +{\tt \#ifdef} sparc\mbox{}\\ +{\tt \#include} $<${\tt{}alloca.h}$>$\mbox{}\\ +{\tt \#else}\mbox{}\\ +{\bf char} $\ast$alloca ();\mbox{}\\ +{\tt \#endif}\mbox{}\\ +{\tt \#endif} \hfill{$/\ast$\it{} not \_\_GNUC\_\_ $\ast/$}\mbox{}\\ +\mbox{}\\ +{\tt \#ifdef} USG\mbox{}\\ +{\tt \#define} bcopy(s, d, l) memcpy((d), (s), (l))\mbox{}\\ +{\tt \#define} index strchr\mbox{}\\ +{\tt \#endif}\mbox{}\\ +\mbox{}\\ +{\bf char} $\ast$getenv ();\mbox{}\\ +{\bf char} $\ast$index ();\mbox{}\\ +{\bf char} $\ast$malloc ();\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} For communication from `getopt' to the caller.\mbox{}\\ +\hspace*{3\indentation}When `getopt' finds an option that takes an argument,\mbox{}\\ +\hspace*{3\indentation}the argument value is returned here.\mbox{}\\ +\hspace*{3\indentation}Also, when `ordering' is RETURN\_IN\_ORDER,\mbox{}\\ +\hspace*{3\indentation}each non-option ARGV-element is returned here. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf char} $\ast$optarg = 0;\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} Index in ARGV of the next element to be scanned.\mbox{}\\ +\hspace*{3\indentation}This is used for communication to and from the caller\mbox{}\\ +\hspace*{3\indentation}and for communication between successive calls to `getopt'.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}On entry to `getopt', zero means this is the first call; initialize.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}When `getopt' returns EOF, this is the index of the first of the\mbox{}\\ +\hspace*{3\indentation}non-option elements that the caller should itself scan.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}Otherwise, `optind' communicates from one call to the next\mbox{}\\ +\hspace*{3\indentation}how much of ARGV has been scanned so far. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf int} optind = 0;\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} The next char to be scanned in the option-element\mbox{}\\ +\hspace*{3\indentation}in which the last option character we returned was found.\mbox{}\\ +\hspace*{3\indentation}This allows us to pick up the scan where we left off.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}If this is zero, or a null string, it means resume the scan\mbox{}\\ +\hspace*{3\indentation}by advancing to the next ARGV-element. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf static} {\bf char} $\ast$nextchar;\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} Callers store zero here to inhibit the error message\mbox{}\\ +\hspace*{3\indentation}for unrecognized options. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf int} opterr = 1;\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} Describe how to deal with options that follow non-option ARGV-elements.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}If the caller did not specify anything,\mbox{}\\ +\hspace*{3\indentation}the default is REQUIRE\_ORDER if the environment variable\mbox{}\\ +\hspace*{3\indentation}\_POSIX\_OPTION\_ORDER is defined, PERMUTE otherwise.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}REQUIRE\_ORDER means don't recognize them as options.\mbox{}\\ +\hspace*{3\indentation}Stop option processing when the first non-option is seen.\mbox{}\\ +\hspace*{3\indentation}This is what Unix does.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}PERMUTE is the default. We permute the contents of ARGV as we scan,\mbox{}\\ +\hspace*{3\indentation}so that eventually all the options are at the end. This allows options\mbox{}\\ +\hspace*{3\indentation}to be given in any order, even with programs that were not written to\mbox{}\\ +\hspace*{3\indentation}expect this.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}RETURN\_IN\_ORDER is an option available to programs that were written\mbox{}\\ +\hspace*{3\indentation}to expect options and other ARGV-elements in any order and that care about\mbox{}\\ +\hspace*{3\indentation}the ordering of the two. We describe each non-option ARGV-element\mbox{}\\ +\hspace*{3\indentation}as if it were the argument of an option with character code one.\mbox{}\\ +\hspace*{3\indentation}Using `-' as the first character of the list of option characters\mbox{}\\ +\hspace*{3\indentation}requests this mode of operation.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}The special argument `--' forces an end of option-scanning regardless\mbox{}\\ +\hspace*{3\indentation}of the value of `ordering'. In the case of RETURN\_IN\_ORDER, only\mbox{}\\ +\hspace*{3\indentation}`--' can cause `getopt' to return EOF with `optind' !$=$ ARGC. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf static} {\bf enum} \{ REQUIRE\_ORDER, PERMUTE, RETURN\_IN\_ORDER \} ordering;\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} Describe the long-named options requested by the application.\mbox{}\\ +\hspace*{3\indentation}\_GETOPT\_LONG\_OPTIONS is a vector of `struct option' terminated by an\mbox{}\\ +\hspace*{3\indentation}element containing a name which is zero.\mbox{}\\ +\hspace*{3\indentation}The field `has\_arg' is 1 if the option takes an argument, \mbox{}\\ +\hspace*{3\indentation}2 if it takes an optional argument. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf struct} option\mbox{}\\ +\{\mbox{}\\ +\hspace*{2\indentation}{\bf char} $\ast$name;\mbox{}\\ +\hspace*{2\indentation}{\bf int} has\_arg;\mbox{}\\ +\hspace*{2\indentation}{\bf int} $\ast$flag;\mbox{}\\ +\hspace*{2\indentation}{\bf int} val;\mbox{}\\ +\};\mbox{}\\ +\mbox{}\\ +{\bf struct} option $\ast$\_getopt\_long\_options;\mbox{}\\ +\mbox{}\\ +{\bf int} \_getopt\_long\_only = 0;\mbox{}\\ +\mbox{}\\ +{\tt \#if} 0\mbox{}\\ +{$/\ast$\it{} This is an ugly kludge. Programs should use the opt\_index argument\mbox{}\\ +\hspace*{3\indentation}to getopt\_long instead. $\ast/$}\mbox{}\\ +{$/\ast$\it{} Name of long-named option actually found. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf char} $\ast$\_getopt\_option\_name;\mbox{}\\ +{\tt \#endif}\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} Index in \_GETOPT\_LONG\_OPTIONS of the long-named option actually found.\mbox{}\\ +\hspace*{3\indentation}Only valid when a long-named option was found. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf int} option\_index;\mbox{}\\ +\newpage +{$/\ast$\it{} Handle permutation of arguments. $\ast/$}\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} Describe the part of ARGV that contains non-options that have\mbox{}\\ +\hspace*{3\indentation}been skipped. `first\_nonopt' is the index in ARGV of the first of them;\mbox{}\\ +\hspace*{3\indentation}`last\_nonopt' is the index after the last of them. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf static} {\bf int} first\_nonopt;\mbox{}\\ +{\bf static} {\bf int} last\_nonopt;\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} Exchange two adjacent subsequences of ARGV.\mbox{}\\ +\hspace*{3\indentation}One subsequence is elements [first\_nonopt,last\_nonopt)\mbox{}\\ +\hspace*{4\indentation}which contains all the non-options that have been skipped so far.\mbox{}\\ +\hspace*{3\indentation}The other is elements [last\_nonopt,optind), which contains all\mbox{}\\ +\hspace*{4\indentation}the options processed since those non-options were skipped.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}`first\_nonopt' and `last\_nonopt' are relocated so that they describe\mbox{}\\ +\hspace*{4\indentation}the new indices of the non-options in ARGV after they are moved. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf static} {\bf void}\mbox{}\\ +exchange (argv)\mbox{}\\ +\hspace*{5\indentation}{\bf char} $\ast$$\ast$argv;\mbox{}\\ +\{\mbox{}\\ +\hspace*{2\indentation}{\bf int} nonopts\_size\mbox{}\\ +\hspace*{4\indentation}= (last\_nonopt - first\_nonopt) $\ast$ {\bf sizeof} ({\bf char} $\ast$);\mbox{}\\ +\hspace*{2\indentation}{\bf char} $\ast$$\ast$temp = ({\bf char} $\ast$$\ast$) alloca (nonopts\_size);\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{$/\ast$\it{} Interchange the two blocks of data in argv. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}bcopy (\&argv[first\_nonopt], temp, nonopts\_size);\mbox{}\\ +\hspace*{2\indentation}bcopy (\&argv[last\_nonopt], \&argv[first\_nonopt],\mbox{}\\ +\hspace*{9\indentation}(optind - last\_nonopt) $\ast$ {\bf sizeof} ({\bf char} $\ast$));\mbox{}\\ +\hspace*{2\indentation}bcopy (temp, \&argv[first\_nonopt + optind - last\_nonopt],\mbox{}\\ +\hspace*{9\indentation}nonopts\_size);\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{$/\ast$\it{} Update records for the slots the non-options now occupy. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}first\_nonopt += (optind - last\_nonopt);\mbox{}\\ +\hspace*{2\indentation}last\_nonopt = optind;\mbox{}\\ +\}\mbox{}\\ +\newpage +{$/\ast$\it{} Scan elements of ARGV (whose length is ARGC) for option characters\mbox{}\\ +\hspace*{3\indentation}given in OPTSTRING.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}If an element of ARGV starts with '-', and is not exactly "-" or "--",\mbox{}\\ +\hspace*{3\indentation}then it is an option element. The characters of this element\mbox{}\\ +\hspace*{3\indentation}(aside from the initial '-') are option characters. If `getopt'\mbox{}\\ +\hspace*{3\indentation}is called repeatedly, it returns successively each of the option characters\mbox{}\\ +\hspace*{3\indentation}from each of the option elements.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}If `getopt' finds another option character, it returns that character,\mbox{}\\ +\hspace*{3\indentation}updating `optind' and `nextchar' so that the next call to `getopt' can\mbox{}\\ +\hspace*{3\indentation}resume the scan with the following option character or ARGV-element.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}If there are no more option characters, `getopt' returns `EOF'.\mbox{}\\ +\hspace*{3\indentation}Then `optind' is the index in ARGV of the first ARGV-element\mbox{}\\ +\hspace*{3\indentation}that is not an option. (The ARGV-elements have been permuted\mbox{}\\ +\hspace*{3\indentation}so that those that are not options now come last.)\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}OPTSTRING is a string containing the legitimate option characters.\mbox{}\\ +\hspace*{3\indentation}If an option character is seen that is not listed in OPTSTRING,\mbox{}\\ +\hspace*{3\indentation}return '?' after printing an error message. If you set `opterr' to\mbox{}\\ +\hspace*{3\indentation}zero, the error message is suppressed but we still return '?'.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}If a char in OPTSTRING is followed by a colon, that means it wants an arg,\mbox{}\\ +\hspace*{3\indentation}so the following text in the same ARGV-element, or the text of the following\mbox{}\\ +\hspace*{3\indentation}ARGV-element, is returned in `optarg'. Two colons mean an option that\mbox{}\\ +\hspace*{3\indentation}wants an optional arg; if there is text in the current ARGV-element,\mbox{}\\ +\hspace*{3\indentation}it is returned in `optarg', otherwise `optarg' is set to zero.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}If OPTSTRING starts with `-', it requests a different method of handling the\mbox{}\\ +\hspace*{3\indentation}non-option ARGV-elements. See the comments about RETURN\_IN\_ORDER, above.\mbox{}\\ +\mbox{}\\ +\hspace*{3\indentation}Long-named options begin with `$+$' instead of `-'.\mbox{}\\ +\hspace*{3\indentation}Their names may be abbreviated as long as the abbreviation is unique\mbox{}\\ +\hspace*{3\indentation}or is an exact match for some defined option. If they have an\mbox{}\\ +\hspace*{3\indentation}argument, it follows the option name in the same ARGV-element, separated\mbox{}\\ +\hspace*{3\indentation}from the option name by a `$=$', or else the in next ARGV-element.\mbox{}\\ +\hspace*{3\indentation}`getopt' returns 0 when it finds a long-named option. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf int}\mbox{}\\ +getopt (argc, argv, optstring)\mbox{}\\ +\hspace*{5\indentation}{\bf int} argc;\mbox{}\\ +\hspace*{5\indentation}{\bf char} $\ast$$\ast$argv;\mbox{}\\ +\hspace*{5\indentation}{\bf char} $\ast$optstring;\mbox{}\\ +\{\mbox{}\\ +\hspace*{2\indentation}optarg = 0;\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{$/\ast$\it{} Initialize the internal data when the first call is made.\mbox{}\\ +\hspace*{5\indentation}Start processing options with ARGV-element 1 (since ARGV-element 0\mbox{}\\ +\hspace*{5\indentation}is the program name); the sequence of previously skipped\mbox{}\\ +\hspace*{5\indentation}non-option ARGV-elements is empty. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{\bf if} (optind == 0)\mbox{}\\ +\hspace*{4\indentation}\{\mbox{}\\ +\hspace*{6\indentation}first\_nonopt = last\_nonopt = optind = 1;\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}nextchar = 0;\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{$/\ast$\it{} Determine how to handle the ordering of options and nonoptions. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{\bf if} (optstring[0] == '-')\mbox{}\\ +\hspace*{8\indentation}ordering = RETURN\_IN\_ORDER;\mbox{}\\ +\hspace*{6\indentation}{\bf else} {\bf if} (getenv ({\tt"\_POSIX\_OPTION\_ORDER"}) $\neq$ 0)\mbox{}\\ +\hspace*{8\indentation}ordering = REQUIRE\_ORDER;\mbox{}\\ +\hspace*{6\indentation}{\bf else}\mbox{}\\ +\hspace*{8\indentation}ordering = PERMUTE;\mbox{}\\ +\hspace*{4\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{\bf if} (nextchar == 0 $\mid\mid$ $\ast$nextchar == 0)\mbox{}\\ +\hspace*{4\indentation}\{\mbox{}\\ +\hspace*{6\indentation}{\bf if} (ordering == PERMUTE)\mbox{}\\ +\hspace*{8\indentation}\{\mbox{}\\ +\hspace*{10\indentation}{$/\ast$\it{} If we have just processed some options following some non-options,\mbox{}\\ +\hspace*{13\indentation}exchange them so that the options come first. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{10\indentation}{\bf if} (first\_nonopt $\neq$ last\_nonopt \&\& last\_nonopt $\neq$ optind)\mbox{}\\ +\hspace*{12\indentation}exchange (argv);\mbox{}\\ +\hspace*{10\indentation}{\bf else} {\bf if} (last\_nonopt $\neq$ optind)\mbox{}\\ +\hspace*{12\indentation}first\_nonopt = optind;\mbox{}\\ +\mbox{}\\ +\hspace*{10\indentation}{$/\ast$\it{} Now skip any additional non-options\mbox{}\\ +\hspace*{13\indentation}and extend the range of non-options previously skipped. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{10\indentation}{\bf while} (optind $<$ argc\mbox{}\\ +\hspace*{17\indentation}\&\& (argv[optind][0] $\neq$ '-'\mbox{}\\ +\hspace*{21\indentation}$\mid\mid$ argv[optind][1] == 0)\mbox{}\\ +\hspace*{17\indentation}\&\& (\_getopt\_long\_options == 0\mbox{}\\ +\hspace*{21\indentation}$\mid\mid$ argv[optind][0] $\neq$ '$+$'\mbox{}\\ +\hspace*{21\indentation}$\mid\mid$ argv[optind][1] == 0))\mbox{}\\ +\hspace*{12\indentation}optind++;\mbox{}\\ +\hspace*{10\indentation}last\_nonopt = optind;\mbox{}\\ +\hspace*{8\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{$/\ast$\it{} Special ARGV-element `--' means premature end of options.\mbox{}\\ +\hspace*{9\indentation}Skip it like a null option,\mbox{}\\ +\hspace*{9\indentation}then exchange with previous non-options as if it were an option,\mbox{}\\ +\hspace*{9\indentation}then skip everything else like a non-option. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{\bf if} (optind $\neq$ argc \&\& !strcmp (argv[optind], {\tt"--"}))\mbox{}\\ +\hspace*{8\indentation}\{\mbox{}\\ +\hspace*{10\indentation}optind++;\mbox{}\\ +\mbox{}\\ +\hspace*{10\indentation}{\bf if} (first\_nonopt $\neq$ last\_nonopt \&\& last\_nonopt $\neq$ optind)\mbox{}\\ +\hspace*{12\indentation}exchange (argv);\mbox{}\\ +\hspace*{10\indentation}{\bf else} {\bf if} (first\_nonopt == last\_nonopt)\mbox{}\\ +\hspace*{12\indentation}first\_nonopt = optind;\mbox{}\\ +\hspace*{10\indentation}last\_nonopt = argc;\mbox{}\\ +\mbox{}\\ +\hspace*{10\indentation}optind = argc;\mbox{}\\ +\hspace*{8\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{$/\ast$\it{} If we have done all the ARGV-elements, stop the scan\mbox{}\\ +\hspace*{9\indentation}and back over any non-options that we skipped and permuted. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{\bf if} (optind == argc)\mbox{}\\ +\hspace*{8\indentation}\{\mbox{}\\ +\hspace*{10\indentation}{$/\ast$\it{} Set the next-arg-index to point at the non-options\mbox{}\\ +\hspace*{13\indentation}that we previously skipped, so the caller will digest them. $\ast/$}\mbox{}\\ +\hspace*{10\indentation}{\bf if} (first\_nonopt $\neq$ last\_nonopt)\mbox{}\\ +\hspace*{12\indentation}optind = first\_nonopt;\mbox{}\\ +\hspace*{10\indentation}{\bf return} EOF;\mbox{}\\ +\hspace*{8\indentation}\}\mbox{}\\ +\hspace*{9\indentation}\mbox{}\\ +\hspace*{6\indentation}{$/\ast$\it{} If we have come to a non-option and did not permute it,\mbox{}\\ +\hspace*{9\indentation}either stop the scan or describe it to the caller and pass it by. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{\bf if} ((argv[optind][0] $\neq$ '-' $\mid\mid$ argv[optind][1] == 0)\mbox{}\\ +\hspace*{10\indentation}\&\& (\_getopt\_long\_options == 0\mbox{}\\ +\hspace*{14\indentation}$\mid\mid$ argv[optind][0] $\neq$ '$+$' $\mid\mid$ argv[optind][1] == 0))\mbox{}\\ +\hspace*{8\indentation}\{\mbox{}\\ +\hspace*{10\indentation}{\bf if} (ordering == REQUIRE\_ORDER)\mbox{}\\ +\hspace*{12\indentation}{\bf return} EOF;\mbox{}\\ +\hspace*{10\indentation}optarg = argv[optind++];\mbox{}\\ +{\tt \#if} 0\mbox{}\\ +\hspace*{10\indentation}\_getopt\_option\_name = 0;\mbox{}\\ +{\tt \#endif}\mbox{}\\ +\hspace*{10\indentation}{\bf return} 1;\mbox{}\\ +\hspace*{8\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{$/\ast$\it{} We have found another option-ARGV-element.\mbox{}\\ +\hspace*{9\indentation}Start decoding its characters. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}nextchar = argv[optind] + 1;\mbox{}\\ +\hspace*{4\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{\bf if} (\_getopt\_long\_options $\neq$ 0\mbox{}\\ +\hspace*{6\indentation}\&\& (argv[optind][0] == '$+$'\mbox{}\\ +\hspace*{10\indentation}$\mid\mid$ (\_getopt\_long\_only \&\& argv[optind][0] == '-'))\mbox{}\\ +\hspace*{6\indentation})\mbox{}\\ +\hspace*{4\indentation}\{\mbox{}\\ +\hspace*{6\indentation}{\bf struct} option $\ast$p;\mbox{}\\ +\hspace*{6\indentation}{\bf char} $\ast$s = nextchar;\mbox{}\\ +\hspace*{6\indentation}{\bf int} exact = 0;\mbox{}\\ +\hspace*{6\indentation}{\bf int} ambig = 0;\mbox{}\\ +\hspace*{6\indentation}{\bf struct} option $\ast$pfound = 0;\mbox{}\\ +\hspace*{6\indentation}{\bf int} indfound;\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{\bf while} ($\ast$s \&\& $\ast$s $\neq$ '$=$') s++;\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{$/\ast$\it{} Test all options for either exact match or abbreviated matches. $\ast/$}\mbox{}\\ +\hspace*{6\indentation}{\bf for} (p = \_getopt\_long\_options, option\_index = 0; p$\rightarrow$name; \mbox{}\\ +\hspace*{11\indentation}p++, option\_index++)\mbox{}\\ +\hspace*{8\indentation}{\bf if} (!strncmp (p$\rightarrow$name, nextchar, s - nextchar))\mbox{}\\ +\hspace*{10\indentation}\{\mbox{}\\ +\hspace*{12\indentation}{\bf if} (s - nextchar == strlen (p$\rightarrow$name))\mbox{}\\ +\hspace*{14\indentation}\{\mbox{}\\ +\hspace*{16\indentation}{$/\ast$\it{} Exact match found. $\ast/$}\mbox{}\\ +\hspace*{16\indentation}pfound = p;\mbox{}\\ +\hspace*{16\indentation}indfound = option\_index;\mbox{}\\ +\hspace*{16\indentation}exact = 1;\mbox{}\\ +\hspace*{16\indentation}{\bf break};\mbox{}\\ +\hspace*{14\indentation}\}\mbox{}\\ +\hspace*{12\indentation}{\bf else} {\bf if} (pfound == 0)\mbox{}\\ +\hspace*{14\indentation}\{\mbox{}\\ +\hspace*{16\indentation}{$/\ast$\it{} First nonexact match found. $\ast/$}\mbox{}\\ +\hspace*{16\indentation}pfound = p;\mbox{}\\ +\hspace*{16\indentation}indfound = option\_index;\mbox{}\\ +\hspace*{14\indentation}\}\mbox{}\\ +\hspace*{12\indentation}{\bf else}\mbox{}\\ +\hspace*{14\indentation}{$/\ast$\it{} Second nonexact match found. $\ast/$}\mbox{}\\ +\hspace*{14\indentation}ambig = 1;\mbox{}\\ +\hspace*{10\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{\bf if} (ambig \&\& !exact)\mbox{}\\ +\hspace*{8\indentation}\{\mbox{}\\ +\hspace*{10\indentation}fprintf (stderr, {\tt"\%s: option `\%s' is ambiguous$\backslash$n"},\mbox{}\\ +\hspace*{19\indentation}argv[0], argv[optind]);\mbox{}\\ +\hspace*{10\indentation}nextchar += strlen (nextchar); \mbox{}\\ +\hspace*{10\indentation}{\bf return} '?';\mbox{}\\ +\hspace*{8\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{\bf if} (pfound $\neq$ 0)\mbox{}\\ +\hspace*{8\indentation}\{\mbox{}\\ +\hspace*{10\indentation}option\_index = indfound;\mbox{}\\ +\hspace*{10\indentation}optind++;\mbox{}\\ +\hspace*{10\indentation}{\bf if} ($\ast$s)\mbox{}\\ +\hspace*{12\indentation}\{\mbox{}\\ +\hspace*{14\indentation}{\bf if} (pfound$\rightarrow$has\_arg $>$ 0)\mbox{}\\ +\hspace*{16\indentation}optarg = s + 1;\mbox{}\\ +\hspace*{14\indentation}{\bf else}\mbox{}\\ +\hspace*{16\indentation}\{\mbox{}\\ +\hspace*{18\indentation}fprintf (stderr,\mbox{}\\ +\hspace*{27\indentation}{\tt"\%s: option `\%c\%s' doesn't allow an argument$\backslash$n"},\mbox{}\\ +\hspace*{27\indentation}argv[0], argv[optind - 1][0], pfound$\rightarrow$name);\mbox{}\\ +\hspace*{18\indentation}nextchar += strlen (nextchar); \mbox{}\\ +\hspace*{18\indentation}{\bf return} '?';\mbox{}\\ +\hspace*{16\indentation}\}\mbox{}\\ +\hspace*{12\indentation}\}\mbox{}\\ +\hspace*{10\indentation}{\bf else} {\bf if} (pfound$\rightarrow$has\_arg)\mbox{}\\ +\hspace*{12\indentation}\{\mbox{}\\ +\hspace*{14\indentation}{\bf if} (optind $<$ argc)\mbox{}\\ +\hspace*{16\indentation}optarg = argv[optind++];\mbox{}\\ +\hspace*{14\indentation}{\bf else} {\bf if} (pfound$\rightarrow$has\_arg $\neq$ 2)\mbox{}\\ +\hspace*{16\indentation}\{\mbox{}\\ +\hspace*{18\indentation}fprintf (stderr, {\tt"\%s: option `\%s' requires an argument$\backslash$n"},\mbox{}\\ +\hspace*{27\indentation}argv[0], argv[optind - 1]);\mbox{}\\ +\hspace*{18\indentation}nextchar += strlen (nextchar); \mbox{}\\ +\hspace*{18\indentation}{\bf return} '?';\mbox{}\\ +\hspace*{16\indentation}\}\mbox{}\\ +\hspace*{12\indentation}\}\mbox{}\\ +{\tt \#if} 0\mbox{}\\ +\hspace*{10\indentation}\_getopt\_option\_name = pfound$\rightarrow$name;\mbox{}\\ +{\tt \#endif}\mbox{}\\ +\hspace*{10\indentation}nextchar += strlen (nextchar);\mbox{}\\ +\hspace*{10\indentation}{\bf if} (pfound$\rightarrow$flag)\mbox{}\\ +\hspace*{12\indentation}$\ast$(pfound$\rightarrow$flag) = pfound$\rightarrow$val;\mbox{}\\ +\hspace*{10\indentation}{\bf return} 0;\mbox{}\\ +\hspace*{8\indentation}\}\mbox{}\\ +\hspace*{6\indentation}{$/\ast$\it{} Can't find it as a long option. If this is getopt\_long\_only,\mbox{}\\ +\hspace*{9\indentation}and the option starts with '-' and is a valid short\mbox{}\\ +\hspace*{9\indentation}option, then interpret it as a short option. Otherwise it's\mbox{}\\ +\hspace*{9\indentation}an error. $\ast/$}\mbox{}\\ +\hspace*{6\indentation}{\bf if} (\_getopt\_long\_only == 0 $\mid\mid$ argv[optind][0] == '$+$' $\mid\mid$\mbox{}\\ +\hspace*{10\indentation}index (optstring, $\ast$nextchar) == 0)\mbox{}\\ +\hspace*{8\indentation}\{\mbox{}\\ +\hspace*{10\indentation}{\bf if} (opterr $\neq$ 0)\mbox{}\\ +\hspace*{12\indentation}fprintf (stderr, {\tt"\%s: unrecognized option `\%c\%s'$\backslash$n"},\mbox{}\\ +\hspace*{21\indentation}argv[0], argv[optind][0], nextchar);\mbox{}\\ +\hspace*{10\indentation}nextchar += strlen (nextchar); \mbox{}\\ +\hspace*{10\indentation}{\bf return} '?';\mbox{}\\ +\hspace*{8\indentation}\}\mbox{}\\ +\hspace*{4\indentation}\}\mbox{}\\ +\hspace*{1\indentation}\mbox{}\\ +\hspace*{2\indentation}{$/\ast$\it{} Look at and handle the next option-character. $\ast/$}\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}\{\mbox{}\\ +\hspace*{4\indentation}{\bf char} c = $\ast$nextchar++;\mbox{}\\ +\hspace*{4\indentation}{\bf char} $\ast$temp = index (optstring, c);\mbox{}\\ +\mbox{}\\ +\hspace*{4\indentation}{$/\ast$\it{} Increment `optind' when we start to process its last character. $\ast/$}\mbox{}\\ +\hspace*{4\indentation}{\bf if} ($\ast$nextchar == 0)\mbox{}\\ +\hspace*{6\indentation}optind++;\mbox{}\\ +\mbox{}\\ +\hspace*{4\indentation}{\bf if} (temp == 0 $\mid\mid$ c == ':')\mbox{}\\ +\hspace*{6\indentation}\{\mbox{}\\ +\hspace*{8\indentation}{\bf if} (opterr $\neq$ 0)\mbox{}\\ +\hspace*{10\indentation}\{\mbox{}\\ +\hspace*{12\indentation}{\bf if} (c $<$ 040 $\mid\mid$ c $\geq$ 0177)\mbox{}\\ +\hspace*{14\indentation}fprintf (stderr, {\tt"\%s: unrecognized option, character code 0\%o$\backslash$n"},\mbox{}\\ +\hspace*{23\indentation}argv[0], c);\mbox{}\\ +\hspace*{12\indentation}{\bf else}\mbox{}\\ +\hspace*{14\indentation}fprintf (stderr, {\tt"\%s: unrecognized option `-\%c'$\backslash$n"},\mbox{}\\ +\hspace*{23\indentation}argv[0], c);\mbox{}\\ +\hspace*{10\indentation}\}\mbox{}\\ +\hspace*{8\indentation}{\bf return} '?';\mbox{}\\ +\hspace*{6\indentation}\}\mbox{}\\ +\hspace*{4\indentation}{\bf if} (temp[1] == ':')\mbox{}\\ +\hspace*{6\indentation}\{\mbox{}\\ +\hspace*{8\indentation}{\bf if} (temp[2] == ':')\mbox{}\\ +\hspace*{10\indentation}\{\mbox{}\\ +\hspace*{12\indentation}{$/\ast$\it{} This is an option that accepts an argument optionally. $\ast/$}\mbox{}\\ +\hspace*{12\indentation}{\bf if} ($\ast$nextchar $\neq$ 0)\mbox{}\\ +\hspace*{14\indentation}\{\mbox{}\\ +\hspace*{16\indentation}optarg = nextchar;\mbox{}\\ +\hspace*{16\indentation}optind++;\mbox{}\\ +\hspace*{14\indentation}\}\mbox{}\\ +\hspace*{12\indentation}{\bf else}\mbox{}\\ +\hspace*{14\indentation}optarg = 0;\mbox{}\\ +\hspace*{12\indentation}nextchar = 0;\mbox{}\\ +\hspace*{10\indentation}\}\mbox{}\\ +\hspace*{8\indentation}{\bf else}\mbox{}\\ +\hspace*{10\indentation}\{\mbox{}\\ +\hspace*{12\indentation}{$/\ast$\it{} This is an option that requires an argument. $\ast/$}\mbox{}\\ +\hspace*{12\indentation}{\bf if} ($\ast$nextchar $\neq$ 0)\mbox{}\\ +\hspace*{14\indentation}\{\mbox{}\\ +\hspace*{16\indentation}optarg = nextchar;\mbox{}\\ +\hspace*{16\indentation}{$/\ast$\it{} If we end this ARGV-element by taking the rest as an arg,\mbox{}\\ +\hspace*{19\indentation}we must advance to the next element now. $\ast/$}\mbox{}\\ +\hspace*{16\indentation}optind++;\mbox{}\\ +\hspace*{14\indentation}\}\mbox{}\\ +\hspace*{12\indentation}{\bf else} {\bf if} (optind == argc)\mbox{}\\ +\hspace*{14\indentation}\{\mbox{}\\ +\hspace*{16\indentation}{\bf if} (opterr $\neq$ 0)\mbox{}\\ +\hspace*{18\indentation}fprintf (stderr, {\tt"\%s: option `-\%c' requires an argument$\backslash$n"},\mbox{}\\ +\hspace*{27\indentation}argv[0], c);\mbox{}\\ +\hspace*{16\indentation}c = '?';\mbox{}\\ +\hspace*{14\indentation}\}\mbox{}\\ +\hspace*{12\indentation}{\bf else}\mbox{}\\ +\hspace*{14\indentation}{$/\ast$\it{} We already incremented `optind' once;\mbox{}\\ +\hspace*{17\indentation}increment it again when taking next ARGV-elt as argument. $\ast/$}\mbox{}\\ +\hspace*{14\indentation}optarg = argv[optind++];\mbox{}\\ +\hspace*{12\indentation}nextchar = 0;\mbox{}\\ +\hspace*{10\indentation}\}\mbox{}\\ +\hspace*{6\indentation}\}\mbox{}\\ +\hspace*{4\indentation}{\bf return} c;\mbox{}\\ +\hspace*{2\indentation}\}\mbox{}\\ +\}\mbox{}\\ +\newpage +{\tt \#ifdef} TEST\mbox{}\\ +\mbox{}\\ +{$/\ast$\it{} Compile with -DTEST to make an executable for use in testing\mbox{}\\ +\hspace*{3\indentation}the above definition of `getopt'. $\ast/$}\mbox{}\\ +\mbox{}\\ +{\bf int}\mbox{}\\ +main (argc, argv)\mbox{}\\ +\hspace*{5\indentation}{\bf int} argc;\mbox{}\\ +\hspace*{5\indentation}{\bf char} $\ast$$\ast$argv;\mbox{}\\ +\{\mbox{}\\ +\hspace*{2\indentation}{\bf char} c;\mbox{}\\ +\hspace*{2\indentation}{\bf int} digit\_optind = 0;\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{\bf while} (1)\mbox{}\\ +\hspace*{4\indentation}\{\mbox{}\\ +\hspace*{6\indentation}{\bf int} this\_option\_optind = optind;\mbox{}\\ +\hspace*{6\indentation}{\bf if} ((c = getopt (argc, argv, {\tt"abc:d:0123456789"})) == EOF)\mbox{}\\ +\hspace*{8\indentation}{\bf break};\mbox{}\\ +\mbox{}\\ +\hspace*{6\indentation}{\bf switch} (c)\mbox{}\\ +\hspace*{8\indentation}\{\mbox{}\\ +\hspace*{8\indentation}{\bf case} '0':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '1':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '2':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '3':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '4':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '5':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '6':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '7':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '8':\mbox{}\\ +\hspace*{8\indentation}{\bf case} '9':\mbox{}\\ +\hspace*{10\indentation}{\bf if} (digit\_optind $\neq$ 0 \&\& digit\_optind $\neq$ this\_option\_optind)\mbox{}\\ +\hspace*{12\indentation}printf ({\tt"digits occur in two different argv-elements.$\backslash$n"});\mbox{}\\ +\hspace*{10\indentation}digit\_optind = this\_option\_optind;\mbox{}\\ +\hspace*{10\indentation}printf ({\tt"option \%c$\backslash$n"}, c);\mbox{}\\ +\hspace*{10\indentation}{\bf break};\mbox{}\\ +\mbox{}\\ +\hspace*{8\indentation}{\bf case} 'a':\mbox{}\\ +\hspace*{10\indentation}printf ({\tt"option a$\backslash$n"});\mbox{}\\ +\hspace*{10\indentation}{\bf break};\mbox{}\\ +\mbox{}\\ +\hspace*{8\indentation}{\bf case} 'b':\mbox{}\\ +\hspace*{10\indentation}printf ({\tt"option b$\backslash$n"});\mbox{}\\ +\hspace*{10\indentation}{\bf break};\mbox{}\\ +\mbox{}\\ +\hspace*{8\indentation}{\bf case} 'c':\mbox{}\\ +\hspace*{10\indentation}printf ({\tt"option c with value `\%s'$\backslash$n"}, optarg);\mbox{}\\ +\hspace*{10\indentation}{\bf break};\mbox{}\\ +\mbox{}\\ +\hspace*{8\indentation}{\bf case} '?':\mbox{}\\ +\hspace*{10\indentation}{\bf break};\mbox{}\\ +\mbox{}\\ +\hspace*{8\indentation}{\bf default}:\mbox{}\\ +\hspace*{10\indentation}printf ({\tt"?? getopt returned character code 0\%o ??$\backslash$n"}, c);\mbox{}\\ +\hspace*{8\indentation}\}\mbox{}\\ +\hspace*{4\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{\bf if} (optind $<$ argc)\mbox{}\\ +\hspace*{4\indentation}\{\mbox{}\\ +\hspace*{6\indentation}printf ({\tt"non-option ARGV-elements: "});\mbox{}\\ +\hspace*{6\indentation}{\bf while} (optind $<$ argc)\mbox{}\\ +\hspace*{8\indentation}printf ({\tt"\%s "}, argv[optind++]);\mbox{}\\ +\hspace*{6\indentation}printf ({\tt"$\backslash$n"});\mbox{}\\ +\hspace*{4\indentation}\}\mbox{}\\ +\mbox{}\\ +\hspace*{2\indentation}{\bf return} 0;\mbox{}\\ +\}\mbox{}\\ +\mbox{}\\ +{\tt \#endif} \hfill{$/\ast$\it{} TEST $\ast/$}\mbox{}\\ +\end{flushleft} +\end{document} diff --git a/support/C++2LaTeX-1_1pl1/getopt1.c b/support/C++2LaTeX-1_1pl1/getopt1.c new file mode 100644 index 0000000000..b4f738e2b4 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt1.c @@ -0,0 +1,145 @@ +/* Getopt for GNU. + Copyright (C) 1987, 1989 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + + +#include "getopt.h" + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char **argv; + char *options; + struct option *long_options; + int *opt_index; +{ + int val; + _getopt_long_options = long_options; + val = getopt (argc, argv, options); + if (val == 0) + *opt_index = option_index; + return val; +} + +/* Like getopt_long, but there are no short options. That is, + '-' as well as '+' indicates a long option. Of course, long_options + can contain single character options but '-ab' is not the same as + '-a -b'. */ +int getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char **argv; + char *options; + struct option *long_options; + int *opt_index; +{ + int val; + _getopt_long_options = long_options; + _getopt_long_only = 1; + val = getopt (argc, argv, options); + if (val == 0) + *opt_index = option_index; + return val; +} + + +#ifdef TEST + +#include <stdio.h> + +int +main (argc, argv) + int argc; + char **argv; +{ + char c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind; + char *name = '\0'; + int option_index = 0; + static struct option long_options[] + = {{ "add", 1, 0, 0 }, + { "append", 0, 0, 0 }, + { "delete", 1, 0, 0 }, + { "verbose", 0, 0, 0 }, + { "create", 0, 0, 0 }, + { "file", 1, 0, 0 }, + { 0, 0, 0, 0}}; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == EOF) + break; + switch (c) + { + case 0: + printf ("option %s", (long_options[option_index]).name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + return 0; +} + +#endif /* TEST */ diff --git a/support/C++2LaTeX-1_1pl1/getopt1.o b/support/C++2LaTeX-1_1pl1/getopt1.o Binary files differnew file mode 100644 index 0000000000..217249a6a5 --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/getopt1.o diff --git a/support/C++2LaTeX-1_1pl1/version.c b/support/C++2LaTeX-1_1pl1/version.c new file mode 100644 index 0000000000..a9349d6b9f --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/version.c @@ -0,0 +1 @@ +char * version_string = "c++2latex Version 1.1 Patchlevel 1"; diff --git a/support/C++2LaTeX-1_1pl1/version.o b/support/C++2LaTeX-1_1pl1/version.o Binary files differnew file mode 100644 index 0000000000..76ea85d7ad --- /dev/null +++ b/support/C++2LaTeX-1_1pl1/version.o |