diff options
author | Richard Basch <probe@mit.edu> | 1997-02-20 06:36:20 +0000 |
---|---|---|
committer | Richard Basch <probe@mit.edu> | 1997-02-20 06:36:20 +0000 |
commit | dc379c9d5736eb20835409df1c138040ace11e50 (patch) | |
tree | be6abc3b867f869e1e0ceeaf6778e3dd12b79ec8 | |
parent | 9d8c34f6ddf2a5c684289d0a5e7d764344d7824d (diff) | |
download | krb5-dc379c9d5736eb20835409df1c138040ace11e50.tar.gz krb5-dc379c9d5736eb20835409df1c138040ace11e50.tar.xz krb5-dc379c9d5736eb20835409df1c138040ace11e50.zip |
et_c.awk:
By default, the Unix version will still modify the _et_list
variable (MIT com_err compatibility)
Also, because et_XXX_error_table (struct error_table) is a
global variable, no initialization/cleanup routine needs to
be declared. The initialization routine is defined to be
a no-op on all platforms but Unix to avoid compilation errors
of a lot of the tree.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9932 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/util/et/et_c.awk | 33 | ||||
-rw-r--r-- | src/util/et/et_h.awk | 12 |
2 files changed, 24 insertions, 21 deletions
diff --git a/src/util/et/et_c.awk b/src/util/et/et_c.awk index 8e6a1d419..61c711d9c 100644 --- a/src/util/et/et_c.awk +++ b/src/util/et/et_c.awk @@ -209,24 +209,19 @@ END { tab_base_low, table_item_count) > outfile } print "" > outfile - print "typedef long errcode_t;" > outfile - print "" > outfile - print "extern KRB5_DLLIMP errcode_t KRB5_CALLCONV" > outfile - print " add_error_table P((const struct error_table FAR *));" > outfile - print "extern KRB5_DLLIMP errcode_t KRB5_CALLCONV" > outfile - print " remove_error_table P((const struct error_table FAR *));" > outfile - print "" > outfile - print "static int init = 0;" > outfile - print "" > outfile - print "void initialize_" table_name "_error_table P((void)) {" > outfile - print " if (init) return;" > outfile - print " init++;" > outfile - print " add_error_table(&et_" table_name "_error_table);" > outfile - print "}" > outfile - print "" > outfile - print "void cleanup_" table_name "_error_table P((void)) {" > outfile - print " if (!init) return;" > outfile - print " init--;" > outfile - print " remove_error_table(&et_" table_name "_error_table);" > outfile + print "#ifdef unix" > outfile + print "struct et_list {" > outfile + print " struct et_list *next;" > outfile + print " const struct error_table * table;" > outfile + print "};" > outfile + print "extern struct et_list *_et_list;" > outfile + print "static struct et_list link = { 0, 0 };" > outfile + print "void initialize_" table_name "_error_table (NOARGS) {" > outfile + print " if (!link.table) {" > outfile + print " link.next = _et_list;" > outfile + print " link.table = &et;" > outfile + print " _et_list = &link;" > outfile + print " }" > outfile print "}" > outfile + print "#endif" > outfile } diff --git a/src/util/et/et_h.awk b/src/util/et/et_h.awk index 075ebc39a..4a635f5c6 100644 --- a/src/util/et/et_h.awk +++ b/src/util/et/et_h.awk @@ -110,6 +110,9 @@ c2n["_"]=63 print " * " outfile ":" > outfile print " * This file is automatically generated; please do not edit it." > outfile print " */" > outfile + print "" > outfile + print "#include <com_err.h>" > outfile + print "" > outfile } /^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,/ { @@ -133,8 +136,6 @@ c2n["_"]=63 } END { - print "extern void initialize_" table_name "_error_table ();" > outfile - print "extern void cleanup_" table_name "_error_table ();" > outfile if (tab_base_high == 0) { print "#define ERROR_TABLE_BASE_" table_name " (" \ sprintf("%d", tab_base_sign*tab_base_low) \ @@ -145,7 +146,14 @@ END { tab_base_low) "L)" > outfile } print "" > outfile + print "extern struct error_table et_" table_name "_error_table;" > outfile + print "" > outfile + print "#ifdef unix" > outfile print "/* for compatibility with older versions... */" > outfile + print "extern void initialize_" table_name "_error_table ();" > outfile print "#define init_" table_name "_err_tbl initialize_" table_name "_error_table" > outfile print "#define " table_name "_err_base ERROR_TABLE_BASE_" table_name > outfile + print "#else" > outfile + print "#define initialize_" table_name "_error_table()" > outfile + print "#endif" > outfile } |