home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
text
/
golded
/
data
/
tools
/
gedscan
/
guide.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-27
|
2KB
|
77 lines
/* -----------------------------------------------------------------------------
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.
Exemple: gestionnaire de scan recherchant des nodes AmigaGuide (DICE-C).
Les gestionnaires de scan sont des fonctions plain (LoadSeg'ées par GED):
pas de code de départ C standard, pas d'appel bibliothèque.
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)
{
const char *version = "$VER: Guides 1.1 (21.7.94)";
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);
}