wp2latex (2 of 4)
Glenn Geers
glenn at extro.ucc.su.oz.au
Wed Aug 8 21:49:59 AEST 1990
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
# wp2latex.pas
# This archive created: Wed Aug 8 21:44:56 1990
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'wp2latex.pas'" '(49507 characters)'
if test -f 'wp2latex.pas'
then
echo shar: "will not over-write existing file 'wp2latex.pas'"
else
sed 's/^ X//' << \SHAR_EOF > 'wp2latex.pas'
XProgram WordPerfect_to_LaTeX;
X
X{ Version 1.0
X Date 27-1-1990
X}
X
X{$R+} { Range check error }
X
X
XUses Crt; { Clearscreen }
X
XType Bin = file of byte;
X
XVar
X wpd_fn,
X strip_fn,
X tabel_fn,
X latex_fn : String;
X
X wpd,
X tabel : Bin;
X strip,
X latex : Text;
X
X num_of_lines_stripfile : Word;
X
X open_com,
X close_com : Array [$0..$10] of String;
X
X Exitsave : pointer;
X
X
XProcedure Rd_word(Var f:Bin; Var w:Word);
X{ Deze procedure leest een woord uit de opgegeven binaire file. }
X
XVar
X b : Byte;
X
XBegin
X Read(f,b);
X w:=b;
X Read(f,b);
X w:=w+256*b
XEnd;
X
X
XProcedure Wr_word(Var f:Bin; w:Word);
X{ Deze procedure schrijft een woord in de opgegeven binaire file. }
X
XVar
X b : Byte;
X
XBegin
X b:=w mod 256;
X Write(f,b);
X b:=w div 256;
X Write(f,b);
XEnd;
X
X
XProcedure Jump_in_file(Var f:Bin; dis:Longint);
X{ Deze procedure springt in een binaire file het aantal opgegeven bytes. }
X
XVar
X cur_pos : Longint;
X
XBegin
X cur_pos := Filepos(f);
X Seek(f,cur_pos+dis);
XEnd;
X
X
X
XProcedure Wpd_check;
X{ Kontroleert of de opgegeven WP-document wel daadwerkelijk een }
X{ WP5.0-document is. }
X
XVar id1,id2,std1,std2,filetype,dmp1,dmp2,dmp3 : Word;
X Startdoc, Pointer : Longint;
X b:Byte;
X
XBegin
X Rd_word(wpd,id1); Rd_word(wpd,id2);
X Rd_word(wpd,std1); Rd_word(wpd,std2);
X Rd_word(wpd,filetype);
X Rd_word(wpd,dmp1); Rd_word(wpd,dmp2); Rd_word(wpd,dmp3);
X
X Startdoc:=std2*65536+std1;
X
X If (id1=$57ff) and (id2=$4350) and
X (filetype=$0A01) {and (dmp1=$0) and (dmp2=$0) and (dmp3=$0)}
X
X Then Seek(wpd,startdoc) { Het is een WP5.0-document}
X Else RunError($0201) { Het is geen WP5.0-document}
XEnd;
X
X
X
X
XProcedure Filenames;
X{ Deze procedure handelt het opgeven van de filenamen af. }
X
XVar
X name,
X invoer,
X wpdef,
X latdef,
X filename,
X ext : String;
X l,p : Integer;
X
XBegin
X If ParamCount<1
X Then wpdef:=''
X Else wpdef:=Paramstr(1);
X
X Writeln;
X Writeln;
X Write('WordPerfect-filename [',wpdef,'] : ');
X Readln(invoer);
X If invoer=''
X Then wpd_fn:=wpdef
X Else wpd_fn:=invoer;
X
X If wpd_fn='' { No filename entered }
X Then RunError($200);
X
X name:=wpd_fn;
X l:=Length(name);
X p:=Pos('.',name);
X if p=0 then p:=l+1;
X filename:=copy(name,1,p-1);
X
X strip_fn:=concat(filename,'.STR');
X tabel_fn:=concat(filename,'.TBL');
X latdef:=concat(filename,'.TEX');
X
X Write('LaTeX-filename [',latdef,'] : ');
X Readln(invoer);
X Writeln;
X If invoer=''
X Then latex_fn:=latdef
X Else latex_fn:=invoer;
X
X Assign(wpd,wpd_fn);
X Assign(strip,strip_fn);
X Assign(tabel,tabel_fn);
X Assign(latex,latex_fn);
X
XEnd;
X
X
X{$F+}
XProcedure Einde_prog;
X{ Deze procedure wordt aan het einde van het programma aangeroepen. }
X{ Er wordt gekeken of er zich Run-Time error heeft voor gedaan. }
X
XVar
X save_ErrorAddr : Pointer;
X
XBegin
X Writeln;
X
X ExitProc:=Exitsave;
X save_ErrorAddr := ErrorAddr;
X ErrorAddr := nil;
X
X If save_ErrorAddr <> nil
X Then Case Exitcode of
X $0002 : Writeln('File not found.');
X $0003 : Writeln('Path not found.');
X $0100 : Writeln('Program Error.');
X $0200 : Writeln('No filename entered !');
X $0201 : Writeln('Not a WordPerfect 5.0 document !');
X
X Else ErrorAddr := save_ErrorAddr;
X End
X
X Else Begin
X Writeln('Conversion completed.');
X Writeln;
X End;
X
X Writeln;
XEnd;
X{$F-}
X
X
XProcedure Init_commando;
XBegin
X Open_com[$0]:='{\LARGE ';
X Open_com[$1]:='{\Large ';
X Open_com[$2]:='{\large ';
X Open_com[$3]:='{\small ';
X Open_com[$4]:='{\footnotesize ';
X Open_com[$5]:='$^{\rm ';
X Open_com[$6]:='$_{\rm ';
X Open_com[$7]:='';
X Open_com[$8]:='{\it ';
X Open_com[$9]:='';
X Open_com[$A]:='';
X Open_com[$B]:='\underline{\Underline{';
X Open_com[$C]:='{\bf ';
X Open_com[$D]:='';
X Open_com[$E]:='\Underline{';
X Open_com[$F]:='{\sc ';
X
X Close_com[$0]:='}';
X Close_com[$1]:='}';
X Close_com[$2]:='}';
X Close_com[$3]:='}';
X Close_com[$4]:='}';
X Close_com[$5]:='}$';
X Close_com[$6]:='}$';
X Close_com[$7]:='';
X Close_com[$8]:='\/}';
X Close_com[$9]:='';
X Close_com[$A]:='';
X Close_com[$B]:='}}';
X Close_com[$C]:='}';
X Close_com[$D]:='';
X Close_com[$E]:='}';
X Close_com[$F]:='}';
XEnd;
X
X
X{---SLAG1----}
X
XProcedure Convert_first_strike;
X{ Dit is de komplete procedure van de eerste slag met zijn eigen proc.'s. }
X
XVar
X by : Byte;
X wo,
X regelnum : Word;
X
X convperc,
X i : Integer;
X
X srtdocpos,
X fsize,
X fpos,
X nextdocpos : longint;
X
X lat : Array[$20..$7F] of String[25];
X char_set : Array[$80..$FE] of Integer;
X char_code : Array[$80..$FE] of Integer;
X ext_lat : Array[$80..$FE] of String[25];
X
X
X leegptr,
X openptr : Array [0..1] of Integer;
X attr_rij : Array [0..1,0..16] of Byte;
X open_attr_rij : Array [0..1] of Boolean;
X depth : Integer;
X
X envir,
X line_term : Char;
X
X char_on_line,
X nomore_valid_tabs,
X indenting,
X indent_end,
X ind_text1,
X ind_text2 : Boolean;
X
X ind_leftmargin,
X ind_rightmargin : Word;
X
X num_of_tabs,
X latex_tabpos : Integer;
X tabpos : Array [1..40] of Word;
X right_tab,
X align_tab,
X center_tab : Boolean;
X
X WP_sidemargin : Integer;
X
X
X
X
XProcedure WP_Default;
XVar
X j : Integer;
X
XBegin
X WP_sidemargin := 1200;
X
X tabpos[1]:=$02c5; { 1e WP-tab is kantlijn --> }
X For j:=2 to 10
X Do tabpos[j]:=tabpos[j-1]+$02c5; { Volgende tabs 1,5 cm }
X For j:=11 to 40 { ($02c5 wpu) verder }
X Do tabpos[j]:=$FFFF;
X
X num_of_tabs:=10;
XEnd;
X
X
XProcedure Table_Init;
XBegin
X lat[$20]:=' '; {Space}
X lat[$21]:='!'; {!}
X lat[$22]:='"'; {"}
X lat[$23]:='\#'; {#}
X lat[$24]:='\$'; {dollar}
X lat[$25]:='\%'; {%}
X lat[$26]:='\&'; {&}
X lat[$27]:=''''; {'}
X lat[$28]:='('; {(}
X lat[$29]:=')'; {)}
X lat[$2A]:='*'; {*}
X lat[$2B]:='+'; {+}
X lat[$2C]:=','; {,}
X lat[$2D]:='-'; {-}
X lat[$2E]:='.'; {.}
X lat[$2F]:='/'; {/}
X lat[$30]:='0'; {0}
X lat[$31]:='1'; {1}
X lat[$32]:='2'; {2}
X lat[$33]:='3'; {3}
X lat[$34]:='4'; {4}
X lat[$35]:='5'; {5}
X lat[$36]:='6'; {6}
X lat[$37]:='7'; {7}
X lat[$38]:='8'; {8}
X lat[$39]:='9'; {9}
X lat[$3A]:=':'; {:}
X lat[$3B]:=';'; {;}
X lat[$3C]:='$<$'; {<}
X lat[$3D]:='='; {=}
X lat[$3E]:='$>$'; {>}
X lat[$3F]:='?'; {?}
X lat[$40]:='@'; {@}
X lat[$41]:='A'; {A}
X lat[$42]:='B'; {B}
X lat[$43]:='C'; {C}
X lat[$44]:='D'; {D}
X lat[$45]:='E'; {E}
X lat[$46]:='F'; {F}
X lat[$47]:='G'; {G}
X lat[$48]:='H'; {H}
X lat[$49]:='I'; {I}
X lat[$4A]:='J'; {J}
X lat[$4B]:='K'; {K}
X lat[$4C]:='L'; {L}
X lat[$4D]:='M'; {M}
X lat[$4E]:='N'; {N}
X lat[$4F]:='O'; {O}
X lat[$50]:='P'; {P}
X lat[$51]:='Q'; {Q}
X lat[$52]:='R'; {R}
X lat[$53]:='S'; {S}
X lat[$54]:='T'; {T}
X lat[$55]:='U'; {U}
X lat[$56]:='V'; {V}
X lat[$57]:='W'; {W}
X lat[$58]:='X'; {X}
X lat[$59]:='Y'; {Y}
X lat[$5A]:='Z'; {Z}
X lat[$5B]:='['; {[}
X lat[$5C]:='$\tt\backslash$'; {\}
X lat[$5D]:=']'; {]}
X lat[$5E]:='\^{'; {^}
X lat[$5F]:='\_'; {_}
X lat[$60]:='`'; {`}
X lat[$61]:='a'; {a}
X lat[$62]:='b'; {b}
X lat[$63]:='c'; {c}
X lat[$64]:='d'; {d}
X lat[$65]:='e'; {e}
X lat[$66]:='f'; {f}
X lat[$67]:='g'; {g}
X lat[$68]:='h'; {h}
X lat[$69]:='i'; {i}
X lat[$6A]:='j'; {j}
X lat[$6B]:='k'; {k}
X lat[$6C]:='l'; {l}
X lat[$6D]:='m'; {m}
X lat[$6E]:='n'; {n}
X lat[$6F]:='o'; {o}
X lat[$70]:='p'; {p}
X lat[$71]:='q'; {q}
X lat[$72]:='r'; {r}
X lat[$73]:='s'; {s}
X lat[$74]:='t'; {t}
X lat[$75]:='u'; {u}
X lat[$76]:='v'; {v}
X lat[$77]:='w'; {w}
X lat[$78]:='x'; {x}
X lat[$79]:='y'; {y}
X lat[$7A]:='z'; {z}
X lat[$7B]:='\{'; {{}
X lat[$7C]:='$|$'; {|}
X lat[$7D]:='\}'; { }
X lat[$7E]:='\tidle{'; {~}
X lat[$7F]:=' '; {Don't exsist}
XEnd;
X
X
XProcedure Ext_chr_init;
XBegin
X char_set[$80]:=$01; char_code[$80]:=$26; ext_lat[$80]:='\c{C}';
X char_set[$81]:=$01; char_code[$81]:=$47; ext_lat[$81]:='\"{u}';
X char_set[$82]:=$01; char_code[$82]:=$29; ext_lat[$82]:='\''{e}';
X char_set[$83]:=$01; char_code[$83]:=$1D; ext_lat[$83]:='\^{a}';
X char_set[$84]:=$01; char_code[$84]:=$1F; ext_lat[$84]:='\"{a}';
X char_set[$85]:=$01; char_code[$85]:=$21; ext_lat[$85]:='\`{a}';
X char_set[$86]:=$01; char_code[$86]:=$23; ext_lat[$86]:='\aa ';
X char_set[$87]:=$01; char_code[$87]:=$27; ext_lat[$87]:='\c{c}';
X char_set[$88]:=$01; char_code[$88]:=$2B; ext_lat[$88]:='\^{e}';
X char_set[$89]:=$01; char_code[$89]:=$2D; ext_lat[$89]:='\"{e}';
X char_set[$8A]:=$01; char_code[$8A]:=$2F; ext_lat[$8A]:='\`{e}';
X char_set[$8B]:=$01; char_code[$8B]:=$35; ext_lat[$8B]:='\"{\i}';
X char_set[$8C]:=$01; char_code[$8C]:=$33; ext_lat[$8C]:='\^{\i}';
X char_set[$8D]:=$01; char_code[$8D]:=$37; ext_lat[$8D]:='\`{\i}';
X char_set[$8E]:=$01; char_code[$8E]:=$1E; ext_lat[$8E]:='\"{A}';
X char_set[$8F]:=$01; char_code[$8F]:=$22; ext_lat[$8F]:='\AA ';
X char_set[$90]:=$01; char_code[$90]:=$28; ext_lat[$90]:='\''{E}';
X char_set[$91]:=$01; char_code[$91]:=$25; ext_lat[$91]:='\ae ';
X char_set[$92]:=$01; char_code[$92]:=$24; ext_lat[$92]:='\AE ';
X char_set[$93]:=$01; char_code[$93]:=$3D; ext_lat[$93]:='\^{o}';
X char_set[$94]:=$01; char_code[$94]:=$3F; ext_lat[$94]:='\"{o}';
X char_set[$95]:=$01; char_code[$95]:=$41; ext_lat[$95]:='\`{o}';
X char_set[$96]:=$01; char_code[$96]:=$45; ext_lat[$96]:='\^{u}';
X char_set[$97]:=$01; char_code[$97]:=$49; ext_lat[$97]:='\`{u}';
X char_set[$98]:=$01; char_code[$98]:=$8B; ext_lat[$98]:='\"{y}';
X char_set[$99]:=$01; char_code[$99]:=$3E; ext_lat[$99]:='\"{O}';
X char_set[$9A]:=$01; char_code[$9A]:=$46; ext_lat[$9A]:='\"{U}';
X char_set[$9B]:=$04; char_code[$9B]:=$13; ext_lat[$9B]:='\ ';
X char_set[$9C]:=$04; char_code[$9C]:=$0B; ext_lat[$9C]:='\pounds ';
X char_set[$9D]:=$04; char_code[$9D]:=$0C; ext_lat[$9D]:='\ ';
X char_set[$9E]:=$04; char_code[$9E]:=$0D; ext_lat[$9E]:='\ ';
X char_set[$9F]:=$04; char_code[$9F]:=$0E; ext_lat[$9F]:='{\it f}\/';
X char_set[$A0]:=$01; char_code[$A0]:=$1B; ext_lat[$A0]:='\''{a}';
X char_set[$A1]:=$01; char_code[$A1]:=$31; ext_lat[$A1]:='\''{\i}';
X char_set[$A2]:=$01; char_code[$A2]:=$3B; ext_lat[$A2]:='\''{o}';
X char_set[$A3]:=$01; char_code[$A3]:=$43; ext_lat[$A3]:='\''{u}';
X char_set[$A4]:=$01; char_code[$A4]:=$39; ext_lat[$A4]:='\~{n}';
X char_set[$A5]:=$01; char_code[$A5]:=$38; ext_lat[$A5]:='\~{N}';
X char_set[$A6]:=$04; char_code[$A6]:=$0F; ext_lat[$A6]:='\astrike ';
X char_set[$A7]:=$04; char_code[$A7]:=$10; ext_lat[$A7]:='\ostrike ';
X char_set[$A8]:=$04; char_code[$A8]:=$08; ext_lat[$A8]:='?`';
X char_set[$A9]:=$05; char_code[$A9]:=$10; ext_lat[$A9]:='~';
X char_set[$AA]:=$06; char_code[$AA]:=$14; ext_lat[$AA]:='~';
X char_set[$AB]:=$04; char_code[$AB]:=$11; ext_lat[$AB]:='$\frac{1}{2}$';
X char_set[$AC]:=$04; char_code[$AC]:=$12; ext_lat[$AC]:='$\frac{1}{4}$';
X char_set[$AD]:=$04; char_code[$AD]:=$07; ext_lat[$AD]:='!`';
X char_set[$AE]:=$04; char_code[$AE]:=$09; ext_lat[$AE]:='$\ll$';
X char_set[$AF]:=$04; char_code[$AF]:=$0A; ext_lat[$AF]:='$\gg$';
X char_set[$E0]:=$08; char_code[$E0]:=$01; ext_lat[$E0]:='$\alpha$';
X char_set[$E1]:=$01; char_code[$E1]:=$17; ext_lat[$E1]:='$\beta$';
X char_set[$E2]:=$08; char_code[$E2]:=$06; ext_lat[$E2]:='$\Gamma$';
X char_set[$E3]:=$08; char_code[$E3]:=$21; ext_lat[$E3]:='$\pi$';
X char_set[$E4]:=$08; char_code[$E4]:=$24; ext_lat[$E4]:='$\Sigma$';
X char_set[$E5]:=$08; char_code[$E5]:=$25; ext_lat[$E5]:='$\sigma$';
X char_set[$E6]:=$08; char_code[$E6]:=$19; ext_lat[$E6]:='$\mu$';
X char_set[$E7]:=$08; char_code[$E7]:=$29; ext_lat[$E7]:='$\tau$';
X char_set[$E8]:=$08; char_code[$E8]:=$2C; ext_lat[$E8]:='$\Phi$';
X char_set[$E9]:=$08; char_code[$E9]:=$10; ext_lat[$E9]:='$\theta$';
X char_set[$EA]:=$08; char_code[$EA]:=$32; ext_lat[$EA]:='$\Omega$';
X char_set[$EB]:=$08; char_code[$EB]:=$09; ext_lat[$EB]:='$\delta$';
X char_set[$EC]:=$06; char_code[$EC]:=$13; ext_lat[$EC]:='$\infty$';
X char_set[$ED]:=$08; char_code[$ED]:=$2D; ext_lat[$ED]:='$\emptyset$';
X char_set[$EE]:=$08; char_code[$EE]:=$0B; ext_lat[$EE]:='$\epsilon$';
X char_set[$EF]:=$06; char_code[$EF]:=$10; ext_lat[$EF]:='$\cap$';
X char_set[$F0]:=$06; char_code[$F0]:=$0E; ext_lat[$F0]:='$\equiv$';
X char_set[$F1]:=$06; char_code[$F1]:=$01; ext_lat[$F1]:='$\pm$';
X char_set[$F2]:=$06; char_code[$F2]:=$03; ext_lat[$F2]:='$\geq$';
X char_set[$F3]:=$06; char_code[$F3]:=$02; ext_lat[$F3]:='$\leq$';
X char_set[$F4]:=$07; char_code[$F4]:=$00; ext_lat[$F4]:='~';
X char_set[$F5]:=$07; char_code[$F5]:=$01; ext_lat[$F5]:='~';
X char_set[$F6]:=$06; char_code[$F6]:=$08; ext_lat[$F6]:='$\div$';
X char_set[$F7]:=$06; char_code[$F7]:=$0D; ext_lat[$F7]:='$\approx$';
X char_set[$F8]:=$06; char_code[$F8]:=$24; ext_lat[$F8]:='\degrees ';
X char_set[$F9]:=$06; char_code[$F9]:=$1F; ext_lat[$F9]:='~';
X char_set[$FA]:=$06; char_code[$FA]:=$20; ext_lat[$FA]:='~';
X char_set[$FB]:=$07; char_code[$FB]:=$04; ext_lat[$FB]:='$\surd$';
X char_set[$FC]:=$04; char_code[$FC]:=$15; ext_lat[$FC]:='$^{n}$';
X char_set[$FD]:=$04; char_code[$FD]:=$14; ext_lat[$FD]:='$^{2}$';
X char_set[$FE]:=$04; char_code[$FE]:=$02; ext_lat[$FE]:='~';
XEnd;
X
X
XProcedure Make_tabelentry_attr;
XVar
X b,
X num_of_attr : Byte;
X j : Integer;
X
XBegin
X num_of_attr := openptr[depth];
X Write(tabel,num_of_attr);
X
X For j:=1 to num_of_attr
X Do Write(tabel,attr_rij[depth,j]);
X
XEnd;
X
X
X
XProcedure Make_tabelentry_tabset;
XVar
X b : Byte;
X j : Integer;
X
XBegin
X b := ord('S');
X Write(tabel,b);
X
X b:=num_of_tabs;
X Write(tabel,b);
X
X For j:=1 to num_of_tabs
X Do Wr_word(tabel,tabpos[j]);
XEnd;
X
X
XProcedure Make_tabelentry_rightjustification;
XVar
X b : Byte;
X
XBegin
X b := Ord('U');
X Write(tabel,b);
X
X If by=$81
X Then b:=01 { regels WEL uitvullen }
X Else b:=00; { regels NIET uitvullen }
X Write(tabel,b);
XEnd;
X
X
X
X
XProcedure Make_tabelentry_envir_extra_end;
XVar
X b : Byte;
X
XBegin
X
X Case envir of
X 'C' : Begin
X b:=ord('C');
X Write(tabel,b);
X End;
X
X 'T' : Begin
X b:=ord('T');
X Write(tabel,b);
X End;
X
X 'I' : Begin
X b:=ord('I');
X Write(tabel,b);
X Wr_word(tabel,ind_leftmargin);
X Wr_word(tabel,ind_rightmargin);
X
X If ind_text2
X Then Begin
X b:=01;
X Write(tabel,b)
X End
X Else Begin
X b:=00;
X Write(tabel,b)
X End;
X
X End;
X
X End; {Case}
X
X b := Ord(line_term);
X write(tabel,b);
X
X b:=$FF;
X Write(tabel,b);
X
XEnd;
X
X
XProcedure Reset_attr_rij(d : Integer);
XVar
X j : Integer;
X
XBegin
X For j:=0 to 16
X Do attr_rij[d,j]:=$00;
X leegptr[d]:=1;
X openptr[d]:=0;
XEnd;
X
X
X
XProcedure Open_all_attr;
X{ -- Open alle commando's door de Attributen-rij af te lopen -- }
X
XVar j:Integer;
XBegin
X For j:=(openptr[depth]+1) to (leegptr[depth]-1)
X Do Begin
X Write(strip,Open_com[attr_rij[depth,j]]);
X openptr[depth]:=openptr[depth]+1;
X End;
X
X open_attr_rij[depth]:=False { Alle attributen staan weer goed }
XEnd;
X
X
X
XProcedure Close_all_attr;
X{ -- Sluit alle commando's door de Attributen-rij af te lopen -- }
XVar j:Integer;
XBegin
X For j:=openptr[depth] Downto 1
X Do Begin
X Write(strip,Close_com[attr_rij[depth,j]]);
X openptr[depth]:=openptr[depth]-1;
X End;
X open_attr_rij[depth] := True;
XEnd;
X
X
X
XProcedure Attr_ON;
X{ Deze procedure plaatst een attribuut (lettertype) in de attribuut-rij }
X
XVar
X b : Byte;
X
XBegin
X Read(wpd,b); { lees attribuut-code }
X
X attr_rij[depth,leegptr[depth]]:=b; { attribuut in attr-rij }
X leegptr[depth]:=leegptr[depth]+1; { plaats 1 verder. }
X open_attr_rij[depth]:=True; { openstaande attr-rij }
X
X Read(wpd,b); { lees voorbij afsluitcode }
XEnd;
X
X
X
XProcedure Attr_OFF;
X{ Deze procedure haalt een uit een attribuut (lettertype) uit de }
X{ attribuut-rij door middel van een stack principe omdat binnen }
X{ LaTeX de later geopende kommando's eerst afgesloten te worden }
X
XVar
X b : Byte;
X found : Boolean;
X j,
X codeptr : Integer;
X
XBegin
X Read(wpd,b); { lees attribuut-code }
X
X j:=leegptr[depth]; { zoek vanaf top attr-rij }
X found:=False; { nog niet gevonden }
X
X While (j>1) and (Not found) { zoek attr-code in attr-rij }
X Do Begin
X j:=j-1;
X found:=(attr_rij[depth,j]=b)
X End;
X
X If j<=0 Then RunError($0100); { Moet nooit kunnen voorkomen }
X codeptr:=j; { plaats van attr-code in rij }
X
X{ Sluit alle commando's t/m de desbetreffende code als deze nog niet }
X{ gesloten zijn. }
X
X If codeptr<=openptr[depth]
X Then Begin
X For j:=openptr[depth] downto codeptr
X Do Begin
X Write(strip,Close_com[attr_rij[depth,j]]);
X openptr[depth]:=openptr[depth]-1;
X End;
X End;
X
X{ Haal de desbetreffende attribuut uit de rij en werk pointers bij }
X
X For j:=codeptr to (leegptr[depth]-1)
X Do attr_rij[depth,j]:=attr_rij[depth,j+1];
X leegptr[depth]:=leegptr[depth]-1;
X
X open_attr_rij[depth]:=True; { openstaande attr-rij }
X
X Read(wpd,b); { lees voorbij afsluitcode }
XEnd;
X
X
X
XProcedure Center;
X{ Deze procedure zorgt voor center environment zolang er nog geen }
X{ andere environment is begonnen. }
X
XBegin
X If envir=' '
X Then envir:='C'; { environment = center }
X
X Jump_in_file(wpd,7); { rest van code overslaan }
XEnd;
X
X
X
XProcedure End_Align;
XBegin
X If align_tab
X Then Begin
X Close_all_attr;
X Write(strip,'\''');
X align_tab := False;
X Open_all_attr;
X End;
X
X If right_tab
X Then Begin
X Close_all_attr;
X Write(strip,'\''');
X right_tab := False;
X Open_all_attr;
X End;
X
X If center_tab
X Then Begin
X Close_all_attr;
X Write(strip,'}');
X center_tab := False;
X Open_all_attr;
X End;
XEnd;
X
X
X
XProcedure Tab;
XVar
X j : integer;
X wpu : word;
X tabnum,
X new_tabs : Integer;
X
XBegin
X If (envir<>'I') and Not Nomore_valid_tabs { Noggeen indent --> normaal tab }
X Then Begin
X If by=$48
X Then right_tab := True;
X
X If by=$40
X Then align_tab := True;
X
X If by=$C8
X Then center_tab := True;
X
X Jump_in_file(wpd,2);
X
X Rd_word(wpd,wpu); { Lees abs.-indent [wpu] }
X wpu := wpu - WP_sidemargin; { Correctie ivm WP kantlijn }
X
X tabnum:=0;
X For j:=1 to num_of_tabs { Bepaal welke tabpos }
X Do If wpu>=tabpos[j]
X Then tabnum:=j;
X
X new_tabs := tabnum - latex_tabpos;
X
X If new_tabs>0
X Then Begin
X Close_all_attr;
X
X For j:=1 to new_tabs
X Do Write(strip,'\>');
X
X If center_tab
X Then Write(strip,'\ctab{');
X
X Open_all_attr;
X End;
X
X latex_tabpos:=tabnum;
X
X Jump_in_file(wpd,3);
X
X envir:='T'; { Er zit een tab in deze regel }
X End
X
X Else Jump_in_file(wpd,7);
X
XEnd;
X
X
X
XProcedure Flush_right_tab;
XBegin
X If envir<>'I'
X Then Begin
X Close_all_attr;
X Write(strip,'\`');
X Open_all_attr;
X
X Nomore_valid_tabs := True;
X
X envir:='T';
X End;
X
X Jump_in_file(wpd,7);
XEnd;
X
X
X
XProcedure Indent;
XVar
X dif,
X abs : Word;
X b : Byte;
X
XBegin
X If envir<>'T'
X Then Begin {Al een tabcommando gezet dus er mag geen insp }
X Envir:='I';
X indenting:=True;
X
X If Not ind_text2
X Then Begin
X Read(wpd,b);
X b:=b And $01;
X
X Rd_word(wpd,dif);
X Rd_word(wpd,abs); { Eigenlijk Old current column }
X Rd_word(wpd,abs);
X
X ind_leftmargin:=abs-WP_sidemargin;
X
X If b=1
X Then ind_rightmargin:=ind_rightmargin+dif;
X {Margins bepaald lees voorby rest van functie-codes }
X Jump_in_file(wpd,3);
X
X If Not ind_text1
X Then Begin
X If char_on_line
X Then Begin
X Write(strip,'}');
X ind_text1:=True;
X End;
X End;
X End
X Else Jump_in_file(wpd,10);
X End
X Else Jump_in_file(wpd,10);
XEnd;
X
X
XProcedure End_of_indent;
XBegin
X indent_end := True;
X Jump_in_file(wpd,5);
XEnd;
X
X
X
XProcedure Tabset;
XVar
X j : Integer;
X w : Word;
X b : Byte;
X
XBegin
X Jump_in_file(wpd,102); { Ga naar TAB-info }
X
X num_of_tabs:=0;
X
X For j:=1 to 40
X Do Begin
X Rd_word(wpd,w);
X If (w>WP_sidemargin) and (w<>$FFFF)
X Then Begin
X num_of_tabs:=num_of_tabs+1;
X tabpos[num_of_tabs] := w - WP_sidemargin;
X End;
X End;
X
X Jump_in_file(wpd,24);
X
X Make_tabelentry_tabset;
XEnd;
X
X
X
XProcedure Page_number_position;
XVar
X position_code : Byte;
X
XBegin
X Jump_in_file(wpd,5); {Skip length of code; always 10}
X { + old information }
X Read(wpd,position_code);
X
X Write(strip,'\pagenumpos');
X Case position_code of
X $01 : Write(strip,'{\pntl}');
X $02 : Write(strip,'{\pntc}');
X $03 : Write(strip,'{\pntr}');
X $05 : Write(strip,'{\pnbl}');
X $06 : Write(strip,'{\pnbc}');
X $07 : Write(strip,'{\pnbr}');
X Else Write(strip,'{\pnno}');
X End;
X
X Jump_in_file(wpd,6);
XEnd;
X
X
X
XProcedure Character;
XVar
X ch : String;
X
X j : Integer;
X chr_code,
X chr_set,
X b : Byte;
X found : Boolean;
X
X
XBegin
X If open_attr_rij[depth]
X Then Open_all_attr;
X
X Case by of
X $20..$7F : { Normal_char }
X Begin
X ch := lat[by];
X End;
X
X $A9 : { Special_char }
X Begin
X If by=$A9
X Then ch:='-'
X Else ch:='\ ';
X End;
X
X $C0 : { Extended_char }
X Begin
X j:=127;
X found:=false;
X
X Read(wpd,chr_code);
X Read(wpd,chr_set);
X
X While (j<254) and not found
X Do Begin
X j:=j+1;
X If (chr_code=char_code[j]) and (chr_set=char_set[j])
X Then found:=True;
X End;
X
X If found
X Then ch:=ext_lat[j]
X Else ch:='\ ';
X
X Read(wpd,b);
X End;
X
X End;
X
X Write(strip,ch);
X
XEnd;
X
X
X
XProcedure Return_Page;
XVar
X j :Integer;
X ond : Boolean;
X
XBegin
X
X Case by of
X $0A,$8C : line_term := 'R'; { Hard return }
X $0D : line_term := 'r'; { Soft return }
X $0C : line_term := 'P'; { Hard page }
X $0B : line_term := 'p'; { Soft page }
X End;
X
X Writeln(strip);
X
X Make_Tabelentry_envir_extra_end;
X
X If indent_end
X Then Begin
X envir:=' ';
X indenting:=False;
X ind_text1:=False;
X ind_text2:=False;
X ind_leftmargin:=0;
X ind_rightmargin:=0;
X
X indent_end:=False;
X End
X
X Else If envir<>'I'
X Then envir:=' ';
X
X char_on_line:=False;
X nomore_valid_tabs := False;
X
X regelnum:=regelnum+1;
X
X Make_tabelentry_attr;
X
X latex_tabpos:=0;
XEnd;
X
X
XProcedure Nop80;
XBegin
X { Om dat het een 1-byte funktie is hoeft er niks overgeslagen }
X { te worden. }
XEnd;
X
X
X
XProcedure NopC0;
XBegin
X If by=$C0 Then Jump_in_file(wpd,3);
X If by=$C1 Then Jump_in_file(wpd,8);
X If by=$C2 Then Jump_in_file(wpd,10);
X If by=$C3 Then Jump_in_file(wpd,2);
X If by=$C4 Then Jump_in_file(wpd,2);
X If by=$C5 Then Jump_in_file(wpd,4);
X If by=$C6 Then Jump_in_file(wpd,5);
X If by=$C7 Then Jump_in_file(wpd,6);
XEnd;
X
X
X
XProcedure NopD0(already_read_subfunc_code : Boolean);
XVar
X b : Byte;
X w : Word;
X
XBegin
X If Not already_read_subfunc_code
X Then Read(wpd,b); { Lees subfunctioncode }
X
X Rd_word(wpd,w); { Lees lengte 'die nog volgt ' }
X Seek(wpd,filepos(wpd)+w);
XEnd;
X
X
X
XProcedure Overstrike;
X
XVar
X first_char_os : Boolean;
X
X char_width_os,
X len_of_code : Word;
X end_of_code : LongInt;
X
XBegin
X Rd_word(wpd,len_of_code); { Lees lengte }
X end_of_code := filepos(wpd) + len_of_code - 4;
X
X Rd_word(wpd,char_width_os);
X
X first_char_os := True;
X
X While FilePos(wpd) < end_of_code
X Do Begin
X Read(wpd,by);
X
X Case by of
X $20..$7F,
X $A9,$C0 : If first_char_os
X Then Begin
X Character;
X first_char_os := False;
X End
X Else Begin
X Write(strip,'\llap{');
X Character;
X Write(strip,'}');
X End;
X
X $00..$BF : Nop80;
X $C0..$CF : NopC0;
X $D0..$FE : NopD0(False);
X End;
X
X End;
X
X Jump_in_file(wpd,4);
X
XEnd;
X
X
X
XProcedure Footnote;
XVar
X flags,
X num_of_pages : Byte;
X
X fn_num,
X len_of_code : Word;
X end_of_code : LongInt;
X
XBegin
X Rd_word(wpd,len_of_code); { Lees lengte }
X end_of_code := filepos(wpd) + len_of_code - 4;
X
X Read(wpd,flags);
X
X Rd_word(wpd,fn_num);
X
X{ Skip all the shit }
X
X Read(wpd,num_of_pages);
X Jump_in_file(wpd,2*(num_of_pages+1)+9);
X
X Close_all_attr;
X
X depth := 1;
X Reset_attr_rij(depth);
X
X Write(strip,'\footnote[',fn_num:1,']{');
X
X While FilePos(wpd) < end_of_code
X Do Begin
X Read(wpd,by);
X
X Case by of
X $20..$7F,
X $A9,$C0 : Character;
X
X $0A,$0C : Write(strip,'\\ ');
X
X $0B,$0D : Write(strip,' ');
X
X $C3 : Attr_ON;
X
X $C4 : Attr_OFF;
X
X $00..$BF : Nop80;
X $C0..$CF : NopC0;
X $D0..$FE : NopD0(False);
X End;
X
X End;
X
X Close_all_attr; { Echt nodig ? }
X Write(strip,'}');
X
X Jump_in_file(wpd,4);
X
X depth := 0;
X Open_all_attr;
X
XEnd;
X
X
X
XProcedure Header_Footer;
XVar
X subfunc,
X occurance : Byte;
X len_of_code : Word;
X end_of_code : LongInt;
X
X hf_left,
X hf_center,
X hf_right : Boolean;
X
X j : Integer;
X
XBegin
X Read(wpd,subfunc);
X Rd_word(wpd,len_of_code);
X
X If len_of_code > 22
X Then Begin
X end_of_code := FilePos(wpd) + len_of_code - 4;
X
X Jump_in_file(wpd,7);
X
X Read(wpd,occurance);
X
X Jump_in_file(wpd,10);
X
X Close_all_attr;
X depth := 1;
X
X{ Geen schone attr._lei; Kopieer attributen uit Niveau 0; Fout in WP 5.0 ? }
X
X For j:=0 to 15
X Do attr_rij[1,j] := attr_rij[0,j];
X
X leegptr[1]:=leegptr[0];
X openptr[1]:=openptr[0];
X
X Case subfunc of
X 00,01 : Write(strip,'\headtext');
X 02,03 : Write(strip,'\foottext');
X End;
X
X Case occurance of
X 00 : Write(strip,'{\neverpages}{');
X 01 : Write(strip,'{\allpages}{');
X 02 : Write(strip,'{\oddpages}{');
X 03 : Write(strip,'{\evenpages}{');
X End;
X
X Open_all_attr;
X hf_left := True; { Beginnen met de linkerkant }
X hf_center := False;
X hf_right := False;
X
X While FilePos(wpd) < end_of_code
X Do Begin
X Read(wpd,by);
X
X Case by of
X $20..$7F,
X $A9,$C0 : Character;
X
X
X $C1 : Begin
X Read(wpd,by);
X by := by and $E0;
X Jump_in_file(wpd,7);
X
X If by=$E0
X Then Begin
X If hf_left
X Then Begin
X Close_all_attr;
X Write(strip,'}{');
X Open_all_attr;
X
X hf_left := False;
X hf_center := True;
X End;
X End;
X
X If by=$60
X Then Begin
X If hf_left
X Then Begin
X Close_all_attr;
X Write(strip,'}{}{');
X Open_all_attr;
X
X hf_left := False;
X hf_right := True;
X End;
X
X If hf_center
X Then Begin
X Close_all_attr;
X Write(strip,'}{');
X Open_all_attr;
X
X hf_center := False;
X hf_right := True;
X End;
X End;
X End;
X
X $C3 : Attr_ON;
X
X $C4 : Attr_OFF;
X
X $00..$BF : Nop80;
X $C0..$CF : NopC0;
X $D0..$FE : NopD0(False);
X
X End;
X End;
X
X Close_all_attr; { Echt nodig ? }
X
X Jump_in_file(wpd,4);
X
X If hf_left Then Write(strip,'}{}{}');
X If hf_center Then Write(strip,'}{}');
X If hf_right Then Write(strip,'}');
X
X depth := 0;
X Open_all_attr;
X
X End
X
X Else Jump_in_file(wpd,len_of_code);
X
XEnd;
X
X
XBegin
X Table_Init;
X Ext_chr_init;
X
X Reset_attr_rij(0);
X Reset_attr_rij(1);
X depth := 0;
X
X WP_default;
X
X latex_tabpos:=0;
X right_tab := False;
X align_tab := False;
X center_tab := False;
X
X indenting:=False;
X indent_end:=False;
X ind_text1:=False;
X ind_text2:=False;
X ind_leftmargin:=0;
X ind_rightmargin:=0;
X
X envir:=' ';
X
X nomore_valid_tabs := False;
X
X Writeln('First strike :');
X Write('Converting-percentage : ');
X
X srtdocpos:=filepos(wpd);
X fsize:=FileSize(wpd);
X
X regelnum := 0;
X
X Make_tabelentry_attr; { attribuut instelling }
X
X Make_tabelentry_tabset; { Geef de defaulttabinstelling door }
X { aan de 2e slag }
X
X
X
X While (FilePos(wpd)<fsize)
X Do Begin
X convperc:=round((FilePos(wpd)-srtdocpos)/(fsize-srtdocpos)*100);
X Write(chr(8),chr(8),chr(8),chr(8),convperc:3,'%');
X
X Read(wpd,by);
X
X Case by of
X $20..$7F,
X $A9,$C0 : Begin
X char_on_line:=True; {Er (al) is een karakter op deze regel }
X If indenting {Als er is ingeprongen er na een stuk }
X Then If ind_text1 {tekst is weer ingesprongen (ind_text1) }
X Then ind_text2:=True; {dan hoort dit char bij het ind_txt-blok }
X
X Character;
X End;
X
X $0A,$0D,
X $0B,$0C,
X $8C : Return_Page;
X
X $C1 : Begin
X Read(wpd,by);
X by:=by and $E8;
X
X Case by of
X $00,$C8,
X $48,$40 : Tab;
X $60 : Flush_right_tab;
X $E0 : Center;
X Else Jump_in_file(wpd,7);
X End;
X End;
X $81,$82 : Make_tabelentry_rightjustification;
X $83 : End_Align;
X $C3 : Attr_ON;
X $C4 : Attr_OFF;
X $C2 : Indent;
X $C6 : End_of_indent;
X $C5,$C7 : NopC0;
X
X $D0 : Begin
X Read(wpd,by);
X Case by of
X $04 : Tabset;
X $08 : Page_number_position;
X Else NopD0(True);
X End;
X End;
X
X $D5 : Header_Footer;
X
X $D6 : Begin
X Read(wpd,by);
X Case by of
X $00 : Footnote;
X Else NopD0(True);
X End;
X End;
X
X $D8 : Begin
X Read(wpd,by);
X Case by of
X $02 : Overstrike;
X Else NopD0(True);
X End;
X End;
X
X $00..$1F,
X $80..$BF : Nop80;
X
X $D0..$FF : NopD0(False);
X
X End;
X End;
X
X Writeln;
X Make_tabelentry_envir_extra_end;
X
X num_of_lines_stripfile := regelnum;
X
XEnd;
X
X
X{---SLAG2---}
X
XProcedure Convert_second_strike;
XVar
X regelnum : Word;
X convperc : Integer;
X
X underline,
X illegal_argument,
X just_envir_closed : Boolean;
X
X i : Integer;
X
X regel,
X hulp_regel : String;
X len_reg : Integer;
X
X num_of_tabs : Integer;
X tabpos : Array [1..40] of Word;
X
X tabent_num_of_tabs : Array [0..2] of Integer;
X tabent_tabpos : Array [0..2,1..40] of Word;
X
X ind_leftmargin,
X ind_rightmargin : Array [0..2] of Word;
X ind_label : Array [0..2] of Byte;
X
X pre,
X cur,
X next : Integer;
X
X envir,
X line_term : Array [0..2] of Char;
X new_tabset : Array [0..2] of Boolean;
X
X rightjust,
X new_rightjust : Boolean;
X new_tabent_rightjust,
X tabent_rightjust : Array [0..2] of Boolean;
X
X num_of_attr : Array[0..2] of Integer;
X attr_BOL : Array[0..2,$00..$10] of Byte;
X attr_closed : Boolean;
X
X
X
XProcedure Read_tabelentry(n:Integer);
XVar
X w : Word;
X b : Byte;
X j : Integer;
X
XBegin
X { Begin met een schone lei die dan door deze procedure verder wordt }
X { opgevuld. }
X
X envir[n]:=' ';
X new_tabset[n]:=False;
X new_tabent_rightjust[n]:=False;
X
X num_of_attr[n] := 0;
X For j:=1 to 16
X Do attr_BOL[n,j]:=0;
X
X If filepos(tabel)<filesize(tabel)
X Then Begin
X
X Read(tabel,b);
X num_of_attr[n] := b;
X For j:=1 to num_of_attr[n]
X Do Read(tabel,Attr_BOL[n,j]);
X
X b:=$00;
X While b<>$FF
X Do Begin
X Read(tabel,b);
X
X Case chr(b) Of
X 'C' : envir[n]:='C';
X 'T' : envir[n]:='T';
X 'I' : Begin
X envir[n]:='I';
X Rd_word(tabel,ind_leftmargin[n]);
X Rd_word(tabel,ind_rightmargin[n]);
X Read(tabel,ind_label[n]);
X End;
X
X 'S' : Begin
X new_tabset[n]:=True;
X Read(tabel,b);
X tabent_num_of_tabs[n]:=b;
X
X For j:=1 to tabent_num_of_tabs[n]
X Do Begin
X Rd_word(tabel,w);
X tabent_tabpos[n,j]:=w;
X End;
X End;
X
X 'U' : Begin
X new_tabent_rightjust[n]:=True;
X Read(tabel,b);
X If b=0
X Then tabent_rightjust[n]:=False
X Else tabent_rightjust[n]:=True;
X End;
X
X 'R','r','P','p' : line_term[n]:=chr(b);
X
X End {Case};
X End;
X End
X
X{ Er is geen volgende tabelentry dus ook geen volgende regel }
X{ De tabelentry is 'schoon'. }
X{ Zodat het document 'schoon' wordt afgesloten. }
X
XEnd;
X
X
X
XProcedure Open_all_attr_BOL;
X{ -- Open alle commando's door de Attributen-rij af te lopen -- }
XVar
X j:Integer;
XBegin
X For j:=$01 to num_of_attr[cur]
X Do Write(latex,Open_com[attr_BOL[cur,j]]);
X
X attr_closed := False;
XEnd;
X
X
XProcedure Close_all_attr_BOL;
X{ -- Sluit alle commando's door de Attributen-rij af te lopen -- }
XVar
X j:Integer;
XBegin
X For j:=num_of_attr[cur] Downto $01
X Do Write(latex,Close_com[Attr_BOL[cur,j]]);
X
X attr_closed := True;
XEnd;
X
X
X
XProcedure Open_all_attr_EOL;
X{ -- Open alle commando's door de Attributen-rij af te lopen -- }
XVar j:Integer;
XBegin
X For j:=$01 to num_of_attr[next]
X Do Write(latex,Open_com[Attr_BOL[next,j]]);
X
X attr_closed := False;
XEnd;
X
X
X
XProcedure Close_all_attr_EOL;
X{ -- Sluit alle commando's door de Attributen-rij af te lopen -- }
XVar j:Integer;
XBegin
X For j:=num_of_attr[next] Downto $01
X Do Write(latex,Close_com[Attr_BOL[next,j]]);
X
X attr_closed := True;
XEnd;
X
X
X
XProcedure Latex_head;
X{ -- Maak het de standard-heading voor een latex-file aan -- }
XBegin
X Writeln(latex,'\documentstyle[11pt,wp2latex]{report}');
X Writeln(latex,'\begin{document}')
XEnd;
X
X
X
XProcedure Latex_foot;
X{ -- Sluit de latex-file op de juiste wijze af -- }
XBegin
X Writeln(latex,'\end{document}')
XEnd;
X
X
X
XProcedure Latex_tabset;
XVar
X atpr,j : Integer;
X l,ol : Real;
X
XBegin
X atpr:=0; { Huiding aantal tabs per regel }
X ol:=0;
X For j:=1 to num_of_tabs
X Do Begin
X l:=tabpos[j]/1200 * 2.54;
X Write(latex,'\hspace{', l-ol :3:2,'cm}\=');
X atpr:=atpr+1;
X If atpr>=4
X Then Begin
X Writeln(latex,'%');
X atpr:=0;
X End;
X ol:=l;
X End;
X Writeln(latex,'\kill');
XEnd;
X
X
X
XFunction Change_envir_BOL : Boolean;
XVar
X hulp : Boolean;
X
XBegin
X hulp := False;
X
X hulp := ((envir[cur]='C') And Not (envir[pre]='C')) Or hulp;
X hulp := ((envir[cur]='T') And Not (envir[pre]='T')) Or hulp;
X hulp := ((envir[cur]='I') And Not (envir[pre]='I')) Or hulp;
X
X change_envir_BOL := hulp;
XEnd;
X
X
X
XFunction Change_envir_EOL : Boolean;
XVar
X hulp : Boolean;
X
XBegin
X hulp := False;
X
X hulp := ((envir[next]='C') Xor (envir[cur]='C')) Or hulp;
X hulp := ((envir[next]='T') Xor (envir[cur]='T')) Or hulp;
X hulp := ((envir[next]='I') Xor (envir[cur]='I')) Or hulp;
X
X change_envir_EOL := hulp;
XEnd;
X
X
X
X
XProcedure Open_environment;
X
XBegin
X If change_envir_BOL { andere environment ? }
X Then Begin
X If Not attr_closed
X Then Close_all_attr_BOL;
X
X Case envir[cur] of
X 'C' : Begin
X Writeln(latex,'\begin{center}');
X End;
X
X 'T' : Begin
X Writeln(latex,'\begin{tabbing}');
X Latex_tabset;
X End;
X
X 'I' : Begin
X Write(latex,'\begin{indenting}');
X Write(latex,'{',ind_leftmargin[cur]/1200*2.54:3:2,'cm}');
X Write(latex,'{',ind_rightmargin[cur]/1200*2.54:3:2,'cm}');
X If ind_label[cur]=1
X Then Begin
X Writeln(latex,'%');
X Write(latex,'{');
X End
X Else Writeln(latex,'{}');
X End
X End;
X
X End
X
X Else If new_tabset[cur] and (envir[cur]='T')
X Then Latex_tabset;
X
XEnd;
X
X
X
XProcedure Close_environment;
X
XBegin
X
X Case envir[cur] of
X 'C' : Begin
X Writeln(latex,'\end{center}');
X End;
X
X 'T' : Begin
X Writeln(latex,'\end{tabbing}');
X End;
X
X 'I' : Begin
X Writeln(latex,'\end{indenting}');
X End;
X End;
X
X just_envir_closed := True;
X
XEnd;
X
X
X
XProcedure Update_global_information;
XVar
X j : Integer;
X
XBegin
X If new_tabset[cur]
X Then Begin
X num_of_tabs:=tabent_num_of_tabs[cur];
X For j:=1 to num_of_tabs
X Do tabpos[j]:=tabent_tabpos[cur,j]
X End;
X
X If new_tabent_rightjust[cur]
X Then new_rightjust := tabent_rightjust[cur];
X
XEnd;
X
X
XProcedure Change_tabelentry;
XVar
X help : Integer;
X
XBegin
X help:=pre;
X pre:=cur;
X cur:=next;
X next:=help;
X Read_tabelentry(next);
XEnd;
X
X
XBegin
X pre:=0;
X cur:=1;
X next:=2;
X
X envir[pre]:=' ';
X new_tabset[pre]:=False;
X
X just_envir_closed:=True;
X attr_closed := False;
X
X rightjust:=True;
X new_rightjust:=True;
X For i:=0 to 2
X Do Begin
X new_tabent_rightjust[i]:=False;
X tabent_rightjust[i]:=False;
X End;
X
X Read_tabelentry(cur);
X Read_tabelentry(next);
X
X regelnum:=1;
X
X Writeln;
X Writeln('Second strike :');
X Write('Converting-percentage : ');
X
X
X
X Latex_head;
X
X While (Not Eof(strip)) and (not keypressed)
X Do Begin
X Update_global_information;
X
X convperc := round(100*regelnum/num_of_lines_stripfile);
X if convperc>100 then convperc:=100;
X Write(chr(8),chr(8),chr(8),chr(8),convperc:3,'%');
X
X Readln(strip,regel);
X
X{ Werk eventueel de regel bij d.m.v. een hulp regel. }
X
X hulp_regel := regel;
X len_reg := length(hulp_regel);
X
X{ Meerdere spaties achter elkaar vervangen door harde spaties. }
X
X For i:=1 to len_reg-1
X Do If (regel[i]=' ') and (regel[i+1]=' ')
X Then hulp_regel[i+1]:='~';
X
X{ Zoek naar een illegaal argument en zet hier accolades voor. }
X
X If ((len_reg>=1) and (hulp_regel[1]='[')) or
X ((len_reg>=2) and (hulp_regel[1]=' ') and (hulp_regel[2]='['))
X Then hulp_regel:='{}' + hulp_regel;
X
X{ De regel is verwerkt. }
X
X regel := hulp_regel;
X len_reg := length(regel);
X
X If new_rightjust xor rightjust
X Then Begin
X rightjust := new_rightjust;
X If rightjust
X Then Writeln(latex,'\justified')
X Else Writeln(latex,'\raggedright');
X End;
X
X Open_environment;
X
X If len_reg>0
X Then Begin
X If attr_closed
X Then Open_all_attr_BOL;
X
X Write(latex,regel);
X
X just_envir_closed := False;
X End;
X
X Case line_term[cur] of
X
X 'r','p' : Begin
X Writeln(latex);
X If Change_envir_EOL
X Then Begin
X If Not attr_closed
X Then Close_all_attr_EOL;
X
X Close_environment;
X End;
X End;
X
X 'R' : Begin
X
X If envir[cur]='I'
X Then Begin
X If Not attr_closed
X Then Close_all_attr_EOL;
X
X Writeln(latex);
X Close_environment;
X envir[cur]:=' ';
X End
X
X Else Begin
X underline:=False;
X For i:=$01 to $10
X Do underline := underline
X Or (Attr_Bol[next,i]=$B)
X Or (Attr_bol[next,i]=$E);
X
X If underline and Not attr_closed
X Then Close_all_attr_EOL;
X
X { Elke Indent-environment moet na een harde Return}
X { Afgesloten worden.}
X
X
X If Change_envir_EOL
X Then Begin
X If just_envir_closed
X Then Writeln(latex,'\nwln')
X Else Writeln(latex);
X
X If Not attr_closed
X Then Close_all_attr_EOL;
X
X Close_environment;
X End
X Else Begin
X If just_envir_closed
X Then Writeln(latex,'\nwln')
X Else Writeln(latex,'\\');
X End;
X End;
X End;
X
X 'P' : Begin
X If Not attr_closed
X Then Close_all_attr_EOL;
X
X Writeln(latex);
X Close_environment;
X Writeln(latex,'\newpage');
X envir[cur]:=' ';
X End;
X
X End {Case};
X
X
X
X Change_tabelentry;
X
X regelnum:=regelnum+1;
X End;
X
X Latex_foot;
X Writeln;
XEnd;
X
X
X{---HOOFDPROG---}
X
X
XBegin
X Exitsave:=Exitproc; { Bewaar de orginele exit-pointer }
X Exitproc:=@Einde_prog; { Spring bij Exit naar Proc. Einde_prog }
X
X Init_commando;
X
X ClrScr;
X Writeln;
X Writeln(' Conversionprogram : From Wordperfect 5.0 to LaTeX (WP2latEX)');
X Writeln;
X Writeln(' (c) TUE-Eindhoven ---- Made by R.C.Houtepen ---- Date : 24 Jan 1990');
X
X Filenames;
X
X Reset(wpd);
X Wpd_check;
X
X Rewrite(strip);
X Rewrite(tabel);
X
X Writeln('Converting ...');
X Writeln;
X
X Convert_first_strike;
X
X Close(wpd);
X Close(strip);
X Close(tabel);
X
X Reset(strip);
X Reset(tabel);
X Rewrite(latex);
X
X Convert_second_strike;
X
X Close(strip);
X Close(tabel);
X Close(latex);
X
X Erase(strip);
X Erase(tabel);
X
XEnd.
SHAR_EOF
if test 49507 -ne "`wc -c < 'wp2latex.pas'`"
then
echo shar: "error transmitting 'wp2latex.pas'" '(should have been 49507 characters)'
fi
fi
exit 0
# End of shell archive
--
Glenn Geers | "So when it's over, we're back to people.
Department of Theoretical Physics | Just to prove that human touch can have
The University of Sydney | no equal."
Sydney NSW 2006 Australia | - Basia Trzetrzelewska, 'Prime Time TV'
More information about the Alt.sources
mailing list