home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume41 / p2latex / part01 < prev    next >
Encoding:
Text File  |  1994-01-09  |  53.0 KB  |  1,920 lines

  1. Newsgroups: comp.sources.misc
  2. From: torsten@diku.dk (Torsten Poulin Nielsen)
  3. Subject: v41i083:  p2latex - Pascal to LaTeX v1.0, Part01/03
  4. Message-ID: <csm-v41i083=p2latex.215324@sparky.Sterling.COM>
  5. X-Md4-Signature: d2bc8437b8abca170c98b84e7bf02658
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Mon, 10 Jan 1994 03:54:58 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: torsten@diku.dk (Torsten Poulin Nielsen)
  12. Posting-number: Volume 41, Issue 83
  13. Archive-name: p2latex/part01
  14. Environment: UNIX, AmigaDOS
  15.  
  16. P2LATEX is a tool for generating LaTeX sources from ISO Pascal
  17. programs.  It recognizes all keywords, strings, and comments. These
  18. recognized parts can be typeset in different fonts.
  19.  
  20. It is built on the work of others and makes liberal use of code
  21. copyrighted by the Free Software Foundation and others. Thus, it is by
  22. default subject to the GPL. Please refer to the file LICENSE for
  23. details.
  24.  
  25. Even though p2latex was written on a machine running AmigaDOS, it is
  26. fundamentally a Unix (or GNU :-) command. Its quite portable, though.
  27.  
  28. I have supplied Makefiles for Unix and AmigaDOS. The one for AmigaDOS
  29. is for SAS/C v5.10b. Yes, I now that compiler is a bit outdated, but
  30. it happens to be the one I have.
  31.  
  32. If you don't have flex, touch p2latex.c before you invoke make.
  33.  
  34. If you use Amiga gcc, you can build p2latex with the supplied Unix
  35. Makefile if you have versions of Unix rm, mv, and BSD make installed.
  36. They are shipped with newer versions of gcc; they are also available
  37. on Aminet. While you're at it, make or get Amiga ports of all the Unix
  38. commands you can lay your hands on. I did a port of the f2c Fortran to
  39. C translator without changing the Makefile that way.
  40.  
  41. If you have any comments or suggestions, you can write to me at
  42.  
  43. Torsten Poulin
  44. Banebrinken 99,2,-77
  45. DK-2400 Copenhagen
  46. Denmark
  47.  
  48. or use email: torsten@diku.dk
  49.  
  50. Have fun,
  51. Torsten
  52.  
  53. #! /bin/sh
  54. # This is a shell archive.  Remove anything before this line, then feed it
  55. # into a shell via "sh file" or similar.  To overwrite existing files,
  56. # type "sh file -c".
  57. # Contents:  README p2latex.1 p2latex.c
  58. # Wrapped by kent@sparky on Sun Jan  9 21:45:39 1994
  59. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  60. echo If this archive is complete, you will see the following message:
  61. echo '          "shar: End of archive 1 (of 3)."'
  62. if test -f 'README' -a "${1}" != "-c" ; then 
  63.   echo shar: Will not clobber existing file \"'README'\"
  64. else
  65.   echo shar: Extracting \"'README'\" \(1169 characters\)
  66.   sed "s/^X//" >'README' <<'END_OF_FILE'
  67. XP2LATEX is built on the work of others and makes liberal use of code
  68. Xcopyrighted by the Free Software Foundation and others. Thus, it is by
  69. Xdefault subject to the GPL. Please refer to the file LICENSE for
  70. Xdetails.
  71. X
  72. XEven though p2latex was written on a machine running AmigaDOS, it is
  73. Xfundamentally a Unix (or GNU :-) command. Its quite portable, though.
  74. X
  75. XI have supplied Makefiles for Unix and AmigaDOS. The one for AmigaDOS
  76. Xis for SAS/C v5.10b. Yes, I now that compiler is a bit outdated, but
  77. Xit happens to be the one I have.
  78. X
  79. XIf you don't have flex, touch p2latex.c before you invoke make.
  80. X
  81. XIf you use Amiga gcc, you can build p2latex with the supplied Unix
  82. XMakefile if you have versions of Unix rm, mv, and BSD make installed.
  83. XThey are shipped with newer versions of gcc; they are also available
  84. Xon Aminet. While you're at it, make or get Amiga ports of all the Unix
  85. Xcommands you can lay your hands on. I did a port of the f2c Fortran to
  86. XC translator without changing the Makefile that way.
  87. X
  88. XIf you have any comments or suggestions, you write to me at
  89. X
  90. XTorsten Poulin
  91. XBanebrinken 99,2,-77
  92. XDK-2400 Copenhagen
  93. XDenmark
  94. X
  95. Xor use email: torsten@diku.dk
  96. X
  97. XHave fun,
  98. XTorsten
  99. END_OF_FILE
  100.   if test 1169 -ne `wc -c <'README'`; then
  101.     echo shar: \"'README'\" unpacked with wrong size!
  102.   fi
  103.   # end of 'README'
  104. fi
  105. if test -f 'p2latex.1' -a "${1}" != "-c" ; then 
  106.   echo shar: Will not clobber existing file \"'p2latex.1'\"
  107. else
  108.   echo shar: Extracting \"'p2latex.1'\" \(6241 characters\)
  109.   sed "s/^X//" >'p2latex.1' <<'END_OF_FILE'
  110. X.\"
  111. X.\" p2latex.1 - the *roff document processor source for the p2latex manual
  112. X.\"
  113. X.\" This file is part of p2latex
  114. X.\" Copyright (C) 1993 Torsten Poulin
  115. X.\"
  116. X.\" This program is free software; you can redistribute it and/or modify
  117. X.\" it under the terms of the GNU General Public License as published by
  118. X.\" the Free Software Foundation; either version 2 of the License , or
  119. X.\" (at your option) any later version.
  120. X.\"
  121. X.\" This program is distributed in the hope that it will be useful,
  122. X.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
  123. X.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  124. X.\" GNU General Public License for more details.
  125. X.\"
  126. X.\" You should have received a copy of the GNU General Public License
  127. X.\" along with this program; see the file COPYING.  If not, write to
  128. X.\" the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  129. X.\"
  130. X.\" You can contact the author by:
  131. X.\" e-mail: torsten@diku.dk
  132. X.\" snail-mail:
  133. X.\"   Torsten Poulin
  134. X.\"   Banebrinken 99, 2, 77
  135. X.\"   DK-2400 Copenhagen NV
  136. X.\"   Denmark
  137. X.\" phone: +45 39663111
  138. X.\"
  139. X.\" $Id: p2latex.1,v 1.1 93/12/20 14:43:20 Torsten Exp $
  140. X.\" $Log:    p2latex.1,v $
  141. X.\" Revision 1.1  93/12/20  14:43:20  Torsten
  142. X.\" Initial revision
  143. X.\" 
  144. X.\"
  145. X.TH P2LATEX 1
  146. X.SH NAME
  147. Xp2latex \- a Pascal to LaTeX converter
  148. X.SH SYNOPSIS
  149. X.B p2latex
  150. X[
  151. X.I options
  152. X] [
  153. X.I file
  154. X]
  155. X.SH DESCRIPTION
  156. X.B p2latex
  157. Xis a tool for generating
  158. X.I LaTeX
  159. Xsources from
  160. X.I ISO Pascal
  161. Xprograms.  It recognizes all keywords, strings, and comments. These
  162. Xrecognized parts can be typeset in different fonts.
  163. X.B p2latex
  164. Xcan generate complete
  165. X.I LaTeX
  166. Xfiles which can be passed directly through
  167. X.BR latex (1)
  168. Xor parts of
  169. X.I LaTeX
  170. Xfiles which can be included in other
  171. X.I LaTeX
  172. Xfiles (either manually or with the
  173. X.B \\\\input
  174. Xor
  175. X.B \\\\include
  176. Xcommands).
  177. X.PP
  178. XIf the
  179. X.B {\-o,\-\-output}
  180. Xoption is given, the output is written to the specified file. If the
  181. X.B {\-p,\-\-pipe}
  182. Xoption is given, the output is written to
  183. X.I stdout
  184. X(it is an error to use both options together). If none of these
  185. Xoptions are used, the output is written to a file. If the input comes
  186. Xfrom a file, the last component of that name with `.tex' appended is
  187. Xused as the output filename.
  188. X.SH OPTIONS
  189. X.B p2latex
  190. Xrecognizes the options described below. The long forms can, unless
  191. Xdisabled by the person who installed
  192. X.BR p2latex ,
  193. Xalso be introduced by a `+' or `-' instead of the
  194. X.B POSIX.2
  195. Xcompliant `--'.
  196. X.TP
  197. X.B "\-c, \-\-complete\-file"
  198. XThe output is enveloped in commands that produce a complete
  199. X.I LaTeX
  200. Xdocument.
  201. X.TP
  202. X.BI "\-e, \-\-end\-comment" " distance"
  203. XThis changes the distance between the
  204. X.I Pascal
  205. Xkeyword
  206. X.B end
  207. X(optionally followed by `;' or `.') and a following comment.  Default
  208. Xis four times the indentation step size (see the
  209. X.B {\-i,\-\-indentation}
  210. Xoption).
  211. X.TP
  212. X.B "\-f, \-\-fancy"
  213. XThe output approximates the style used in Niklaus Wirth:
  214. X.IR "Programs+Data Structures=Programs" .
  215. X.TP
  216. X.B "\-h, \-\-header"
  217. XEach page of output has a header giving the input filename.
  218. XThis option implies the
  219. X.B {\-c,\-\-complete\-file}
  220. Xoption.
  221. X.TP
  222. X.BI "\-i, \-\-indentation" " length"
  223. XGives the amount of indentation for each leading blank (tabs are
  224. Xconverted to blanks). Default is `0.5em'.
  225. X.TP
  226. X.B "\-n, \-\-no\-alignment"
  227. XComments belonging to statements are aligned to the right margin by
  228. Xdefault. You can turn off this behaviour with this option.
  229. X.TP
  230. X.BI "\-o, \-\-output" " file"
  231. XThe output is written on
  232. X.IR file .
  233. X.TP
  234. X.B "\-p, \-\-pipe"
  235. XThe output goes to
  236. X.IR stdout .
  237. X.TP
  238. X.BI "\-s, \-\-font\-size" " fontsize"
  239. XThe
  240. X.I LaTeX
  241. Xsource is set in
  242. X.IR fontsize pt.
  243. XDefault is `10'. This option is meaningless if not used in combination
  244. Xwith
  245. X.BR {\-c,\-\-complete\-file} .
  246. X.TP
  247. X.BI "\-C, \-\-comment\-font" " font"
  248. XThe comments are set in the given
  249. X.IR font .
  250. XDefault is `it'.
  251. X.TP
  252. X.BI "\-H, \-\-header\-font" " font"
  253. XThe headers are set in the given
  254. X.IR font .
  255. XDefault is `sl'.
  256. X.TP
  257. X.BI "\-I, \-\-identifier\-font" " font"
  258. XThe identifiers are set in the given
  259. X.IR font .
  260. XDefault is `it'.
  261. X.TP
  262. X.BI "\-K, \-\-keyword\-font" " font"
  263. XThe keywords are set in the given
  264. X.IR font .
  265. XDefault is `bf'.
  266. X.TP
  267. X.BI "\-S, \-\-string\-font" " font"
  268. XThe string and character constants are set in the given
  269. X.IR font .
  270. XDefault is `tt'.
  271. X.TP
  272. X.BI "\-T, \-\-tabstop" " width"
  273. XThe width of tabs is
  274. X.IR width .
  275. XDefault is `8'.
  276. X.TP
  277. X.B "\-V, \-\-version"
  278. XPrints the version number on
  279. X.IR stderr .
  280. X.PP
  281. XTo give no options at all is the same as giving the options
  282. X.nf
  283. X.RS
  284. X\-i 0.5em \-s 10 \-C it \-H sl \-I it \-K bf \-S tt \-T 8
  285. X.RE
  286. X.fi
  287. X.SH DIAGNOSTICS
  288. X.TP
  289. X.I Can't use {\-p,\-\-pipe} and {\-o,\-\-output} together
  290. XAt most one of this options may be given.
  291. X.PP
  292. X.TP
  293. X.I Can't open `<file>' for reading
  294. XThe program failed to open <file> for reading.
  295. X.PP
  296. X.TP
  297. X.I Can't open `<file>' for writing
  298. XThe program failed to open <file> for writing. All output is written
  299. Xin the current directory if not explicitly changed by
  300. X.BR {\-o,\-\-output} .
  301. X.PP
  302. X.TP
  303. X.I Virtual memory exhausted
  304. XThe program failed to allocate storage. As this is only done for the
  305. Xconstruction of the output filename, this error will normally indicate
  306. Xa program error.
  307. X.SH FILES
  308. X.TP
  309. X.I fancyheadings.sty
  310. XUsed by the output when
  311. X.B \-h
  312. Xor
  313. X.B \-\-header
  314. Xis specified.
  315. X.SH UNRESTRICTIONS
  316. X.B p2latex
  317. Xis free; anyone may redistribute copies of
  318. X.B p2latex
  319. Xto anyone under the
  320. Xterms stated in the GNU General Public Licence, a copy of which
  321. Xaccompanies each copy of
  322. X.BR p2latex .
  323. X.PP
  324. XTorsten Poulin encourages you to improve and extend
  325. X.BR p2latex ,
  326. Xand urges that you contribute your extensions to the world.
  327. X.SH "SEE ALSO"
  328. X.BR c++2latex (1),
  329. X.BR latex (1)
  330. X.SH AUTHOR
  331. XTorsten Poulin (torsten@diku.dk)
  332. X.PP
  333. X.B p2latex
  334. Xis derived from version 2.0 of
  335. X.B c++2latex
  336. Xwritten by Joerg Heitkoetter
  337. X.PP
  338. XThe original
  339. X.B c++2latex
  340. Xwas written by Norbert Kiesel.
  341. X.PP
  342. XThis manual page is an adapted version of the one for
  343. X.B c++2latex.
  344. X.SH BUGS
  345. XOnly knows about Unix pathnames. Thus, some AmigaDOS and all MS\-DOS
  346. Xinput filenames will yield unexpected results. This problem can be
  347. Xcircumvented by using the
  348. X.B {\-o,\-\-output}
  349. Xoption.
  350. X.PP
  351. XBeware of filenames that are too long for the appended `.tex' to fit.
  352. XIt would be a shame if the
  353. X.I Pascal
  354. Xsource file was inadvertently overwritten by the
  355. X.I LaTeX
  356. Xfile.
  357. END_OF_FILE
  358.   if test 6241 -ne `wc -c <'p2latex.1'`; then
  359.     echo shar: \"'p2latex.1'\" unpacked with wrong size!
  360.   fi
  361.   # end of 'p2latex.1'
  362. fi
  363. if test -f 'p2latex.c' -a "${1}" != "-c" ; then 
  364.   echo shar: Will not clobber existing file \"'p2latex.c'\"
  365. else
  366.   echo shar: Extracting \"'p2latex.c'\" \(41206 characters\)
  367.   sed "s/^X//" >'p2latex.c' <<'END_OF_FILE'
  368. X/* A lexical scanner generated by flex */
  369. X
  370. X/* scanner skeleton version:
  371. X * $Header: WPL:Generators/flex-2.3/RCS/flex.skel,v 1.2 90/07/15 01:17:26 loftus Exp $
  372. X */
  373. X
  374. X#define FLEX_SCANNER
  375. X
  376. X#include <stdio.h>
  377. X
  378. X#ifdef __STDC__
  379. X
  380. X#ifndef DONT_HAVE_STDLIB_H
  381. X#include <stdlib.h>
  382. X#else
  383. Xvoid *malloc( unsigned );
  384. Xvoid free( void* );
  385. X#endif
  386. X
  387. X#define YY_USE_PROTOS
  388. X#define YY_USE_CONST
  389. X#endif
  390. X
  391. X
  392. X/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  393. X#ifdef c_plusplus
  394. X#ifndef __cplusplus
  395. X#define __cplusplus
  396. X#endif
  397. X#endif
  398. X
  399. X
  400. X#ifdef __cplusplus
  401. X
  402. X#ifndef __STDC__
  403. X#include <stdlib.h>
  404. X#endif
  405. X
  406. X#include <osfcn.h>
  407. X
  408. X/* use prototypes in function declarations */
  409. X#define YY_USE_PROTOS
  410. X
  411. X/* the "const" storage-class-modifier is valid */
  412. X#define YY_USE_CONST
  413. X
  414. X#endif
  415. X
  416. X
  417. X#ifdef __TURBOC__
  418. X#define YY_USE_CONST
  419. X#endif
  420. X
  421. X
  422. X#ifndef YY_USE_CONST
  423. X#define const
  424. X#endif
  425. X
  426. X
  427. X#ifdef YY_USE_PROTOS
  428. X#define YY_PROTO(proto) proto
  429. X#else
  430. X#define YY_PROTO(proto) ()
  431. X/* there's no standard place to get these definitions */
  432. Xchar *malloc();
  433. Xint free();
  434. Xint read();
  435. X#endif
  436. X
  437. X
  438. X/* amount of stuff to slurp up with each read */
  439. X#ifndef YY_READ_BUF_SIZE
  440. X#define YY_READ_BUF_SIZE 8192
  441. X#endif
  442. X
  443. X/* returned upon end-of-file */
  444. X#define YY_END_TOK 0
  445. X
  446. X/* copy whatever the last rule matched to the standard output */
  447. X
  448. X/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  449. X/* this used to be an fputs(), but since the string might contain NUL's,
  450. X * we now use fwrite()
  451. X */
  452. X#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  453. X
  454. X/* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  455. X * is returned in "result".
  456. X */
  457. X#define YY_INPUT(buf,result,max_size) \
  458. X    if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
  459. X        YY_FATAL_ERROR( "read() in flex scanner failed" );
  460. X#define YY_NULL 0
  461. X
  462. X/* no semi-colon after return; correct usage is to write "yyterminate();" -
  463. X * we don't want an extra ';' after the "return" because that will cause
  464. X * some compilers to complain about unreachable statements.
  465. X */
  466. X#define yyterminate() return ( YY_NULL )
  467. X
  468. X/* report a fatal error */
  469. X
  470. X/* The funky do-while is used to turn this macro definition into
  471. X * a single C statement (which needs a semi-colon terminator).
  472. X * This avoids problems with code like:
  473. X *
  474. X *     if ( something_happens )
  475. X *        YY_FATAL_ERROR( "oops, the something happened" );
  476. X *    else
  477. X *        everything_okay();
  478. X *
  479. X * Prior to using the do-while the compiler would get upset at the
  480. X * "else" because it interpreted the "if" statement as being all
  481. X * done when it reached the ';' after the YY_FATAL_ERROR() call.
  482. X */
  483. X
  484. X#define YY_FATAL_ERROR(msg) \
  485. X    do \
  486. X        { \
  487. X        (void) fputs( msg, stderr ); \
  488. X        (void) putc( '\n', stderr ); \
  489. X        exit( 1 ); \
  490. X        } \
  491. X    while ( 0 )
  492. X
  493. X/* default yywrap function - always treat EOF as an EOF */
  494. X#define yywrap() 1
  495. X
  496. X/* enter a start condition.  This macro really ought to take a parameter,
  497. X * but we do it the disgusting crufty way forced on us by the ()-less
  498. X * definition of BEGIN
  499. X */
  500. X#define BEGIN yy_start = 1 + 2 *
  501. X
  502. X/* action number for EOF rule of a given start state */
  503. X#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  504. X
  505. X/* special action meaning "start processing a new file" */
  506. X#define YY_NEW_FILE \
  507. X    do \
  508. X        { \
  509. X        yy_init_buffer( yy_current_buffer, yyin ); \
  510. X        yy_load_buffer_state(); \
  511. X        } \
  512. X    while ( 0 )
  513. X
  514. X/* default declaration of generated scanner - a define so the user can
  515. X * easily add parameters
  516. X */
  517. X#define YY_DECL int yylex YY_PROTO(( void )) 
  518. X
  519. X/* code executed at the end of each rule */
  520. X#define YY_BREAK break;
  521. X
  522. X#define YY_END_OF_BUFFER_CHAR 0
  523. X
  524. X#ifndef YY_BUF_SIZE
  525. X#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  526. X#endif
  527. X
  528. Xtypedef struct yy_buffer_state *YY_BUFFER_STATE;
  529. X
  530. X#define YY_CHAR unsigned char
  531. X# line 1 "p2latex.l"
  532. X#define INITIAL 0
  533. X/*
  534. X *  p2LaTeX: Produce prettyprinted LaTeX files from Pascal sources.
  535. X *  Copyright (C) 1993 Torsten Poulin
  536. X *    Note: This program is derived from work done by others (see below).
  537. X *
  538. X *  This program is free software; you can redistribute it and/or modify
  539. X *  it under the terms of the GNU General Public License as published by
  540. X *  the Free Software Foundation; either version 2, or (at your option)
  541. X *  any later version.
  542. X *
  543. X *  This program is distributed in the hope that it will be useful,
  544. X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  545. X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  546. X *  GNU General Public License for more details.
  547. X *
  548. X *  You should have received a copy of the GNU General Public License
  549. X *  along with this program; if not, write to the Free Software
  550. X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  551. X *
  552. X *  Torsten Poulin 
  553. X *  Banebrinken 99, 2, 77
  554. X *  DK-2400 Copenhagen NV
  555. X *  DENMARK
  556. X *
  557. X *  e-mail: torsten@diku.dk
  558. X *  --------------------------------------------------------------------
  559. X *  p2latex is derived from the code for the program C++2LaTeX 2.0 which
  560. X *  produces prettyprinted LaTeX files from C++ or C sources.
  561. X *
  562. X *  C++2LaTeX 2.0 is copyright (C) 1991 Joerg Heitkoetter
  563. X *
  564. X *     Systems Analysis Research Group
  565. X *     University of Dortmund
  566. X *     (heitkoet@gorbi.informatik.uni-dortmund.de).
  567. X *
  568. X *  The original C++2LaTeX is copyright (C) 1990 Norbert Kiesel
  569. X *
  570. X *      Norbert Kiesel
  571. X *      RWTH Aachen / Institut f. Informatik III
  572. X *      Ahornstr. 55
  573. X *      D-5100 Aachen
  574. X *      West Germany
  575. X *
  576. X *      Phone:  +49 241 80-7266
  577. X *      EUNET:  norbert@rwthi3.uucp
  578. X *      USENET: ...!mcvax!unido!rwthi3!norbert
  579. X *      X.400:  norbert@rwthi3.informatik.rwth-aachen.de
  580. X *  --------------------------------------------------------------------
  581. X * p2latex p2main.l revision history.
  582. X * $Log:    p2latex.l,v $
  583. X * Revision 1.3  93/12/09  01:20:12  Torsten
  584. X * Now sets the insidestring flag when inside a string.
  585. X * Corrected the indentation of comments preceded only by white-space.
  586. X * The copyleft comment now refers to version 2 of the GPL.
  587. X * 
  588. X * Revision 1.2  93/11/06  14:43:51  Torsten
  589. X * Added a few lines to the comment at the top of the program
  590. X * giving credit to the authors of C++2LaTeX.
  591. X * Minus now emits -- (a TeX number-range dash) when not in
  592. X * a comment or a string.
  593. X * Strings are now printed using \frenchspacing to suppress
  594. X * extra space after punctuation. 
  595. X * 
  596. X * Revision 1.1  93/10/15  23:41:49  Torsten
  597. X * Initial revision
  598. X *
  599. X */
  600. X#define STRING 1
  601. X#define BCOMMENT 2
  602. X# line 72 "p2latex.l"
  603. X#define KEY        printf ("{\\%s %s}", keyword_font, yytext)
  604. X#define FANCYKEY(x)    fancysymbols ? printf(x) : KEY
  605. X#define SYM(x)        printf ("$\\%s$", x)
  606. X#define FANCY(x,y)    printf ("%s", fancysymbols ? x : y)
  607. X#define OUT(x)        printf ("%s", x)
  608. X#define ETAB        printf ("\\hspace*{%d\\indentation}", tabtoend)
  609. X#define CTAB        printf ("\\hspace*{%d\\indentation}", tabtocomment)
  610. X#define FONT(x)        printf ("{\\%s ",x)
  611. X#define SUB(x)        substitute(x)
  612. X#define IDENTIFIER    printf ("{\\%s %s\\/}", ident_font, yytext)
  613. X#define IND        indent(yytext)
  614. X#define INIT        BEGIN (INITIAL);
  615. X
  616. X#include <stdio.h>
  617. X
  618. Xstatic char RCSid[] = "$Id: p2latex.l,v 1.3 93/12/09 01:20:12 Torsten Rel $";
  619. X
  620. Xstatic void nindent(char *, int);
  621. Xint insidestring    = 0;
  622. X
  623. Xint complete_file    = 0;
  624. Xint header        = 0;
  625. Xint tabtotab        = 8;
  626. Xint piped        = 0;
  627. Xint fancysymbols    = 0;
  628. X
  629. Xint aligntoright    = 1;        /* align comments to the right */
  630. Xint tabtoend        = 2;        /* distance between end and comment */
  631. Xint tabtocomment    = 4;        /* distance between statement and comment*/
  632. X
  633. Xchar *font_size        = "10";
  634. Xchar *indentation    = "0.5em";
  635. Xchar *comment_font    = "it";
  636. Xchar *ident_font    = "it";
  637. Xchar *keyword_font    = "bf";
  638. Xchar *header_font    = "sl";
  639. Xchar *string_font    = "tt";
  640. X
  641. X#ifdef __STDC__
  642. Xvoid substitute(const char *);
  643. Xvoid indent(const char *);
  644. Xvoid newpage(int);
  645. Xvoid usage(const char *);
  646. X#else
  647. Xvoid substitute();
  648. Xvoid indent();
  649. Xvoid newpage();
  650. Xvoid usage();
  651. X#endif
  652. X# line 123 "p2latex.l"
  653. X
  654. X/* done after the current pattern has been matched and before the
  655. X * corresponding action - sets up yytext
  656. X */
  657. X#define YY_DO_BEFORE_ACTION \
  658. X    yytext = yy_bp; \
  659. X    yyleng = yy_cp - yy_bp; \
  660. X    yy_hold_char = *yy_cp; \
  661. X    *yy_cp = '\0'; \
  662. X    yy_c_buf_p = yy_cp;
  663. X
  664. X#define EOB_ACT_CONTINUE_SCAN 0
  665. X#define EOB_ACT_END_OF_FILE 1
  666. X#define EOB_ACT_LAST_MATCH 2
  667. X
  668. X/* return all but the first 'n' matched characters back to the input stream */
  669. X#define yyless(n) \
  670. X    do \
  671. X        { \
  672. X        /* undo effects of setting up yytext */ \
  673. X        *yy_cp = yy_hold_char; \
  674. X        yy_c_buf_p = yy_cp = yy_bp + n; \
  675. X        YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  676. X        } \
  677. X    while ( 0 )
  678. X
  679. X#define unput(c) yyunput( c, yytext )
  680. X
  681. X
  682. Xstruct yy_buffer_state
  683. X    {
  684. X    FILE *yy_input_file;
  685. X
  686. X    YY_CHAR *yy_ch_buf;        /* input buffer */
  687. X    YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  688. X
  689. X    /* size of input buffer in bytes, not including room for EOB characters*/
  690. X    int yy_buf_size;    
  691. X
  692. X    /* number of characters read into yy_ch_buf, not including EOB characters */
  693. X    int yy_n_chars;
  694. X
  695. X    int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  696. X#define EOF_NOT_SEEN 0
  697. X    /* "pending" happens when the EOF has been seen but there's still
  698. X     * some text process
  699. X     */
  700. X#define EOF_PENDING 1
  701. X#define EOF_DONE 2
  702. X    };
  703. X
  704. Xstatic YY_BUFFER_STATE yy_current_buffer;
  705. X
  706. X/* we provide macros for accessing buffer states in case in the
  707. X * future we want to put the buffer states in a more general
  708. X * "scanner state"
  709. X */
  710. X#define YY_CURRENT_BUFFER yy_current_buffer
  711. X
  712. X
  713. X/* yy_hold_char holds the character lost when yytext is formed */
  714. Xstatic YY_CHAR yy_hold_char;
  715. X
  716. Xstatic int yy_n_chars;        /* number of characters read into yy_ch_buf */
  717. X
  718. X
  719. X
  720. X#ifndef YY_USER_ACTION
  721. X#define YY_USER_ACTION
  722. X#endif
  723. X
  724. X#ifndef YY_USER_INIT
  725. X#define YY_USER_INIT
  726. X#endif
  727. X
  728. Xextern YY_CHAR *yytext;
  729. Xextern int yyleng;
  730. Xextern FILE *yyin, *yyout;
  731. X
  732. XYY_CHAR *yytext;
  733. Xint yyleng;
  734. X
  735. XFILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  736. X
  737. X#define YY_END_OF_BUFFER 82
  738. Xtypedef int yy_state_type;
  739. Xstatic const short int yy_accept[204] =
  740. X    {   0,
  741. X        0,    0,    0,    0,    0,    0,   82,   81,   78,   80,
  742. X       79,   67,   45,   46,   39,   52,   49,   44,   50,   41,
  743. X       76,   47,   51,   42,   48,   43,   53,   54,   40,   55,
  744. X       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
  745. X       55,   55,   55,   55,   55,   55,   55,   55,   55,   61,
  746. X       77,   45,   59,   71,   69,   68,   70,   66,   65,   64,
  747. X       66,   63,   78,   79,   60,   72,   73,   76,    0,   36,
  748. X       38,   37,   55,   55,   55,   55,   55,   55,   55,    6,
  749. X       55,   55,   55,   55,   55,   55,   14,   15,   67,   55,
  750. X       55,   55,   55,   19,   35,   55,   55,   55,   55,   55,
  751. X
  752. X       27,   55,   55,   55,   55,   55,   77,    0,   59,   58,
  753. X       70,   65,   62,    0,   72,    0,    0,   74,   33,   55,
  754. X       55,   55,   55,    5,   55,   55,    9,   55,   11,   55,
  755. X       55,   55,   17,   18,   34,   55,   55,   55,   55,   25,
  756. X       55,   55,   55,   30,   55,   55,   58,    0,   74,    0,
  757. X       75,   55,   55,    3,   55,   55,    8,    0,    0,    0,
  758. X       57,   10,   55,   13,   55,   55,   55,   55,   55,   55,
  759. X       26,   28,   55,   55,   32,    1,    2,    4,   55,   56,
  760. X       55,   16,   55,   55,   55,   55,   55,   29,   31,    7,
  761. X       55,   20,   55,   55,   23,   24,   55,   55,   22,   12,
  762. X
  763. X       55,   21,    0
  764. X    } ;
  765. X
  766. Xstatic const YY_CHAR yy_ec[256] =
  767. X    {   0,
  768. X        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  769. X        1,    4,    1,    1,    1,    1,    1,    1,    1,    1,
  770. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  771. X        1,    2,    1,    1,    1,    1,    1,    1,    5,    6,
  772. X        7,    8,    9,   10,   11,   12,   13,   14,   14,   14,
  773. X       14,   14,   14,   14,   14,   14,   14,   15,   16,   17,
  774. X       18,   19,    1,    1,   24,   25,   26,   27,   28,   29,
  775. X       30,   31,   32,   23,   33,   34,   35,   36,   37,   38,
  776. X       23,   39,   40,   41,   42,   43,   44,   23,   45,   23,
  777. X       20,    1,   21,   22,   23,    1,   24,   25,   26,   27,
  778. X
  779. X       28,   29,   30,   31,   32,   23,   33,   34,   35,   36,
  780. X       37,   38,   23,   39,   40,   41,   42,   43,   44,   23,
  781. X       45,   23,   46,    1,   47,    1,    1,    1,    1,    1,
  782. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  783. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  784. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  785. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  786. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  787. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  788. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  789. X
  790. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  791. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  792. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  793. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  794. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  795. X        1,    1,    1,    1,    1
  796. X    } ;
  797. X
  798. Xstatic const YY_CHAR yy_meta[48] =
  799. X    {   0,
  800. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  801. X        1,    1,    1,    2,    1,    1,    1,    1,    1,    1,
  802. X        1,    1,    2,    2,    2,    2,    2,    2,    2,    2,
  803. X        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
  804. X        2,    2,    2,    2,    2,    1,    1
  805. X    } ;
  806. X
  807. Xstatic const short int yy_base[207] =
  808. X    {   0,
  809. X        0,   46,   46,   51,   55,   57,  236,  237,  233,  237,
  810. X      231,  237,  225,  237,  237,  237,  237,  237,  218,  237,
  811. X       50,  237,  237,   48,  237,  213,  237,  237,  237,    0,
  812. X       32,  202,   37,   18,   36,   43,  192,   40,   72,  191,
  813. X       47,   44,   58,  199,  198,   50,  189,  200,   57,  237,
  814. X       84,  215,  237,  237,  237,  237,  220,  237,  219,  237,
  815. X      213,  237,  217,  237,  237,   77,   79,   86,   92,  237,
  816. X      237,  237,    0,  191,  178,  186,  175,  178,  170,  168,
  817. X      171,  183,  175,  169,  171,  165,    0,    0,  237,  180,
  818. X      177,  169,  161,    0,    0,  175,  163,   73,  158,  170,
  819. X
  820. X        0,  159,  155,  156,  162,  152,  106,  184,  237,  237,
  821. X      189,  188,  237,  104,   95,  108,  175,  174,    0,  163,
  822. X      154,  157,  144,    0,  147,  154,  119,  153,    0,  154,
  823. X      142,  150,    0,    0,    0,  139,   90,  134,  142,    0,
  824. X      133,  139,  134,    0,  130,  132,  237,  148,  147,  146,
  825. X      145,  113,  121,    0,  115,  114,    0,  122,  146,  127,
  826. X      237,    0,  112,    0,  117,  122,  121,  109,  108,  122,
  827. X        0,    0,  111,  116,    0,    0,    0,    0,  106,  237,
  828. X      110,    0,  114,  113,  115,  111,   96,    0,    0,    0,
  829. X       99,    0,   92,   97,    0,    0,   91,   87,    0,    0,
  830. X
  831. X       82,    0,  237,  173,  175,   92
  832. X    } ;
  833. X
  834. Xstatic const short int yy_def[207] =
  835. X    {   0,
  836. X      203,    1,  204,  204,  205,  205,  203,  203,  203,  203,
  837. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  838. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  206,
  839. X      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
  840. X      206,  206,  206,  206,  206,  206,  206,  206,  206,  203,
  841. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  842. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  843. X      203,  203,  206,  206,  206,  206,  206,  206,  206,  206,
  844. X      206,  206,  206,  206,  206,  206,  206,  206,  203,  206,
  845. X      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
  846. X
  847. X      206,  206,  206,  206,  206,  206,  203,  203,  203,  203,
  848. X      203,  203,  203,  203,  203,  203,  203,  203,  206,  206,
  849. X      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
  850. X      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
  851. X      206,  206,  206,  206,  206,  206,  203,  203,  203,  203,
  852. X      203,  206,  206,  206,  206,  206,  206,  203,  203,  203,
  853. X      203,  206,  206,  206,  206,  206,  206,  206,  206,  206,
  854. X      206,  206,  206,  206,  206,  206,  206,  206,  206,  203,
  855. X      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
  856. X      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
  857. X
  858. X      206,  206,    0,  203,  203,  203
  859. X    } ;
  860. X
  861. Xstatic const short int yy_nxt[285] =
  862. X    {   0,
  863. X        8,    9,   10,   11,   12,   13,   14,   15,   16,   17,
  864. X       18,   19,   20,   21,   22,   23,   24,   25,   26,   27,
  865. X       28,   29,   30,   31,   32,   33,   34,   35,   36,   37,
  866. X       30,   38,   30,   39,   40,   41,   42,   43,   44,   45,
  867. X       46,   47,   48,   49,   30,   50,    8,   51,   55,   79,
  868. X       56,   52,   57,   55,   80,   56,   59,   60,   59,   60,
  869. X       77,   67,   61,   68,   61,   70,   71,   74,   87,   81,
  870. X       75,   82,   94,   78,   83,   88,   89,   69,   92,   84,
  871. X      100,   96,   95,   93,   85,  107,  101,  105,  106,  108,
  872. X       66,   53,  115,   73,  102,   90,   97,   67,  138,   68,
  873. X
  874. X      117,   62,  117,   62,  114,  118,  116,  107,  115,  202,
  875. X      139,  108,  148,   69,  148,  167,  150,  149,  150,  168,
  876. X      158,  151,   69,  158,  159,  201,  200,  159,  158,  109,
  877. X      160,  199,  159,  198,  160,  197,  196,  195,  194,  193,
  878. X      192,  191,  190,  189,  188,  187,  186,  185,  184,  183,
  879. X      182,  109,  181,  180,  179,  178,  177,  176,  151,  151,
  880. X      149,  149,  175,  174,  161,  173,  172,  161,  171,  170,
  881. X      169,  166,  161,   54,   54,   58,   58,  165,  164,  163,
  882. X      162,  157,  156,  155,  154,  153,  152,  118,  118,  112,
  883. X      111,  147,  146,  145,  144,  143,  142,  141,  140,  137,
  884. X
  885. X      136,  135,  134,  133,  132,  131,  130,  129,  128,  127,
  886. X      126,  125,  124,  123,  122,  121,  120,  119,   63,  113,
  887. X      112,  111,  110,  104,  103,   99,   98,   91,   86,   76,
  888. X       72,   66,   65,   64,   63,  203,    7,  203,  203,  203,
  889. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  890. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  891. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  892. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  893. X      203,  203,  203,  203
  894. X    } ;
  895. X
  896. Xstatic const short int yy_chk[285] =
  897. X    {   0,
  898. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  899. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  900. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  901. X        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  902. X        1,    1,    1,    1,    1,    1,    1,    2,    3,   34,
  903. X        3,    2,    4,    4,   34,    4,    5,    5,    6,    6,
  904. X       33,   21,    5,   21,    6,   24,   24,   31,   38,   35,
  905. X       31,   35,   42,   33,   36,   38,   39,   21,   41,   36,
  906. X       46,   43,   42,   41,   36,   51,   46,   49,   49,   51,
  907. X       66,    2,   67,  206,   46,   39,   43,   68,   98,   68,
  908. X
  909. X       69,    5,   69,    6,   66,   69,   67,  107,  115,  201,
  910. X       98,  107,  114,   68,  114,  137,  116,  114,  116,  137,
  911. X      127,  116,  115,  158,  127,  198,  197,  158,  160,   51,
  912. X      127,  194,  160,  193,  127,  191,  187,  186,  185,  184,
  913. X      183,  181,  179,  174,  173,  170,  169,  168,  167,  166,
  914. X      165,  107,  163,  159,  156,  155,  153,  152,  151,  150,
  915. X      149,  148,  146,  145,  127,  143,  142,  158,  141,  139,
  916. X      138,  136,  160,  204,  204,  205,  205,  132,  131,  130,
  917. X      128,  126,  125,  123,  122,  121,  120,  118,  117,  112,
  918. X      111,  108,  106,  105,  104,  103,  102,  100,   99,   97,
  919. X
  920. X       96,   93,   92,   91,   90,   86,   85,   84,   83,   82,
  921. X       81,   80,   79,   78,   77,   76,   75,   74,   63,   61,
  922. X       59,   57,   52,   48,   47,   45,   44,   40,   37,   32,
  923. X       26,   19,   13,   11,    9,    7,  203,  203,  203,  203,
  924. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  925. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  926. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  927. X      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
  928. X      203,  203,  203,  203
  929. X    } ;
  930. X
  931. Xstatic yy_state_type yy_last_accepting_state;
  932. Xstatic YY_CHAR *yy_last_accepting_cpos;
  933. X
  934. X/* the intent behind this definition is that it'll catch
  935. X * any uses of REJECT which flex missed
  936. X */
  937. X#define REJECT reject_used_but_not_detected
  938. X#define yymore() yymore_used_but_not_detected
  939. X#define YY_MORE_ADJ 0
  940. X
  941. X/* these variables are all declared out here so that section 3 code can
  942. X * manipulate them
  943. X */
  944. X/* points to current character in buffer */
  945. Xstatic YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  946. Xstatic int yy_init = 1;        /* whether we need to initialize */
  947. Xstatic int yy_start = 0;    /* start state number */
  948. X
  949. X/* flag which is used to allow yywrap()'s to do buffer switches
  950. X * instead of setting up a fresh yyin.  A bit of a hack ...
  951. X */
  952. Xstatic int yy_did_buffer_switch_on_eof;
  953. X
  954. Xstatic yy_state_type yy_get_previous_state YY_PROTO(( void ));
  955. Xstatic yy_state_type yy_try_NUL_trans YY_PROTO(( register yy_state_type current_state ));
  956. Xstatic int yy_get_next_buffer YY_PROTO(( void ));
  957. Xstatic void yyunput YY_PROTO(( YY_CHAR c, register YY_CHAR *buf_ptr ));
  958. Xvoid yyrestart YY_PROTO(( FILE *input_file ));
  959. Xvoid yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  960. Xvoid yy_load_buffer_state YY_PROTO(( void ));
  961. XYY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  962. Xvoid yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  963. Xvoid yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  964. X
  965. X#define yy_new_buffer yy_create_buffer
  966. X
  967. X#ifdef __cplusplus
  968. Xstatic int yyinput YY_PROTO(( void ));
  969. X#else
  970. Xstatic int input YY_PROTO(( void ));
  971. X#endif
  972. X
  973. XYY_DECL
  974. X    {
  975. X    register yy_state_type yy_current_state;
  976. X    register YY_CHAR *yy_cp, *yy_bp;
  977. X    register int yy_act;
  978. X
  979. X
  980. X
  981. X            INIT;
  982. X
  983. X
  984. X    if ( yy_init )
  985. X    {
  986. X    YY_USER_INIT;
  987. X
  988. X    if ( ! yy_start )
  989. X        yy_start = 1;    /* first start state */
  990. X
  991. X    if ( ! yyin )
  992. X        yyin = stdin;
  993. X
  994. X    if ( ! yyout )
  995. X        yyout = stdout;
  996. X
  997. X    if ( yy_current_buffer )
  998. X        yy_init_buffer( yy_current_buffer, yyin );
  999. X    else
  1000. X        yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  1001. X
  1002. X    yy_load_buffer_state();
  1003. X
  1004. X    yy_init = 0;
  1005. X    }
  1006. X
  1007. X    while ( 1 )        /* loops until end-of-file is reached */
  1008. X    {
  1009. X    yy_cp = yy_c_buf_p;
  1010. X
  1011. X    /* support of yytext */
  1012. X    *yy_cp = yy_hold_char;
  1013. X
  1014. X    /* yy_bp points to the position in yy_ch_buf of the start of the
  1015. X     * current run.
  1016. X     */
  1017. X    yy_bp = yy_cp;
  1018. X
  1019. X    yy_current_state = yy_start;
  1020. X    if ( yy_bp[-1] == '\n' )
  1021. X        ++yy_current_state;
  1022. Xyy_match:
  1023. X    do
  1024. X        {
  1025. X        register YY_CHAR yy_c = yy_ec[*yy_cp];
  1026. X        if ( yy_accept[yy_current_state] )
  1027. X        {
  1028. X        yy_last_accepting_state = yy_current_state;
  1029. X        yy_last_accepting_cpos = yy_cp;
  1030. X        }
  1031. X        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1032. X        {
  1033. X        yy_current_state = yy_def[yy_current_state];
  1034. X        if ( yy_current_state >= 204 )
  1035. X            yy_c = yy_meta[yy_c];
  1036. X        }
  1037. X        yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1038. X        ++yy_cp;
  1039. X        }
  1040. X    while ( yy_current_state != 203 );
  1041. X    yy_cp = yy_last_accepting_cpos;
  1042. X    yy_current_state = yy_last_accepting_state;
  1043. X
  1044. Xyy_find_action:
  1045. X    yy_act = yy_accept[yy_current_state];
  1046. X
  1047. X    YY_DO_BEFORE_ACTION;
  1048. X    YY_USER_ACTION;
  1049. X
  1050. Xdo_action:    /* this label is used only to access EOF actions */
  1051. X
  1052. X
  1053. X    switch ( yy_act )
  1054. X        {
  1055. X        case 0: /* must backtrack */
  1056. X        /* undo the effects of YY_DO_BEFORE_ACTION */
  1057. X        *yy_cp = yy_hold_char;
  1058. X        yy_cp = yy_last_accepting_cpos;
  1059. X        yy_current_state = yy_last_accepting_state;
  1060. X        goto yy_find_action;
  1061. X
  1062. Xcase 1:
  1063. X# line 128 "p2latex.l"
  1064. Xcase 2:
  1065. X# line 129 "p2latex.l"
  1066. Xcase 3:
  1067. X# line 130 "p2latex.l"
  1068. Xcase 4:
  1069. X# line 131 "p2latex.l"
  1070. Xcase 5:
  1071. X# line 132 "p2latex.l"
  1072. Xcase 6:
  1073. X# line 133 "p2latex.l"
  1074. Xcase 7:
  1075. X# line 134 "p2latex.l"
  1076. Xcase 8:
  1077. X# line 135 "p2latex.l"
  1078. Xcase 9:
  1079. X# line 136 "p2latex.l"
  1080. Xcase 10:
  1081. X# line 137 "p2latex.l"
  1082. Xcase 11:
  1083. X# line 138 "p2latex.l"
  1084. Xcase 12:
  1085. X# line 139 "p2latex.l"
  1086. Xcase 13:
  1087. X# line 140 "p2latex.l"
  1088. Xcase 14:
  1089. X# line 141 "p2latex.l"
  1090. Xcase 15:
  1091. X# line 142 "p2latex.l"
  1092. Xcase 16:
  1093. X# line 143 "p2latex.l"
  1094. Xcase 17:
  1095. X# line 144 "p2latex.l"
  1096. Xcase 18:
  1097. X# line 145 "p2latex.l"
  1098. Xcase 19:
  1099. X# line 146 "p2latex.l"
  1100. Xcase 20:
  1101. X# line 147 "p2latex.l"
  1102. Xcase 21:
  1103. X# line 148 "p2latex.l"
  1104. Xcase 22:
  1105. X# line 149 "p2latex.l"
  1106. Xcase 23:
  1107. X# line 150 "p2latex.l"
  1108. Xcase 24:
  1109. X# line 151 "p2latex.l"
  1110. Xcase 25:
  1111. X# line 152 "p2latex.l"
  1112. Xcase 26:
  1113. X# line 153 "p2latex.l"
  1114. Xcase 27:
  1115. X# line 154 "p2latex.l"
  1116. Xcase 28:
  1117. X# line 155 "p2latex.l"
  1118. Xcase 29:
  1119. X# line 156 "p2latex.l"
  1120. Xcase 30:
  1121. X# line 157 "p2latex.l"
  1122. Xcase 31:
  1123. X# line 158 "p2latex.l"
  1124. Xcase 32:
  1125. X# line 158 "p2latex.l"
  1126. XKEY;
  1127. X    YY_BREAK
  1128. Xcase 33:
  1129. X# line 159 "p2latex.l"
  1130. XFANCYKEY("$\\wedge$");
  1131. X    YY_BREAK
  1132. Xcase 34:
  1133. X# line 160 "p2latex.l"
  1134. XFANCYKEY("$\\neg$");
  1135. X    YY_BREAK
  1136. Xcase 35:
  1137. X# line 161 "p2latex.l"
  1138. XFANCYKEY("$\\vee");
  1139. X    YY_BREAK
  1140. Xcase 36:
  1141. X# line 162 "p2latex.l"
  1142. XFANCY ("$\\leq$", "$<$=");
  1143. X    YY_BREAK
  1144. Xcase 37:
  1145. X# line 163 "p2latex.l"
  1146. XFANCY ("$\\geq$", "$>$=");
  1147. X    YY_BREAK
  1148. Xcase 38:
  1149. X# line 164 "p2latex.l"
  1150. XFANCY ("$\\neq$", "$<>$");
  1151. X    YY_BREAK
  1152. Xcase 39:
  1153. X# line 165 "p2latex.l"
  1154. XSYM ("ast");
  1155. X    YY_BREAK
  1156. Xcase 40:
  1157. X# line 166 "p2latex.l"
  1158. XSYM ("uparrow");
  1159. X    YY_BREAK
  1160. Xcase 41:
  1161. X# line 167 "p2latex.l"
  1162. XOUT ("$/$");
  1163. X    YY_BREAK
  1164. Xcase 42:
  1165. X# line 168 "p2latex.l"
  1166. XOUT ("$<$");
  1167. X    YY_BREAK
  1168. Xcase 43:
  1169. X# line 169 "p2latex.l"
  1170. XOUT ("$>$");
  1171. X    YY_BREAK
  1172. Xcase 44:
  1173. X# line 170 "p2latex.l"
  1174. XOUT ("--");
  1175. X    YY_BREAK
  1176. Xcase 45:
  1177. X# line 172 "p2latex.l"
  1178. Xcase 46:
  1179. X# line 173 "p2latex.l"
  1180. Xcase 47:
  1181. X# line 174 "p2latex.l"
  1182. Xcase 48:
  1183. X# line 175 "p2latex.l"
  1184. Xcase 49:
  1185. X# line 176 "p2latex.l"
  1186. Xcase 50:
  1187. X# line 177 "p2latex.l"
  1188. Xcase 51:
  1189. X# line 178 "p2latex.l"
  1190. Xcase 52:
  1191. X# line 179 "p2latex.l"
  1192. Xcase 53:
  1193. X# line 180 "p2latex.l"
  1194. Xcase 54:
  1195. X# line 180 "p2latex.l"
  1196. XECHO;
  1197. X    YY_BREAK
  1198. Xcase 55:
  1199. X# line 182 "p2latex.l"
  1200. XIDENTIFIER;
  1201. X    YY_BREAK
  1202. X /* Comments mini scanner */
  1203. X /* 1. Comment after 'end;', 'end.', or 'end'  */
  1204. Xcase 56:
  1205. X# line 186 "p2latex.l"
  1206. X{ BEGIN (BCOMMENT);
  1207. X                { int i;
  1208. X                  printf("{\\%s ", keyword_font);
  1209. X                  for (i = 0; i < 3; i++)
  1210. X                    printf("%c", yytext[i]);
  1211. X                  printf("}");
  1212. X                  if (yytext[i] == ';' || yytext[i] == '.')
  1213. X                    printf("%c", yytext[i]); }
  1214. X                                ETAB;
  1215. X                                OUT ("($\\ast$");
  1216. X                                FONT (comment_font); }
  1217. X    YY_BREAK
  1218. Xcase 57:
  1219. X# line 197 "p2latex.l"
  1220. X{ BEGIN (BCOMMENT);
  1221. X                { int i;
  1222. X                  printf("{\\%s ", keyword_font);
  1223. X                  for (i = 0; i < 3; i++)
  1224. X                    printf("%c", yytext[i]);
  1225. X                  printf("}");
  1226. X                  if (yytext[i] == ';' || yytext[i] == '.')
  1227. X                    printf("%c", yytext[i]); }
  1228. X                                ETAB;
  1229. X                                OUT ("\\{");
  1230. X                                FONT (comment_font); }
  1231. X    YY_BREAK
  1232. X /* 2. Comments at the beginning of a line */
  1233. Xcase 58:
  1234. X# line 210 "p2latex.l"
  1235. X{ BEGIN (BCOMMENT);
  1236. X                nindent(yytext, yyleng - 2);
  1237. X                                OUT ("($\\ast$");
  1238. X                FONT (comment_font); }
  1239. X    YY_BREAK
  1240. Xcase 59:
  1241. X# line 214 "p2latex.l"
  1242. X{ BEGIN (BCOMMENT);
  1243. X                nindent(yytext, yyleng - 1);
  1244. X                OUT ("\\{");
  1245. X                FONT (comment_font); }
  1246. X    YY_BREAK
  1247. X /* 3. Other comments, aligned to right side of paper */
  1248. Xcase 60:
  1249. X# line 220 "p2latex.l"
  1250. X{ BEGIN (BCOMMENT);
  1251. X                                if (aligntoright) {
  1252. X                    OUT ("\\hfill");
  1253. X                } else {
  1254. X                    CTAB;
  1255. X                }
  1256. X                                OUT ("($\\ast$");
  1257. X                FONT (comment_font); }
  1258. X    YY_BREAK
  1259. Xcase 61:
  1260. X# line 228 "p2latex.l"
  1261. X{ BEGIN (BCOMMENT);
  1262. X                                if (aligntoright) {
  1263. X                    OUT ("\\hfill");
  1264. X                } else {
  1265. X                    CTAB;
  1266. X                }
  1267. X                                OUT ("\\{");
  1268. X                FONT (comment_font); }
  1269. X    YY_BREAK
  1270. Xcase 62:
  1271. X# line 238 "p2latex.l"
  1272. X{ INIT; OUT ("}$\\ast$)"); }
  1273. X    YY_BREAK
  1274. Xcase 63:
  1275. X# line 239 "p2latex.l"
  1276. X{ INIT; OUT ("}\\}"); }
  1277. X    YY_BREAK
  1278. Xcase 64:
  1279. X# line 240 "p2latex.l"
  1280. XOUT ("\\mbox{}\\\\\n");
  1281. X    YY_BREAK
  1282. Xcase 65:
  1283. X# line 241 "p2latex.l"
  1284. XIND;
  1285. X    YY_BREAK
  1286. Xcase 66:
  1287. X# line 242 "p2latex.l"
  1288. XSUB (yytext);
  1289. X    YY_BREAK
  1290. Xcase 67:
  1291. X# line 244 "p2latex.l"
  1292. X{ BEGIN (STRING);
  1293. X                FONT (string_font);
  1294. X                OUT ("\\frenchspacing{");
  1295. X                OUT ("\'");
  1296. X                insidestring = 1; }
  1297. X    YY_BREAK
  1298. Xcase 68:
  1299. X# line 249 "p2latex.l"
  1300. X{ INIT;
  1301. X                OUT ("\'}}");
  1302. X                insidestring = 0; }
  1303. X    YY_BREAK
  1304. Xcase 69:
  1305. X# line 252 "p2latex.l"
  1306. XOUT ("\\mbox{}\\\\\n");
  1307. X    YY_BREAK
  1308. Xcase 70:
  1309. X# line 253 "p2latex.l"
  1310. XIND;
  1311. X    YY_BREAK
  1312. Xcase 71:
  1313. X# line 254 "p2latex.l"
  1314. XSUB (yytext);
  1315. X    YY_BREAK
  1316. Xcase 72:
  1317. X# line 257 "p2latex.l"
  1318. Xcase 73:
  1319. X# line 258 "p2latex.l"
  1320. Xcase 74:
  1321. X# line 259 "p2latex.l"
  1322. Xcase 75:
  1323. X# line 259 "p2latex.l"
  1324. XECHO;
  1325. X    YY_BREAK
  1326. Xcase 76:
  1327. X# line 261 "p2latex.l"
  1328. XECHO;
  1329. X    YY_BREAK
  1330. Xcase 77:
  1331. X# line 263 "p2latex.l"
  1332. XIND;
  1333. X    YY_BREAK
  1334. Xcase 78:
  1335. X# line 264 "p2latex.l"
  1336. XECHO;
  1337. X    YY_BREAK
  1338. Xcase 79:
  1339. X# line 265 "p2latex.l"
  1340. XOUT ("\\newpage\n");
  1341. X    YY_BREAK
  1342. Xcase 80:
  1343. X# line 266 "p2latex.l"
  1344. XOUT ("\\mbox{}\\\\\n");
  1345. X    YY_BREAK
  1346. Xcase 81:
  1347. X# line 268 "p2latex.l"
  1348. XECHO;
  1349. X    YY_BREAK
  1350. Xcase YY_STATE_EOF(INITIAL):
  1351. Xcase YY_STATE_EOF(STRING):
  1352. Xcase YY_STATE_EOF(BCOMMENT):
  1353. X    yyterminate();
  1354. X
  1355. X        case YY_END_OF_BUFFER:
  1356. X        {
  1357. X        /* amount of text matched not including the EOB char */
  1358. X        int yy_amount_of_matched_text = yy_cp - yytext - 1;
  1359. X
  1360. X        /* undo the effects of YY_DO_BEFORE_ACTION */
  1361. X        *yy_cp = yy_hold_char;
  1362. X
  1363. X        /* note that here we test for yy_c_buf_p "<=" to the position
  1364. X         * of the first EOB in the buffer, since yy_c_buf_p will
  1365. X         * already have been incremented past the NUL character
  1366. X         * (since all states make transitions on EOB to the end-
  1367. X         * of-buffer state).  Contrast this with the test in yyinput().
  1368. X         */
  1369. X        if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1370. X            /* this was really a NUL */
  1371. X            {
  1372. X            yy_state_type yy_next_state;
  1373. X
  1374. X            yy_c_buf_p = yytext + yy_amount_of_matched_text;
  1375. X
  1376. X            yy_current_state = yy_get_previous_state();
  1377. X
  1378. X            /* okay, we're now positioned to make the
  1379. X             * NUL transition.  We couldn't have
  1380. X             * yy_get_previous_state() go ahead and do it
  1381. X             * for us because it doesn't know how to deal
  1382. X             * with the possibility of jamming (and we
  1383. X             * don't want to build jamming into it because
  1384. X             * then it will run more slowly)
  1385. X             */
  1386. X
  1387. X            yy_next_state = yy_try_NUL_trans( yy_current_state );
  1388. X
  1389. X            yy_bp = yytext + YY_MORE_ADJ;
  1390. X
  1391. X            if ( yy_next_state )
  1392. X            {
  1393. X            /* consume the NUL */
  1394. X            yy_cp = ++yy_c_buf_p;
  1395. X            yy_current_state = yy_next_state;
  1396. X            goto yy_match;
  1397. X            }
  1398. X
  1399. X            else
  1400. X            {
  1401. X                yy_cp = yy_last_accepting_cpos;
  1402. X                yy_current_state = yy_last_accepting_state;
  1403. X            goto yy_find_action;
  1404. X            }
  1405. X            }
  1406. X
  1407. X        else switch ( yy_get_next_buffer() )
  1408. X            {
  1409. X            case EOB_ACT_END_OF_FILE:
  1410. X            {
  1411. X            yy_did_buffer_switch_on_eof = 0;
  1412. X
  1413. X            if ( yywrap() )
  1414. X                {
  1415. X                /* note: because we've taken care in
  1416. X                 * yy_get_next_buffer() to have set up yytext,
  1417. X                 * we can now set up yy_c_buf_p so that if some
  1418. X                 * total hoser (like flex itself) wants
  1419. X                 * to call the scanner after we return the
  1420. X                 * YY_NULL, it'll still work - another YY_NULL
  1421. X                 * will get returned.
  1422. X                 */
  1423. X                yy_c_buf_p = yytext + YY_MORE_ADJ;
  1424. X
  1425. X                yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  1426. X                goto do_action;
  1427. X                }
  1428. X
  1429. X            else
  1430. X                {
  1431. X                if ( ! yy_did_buffer_switch_on_eof )
  1432. X                YY_NEW_FILE;
  1433. X                }
  1434. X            }
  1435. X            break;
  1436. X
  1437. X            case EOB_ACT_CONTINUE_SCAN:
  1438. X            yy_c_buf_p = yytext + yy_amount_of_matched_text;
  1439. X
  1440. X            yy_current_state = yy_get_previous_state();
  1441. X
  1442. X            yy_cp = yy_c_buf_p;
  1443. X            yy_bp = yytext + YY_MORE_ADJ;
  1444. X            goto yy_match;
  1445. X
  1446. X            case EOB_ACT_LAST_MATCH:
  1447. X            yy_c_buf_p =
  1448. X                &yy_current_buffer->yy_ch_buf[yy_n_chars];
  1449. X
  1450. X            yy_current_state = yy_get_previous_state();
  1451. X
  1452. X            yy_cp = yy_c_buf_p;
  1453. X            yy_bp = yytext + YY_MORE_ADJ;
  1454. X            goto yy_find_action;
  1455. X            }
  1456. X        break;
  1457. X        }
  1458. X
  1459. X        default:
  1460. X#ifdef FLEX_DEBUG
  1461. X        printf( "action # %d\n", yy_act );
  1462. X#endif
  1463. X        YY_FATAL_ERROR(
  1464. X            "fatal flex scanner internal error--no action found" );
  1465. X        }
  1466. X    }
  1467. X    }
  1468. X
  1469. X
  1470. X/* yy_get_next_buffer - try to read in a new buffer
  1471. X *
  1472. X * synopsis
  1473. X *     int yy_get_next_buffer();
  1474. X *     
  1475. X * returns a code representing an action
  1476. X *     EOB_ACT_LAST_MATCH - 
  1477. X *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1478. X *     EOB_ACT_END_OF_FILE - end of file
  1479. X */
  1480. X
  1481. Xstatic int yy_get_next_buffer()
  1482. X
  1483. X    {
  1484. X    register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  1485. X    register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  1486. X    register int number_to_move, i;
  1487. X    int ret_val;
  1488. X
  1489. X    if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  1490. X    YY_FATAL_ERROR(
  1491. X        "fatal flex scanner internal error--end of buffer missed" );
  1492. X
  1493. X    /* try to read more data */
  1494. X
  1495. X    /* first move last chars to start of buffer */
  1496. X    number_to_move = yy_c_buf_p - yytext;
  1497. X
  1498. X    for ( i = 0; i < number_to_move; ++i )
  1499. X    *(dest++) = *(source++);
  1500. X
  1501. X    if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  1502. X    /* don't do the read, it's not guaranteed to return an EOF,
  1503. X     * just force an EOF
  1504. X     */
  1505. X    yy_n_chars = 0;
  1506. X
  1507. X    else
  1508. X    {
  1509. X    int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  1510. X
  1511. X    if ( num_to_read > YY_READ_BUF_SIZE )
  1512. X        num_to_read = YY_READ_BUF_SIZE;
  1513. X
  1514. X    else if ( num_to_read <= 0 )
  1515. X        YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  1516. X
  1517. X    /* read in more data */
  1518. X    YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  1519. X          yy_n_chars, num_to_read );
  1520. X    }
  1521. X
  1522. X    if ( yy_n_chars == 0 )
  1523. X    {
  1524. X    if ( number_to_move == 1 )
  1525. X        {
  1526. X        ret_val = EOB_ACT_END_OF_FILE;
  1527. X        yy_current_buffer->yy_eof_status = EOF_DONE;
  1528. X        }
  1529. X
  1530. X    else
  1531. X        {
  1532. X        ret_val = EOB_ACT_LAST_MATCH;
  1533. X        yy_current_buffer->yy_eof_status = EOF_PENDING;
  1534. X        }
  1535. X    }
  1536. X
  1537. X    else
  1538. X    ret_val = EOB_ACT_CONTINUE_SCAN;
  1539. X
  1540. X    yy_n_chars += number_to_move;
  1541. X    yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1542. X    yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1543. X
  1544. X    /* yytext begins at the second character in yy_ch_buf; the first
  1545. X     * character is the one which preceded it before reading in the latest
  1546. X     * buffer; it needs to be kept around in case it's a newline, so
  1547. X     * yy_get_previous_state() will have with '^' rules active
  1548. X     */
  1549. X
  1550. X    yytext = &yy_current_buffer->yy_ch_buf[1];
  1551. X
  1552. X    return ( ret_val );
  1553. X    }
  1554. X
  1555. X
  1556. X/* yy_get_previous_state - get the state just before the EOB char was reached
  1557. X *
  1558. X * synopsis
  1559. X *     yy_state_type yy_get_previous_state();
  1560. X */
  1561. X
  1562. Xstatic yy_state_type yy_get_previous_state()
  1563. X
  1564. X    {
  1565. X    register yy_state_type yy_current_state;
  1566. X    register YY_CHAR *yy_cp;
  1567. X
  1568. X    register YY_CHAR *yy_bp = yytext;
  1569. X
  1570. X    yy_current_state = yy_start;
  1571. X    if ( yy_bp[-1] == '\n' )
  1572. X    ++yy_current_state;
  1573. X
  1574. X    for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  1575. X    {
  1576. X    register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
  1577. X    if ( yy_accept[yy_current_state] )
  1578. X        {
  1579. X        yy_last_accepting_state = yy_current_state;
  1580. X        yy_last_accepting_cpos = yy_cp;
  1581. X        }
  1582. X    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1583. X        {
  1584. X        yy_current_state = yy_def[yy_current_state];
  1585. X        if ( yy_current_state >= 204 )
  1586. X        yy_c = yy_meta[yy_c];
  1587. X        }
  1588. X    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1589. X    }
  1590. X
  1591. X    return ( yy_current_state );
  1592. X    }
  1593. X
  1594. X
  1595. X/* yy_try_NUL_trans - try to make a transition on the NUL character
  1596. X *
  1597. X * synopsis
  1598. X *     next_state = yy_try_NUL_trans( current_state );
  1599. X */
  1600. X
  1601. X#ifdef YY_USE_PROTOS
  1602. Xstatic yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  1603. X#else
  1604. Xstatic yy_state_type yy_try_NUL_trans( yy_current_state )
  1605. Xregister yy_state_type yy_current_state;
  1606. X#endif
  1607. X
  1608. X    {
  1609. X    register int yy_is_jam;
  1610. X    register YY_CHAR *yy_cp = yy_c_buf_p;
  1611. X
  1612. X    register YY_CHAR yy_c = 1;
  1613. X    if ( yy_accept[yy_current_state] )
  1614. X    {
  1615. X    yy_last_accepting_state = yy_current_state;
  1616. X    yy_last_accepting_cpos = yy_cp;
  1617. X    }
  1618. X    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1619. X    {
  1620. X    yy_current_state = yy_def[yy_current_state];
  1621. X    if ( yy_current_state >= 204 )
  1622. X        yy_c = yy_meta[yy_c];
  1623. X    }
  1624. X    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1625. X    yy_is_jam = (yy_current_state == 203);
  1626. X
  1627. X    return ( yy_is_jam ? 0 : yy_current_state );
  1628. X    }
  1629. X
  1630. X
  1631. X#ifdef YY_USE_PROTOS
  1632. Xstatic void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  1633. X#else
  1634. Xstatic void yyunput( c, yy_bp )
  1635. XYY_CHAR c;
  1636. Xregister YY_CHAR *yy_bp;
  1637. X#endif
  1638. X
  1639. X    {
  1640. X    register YY_CHAR *yy_cp = yy_c_buf_p;
  1641. X
  1642. X    /* undo effects of setting up yytext */
  1643. X    *yy_cp = yy_hold_char;
  1644. X
  1645. X    if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1646. X    { /* need to shift things up to make room */
  1647. X    register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  1648. X    register YY_CHAR *dest =
  1649. X        &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  1650. X    register YY_CHAR *source =
  1651. X        &yy_current_buffer->yy_ch_buf[number_to_move];
  1652. X
  1653. X    while ( source > yy_current_buffer->yy_ch_buf )
  1654. X        *--dest = *--source;
  1655. X
  1656. X    yy_cp += dest - source;
  1657. X    yy_bp += dest - source;
  1658. X    yy_n_chars = yy_current_buffer->yy_buf_size;
  1659. X
  1660. X    if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1661. X        YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1662. X    }
  1663. X
  1664. X    if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  1665. X    yy_cp[-2] = '\n';
  1666. X
  1667. X    *--yy_cp = c;
  1668. X
  1669. X    /* note: the formal parameter *must* be called "yy_bp" for this
  1670. X     *       macro to now work correctly
  1671. X     */
  1672. X    YY_DO_BEFORE_ACTION; /* set up yytext again */
  1673. X    }
  1674. X
  1675. X
  1676. X#ifdef __cplusplus
  1677. Xstatic int yyinput()
  1678. X#else
  1679. Xstatic int input()
  1680. X#endif
  1681. X
  1682. X    {
  1683. X    int c;
  1684. X    YY_CHAR *yy_cp = yy_c_buf_p;
  1685. X
  1686. X    *yy_cp = yy_hold_char;
  1687. X
  1688. X    if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1689. X    {
  1690. X    /* yy_c_buf_p now points to the character we want to return.
  1691. X     * If this occurs *before* the EOB characters, then it's a
  1692. X     * valid NUL; if not, then we've hit the end of the buffer.
  1693. X     */
  1694. X    if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1695. X        /* this was really a NUL */
  1696. X        *yy_c_buf_p = '\0';
  1697. X
  1698. X    else
  1699. X        { /* need more input */
  1700. X        yytext = yy_c_buf_p;
  1701. X        ++yy_c_buf_p;
  1702. X
  1703. X        switch ( yy_get_next_buffer() )
  1704. X        {
  1705. X        case EOB_ACT_END_OF_FILE:
  1706. X            {
  1707. X            if ( yywrap() )
  1708. X            {
  1709. X            yy_c_buf_p = yytext + YY_MORE_ADJ;
  1710. X            return ( EOF );
  1711. X            }
  1712. X
  1713. X            YY_NEW_FILE;
  1714. X
  1715. X#ifdef __cplusplus
  1716. X            return ( yyinput() );
  1717. X#else
  1718. X            return ( input() );
  1719. X#endif
  1720. X            }
  1721. X            break;
  1722. X
  1723. X        case EOB_ACT_CONTINUE_SCAN:
  1724. X            yy_c_buf_p = yytext + YY_MORE_ADJ;
  1725. X            break;
  1726. X
  1727. X        case EOB_ACT_LAST_MATCH:
  1728. X#ifdef __cplusplus
  1729. X            YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  1730. X#else
  1731. X            YY_FATAL_ERROR( "unexpected last match in input()" );
  1732. X#endif
  1733. X        }
  1734. X        }
  1735. X    }
  1736. X
  1737. X    c = *yy_c_buf_p;
  1738. X    yy_hold_char = *++yy_c_buf_p;
  1739. X
  1740. X    return ( c );
  1741. X    }
  1742. X
  1743. X
  1744. X#ifdef YY_USE_PROTOS
  1745. Xvoid yyrestart( FILE *input_file )
  1746. X#else
  1747. Xvoid yyrestart( input_file )
  1748. XFILE *input_file;
  1749. X#endif
  1750. X
  1751. X    {
  1752. X    yy_init_buffer( yy_current_buffer, input_file );
  1753. X    yy_load_buffer_state();
  1754. X    }
  1755. X
  1756. X
  1757. X#ifdef YY_USE_PROTOS
  1758. Xvoid yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  1759. X#else
  1760. Xvoid yy_switch_to_buffer( new_buffer )
  1761. XYY_BUFFER_STATE new_buffer;
  1762. X#endif
  1763. X
  1764. X    {
  1765. X    if ( yy_current_buffer == new_buffer )
  1766. X    return;
  1767. X
  1768. X    if ( yy_current_buffer )
  1769. X    {
  1770. X    /* flush out information for old buffer */
  1771. X    *yy_c_buf_p = yy_hold_char;
  1772. X    yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  1773. X    yy_current_buffer->yy_n_chars = yy_n_chars;
  1774. X    }
  1775. X
  1776. X    yy_current_buffer = new_buffer;
  1777. X    yy_load_buffer_state();
  1778. X
  1779. X    /* we don't actually know whether we did this switch during
  1780. X     * EOF (yywrap()) processing, but the only time this flag
  1781. X     * is looked at is after yywrap() is called, so it's safe
  1782. X     * to go ahead and always set it.
  1783. X     */
  1784. X    yy_did_buffer_switch_on_eof = 1;
  1785. X    }
  1786. X
  1787. X
  1788. X#ifdef YY_USE_PROTOS
  1789. Xvoid yy_load_buffer_state( void )
  1790. X#else
  1791. Xvoid yy_load_buffer_state()
  1792. X#endif
  1793. X
  1794. X    {
  1795. X    yy_n_chars = yy_current_buffer->yy_n_chars;
  1796. X    yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  1797. X    yyin = yy_current_buffer->yy_input_file;
  1798. X    yy_hold_char = *yy_c_buf_p;
  1799. X    }
  1800. X
  1801. X
  1802. X#ifdef YY_USE_PROTOS
  1803. XYY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  1804. X#else
  1805. XYY_BUFFER_STATE yy_create_buffer( file, size )
  1806. XFILE *file;
  1807. Xint size;
  1808. X#endif
  1809. X
  1810. X    {
  1811. X    YY_BUFFER_STATE b;
  1812. X
  1813. X    b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  1814. X
  1815. X    if ( ! b )
  1816. X    YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1817. X
  1818. X    b->yy_buf_size = size;
  1819. X
  1820. X    /* yy_ch_buf has to be 2 characters longer than the size given because
  1821. X     * we need to put in 2 end-of-buffer characters.
  1822. X     */
  1823. X    b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  1824. X
  1825. X    if ( ! b->yy_ch_buf )
  1826. X    YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1827. X
  1828. X    yy_init_buffer( b, file );
  1829. X
  1830. X    return ( b );
  1831. X    }
  1832. X
  1833. X
  1834. X#ifdef YY_USE_PROTOS
  1835. Xvoid yy_delete_buffer( YY_BUFFER_STATE b )
  1836. X#else
  1837. Xvoid yy_delete_buffer( b )
  1838. XYY_BUFFER_STATE b;
  1839. X#endif
  1840. X
  1841. X    {
  1842. X    if ( b == yy_current_buffer )
  1843. X    yy_current_buffer = (YY_BUFFER_STATE) 0;
  1844. X
  1845. X    free( (char *) b->yy_ch_buf );
  1846. X    free( (char *) b );
  1847. X    }
  1848. X
  1849. X
  1850. X#ifdef YY_USE_PROTOS
  1851. Xvoid yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  1852. X#else
  1853. Xvoid yy_init_buffer( b, file )
  1854. XYY_BUFFER_STATE b;
  1855. XFILE *file;
  1856. X#endif
  1857. X
  1858. X    {
  1859. X    b->yy_input_file = file;
  1860. X
  1861. X    /* we put in the '\n' and start reading from [1] so that an
  1862. X     * initial match-at-newline will be true.
  1863. X     */
  1864. X
  1865. X    b->yy_ch_buf[0] = '\n';
  1866. X    b->yy_n_chars = 1;
  1867. X
  1868. X    /* we always need two end-of-buffer characters.  The first causes
  1869. X     * a transition to the end-of-buffer state.  The second causes
  1870. X     * a jam in that state.
  1871. X     */
  1872. X    b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1873. X    b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  1874. X
  1875. X    b->yy_buf_pos = &b->yy_ch_buf[1];
  1876. X
  1877. X    b->yy_eof_status = EOF_NOT_SEEN;
  1878. X    }
  1879. X# line 268 "p2latex.l"
  1880. X
  1881. X
  1882. Xstatic void nindent(char *blanks, int n)
  1883. X{
  1884. X  int i, bl;
  1885. X
  1886. X  for (i = bl = 0; i < n; i++) {
  1887. X    if (*blanks == ' ') {
  1888. X      bl++;
  1889. X    }
  1890. X    else {            /* *blanks == '\t' */
  1891. X      while (++bl % tabtotab) ;
  1892. X    }
  1893. X    blanks++;
  1894. X  }
  1895. X  printf("\\hspace*{%d\\indentation}", bl);
  1896. X}
  1897. END_OF_FILE
  1898.   if test 41206 -ne `wc -c <'p2latex.c'`; then
  1899.     echo shar: \"'p2latex.c'\" unpacked with wrong size!
  1900.   fi
  1901.   # end of 'p2latex.c'
  1902. fi
  1903. echo shar: End of archive 1 \(of 3\).
  1904. cp /dev/null ark1isdone
  1905. MISSING=""
  1906. for I in 1 2 3 ; do
  1907.     if test ! -f ark${I}isdone ; then
  1908.     MISSING="${MISSING} ${I}"
  1909.     fi
  1910. done
  1911. if test "${MISSING}" = "" ; then
  1912.     echo You have unpacked all 3 archives.
  1913.     rm -f ark[1-9]isdone
  1914. else
  1915.     echo You still must unpack the following archives:
  1916.     echo "        " ${MISSING}
  1917. fi
  1918. exit 0
  1919. exit 0 # Just in case...
  1920.