Update ooo320-m1
[ooovba.git] / i18npool / source / localedata / data / linkermapfile-check.awk
blobbaa703a3468e119cac793356c15ff583a826b611
1 #!/usr/bin/gawk -f
2 # Usage: gawk -f linkermapfile-check.awk *.map *.xml
3 # Order of *.map *.xml is important, otherwise all symbols are reported to be
4 # missing.
5 # Checks if all symbols of all locale data are present in the symbol scoping
6 # linker mapfiles. Any output indicates a missing symbol, ../localedata.cxx is
7 # grep'ed to indicate the library to which mapfile the symbol should be added.
8 # Author: Eike Rathke <er@openoffice.org>
10 BEGIN {
11 bAnyMissing = 0
12 file = ""
13 nMap = 0
14 nMaps = 0
15 nPublics = 0
16 sPublic[nPublics++] = "getAllCalendars_"
17 sPublic[nPublics++] = "getAllCurrencies_"
18 sPublic[nPublics++] = "getAllFormats0_"
19 bOptional[nPublics] = 1 # getAllFormats1 most times not present
20 sPublic[nPublics++] = "getAllFormats1_"
21 sPublic[nPublics++] = "getBreakIteratorRules_"
22 sPublic[nPublics++] = "getCollationOptions_"
23 sPublic[nPublics++] = "getCollatorImplementation_"
24 sPublic[nPublics++] = "getContinuousNumberingLevels_"
25 sPublic[nPublics++] = "getForbiddenCharacters_"
26 sPublic[nPublics++] = "getLCInfo_"
27 sPublic[nPublics++] = "getLocaleItem_"
28 sPublic[nPublics++] = "getOutlineNumberingLevels_"
29 sPublic[nPublics++] = "getReservedWords_"
30 sPublic[nPublics++] = "getSearchOptions_"
31 sPublic[nPublics++] = "getTransliterations_"
32 sPublic[nPublics++] = "getIndexAlgorithm_"
33 sPublic[nPublics++] = "getUnicodeScripts_"
34 sPublic[nPublics++] = "getFollowPageWords_"
37 file != FILENAME {
38 file = FILENAME
39 if ( file ~ /\.map$/ )
41 sMapFile[nMaps] = file
42 nMap = nMaps
43 ++nMaps
45 else if ( file ~ /\.xml$/ )
47 bOut = 0
48 n = split( file, arr, /[:\\\/.]/ )
49 locale = arr[n-1]
50 for ( i=0; i<nPublics; ++i )
52 symbol = sPublic[i] locale ";"
53 bFound = 0
54 for ( j=0; j<nMaps && !bFound; ++j )
56 if ( sSymbol[j,symbol] )
57 bFound = 1
59 if ( !bFound && bOptional[i] )
61 print symbol " not present but optional"
62 bFound = 1
64 if ( !bFound )
66 if ( !bOut )
68 search = "\"" locale "\""
69 while ( !bOut && (getline <"../localedata.cxx") > 0 )
71 if ( $0 ~ search )
73 bOut = 1
74 print "../localedata.cxx says this should go into: " $0
77 close( "../localedata.cxx" )
78 if ( !bOut )
79 print "../localedata.cxx doesn't indicate to which lib this belongs to:"
80 bOut = 1
82 print symbol
85 if ( bOut)
87 printf("\n")
88 bAnyMissing = 1
90 nextfile
92 else
93 nextfile
96 # only reached if .map file encountered, read in symbols
98 if ( $1 ~ /;$/ )
99 sSymbol[nMap,$1] = 1
102 END {
103 if ( !bAnyMissing )
104 print "All good." >>"/dev/stderr"