[Info-vax] A SYS$ version of F$EDIT

Arne Vajhøj arne at vajhoej.dk
Sat Jun 1 20:55:41 EDT 2019


On 5/31/2019 10:11 PM, John Reagan wrote:
> Many people used to call BAS$EDIT from non BASIC code on VAX.  It is now called DBAS$EDIT in Alpha going forward.  We use to document all those language RTL entry points.

So like:

$ type edit.pas
program edit(input,output);

const
    COLLAPSE = 2;
    TRIM = 8 + 128;
    COMPRESS = 16;
    UPCASE = 32;
    QUOTE = 256;

type
    varstr = varying[255] of char;

[external]
function dbasic$edit(%DESCR newstr : varstr;
                      %DESCR oldstr : varstr;
                      %IMMED editlist : integer) :  integer; external;

procedure test(s : varstr; editlist : integer);

var
    res : varstr;

begin
    dbasic$edit(res, s, editlist);
    writeln('|' + s + '| -> |' + res + '|');
end;

begin
    test('Test', UPCASE);
    test(' X ', TRIM);
    test('X   X', COMPRESS);
    test('X X X', COLLAPSE);
    test(' x  x  x ', COMPRESS + TRIM + UPCASE);
    test('x x " x x " x x', COLLAPSE + UPCASE);
    test('x x " x x " x x', COLLAPSE + UPCASE + QUOTE);
end.
$ pas edit
$ lin edit + sys$input/opt
sys$share:dec$basrtl/share
$
run edit
|Test| -> |TEST|
| X | -> |X|
|X   X| -> |X X|
|X X X| -> |XXX|
| x  x  x | -> |X X X|
|x x " x x " x x| -> |XX"XX"XX|
|x x " x x " x x| -> |XX" x x "XX|

Arne





More information about the Info-vax mailing list