$Id$
Second-level change file for TeX compilation on RISC OS
Line numbers refer to either tex.web or tex.ch from Web2c 7.2 or their merge

--- direct-io, inputfile, read_file and write_file are all dio handles ---
@x 1460
othercases write_ln(write_file[selector])
@y
othercases dio_write_ln(write_file[selector])
@z

print_visible_char: do dio and throwback.
@x 1495
othercases write(write_file[selector],xchr[s])
endcases;@/
@y
othercases dio_write(write_file[selector],xchr[s])
endcases;@/
throwback_char(xchr[s]);
@z

print_err: Start recording the error message for throwback
@x 1749
  print_nl("! "); print(#);
@y
  print_nl("! "); throwback_start; print(#);
@z

error: Stop recording throwback message and send it.
@x 1896
print_char("."); show_context;
@y
throwback_stop; print_char("."); show_context;
{ |throwback_xsend| is called like |call_edit| }
if throwback_flag and (base_ptr>0) then
  throwback_xsend(str_pool, str_start[input_stack[base_ptr].name_field],
	length(input_stack[base_ptr].name_field), line);
@z

Add a "T" option to turn on throwback
@x 1936
"E": if base_ptr>0 then
@y
"T": if (not throwback_flag) and (base_ptr>0) then begin
       throwback_flag:=true; { enable throwback }
       throwback_xsend(str_pool, str_start[edit_file.name_field],
		length(edit_file.name_field), line);
       { and send the current message }
       interaction:=nonstop_mode;
       return;
     end;
"E": if base_ptr>0 then
@z

Show the "T" option in the menu
@x 1957
if base_ptr>0 then print("E to edit your file,");
@y
if base_ptr>0 then begin
  print("E to edit your file,");
  if not throwback_flag then
    print_nl("T to start throwback and run without stopping,");
end;
@z

@x 6598
@!input_file : ^alpha_file;
@y
@!input_file : ^dio_handle;
@z

@x 7109
if name>17 then a_close(cur_file); {forget it}
@y
if name>17 then dio_close(cur_file); {forget it}
@z

@x 7601
  begin if input_ln(cur_file,true) then {not end of file}
@y
  begin if dio_input_ln(cur_file,true) then {not end of file}
@z

@x 9474
@!read_file:array[0..15] of alpha_file; {used for \.{\\read}}
@y
@!read_file:array[0..15] of dio_handle; {used for \.{\\read}}
@z

@x 9539
if input_ln(read_file[m],false) then read_open[m]:=normal
else  begin a_close(read_file[m]); read_open[m]:=closed;
@y
if dio_input_ln(read_file[m],false) then read_open[m]:=normal
else  begin dio_close(read_file[m]); read_open[m]:=closed;
@z

@x 9547
begin if not input_ln(read_file[m],true) then
  begin a_close(read_file[m]); read_open[m]:=closed;
@y
begin if not dio_input_ln(read_file[m],true) then
  begin dio_close(read_file[m]); read_open[m]:=closed;
@z

--- Filename parsing ---
We accept '.' or ':' as directory separator and '.' or '/' as extension
separator. This will fail for Unix-style names, but that is not
important since the filename is rescanned after path searching which
will translate it to RISC OS style.

The last '.' is not always the area_delimiter
@x [9963] web.tex:9963 (ch.tex:1421)
@!area_delimiter:pool_pointer; {the most recent `\./', if any}
@!ext_delimiter:pool_pointer; {the most recent `\..', if any}
@y
@!area_delimiter:pool_pointer; {the most recent `\..' before the extension, if any}
@!ext_delimiter:pool_pointer; {the most recent `\..' or `\./', if any}
@!area_delimiter2:pool_pointer; {the last `\..', if any}
@z

|begin_name|: Initialise |area_delimiter2| also.
@x [9982] web.tex:9982 (ch2.tex:24)
begin area_delimiter:=0; ext_delimiter:=0;
@y
begin area_delimiter:=0; ext_delimiter:=0; area_delimiter2:=0;
@z

|more_name|: |DIR_SEP| can be the extension delimiter
@x [9994] web.tex:9994 (ch.tex:1438)
  if IS_DIR_SEP(c) then
    begin area_delimiter:=cur_length; ext_delimiter:=0;
    end
  else if c="." then ext_delimiter:=cur_length;
@y
  if IS_DIR_SEP(c) then
    begin ext_delimiter:=cur_length;
      area_delimiter:=area_delimiter2;
      area_delimiter2:=cur_length;
    end
  else if c="/" then
    begin ext_delimiter:=cur_length;
      area_delimiter:=area_delimiter2;
    end;
@z

Filetypes DVI for DVI files.
@x [10366]
  while not b_open_out(dvi_file) do
@y
  while not b_open_out(dvi_file, riscos_DVI_type) do
@z

Filetype Text for log files.
@x [10390]
while not a_open_out(log_file) do @<Try to get a different log file name@>;
@y
while not a_open_out(log_file, riscos_TEXT_type) do
  @<Try to get a different log file name@>;
@z

@x 10449
  if a_open_in(cur_file, kpse_tex_format) then
@y
  if dio_open_in(cur_file, kpse_tex_format) then
@z

After opening the first input file, we set the output_mode according to its
extension conventions. We also set the prefix if desktop_flag is set.
@x [10472]
  begin job_name:=cur_name;
@y
  begin job_name:=cur_name;
    throwback_primary (name_of_file + 1);
    riscos_set_output_mode (name_of_file + 1);
    if riscos_desktop_flag then
      riscos_initialise_prefix (name_of_file + 1);
@z

@x 10499
if input_ln(cur_file,false) then do_nothing;
@y
if dio_input_ln(cur_file,false) then do_nothing;
@z

@x 23743
  begin a_close(read_file[n]); read_open[n]:=closed;
@y
  begin dio_close(read_file[n]); read_open[n]:=closed;
@z

@x 23749
  if a_open_in(read_file[n], kpse_tex_format) then read_open[n]:=just_open;
@y
  if dio_open_in(read_file[n], kpse_tex_format) then read_open[n]:=just_open;
@z

Filetype data for formats
@x [24555]
while not w_open_out(fmt_file) do
@y
while not w_open_out(fmt_file, riscos_DUMP_type) do
@z

@x 25173
@!write_file:array[0..15] of alpha_file;
@y
@!write_file:array[0..15] of dio_handle;
@z

@x 25530
  else  begin if write_open[j] then a_close(write_file[j]);
@y
  else  begin if write_open[j] then dio_close(write_file[j]);
@z

Filetype TeX for \openout
@x [25538]
            or not a_open_out(write_file[j]) do
@y
            or not dio_open_out(write_file[j], riscos_TEX_type) do
@z

@x 25604
for k:=0 to 15 do if write_open[k] then a_close(write_file[k])
@y
for k:=0 to 15 do if write_open[k] then dio_close(write_file[k])
@z
