/* This C language subroutine searches for a character within 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 6/94 by AS Updated on 3/95 by AS - separated polymorphic functions #include
char *strrchr(const char *s1, int c); */ #include "lib_glob.h" #include "str_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___strrchrP; ___strrchrP: chr_core: R4=PASS R8, R0=R4; pm_chr: R2=PASS R0, pm_ptr=R0; /*Point to start*/ R0=R0-R0, R12=PM(pm_ptr,1); /*Read first sample*/ DO find_pm_chr UNTIL FOREVER; COMP(R4,R12); /*If they equal, */ IF EQ R0=PASS R2; /* copy address*/ R12=PASS R12; IF EQ JUMP (PC, restore_state) (LA); find_pm_chr: R2=R2+1, R12=PM(pm_ptr,1); restore_state: FETCH_RETURN RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;