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

  1.  
  2.  
  3. /*
  4. **  ***********************************************************************
  5. **
  6. **  ScanHandlerTeXDefs (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. ScanHandlerTeXDefs(register __d0 ULONG len, register __a0 char **text)
  19. {
  20.     const char *version = "$VER: TeXDefs 1.0 (17.10.94)";
  21.  
  22.     if (len > 5)
  23.     {
  24.         char *pos  = *text;
  25.         char *last = *text + len -1;
  26.  
  27.         if (    *pos++ == '\\'
  28.              && *pos++ == 'd'
  29.              && *pos++ == 'e'
  30.              && *pos++ == 'f'
  31.              && *pos   == '\\' )
  32.  
  33.         {
  34.             *text = pos;                                        /* Hier beginnt der Text     */
  35.  
  36.             while (pos<last && *++pos!='{' && *pos!='\\');      /* Solange kein { und kein \ */
  37.  
  38.             if (*pos == '\\' || *pos == '{')
  39.                 return ((ULONG)pos - (ULONG)*text);             /* Länge zurück              */
  40.             else
  41.                 return ((ULONG)pos - (ULONG)*text + 1);         /* Länge zurück              */
  42.         }
  43.     }
  44.  
  45.     return 0;
  46. }
  47.