[psnames] Really fix issue #49949. We now use a separate preprocessor macro to handle both definition and declaration of the glyph name arrays. * src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro. * src/tools/glnames.py (StringTable::dump, StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'. (dump_encoding): Ditto. (main): Use `wb' mode for writing the output file, which works on Windows also. * src/psnames/pstables.h: Regenerated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
diff --git a/ChangeLog b/ChangeLog
index 6c64854..c512808 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2017-08-08 Werner Lemberg <wl@gnu.org>
+
+ [psnames] Really fix issue #49949.
+
+ We now use a separate preprocessor macro to handle both definition
+ and declaration of the glyph name arrays.
+
+ * src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro.
+
+ * src/tools/glnames.py (StringTable::dump,
+ StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'.
+ (dump_encoding): Ditto.
+ (main): Use `wb' mode for writing the output file, which works on
+ Windows also.
+
+ * src/psnames/pstables.h: Regenerated.
+
2017-08-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Harmony LCD rendering.
@@ -25,7 +42,7 @@
* src/sftnt/ttpost.c (format): Use otspec-compliant versions.
-2017-06-27 Werner Lemberg <wl@gnu.org>
+2017-08-05 Werner Lemberg <wl@gnu.org>
[truetype] Integer overflow.
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 3ff8cb9..44ba9ec 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -23,8 +23,21 @@
#include "psmodule.h"
+ /*
+ * The file `pstables.h' with its arrays and its function
+ * `ft_get_adobe_glyph_index' is useful for other projects also (for
+ * example, `pdfium' is using it). However, if used as a C++ header,
+ * including it in two different source files makes it necessary to use
+ * `extern const' for the declaration of its arrays, otherwise the data
+ * would be duplicated as mandated by the C++ standard.
+ *
+ * For this reason, we use `DEFINE_PS_TABLES' to guard the function
+ * definitions, and `DEFINE_PS_TABLES_DATA' to provide both proper array
+ * declarations and definitions.
+ */
#include "pstables.h"
#define DEFINE_PS_TABLES
+#define DEFINE_PS_TABLES_DATA
#include "pstables.h"
#include "psnamerr.h"
diff --git a/src/psnames/pstables.h b/src/psnames/pstables.h
index e0f5e30..2a2b717 100644
--- a/src/psnames/pstables.h
+++ b/src/psnames/pstables.h
@@ -19,7 +19,7 @@
/* This file has been generated automatically -- do not edit! */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -27,7 +27,7 @@
#endif
#endif
const char ft_standard_glyph_names[3696]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
'.','n','u','l','l', 0,
@@ -451,7 +451,7 @@
'R','o','m','a','n', 0,
'S','e','m','i','b','o','l','d', 0,
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
@@ -459,7 +459,7 @@
/* Values are offsets into the `ft_standard_glyph_names' table */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -467,7 +467,7 @@
#endif
#endif
const short ft_mac_names[FT_NUM_MAC_NAMES]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
253, 0, 6, 261, 267, 274, 283, 294, 301, 309, 758, 330, 340, 351,
@@ -490,7 +490,7 @@
1270,1313,1323,1171,1290,1332,1211,1235,1276, 169, 175, 182, 189, 200,
209, 218, 225, 232, 239, 246
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
@@ -498,7 +498,7 @@
/* Values are offsets into the `ft_standard_glyph_names' table */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -506,7 +506,7 @@
#endif
#endif
const short ft_sid_names[FT_NUM_SID_NAMES]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
253, 261, 267, 274, 283, 294, 301, 309, 319, 330, 340, 351, 360, 365,
@@ -538,12 +538,12 @@
3418,3430,3442,3454,3471,3483,3498,3506,3518,3530,3542,3559,3574,3586,
3597,3612,3620,3628,3636,3644,3650,3655,3660,3666,3673,3681,3687
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
/* the following are indices into the SID name table */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -551,7 +551,7 @@
#endif
#endif
const unsigned short t1_standard_encoding[256]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -571,12 +571,12 @@
0,138, 0,139, 0, 0, 0, 0,140,141,142,143, 0, 0, 0, 0,
0,144, 0, 0, 0,145, 0, 0,146,147,148,149, 0, 0, 0, 0
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
/* the following are indices into the SID name table */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -584,7 +584,7 @@
#endif
#endif
const unsigned short t1_expert_encoding[256]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -604,7 +604,7 @@
347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,
363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
@@ -619,7 +619,7 @@
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -627,7 +627,7 @@
#endif
#endif
const unsigned char ft_adobe_glyph_list[55997L]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23,
@@ -4131,7 +4131,7 @@
182,117, 2,218,167,218,178,232,233,242,225,231,225,238, 97,128,
48, 90,235,225,244,225,235,225,238, 97,128, 48,186
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
diff --git a/src/tools/glnames.py b/src/tools/glnames.py
index 9ed1588..3270eeb 100644
--- a/src/tools/glnames.py
+++ b/src/tools/glnames.py
@@ -4920,7 +4920,7 @@ class StringTable:
def dump( self, file ):
write = file.write
- write( "#ifndef DEFINE_PS_TABLES\n" )
+ write( "#ifndef DEFINE_PS_TABLES_DATA\n" )
write( "#ifdef __cplusplus\n" )
write( ' extern "C"\n' )
write( "#else\n" )
@@ -4929,7 +4929,7 @@ class StringTable:
write( "#endif\n" )
write( " const char " + self.master_table +
"[" + repr( self.total ) + "]\n" )
- write( "#ifdef DEFINE_PS_TABLES\n" )
+ write( "#ifdef DEFINE_PS_TABLES_DATA\n" )
write( " =\n" )
write( " {\n" )
@@ -4941,7 +4941,7 @@ class StringTable:
write( line )
write( " }\n" )
- write( "#endif /* DEFINE_PS_TABLES */\n" )
+ write( "#endif /* DEFINE_PS_TABLES_DATA */\n" )
write( " ;\n\n\n" )
def dump_sublist( self, file, table_name, macro_name, sublist ):
@@ -4950,7 +4950,7 @@ class StringTable:
write( " /* Values are offsets into the `" +
self.master_table + "' table */\n\n" )
- write( "#ifndef DEFINE_PS_TABLES\n" )
+ write( "#ifndef DEFINE_PS_TABLES_DATA\n" )
write( "#ifdef __cplusplus\n" )
write( ' extern "C"\n' )
write( "#else\n" )
@@ -4959,7 +4959,7 @@ class StringTable:
write( "#endif\n" )
write( " const short " + table_name +
"[" + macro_name + "]\n" )
- write( "#ifdef DEFINE_PS_TABLES\n" )
+ write( "#ifdef DEFINE_PS_TABLES_DATA\n" )
write( " =\n" )
write( " {\n" )
@@ -4979,7 +4979,7 @@ class StringTable:
write( line )
write( "\n" )
write( " }\n" )
- write( "#endif /* DEFINE_PS_TABLES */\n" )
+ write( "#endif /* DEFINE_PS_TABLES_DATA */\n" )
write( " ;\n\n\n" )
@@ -5213,7 +5213,7 @@ def dump_encoding( file, encoding_name, encoding_list ):
write = file.write
write( " /* the following are indices into the SID name table */\n" )
- write( "#ifndef DEFINE_PS_TABLES\n" )
+ write( "#ifndef DEFINE_PS_TABLES_DATA\n" )
write( "#ifdef __cplusplus\n" )
write( ' extern "C"\n' )
write( "#else\n" )
@@ -5222,7 +5222,7 @@ def dump_encoding( file, encoding_name, encoding_list ):
write( "#endif\n" )
write( " const unsigned short " + encoding_name +
"[" + repr( len( encoding_list ) ) + "]\n" )
- write( "#ifdef DEFINE_PS_TABLES\n" )
+ write( "#ifdef DEFINE_PS_TABLES_DATA\n" )
write( " =\n" )
write( " {\n" )
@@ -5241,14 +5241,14 @@ def dump_encoding( file, encoding_name, encoding_list ):
write( line )
write( "\n" )
write( " }\n" )
- write( "#endif /* DEFINE_PS_TABLES */\n" )
+ write( "#endif /* DEFINE_PS_TABLES_DATA */\n" )
write( " ;\n\n\n" )
def dump_array( the_array, write, array_name ):
"""dumps a given encoding"""
- write( "#ifndef DEFINE_PS_TABLES\n" )
+ write( "#ifndef DEFINE_PS_TABLES_DATA\n" )
write( "#ifdef __cplusplus\n" )
write( ' extern "C"\n' )
write( "#else\n" )
@@ -5257,7 +5257,7 @@ def dump_array( the_array, write, array_name ):
write( "#endif\n" )
write( " const unsigned char " + array_name +
"[" + repr( len( the_array ) ) + "L]\n" )
- write( "#ifdef DEFINE_PS_TABLES\n" )
+ write( "#ifdef DEFINE_PS_TABLES_DATA\n" )
write( " =\n" )
write( " {\n" )
@@ -5282,7 +5282,7 @@ def dump_array( the_array, write, array_name ):
write( line )
write( "\n" )
write( " }\n" )
- write( "#endif /* DEFINE_PS_TABLES */\n" )
+ write( "#endif /* DEFINE_PS_TABLES_DATA */\n" )
write( " ;\n\n\n" )
@@ -5293,7 +5293,7 @@ def main():
print __doc__ % sys.argv[0]
sys.exit( 1 )
- file = open( sys.argv[1], "w\n" )
+ file = open( sys.argv[1], "wb" )
write = file.write
count_sid = len( sid_standard_names )