home *** CD-ROM | disk | FTP | other *** search
- /* -----------------------------------------------------------------------------
-
- COPYIGHT
-
- ©1995 Dietmar Eilert (e-mail: DIETMAR@TOMATE.TNG.OCHE.DE). All Rights
- Reserved. Code may not be reused/reproduced without written permission of
- the author.
-
- Dietmar Eilert
- Mies-v-d-Rohe-Str.31, 52074 Aachen, Germany
- E-Mail: DIETMAR@TOMATE.TNG.OCHE.DE
- Tel: +49-(0)241-81665
- +49-(0)2525-7776
- Fax: +49-(0)241-81665
-
- Example: scan handler looking for Pascal style functions & procedure. Scan
- handlers are plain functions (LoadSeg'ed by GED): no standard C startup code,
- no library calls.
-
- DICE-C:
-
- dcc pascal.c -// -l0 -md -mRR -o ram:pascal
-
- ------------------------------------------------------------------------------
- */
-
- #include <exec/types.h>
-
- #define UPPER(a) ((a) & 95)
-
- ULONG
- ScanHandlerPascal(__D0 ULONG len, __A0 char **text, __A1 ULONG *line)
- {
- const char *version = "$VER: Pascal 1.0 (11.12.95)";
-
- if (len > 9) {
-
- if (UPPER(**text) == 'F') {
-
- if ((UPPER((*text)[1]) == 'U') && (UPPER((*text)[2]) == 'N') && (UPPER((*text)[3]) == 'C') && (UPPER((*text)[4]) == 'T') && (UPPER((*text)[5]) == 'I') && (UPPER((*text)[6]) == 'O') && (UPPER((*text)[7]) == 'N') && ((*text)[8] == ' ')) {
-
- // found FUNCTION
-
- *text += 9;
-
- return(len - 9);
- }
- }
- else if (UPPER(**text) == 'P') {
-
- if ((UPPER((*text)[1]) == 'R') && (UPPER((*text)[2]) == 'O') && (UPPER((*text)[3]) == 'C') && (UPPER((*text)[4]) == 'E') && (UPPER((*text)[5]) == 'D') && (UPPER((*text)[6]) == 'U') && (UPPER((*text)[7]) == 'R') && (UPPER((*text)[8]) == 'E') && ((*text)[9] == ' ')) {
-
- // found PROCEDURE
-
- *text += 10;
-
- return(len - 10);
- }
- }
- }
-
- return(FALSE);
- }
-
-