summaryrefslogtreecommitdiffstats
path: root/scanners.c
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>1997-04-18 06:38:38 +0000
committerGreg McGary <greg@mcgary.org>1997-04-18 06:38:38 +0000
commit8c13e09279f361e18173f9e237c454af0ab33299 (patch)
treef66f1ed48a98145460da6a01926017825cebbdf2 /scanners.c
parent509a418a05787df17f1e942593541798facb5acf (diff)
downloadidutils-8c13e09279f361e18173f9e237c454af0ab33299.tar.gz
idutils-8c13e09279f361e18173f9e237c454af0ab33299.tar.bz2
idutils-8c13e09279f361e18173f9e237c454af0ab33299.zip
imported from mkid-3.0.9r3_0_8_2
Diffstat (limited to 'scanners.c')
-rw-r--r--scanners.c115
1 files changed, 35 insertions, 80 deletions
diff --git a/scanners.c b/scanners.c
index d7ffdba..f2a5d44 100644
--- a/scanners.c
+++ b/scanners.c
@@ -32,29 +32,31 @@ extern char const *program_name;
static char const *get_token_VHIL __P((FILE *input_FILE, int *flags));
static char const *get_token_c __P((FILE *input_FILE, int *flags));
static void set_args_c __P((char const *lang_name, int op, char const *arg));
-static void set_ctype_c __P((unsigned char const *chars, int type));
-static void clear_ctype_c __P((unsigned char const *chars, int type));
+static void set_ctype_c __P((char const *chars, int type));
+static void clear_ctype_c __P((char const *chars, int type));
static void usage_c __P((char const *lang_name));
static char const *get_token_asm __P((FILE *input_FILE, int *flags));
-static void set_ctype_asm __P((unsigned char const *chars, int type));
-static void clear_ctype_asm __P((unsigned char const *chars, int type));
+static void set_ctype_asm __P((char const *chars, int type));
+static void clear_ctype_asm __P((char const *chars, int type));
static void usage_asm __P((char const *lang_name));
static void set_args_asm __P((char const *lang_name, int op, char const *arg));
static char const *get_token_text __P((FILE *input_FILE, int *flags));
-static void set_ctype_text __P((unsigned char const *chars, int type));
-static void clear_ctype_text __P((unsigned char const *chars, int type));
+static void set_ctype_text __P((char const *chars, int type));
+static void clear_ctype_text __P((char const *chars, int type));
static void usage_text __P((char const *lang_name));
static void set_args_text __P((char const *lang_name, int op, char const *arg));
/****************************************************************************/
+typedef void (*set_args_t) __P((char const *lang_name, int op, char const *arg));
+
struct language
{
char const *lang_name;
- char const *(*lang_get_token) (FILE *input_FILE, int *flags);
- void (*lang_set_args) (char const *lang_name, int op, char const *arg);
+ get_token_t lang_get_token;
+ set_args_t lang_set_args;
char const *lang_filter;
struct language *lang_next;
};
@@ -380,7 +382,7 @@ usage_scan (void)
fprintf (stderr, "Usage: %s [-S<suffix>=<lang>] [+S(+|-)<arg>] [-S<lang>(+|-)<arg>] [-S<lang>/<lang>/<filter>]\n", program_name);
exit (1);
}
-
+
/*************** C & C++ ****************************************************/
#define I1 0x0001 /* 1st char of an identifier [a-zA-Z_] */
@@ -438,22 +440,6 @@ static unsigned short ctype_c[257] =
/*150*/ I1, I1, I1, I1, I1|NM, I1, I1, I1,
/*160*/ I1, I1, I1, I1, I1, I1, I1, I1,
/*170*/ I1|NM, I1, I1, 0, 0, 0, 0, 0,
-/*200*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*210*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*220*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*230*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*240*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*250*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*260*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*270*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*300*/ SK, SK, SK, SK, SK, SK, SK, SK,
-/*310*/ SK, SK, SK, SK, SK, SK, SK, SK,
-/*320*/ SK, SK, SK, SK, SK, SK, SK, 0,
-/*330*/ SK, SK, SK, SK, SK, SK, SK, SK,
-/*340*/ SK, SK, SK, SK, SK, SK, SK, SK,
-/*350*/ SK, SK, SK, SK, SK, SK, SK, SK,
-/*360*/ SK, SK, SK, SK, SK, SK, SK, 0,
-/*370*/ SK, SK, SK, SK, SK, SK, SK, SK,
};
static int eat_underscore = 1;
@@ -705,7 +691,7 @@ next:
}
static void
-set_ctype_c (unsigned char const *chars, int type)
+set_ctype_c (char const *chars, int type)
{
unsigned short *rct = &ctype_c[1];
@@ -714,7 +700,7 @@ set_ctype_c (unsigned char const *chars, int type)
}
static void
-clear_ctype_c (unsigned char const *chars, int type)
+clear_ctype_c (char const *chars, int type)
{
unsigned short *rct = &ctype_c[1];
@@ -751,14 +737,14 @@ set_args_c (char const *lang_name, int op, char const *arg)
break;
case 's':
if (op == '+')
- set_ctype_c ((unsigned char *) arg, SK);
+ set_ctype_c (arg, SK);
else
- clear_ctype_c ((unsigned char *) arg, SK);
+ clear_ctype_c (arg, SK);
break;
case 'v':
- set_ctype_c ((unsigned char *) "$", I1);
- set_ctype_c ((unsigned char *) "#", VH);
- set_ctype_c ((unsigned char *) " \t", WS);
+ set_ctype_c ("$", I1);
+ set_ctype_c ("#", VH);
+ set_ctype_c (" \t", WS);
scan_VHIL = 1;
break;
default:
@@ -793,7 +779,7 @@ set_args_c (char const *lang_name, int op, char const *arg)
#undef ISVBORING
#undef ISQ1BORING
#undef ISQ2BORING
-
+
/*************** Assembly ***************************************************/
#define I1 0x01 /* 1st char of an identifier [a-zA-Z_] */
@@ -837,22 +823,7 @@ static unsigned char ctype_asm[257] =
/*150*/ I1, I1, I1, I1, I1|NM, I1, I1, I1,
/*160*/ I1, I1, I1, I1, I1, I1, I1, I1,
/*170*/ I1|NM, I1, I1, 0, 0, 0, 0, 0,
-/*200*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*210*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*220*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*230*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*240*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*250*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*260*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*270*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*300*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*310*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*320*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*330*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*340*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*350*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*360*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*370*/ 0, 0, 0, 0, 0, 0, 0, 0,
+
};
static int cpp_on_asm = 1;
@@ -994,7 +965,7 @@ next:
}
static void
-set_ctype_asm (unsigned char const *chars, int type)
+set_ctype_asm (char const *chars, int type)
{
unsigned char *rct = &ctype_asm[1];
@@ -1003,7 +974,7 @@ set_ctype_asm (unsigned char const *chars, int type)
}
static void
-clear_ctype_asm (unsigned char const *chars, int type)
+clear_ctype_asm (char const *chars, int type)
{
unsigned char *rct = &ctype_asm[1];
@@ -1038,10 +1009,10 @@ set_args_asm (char const *lang_name, int op, char const *arg)
switch (*arg++)
{
case 'a':
- set_ctype_asm ((unsigned char *) arg, I1 | ((op == '-') ? IG : 0));
+ set_ctype_asm (arg, I1 | ((op == '-') ? IG : 0));
break;
case 'c':
- set_ctype_asm ((unsigned char *) arg, CM);
+ set_ctype_asm (arg, CM);
break;
case 'u':
eat_underscore = (op == '+');
@@ -1052,13 +1023,13 @@ set_args_asm (char const *lang_name, int op, char const *arg)
case 'C':
if (op == '+')
{
- set_ctype_asm ((unsigned char *) "/", C1);
- set_ctype_asm ((unsigned char *) "*", C2);
+ set_ctype_asm ("/", C1);
+ set_ctype_asm ("*", C2);
}
else
{
- clear_ctype_asm ((unsigned char *) "/", C1);
- clear_ctype_asm ((unsigned char *) "*", C2);
+ clear_ctype_asm ("/", C1);
+ clear_ctype_asm ("*", C2);
}
break;
default:
@@ -1085,7 +1056,7 @@ set_args_asm (char const *lang_name, int op, char const *arg)
#undef ISCBORING
#undef ISCCBORING
#undef ISIGNORE
-
+
/*************** Text *******************************************************/
#define I1 0x01 /* 1st char of an identifier [a-zA-Z_] */
@@ -1122,22 +1093,6 @@ static unsigned char ctype_text[257] =
/*150*/ I1, I1, I1, I1, I1|NM, I1, I1, I1,
/*160*/ I1, I1, I1, I1, I1, I1, I1, I1,
/*170*/ I1|NM, I1, I1, 0, 0, 0, 0, 0,
-/*200*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*210*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*220*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*230*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*240*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*250*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*260*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*270*/ 0, 0, 0, 0, 0, 0, 0, 0,
-/*300*/ I1, I1, I1, I1, I1, I1, I1, I1,
-/*310*/ I1, I1, I1, I1, I1, I1, I1, I1,
-/*320*/ I1, I1, I1, I1, I1, I1, I1, 0,
-/*330*/ I1, I1, I1, I1, I1, I1, I1, I1,
-/*340*/ I1, I1, I1, I1, I1, I1, I1, I1,
-/*350*/ I1, I1, I1, I1, I1, I1, I1, I1,
-/*360*/ I1, I1, I1, I1, I1, I1, I1, 0,
-/*370*/ I1, I1, I1, I1, I1, I1, I1, I1,
};
/*
@@ -1190,7 +1145,7 @@ top:
}
static void
-set_ctype_text (unsigned char const *chars, int type)
+set_ctype_text (char const *chars, int type)
{
unsigned char *rct = &ctype_text[1];
@@ -1199,7 +1154,7 @@ set_ctype_text (unsigned char const *chars, int type)
}
static void
-clear_ctype_text (unsigned char const *chars, int type)
+clear_ctype_text (char const *chars, int type)
{
unsigned char *rct = &ctype_text[1];
@@ -1232,15 +1187,15 @@ set_args_text (char const *lang_name, int op, char const *arg)
{
case 'a':
if (op == '+')
- set_ctype_text ((unsigned char *) arg, I1);
+ set_ctype_text (arg, I1);
else
- clear_ctype_text ((unsigned char *) arg, I1);
+ clear_ctype_text (arg, I1);
break;
case 's':
if (op == '+')
- set_ctype_text ((unsigned char *) arg, SQ);
+ set_ctype_text (arg, SQ);
else
- clear_ctype_text ((unsigned char *) arg, SQ);
+ clear_ctype_text (arg, SQ);
break;
default:
if (lang_name)