home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume22 / m2latex / part03 < prev    next >
Text File  |  1991-08-29  |  32KB  |  1,298 lines

  1. Newsgroups: comp.sources.misc
  2. From: Joerg Heitkoetter <heitkoet@gorbi.informatik.uni-dortmund.de>
  3. Subject:  v22i081:  m2latex - Generate LaTex source from Pascal or Modula-2, Part03/03
  4. Message-ID: <1991Aug30.024540.1258@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 2a46b471263679a179184c77f04a343f
  6. Date: Fri, 30 Aug 1991 02:45:40 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Joerg Heitkoetter <heitkoet@gorbi.informatik.uni-dortmund.de>
  10. Posting-number: Volume 22, Issue 81
  11. Archive-name: m2latex/part03
  12. Environment: UNIX, LaTex, Flex
  13.  
  14. ---- Cut Here and feed the following to sh ----
  15. # this is Part.03 (part 3 of a multipart archive)
  16. # do not concatenate these parts, unpack them in order with /bin/sh
  17. # file m2latex.c continued
  18. #
  19. if test ! -r _shar_seq_.tmp; then
  20.     echo 'Please unpack part 1 first!'
  21.     exit 1
  22. fi
  23. (read Scheck
  24.  if test "$Scheck" != 3; then
  25.     echo Please unpack part "$Scheck" next!
  26.     exit 1
  27.  else
  28.     exit 0
  29.  fi
  30. ) < _shar_seq_.tmp || exit 1
  31. if test ! -f _shar_wnt_.tmp; then
  32.     echo 'x - still skipping m2latex.c'
  33. else
  34. echo 'x - continuing file m2latex.c'
  35. sed 's/^X//' << 'SHAR_EOF' >> 'm2latex.c' &&
  36. X *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  37. X *     EOB_ACT_END_OF_FILE - end of file
  38. X */
  39. X
  40. static int yy_get_next_buffer()
  41. X
  42. X    {
  43. X    register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  44. X    register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  45. X    register int number_to_move, i;
  46. X    int ret_val;
  47. X
  48. X    if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  49. X    YY_FATAL_ERROR(
  50. X        "fatal flex scanner internal error--end of buffer missed" );
  51. X
  52. X    /* try to read more data */
  53. X
  54. X    /* first move last chars to start of buffer */
  55. X    number_to_move = yy_c_buf_p - yytext;
  56. X
  57. X    for ( i = 0; i < number_to_move; ++i )
  58. X    *(dest++) = *(source++);
  59. X
  60. X    if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  61. X    /* don't do the read, it's not guaranteed to return an EOF,
  62. X     * just force an EOF
  63. X     */
  64. X    yy_n_chars = 0;
  65. X
  66. X    else
  67. X    {
  68. X    int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  69. X
  70. X    if ( num_to_read > YY_READ_BUF_SIZE )
  71. X        num_to_read = YY_READ_BUF_SIZE;
  72. X
  73. X    else if ( num_to_read <= 0 )
  74. X        YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  75. X
  76. X    /* read in more data */
  77. X    YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  78. X          yy_n_chars, num_to_read );
  79. X    }
  80. X
  81. X    if ( yy_n_chars == 0 )
  82. X    {
  83. X    if ( number_to_move == 1 )
  84. X        {
  85. X        ret_val = EOB_ACT_END_OF_FILE;
  86. X        yy_current_buffer->yy_eof_status = EOF_DONE;
  87. X        }
  88. X
  89. X    else
  90. X        {
  91. X        ret_val = EOB_ACT_LAST_MATCH;
  92. X        yy_current_buffer->yy_eof_status = EOF_PENDING;
  93. X        }
  94. X    }
  95. X
  96. X    else
  97. X    ret_val = EOB_ACT_CONTINUE_SCAN;
  98. X
  99. X    yy_n_chars += number_to_move;
  100. X    yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  101. X    yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  102. X
  103. X    /* yytext begins at the second character in yy_ch_buf; the first
  104. X     * character is the one which preceded it before reading in the latest
  105. X     * buffer; it needs to be kept around in case it's a newline, so
  106. X     * yy_get_previous_state() will have with '^' rules active
  107. X     */
  108. X
  109. X    yytext = &yy_current_buffer->yy_ch_buf[1];
  110. X
  111. X    return ( ret_val );
  112. X    }
  113. X
  114. X
  115. /* yy_get_previous_state - get the state just before the EOB char was reached
  116. X *
  117. X * synopsis
  118. X *     yy_state_type yy_get_previous_state();
  119. X */
  120. X
  121. static yy_state_type yy_get_previous_state()
  122. X
  123. X    {
  124. X    register yy_state_type yy_current_state;
  125. X    register YY_CHAR *yy_cp;
  126. X
  127. X    register YY_CHAR *yy_bp = yytext;
  128. X
  129. X    yy_current_state = yy_start;
  130. X    if ( yy_bp[-1] == '\n' )
  131. X    ++yy_current_state;
  132. X
  133. X    for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  134. X    {
  135. X    register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
  136. X    if ( yy_accept[yy_current_state] )
  137. X        {
  138. X        yy_last_accepting_state = yy_current_state;
  139. X        yy_last_accepting_cpos = yy_cp;
  140. X        }
  141. X    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  142. X        {
  143. X        yy_current_state = yy_def[yy_current_state];
  144. X        if ( yy_current_state >= 591 )
  145. X        yy_c = yy_meta[yy_c];
  146. X        }
  147. X    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  148. X    }
  149. X
  150. X    return ( yy_current_state );
  151. X    }
  152. X
  153. X
  154. /* yy_try_NUL_trans - try to make a transition on the NUL character
  155. X *
  156. X * synopsis
  157. X *     next_state = yy_try_NUL_trans( current_state );
  158. X */
  159. X
  160. #ifdef YY_USE_PROTOS
  161. static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  162. #else
  163. static yy_state_type yy_try_NUL_trans( yy_current_state )
  164. register yy_state_type yy_current_state;
  165. #endif
  166. X
  167. X    {
  168. X    register int yy_is_jam;
  169. X    register YY_CHAR *yy_cp = yy_c_buf_p;
  170. X
  171. X    register YY_CHAR yy_c = 1;
  172. X    if ( yy_accept[yy_current_state] )
  173. X    {
  174. X    yy_last_accepting_state = yy_current_state;
  175. X    yy_last_accepting_cpos = yy_cp;
  176. X    }
  177. X    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  178. X    {
  179. X    yy_current_state = yy_def[yy_current_state];
  180. X    if ( yy_current_state >= 591 )
  181. X        yy_c = yy_meta[yy_c];
  182. X    }
  183. X    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  184. X    yy_is_jam = (yy_current_state == 590);
  185. X
  186. X    return ( yy_is_jam ? 0 : yy_current_state );
  187. X    }
  188. X
  189. X
  190. #ifdef YY_USE_PROTOS
  191. static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  192. #else
  193. static void yyunput( c, yy_bp )
  194. YY_CHAR c;
  195. register YY_CHAR *yy_bp;
  196. #endif
  197. X
  198. X    {
  199. X    register YY_CHAR *yy_cp = yy_c_buf_p;
  200. X
  201. X    /* undo effects of setting up yytext */
  202. X    *yy_cp = yy_hold_char;
  203. X
  204. X    if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  205. X    { /* need to shift things up to make room */
  206. X    register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  207. X    register YY_CHAR *dest =
  208. X        &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  209. X    register YY_CHAR *source =
  210. X        &yy_current_buffer->yy_ch_buf[number_to_move];
  211. X
  212. X    while ( source > yy_current_buffer->yy_ch_buf )
  213. X        *--dest = *--source;
  214. X
  215. X    yy_cp += dest - source;
  216. X    yy_bp += dest - source;
  217. X    yy_n_chars = yy_current_buffer->yy_buf_size;
  218. X
  219. X    if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  220. X        YY_FATAL_ERROR( "flex scanner push-back overflow" );
  221. X    }
  222. X
  223. X    if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  224. X    yy_cp[-2] = '\n';
  225. X
  226. X    *--yy_cp = c;
  227. X
  228. X    /* note: the formal parameter *must* be called "yy_bp" for this
  229. X     *       macro to now work correctly
  230. X     */
  231. X    YY_DO_BEFORE_ACTION; /* set up yytext again */
  232. X    }
  233. X
  234. X
  235. #ifdef __cplusplus
  236. static int yyinput()
  237. #else
  238. static int input()
  239. #endif
  240. X
  241. X    {
  242. X    int c;
  243. X    YY_CHAR *yy_cp = yy_c_buf_p;
  244. X
  245. X    *yy_cp = yy_hold_char;
  246. X
  247. X    if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  248. X    {
  249. X    /* yy_c_buf_p now points to the character we want to return.
  250. X     * If this occurs *before* the EOB characters, then it's a
  251. X     * valid NUL; if not, then we've hit the end of the buffer.
  252. X     */
  253. X    if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  254. X        /* this was really a NUL */
  255. X        *yy_c_buf_p = '\0';
  256. X
  257. X    else
  258. X        { /* need more input */
  259. X        yytext = yy_c_buf_p;
  260. X        ++yy_c_buf_p;
  261. X
  262. X        switch ( yy_get_next_buffer() )
  263. X        {
  264. X        case EOB_ACT_END_OF_FILE:
  265. X            {
  266. X            if ( yywrap() )
  267. X            {
  268. X            yy_c_buf_p = yytext + YY_MORE_ADJ;
  269. X            return ( EOF );
  270. X            }
  271. X
  272. X            YY_NEW_FILE;
  273. X
  274. #ifdef __cplusplus
  275. X            return ( yyinput() );
  276. #else
  277. X            return ( input() );
  278. #endif
  279. X            }
  280. X            break;
  281. X
  282. X        case EOB_ACT_CONTINUE_SCAN:
  283. X            yy_c_buf_p = yytext + YY_MORE_ADJ;
  284. X            break;
  285. X
  286. X        case EOB_ACT_LAST_MATCH:
  287. #ifdef __cplusplus
  288. X            YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  289. #else
  290. X            YY_FATAL_ERROR( "unexpected last match in input()" );
  291. #endif
  292. X        }
  293. X        }
  294. X    }
  295. X
  296. X    c = *yy_c_buf_p;
  297. X    yy_hold_char = *++yy_c_buf_p;
  298. X
  299. X    return ( c );
  300. X    }
  301. X
  302. X
  303. #ifdef YY_USE_PROTOS
  304. void yyrestart( FILE *input_file )
  305. #else
  306. void yyrestart( input_file )
  307. FILE *input_file;
  308. #endif
  309. X
  310. X    {
  311. X    yy_init_buffer( yy_current_buffer, input_file );
  312. X    yy_load_buffer_state();
  313. X    }
  314. X
  315. X
  316. #ifdef YY_USE_PROTOS
  317. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  318. #else
  319. void yy_switch_to_buffer( new_buffer )
  320. YY_BUFFER_STATE new_buffer;
  321. #endif
  322. X
  323. X    {
  324. X    if ( yy_current_buffer == new_buffer )
  325. X    return;
  326. X
  327. X    if ( yy_current_buffer )
  328. X    {
  329. X    /* flush out information for old buffer */
  330. X    *yy_c_buf_p = yy_hold_char;
  331. X    yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  332. X    yy_current_buffer->yy_n_chars = yy_n_chars;
  333. X    }
  334. X
  335. X    yy_current_buffer = new_buffer;
  336. X    yy_load_buffer_state();
  337. X
  338. X    /* we don't actually know whether we did this switch during
  339. X     * EOF (yywrap()) processing, but the only time this flag
  340. X     * is looked at is after yywrap() is called, so it's safe
  341. X     * to go ahead and always set it.
  342. X     */
  343. X    yy_did_buffer_switch_on_eof = 1;
  344. X    }
  345. X
  346. X
  347. #ifdef YY_USE_PROTOS
  348. void yy_load_buffer_state( void )
  349. #else
  350. void yy_load_buffer_state()
  351. #endif
  352. X
  353. X    {
  354. X    yy_n_chars = yy_current_buffer->yy_n_chars;
  355. X    yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  356. X    yyin = yy_current_buffer->yy_input_file;
  357. X    yy_hold_char = *yy_c_buf_p;
  358. X    }
  359. X
  360. X
  361. #ifdef YY_USE_PROTOS
  362. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  363. #else
  364. YY_BUFFER_STATE yy_create_buffer( file, size )
  365. FILE *file;
  366. int size;
  367. #endif
  368. X
  369. X    {
  370. X    YY_BUFFER_STATE b;
  371. X
  372. X    b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  373. X
  374. X    if ( ! b )
  375. X    YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  376. X
  377. X    b->yy_buf_size = size;
  378. X
  379. X    /* yy_ch_buf has to be 2 characters longer than the size given because
  380. X     * we need to put in 2 end-of-buffer characters.
  381. X     */
  382. X    b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  383. X
  384. X    if ( ! b->yy_ch_buf )
  385. X    YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  386. X
  387. X    yy_init_buffer( b, file );
  388. X
  389. X    return ( b );
  390. X    }
  391. X
  392. X
  393. #ifdef YY_USE_PROTOS
  394. void yy_delete_buffer( YY_BUFFER_STATE b )
  395. #else
  396. void yy_delete_buffer( b )
  397. YY_BUFFER_STATE b;
  398. #endif
  399. X
  400. X    {
  401. X    if ( b == yy_current_buffer )
  402. X    yy_current_buffer = (YY_BUFFER_STATE) 0;
  403. X
  404. X    free( (char *) b->yy_ch_buf );
  405. X    free( (char *) b );
  406. X    }
  407. X
  408. X
  409. #ifdef YY_USE_PROTOS
  410. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  411. #else
  412. void yy_init_buffer( b, file )
  413. YY_BUFFER_STATE b;
  414. FILE *file;
  415. #endif
  416. X
  417. X    {
  418. X    b->yy_input_file = file;
  419. X
  420. X    /* we put in the '\n' and start reading from [1] so that an
  421. X     * initial match-at-newline will be true.
  422. X     */
  423. X
  424. X    b->yy_ch_buf[0] = '\n';
  425. X    b->yy_n_chars = 1;
  426. X
  427. X    /* we always need two end-of-buffer characters.  The first causes
  428. X     * a transition to the end-of-buffer state.  The second causes
  429. X     * a jam in that state.
  430. X     */
  431. X    b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  432. X    b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  433. X
  434. X    b->yy_buf_pos = &b->yy_ch_buf[1];
  435. X
  436. X    b->yy_eof_status = EOF_NOT_SEEN;
  437. X    }
  438. # line 243 "m2latex.l"
  439. X
  440. X
  441. #include "main.c"
  442. SHAR_EOF
  443. echo 'File m2latex.c is complete' &&
  444. chmod 0640 m2latex.c ||
  445. echo 'restore of m2latex.c failed'
  446. Wc_c="`wc -c < 'm2latex.c'`"
  447. test 59511 -eq "$Wc_c" ||
  448.     echo 'm2latex.c: original size 59511, current size' "$Wc_c"
  449. rm -f _shar_wnt_.tmp
  450. fi
  451. # ============= m2latex.l ==============
  452. if test -f 'm2latex.l' -a X"$1" != X"-c"; then
  453.     echo 'x - skipping m2latex.l (File already exists)'
  454.     rm -f _shar_wnt_.tmp
  455. else
  456. > _shar_wnt_.tmp
  457. echo 'x - extracting m2latex.l (Text)'
  458. sed 's/^X//' << 'SHAR_EOF' > 'm2latex.l' &&
  459. /*
  460. X *  This is a flex input file but should be edited in -*-C-*- mode
  461. X *
  462. X *  Modula2LaTeX 1.0:
  463. X *  Produce prettyprinted LaTeX files from Modula-2 or Pascal sources.
  464. X *
  465. X *  Copyright (C) 1991    Joerg Heitkoetter
  466. X *  Systems Analysis Group, University of Dortmund
  467. X *  (heitkoet@gorbi.informatik.uni-dortmund.de).
  468. X *
  469. X *  This program is free software; you can redistribute it and/or modify
  470. X *  it under the terms of the GNU General Public License as published by
  471. X *  the Free Software Foundation; either version 1, or (at your option)
  472. X *  any later version.
  473. X *
  474. X *  This program is distributed in the hope that it will be useful,
  475. X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  476. X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  477. X *  GNU General Public License for more details.
  478. X *
  479. X *  You should have received a copy of the GNU General Public License
  480. X *  along with this program; if not, write to the Free Software
  481. X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  482. X *
  483. X */
  484. X
  485. %x STRING COMMENT
  486. %s MODULA2
  487. X
  488. %{
  489. #define KEY        printf ("{\\%s %s}", keyword_font, yytext)
  490. #define STDFUN        unput("("); printf ("{\\%s %s} (", stdfun_font, yytext)
  491. #define SYM(x)        printf ("$\\%s$", x)
  492. #define OUT(x)        printf ("%s", x)
  493. #define CTAB        printf ("\\hspace*{%d\\indentation}", tabtocomment)
  494. #define FONT(x)        printf ("{\\%s ",x);
  495. #define SUB(x)        substitute(x)
  496. #define IND        indent(yytext)
  497. #define INIT        BEGIN (modula_mode ? MODULA2 : INITIAL);
  498. #define REPARSE        yyless (0)
  499. X
  500. #include <stdio.h>
  501. X
  502. #define ON    (1)
  503. #define OFF    (0)
  504. X
  505. int modula_mode        = ON;
  506. X
  507. int complete_file    = OFF;
  508. int header        = OFF;
  509. int tabtotab        = 8;
  510. int piped        = OFF;
  511. X
  512. int aligntoright    = ON;        /* align comments to the right  -joke */
  513. int tabtocomment    = 4;        /* distance between statement and corresponding comment  -joke */
  514. X
  515. char *indentation    = "0.5em";
  516. X
  517. char* font_size        = "10";
  518. char* comment_font    = "it";
  519. char* keyword_font    = "bf";
  520. char* header_font    = "sl";
  521. char* stdfun_font    = "bf";
  522. char* string_font    = "tt";
  523. X
  524. #ifdef __STDC__
  525. void substitute(const char*);
  526. void indent(const char*);
  527. void newpage(int);
  528. void usage(const char*);
  529. #else
  530. void substitute();
  531. void indent();
  532. void newpage();
  533. void usage();
  534. #endif
  535. %}
  536. X
  537. %%
  538. X
  539. X            INIT;
  540. X
  541. "CHR"[ \t]*"("        |
  542. "DIV"[ \t]*"("        |
  543. "DISPOSE"[ \t]*"("    |
  544. "MOD"[ \t]*"("        |
  545. "NEW"[ \t]*"("        |
  546. "SUCC"[ \t]*"("        |
  547. "ORD"[ \t]*"("        |
  548. "ODD"[ \t]*"("        |
  549. "PRED"[ \t]*"("        |
  550. "ROUND"[ \t]*"("    |
  551. "TRUNC"[ \t]*"("    |
  552. <MODULA2>"ABS"[ \t]*"("    |
  553. <MODULA2>"CAP"[ \t]*"("    |
  554. <MODULA2>"EXCL"[ \t]*"("    |
  555. <MODULA2>"FLOAT"[ \t]*"("    |
  556. <MODULA2>"HIGH"[ \t]*"("    |
  557. <MODULA2>"INCL"[ \t]*"("    |
  558. <MODULA2>"MIN"[ \t]*"("    |
  559. <MODULA2>"MAX"[ \t]*"("    |
  560. <MODULA2>"REAL"[ \t]*"("    |
  561. <MODULA2>"VAL"[ \t]*"("    |
  562. <MODULA2>"DEC"[ \t]*"("    |
  563. <MODULA2>"INC"[ \t]*"("    STDFUN;
  564. X
  565. "AND"            |
  566. "ARRAY"            |
  567. "BEGIN"            |
  568. "CASE"            |
  569. "CONST"            |
  570. "DO"            |
  571. "DOWNTO"        |
  572. "ELSE"            |
  573. "END"            |
  574. "EXIT"            |
  575. "FOR"            |
  576. "FUNCTION"        |
  577. "FROM"            |
  578. "IF"            |
  579. "HALT"            |
  580. "IN"            |
  581. "NOT"            |
  582. "OF"            |
  583. "OR"            |
  584. "PACKED"        |
  585. "PROCEDURE"        |
  586. "RECORD"        |
  587. "REPEAT"        |
  588. "SET"            |
  589. "STRING"        |
  590. "THEN"            |
  591. "TO"            |
  592. "TYPE"            |
  593. "UNTIL"            |
  594. "VAR"            |
  595. "WHILE"            |
  596. "WITH"            |
  597. "INTEGER"        |
  598. "CHAR"            |
  599. "REAL"            |
  600. "BOOLEAN"        |
  601. "NIL"            |
  602. <MODULA2>"SHORTINT"    |
  603. <MODULA2>"CARDINAL"    |
  604. <MODULA2>"SHORTCARD"    |
  605. <MODULA2>"BITSET"    |
  606. <MODULA2>"PROC"    |
  607. <MODULA2>"BY"        |
  608. <MODULA2>"DEFINITION"    |
  609. <MODULA2>"ELSIF"    |
  610. <MODULA2>"EXPORT"    |
  611. <MODULA2>"FOREIGN"    |        /* Mocka special -joke */
  612. <MODULA2>"IMPLEMENTATION"    |
  613. <MODULA2>"IMPORT"    |
  614. <MODULA2>"LOOP"        |
  615. <MODULA2>"MODULE"    |
  616. <MODULA2>"POINTER"    |
  617. <MODULA2>"RETURN"    |
  618. <MODULA2>"QUALIFIED"    KEY;
  619. X
  620. "<="            SYM ("leq");
  621. ">="            SYM ("geq");
  622. "<>"            SYM ("neq");
  623. "*"            SYM ("ast");
  624. "^"            SYM ("wedge");
  625. "|"            SYM ("mid");
  626. <MODULA2>"#"        SYM ("neq");
  627. <MODULA2>"~"        SYM ("sim");
  628. "<"            OUT ("$<$");
  629. ">"            OUT ("$>$");
  630. "{"            OUT ("\\{");
  631. "}"            OUT ("\\}");
  632. <MODULA2>"&"        OUT ("\\&");
  633. ":"            |
  634. "="            |
  635. ","            |
  636. "."            |
  637. ";"            |
  638. "-"            |
  639. "+"            |
  640. "/"            |
  641. ":="            |
  642. "("            |
  643. ")"            |
  644. "["            |
  645. "]"            ECHO;
  646. X
  647. <MODULA2>[a-zA-Z_$][a-zA-Z_$0-9]*    |
  648. [a-zA-Z_][a-zA-Z_0-9]*            SUB (yytext);
  649. X
  650. ^[ \t]*"(*"              { BEGIN (COMMENT);
  651. X                FONT (comment_font);
  652. X                                REPARSE; }
  653. X
  654. "(*"                  { BEGIN (COMMENT);
  655. X                                if (aligntoright) {
  656. X                    OUT ("\\hfill");
  657. X                } else {
  658. X                    CTAB;
  659. X                }
  660. X                FONT (comment_font);
  661. X                                OUT ("($\\ast$"); }
  662. X
  663. <COMMENT>"*)"              { INIT; OUT ("$\\ast$)}"); }
  664. <COMMENT>"\n"            OUT ("\\mbox{}\\\\\n");
  665. <COMMENT>[ \t]+            IND;
  666. <COMMENT>.            SUB (yytext);
  667. X
  668. L?\"                       { BEGIN (STRING);
  669. X                FONT (string_font); OUT ("\""); }
  670. <STRING>"\""              { INIT; OUT ("\"}"); }
  671. X
  672. L?'                       { BEGIN (STRING);
  673. X                FONT (string_font); OUT ("'"); }
  674. <STRING>"'"              { INIT; OUT ("'}"); }
  675. <STRING>"\n"            OUT ("\\mbox{}\\\\\n");
  676. <STRING>^[ \t]+            IND;
  677. <STRING>.            SUB (yytext);
  678. X
  679. ([0-9]*\.[0-9]+[fFlL]?)         |
  680. ([0-9]+\.[0-9]*[fFlL]?)         |
  681. ([0-9]*\.?[0-9]+[eE][+-]?[0-9]+) |
  682. ([0-9]+\.?[0-9]*[eE][+-]?[0-9]+) ECHO;
  683. X
  684. [0-9]+[uUlL]?            ECHO;
  685. X
  686. L?'[ -~]'            |
  687. L?'\\[ntvbrfa\\?'"]'        |
  688. L?'\\[0-7]{1,3}'        |
  689. L?'\\x[0-9a-fA-F]{1,2}'        SUB (yytext);
  690. X
  691. 0[0-7]+[uUlL]?            ECHO;
  692. X
  693. 0x[0-9a-fA-F]+[uUlL]?        ECHO;
  694. X
  695. "\\\n"                OUT ("$\\backslash$\\\\\n");
  696. ^[ \t]+                IND;
  697. [ \t]+                ECHO;
  698. "\f"[\n]?            OUT ("\\newpage\n");
  699. "\n"                OUT ("\\mbox{}\\\\\n");
  700. X
  701. %%
  702. X
  703. #include "main.c"
  704. SHAR_EOF
  705. chmod 0640 m2latex.l ||
  706. echo 'restore of m2latex.l failed'
  707. Wc_c="`wc -c < 'm2latex.l'`"
  708. test 5245 -eq "$Wc_c" ||
  709.     echo 'm2latex.l: original size 5245, current size' "$Wc_c"
  710. rm -f _shar_wnt_.tmp
  711. fi
  712. # ============= m2latex.man ==============
  713. if test -f 'm2latex.man' -a X"$1" != X"-c"; then
  714.     echo 'x - skipping m2latex.man (File already exists)'
  715.     rm -f _shar_wnt_.tmp
  716. else
  717. > _shar_wnt_.tmp
  718. echo 'x - extracting m2latex.man (Text)'
  719. sed 's/^X//' << 'SHAR_EOF' > 'm2latex.man' &&
  720. X
  721. X
  722. X
  723. M2LATEX(1)               USER COMMANDS                 M2LATEX(1)
  724. X
  725. X
  726. X
  727. NAME
  728. X     m2latex - a Modula-2 to LaTeX converter
  729. X
  730. X
  731. SYNOPSIS
  732. X     _m_2_l_a_t_e_x [-c] [-h]  [-i  length]  [-n]  [-o  file]  [-p]  [-s
  733. X     fontsize]  [-H  font]  [-K  font]  [-P] [-S [+complete-file]
  734. X     [+header] [+indentation length] [+output  file]  [+font-size
  735. X     size]  [+pipe]  [+comment-font  font]  [+function-font font]
  736. X     [+keyword-font   font]   [+pascal]    [+header-font    font]
  737. X     [+string-font font] [+tabstop width] [+version] _f_i_l_e
  738. X
  739. X
  740. DESCRIPTION
  741. X     _m_2_l_a_t_e_x is a tool for generating _L_a_T_e_X sources  from  Pascal
  742. X     or  Modula-2  It  recogizes  all keywords, strings, and com-
  743. X     ments. These recognized parts can be  typeset  in  different
  744. X     fonts.   _m_2_l_a_t_e_x can generate complete _L_a_T_e_X files which can
  745. X     pass directly through latex(1) or parts of _L_a_T_e_X files which
  746. X     can  be  included  in  other  files (either direct or by the
  747. X     \input or \include commands).
  748. X
  749. X     The output filename is searched in various steps. First,  if
  750. X     the {-o,+output} flag is given, the output is written to the
  751. X     file pointed to by the value of this flag. If the {-p,+pipe}
  752. X     option  is given, the output is written to _s_t_d_o_u_t. (It is an
  753. X     error to specify both options together.) If  none  of  these
  754. X     options  but an input filename is given, the output is writ-
  755. X     ten to a file who's name is the last component of the  input
  756. X     filename with the added suffix '.tex'.
  757. X
  758. X
  759. OPTIONS
  760. X     _m_2_l_a_t_e_x recognizes the following options:
  761. X
  762. X     {-c,+complete-file}
  763. X          The output is enveloped in  commands  which  produce  a
  764. X          complete _L_a_T_e_X source.
  765. X
  766. X     {-h,+header}
  767. X          Each page of output has a header giving the input  file
  768. X          name.   This  option  implies  the  {-c,+complete-file}
  769. X          option.
  770. X
  771. X     {-i,+indentation} length
  772. X          Gives the amount of indentation for each leading  blank
  773. X          (tabs are converted to blanks). Default is `0.5em'.
  774. X
  775. X     {-n,+no-alignment}
  776. X          Comments belonging to statements  are  aligned  to  the
  777. X          right  paper  side  by  default.  You can turn off this
  778. X          behaviour using this switch.
  779. X
  780. X
  781. X
  782. MAGPIE Release 1.0 Last change: 29 August 1991                  1
  783. X
  784. X
  785. X
  786. X
  787. X
  788. X
  789. M2LATEX(1)               USER COMMANDS                 M2LATEX(1)
  790. X
  791. X
  792. X
  793. X     {-o,+output} _f_i_l_e
  794. X          The output is written in the file pointed to by _f_i_l_e.
  795. X
  796. X     {-s,+font-size} _s_i_z_e
  797. X          The LaTeX source is set in _s_i_z_ept. Default is `10'.
  798. X
  799. X     {-p,+pipe}
  800. X          The output is written to stdout.
  801. X
  802. X     {-C,+comment-font} _f_o_n_t
  803. X          The comments are set in  the  given  font.  Default  is
  804. X          `it'.
  805. X
  806. X     {-F,+function-font} _f_o_n_t
  807. X          The standard functions  are  set  in  the  given  font.
  808. X          Default is `bf'.
  809. X
  810. X     {-H,+header-font} _f_o_n_t
  811. X          The headers are set in the given font. Default is `sl'.
  812. X
  813. X     {-K,+keyword-font} _f_o_n_t
  814. X          The keywords are set in  the  given  font.  Default  is
  815. X          `bf'.
  816. X
  817. X     {-P,+pascal} _f_o_n_t
  818. X          recognize Pascal keywords, only. Keywords must be writ-
  819. X          ten in uppercase letters!
  820. X
  821. X     {-S,+string-font} _f_o_n_t
  822. X          The string and character constants are set in the given
  823. X          font. Default is `tt'.
  824. X
  825. X     {-T,+tabstop} _w_i_d_t_h
  826. X          The width of tabs is _w_i_d_t_h. Default is `8'.
  827. X
  828. X     {-V,+version}
  829. X          Prints the version number on _s_t_d_e_r_r.
  830. X
  831. X
  832. OPTION SUMMARY
  833. X     To give no option at all is the same as to give the options
  834. X          -i 0.5em -s 10 -C it -F bf -H sl -K bf -S tt -T 8
  835. X
  836. X
  837. SEE ALSO
  838. X     c++2latex(1), latex(1).
  839. X
  840. X
  841. DIAGNOSTICS
  842. X     _C_a_n'_t _u_s_e {-_p,+_p_i_p_e} _a_n_d {-_o,+_o_u_t_p_u_t} _t_o_g_e_t_h_e_r.
  843. X          At most one of this options may be given.
  844. X
  845. X
  846. X
  847. X
  848. MAGPIE Release 1.0 Last change: 29 August 1991                  2
  849. X
  850. X
  851. X
  852. X
  853. X
  854. X
  855. M2LATEX(1)               USER COMMANDS                 M2LATEX(1)
  856. X
  857. X
  858. X
  859. X     _C_a_n'_t _o_p_e_n `<_f_i_l_e>' _f_o_r _r_e_a_d_i_n_g
  860. X          The program failed to open <file> for reading.
  861. X
  862. X     _C_a_n'_t _o_p_e_n `<_f_i_l_e>' _f_o_r _w_r_i_t_i_n_g
  863. X          The program failed to open <file> for writing. All out-
  864. X          put  is  written in the current directory if not expli-
  865. X          citly changed by {-o,+output}.
  866. X
  867. X     _V_i_r_t_u_a_l _m_e_m_o_r_y _e_x_h_a_u_s_t_e_d
  868. X          The program failed to allocate storage. As this is only
  869. X          done for the construction of filenames, this error will
  870. X          normally indicate a program error.
  871. X
  872. X
  873. AUTHOR
  874. X     Copyright (C) 1991 by Joerg  Heitkoetter,  Systems  Analysis
  875. X     Group, University of Dortmund, Germany.
  876. X     Send bugs, comments, etc., to (heitkoet@gorbi.informatik.uni-dortmund.de).
  877. X
  878. X
  879. CREDITS
  880. X     Thanks to Norbert Kiesel for his C++2LaTeX converter,  show-
  881. X     ing me how to flex(1) something like this.
  882. X
  883. X
  884. AVAILABILITY
  885. X     This program is under GNU General Public License.  Refer  to
  886. X     the  LICENSE  file accompanying this software for a lengthy,
  887. X     boring, but absolutely complete description.
  888. X
  889. X
  890. FINAL NOTE
  891. X     If you want to use _m_2_l_a_t_e_x as a Pascal pretty printer  only,
  892. X     simply  install  it  as  a  (soft) link to ``p2latex''.  The
  893. X     Modula-2 mode is switched on, when _m_2_l_a_t_e_x finds the  letter
  894. X     ``m'' in it's name during execution.
  895. X
  896. X
  897. X
  898. X
  899. X
  900. X
  901. X
  902. X
  903. X
  904. X
  905. X
  906. X
  907. X
  908. X
  909. X
  910. X
  911. X
  912. X
  913. X
  914. MAGPIE Release 1.0 Last change: 29 August 1991                  3
  915. X
  916. X
  917. X
  918. SHAR_EOF
  919. chmod 0640 m2latex.man ||
  920. echo 'restore of m2latex.man failed'
  921. Wc_c="`wc -c < 'm2latex.man'`"
  922. test 5672 -eq "$Wc_c" ||
  923.     echo 'm2latex.man: original size 5672, current size' "$Wc_c"
  924. rm -f _shar_wnt_.tmp
  925. fi
  926. # ============= main.c ==============
  927. if test -f 'main.c' -a X"$1" != X"-c"; then
  928.     echo 'x - skipping main.c (File already exists)'
  929.     rm -f _shar_wnt_.tmp
  930. else
  931. > _shar_wnt_.tmp
  932. echo 'x - extracting main.c (Text)'
  933. sed 's/^X//' << 'SHAR_EOF' > 'main.c' &&
  934. /*
  935. X *  Modula2LaTeX 1.0:
  936. X *  Produce pretty printed LaTeX files from Modula-2 and Pascal sources.
  937. X *
  938. X *  Copyright (C) 1991 Joerg Heitkoetter
  939. X *  Systems Analysis Group, University of Dortmund (UNIDO)
  940. X *  (heitkoet@gorbi.informatik.uni-dortmund.de).
  941. X *
  942. X *  This program is free software; you can redistribute it and/or modify
  943. X *  it under the terms of the GNU General Public License as published by
  944. X *  the Free Software Foundation; either version 1, or (at your option)
  945. X *  any later version.
  946. X *
  947. X *  This program is distributed in the hope that it will be useful,
  948. X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  949. X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  950. X *  GNU General Public License for more details.
  951. X *
  952. X *  You should have received a copy of the GNU General Public License
  953. X *  along with this program; if not, write to the Free Software
  954. X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  955. X *
  956. X */
  957. X
  958. void
  959. substitute (input)
  960. char   *input;
  961. {
  962. X    while (*input) {
  963. X        switch (*input) {
  964. X            case '_':
  965. X            case '&':
  966. X            case '#':
  967. X            case '$':
  968. X            case '%':
  969. X            case '{':
  970. X            case '}':
  971. X                printf ("\\%c", *input);
  972. X                break;
  973. X            case '+':
  974. X            case '=':
  975. X            case '<':
  976. X            case '>':
  977. X                printf ("$%c$", *input);
  978. X                break;
  979. X            case '*':
  980. X                printf ("$\\ast$");
  981. X                break;
  982. X            case '|':
  983. X                printf ("$\\mid$");
  984. X                break;
  985. X            case '\\':
  986. X                printf ("$\\backslash$");
  987. X                break;
  988. X            case '^':
  989. X                printf ("$\\wedge$");
  990. X                break;
  991. X            case '~':
  992. X                printf ("$\\sim$");
  993. X                break;
  994. X            default:
  995. X                printf ("%c", *input);
  996. X                break;
  997. X        }
  998. X        input++;
  999. X    }
  1000. }
  1001. X
  1002. void
  1003. indent (blanks)
  1004. char   *blanks;
  1005. {
  1006. X    int     i;
  1007. X
  1008. X    i = 0;
  1009. X    while (*blanks) {
  1010. X        if (*blanks == ' ') {
  1011. X            i++;
  1012. X        } else {           /* *blanks == '\t' */
  1013. X            while (++i % tabtotab);
  1014. X        }
  1015. X        blanks++;
  1016. X    }
  1017. X    printf ("\\hspace*{%d\\indentation}", i);
  1018. }
  1019. X
  1020. #include "getopt.h"
  1021. #include <string.h>
  1022. #include <fcntl.h>
  1023. #include <ctype.h>
  1024. #include <time.h>
  1025. X
  1026. extern char *version_string;
  1027. X
  1028. static struct option opts[] =
  1029. {
  1030. X    {"complete-file", 0, 0, 'c'},
  1031. X    {"font-size", 1, 0, 's'},
  1032. X    {"indentation", 1, 0, 'i'},
  1033. X    {"header", 0, 0, 'h'},
  1034. X    {"piped", 0, 0, 'p'},
  1035. X    {"alignment", 0, 0, 'n'},      /* turn off comment alignment  -joke */
  1036. X    {"output", 1, 0, 'o'},
  1037. X    {"tabstop", 1, 0, 'T'},
  1038. X    {"comment-font", 1, 0, 'C'},
  1039. X    {"function-font", 1, 0, 'F'},
  1040. X    {"string-font", 1, 0, 'S'},
  1041. X    {"keyword-font", 1, 0, 'K'},
  1042. X    {"header-font", 1, 0, 'H'},
  1043. X    {"pascal", 0, 0, 'P'},
  1044. X    {"version", 0, 0, 'V'},
  1045. X    {0, 0, 0, 0}
  1046. };
  1047. X
  1048. X
  1049. main (argc, argv)
  1050. int     argc;
  1051. char  **argv;
  1052. {
  1053. X    int     c;
  1054. X    int     index;
  1055. X    int     i;
  1056. X    int     has_filename;
  1057. X    char   *input_name;
  1058. X    char   *output_name;
  1059. X    char   *program_name;
  1060. X    long    now;
  1061. X    char   *today;
  1062. X    char   *malloc ();
  1063. X
  1064. X    input_name = "Standard Input";
  1065. X    output_name = 0;
  1066. X
  1067. X    now = time (0);
  1068. X    today = ctime (&now);
  1069. X
  1070. X    program_name = strrchr (argv[0], '/');
  1071. X    if (program_name == NULL) {    /* no pathname */
  1072. X        program_name = argv[0];
  1073. X    } else {
  1074. X        program_name++;
  1075. X    }
  1076. X
  1077. X    /* simple heuristic: 'm' in name means Modula-2 */
  1078. X    modula_mode = (strchr (program_name, 'm') != 0);
  1079. X
  1080. X    if (argc == 1)
  1081. X        usage (program_name);  /* added exit with usage  -joke */
  1082. X
  1083. X    while ((c = getopt_long (argc, argv,
  1084. X                 "cpno:s:i:b:hT:C:F:H:S:K:P:V", opts, &index))
  1085. X            != EOF) {
  1086. X        if (c == 0) {           /* Long option */
  1087. X            c = opts[index].val;
  1088. X        }
  1089. X        switch (c) {
  1090. X            case 'c':
  1091. X                complete_file = 1;
  1092. X                break;
  1093. X            case 'o':
  1094. X                if (piped) {
  1095. X                    fprintf (stderr,
  1096. X                         "%s: Can't use {-p,+pipe} and {-o,+output} together\n",
  1097. X                         program_name);
  1098. X                    exit (5);
  1099. X                }
  1100. X                output_name = optarg;
  1101. X                break;
  1102. X            case 'n':
  1103. X                aligntoright = 0;
  1104. X                break;
  1105. X            case 's':
  1106. X                font_size = optarg;
  1107. X                break;
  1108. X            case 'i':
  1109. X                indentation = optarg;
  1110. X                break;
  1111. X            case 'T':
  1112. X                tabtotab = atoi (optarg);
  1113. X                break;
  1114. X            case 'p':
  1115. X                if (output_name != 0) {
  1116. X                    fprintf (stderr,
  1117. X                         "%s: Can't use {-p,+pipe} and {-o,+output} together\n",
  1118. X                         program_name);
  1119. X                    exit (5);
  1120. X                }
  1121. X                piped = 1;
  1122. X                break;
  1123. X            case 'h':
  1124. X                header = 1;
  1125. X                complete_file = 1;    /* header implies
  1126. X                             * complete-file */
  1127. X                break;
  1128. X            case 'C':
  1129. X                comment_font = optarg;
  1130. X                break;
  1131. X            case 'F':
  1132. X                stdfun_font = optarg;
  1133. X                break;
  1134. X            case 'H':
  1135. X                header_font = optarg;
  1136. X                break;
  1137. X            case 'S':
  1138. X                string_font = optarg;
  1139. X                break;
  1140. X            case 'K':
  1141. X                keyword_font = optarg;
  1142. X                break;
  1143. X            case 'P':
  1144. X                modula_mode = 0;
  1145. X                break;
  1146. X            case 'V':
  1147. X                fprintf (stderr, "%s\n", version_string);
  1148. X                break;
  1149. X            default:
  1150. X                usage (program_name);
  1151. X        }
  1152. X    }
  1153. X    has_filename = (argc - optind == 1);
  1154. X    if (has_filename) {           /* last argument is input file name */
  1155. X        input_name = argv[optind];
  1156. X        if (freopen (input_name, "r", stdin) == NULL) {
  1157. X            fprintf (stderr, "%s: Can't open `%s' for reading\n",
  1158. X                 program_name, input_name);
  1159. X            exit (2);
  1160. X        }
  1161. X    }
  1162. X    if ((output_name == 0) && !piped) {
  1163. X        char   *tmp;
  1164. X        if (has_filename) {
  1165. X            tmp = strrchr (input_name, '/');
  1166. X            if (tmp == 0) {    /* plain filename */
  1167. X                tmp = input_name;
  1168. X            } else {
  1169. X                tmp++;
  1170. X            }
  1171. X        } else {
  1172. X            tmp = program_name;
  1173. X        }
  1174. X        output_name = malloc (strlen (tmp) + 4);
  1175. X        if (output_name == 0) {
  1176. X            fprintf (stderr, "%s: Virtual memory exhausted\n", program_name);
  1177. X            exit (3);
  1178. X        }
  1179. X        strcpy (output_name, tmp);
  1180. X        strcat (output_name, ".tex");
  1181. X    }
  1182. X    if (!piped) {
  1183. X        if (freopen (output_name, "w", stdout) == NULL) {
  1184. X            fprintf (stderr, "%s: Can't open `%s' for writing\n",
  1185. X                 program_name, output_name);
  1186. X            exit (3);
  1187. X        }
  1188. X    }
  1189. X    printf ("\
  1190. %%\n\
  1191. %% This file was automatically produced at %.24s by\n\
  1192. %% %s", today, program_name);
  1193. X    for (i = 1; i < argc; i++) {
  1194. X        printf (" %s", argv[i]);
  1195. X    }
  1196. X    if (!has_filename) {
  1197. X        printf (" (from Standard Input)");
  1198. X    }
  1199. X    printf ("\n%%\n");
  1200. X    if (complete_file) {
  1201. X        if (header) {
  1202. X            if (strcmp (font_size, "10") == 0) {
  1203. X                printf ("\\documentstyle[fancyheadings]{article}\n");
  1204. X            } else {
  1205. X                printf ("\\documentstyle[%spt,fancyheadings]{article}\n",
  1206. X                    font_size);
  1207. X            }
  1208. X        } else {
  1209. X            if (strcmp (font_size, "10") == 0) {
  1210. X                printf ("\\documentstyle{article}\n");
  1211. X            } else {
  1212. X                printf ("\\documentstyle[%spt]{article}\n", font_size);
  1213. X            }
  1214. X        }
  1215. X        printf ("\\setlength{\\textwidth}{16cm}\n");
  1216. X        printf ("\\setlength{\\textheight}{23cm}\n");
  1217. X        printf ("\\setlength{\\hoffset}{-2cm}\n");
  1218. X        printf ("\\setlength{\\voffset}{-2cm}\n");
  1219. X        if (header) {
  1220. X            printf ("\\lhead{\\%s ", header_font);
  1221. X            substitute (input_name);
  1222. X            printf ("}");
  1223. X            printf ("\\rhead{\\rm\\thepage}\n");
  1224. X            printf ("\\cfoot{}\n");
  1225. X            printf ("\\addtolength{\\headheight}{14pt}\n");
  1226. X            printf ("\\pagestyle{fancy}\n");
  1227. X        }
  1228. X        printf ("\\begin{document}\n");
  1229. X    }
  1230. X    printf ("\\expandafter\\ifx\\csname indentation\\endcsname\\relax%\n");
  1231. X    printf ("\\newlength{\\indentation}\\fi\n");
  1232. X    printf ("\\setlength{\\indentation}{%s}\n", indentation);
  1233. X    printf ("\\begin{flushleft}\n");
  1234. X    yylex ();
  1235. X    printf ("\\end{flushleft}\n");
  1236. X    if (complete_file) {
  1237. X        printf ("\\end{document}\n");
  1238. X    }
  1239. X    exit (0);
  1240. }
  1241. X
  1242. void
  1243. usage (name)
  1244. char   *name;
  1245. {
  1246. X    fprintf (stderr, "%s\n", version_string);
  1247. X    fprintf (stderr, "\
  1248. Usage: %s [options] file\n\n\
  1249. Options:\n\
  1250. X    [-c]            [-h]\n\
  1251. X    [-i length]        [-n]\n\
  1252. X    [-o file]        [-p]\n\
  1253. X    [-s fontsize]        [-C font]\n\
  1254. X    [-F font        [-H font]\n\
  1255. X    [-K font]        [-P]\n\
  1256. X    [-S font]        [-T tabulatorwidth]\n\
  1257. X    [-V]\n\
  1258. X    \n\
  1259. X    [+complete-file]    [+header]\n\
  1260. X    [+indentation length]    [+no-alignment]\n\
  1261. X    [+output file]        [+pipe]\n\
  1262. X    [+font-size size]    [+comment-font font]\n\
  1263. X    {+function-font font    [+keyword-font font]\n\
  1264. X    [+pascal]        [+header-font font]\n\
  1265. X    [+string-font font]    [+tabstop width]\n\
  1266. X    [+version]\n", name);
  1267. X    exit (1);
  1268. }
  1269. SHAR_EOF
  1270. chmod 0640 main.c ||
  1271. echo 'restore of main.c failed'
  1272. Wc_c="`wc -c < 'main.c'`"
  1273. test 7449 -eq "$Wc_c" ||
  1274.     echo 'main.c: original size 7449, current size' "$Wc_c"
  1275. rm -f _shar_wnt_.tmp
  1276. fi
  1277. # ============= version.c ==============
  1278. if test -f 'version.c' -a X"$1" != X"-c"; then
  1279.     echo 'x - skipping version.c (File already exists)'
  1280.     rm -f _shar_wnt_.tmp
  1281. else
  1282. > _shar_wnt_.tmp
  1283. echo 'x - extracting version.c (Text)'
  1284. sed 's/^X//' << 'SHAR_EOF' > 'version.c' &&
  1285. char* version_string = "m2latex Version 1.0, Patchlevel 1";
  1286. SHAR_EOF
  1287. chmod 0640 version.c ||
  1288. echo 'restore of version.c failed'
  1289. Wc_c="`wc -c < 'version.c'`"
  1290. test 60 -eq "$Wc_c" ||
  1291.     echo 'version.c: original size 60, current size' "$Wc_c"
  1292. rm -f _shar_wnt_.tmp
  1293. fi
  1294. rm -f _shar_seq_.tmp
  1295. echo You have unpacked the last part
  1296. exit 0
  1297. exit 0 # Just in case...
  1298.