%%%  WEB Change File for VFtoVP (Win32 version)
%%%  Time-stamp: "97/01/03 18:02:28 mik"
%%%
%%%  Copyright (C) 1991, 92, 93, 94, 95, 96, 97
%%%	Christian Schenk  <cschenk@berlin.snafu.de>
%%%
%%%  This file is part of MiKTeX.
%%%
%%%  MiKTeX is free software; you can redistribute it and/or
%%%  modify it under the terms of the GNU General Public License as
%%%  published by the Free Software Foundation; either version 2, or (at
%%%  your option) any later version.
%%%  
%%%  MiKTeX is distributed in the hope that it will be useful, but
%%%  WITHOUT ANY WARRANTY; without even the implied warranty of
%%%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%%%  General Public License for more details.
%%%  
%%%  You should have received a copy of the GNU General Public License
%%%  along with MiKTeX; if not, write to the Free Software
%%%  Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
%%%  USA.

@x
\def\title{VF\lowercase{to}VP}
@y
\def\MiKTeX{MiK\TeX}
\def\title{VF\lowercase{to}VP for Win32 (\MiKTeX\ 1.06)}
@z

%% **     2  ******************************************************************

@x
procedure initialize; {this procedure gets things started properly}
  var @!k:integer; {all-purpose index for initialization}
  begin print_ln(banner);@/
@y
@<External C routines@>@/
procedure initialize; {this procedure gets things started properly}
  var @!k:integer; {all-purpose index for initialization}
  begin print(banner); miktex_banner(output); write_ln;@/
@z

%% **    11  ******************************************************************

@x
@<Set init...@>=
reset(tfm_file); reset(vf_file);
@y
@<Set init...@>=
if (c4pargc <> 4) then begin
 print_ln('Usage: vftovp inputfile tfmfile outputfile'); c4p_exit(1);
end;
c4p_fopen(vf_file,c4p_argv[1],c4p_rb_mode,true);
c4p_fopen(tfm_file,c4p_argv[2],c4p_rb_mode,true);
reset(tfm_file); reset(vf_file);
@z

%% **    21  ******************************************************************

@x
@ @<Set init...@>=
rewrite(vpl_file);
@y
@ @<Set init...@>=
if (c4pargc <> 4) then begin
 print_ln('Usage: vftovp inputfile tfmfile outputfile'); c4p_exit(1);
end;
c4p_fopen(vpl_file,c4p_argv[3],c4p_w_mode,true);
rewrite(vpl_file);
@z

%% **    24  ******************************************************************

