struct StringsBase *StringsBase=0L; /*#define RUN*/ #ifdef RUN char *ToUpper(s) register char *s; { register char c,*p; if(s) { p=s; c=*p; do { if(c>='a') if(c<='z') c&=223; *p++=c; c=*p; } while(*p); } return s; }; /* $VER: ToUpper feb06 0.1 */ #endif long test(s) char *s; { long el=0,l=StrLen(s); char os[256],*p; sprintf(os,"<%s>",s); if(s) { printf("%29s ",os); p=(char *)ToUpper(s); sprintf(os,"<%s>",s); printf(" %29s %8x %ld\n",os,p,l); } if(!s) p=(char *)ToUpper(s), printf("ZEROPOINTER return = %x\n",p); return el; } int main() { /* MAIN */ long el; StringsBase=(struct StringsBase *)OpenLibrary("Strings.library",0); puts(" inputstring \t\t outputstring\t\t return len"); el=test("TESTING ToUpper(UPPERCASE)"); el=test("abcdefghijklmnopqrstuvwxyz "); el=test("!@#$%^&*()__+|1234567890"); el=test("ABCDEF GHIJKL MNOPQ RSTUV"); el=test("WXYZ \[];',../<>{}:<>?"); el=test("a"); el=test("B"); el=test(""); el=test(0); if(StringsBase) CloseLibrary(StringsBase); return 0; } /* END */ #ifdef COMMENT _ToUpper: ; FEB06 move.l 8(a5),a0 cmp.l #0,a0 beq ToUpperEnd move.l a0,a1 move.b (a1),d0 ToUpperLoop: cmp.b #97,d0 blt ToUpperJump cmp.b #122,d0 bgt ToUpperJump and.b #223,d0 ToUpperJump: move.b d0,(a1)+ move.b (a1),d0 bne ToUpperLoop ToUpperEnd: move.l a0,d0 rts inputstring outputstring return len 2839BA 26 28399E 27 283985 24 28396B 25 {}:<>?> {}:<>?> 283955 21 283953 1 283951 1 <> <> 283950 0 ZEROPOINTER return = 0 #endif