home *** CD-ROM | disk | FTP | other *** search
- /* -----------------------------------------------------------------------------
-
- Example: scan handler looking for AmigaGuide nodes (DICE-C). Scan handlers are
- plain functions loadSeg'ed by GED: no standard C startup code and no library
- calls.
-
- DICE C (-ms1 makes DICE compiler put string constants into code hunk):
-
- dcc guide.c -// -l0 -md -ms1 -mRR -o ram:Guides
-
- ------------------------------------------------------------------------------
- */
-
- #include <exec/types.h>
-
- #define UPPER(a) ((a) & 95)
-
- ULONG
- ScanHandlerGuide(__D0 ULONG len, __A0 char **text, __D1 ULONG line)
- {
- const char *version = "$VER: Guides 1.2 (5.4.95)";
-
- if (**text == '@') {
-
- if (len > 4) {
-
- UBYTE *next = *text + 1;
-
- if (UPPER(*next++) == 'N') {
-
- if (UPPER(*next++) == 'O') {
-
- if (UPPER(*next++) == 'D') {
-
- if (UPPER(*next++) == 'E') {
-
- UWORD letters = 0;
-
- for (len -= 5; len; --len) {
-
- if (*next == '"') {
-
- for (*text = ++next, --len; len && (*next != '"'); ++next)
- ++letters;
-
- return(letters);
- }
- else if (*next == ' ')
-
- next++;
-
- else {
-
- for (*text = next; len-- && (*next != ' ') && (*next != '"'); ++next)
- ++letters;
-
- return(letters);
- }
- }
-
- *text = "(unnamed)";
-
- return(9);
- }
- }
- }
- }
- }
- }
-
- return(NULL);
- }
-