1 /******************************************************************************
2  * Copyright (C) 1991,1992 by Wei Sun (william@cs.anu.edu.au)
3  * All Rights Reserved
4  * Version 2.02
5  *
6  * File:
7  *	GB2PS.C
8  *
9  * SYNOPSIS:
10  * 	 gb2ps [-h] [-c font][-y year][-m month][-i issue][-b page_no]
11  *	       [-e page_no][-p][-t] input_file [output_file]
12  *
13  * DESCRIPTION:
14  * 	GB2PS converts the HANZI GB code article into PostScript printable
15  * 	files that can be printed on PostScript printers.
16  *
17  *	OPTIONS:
18  *	-h		Help, print the usage of GB2PS
19  *	-y year
20  *	-m month
21  *	-i issue	These peramaters are used in generating the cover
22  *			page file, they will be passed to the coverpage
23  *			PS file directly.
24  *	-t		don't generate cover page.
25  *	-f		allow page formating.
26  *	-p		don't generate page number.
27  *	-b page_no	begin generating PS file from page page_no.
28  *	-e page_no	end generating PS file at page page_no.
29 
30  * ENVIRONMENT VARIABLES:
31  *	CFONT:		Chinese characters font file.
32  *	COVERPAGE:	Cover page PS file.
33  *
34  * DISTRIBUTION:
35  *	This program and the font file are NOT in public domain.
36  *	All the files can be freely distributed for non-commercial purposes
37  * 	only, and THERE IS NO WARRANTY FOR THIS PROGRAM.
38  *
39  * AUTHOR:
40  * 	The author can be reached by E-mail: william@cs.anu.edu.au
41  *	or mail at:
42  *
43  *	   Wei Sun
44  *	   Department of Computer Science
45  *	   The Australian National University
46  *	   Canberra, ACT 2601
47  *	   Australia
48  *****************************************************************************/
49 
50 #include <string.h>
51 #include <stdlib.h>
52 #include "gb2ps.h"
53 
54 
55 int _LM,_RM,_TM,_BM,_FI;
56 
57 char 	stheader[100],stfooter[100];
58 int	pageno_flag=TRUE;
59 int	endpage_flag=FALSE;
60 int	pagecounter=1;
61 int	page_begin_print=1,page_end_print= -1;
62 float	linespace=3.0;
63 float	charspace=0.07;
64 
65 struct CHfont	CHFONT[6];
66 int	CFP=0;
67 char	cfont_name[100];
68 char	filename[100];
69 long	offset_CH=0;
70 int 	font_height,font_width;
71 long	size_of_CH=150;
72 char	line[500];
73 int	charcount=0;
74 
75 char 	styear[5]="1991";
76 char 	stmonth[3]="5";
77 char 	stissue[3]="4";
78 int	coverpage_flag=TRUE;
79 int	format_flag=FALSE;
80 int	Analyse_flag=TRUE;
81 
82 FILE	*in, *out;
83 FILE	*cfont;
84 float	H,V;
85 
86 int
main(argc,argv)87 main (argc,argv)
88 int	argc;
89 char	**argv;
90 {
91   int	ch=0,ch1,ch2;
92   int	i;
93 
94   *stheader= *stfooter=0;
95   i=init(argc,argv);
96 
97   init_page();
98   AnalyseDoc();
99 
100   printf("Page(s):");
101 
102   if (coverpage_flag)
103   	coverpage();
104   else
105 	ps_header();
106 
107   begin_page();
108   while (((ch1=readchar())!=EOF)&&(pagecounter!=page_end_print)) {
109 	if (!ch)
110 		ch2=readchar();
111 	else {
112 		ch2=ch1;
113 		ch1=ch;
114 	}
115 	ch=putChar(ch1,ch2);
116   }
117     if (pagecounter!=page_end_print) end_page ();
118     ps_end();
119     fprintf(out,"end\n");
120     cleanup(i);
121   printf("\n");
122 }
123 
124 
125