v13i097: lj2ps (12 of 12), a LaserJet to PostScript Translator
Chris Lishka relaxing in the Mad-City
lishka at uwslh.slh.wisc.edu
Tue Jul 3 10:09:53 AEST 1990
Posting-number: Volume 13, Issue 97
Submitted-by: lishka at uwslh.slh.wisc.edu (Chris Lishka (relaxing in the Mad-City) )
Archive-name: lj2ps/part12
---- Cut Here and unpack ----
#!/bin/sh
# This is part 12 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
then TOUCH=touch
else TOUCH=true
fi
# ============= scan.c ==============
if test X"$1" != X"-c" -a -f 'scan.c'; then
echo "File already exists: skipping 'scan.c'"
else
echo "x - extracting scan.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > scan.c &&
X/* Project: lj2ps
X** File: scan.c
X**
X** Author: Christopher Lishka
X** Organization: Wisconsin State Laboratory of Hygiene
X** Data Processing Dept.
X**
X** Copyright (C) 1990 by Christopher Lishka.
X**
X** This program is free software; you can redistribute it and/or modify
X** it under the terms of the GNU General Public License as published by
X** the Free Software Foundation; either version 1, or (at your option)
X** any later version.
X**
X** This program is distributed in the hope that it will be useful,
X** but WITHOUT ANY WARRANTY; without even the implied warranty of
X** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X** GNU General Public License for more details.
X**
X** You should have received a copy of the GNU General Public License
X** along with this program; if not, write to the Free Software
X** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
Xstatic char * ModuleID = "Module scan: v1.0.1.2, production";
X
X /* Include files
X */
X#include <stdio.h>
X#include <ctype.h>
X#include "scan.h"
X#include "lj.h"
X#include "lj2ps.h"
X
X /* External definitions
X */
X
X /* Global variables
X */
Xint scan_state; /* Controls which scanner is being used */
Xchar *text; /* Text read in for text tokens */
Xchar *command; /* Command read in */
Xchar variable[MAX_BUFFER]; /* Command parameter */
Xchar number[MAX_BUFFER]; /* Command numeric argument */
Xint pos_code; /* Command numeric position code */
Xtoken curr_token; /* Where to hold the scanned token */
X
X /* Global function list
X */
Xextern int scan(); /* The entry into the scanners */
Xextern void scan_init(); /* Reset the input for the scanner */
X
X /* Local constants
X */
X /* Scanner state constants */
X /* These two constants allow access to the START and END states. I do not
X ** recommend changing the actual values for them, because they need to be
X ** defined to the same value for *all* scanners in here.
X */
X#define START 1
X#define END 0
X /* Text scanner states */
X#define ST____ END /* End...must be zero! */
X#define ST_STT START /* Start */
X#define ST_CMD 2 /* Command */
X#define ST_CMA 3 /* Command & */
X#define ST_CMS 4 /* Command * */
X#define ST_TLP 5 /* END: Text ( */
X#define ST_TRP 6 /* END: Text ) */
X#define ST_TBS 7 /* END: Text \ */
X#define ST_TNL 8 /* END: Text \n */
X#define ST_TFF 9 /* END: Text \f */
X#define ST_UNK 10 /* END: Error: unknown command */
X#define ST_CEQ 11 /* END: Command = */
X#define ST_C9 12 /* END: Command 9 */
X#define ST_CZ 13 /* END: Command Z */
X#define ST_CY 14 /* END: Command Y */
X#define ST_CE 15 /* END: Command E */
X#define ST_CAa 16 /* END: Command &a */
X#define ST_CAd 17 /* END: Command &d */
X#define ST_CAf 18 /* END: Command &f */
X#define ST_CAk 19 /* END: Command &k */
X#define ST_CAl 20 /* END: Command &l */
X#define ST_CAp 21 /* END: Command &p */
X#define ST_CAs 22 /* END: Command &s */
X#define ST_CSt 23 /* END: Command *t */
X#define ST_CSr 24 /* END: Command *r */
X#define ST_CSp 25 /* END: Command *p */
X#define ST_CSc 26 /* END: Command *c */
X#define ST_CSb 27 /* END: Command *b */
X#define ST_CLs 28 /* END: Command (s */
X#define ST_CRs 29 /* END: Command )s */
X#define ST_CLP 30 /* END: Command ( */
X#define ST_CRP 31 /* END: Command ) */
X#define ST_TXT 32 /* END: Text */
X#define ST_NUL 33 /* END: Null */
X#define ST_TTB 34 /* END: Tab */
X#define ST_TSI 35 /* END: Shift in */
X#define ST_TSO 36 /* END: Shift out */
X#define ST_MAX 37 /* End of these states */
X /* Parameter scanner states */
X#define SP____ END /* End state */
X#define SP_PRM START /* Parameter */
X#define SP_INT 2 /* Integer */
X#define SP_FLP 3 /* Floating point */
X#define SP_PEO 4 /* END: Parameter end -- other (no argument) */
X#define SP_PE 5 /* END: Parameter end -- normal */
X#define SP_PC 6 /* END: Parameter continue */
X#define SP_UNK 7 /* END: Unknown command */
X#define SP_MAX 8 /* End of these states */
X /* Text scanner character classes */
X#define CST___ 0 /* All other characters */
X#define CST_LP 1 /* ( */
X#define CST_RP 2 /* ) */
X#define CST_BS 3 /* \ */
X#define CST_NL 4 /* \n */
X#define CST_FF 5 /* \f */
X#define CST_NU 6 /* \0 */
X#define CST_ES 7 /* ^[ */
X#define CST_EQ 8 /* = */
X#define CST_AM 9 /* & */
X#define CST_AS 10 /* * */
X#define CST_9 11 /* 9 */
X#define CST_E 12 /* E */
X#define CST_Y 13 /* Y */
X#define CST_Z 14 /* Z */
X#define CST_a 15 /* a */
X#define CST_b 16 /* b */
X#define CST_c 17 /* c */
X#define CST_d 18 /* d */
X#define CST_f 19 /* f */
X#define CST_k 20 /* k */
X#define CST_l 21 /* l */
X#define CST_p 22 /* p */
X#define CST_r 23 /* r */
X#define CST_s 24 /* s */
X#define CST_t 25 /* t */
X#define CST_EF 26 /* EOF */
X#define CST_TB 27 /* Tab */
X#define CST_SI 28 /* Shift in */
X#define CST_SO 29 /* Shift out */
X#define CST_MAX 30 /* End of these classes */
X /* Parameter scanner character classes */
X#define CSP___ 0 /* All other characters */
X#define CSP_SI 1 /* + - */
X#define CSP_DI 2 /* 0 1 2 3 4 5 6 7 8 9 */
X#define CSP_PE 3 /* . */
X#define CSP_LW 4 /* a-z */
X#define CSP_US 5 /* A-Z ! " # $ % & ' ( ) * , / : */
X /* ; < = > ? @ [ \ ] ^ _ ` { | } ~ */
X#define CSP_EF 6 /* EOF */
X#define CSP_MAX 7 /* End of these classes */
X
X /* Local structures and types
X */
X /* The text buffer */
Xtypedef struct { /* Input buffer */
X int length; /* Number of characters put back */
X char storage[MAX_BUFFER]; /* Storage for characters in the buffer */
X} buffer;
X
X /* Local variables
X */
Xstatic FILE *in_file; /* Input file */
Xstatic char curr_char; /* The current character */
Xstatic int end_of_file; /* True if at the end_of_file */
Xstatic buffer input; /* Buffer to hold put-back characters */
X
X /* The text scanner state/input table */
Xstatic int st_states[ST_MAX][CST_MAX] = {
X/* Legend:
X**{ CST___, CST_LP, CST_RP, CST_BS, CST_NL, CST_FF, CST_NU, CST_ES,
X** CST_EQ, CST_AM, CST_AS, CST_9 , CST_E , CST_Y , CST_Z , CST_a ,
X** CST_b , CST_c , CST_d , CST_f , CST_k , CST_l , CST_p , CST_r ,
X** CST_s , CST_t , CST_EF, CST_TB, CST_SI, CST_SO },
X*/
X /* ST____: END*/
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_STT: Start */
X { ST_TXT, ST_TLP, ST_TRP, ST_TBS, ST_TNL, ST_TFF, ST_NUL, ST_CMD,
X ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT,
X ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT,
X ST_TXT, ST_TXT, ST____, ST_TTB, ST_TSI, ST_TSO },
X /* ST_CMD: Command */
X { ST_UNK, ST_CLP, ST_CRP, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK,
X ST_CEQ, ST_CMA, ST_CMS, ST_C9 , ST_CE , ST_CY , ST_CZ , ST_UNK,
X ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK,
X ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK },
X /* ST_CMA: Command & */
X { ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK,
X ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_CAa,
X ST_UNK, ST_UNK, ST_CAd, ST_CAf, ST_CAk, ST_CAl, ST_CAp, ST_UNK,
X ST_CAs, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK },
X /* ST_CMS: Command * */
X { ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK,
X ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_UNK,
X ST_CSb, ST_CSc, ST_UNK, ST_UNK, ST_UNK, ST_UNK, ST_CSp, ST_CSr,
X ST_UNK, ST_CSt, ST_UNK, ST_UNK, ST_UNK, ST_UNK },
X /* ST_TLP: END: Text ( */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_TRP: END: Text ) */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_TBS: END: Text \ */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_TNL: END: Text \n */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_TFF: END: Text \f */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_UNK: END: Error: unknown command */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CEQ: END: Command = */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_C9:* END: Command 9 */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CZ:* END: Command Z */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CY:* END: Command Y */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CE:* END: Command E */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CAa: END: Command &a */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CAd: END: Command &d */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CAf: END: Command &f */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CAk: END: Command &k */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CAl: END: Command &l */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CAp: END: Command &p */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CAs: END: Command &s */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CSt: END: Command *t */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CSr: END: Command *r */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CSp: END: Command *p */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CSc: END: Command *c */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CSb: END: Command *b */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CLs: END: Command (s */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CRs: END: Command )s */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CLP: END: Command ( */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST_CLs, ST____, ST____, ST____, ST____, ST____ },
X /* ST_CRP: END: Command ) */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST_CRs, ST____, ST____, ST____, ST____, ST____ },
X /* ST_TXT: END: Text */
X { ST_TXT, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT,
X ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT, ST_TXT,
X ST_TXT, ST_TXT, ST____, ST____, ST____, ST____ },
X /* ST_NUL: END: Null */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_TTB: END: Tab */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_TSI: END: Shift in */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ },
X /* ST_TSO: END: Shift out */
X { ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____, ST____, ST____,
X ST____, ST____, ST____, ST____, ST____, ST____ }
X};
X
Xstatic int sp_states[SP_MAX][CSP_MAX] = {
X/* Legend:
X**{ CSP___, CSP_SI, CSP_DI, CSP_PE, CSP_LW, CSP_US, CSP_EF }
X*/
X /* SP____: Error */
X { SP____, SP____, SP____, SP____, SP____, SP____, SP____ },
X /* SP_PRM: Parameter */
X { SP_PEO, SP_INT, SP_INT, SP_PEO, SP_PC , SP_PE , SP_UNK },
X /* SP_INT: Integer */
X { SP_UNK, SP_PE , SP_INT, SP_FLP, SP_PC , SP_PE , SP_UNK },
X /* SP_FLP: Floating point */
X { SP_UNK, SP_PE , SP_FLP, SP_PE , SP_PC , SP_PE , SP_UNK },
X /* SP_PEO: END: Parameter end -- other (no argument) */
X { SP____, SP____, SP____, SP____, SP____, SP____, SP____ },
X /* SP_PE: END: Parameter end -- normal */
X { SP____, SP____, SP____, SP____, SP____, SP____, SP____ },
X /* SP_PC: END: Parameter continue */
X { SP____, SP____, SP____, SP____, SP____, SP____, SP____ },
X /* SP_UNK: END: Unknown command */
X { SP____, SP____, SP____, SP____, SP____, SP____, SP____ }
X};
X
Xstatic int st_classes[256] = {
X /* 00 */ CST_NU, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* 08 */ CST___, CST_TB, CST_NL, CST___, CST_FF, CST___, CST_SO, CST_SI,
X /* 10 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* 18 */ CST___, CST___, CST___, CST_ES, CST___, CST___, CST___, CST___,
X /* 20 */ CST___, CST___, CST___, CST___, CST___, CST___, CST_AM, CST___,
X /* 28 */ CST_LP, CST_RP, CST_AS, CST___, CST___, CST___, CST___, CST___,
X /* 30 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* 38 */ CST___, CST_9 , CST___, CST___, CST___, CST_EQ, CST___, CST___,
X /* 40 */ CST___, CST___, CST___, CST___, CST___, CST_E , CST___, CST___,
X /* 48 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* 50 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* 58 */ CST___, CST_Y , CST_Z , CST___, CST_BS, CST___, CST___, CST___,
X /* 60 */ CST___, CST_a , CST_b , CST_c , CST_d , CST___, CST_f , CST___,
X /* 68 */ CST___, CST___, CST___, CST_k , CST_l , CST___, CST___, CST___,
X /* 70 */ CST_p , CST___, CST_r , CST_s , CST_t , CST___, CST___, CST___,
X /* 78 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X
X /* 80 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* 88 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* 90 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* 98 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* a0 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* a8 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* b0 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* b8 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* c0 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* c8 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* d0 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* d8 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* e0 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* e8 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* f0 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___,
X /* f8 */ CST___, CST___, CST___, CST___, CST___, CST___, CST___, CST___
X};
X
Xstatic int sp_classes[256] = {
X /* 00 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* 08 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* 10 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* 18 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* 20 */ CSP___, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US,
X /* 28 */ CSP_US, CSP_US, CSP_US, CSP_SI, CSP_US, CSP_SI, CSP_PE, CSP_US,
X /* 30 */ CSP_DI, CSP_DI, CSP_DI, CSP_DI, CSP_DI, CSP_DI, CSP_DI, CSP_DI,
X /* 38 */ CSP_DI, CSP_DI, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US,
X /* 40 */ CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US,
X /* 48 */ CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US,
X /* 50 */ CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US,
X /* 58 */ CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US, CSP_US,
X /* 60 */ CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW,
X /* 68 */ CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW,
X /* 70 */ CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW, CSP_LW,
X /* 78 */ CSP_LW, CSP_LW, CSP_LW, CSP_US, CSP_US, CSP_US, CSP_US, CSP___,
X
X /* 80 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* 88 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* 90 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* 98 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* a0 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* a8 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* b0 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* b8 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* c0 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* c8 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* d0 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* d8 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* e0 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* e8 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* f0 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___,
X /* f8 */ CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___, CSP___
X};
X
X
X /* Local macro definitions
X */
X
X /* Local function list
X */
Xstatic void parse_argument();
X
X /* Function bodies
X */
X
X /* scan() is the front_end to the scanner. It runs the proper scanner,
X ** based on the value of scan_state. It returns a token number if the
X ** scan was successful, or zero if the end-of-file was reached.
X */
Xint
Xscan()
X{
X register int prev_state; /* The previous state */
X register int curr_state; /* The current state */
X
X rescan:
X
X curr_token.storage[0] = '\0'; curr_token.length = 0;
X curr_state = START;
X
X do{ /* Main scanning loop */
X
X prev_state = curr_state;
X
X /* Get the next character */
X if( input.length > 0 ){
X curr_char = input.storage[--input.length];
X }
X else{
X if( (curr_char = getc(in_file)) == EOF)
X end_of_file = 1;
X else
X end_of_file = 0;
X }
X
X#ifdef DEBUG
X if( debug == 2 ) fputc(curr_char, stderr);
X#endif
X
X if( !end_of_file ){
X
X#ifdef DEBUG
X if( debug == 3 ){
X switch( scan_state ){
X case SS_TEXT:
X fprintf(stderr,
X "TEXT curr % 3.3d (prev % 3.3d) char %c (0x%2.2x) class % 3.3d -> % 3.3d\n",
X curr_state, prev_state,
X curr_char, (int) curr_char, st_classes[curr_char],
X st_states[curr_state][st_classes[curr_char]]
X );
X break;
X case SS_PARAM:
X fprintf(stderr,
X "TEXT curr % 3.3d (prev % 3.3d) char %c (0x%2.2x) class % 3.3d -> % 3.3d\n",
X curr_state, prev_state,
X curr_char, (int) curr_char, sp_classes[curr_char],
X sp_states[curr_state][sp_classes[curr_char]]
X );
X break;
X default:
X internal_error("illegal scan state in scan()", "");
X } /* switch( ... ) */
X } /* if( debug ... ) */
X#endif
X
X switch( scan_state ){
X case SS_TEXT:
X if( (curr_state = st_states[curr_state][st_classes[curr_char]])
X == END ){
X
X /* Put back character */
X if( input.length == MAX_BUFFER ){
X internal_error("you blew the put-back buffer!", "");
X }
X else{
X input.storage[input.length] = curr_char;
X input.length++;
X }
X
X }
X else{
X
X /* Accept character */
X if( curr_token.length == MAX_BUFFER ){
X internal_error("current token is too large", "");
X }
X else{
X curr_token.storage[curr_token.length] = curr_char;
X curr_token.length++;
X }
X
X }
X break;
X case SS_PARAM:
X if( (curr_state = sp_states[curr_state][sp_classes[curr_char]])
X == END ){
X
X /* Put back character */
X if( input.length == MAX_BUFFER ){
X internal_error("you blew the put-back buffer!", "");
X }
X else{
X input.storage[input.length] = curr_char;
X input.length++;
X }
X
X }
X else{
X
X /* Accept character */
X if( curr_token.length == MAX_BUFFER ){
X internal_error("current token is too large", "");
X }
X else{
X curr_token.storage[curr_token.length] = curr_char;
X curr_token.length++;
X }
X
X }
X break;
X default:
X internal_error("illegal scan state in scan()", "");
X } /* switch(...) */
X
X } /* if( !eof ) */
X else{
X
X switch( scan_state ){
X case SS_TEXT:
X if( (curr_state = st_states[curr_state][CST_EF])
X != END ){
X
X fatal_error("end-of-file found in a command", "");
X
X }
X break;
X case SS_PARAM:
X if( (curr_state = sp_states[curr_state][CSP_EF])
X != END ){
X
X fatal_error("end-of-file found in a command", "");
X
X }
X break;
X default:
X internal_error("illegal scan state in scan()", "");
X } /* switch(...) */
X
X } /* else( !eof ) */
X
X } while( curr_state != END );
X
X /* If this point is reached, then an entire token has been scanned.
X ** The token must be properly saved, and then the appropriate token
X ** action must be performed. The switch() and embedded switch()'s
X ** perform the necessary token actions for each state.
X */
X curr_token.storage[curr_token.length] = '\0';
X switch( scan_state ){
X case SS_TEXT:
X switch( prev_state ){
X case ST_TLP: scan_state = SS_TEXT; curr_token.code = TEXT_lp; break;
X case ST_TRP: scan_state = SS_TEXT; curr_token.code = TEXT_rp; break;
X case ST_TBS: scan_state = SS_TEXT; curr_token.code = TEXT_bslash; break;
X case ST_TNL: scan_state = SS_TEXT; curr_token.code = TEXT_NEWLINE; break;
X case ST_TFF: scan_state = SS_TEXT; curr_token.code = TEXT_FORMFEED;break;
X case ST_UNK:
X warning("LaserJet command not supported", curr_token.storage);
X scan_state = SS_TEXT; goto rescan;
X case ST_CEQ: scan_state = SS_TEXT; curr_token.code = CMD_eq; break;
X case ST_C9 : scan_state = SS_TEXT; curr_token.code = CMD_9; break;
X case ST_CZ : scan_state = SS_TEXT; curr_token.code = CMD_Z; break;
X case ST_CY : scan_state = SS_TEXT; curr_token.code = CMD_Y; break;
X case ST_CE : scan_state = SS_TEXT; curr_token.code = CMD_E; break;
X case ST_CAa: scan_state = SS_PARAM; curr_token.code = CMD_amp_a; break;
X case ST_CAd: scan_state = SS_PARAM; curr_token.code = CMD_amp_d; break;
X case ST_CAf: scan_state = SS_PARAM; curr_token.code = CMD_amp_f; break;
X case ST_CAk: scan_state = SS_PARAM; curr_token.code = CMD_amp_k; break;
X case ST_CAl: scan_state = SS_PARAM; curr_token.code = CMD_amp_l; break;
X case ST_CAp: scan_state = SS_PARAM; curr_token.code = CMD_amp_p; break;
X case ST_CAs: scan_state = SS_PARAM; curr_token.code = CMD_amp_s; break;
X case ST_CSt: scan_state = SS_PARAM; curr_token.code = CMD_star_t; break;
X case ST_CSr: scan_state = SS_PARAM; curr_token.code = CMD_star_r; break;
X case ST_CSp: scan_state = SS_PARAM; curr_token.code = CMD_star_p; break;
X case ST_CSc: scan_state = SS_PARAM; curr_token.code = CMD_star_c; break;
X case ST_CSb: scan_state = SS_PARAM; curr_token.code = CMD_star_b; break;
X case ST_CLs: scan_state = SS_PARAM; curr_token.code = CMD_lp_s; break;
X case ST_CRs: scan_state = SS_PARAM; curr_token.code = CMD_rp_s; break;
X case ST_CLP: scan_state = SS_PARAM; curr_token.code = CMD_lp; break;
X case ST_CRP: scan_state = SS_PARAM; curr_token.code = CMD_rp; break;
X case ST_TXT: scan_state = SS_TEXT; curr_token.code = TEXT_CHAR; break;
X case ST_NUL: scan_state = SS_TEXT; curr_token.code = TEXT_NULL; break;
X case ST_TTB: scan_state = SS_TEXT; curr_token.code = TEXT_TAB; break;
X case ST_TSI: scan_state = SS_TEXT; curr_token.code = TEXT_SH_IN; break;
X case ST_TSO: scan_state = SS_TEXT; curr_token.code = TEXT_SH_OUT; break;
X case ST____:
X case ST_STT:
X case ST_CMD:
X case ST_CMA:
X case ST_CMS:
X default:
X if( !end_of_file ){
X internal_error("illegal state in text scanner token actions", "");
X }
X } /* switch( text scanner ) */
X break;
X case SS_PARAM:
X switch( prev_state ){
X case SP_PE :
X scan_state = SS_TEXT;
X curr_token.code = PARAM_END;
X parse_argument();
X break;
X case SP_PC :
X scan_state = SS_PARAM;
X curr_token.code = PARAM_CONTINUE;
X parse_argument();
X break;
X case SP_PEO:
X scan_state = SS_TEXT;
X curr_token.code = PARAM_END;
X parse_argument();
X break;
X case SP_UNK:
X warning("illegal character in command parameter", curr_token.storage);
X scan_state = SS_TEXT; goto rescan;
X case SP____:
X case SP_PRM:
X case SP_INT:
X case SP_FLP:
X default:
X internal_error("illegal state in parameter scanner token actions", "");
X } /* switch( parameter scanner ) */
X break;
X default:
X internal_error("illegal scan state in token actions", "");
X } /* switch( scan_state ) */
X
X return( !end_of_file );
X} /* scan() */
X
X
X
X /* scan_init() initializes the scanner to a new input stream. This is
X ** accomplished by reseting the scan_state, clearing the put-back buffer,
X ** and various other minor tasks.
X */
Xvoid
Xscan_init(file)
X FILE *file;
X{
X
X /* Initialize the scan state */
X scan_state = SS_TEXT;
X
X /* Save the handle to the file */
X in_file = file;
X end_of_file = 0;
X
X /* Reset the buffer */
X input.length = 0;
X
X /* Miscellaneous */
X text = curr_token.storage;
X command = curr_token.storage;
X
X} /* scan_init() */
X
X
X
X
Xstatic void
Xparse_argument()
X{
X
X /* Determine whether or not the command has a numeric argument */
X if( curr_token.length == 1 ){ /* No numeric argument */
X number[0] = '0'; /* Set number = "0" */
X number[1] = '\0';
X pos_code = POS_ABSOLUTE; /* Set to a constant value */
X }
X else{ /* Numeric argument present */
X /* Check if it is a relative offset */
X if( !isdigit(curr_token.storage[0]) ){
X if( curr_token.storage[0] == '+' ) pos_code = POS_REL_POSITIVE;
X else if( curr_token.storage[0] == '-' ) pos_code = POS_REL_NEGATIVE;
X else internal_error("illegal relative offset", curr_token.storage);
X }
X else{
X pos_code = POS_ABSOLUTE;
X }
X /* Record the scalar value */
X if( pos_code == POS_ABSOLUTE ){
X (void) strncpy(number, curr_token.storage, curr_token.length - 1);
X number[curr_token.length - 1] = '\0';
X }
X else{
X (void) strncpy(number, &(curr_token.storage)[1], curr_token.length - 2);
X number[curr_token.length - 2] = '\0';
X }
X }
X
X /* Finally, record the command as an *upper-case* single digit string */
X variable[0] = curr_token.storage[curr_token.length - 1];
X variable[1] = '\0';
X if( islower(variable[0]) ) variable[0] = toupper(variable[0]);
X
X} /* parse_argument() */
SHAR_EOF
$TOUCH -am 0630160790 scan.c &&
chmod 0644 scan.c ||
echo "restore of scan.c failed"
set `wc -c scan.c`;Wc_c=$1
if test "$Wc_c" != "32557"; then
echo original size 32557, current size $Wc_c
fi
fi
# ============= scan.h ==============
if test X"$1" != X"-c" -a -f 'scan.h'; then
echo "File already exists: skipping 'scan.h'"
else
echo "x - extracting scan.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > scan.h &&
X/*
X** Project: lj2ps
X** File: scan.h
X**
X** Author: Christopher Lishka
X** Organization: Wisconsin State Laboratory of Hygiene
X** Data Processing Dept.
X**
X** Copyright (C) 1990 by Christopher Lishka.
X**
X** This program is free software; you can redistribute it and/or modify
X** it under the terms of the GNU General Public License as published by
X** the Free Software Foundation; either version 1, or (at your option)
X** any later version.
X**
X** This program is distributed in the hope that it will be useful,
X** but WITHOUT ANY WARRANTY; without even the implied warranty of
X** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X** GNU General Public License for more details.
X**
X** You should have received a copy of the GNU General Public License
X** along with this program; if not, write to the Free Software
X** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X /* Global constants
X */
X#define MAX_BUFFER 1024 /* The maximum size of the token buffer */
X /* Persistent scanner states */
X#define SS_TEXT 1
X#define SS_PARAM 2
X /* Tokens returned */
X#define TEXT_lp 201 /* Normal text tokens */
X#define TEXT_rp 202
X#define TEXT_bslash 203
X#define TEXT_NEWLINE 204
X#define TEXT_FORMFEED 205
X#define TEXT_NULL 206
X#define TEXT_CHAR 207
X#define TEXT_TAB 208
X#define TEXT_SH_IN 209
X#define TEXT_SH_OUT 210
X#define CMD_UNDEF 300 /* Command tokens */
X#define CMD_E 301
X#define CMD_Y 302
X#define CMD_Z 303
X#define CMD_9 304
X#define CMD_eq 305
X#define CMD_lp 306
X#define CMD_rp 307
X#define CMD_lp_s 308
X#define CMD_rp_s 309
X#define CMD_amp_a 310
X#define CMD_amp_d 311
X#define CMD_amp_f 312
X#define CMD_amp_k 313
X#define CMD_amp_l 314
X#define CMD_amp_p 315
X#define CMD_amp_s 316
X#define CMD_star_b 317
X#define CMD_star_c 318
X#define CMD_star_p 319
X#define CMD_star_r 320
X#define CMD_star_t 321
X#define PARAM_CONTINUE 401 /* Parameter tokens */
X#define PARAM_END 402
X#define PARAM_UNDEF 403
X /* Position codes */
X#define POS_ABSOLUTE 501
X#define POS_REL_POSITIVE 502
X#define POS_REL_NEGATIVE 503
X
X /* Global structure and type definitions
X */
Xtypedef struct { /* Input buffer */
X int code; /* The token code */
X int length; /* Number of characters put back */
X char storage[MAX_BUFFER]; /* Storage for characters in the buffer */
X} token;
X
X /* Global variables
X */
Xextern int scan_state; /* Controls which scanner is being used */
Xextern char *text; /* Text read in for text tokens */
Xextern char *command; /* Command read in */
Xextern char variable[]; /* Command parameter */
Xextern char number[]; /* Command numeric argument */
Xextern int pos_code; /* Command numeric position code */
Xextern token curr_token; /* Where to hold the scanned token */
X
X /* Global macro definitions
X */
X
X /* Global functions
X */
Xextern int scan(); /* The entry into the scanners */
Xextern void scan_init(); /* Reset the input for the scanner */
SHAR_EOF
$TOUCH -am 0630160790 scan.h &&
chmod 0644 scan.h ||
echo "restore of scan.h failed"
set `wc -c scan.h`;Wc_c=$1
if test "$Wc_c" != "3044"; then
echo original size 3044, current size $Wc_c
fi
fi
# ============= transform.c ==============
if test X"$1" != X"-c" -a -f 'transform.c'; then
echo "File already exists: skipping 'transform.c'"
else
echo "x - extracting transform.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > transform.c &&
X/* Program: lj2ps
X** File: transform.c
X**
X** Author: Christopher Lishka
X** Organization: Wisconsin State Laboratory of Hygiene
X** Data Processing Dept.
X**
X** Copyright (C) 1990 by Christopher Lishka.
X**
X** This program is free software; you can redistribute it and/or modify
X** it under the terms of the GNU General Public License as published by
X** the Free Software Foundation; either version 1, or (at your option)
X** any later version.
X**
X** This program is distributed in the hope that it will be useful,
X** but WITHOUT ANY WARRANTY; without even the implied warranty of
X** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X** GNU General Public License for more details.
X**
X** You should have received a copy of the GNU General Public License
X** along with this program; if not, write to the Free Software
X** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
Xstatic char * ModuleID = "Module transform: v1.0.1.2, production";
X
X /* Include files
X */
X#include <stdio.h>
X#include "transform.h"
X#include "scan.h"
X#include "lj2ps.h"
X#include "lj.h"
X
X /* External definitions
X */
X
X /* Global variables
X */
X
X /* Global function list
X */
Xextern void transform();
X
X /* Local constants
X */
X
X /* Local structures and types
X */
X
X /* Local variables
X */
X
X /* Local macro definitions
X */
X#define report(x) fprintf(output_file, "%s", x);
X
X /* Local function list
X */
X
X /* Function bodies
X */
X
X /* transform() reads text mixed with laserjet commands from its input
X ** and "magically" changes it to postscript on its output. The magic
X ** is performed in a tight while-loop which acts as a simple decision
X ** table: for each token type (command, text, parameter) the appropriate
X ** action is done (which usually involves writing to stdout or calling
X ** an emulation function).
X */
Xvoid
Xtransform(input_file, output_file)
X FILE *input_file, *output_file;
X{
X
X /* Reset the scanner to read from the input */
X scan_init(input_file);
X
X /* While the input stream still has tokens, handle each token through
X ** the switch() jump table.
X */
X scan_state = SS_TEXT; /* Set the initial scan state */
X while( scan() ){
X#ifdef DEBUG
X if( debug ) fprintf(stderr, "{TOKEN:%d}", curr_token.code);
X#endif
X switch( curr_token.code ){
X case TEXT_CHAR:
X if( (page_height - current_y) > (text_height + margin_top + LJ_ERROR) ){
X lj_page_end(output_file);
X lj_page_begin(output_file);
X }
X lj_text_add(output_file, text);
X break;
X case TEXT_NULL: /* Ignore nulls */
X warning("encountered a null; ignoring", "");
X break;
X case TEXT_lp:
X lj_text_add(output_file, "\\(");
X break;
X case TEXT_rp:
X lj_text_add(output_file, "\\)");
X break;
X case TEXT_bslash:
X lj_text_add(output_file, "\\\\");
X break;
X case TEXT_NEWLINE:
X if( (page_height - current_y) > (text_height + margin_top + LJ_ERROR) ){
X lj_page_end(output_file);
X lj_page_begin(output_file);
X }
X lj_nl(output_file); /* Write out a newline */
X current_line++;
X break;
X case TEXT_FORMFEED:
X lj_page_end(output_file);
X /* XXX insert page counting mechanism here! */
X lj_page_begin(output_file);
X break;
X case TEXT_TAB:
X /* XXX This should check for either font_p or font_s, and not assume
X ** font_p automatically!
X */
X if( font_p.spacing == LJ_SP_PROPORTIONAL )
X warning("a tab is being used with a proportional font!", "");
X lj_text_end(output_file);
X fputs("TAB ", output_file);
X lj_text_begin();
X break;
X case TEXT_SH_IN:
X warning("shift-in is not yet supported -- ignoring", "");
X break;
X case TEXT_SH_OUT:
X warning("shift-out is not yet supported -- ignoring", "");
X break;
X case CMD_UNDEF: ljcmd_undefined(input_file, output_file); break;
X case CMD_E: ljcmd_E(output_file); break;
X case CMD_Y: ljcmd_Y(output_file); break;
X case CMD_Z: ljcmd_Z(output_file); break;
X case CMD_9: ljcmd_9(output_file); break;
X case CMD_eq: ljcmd_eq(output_file); break;
X case CMD_lp: ljcmd_lp(input_file, output_file); break;
X case CMD_rp: ljcmd_rp(input_file, output_file); break;
X case CMD_lp_s: ljcmd_lp_s(input_file, output_file); break;
X case CMD_rp_s: ljcmd_rp_s(input_file, output_file); break;
X case CMD_amp_a: ljcmd_amp_a(input_file, output_file); break;
X case CMD_amp_d: ljcmd_amp_d(input_file, output_file); break;
X case CMD_amp_f: ljcmd_amp_f(input_file, output_file); break;
X case CMD_amp_k: ljcmd_amp_k(input_file, output_file); break;
X case CMD_amp_l: ljcmd_amp_l(input_file, output_file); break;
X case CMD_amp_p: ljcmd_amp_p(input_file, output_file); break;
X case CMD_amp_s: ljcmd_amp_s(input_file, output_file); break;
X case CMD_star_b: ljcmd_star_b(input_file, output_file); break;
X case CMD_star_c: ljcmd_star_c(input_file, output_file); break;
X case CMD_star_p: ljcmd_star_p(input_file, output_file); break;
X case CMD_star_r: ljcmd_star_r(input_file, output_file); break;
X case CMD_star_t: ljcmd_star_t(input_file, output_file); break;
X case PARAM_CONTINUE:
X case PARAM_END:
X internal_error("(end)parameter found in transform()", variable);
X break;
X default:
X internal_error("illegal token encountered in transform()", "");
X } /* switch(...) */
X } /* while(...) */
X
X} /* transform() */
X
X
X
SHAR_EOF
$TOUCH -am 0630160790 transform.c &&
chmod 0644 transform.c ||
echo "restore of transform.c failed"
set `wc -c transform.c`;Wc_c=$1
if test "$Wc_c" != "5589"; then
echo original size 5589, current size $Wc_c
fi
fi
# ============= transform.h ==============
if test X"$1" != X"-c" -a -f 'transform.h'; then
echo "File already exists: skipping 'transform.h'"
else
echo "x - extracting transform.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > transform.h &&
X/*
X** Project: lj2ps
X** File: transform.h
X**
X** Author: Christopher Lishka
X** Organization: Wisconsin State Laboratory of Hygiene
X** Data Processing Dept.
X**
X** Copyright (C) 1990 by Christopher Lishka.
X**
X** This program is free software; you can redistribute it and/or modify
X** it under the terms of the GNU General Public License as published by
X** the Free Software Foundation; either version 1, or (at your option)
X** any later version.
X**
X** This program is distributed in the hope that it will be useful,
X** but WITHOUT ANY WARRANTY; without even the implied warranty of
X** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X** GNU General Public License for more details.
X**
X** You should have received a copy of the GNU General Public License
X** along with this program; if not, write to the Free Software
X** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X /* Global constants
X */
X
X /* Global structure and type definitions
X */
X
X /* Global variables
X */
X
X /* Global macro definitions
X */
X
X /* Global functions
X */
Xextern void transform();
SHAR_EOF
$TOUCH -am 0630160790 transform.h &&
chmod 0644 transform.h ||
echo "restore of transform.h failed"
set `wc -c transform.h`;Wc_c=$1
if test "$Wc_c" != "1091"; then
echo original size 1091, current size $Wc_c
fi
fi
exit 0
More information about the Comp.sources.misc
mailing list