SPL to HP C/XL Migration Guide (30231-90001)
5- 38
In this case, these statements might become:
NUM = strchr(B1,' ') - B1;"
or
NUM = strcspn(B1,"% ");
NOTE The HP C/XL library function memchr can be used to scan strings
that are not terminated by NUL ('\0', numeric value 0). For more
information on memchr and its related functions and on the str...
series of functions, see the
HP C/XL Library Reference Manual
.
The HP C/XL SCANU function, shown in Figure 5-25, duplicates the
SCAN-UNTIL operation.
________________________________________________________
| |
| int SCANU(ba,test,sdec,scan_adr) |
| char *ba, *scan_adr; |
| unsigned short test; |
| int sdec; |
| { |
| char termc, testc, *temp; |
| temp = ba; |
| termc = (char)test >> 8; |
| testc = (char)test & 0xFF; |
| while ((*ba != testc) && (*ba != testc)) ba++;|
| switch (sdec) |
| { |
| case 0: ; /* fall through to case 1 */ |
| case 1: *scan_adr = ba; |
| case 2: ; /* nil */ |
| } |
| return(ba - temp); |
| } |
________________________________________________________
Figure 5-25. HP C/XL SCANU Function: SCAN-UNTIL Statement