Accept "et" as well as "error_table". Typedef foo_error_number.
Include <foo_err.h> in foo_err.c. Use symbolic names for base and n_msgs. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2124 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
$1 == "error_table" {
|
$1 == "error_table" || $1 == "et" {
|
||||||
name = $2
|
name = $2
|
||||||
base = 0
|
base = 0
|
||||||
for(i = 1; i <= 4; i++){
|
for(i = 1; i <= 4; i++){
|
||||||
@@ -25,6 +25,7 @@ $1 == "error_table" {
|
|||||||
print "#include <stddef.h>" > c_file # NULL
|
print "#include <stddef.h>" > c_file # NULL
|
||||||
print "#include <stdlib.h>" > c_file # malloc
|
print "#include <stdlib.h>" > c_file # malloc
|
||||||
print "#include <error.h>" > c_file
|
print "#include <error.h>" > c_file
|
||||||
|
print "#include <" h_file ">" > c_file
|
||||||
print "" > c_file
|
print "" > c_file
|
||||||
print "static const char *text[] = {" > c_file
|
print "static const char *text[] = {" > c_file
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ $1 == "error_table" {
|
|||||||
print "" > h_file
|
print "" > h_file
|
||||||
print "void initialize_" name "_error_table(struct error_table**);" > h_file
|
print "void initialize_" name "_error_table(struct error_table**);" > h_file
|
||||||
print "" > h_file
|
print "" > h_file
|
||||||
print "enum " name "_error_number{" > h_file
|
print "typedef enum " name "_error_number{" > h_file
|
||||||
print "\tERROR_TABLE_BASE_" name " = " base "," > h_file
|
print "\tERROR_TABLE_BASE_" name " = " base "," > h_file
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
@@ -52,15 +53,15 @@ function end_file(c_file, h_file){
|
|||||||
print " if (et == NULL)" > c_file
|
print " if (et == NULL)" > c_file
|
||||||
print " return;" > c_file
|
print " return;" > c_file
|
||||||
print " et->msgs = text;" > c_file
|
print " et->msgs = text;" > c_file
|
||||||
print " et->n_msgs = " number ";" > c_file
|
print " et->n_msgs = " name "_num_errors;" > c_file
|
||||||
print " et->base = " base ";" > c_file
|
print " et->base = ERROR_TABLE_BASE_" name ";" > c_file
|
||||||
print " et->next = *list;" > c_file
|
print " et->next = *list;" > c_file
|
||||||
print " *list = et;" > c_file
|
print " *list = et;" > c_file
|
||||||
print "}" > c_file
|
print "}" > c_file
|
||||||
close(c_file)
|
close(c_file)
|
||||||
|
|
||||||
print "\t" name "_num_errors = " number > h_file
|
print "\t" name "_num_errors = " number > h_file
|
||||||
print "};" > h_file
|
print "} " name "_error_number;" > h_file
|
||||||
print "" > h_file
|
print "" > h_file
|
||||||
print "#endif /* " H_FILE " */" > h_file
|
print "#endif /* " H_FILE " */" > h_file
|
||||||
close(h_file)
|
close(h_file)
|
||||||
@@ -86,11 +87,10 @@ $1 == "prefix" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$1 == "error_code" {
|
$1 == "error_code" {
|
||||||
code = $0
|
code = $2
|
||||||
sub("error_code[ \t]+", "", code)
|
|
||||||
sub(",.*", "", code)
|
sub(",.*", "", code)
|
||||||
code = prefix code
|
code = prefix code
|
||||||
string = $0
|
string = $tmp
|
||||||
sub("[^,]*,", "", string)
|
sub("[^,]*,", "", string)
|
||||||
sub("[ \t]*", "", string)
|
sub("[ \t]*", "", string)
|
||||||
print_line(code, string, number)
|
print_line(code, string, number)
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
$1 == "error_table" {
|
$1 == "error_table" || $1 == "et" {
|
||||||
name = $2
|
name = $2
|
||||||
base = 0
|
base = 0
|
||||||
for(i = 1; i <= 4; i++){
|
for(i = 1; i <= 4; i++){
|
||||||
@@ -25,6 +25,7 @@ $1 == "error_table" {
|
|||||||
print "#include <stddef.h>" > c_file # NULL
|
print "#include <stddef.h>" > c_file # NULL
|
||||||
print "#include <stdlib.h>" > c_file # malloc
|
print "#include <stdlib.h>" > c_file # malloc
|
||||||
print "#include <error.h>" > c_file
|
print "#include <error.h>" > c_file
|
||||||
|
print "#include <" h_file ">" > c_file
|
||||||
print "" > c_file
|
print "" > c_file
|
||||||
print "static const char *text[] = {" > c_file
|
print "static const char *text[] = {" > c_file
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ $1 == "error_table" {
|
|||||||
print "" > h_file
|
print "" > h_file
|
||||||
print "void initialize_" name "_error_table(struct error_table**);" > h_file
|
print "void initialize_" name "_error_table(struct error_table**);" > h_file
|
||||||
print "" > h_file
|
print "" > h_file
|
||||||
print "enum " name "_error_number{" > h_file
|
print "typedef enum " name "_error_number{" > h_file
|
||||||
print "\tERROR_TABLE_BASE_" name " = " base "," > h_file
|
print "\tERROR_TABLE_BASE_" name " = " base "," > h_file
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
@@ -52,15 +53,15 @@ function end_file(c_file, h_file){
|
|||||||
print " if (et == NULL)" > c_file
|
print " if (et == NULL)" > c_file
|
||||||
print " return;" > c_file
|
print " return;" > c_file
|
||||||
print " et->msgs = text;" > c_file
|
print " et->msgs = text;" > c_file
|
||||||
print " et->n_msgs = " number ";" > c_file
|
print " et->n_msgs = " name "_num_errors;" > c_file
|
||||||
print " et->base = " base ";" > c_file
|
print " et->base = ERROR_TABLE_BASE_" name ";" > c_file
|
||||||
print " et->next = *list;" > c_file
|
print " et->next = *list;" > c_file
|
||||||
print " *list = et;" > c_file
|
print " *list = et;" > c_file
|
||||||
print "}" > c_file
|
print "}" > c_file
|
||||||
close(c_file)
|
close(c_file)
|
||||||
|
|
||||||
print "\t" name "_num_errors = " number > h_file
|
print "\t" name "_num_errors = " number > h_file
|
||||||
print "};" > h_file
|
print "} " name "_error_number;" > h_file
|
||||||
print "" > h_file
|
print "" > h_file
|
||||||
print "#endif /* " H_FILE " */" > h_file
|
print "#endif /* " H_FILE " */" > h_file
|
||||||
close(h_file)
|
close(h_file)
|
||||||
@@ -86,11 +87,10 @@ $1 == "prefix" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$1 == "error_code" {
|
$1 == "error_code" {
|
||||||
code = $0
|
code = $2
|
||||||
sub("error_code[ \t]+", "", code)
|
|
||||||
sub(",.*", "", code)
|
sub(",.*", "", code)
|
||||||
code = prefix code
|
code = prefix code
|
||||||
string = $0
|
string = $tmp
|
||||||
sub("[^,]*,", "", string)
|
sub("[^,]*,", "", string)
|
||||||
sub("[ \t]*", "", string)
|
sub("[ \t]*", "", string)
|
||||||
print_line(code, string, number)
|
print_line(code, string, number)
|
||||||
|
Reference in New Issue
Block a user