1
# This awk script parses C input files looking for lines marked "PUBLIC:"
2
# and "EXTERN:". (PUBLIC lines are DB internal function prototypes and
3
# #defines, EXTERN are DB external function prototypes and #defines.)
5
# PUBLIC lines are put into two versions of per-directory include files:
6
# one file that contains the prototypes, and one file that contains a
7
# #define for the name to be processed during configuration when creating
8
# unique names for every global symbol in the DB library.
10
# The EXTERN lines are put into two files: one of which contains prototypes
11
# which are always appended to the db.h file, and one of which contains a
12
# #define list for use when creating unique symbol names.
15
# e_dfile list of EXTERN #defines
16
# e_pfile include file that contains EXTERN prototypes
17
# i_dfile list of internal (PUBLIC) #defines
18
# i_pfile include file that contains internal (PUBLIC) prototypes
20
sub("^.*PUBLIC:[ ][ ]*", "")
21
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
26
pline = sprintf("%s %s", pline, $0)
28
sub("^[ ]*", "", pline)
29
print pline >> i_pfile
30
if (pline !~ db_version_unique_name) {
31
def = gensub("[ ][ ]*__P.*", "", 1, pline)
32
sub("^.*[ ][*]*", "", def)
33
printf("#define %s %s@DB_VERSION_UNIQUE_NAME@\n",
40
# When we switched to methods in 4.0, we guessed txn_{abort,begin,commit}
41
# were the interfaces applications would likely use and not be willing to
42
# change, due to the sheer volume of the calls. Provide wrappers -- we
43
# could do txn_abort and txn_commit using macros, but not txn_begin, as
44
# the name of the field is txn_begin, we didn't want to modify it.
46
# The issue with txn_begin hits us in another way. If configured with the
47
# --with-uniquename option, we use #defines to re-define DB's interfaces
48
# to unique names. We can't do that for these functions because txn_begin
49
# is also a field name in the DB_ENV structure, and the #defines we use go
50
# at the end of the db.h file -- we get control too late to #define a field
51
# name. So, modify the script that generates the unique names #defines to
52
# not generate them for these three functions, and don't include the three
53
# functions in libraries built with that configuration option.
55
sub("^.*EXTERN:[ ][ ]*", "")
56
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
61
eline = sprintf("%s %s", eline, $0)
63
sub("^[ ]*", "", eline)
64
print eline >> e_pfile
65
if (eline !~ db_version_unique_name && eline !~ "^int txn_") {
66
def = gensub("[ ][ ]*__P.*", "", 1, eline)
67
sub("^.*[ ][*]*", "", def)
68
printf("#define %s %s@DB_VERSION_UNIQUE_NAME@\n",