home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 45
/
Amiga_Dream_45.iso
/
Amiga
/
Magazine
/
Dossier-LaTeX
/
AmiWeb2C.lha
/
source
/
web2c-6.1
/
web2c
/
mp
/
mp.chch
< prev
next >
Wrap
Text File
|
1995-04-10
|
9KB
|
307 lines
Changes for MP.CH by Andreas Scherer, April 10, 1995.
@x l.301 of MP.WEB
@^system dependencies@>
@y
@^system dependencies@>
@d file_name_size == PATH_MAX
@z
@x l.135
@!file_name_size=FILENAMESIZE; {file names shouldn't be longer than this}
@y
@z
@x l.680 of MP.WEB
@!alpha_file=packed file of text_char; {files that contain textual data}
@!byte_file=packed file of eight_bits; {files that contain binary data}
@y
@z
Undo this change in MP.CH completely.
@x l.217
is crucial for our purposes. We make real_name_of_file hold the
|name_of_file| plus a directory specifier to open the file in Unix.
@^system dependencies@>
@<Glob...@>=
@!name_of_file,@!real_name_of_file:packed array[1..file_name_size] of char;@;@/
{on some systems this may be a \&{record} variable}
@!name_length:0..file_name_size;@/{this many characters are actually
relevant in |name_of_file| (the rest are blank)}
@y
is crucial for our purposes. We shall assume that |name_of_file| is a variable
of an appropriate type such that the \PASCAL\ run-time system being used to
implement \MP\ can open a file whose external name is specified by
|name_of_file|.
@^system dependencies@>
@<Glob...@>=
@!name_of_file:packed array[1..file_name_size] of char;@;@/
{on some systems this may be a \&{record} variable}
@!name_length:0..file_name_size;@/{this many characters are actually
relevant in |name_of_file| (the rest are blank)}
@z
Path searching is done with KPathSea.
@x l.292
An external C procedure, |test_access| is used to check whether or not the
open will work, and it returns
|true| or |false|. The |name_of_file| global holds the file name whose access
is to be tested.
The first parameter for |test_access| is the access mode,
one of |read_access_mode| or |write_access_mode|.
We also implement path searching in |test_access|: its second parameter is
one of the ``file path'' constants defined below. If |name_of_file|
doesn't start with |'/'| then |test_access| tries prepending pathnames
from the appropriate path list until success or the end of path list
is reached.
On return, |real_name_of_file| contains the original name with the path
that succeeded (if any) prepended. It is the name used in the various
open procedures.
Note that |a_open_in| has been redefined to take an additional argument,
which should be one of the ``file path'' specifiers.
Path searching is not done for output files.
In the C-Version |X_open_in| and |X_open_out|, |w_open_in| and |w_open_out|
are completely replaced by C preprocessor macros. We retain
the testaccess() routine since it was already written in C and it
implements the path searching mechanism.
@d read_access_mode=4 {``read'' mode for |test_access|}
@d write_access_mode=2 {``write'' mode for |test_access|}
@d no_file_path=0 {no path searching should be done}
@d TeX_font_file_path=3 {path specifier for \.{TFM} files}
@d MF_input_file_path=6 {path specifier for \.{.mf} \.{input} files}
@d MP_input_file_path=9 {path specifier for \.{input} files}
@d MP_mem_file_path=10 {path specifier for \.{MEM} files}
@d MP_pool_file_path=11 {path specifier for the pool file}
@y
@d no_file_path=-1 {no path searching should be done}
@z
Path searching is done with KPathSea.
@x l.535
if a_open_in(pool_file,MP_pool_file_path) then
@y
if a_open_in(pool_file,MP_POOL_PATH) then
@z
@x l.588
if (history <> spotless) and (history <> warning_issued) then
uexit(1)
else
uexit(0);
@y
uexit(history);
@z
@x l.3389 of MP.WEB
@!word_file = file of memory_word;
@y
@=#include "texmfmem.h";@>
@z
`abs()' will be done by ways of a C macro, so we don't want to evaluate
`take_fraction' multiple times (it's in the `inner loop', remember!).
@x l.8078 of MP.WEB
get_pen_scale:=s*square_rt(abs(take_fraction(a,d)-take_fraction(b,c)));
@y
a:=take_fraction(a,d)-take_fraction(b,c);
get_pen_scale:=s*square_rt(abs(a));
@z
This change is necessary for file name conventions of the AmigaOS.
Probably it won't hurt the UNIX syntax.
@x l.936
else begin if (c="/") then
@y
else begin if (c="/")or(c=":") then
@z
@x l.956
@d mem_default_length=9 {length of the |MP_mem_default| string}
@d mem_area_length=0 {length of its area part}
@d mem_ext_length=4 {length of its `\.{.mem}' part}
@d mem_extension=".mem" {the extension, as a \.{WEB} constant}
@<Glob...@>=
@!MP_mem_default:packed array[1..mem_default_length] of char;
@y
@d mem_area_length=0 {length of its area part}
@d mem_ext_length=4 {length of its `\.{.mem}' part}
@d mem_extension=".mem" {the extension, as a \.{WEB} constant}
@<Glob...@>=
@!mem_default_length: integer;
@!MP_mem_default: c_char_pointer;
@z
Undo this change in MP.CH completely.
@x l.1014
which simply makes a \MP\ string from the value of |name_of_file|, should
ideally be changed to deduce the full name of file~|f|, which is the file
most recently opened, if it is possible to do this in a \PASCAL\ program.
With the C version, we know that |real_name_of_file|
contains |name_of_file| prepended with the directory name that was found
by path searching.
If |real_name_of_file| starts with |'./'|, we don't use that part of the
name, since {\mc UNIX} users understand that.
@^system dependencies@>
This routine might be called after string memory has overflowed, hence
we dare not use `|str_room|'.
@p function make_name_string:str_number;
var @!k,@!kstart:1..file_name_size; {index into |name_of_file|}
begin
k:=1;
while (k<file_name_size) and (xord[real_name_of_file[k]]<>" ") do
incr(k);
name_length:=k-1; {the real |name_length|}
if str_overflowed then
make_name_string:="?"
else begin
if (xord[real_name_of_file[1]]=".") and (xord[real_name_of_file[2]]="/") then
kstart:=3
else
kstart:=1;
str_room(name_length-kstart-1);
for k:=kstart to name_length do append_char(xord[real_name_of_file[k]]);
make_name_string:=make_string;
end;
end;
@y
which simply makes a \MP\ string from the value of |name_of_file|, should
ideally be changed to deduce the full name of file~|f|, which is the file
most recently opened, if it is possible to do this in a \PASCAL\ program.
@^system dependencies@>
This routine might be called after string memory has overflowed, hence
we dare not use `|str_room|'.
@p function make_name_string:str_number;
var @!k:1..file_name_size; {index into |name_of_file|}
begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings) then
make_name_string:="?"
else begin for k:=1 to name_length do append_char(xord[name_of_file[k]]);
make_name_string:=make_string;
end;
end;
@z
Undo this change in MP.CH completely.
@x l.1061
{These are all replaced by macros in C which call makenamestring}
@y
function a_make_name_string(var @!f:alpha_file):str_number;
begin a_make_name_string:=make_name_string;
end;
function b_make_name_string(var @!f:byte_file):str_number;
begin b_make_name_string:=make_name_string;
end;
function w_make_name_string(var @!f:word_file):str_number;
begin w_make_name_string:=make_name_string;
end;
@z
Path searching is done with KPathSea.
@x l.1115
try_extension:=a_open_in(cur_file,MF_input_file_path)
else try_extension:=a_open_in(cur_file,MP_input_file_path);
@y
try_extension:=a_open_in(cur_file,MF_INPUT_PATH)
else try_extension:=a_open_in(cur_file,MP_INPUT_PATH);
@z
This fixes a problem in the first step of the TRAP test.
At least with SAS/C++ 6.55 on the Amiga it is not possible to
write to a file whose file pointer is still active in READ mode.
@x l.14520
@ Open |wr_file[n]| using file name~|s| and update |wr_fname[n]|.
@p procedure open_write_file(s:str_number; n:readf_index);
begin str_scan_file(s);
pack_cur_name;
while not a_open_out(wr_file[n]) do
prompt_file_name("file name for write output","");
wr_fname[n]:=s;
add_str_ref(s);
end;
@y
@ Open |wr_file[n]| using file name~|s| and update |wr_fname[n]|.
The Amiga operating system does not permit write access to a file that is
currently opened in read mode. To avoid desaster, we look for the file to
be opened in the list of |read_from| files and close it if present.
@d amiga==ifdef('_AMIGA')
@d agima==endif('_AMIGA')
@p procedure open_write_file(s:str_number; n:readf_index);
amiga@;
label done;
var @!n0:readf_index; {Scratch variable}
agima@;
begin
str_scan_file(s);
pack_cur_name;
amiga@;
for n0:=0 to read_files-1 do begin
if rd_fname[n0]<>0 then begin
if str_vs_str(s,rd_fname[n0])=0 then begin
a_close(rd_file[n0]);
delete_str_ref(rd_fname[n0]);
rd_fname[n0]:=0;
if n0=read_files-1 then read_files:=n0;
goto done;
end;
end;
end;
done: do_nothing;
agima@;
while not a_open_out(wr_file[n]) do
prompt_file_name("file name for write output","");
wr_fname[n]:=s;
add_str_ref(s);
end;
@z
@x l.1275
if a_open_in(ps_tab_file,MP_pool_file_path) then
@y
if a_open_in(ps_tab_file,MP_POOL_PATH) then
@z
@x l.1340
set_paths;
@y
set_paths (
MP_MEM_PATH_BIT +
MP_INPUT_PATH_BIT +
MP_POOL_PATH_BIT +
TFM_FILE_PATH_BIT +
MF_INPUT_PATH_BIT);
@z
@x l.1356
if (history <> spotless) and (history <> warning_issued) then
uexit(1)
else
uexit(0);
@y
uexit(history);
@z