home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / edit / macro / scanner / stdefines.c < prev    next >
C/C++ Source or Header  |  1994-10-17  |  1KB  |  55 lines

  1.  
  2.  
  3. /*
  4. **  ***********************************************************************
  5. **
  6. **  ScanHandlerSDefine (c) by Stefan Schor
  7. **
  8. **  ***********************************************************************
  9. */
  10.  
  11.  
  12. #include <exec/types.h>
  13.  
  14. #define UPPER(a) ((a) & 95)
  15.  
  16. __asm
  17. ULONG
  18. ScanHandlerSDefine(register __d0 ULONG len, register __a0 char **text)
  19. {
  20.     const char *version = "$VER: SDefine 1.1 (17.10.94)";
  21.  
  22.     if (len > 8)
  23.     {
  24.         char *pos  = *text;
  25.         char *last = *text + len -1;
  26.  
  27.  
  28.         if (          *pos++  == '#'
  29.              && UPPER(*pos++) == 'D'
  30.              && UPPER(*pos++) == 'E'
  31.              && UPPER(*pos++) == 'F'
  32.              && UPPER(*pos++) == 'I'
  33.              && UPPER(*pos++) == 'N'
  34.              && UPPER(*pos++) == 'E'
  35.              &&       *pos    == ' ' )
  36.  
  37.         {
  38.             while (pos<last && *++pos==' ');                    /* Alle Spaces übergehen    */
  39.  
  40.             *text = pos;                                        /* Hier beginnt der Text    */
  41.  
  42.             while (pos<last && *++pos!=' ' && *pos!='(');       /* Solange bis Space oder ( */
  43.  
  44.             if (*pos == ' ' || *pos == '(')
  45.                 return ((ULONG)pos - (ULONG)*text);             /* Länge zurück              */
  46.             else
  47.                 return ((ULONG)pos - (ULONG)*text + 1);         /* Länge zurück              */
  48.         }
  49.     }
  50.  
  51.  
  52.  
  53.     return 0;
  54. }
  55.