Commit 29a90e2610ad5dc93ae4fc24e37a74bbe751f834

Werner Lemberg 2000-08-03T00:03:08

Updating unix/ftconfig.in to recent config/ftconfig.h changes. More C++ fixes: Introducing LOCAL_FUNC_X for local functions used in function pointers (there are no local anonymous functions in C++) and FT_CPLUSPLUS (instead of FT_EXPORT_VAR) to define linkage of structures which contain function pointers.

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
341
342
343
344
345
346
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in
index e1c02b0..f73804a 100644
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -144,33 +144,98 @@
 
 
 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
-#define  LOCAL_DEF   static
-#define  LOCAL_FUNC  static
+
+#define LOCAL_DEF   static
+#define LOCAL_FUNC  static
+
+#else
+
+#ifdef __cplusplus
+#define LOCAL_DEF   extern "C"
+#define LOCAL_FUNC  extern "C"
 #else
-#define  LOCAL_DEF   extern
-#define  LOCAL_FUNC  /* nothing */
+#define LOCAL_DEF   extern
+#define LOCAL_FUNC  extern
 #endif
 
-#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT
-#define  BASE_DEF( x )   static  x
-#define  BASE_FUNC( x )  static  x
+#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
+
+
+#ifndef BASE_DEF
+
+#ifdef __cplusplus
+#define BASE_DEF( x )  extern "C"  x
 #else
-#define  BASE_DEF( x )   extern  x
-#define  BASE_FUNC( x )  extern  x
+#define BASE_DEF( x )  extern  x
 #endif
 
-#ifndef  FT_EXPORT_DEF
-#define  FT_EXPORT_DEF( x )   extern  x
+#endif /* !BASE_DEF */
+
+
+#ifndef BASE_FUNC
+
+#ifdef __cplusplus
+#define BASE_FUNC( x )  extern "C"  x
+#else
+#define BASE_FUNC( x )  extern  x
+#endif
+
+#endif /* !BASE_FUNC */
+
+
+#ifndef FT_EXPORT_DEF
+
+#ifdef __cplusplus
+#define FT_EXPORT_DEF( x )  extern "C"  x
+#else
+#define FT_EXPORT_DEF( x )  extern  x
 #endif
 
-#ifndef  FT_EXPORT_FUNC
-#define  FT_EXPORT_FUNC( x )  extern  x
+#endif /* !FT_EXPORT_DEF */
+
+
+#ifndef FT_EXPORT_FUNC
+
+#ifdef __cplusplus
+#define FT_EXPORT_FUNC( x )  extern "C"  x
+#else
+#define FT_EXPORT_FUNC( x )  extern  x
 #endif
 
-#ifndef  FT_EXPORT_VAR
-#define  FT_EXPORT_VAR( x )   extern  x
+#endif /* !FT_EXPORT_FUNC */
+
+
+#ifndef FT_EXPORT_VAR
+
+#ifdef __cplusplus
+#define FT_EXPORT_VAR( x )  extern "C"  x
+#else
+#define FT_EXPORT_VAR( x )  extern  x
 #endif
 
+#endif /* !FT_EXPORT_VAR */
+
+
+  /* This is special.  Within C++, you must specify `extern "C"' for */
+  /* functions which are used via function pointers, and you also    */
+  /* must do that for structures which contain function pointers to  */
+  /* assure C linkage -- it's not possible to have (local) anonymous */
+  /* functions which are accessed by (global) function pointers.     */
+  /*                                                                 */
+#ifdef __cplusplus
+
+#define LOCAL_FUNC_X  extern "C"
+
+#define FT_CPLUSPLUS( x )  extern "C"  x
+
+#else
+
+#define LOCAL_FUNC_X  static
+
+#define FT_CPLUSPLUS( x )  x
+
+#endif /* __cplusplus */
+
 
 #ifdef __cplusplus
   }
