home *** CD-ROM | disk | FTP | other *** search
- DEFINITION FOR C MODULE String ;
-
- (*----------------------------------------------------------------------------*)
- (* Parameter names prefixed with c ( cs or ct ) imply that the function does *)
- (* not modify the parameter. *)
- (* NB:Lazer M2 has a built in SYSTEM.STRING type , which is compatible *)
- (* with both character arrays and "string" contants, so you can pass a string *)
- (* constant or character array to any STRING formal parameter. *)
- (* Also function procedures in a "FOR C" definition module can be treated as *)
- (* proper procedures IOWs its possible to ignore the result type from funtions*)
- (* like strcat & printf etc. *)
- (*----------------------------------------------------------------------------*)
-
- FROM SYSTEM IMPORT ADDRESS , STRING ;
-
- PROCEDURE strlen( cs : STRING ) : LONGINT ;
- (* returns length of cs *)
-
- PROCEDURE strcmp( cs , ct : STRING ) : LONGINT ;
- (* compare cs to ct, returns <0 if cs<ct ,0 if cs=ct ,>0 otherwise *)
-
- PROCEDURE strncmp( cs , ct : STRING ; n : LONGINT ) : LONGINT ;
- (* compare at most n characters of cs to ct , result as strcmp *)
-
- PROCEDURE strcat( s , ct : STRING ) : STRING ;
- (* concatenate ct to end of s , returns s *)
-
- PROCEDURE strncat( s , ct : STRING ; n : LONGINT ) : STRING ;
- (* concatenate at most n characters of ct to end of s , terminate *)
- (* s with 0C , returns s. *)
-
- PROCEDURE strcpy( s , ct : STRING ) : STRING ;
- (* copy ct to s including null terminator , returns s *)
-
- PROCEDURE strncpy( s , ct : STRING ; n : LONGINT ) : STRING ;
- (* copy first n characters of ct to s , pads with 0C's if t has fewer chars *)
- (* than n. *)
-
- PROCEDURE strerror( i : LONGINT ) : STRING ;
- (* string corresponding to error number i see errno.def *)
-
- PROCEDURE strchr( cs : STRING ; c : CHAR ) : STRING ;
- (* pointer to first occurrence of c in s , NIL if not found *)
-
- PROCEDURE strrchr( cs : STRING ; c : CHAR ) : STRING ;
- (* pointer to last occurrence of c in s , NIL if not found *)
-
- PROCEDURE strspn( cs , ct : STRING ) : LONGINT ;
- (* length of prefix of cs consisting of characters in ct *)
-
- PROCEDURE strcspn( cs , ct : STRING ) : LONGINT ;
- (* length of prefix of cs consisting of characters NOT in ct *)
-
- PROCEDURE strpbrk( cs , ct : STRING ) : STRING ;
- (* return pointer to first occurrence in cs of any character of ct, NIL if no *)
- (* occurrence *)
-
- PROCEDURE strstr( cs , ct : STRING ) : STRING ;
- (* pointer to first occurrence of ct in cs , NIL if not found *)
-
- PROCEDURE strtok( s , ct : STRING ) : STRING ;
- (* no time to describe this one , see any good ANSI-C book *)
-
- PROCEDURE memcmp ( cs , ct : ADDRESS ; n : LONGINT ) : LONGINT ;
- (* compare at most n bytes of cs to ct , result as strcmp (above) *)
-
- PROCEDURE memcpy ( s , ct : ADDRESS ; n : LONGINT ) : ADDRESS ;
- (* copy n bytes from ct to s , returns s *)
-
- PROCEDURE memmove( s , ct : ADDRESS ; n : LONGINT ): ADDRESS ;
- (* as memcpy but s & ct can overlap *)
-
- PROCEDURE memset( s : ADDRESS ; b : CHAR ; n : LONGINT ) : ADDRESS ;
- (* place b into first n locations of s , returns s *)
-
- PROCEDURE memchr( cs : ADDRESS ; b : CHAR ; n : LONGINT ) : ADDRESS ;
- (* return pointer to the first occurrence of b in cs, or NIL if not found *)
-
- END String.
-