@x
@d abort(#)==begin print_ln(#);
  print_ln('Sorry, but I can''t go on; are you sure this is a TFM?');
  goto final_end;
@y
@d abort(#)==begin print_ln(#);
  print_ln('Sorry, but I can''t go on; are you sure this is a TFM?');
  c4p_exit(1);
@z

@x
@d vf_abort(#)==
  begin print_ln(#);
  print_ln('Sorry, but I can''t go on; are you sure this is a VF?');
  goto final_end;
  end
@y
@d vf_abort(#)==
  begin print_ln(#);
  print_ln('Sorry, but I can''t go on; are you sure this is a VF?');
  c4p_exit(1);
  end
@z

%% **    36  ******************************************************************

@x
@<Print the name...@>=
print('MAPFONT ',font_ptr:1,': ');
for k:=font_start[font_ptr]+14 to vf_ptr-1 do print(xchr[vf[k]]);
k:=font_start[font_ptr]+5;
print_ln(' at ',(((vf[k]*256+vf[k+1])*256+vf[k+2])/@'4000000)*real_dsize:2:2,
  'pt')
@y
@<Print the name...@>=
print('MAPFONT ',font_ptr:1,': ');
for k:=font_start[font_ptr]+14 to vf_ptr-1 do print(xchr[vf[k]]);
k:=font_start[font_ptr]+5;
print_ln(' at ',(((vf[k]*256+vf[k+1])*256+vf[k+2])/@'4000000)*real_dsize:2:2,
  'pt')
@z

%% **    39  ******************************************************************

@x
reset(tfm_file,cur_name);
@y
c4p_fopen (tfm_file,cur_name,c4p_rb_mode,true); reset(tfm_file);
@z

%% **    42  ******************************************************************

@x
@d default_directory_name=='TeXfonts:' {change this to the correct name}
@d default_directory_name_length=9 {change this to the correct length}

@<Glob...@>=
@!default_directory:packed array[1..default_directory_name_length] of char;

@ @<Set init...@>=
default_directory:=default_directory_name;
@y
@d default_directory_name=='./' {change this to the correct name}
@d default_directory_name_length=2 {change this to the correct length}

@<Glob...@>=
@!default_directory:packed array[1..default_directory_name_length] of char;

@ @<Set init...@>=
c4p_arrcpy(default_directory,default_directory_name);
@z

%% **    44  ******************************************************************

@x
@ The string |cur_name| is supposed to be set to the external name of the
\.{TFM} file for the current font. This usually means that we need to
prepend the name of the default directory, and
to append the suffix `\.{.TFM}'. Furthermore, we change lower case letters
to upper case, since |cur_name| is a \PASCAL\ string.
@^system dependencies@>

@<Move font name into the |cur_name| string@>=
for k:=1 to name_length do cur_name[k]:=' ';
if a=0 then
  begin for k:=1 to default_directory_name_length do
    cur_name[k]:=default_directory[k];
  r:=default_directory_name_length;
  end
else r:=0;
for k:=font_start[font_ptr]+14 to vf_ptr-1 do
  begin incr(r);
  if r+4>name_length then vf_abort('Font name too long for me!');
@.Font name too long for me@>
  if (vf[k]>="a")and(vf[k]<="z") then
      cur_name[r]:=xchr[vf[k]-@'40]
  else cur_name[r]:=xchr[vf[k]];
  end;
cur_name[r+1]:='.'; cur_name[r+2]:='T'; cur_name[r+3]:='F'; cur_name[r+4]:='M'
@y
@ The string |cur_name| is supposed to be set to the external name of the
\.{TFM} file for the current font. This usually means that we need to
prepend the name of the default directory, and
to append the suffix `\.{.TFM}'. Furthermore, we change lower case letters
to upper case, since |cur_name| is a \PASCAL\ string.
@^system dependencies@>

@<Move font name into the |cur_name| string@>=
for k:=1 to name_length do cur_name[k]:=' ';
if a=0 then
  begin for k:=1 to default_directory_name_length do
    cur_name[k]:=default_directory[k];
  r:=default_directory_name_length;
  end
else r:=0;
for k:=font_start[font_ptr]+14 to vf_ptr-1 do
  begin incr(r);
  if r+5>name_length then vf_abort('Font name too long for me!');
@.Font name too long for me@>
  if (vf[k]>="a")and(vf[k]<="z") then
      cur_name[r]:=xchr[vf[k]-@'40]
  else cur_name[r]:=xchr[vf[k]];
  end;
cur_name[r+1]:='.'; cur_name[r+2]:='T'; cur_name[r+3]:='F'; cur_name[r+4]:='M';
cur_name[r+5]:= chr (0);
@z

%% **    50  ******************************************************************

@x
@ @<Set init...@>=
ASCII_04:=' !"#$%&''()*+,-./0123456789:;<=>?';@/
ASCII_10:='@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_';@/
ASCII_14:='`abcdefghijklmnopqrstuvwxyz{|}~?';@/
for k:=0 to 255 do xchr[k]:='?';
for k:=0 to @'37 do
  begin xchr[k+@'40]:=ASCII_04[k+1];
  xchr[k+@'100]:=ASCII_10[k+1];
  xchr[k+@'140]:=ASCII_14[k+1];
  end;
MBL_string:='MBL'; RI_string:='RI '; RCE_string:='RCE';
@y
@ @<Set init...@>=
c4p_arrcpy(ASCII_04,' !"#$%&''()*+,-./0123456789:;<=>?');@/
c4p_arrcpy(ASCII_10,'@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_');@/
c4p_arrcpy(ASCII_14,'`abcdefghijklmnopqrstuvwxyz{|}~?');@/
for k:=0 to 255 do xchr[k]:='?';
for k:=0 to @'37 do
  begin xchr[k+@'40]:=ASCII_04[k+1];
  xchr[k+@'100]:=ASCII_10[k+1];
  xchr[k+@'140]:=ASCII_14[k+1];
  end;
c4p_arrcpy(MBL_string,'MBL'); c4p_arrcpy(RI_string,'RI ');
c4p_arrcpy(RCE_string,'RCE');
@z

%% **   135  ******************************************************************

@x
which introduce new sections, can be inserted here; then only the index
itself will get a new section number.
@^system dependencies@>
@y
which introduce new sections, can be inserted here; then only the index
itself will get a new section number.
@^system dependencies@>

@ @<External C routines@>=
procedure miktex_banner (var f:text); forward;
@z
