SPL to HP C/XL Migration Guide (30231-90001)

B-4
case NEQ: /* compare != */
while ((count != 0) && (*left != *right)) ADJ;
break;
case GEQ: /* compare >= */
while ((count != 0) && (*left >= *right)) ADJ;
break;
case GTR: /* compare > */
while ((count != 0) && (*left > *right)) ADJ;
break;
}
switch (sdec) {
case 0: *raddr = right;
case 1: *laddr = left;
case 2: *caddr = count;
case 3: ; /* nil */
}
return (count == 0);
#undef ADJ
}
HP C/XL MOVEB Function: Move Bytes
/*************************************************************
MOVEB SPL MOVE BYTES
This emulates the MOVE statement in SPL for byte moves with
no information removed from the stack, for example:
MOVE B1 := B2, (CNT), 0
LEN := tos;
@S1 := tos;
@D1 := tos;
This may be converted to C with:
LEN := MOVEB(B1,B2,CNT,0,&S1,&D1);
The parameters to MOVEB are:
to -- The address to be moved to.
from -- The address to be moved from.
count -- Number of bytes to be moved. A positive value
means left to right move, negative means
right to left.
sdec -- The SPL stack decrement. In this context, the
value of this parameter will determine if
the function accesses the last two
parameters, as follows:
sdec = 3 -- Ignore the last two parameters
(in SPL, this is the default
case, deleting 3 stack words).
sdec = 2 -- Expect only one parameter
after this, dest_addr.
sdec = 1 -- Expect two parameters after
this, dest_addr and source_addr.
sdec = 0 -- Same as 1. This is never a
meaningful operation in SPL,
as the TOS, or count value,
is always zero after the MOVE
instruction.
source_addr -- The address of the next char of "from" beyond
the final character moved.
dest_addr -- The address of the next char of "to" beyond the
final character moved.
The return value of the function is the number of bytes moved