/* This C language subroutine returns non-zero if the input is alpha-numeric, zero otherwise. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Updated on 5/94 by AS #include
int isalnum(int c); */ #include "lib_glob.h" #include "cty_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL _isalnum; _isalnum: test_for_lowera:R2=122; /* 122 == ASC('z') */ COMP(R4,R2), FETCH_RETURN /* test c > ASC('z'), defl ret val*/ IF GT JUMP (PC, return_false); /* must not be alnum*/ R2=97; /* 97 == ASC('a') */ COMP(R4,R2), R0=dm_1; /* test c >= ASC('a') */ IF GE JUMP (PC, restore_state); /* is lower case alpha*/ test_for_uppera:R2=90; /* 90 == ASC('Z') */ COMP(R4,R2); /* test c > ASC('z') */ IF GT JUMP (PC, return_false);/* must not be alnum*/ R2=65; /* 65 == ASC('A') */ COMP(R4,R2); /* test c >= ASC('A') */ IF GE JUMP (PC, restore_state);/* is upper case alpha*/ test_for_digit: R2=57; /* 57 = ASC('9') */ COMP(R4,R2); /* test c > ASC('9') */ IF GT JUMP (PC, return_false);/* must not be alnum*/ R2=48; /* 48 = ASC('0') */ COMP(R4,R2); /* test c >= ASC('0') */ IF GE JUMP (PC, restore_state); /* is digit */ return_false: R0=R0-R0; /* Set return false */ restore_state: RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;