/* This C language subroutine determines the length of a string. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 4/30/90 Updated on 5/94 by AS Updated on 3/95 by AS - separated polymorphic functions #include
int strlen(const char *s1); */ #include "lib_glob.h" #include "str_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___strlenP; ___strlenP: len_core: R2=PASS R4, pm_ptr=R4; /*Point to start */ R0=R0-R0, R2=PM(pm_ptr,1); /*Clear count, read first sample*/ R2=PASS R2; /*Check for \0 */ DO find_pm_end UNTIL EQ; IF NE R0=R0+1, R2=PM(pm_ptr,1); /*Inc counter, read next*/ find_pm_end: R2=PASS R2; /*Check for \0 */ restore_state: FETCH_RETURN RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;