; string.h -- Standard interface definitons for the Hawk string library. ; language: SMAL32 assembly language, intended as an include file ; author: Douglas W. Jones ; date: Dec 1, 2019 ; Linkage conventions: ; R1 -- used for return address linkage by all support routines. ; R2 -- available for use as an activation record pointer. ; R3 -- typically the first parameter and function return value ; R4 -- typically the second parameter, if there is one. ;------------------------------- ; length EXT STRLEN ; count the characters in a string ; takes R3=pointer to the string ; returns R3=length of the string, without NUL ; C equivalent: length = strlen(string) ;------------------------------- ; copy and concatenate EXT STRCPY ; copy a string with no length limit EXT STRNCPY ; copy a string with a set length limit ; takes R3=pointer to destination string buffer ; R4=pointer to source ; R5=length limit (STRNCPY only) ; returns R3=unchanged ; wipes out R4-R7 ; C equivalent: dst = strcpy(dst,src) ; dst = strcpy(dst,src,limit) EXT STRCAT ; concatenate a string to another with no limit EXT STRNCAT ; concatenate a string with a set length limit ; takes R3=pointer to destination string ; R4=pointer to source ; R5=length limit (STRNCAT only) ; returns R3=unchanged ; wipes out R4-R7 ; C equivalent: dst = strcat(dst,src) ; dst = strcat(dst,src,limit) ;------------------------------- ; compare EXT STRCMP ; compare two strings ; takes R3=pointer to string s1 ; R4=pointer to string s2 ; returns R3 < 0 if s1 0 if s1>s2 ; wipes out R4-R6 ; R5=length limit (STRNCAT only) ; C equivalent: result = strcmp(s1,s2)