version_gen.awk (156772) | version_gen.awk (168963) |
---|---|
1# 2# Copyright (C) 2006 Daniel M. Eischen. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23# SUCH DAMAGE. 24# | 1# 2# Copyright (C) 2006 Daniel M. Eischen. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23# SUCH DAMAGE. 24# |
25# $FreeBSD: head/share/mk/version_gen.awk 156772 2006-03-16 15:12:26Z deischen $ | 25# $FreeBSD: head/share/mk/version_gen.awk 168963 2007-04-23 03:24:33Z deischen $ |
26# 27 28# 29# Make a list of all the library versions listed in the master file. 30# 31# versions[] - array indexed by version name, contains number 32# of symbols (+ 1) found for each version. 33# successors[] - array index by version name, contains successor --- 14 unchanged lines hidden (view full) --- 48 # Strip trailing spaces. 49 sub(" *$", "", $0); 50 51 if (/^[ \t]*[a-zA-Z0-9._]+ *{/) { 52 brackets++; 53 symver = $1; 54 versions[symver] = 1; 55 successors[symver] = ""; | 26# 27 28# 29# Make a list of all the library versions listed in the master file. 30# 31# versions[] - array indexed by version name, contains number 32# of symbols (+ 1) found for each version. 33# successors[] - array index by version name, contains successor --- 14 unchanged lines hidden (view full) --- 48 # Strip trailing spaces. 49 sub(" *$", "", $0); 50 51 if (/^[ \t]*[a-zA-Z0-9._]+ *{/) { 52 brackets++; 53 symver = $1; 54 versions[symver] = 1; 55 successors[symver] = ""; |
56 generated[symver] = 0; |
|
56 version_count++; 57 } 58 else if (/^[ \t]*} *[a-zA-Z0-9._]+ *;/) { 59 # Strip semicolon. 60 gsub(";", "", $2); 61 if (symver == "") 62 printf("Unmatched bracket.\n"); 63 else if (versions[$2] != 1) --- 72 unchanged lines hidden (view full) --- 136} 137 138 139/.*/ { 140 printf("File %s, line %d: Unknown directive: '%s'\n", 141 FILENAME, FNR, $0) > stderr; 142} 143 | 57 version_count++; 58 } 59 else if (/^[ \t]*} *[a-zA-Z0-9._]+ *;/) { 60 # Strip semicolon. 61 gsub(";", "", $2); 62 if (symver == "") 63 printf("Unmatched bracket.\n"); 64 else if (versions[$2] != 1) --- 72 unchanged lines hidden (view full) --- 137} 138 139 140/.*/ { 141 printf("File %s, line %d: Unknown directive: '%s'\n", 142 FILENAME, FNR, $0) > stderr; 143} 144 |
145function print_version(v) 146{ 147 # This function is recursive, so return if this version 148 # has already been printed. Otherwise, if there is an 149 # ancestral version, recursively print its symbols before 150 # printing the symbols for this version. 151 # 152 if (generated[v] == 1) 153 return; 154 if (successors[v] != "") 155 print_version(successors[v]); 156 157 printf("%s {\n", v); 158 159 # The version count is always one more that actual, 160 # so the loop ranges from 1 to n-1. 161 # 162 for (i = 1; i < versions[v]; i++) { 163 if (i == 1) 164 printf("global:\n"); 165 printf("\t%s\n", symbols[v, i]); 166 } 167 if (successors[v] == "") { 168 # This version succeeds no other version. 169 printf("local:\n"); 170 printf("\t*;\n"); 171 printf("};\n"); 172 } 173 else 174 printf("} %s;\n", successors[v]); 175 printf("\n"); 176 177 generated[v] = 1; 178 } |
|
144END { 145 for (v in versions) { | 179END { 180 for (v in versions) { |
146 printf("\n"); 147 printf("%s {\n", v); 148 149 # The version count is always one more that actual, 150 # so the loop ranges from 1 to n-1. 151 # 152 for (i = 1; i < versions[v]; i++) { 153 if (i == 1) 154 printf("global:\n"); 155 printf("\t%s\n", symbols[v, i]); 156 } 157 if (successors[v] == "") { 158 # This version succeeds no other version. 159 printf("local:\n"); 160 printf("\t*;\n"); 161 printf("};\n"); 162 } 163 else 164 printf("} %s;\n", successors[v]); | 181 print_version(v); |
165 } 166} | 182 } 183} |