add "needs-count" specifier, which means "make a .h file if you otherwise

wouldn't".  this is overridden by (and is a subset of "device-driver".
if you have a "standard" file, you can also do: "standard foo needs-count"
to get a foo.h file.  (for the hp300 stuff)
This commit is contained in:
cgd 1993-05-29 18:50:37 +00:00
parent a2127940d9
commit 2dfb467a38
6 changed files with 68 additions and 20 deletions

View File

@ -48,8 +48,10 @@ struct file_list {
u_char f_type; /* see below */ u_char f_type; /* see below */
u_char f_flags; /* see below */ u_char f_flags; /* see below */
u_char f_was_driver; /* to handle un-included pseudo-drivers*/ u_char f_was_driver; /* to handle un-included pseudo-drivers*/
u_char f_needs_count; /* to handle un-included pseudo-drivers*/
char *f_special; /* special make rule if present */ char *f_special; /* special make rule if present */
char *f_needs; char *f_needs;
char *f_countname;
/* /*
* Random values: * Random values:
* swap space parameters for swap areas * swap space parameters for swap areas

View File

@ -51,6 +51,8 @@ headers()
for (fl = ftab; fl != 0; fl = fl->f_next) for (fl = ftab; fl != 0; fl = fl->f_next)
if (fl->f_was_driver) if (fl->f_was_driver)
do_count(fl->f_needs, fl->f_needs, 1); do_count(fl->f_needs, fl->f_needs, 1);
else if (fl->f_needs_count)
do_count(fl->f_countname, fl->f_countname, 1);
} }
/* /*

View File

@ -17,6 +17,7 @@
#define EXPR_GROUP 11 #define EXPR_GROUP 11
#define T_LEFTPAREN 12 #define T_LEFTPAREN 12
#define T_RIGHTPAREN 13 #define T_RIGHTPAREN 13
#define T_NEEDS_COUNT 14
#define is_paren(x) ((x == '(') || (x == ')')) #define is_paren(x) ((x == '(') || (x == ')'))
struct file_keyword { struct file_keyword {
@ -30,7 +31,8 @@ struct file_keyword {
"or", T_OR, "or", T_OR,
"not", T_NOT, "not", T_NOT,
"requires", T_REQUIRES, "requires", T_REQUIRES,
"standard", T_STANDARD "standard", T_STANDARD,
"needs-count", T_NEEDS_COUNT,
}; };
extern struct file_list *fltail_lookup(),*new_fent(),*fl_lookup(); extern struct file_list *fltail_lookup(),*new_fent(),*fl_lookup();
@ -405,7 +407,7 @@ read_file(filename, fatal_on_open, override)
for (;;) { for (;;) {
char *str, *kf_name, *read_ahead,*compile_with; char *str, *kf_name, *read_ahead,*compile_with;
extern char *get_word(),*get_quoted_word(); extern char *get_word(),*get_quoted_word();
int token, optional,driver,config_depend, is_dup,filetype; int token, optional,driver,needs_count,config_depend, is_dup,filetype;
struct name_expr *depends_on,*requires; struct name_expr *depends_on,*requires;
struct file_list *tp,*tmp, *fl,*pf; struct file_list *tp,*tmp, *fl,*pf;
enum {BEFORE_FILENAME,BEFORE_SPEC,BEFORE_DEPENDS,PAST_DEPENDS, enum {BEFORE_FILENAME,BEFORE_SPEC,BEFORE_DEPENDS,PAST_DEPENDS,
@ -430,7 +432,7 @@ read_file(filename, fatal_on_open, override)
} }
parse_state = BEFORE_FILENAME; parse_state = BEFORE_FILENAME;
kf_name = read_ahead = compile_with = NULL; kf_name = read_ahead = compile_with = NULL;
optional= driver = config_depend = filetype =0; optional= driver = config_depend = filetype = needs_count = 0;
depends_on = requires = NULL; depends_on = requires = NULL;
is_dup = 0; is_dup = 0;
while ((str != NULL) && (str != (char *)EOF)) { while ((str != NULL) && (str != (char *)EOF)) {
@ -471,6 +473,7 @@ read_file(filename, fatal_on_open, override)
} }
case T_DEVICE_DRIVER: { case T_DEVICE_DRIVER: {
driver = 1; driver = 1;
needs_count = 0;
break; break;
} }
case T_REQUIRES: { case T_REQUIRES: {
@ -481,6 +484,10 @@ read_file(filename, fatal_on_open, override)
continue; continue;
break; break;
} }
case T_NEEDS_COUNT: {
if (!driver) needs_count = 1;
break;
}
default: default:
parse_err("unexpected token"); parse_err("unexpected token");
} }
@ -510,18 +517,26 @@ read_file(filename, fatal_on_open, override)
if (!optional) { if (!optional) {
if (driver) if (driver)
parse_err("'standard' incompatible with 'device-driver'"); parse_err("'standard' incompatible with 'device-driver'");
if (depends_on) if (depends_on && !needs_count)
parse_err("'standard' can't have dependencies"); parse_err("'standard' can't have dependencies");
} }
else if (!depends_on) else if (!depends_on)
parse_err("'optional' requires dependency specification"); parse_err("'optional' requires dependency specification");
if (driver && !is_simple(depends_on)) if (driver) {
parse_err("device-driver's must have a singular name"); if (!is_simple(depends_on))
if (driver && eq("profiling-routine", depends_on->name)) parse_err("device-driver's must have a singular name");
parse_err("not a valid device-driver name"); if (eq("profiling-routine", depends_on->name))
parse_err("not a valid device-driver name");
}
if (needs_count) {
if (!is_simple(depends_on))
parse_err("needs-count's must have a singular name");
if (eq("profiling-routine", depends_on->name))
parse_err("not a valid name for needs-count");
}
if (is_simple(depends_on) && if (is_simple(depends_on) &&
eq("profiling-routine", depends_on->name)) filetype = PROFILING; eq("profiling-routine", depends_on->name)) filetype = PROFILING;
else if (depend_check(depends_on,0)) filetype = NORMAL; else if (!optional || depend_check(depends_on,0)) filetype = NORMAL;
else filetype = INVISIBLE; else filetype = INVISIBLE;
if (filetype == NORMAL && requires && !depend_check(requires,0)) { if (filetype == NORMAL && requires && !depend_check(requires,0)) {
@ -536,8 +551,13 @@ read_file(filename, fatal_on_open, override)
tp->f_type = filetype; tp->f_type = filetype;
if (driver) if (driver)
tp->f_needs = depends_on->name; tp->f_needs = depends_on->name;
else tp->f_needs = NULL; /* memory leak */ else tp->f_needs = NULL; /* memory leak if doesn't need count */
if (needs_count)
tp->f_countname = depends_on->name;
else
tp->f_countname = NULL;
tp->f_was_driver = driver; tp->f_was_driver = driver;
tp->f_needs_count = needs_count;
tp->f_special = compile_with; tp->f_special = compile_with;
tp->f_flags = 0; tp->f_flags = 0;
tp->f_flags |= (config_depend ? CONFIGDEP : 0); tp->f_flags |= (config_depend ? CONFIGDEP : 0);

View File

@ -48,8 +48,10 @@ struct file_list {
u_char f_type; /* see below */ u_char f_type; /* see below */
u_char f_flags; /* see below */ u_char f_flags; /* see below */
u_char f_was_driver; /* to handle un-included pseudo-drivers*/ u_char f_was_driver; /* to handle un-included pseudo-drivers*/
u_char f_needs_count; /* to handle un-included pseudo-drivers*/
char *f_special; /* special make rule if present */ char *f_special; /* special make rule if present */
char *f_needs; char *f_needs;
char *f_countname;
/* /*
* Random values: * Random values:
* swap space parameters for swap areas * swap space parameters for swap areas

View File

@ -51,6 +51,8 @@ headers()
for (fl = ftab; fl != 0; fl = fl->f_next) for (fl = ftab; fl != 0; fl = fl->f_next)
if (fl->f_was_driver) if (fl->f_was_driver)
do_count(fl->f_needs, fl->f_needs, 1); do_count(fl->f_needs, fl->f_needs, 1);
else if (fl->f_needs_count)
do_count(fl->f_countname, fl->f_countname, 1);
} }
/* /*

View File

@ -17,6 +17,7 @@
#define EXPR_GROUP 11 #define EXPR_GROUP 11
#define T_LEFTPAREN 12 #define T_LEFTPAREN 12
#define T_RIGHTPAREN 13 #define T_RIGHTPAREN 13
#define T_NEEDS_COUNT 14
#define is_paren(x) ((x == '(') || (x == ')')) #define is_paren(x) ((x == '(') || (x == ')'))
struct file_keyword { struct file_keyword {
@ -30,7 +31,8 @@ struct file_keyword {
"or", T_OR, "or", T_OR,
"not", T_NOT, "not", T_NOT,
"requires", T_REQUIRES, "requires", T_REQUIRES,
"standard", T_STANDARD "standard", T_STANDARD,
"needs-count", T_NEEDS_COUNT,
}; };
extern struct file_list *fltail_lookup(),*new_fent(),*fl_lookup(); extern struct file_list *fltail_lookup(),*new_fent(),*fl_lookup();
@ -405,7 +407,7 @@ read_file(filename, fatal_on_open, override)
for (;;) { for (;;) {
char *str, *kf_name, *read_ahead,*compile_with; char *str, *kf_name, *read_ahead,*compile_with;
extern char *get_word(),*get_quoted_word(); extern char *get_word(),*get_quoted_word();
int token, optional,driver,config_depend, is_dup,filetype; int token, optional,driver,needs_count,config_depend, is_dup,filetype;
struct name_expr *depends_on,*requires; struct name_expr *depends_on,*requires;
struct file_list *tp,*tmp, *fl,*pf; struct file_list *tp,*tmp, *fl,*pf;
enum {BEFORE_FILENAME,BEFORE_SPEC,BEFORE_DEPENDS,PAST_DEPENDS, enum {BEFORE_FILENAME,BEFORE_SPEC,BEFORE_DEPENDS,PAST_DEPENDS,
@ -430,7 +432,7 @@ read_file(filename, fatal_on_open, override)
} }
parse_state = BEFORE_FILENAME; parse_state = BEFORE_FILENAME;
kf_name = read_ahead = compile_with = NULL; kf_name = read_ahead = compile_with = NULL;
optional= driver = config_depend = filetype =0; optional= driver = config_depend = filetype = needs_count = 0;
depends_on = requires = NULL; depends_on = requires = NULL;
is_dup = 0; is_dup = 0;
while ((str != NULL) && (str != (char *)EOF)) { while ((str != NULL) && (str != (char *)EOF)) {
@ -471,6 +473,7 @@ read_file(filename, fatal_on_open, override)
} }
case T_DEVICE_DRIVER: { case T_DEVICE_DRIVER: {
driver = 1; driver = 1;
needs_count = 0;
break; break;
} }
case T_REQUIRES: { case T_REQUIRES: {
@ -481,6 +484,10 @@ read_file(filename, fatal_on_open, override)
continue; continue;
break; break;
} }
case T_NEEDS_COUNT: {
if (!driver) needs_count = 1;
break;
}
default: default:
parse_err("unexpected token"); parse_err("unexpected token");
} }
@ -510,18 +517,26 @@ read_file(filename, fatal_on_open, override)
if (!optional) { if (!optional) {
if (driver) if (driver)
parse_err("'standard' incompatible with 'device-driver'"); parse_err("'standard' incompatible with 'device-driver'");
if (depends_on) if (depends_on && !needs_count)
parse_err("'standard' can't have dependencies"); parse_err("'standard' can't have dependencies");
} }
else if (!depends_on) else if (!depends_on)
parse_err("'optional' requires dependency specification"); parse_err("'optional' requires dependency specification");
if (driver && !is_simple(depends_on)) if (driver) {
parse_err("device-driver's must have a singular name"); if (!is_simple(depends_on))
if (driver && eq("profiling-routine", depends_on->name)) parse_err("device-driver's must have a singular name");
parse_err("not a valid device-driver name"); if (eq("profiling-routine", depends_on->name))
parse_err("not a valid device-driver name");
}
if (needs_count) {
if (!is_simple(depends_on))
parse_err("needs-count's must have a singular name");
if (eq("profiling-routine", depends_on->name))
parse_err("not a valid name for needs-count");
}
if (is_simple(depends_on) && if (is_simple(depends_on) &&
eq("profiling-routine", depends_on->name)) filetype = PROFILING; eq("profiling-routine", depends_on->name)) filetype = PROFILING;
else if (depend_check(depends_on,0)) filetype = NORMAL; else if (!optional || depend_check(depends_on,0)) filetype = NORMAL;
else filetype = INVISIBLE; else filetype = INVISIBLE;
if (filetype == NORMAL && requires && !depend_check(requires,0)) { if (filetype == NORMAL && requires && !depend_check(requires,0)) {
@ -536,8 +551,13 @@ read_file(filename, fatal_on_open, override)
tp->f_type = filetype; tp->f_type = filetype;
if (driver) if (driver)
tp->f_needs = depends_on->name; tp->f_needs = depends_on->name;
else tp->f_needs = NULL; /* memory leak */ else tp->f_needs = NULL; /* memory leak if doesn't need count */
if (needs_count)
tp->f_countname = depends_on->name;
else
tp->f_countname = NULL;
tp->f_was_driver = driver; tp->f_was_driver = driver;
tp->f_needs_count = needs_count;
tp->f_special = compile_with; tp->f_special = compile_with;
tp->f_flags = 0; tp->f_flags = 0;
tp->f_flags |= (config_depend ? CONFIGDEP : 0); tp->f_flags |= (config_depend ? CONFIGDEP : 0);