Because of limitations on string lengths (the maximum string constant length is 64, at the moment), I wanted to have a function like MEMSET to be able to initialize a larger string to blanks, for example.
I added a new module PASSTRX (which is supposed to support more string functions in the future, when I want to add a STRING datatype supporting variable length strings). At the moment, the module PASSTRX only contains an external entry $PASSTR, which implements the two new library functions MEMSET and MEMCPY.
The functions are defined much the same as their C counterparts:
MEMSET (p, ch, len) - where p is a pointer of any type, ch is a char and len is an integer value (maybe an expression involving SIZEOF)
MEMCPY (p, q, len) - where p and q are pointers, and len is an integer value. p and q can be ADDR expressions (for example).
At the moment, the functions are implemented using simple Pascal loops; a better solution involving loops of MVCs or MVCL has to be done later.
Here is a short example program which I used to test the new functions:
|