From: Richard Basch Date: Thu, 20 Feb 1997 06:36:20 +0000 (+0000) Subject: et_c.awk: X-Git-Tag: krb5-1.1-beta1~1259 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dc379c9d5736eb20835409df1c138040ace11e50;p=krb5.git 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 --- 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 " > 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 }