et_c.awk:
authorRichard Basch <probe@mit.edu>
Thu, 20 Feb 1997 06:36:20 +0000 (06:36 +0000)
committerRichard Basch <probe@mit.edu>
Thu, 20 Feb 1997 06:36:20 +0000 (06:36 +0000)
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

src/util/et/et_c.awk
src/util/et/et_h.awk

index 8e6a1d419b8eec7fcf329ba4fc83aaf9128d3e22..61c711d9c1ffee65ee8ea15146138d0484155242 100644 (file)
@@ -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
 }
index 075ebc39a4839d2ad228f6b8778a19dd3d04ae09..4a635f5c6d77420bfe6db03203be99caf9ac6ccf 100644 (file)
@@ -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
 }