Sujet : Re: Clair Grant on VMS code base
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 07. Apr 2025, 01:58:43
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vsv804$28vt6$2@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 4/6/2025 8:34 PM, Arne Vajhøj wrote:
On 4/4/2025 2:00 PM, Simon Clubley wrote:
It basically parses, validates, and executes commands it has been given.
That is something which can be implemented a lot more easily and concisely
in a HLL with abstracted data structure capabilities (which includes
even C) than an assembly language with no such capabilities.
It is not obvious to me that:
(LOC/FP for Macro-32) / (LOC/FP for C)
is a lot higher for a shell than for the average application - data
structures are not anything special for shells.
But maybe.
And Macro-32 can be used to work with data structures.
Many have worked with FAB and RAB in Macro-32. :-)
To illustrate:
$ type ds.c
#define MAX_LEN 80
struct data
{
int v;
int slen;
char s[MAX_LEN];
};
void m(struct data * d)
{
d->v = d->v + 1;
d->s[d->slen] = 'X';
d->slen += 1;
}
$ type ds.mar
.title ds
MAX_LEN=10
V=0
SLEN=V+4
S=SLEN+4
X=88
.psect $CODE quad,pic,con,lcl,shr,exe,nowrt
.entry m,^m<>
movl 4(ap),r0
addl2 #1, V(r0)
movab S(r0), r1
addl2 SLEN(r0), r1
movb #X, (r1)
addl2 #1, SLEN(r0)
ret
.end
$ type dstest.for
program dstest
structure /data/
integer*4 v
integer*4 slen
character*80 s
end structure
record /data/buf
buf.v = 123
buf.s = 'ABC'
buf.slen = len('ABC')
call m(buf)
write(*,*) buf.v, buf.s(1:buf.slen)
end
$ for dstest
$ cc ds
$ link dstest + ds
$ run dstest
124 ABCX
$ macro ds
$ link dstest + ds
$ run dstest
124 ABCX
Arne