struct StringsBase *StringsBase=0L; /*#define RUN*/ #ifdef RUN char *SetAfterChar(s,c) char *s; char c; { register char *p,cc; p=s; p--; do { cc=*++p; } while (cc==c); if(*(p-1)!=c) p=0L; return p; } /* $VER: SetafterChar 0.1 */ #endif long test(s,c) char *s; char c; { long el=0; char *p; char a[64],b[64]; strcpy(b,"<"); el++; p=s; p=(char *)SetAfterChar(s,c); strcat(b,s); strcpy(a,"<"); strcat(a,p); printf(" %9s> %3c %4ld %8s> p %x\n",b,c,(long)c,a,p); return el; } main() { char s[256],*p; long el=0; el++; StringsBase=(struct StringsBase *)OpenLibrary("Strings.library",0); puts(" inputstring searchchar out"); el=test("asd",0); el=test("iiiies ",'i'); el=test("test",'t'); el=test(" ",'d'); el=test("setafter",'w'); if(StringsBase) CloseLibrary(StringsBase); } /* register char *p,cc; p=s; cc=*p; while (cc==c) { p++; cc=*p; }; move.b (a2),d3 L3: cmp.b 15(a5),d3 bne L4 addq.l #1,a2 move.b (a2),d3 bra L3 L4: move.l a2,d0 register char *p,cc; p=s; p--; do { cc=*++p; } while (cc==c); subq.l #1,a2 L3: addq.l #1,a2 move.b (a2),d3 cmp.b d4,d3 beq L3 move.l a2,d0 subq.l #1,d0 move.l d0,a0 move.b (a0),d0 cmp.b d4,d0 beq L6 sub.l a2,a2 L6: move.l a2,d0 _SetAfterChar: move.b 15(a5),d0 move.l 8(a5),a0 SetAfterChar3: move.b (a0)+,d1 cmp.b d0,d1 beq SetAfterChar3 subq.l #2,a0 move.b (a0),d1 addq.l #1,a0 cmp.b d0,d1 beq SetAfterChar6 sub.l a0,a0 SetAfterChar6: move.l a0,d0 rts inputstring searchchar out 0 p 232904 i 105 p 232900 t 116 p 2328F8 < > d 100 <> p 0 w 119 <> p 0 */