summaryrefslogtreecommitdiff
path: root/systems/unix/tex-fpc/mfware/gftopk.ch
blob: ed7f0feaa27bbf25513006bed89c8084eb8701a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
This is a change file of GFtoPK for FPC, Wolfgang Helbig, Apr. 2008
To be used with the GNU Pascal Compiler Version 2.1

[0] About GFtoPK-FPC
@x
\pageno=\contentspagenumber \advance\pageno by 1
@y
\pageno=\contentspagenumber \advance\pageno by 1
\input webmac-fpc

% \let\maybe=\iffalse % uncomment to print changed modules only.

\def\name{\tt GFtoPK}

\N0\*. About \namefpc.\fi
This is an adaption of Donald~E. Knuth's \.{GFtoPK}, version 2.4
from January 2014, to Unix. \namefpc\ is based on Free~Pascal,
version 3.0.0

\namefpc\ expects the input file (\.{.gf}) and the output file
(\.{.pk}) on the command line.
To support shell scripting, it sets the exit code to one
when something was wrong with the input file.

\hint

Comments and questions are welcome!

\bigskip
\address
@z

[1] Change the banner line
@x
@d banner=='This is GFtoPK, Version 2.4' {printed when the program starts}
@y
@d banner=='This is GFtoPK-FPC'
   {printed when the program starts}
@z

[3] default case branch
@x
@d othercases == others: {default for cases not listed explicitly}
@y
@d othercases == @+else {default for cases not listed explicitly}
@z

[4] filenames from commandline
@x
@p program GFtoPK(@!gf_file,@!pk_file,@!output);
@y
@p@{@&$M@&O@&D@&E D@&E@&L@&P@&H@&I@}

 program GFtoPK(@!output);
@z

[8] pint end of line at end of line
@x
@d abort(#)==begin print(' ',#); jump_out;
@y
@d abort(#)==begin print_ln(' ',#); history := 1; jump_out;
@z

[8] cannot use nonlocal goto in DELPHI-Mode
@x
begin goto final_end;
@y
begin halt(history);
@z

[39] get gf file name from command line
@x
begin reset(gf_file);
@y
begin assign(gf_file, param_str(1)); reset(gf_file);
@z

[40] get pk file name from command line
@x
begin rewrite(pk_file);
@y
begin assign(pk_file, param_str(2)); rewrite(pk_file);
@z

[46] Random access
@x
   set_pos(gf_file, -1) ; gf_len := cur_pos(gf_file) ;
@y
   gf_len := file_size(gf_file); seek(gf_file, gf_len);
@z

@x
   set_pos(gf_file, n); gf_loc := n ;
@y
   seek(gf_file, n); gf_loc := n ;
@z

[51] check command line arguments
@x
   open_gf_file ;
@y
   if param_count <> 2 then abort('Usage: gftopk gf-file pk-file');
   open_gf_file ;
@z

[88 ff] system dependent changes
@x
itself will get a new section number.
@^system dependencies@>
@y
itself will get a new section number.
@^system dependencies@>

@<Glob...@>=
@! history : integer;

@ @<Set init...@>=
history := 0;
@z