diff --git a/builds/unix/ftsystem.c b/builds/unix/ftsystem.c
index ceeff3f..570afa1 100644
--- a/builds/unix/ftsystem.c
+++ b/builds/unix/ftsystem.c
@@ -92,7 +92,7 @@
   /* <Return>                                                              */
   /*    block  :: The address of newly allocated block.                    */
   /*                                                                       */
-  static
+  LOCAL_FUNC_X
   void*  ft_alloc( FT_Memory  memory,
                    long       size )
   {
@@ -122,7 +122,7 @@
   /* <Return>                                                              */
   /*    The address of the reallocated memory block.                       */
   /*                                                                       */
-  static
+  LOCAL_FUNC_X
   void*  ft_realloc( FT_Memory  memory,
                      long       cur_size,
                      long       new_size,
@@ -148,7 +148,7 @@
   /*                                                                       */
   /*    block   :: The address of block in memory to be freed.             */
   /*                                                                       */
-  static
+  LOCAL_FUNC_X
   void  ft_free( FT_Memory  memory,
                  void*      block )
   {
@@ -190,7 +190,7 @@
   /* <Input>                                                               */
   /*    stream :: A pointer to the stream object.                          */
   /*                                                                       */
-  static
+  LOCAL_FUNC_X
   void  ft_close_stream( FT_Stream  stream )
   {
     munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size );
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index a2e9842..11e697e 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -231,6 +231,27 @@
 #endif /* !FT_EXPORT_VAR */
 
 
+  /* This is special.  Within C++, you must specify `extern "C"' for */
+  /* functions which are used via function pointers, and you also    */
+  /* must do that for structures which contain function pointers to  */
+  /* assure C linkage -- it's not possible to have (local) anonymous */
+  /* functions which are accessed by (global) function pointers.     */
+  /*                                                                 */
+#ifdef __cplusplus
+
+#define LOCAL_FUNC_X  extern "C"
+
+#define FT_CPLUSPLUS( x )  extern "C"  x
+
+#else
+
+#define LOCAL_FUNC_X  static
+
+#define FT_CPLUSPLUS( x )  x
+
+#endif /* __cplusplus */
+
+
 #ifdef __cplusplus
   }
 #endif
diff --git a/src/autohint/ahmodule.c b/src/autohint/ahmodule.c
index 255d542..20a37ef 100644
--- a/src/autohint/ahmodule.c
+++ b/src/autohint/ahmodule.c
@@ -55,7 +55,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   FT_Error  ft_autohinter_load( FT_AutoHinter  module,
                                 FT_GlyphSlot   slot,
                                 FT_Size        size,
@@ -67,7 +67,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   void   ft_autohinter_reset( FT_AutoHinter  module,
                               FT_Face        face )
   {
@@ -78,7 +78,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   void  ft_autohinter_get_globals( FT_AutoHinter  module,
                                    FT_Face        face,
                                    void**         global_hints,
@@ -89,7 +89,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   void  ft_autohinter_done_globals( FT_AutoHinter  module,
                                     void*          global_hints )
   {
@@ -107,7 +107,7 @@
   };
 
 
-  FT_EXPORT_VAR( const FT_Module_Class )  autohint_module_class =
+  FT_CPLUSPLUS( const FT_Module_Class ) autohint_module_class =
   {
     ft_module_hinter,
     sizeof ( FT_AutoHinterRec ),
diff --git a/src/cff/t2driver.c b/src/cff/t2driver.c
index ab6c20f..9e3ca48 100644
--- a/src/cff/t2driver.c
+++ b/src/cff/t2driver.c
@@ -302,7 +302,7 @@
 
   /* The FT_DriverInterface structure is defined in ftdriver.h. */
 
-  FT_EXPORT_VAR( const FT_Driver_Class )  cff_driver_class =
+  FT_CPLUSPLUS( const FT_Driver_Class )  cff_driver_class =
   {
     /* begin with the FT_Module_Class fields */
     {
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 59eeb0b..b512bef 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -163,7 +163,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   FT_Error  parse_font_bbox( CID_Face     face,
                              CID_Parser*  parser )
   {
@@ -182,7 +182,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   FT_Error  parse_font_matrix( CID_Face     face,
                                CID_Parser*  parser )
   {
@@ -208,7 +208,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   FT_Error  parse_fd_array( CID_Face     face,
                             CID_Parser*  parser )
   {
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c
index b4f0fd7..224b0c6 100644
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -182,7 +182,7 @@
   }
 
 
-  FT_EXPORT_VAR( const FT_Driver_Class )  t1cid_driver_class =
+  FT_CPLUSPLUS( const FT_Driver_Class )  t1cid_driver_class =
   {
     /* first of all, the FT_Module_Class fields */
     {
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 448ea18..7bd5349 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -139,7 +139,7 @@
 
 
   /* qsort callback to sort the unicode map */
-  static
+  LOCAL_FUNC_X
   int  compare_uni_maps( const void*  a,
                          const void*  b )
   {
@@ -296,7 +296,7 @@
 #endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */
 
 
-  FT_EXPORT_VAR( const FT_Module_Class )  psnames_module_class =
+  FT_CPLUSPLUS( const FT_Module_Class )  psnames_module_class =
   {
     0,  /* this is not a font driver, nor a renderer */
     sizeof( FT_ModuleRec ),
diff --git a/src/raster1/ftrend1.c b/src/raster1/ftrend1.c
index 9364864..8916105 100644
--- a/src/raster1/ftrend1.c
+++ b/src/raster1/ftrend1.c
@@ -213,7 +213,7 @@
   }
 
 
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_raster1_renderer_class =
+  FT_CPLUSPLUS( const FT_Renderer_Class )  ft_raster1_renderer_class =
   {
     {
       ft_module_renderer,
@@ -245,7 +245,7 @@
   /* to register it by hand in your application.  It should only be    */
   /* used for backwards-compatibility with FT 1.x anyway.              */
   /*                                                                   */
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_raster5_renderer_class =
+  FT_CPLUSPLUS( const FT_Renderer_Class )  ft_raster5_renderer_class =
   {
     {
       ft_module_renderer,
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index dfeb711..908e09e 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -122,7 +122,7 @@
 #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
 
 
-  static
+  LOCAL_FUNC_X
   FT_Module_Interface  SFNT_Get_Interface( FT_Module    module,
                                            const char*  interface )
   {
@@ -204,7 +204,7 @@
   };
 
 
-  FT_EXPORT_VAR( const FT_Module_Class )  sfnt_module_class =
+  FT_CPLUSPLUS( const FT_Module_Class )  sfnt_module_class =
   {
     0,  /* not a font driver or renderer */
     sizeof( FT_ModuleRec ),
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index 87ad04f..0a3024e 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -43,14 +43,14 @@
 #define FT_COMPONENT  trace_ttcmap
 
 
-  static FT_UInt  code_to_index0( TT_CMapTable*  charmap,
-                                  FT_ULong       char_code );
-  static FT_UInt  code_to_index2( TT_CMapTable*  charmap,
-                                  FT_ULong       char_code );
-  static FT_UInt  code_to_index4( TT_CMapTable*  charmap,
-                                  FT_ULong       char_code );
-  static FT_UInt  code_to_index6( TT_CMapTable*  charmap,
-                                  FT_ULong       char_code );
+  LOCAL_FUNC_X FT_UInt  code_to_index0( TT_CMapTable*  charmap,
+                                        FT_ULong       char_code );
+  LOCAL_FUNC_X FT_UInt  code_to_index2( TT_CMapTable*  charmap,
+                                        FT_ULong       char_code );
+  LOCAL_FUNC_X FT_UInt  code_to_index4( TT_CMapTable*  charmap,
+                                        FT_ULong       char_code );
+  LOCAL_FUNC_X FT_UInt  code_to_index6( TT_CMapTable*  charmap,
+                                        FT_ULong       char_code );
 
 
   /*************************************************************************/
@@ -355,7 +355,7 @@
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
-  static
+  LOCAL_FUNC_X
   FT_UInt  code_to_index0( TT_CMapTable*  cmap,
                            FT_ULong       charCode )
   {
@@ -381,7 +381,7 @@
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
-  static
+  LOCAL_FUNC_X
   FT_UInt  code_to_index2( TT_CMapTable*  cmap,
                            FT_ULong       charCode )
   {
@@ -445,7 +445,7 @@
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
-  static
+  LOCAL_FUNC_X
   FT_UInt  code_to_index4( TT_CMapTable*  cmap,
                            FT_ULong       charCode )
   {
@@ -528,7 +528,7 @@
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
-  static
+  LOCAL_FUNC_X
   FT_UInt  code_to_index6( TT_CMapTable*  cmap,
                            FT_ULong       charCode )
   {
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index f040846..e0a6785 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -189,7 +189,7 @@
   }
 
 
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_smooth_renderer_class =
+  FT_CPLUSPLUS( const FT_Renderer_Class )  ft_smooth_renderer_class =
   {
     {
       ft_module_renderer,
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 9e19f28..522df0b 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -430,7 +430,7 @@
 
   /* The FT_DriverInterface structure is defined in ftdriver.h. */
 
-  FT_EXPORT_VAR( const FT_Driver_Class )  tt_driver_class =
+  FT_CPLUSPLUS( const FT_Driver_Class )  tt_driver_class =
   {
     {
       ft_module_font_driver     |
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 963ecd6..8adaf58 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -207,7 +207,7 @@
   /*                                                                       */
   /*************************************************************************/
 
-  static
+  LOCAL_FUNC_X
   FT_Error  TT_Access_Glyph_Frame( TT_Loader*  loader,
                                    FT_UInt     glyph_index,
                                    FT_ULong    offset,
@@ -227,7 +227,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   void  TT_Forget_Glyph_Frame( TT_Loader*  loader )
   {
     FT_Stream  stream = loader->stream;
@@ -237,7 +237,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   FT_Error  TT_Load_Glyph_Header( TT_Loader*  loader )
   {
     FT_Stream   stream = loader->stream;
@@ -260,7 +260,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   FT_Error  TT_Load_Simple_Glyph( TT_Loader*  load )
   {
     FT_Error         error;
@@ -419,7 +419,7 @@
   }
 
 
-  static
+  LOCAL_FUNC_X
   FT_Error  TT_Load_Composite_Glyph( TT_Loader*  loader )
   {
     FT_Error         error;
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 603546c..764f080 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -324,7 +324,7 @@
 
 
 
-  FT_EXPORT_VAR( const FT_Driver_Class )  t1_driver_class =
+  FT_CPLUSPLUS( const FT_Driver_Class )  t1_driver_class =
   {
     {
       ft_module_font_driver | ft_module_driver_scalable,
diff --git a/src/type1z/z1afm.c b/src/type1z/z1afm.c
index b329cd3..e47349c 100644
--- a/src/type1z/z1afm.c
+++ b/src/type1z/z1afm.c
@@ -149,7 +149,7 @@
 
 
   /* compare two kerning pairs */
-  static
+  LOCAL_FUNC_X
   int  compare_kern_pairs( const void*  a,
                            const void*  b )
   {
diff --git a/src/type1z/z1driver.c b/src/type1z/z1driver.c
index ef6570d..11990d8 100644
--- a/src/type1z/z1driver.c
+++ b/src/type1z/z1driver.c
@@ -283,7 +283,7 @@
   }
 
 
-  FT_EXPORT_VAR( const FT_Driver_Class )  t1_driver_class =
+  FT_CPLUSPLUS( const FT_Driver_Class )  t1_driver_class =
   {
     {
       ft_module_font_driver | ft_module_driver_scalable,
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 99f29e8..7e467ed 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -588,7 +588,7 @@
   }
 
 
-  FT_EXPORT_VAR( const FT_Driver_Class )  winfnt_driver_class =
+  FT_CPLUSPLUS( const FT_Driver_Class )  winfnt_driver_class =
   {
     {
       ft_module_font_driver,