[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Nov 16 18:14:23 1993 
Subject:Re: Tabulation, and pop_charout_col 
From:Ian Rogers 
Volume-ID:931117.01 

pop@dcs.glasgow.ac.uk (Robin Popplestone) writes:
> But of course it does not work if you are outputting to anything other
> than the "terminal". Now clearly one can program round any problems, but
> is there a nice easy way of generating disc-files with tabulated output?
>
> Robin

A standard way of printing to disk is simply to reassign cucharout
to a character consumer that sends the data to disk, and then just
print in the normal way.

E.g.

    define name_space;
        npr('     my    name    is    Ian       Rogers');
    enddefine;

    define print_to_disc;
        dlocal cucharout = discout('name_file');
        name_space();
        cucharout(termin);
    enddefine

The final 'cucharout(termin);' is needed to close the disk device,
although it's not strictly needed as the garbage collector will do
it for you at the next collection.

pop_charout_col and company will work for these "disk" devices
as well as for "terminals". Ie., from REF * CHARIO:

  pop_charout_col -> int                                        [variable]
  int -> pop_charout_col
  pop_charerr_col -> int                                        [variable]
  int -> pop_charerr_col
          These variables  contain  integers representing  the  number  of
          columns filled  by charout  and  charerr respectively  in  their
          current lines,  where  tab  characters  count  as  vedindentstep
          columns if in VED or 8 otherwise, control characters (i.e. ASCII
          value < 32) count as none, and all other characters count as  1.
          These values are reset to 0 on outputting a newline character.


Ian