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

B-7
**************************************************************/
short int MOVESB(to,str,sdec,source_addr,dest_addr)
char *to, *str, **source_addr, **dest_addr;
int sdec;
{
char *temp;
temp = to;
while (*str != '\0') *to++ = *str++;
switch (sdec) {
case 0: ; /* fall through to case 1 */
case 1: *source_addr = str;
case 2: *dest_addr = to;
case 3: ; /* nil */
}
return(to-temp);
}
HP C/XL MOVEW Function: Move Words
/********************************************************************
MOVEW SPL MOVE WORDS
This emulates the MOVE statement in SPL for word moves with
no information removed from the stack, for example:
MOVE W1 := W2, (CNT), 0
LEN := tos;
@S1 := tos;
@D1 := tos;
This may be converted to C with:
LEN := MOVEW(W1,W2,CNT,0,&S1,&D1);
The parameters to MOVEW are:
to -- The address to be moved into.
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 not a meaningful
operation in SPL because 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.
********************************************************************/
short int MOVEW(to,from,count,sdec,source_addr,dest_addr)
short int *to, *from, **source_addr, **dest_addr;
int count, sdec;
{
int c;