tioga 1.8 → 1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/Tioga_README +46 -11
  2. data/split/Dtable/dtable.c +2 -2
  3. data/split/Dtable/dvector.h +8 -0
  4. data/split/Dtable/namespace.h +16 -8
  5. data/split/Dtable/symbols.h +1 -1
  6. data/split/Dvector/dvector.c +77 -2
  7. data/split/Dvector/dvector_intern.h +2 -0
  8. data/split/Dvector/include/dvector.h +8 -0
  9. data/split/Dvector/lib/Dvector_extras.rb +12 -0
  10. data/split/Dvector/namespace.h +16 -8
  11. data/split/Dvector/symbols.h +1 -1
  12. data/split/Flate/namespace.h +16 -8
  13. data/split/Flate/symbols.h +1 -1
  14. data/split/Function/dvector.h +8 -0
  15. data/split/Function/function.c +2 -1
  16. data/split/Function/namespace.h +16 -8
  17. data/split/Function/symbols.h +1 -1
  18. data/split/Tioga/axes.c +217 -75
  19. data/split/Tioga/dvector.h +8 -0
  20. data/split/Tioga/figures.c +19 -2
  21. data/split/Tioga/figures.h +7 -6
  22. data/split/Tioga/generic.c +14 -1
  23. data/split/Tioga/generic.h +13 -0
  24. data/split/Tioga/init.c +5 -9
  25. data/split/Tioga/lib/Colormaps.rb +33 -2
  26. data/split/Tioga/lib/Doc.rb +30 -0
  27. data/split/Tioga/lib/Executive.rb +4 -2
  28. data/split/Tioga/lib/FigMkr.rb +219 -53
  29. data/split/Tioga/lib/Figures_and_Plots.rb +7 -0
  30. data/split/Tioga/lib/Images.rb +10 -2
  31. data/split/Tioga/lib/Legends.rb +7 -3
  32. data/split/Tioga/lib/Markers.rb +7 -0
  33. data/split/Tioga/lib/TexPreamble.rb +56 -56
  34. data/split/Tioga/lib/Utils.rb +7 -0
  35. data/split/Tioga/lib/maker.rb +1 -0
  36. data/split/Tioga/lib/tioga_ui_cmds.rb +6 -5
  37. data/split/Tioga/namespace.h +16 -8
  38. data/split/Tioga/pdfcolor.c +63 -7
  39. data/split/Tioga/pdfcoords.c +0 -16
  40. data/split/Tioga/pdfimage.c +16 -2
  41. data/split/Tioga/pdfs.h +1 -0
  42. data/split/Tioga/pdftext.c +223 -82
  43. data/split/Tioga/symbols.h +1 -1
  44. data/split/Tioga/texout.c +1 -1
  45. data/split/Tioga/wrappers.c +21 -10
  46. data/split/Tioga/wrappers.h +5 -0
  47. data/split/extconf.rb +27 -15
  48. data/split/namespace.h +16 -8
  49. data/split/scripts/tioga +0 -0
  50. data/split/symbols.h +1 -1
  51. data/tests/Icon_Test.pdf +0 -0
  52. data/tests/tc_Dvector.rb +24 -0
  53. metadata +38 -37
data/Tioga_README CHANGED
@@ -21,14 +21,41 @@ This is the README for the Tioga kernel, version 1.8, April 4, 2008.
21
21
 
22
22
  << What's new >>
23
23
 
24
- Version 1.8 is essentially a cleanup/bug fix release. Tioga now compiles
25
- with hardly any warnings, thanks to the work by Taro Sato. show_axis can now
26
- take a hash instead of a simple location, and can draw axes basically
27
- anywhere. See the axes_fun function in samples/plots/plots.rb and
28
- show_axis documentation. Few bugs were fixed, in particular the
29
- position of ticks with ticks_inside/ticks_outside, and the
30
- installation via Rubygems which was broken for such a long time we are
31
- ashamed of it.
24
+ Version 1.9:
25
+
26
+ zlib's source has been included again to fix compilation problems on
27
+ MacOS. The embedded copy will only be used if tioga does not manage to
28
+ link to the system one.
29
+
30
+ It is now possible to use directly a HLS image using 'color_space' =
31
+ 'HLS' as argument to show_image.
32
+
33
+ A new ticks placement algorithm was written. You can benefit from it
34
+ by saying t.vincent_or_bill = true.
35
+
36
+ You can now use the optional argument to show_legend to draw a
37
+ background (or anything else) to a legend. The information given to
38
+ the callback will only be accurate if t.measure_legends = true. See
39
+ samples/plots.rb
40
+ (Legend_Inside_with_Background_using_legend_background) for more
41
+ information. Accordingly, you can use legend_text_width to know the
42
+ legend's text maximal width.
43
+
44
+ A new utility function was written, show_grid, that draws a grid
45
+ according to major and optionally minor ticks of the current axes.
46
+
47
+ show_marker can now take arrays for 'marker' and 'color', and cycles
48
+ through them while plotting.
49
+
50
+ Some top-level convenience functions have been added:
51
+ FigureMaker.exec, FigureMaker.make_pdf,
52
+ FigureMaker.def_enter_page_function, FigureMaker.page_style that work
53
+ on the default FigureMaker.
54
+
55
+ show_plot_without_clipping, obviously a non-clipping version of
56
+ show_plot.
57
+
58
+ And all corresponding demonstrations in the samples/ directory !
32
59
 
33
60
 
34
61
  << Quick Installation of Tioga >>
@@ -177,6 +204,17 @@ Bill Paxton
177
204
 
178
205
  Here are the old release messages:
179
206
 
207
+ --------------------------
208
+
209
+ Version 1.8 is essentially a cleanup/bug fix release. Tioga now compiles
210
+ with hardly any warnings, thanks to the work by Taro Sato. show_axis can now
211
+ take a hash instead of a simple location, and can draw axes basically
212
+ anywhere. See the axes_fun function in samples/plots/plots.rb and
213
+ show_axis documentation. Few bugs were fixed, in particular the
214
+ position of ticks with ticks_inside/ticks_outside, and the
215
+ installation via Rubygems which was broken for such a long time we are
216
+ ashamed of it.
217
+
180
218
 
181
219
  --------------------------
182
220
 
@@ -205,9 +243,6 @@ than before.
205
243
 
206
244
  Code should now compile cleanly with Ruby 1.9.
207
245
 
208
-
209
-
210
-
211
246
  --------------------------
212
247
 
213
248
  Version 1.6 adds numeric label "frequency" and "phase" attributes for
@@ -1843,6 +1843,7 @@ PUBLIC void Init_Dtable() {
1843
1843
 
1844
1844
  /* nonstandard math functions */
1845
1845
  rb_define_method(cDtable, "neg", dtable_neg, 0);
1846
+ rb_define_alias(cDtable, "-@", "neg");
1846
1847
  rb_define_method(cDtable, "exp10", dtable_exp10, 0);
1847
1848
  rb_define_method(cDtable, "inv", dtable_inv, 0);
1848
1849
  rb_define_method(cDtable, "trim", dtable_trim, -1);
@@ -1914,8 +1915,7 @@ PUBLIC void Init_Dtable() {
1914
1915
  RB_EXPORT_SYMBOL(cDtable, Dtable_Ptr);
1915
1916
 
1916
1917
  /* now we import the symbols from Dvector */
1917
-
1918
- VALUE cDvector = rb_define_class_under(mDobjects, "Dvector", rb_cObject);
1918
+ VALUE cDvector = rb_const_get(mDobjects, rb_intern("Dvector"));
1919
1919
  RB_IMPORT_SYMBOL(cDvector, Dvector_Create);
1920
1920
  RB_IMPORT_SYMBOL(cDvector, Dvector_Data_Resize);
1921
1921
  RB_IMPORT_SYMBOL(cDvector, Dvector_Data_Replace);
@@ -31,6 +31,13 @@
31
31
 
32
32
  /* functions for handling Dvectors: */
33
33
 
34
+ DECLARE_SYMBOL(bool, isa_Dvector, (VALUE obj));
35
+ /* returns true if the obj is a Dvector */
36
+ DECLARE_SYMBOL(long, len_Dvector, (VALUE dvector));
37
+ /* returns length of the dvector */
38
+ DECLARE_SYMBOL(double, access_Dvector, (VALUE dvector, long idx));
39
+ /* returns the value of entry idx in dvector */
40
+
34
41
  DECLARE_SYMBOL(double *, Dvector_Data_for_Read, (VALUE dvector, long *len_ptr));
35
42
  /* returns pointer to the dvector's data (which may be shared) */
36
43
  DECLARE_SYMBOL(double *, Dvector_Data_Copy, (VALUE dvector, long *len_ptr));
@@ -46,6 +53,7 @@ DECLARE_SYMBOL(void, Dvector_Store_Double, (VALUE ary, long idx, double val));
46
53
  /* pushes one element onto the vector */
47
54
  DECLARE_SYMBOL(void, Dvector_Push_Double, (VALUE ary, double val));
48
55
 
56
+
49
57
  /* functions for interpolation */
50
58
  DECLARE_SYMBOL(double, c_dvector_spline_interpolate,
51
59
  (double x, int n_pts_data, double *Xs, double *Ys,
@@ -21,27 +21,35 @@
21
21
  #ifndef _NAMESPACE_H
22
22
  #define _NAMESPACE_H
23
23
 
24
- /* This header file provides two OS-specific macros for the definition of
25
- extern symbols:
24
+ /* This header file provides three OS-specific macros for the definition of
25
+ extern (or NOT extern) symbols:
26
26
 
27
27
  * PUBLIC, which has to be used to mark objects that will be used
28
- outside the module
28
+ outside the module
29
29
 
30
- * PRIVATE, for symbols which are "extern" but intern to the module
30
+ * INTERN, for symbols which are shared among compilation units within a
31
+ module, but are NOT exported to other modules.
32
+
33
+ * PRIVATE, for symbols which are visible only within the containing
34
+ compilation unit (i.e. C source file) and, of course, are not exported to
35
+ other modules.
31
36
 
32
37
  Please don't add "extern" after the PRIVATE or PUBLIC declaration
33
38
  as this would break compilation on Darwin.
34
39
  */
35
40
 
36
- #ifdef __APPLE__
41
+ #if __GNUC__ >= 4 /* we have the visibility attribute */
42
+ # define INTERN __attribute__ ((visibility ("hidden")))
43
+ # define PUBLIC __attribute__ ((visibility ("default")))
44
+ # define INTERN_EXTERN extern
45
+ #elif defined __APPLE__
37
46
  # define INTERN __private_extern__
38
47
  # define PUBLIC
39
- #elif __GNUC__ >= 4 /* we have the visibility attribute */
40
- # define INTERN __attribute__ ((visibility ("hidden")))
41
- # define PUBLIC __attribute__ ((visibility ("default")))
48
+ # define INTERN_EXTERN
42
49
  #else /* not really good */
43
50
  # define INTERN
44
51
  # define PUBLIC
52
+ # define INTERN_EXTERN
45
53
  #endif /* __APPLE__ and __GNU_C_ >= 4*/
46
54
 
47
55
  /* In any case, PRIVATE is static */
@@ -22,7 +22,7 @@ PRIVATE void * rb_import_symbol_no_raise(VALUE module,
22
22
 
23
23
  #define DECLARE_SYMBOL(ret_type,name,args) \
24
24
  typedef ret_type (*rb_export_##name##_type) args;\
25
- INTERN rb_export_##name##_type name
25
+ INTERN INTERN_EXTERN rb_export_##name##_type name
26
26
 
27
27
  #define IMPLEMENT_SYMBOL(name)\
28
28
  INTERN rb_export_##name##_type name = 0;
@@ -1971,6 +1971,53 @@ VALUE dvector_delete_at_m(VALUE ary, VALUE pos) {
1971
1971
  return dvector_delete_at(ary, NUM2LONG(pos));
1972
1972
  }
1973
1973
 
1974
+ PRIVATE
1975
+ /*
1976
+ * call-seq:
1977
+ * dvector.prune(lst) -> dvector
1978
+ *
1979
+ * Creates a new dvector without the entries given by the indexes in _lst_.
1980
+ *
1981
+ * a = Dvector.new(5) {|i| i*3 } -> [0, 3, 6, 9, 12]
1982
+ * a.prune([0, 2]) -> [3, 9, 12]
1983
+ * a -> [0, 3, 6, 9, 12]
1984
+ */
1985
+ VALUE dvector_prune(VALUE ary, VALUE lst) {
1986
+ ary = dvector_dup(ary);
1987
+ dvector_prune_bang(ary, lst);
1988
+ return ary;
1989
+ }
1990
+
1991
+ PRIVATE
1992
+ /*
1993
+ * call-seq:
1994
+ * dvector.prune!(lst) -> dvector
1995
+ *
1996
+ * Modifies the dvector by removing the entries given by the indexes in _lst_.
1997
+ *
1998
+ * a = Dvector.new(5) {|i| i*3 } -> [0, 3, 6, 9, 12]
1999
+ * a.prune!([0, 2]) -> [3, 9, 12]
2000
+ * a -> [3, 9, 12]
2001
+ */
2002
+ VALUE dvector_prune_bang(VALUE ary, VALUE lst) {
2003
+ Dvector *d;
2004
+ d = dvector_modify(ary);
2005
+ int i, lst_len, ary_len, pos, j;
2006
+ VALUE *lst_ptr;
2007
+ lst = rb_Array(lst);
2008
+ lst_ptr = RARRAY(lst)->ptr;
2009
+ lst_len = RARRAY(lst)->len;
2010
+ for (i = lst_len-1; i >= 0; i--) {
2011
+ ary_len = d->len;
2012
+ pos = NUM2INT(lst_ptr[i]); // remove this one from ary
2013
+ for (j = pos+1; j < ary_len; j++, pos++) {
2014
+ d->ptr[pos] = d->ptr[j];
2015
+ }
2016
+ d->len = pos;
2017
+ }
2018
+ return ary;
2019
+ }
2020
+
1974
2021
  PRIVATE
1975
2022
  /*
1976
2023
  * call-seq:
@@ -1999,7 +2046,8 @@ PRIVATE
1999
2046
  VALUE dvector_slice_bang(int argc, VALUE *argv, VALUE ary) {
2000
2047
  VALUE arg1, arg2;
2001
2048
  long pos, len;
2002
- Dvector *d = Get_Dvector(ary);
2049
+ Dvector *d;
2050
+ d = dvector_modify(ary);
2003
2051
  if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) {
2004
2052
  pos = NUM2LONG(arg1);
2005
2053
  len = NUM2LONG(arg2);
@@ -4533,7 +4581,7 @@ VALUE Read_Rows_of_Dvectors(char *filename, VALUE destinations, int first_row_of
4533
4581
  double v, *row_data;
4534
4582
  int buff_len = 1000;
4535
4583
  char *buff, *num_str, *pend, c, *cptr;
4536
- int num_rows = 0, i, row, col, buff_loc, c_loc, skip = first_row_of_file - 1;
4584
+ int num_rows = 0, i, row, col, buff_loc, skip = first_row_of_file - 1;
4537
4585
  rows_obj = rb_Array(destinations);
4538
4586
  num_rows = RARRAY(rows_obj)->len;
4539
4587
  rows_ptr = RARRAY(rows_obj)->ptr;
@@ -4740,6 +4788,27 @@ VALUE dvector_read_row(int argc, VALUE *argv, VALUE klass) {
4740
4788
 
4741
4789
  /* C API functions */
4742
4790
 
4791
+ bool isa_Dvector(VALUE dvector) {
4792
+ return Is_Dvector(dvector);
4793
+ }
4794
+
4795
+ long len_Dvector(VALUE dvector) {
4796
+ Dvector *d = Get_Dvector(dvector);
4797
+ return d->len;
4798
+ }
4799
+
4800
+ double access_Dvector(VALUE dvector, long offset) {
4801
+ Dvector *d = Get_Dvector(dvector);
4802
+ if (d->len == 0) return 0.0;
4803
+ if (offset < 0) {
4804
+ offset += d->len;
4805
+ }
4806
+ if (offset < 0 || d->len <= offset) {
4807
+ return 0.0;
4808
+ }
4809
+ return d->ptr[offset];
4810
+ }
4811
+
4743
4812
  double *Dvector_Data_for_Read(VALUE dvector, long *len_ptr) { /* returns pointer to the dvector's data (which may be shared) */
4744
4813
  Dvector *d = Get_Dvector(dvector);
4745
4814
  if(len_ptr)
@@ -5522,6 +5591,8 @@ void Init_Dvector() {
5522
5591
  rb_define_method(cDvector, "sort!", dvector_sort_bang, 0);
5523
5592
  rb_define_method(cDvector, "collect", dvector_collect, 0);
5524
5593
  rb_define_method(cDvector, "collect!", dvector_collect_bang, 0);
5594
+ rb_define_method(cDvector, "prune", dvector_prune, 1);
5595
+ rb_define_method(cDvector, "prune!", dvector_prune_bang, 1);
5525
5596
  rb_define_alias(cDvector, "map", "collect");
5526
5597
  rb_define_alias(cDvector, "map!", "collect!");
5527
5598
  rb_define_method(cDvector, "dup", dvector_dup, 0);
@@ -5640,6 +5711,7 @@ void Init_Dvector() {
5640
5711
 
5641
5712
  /* nonstandard math functions */
5642
5713
  rb_define_method(cDvector, "neg", dvector_neg, 0);
5714
+ rb_define_alias(cDvector, "-@", "neg");
5643
5715
  rb_define_method(cDvector, "exp10", dvector_exp10, 0);
5644
5716
  rb_define_method(cDvector, "inv", dvector_inv, 0);
5645
5717
  rb_define_method(cDvector, "trim", dvector_trim, -1);
@@ -5729,6 +5801,9 @@ void Init_Dvector() {
5729
5801
  /* now, the fun part: exporting binary symbols.
5730
5802
  see include/dvector.h for their meaning
5731
5803
  */
5804
+ RB_EXPORT_SYMBOL(cDvector, isa_Dvector);
5805
+ RB_EXPORT_SYMBOL(cDvector, len_Dvector);
5806
+ RB_EXPORT_SYMBOL(cDvector, access_Dvector);
5732
5807
  RB_EXPORT_SYMBOL(cDvector, Dvector_Data_for_Read);
5733
5808
  RB_EXPORT_SYMBOL(cDvector, Dvector_Data_Copy);
5734
5809
  RB_EXPORT_SYMBOL(cDvector, Dvector_Data_for_Write);
@@ -110,6 +110,8 @@ PRIVATE VALUE dvector_values_at(int argc, VALUE *argv, VALUE ary);
110
110
  PRIVATE VALUE dvector_select(VALUE ary);
111
111
  PRIVATE VALUE dvector_delete(VALUE ary, VALUE item);
112
112
  PRIVATE VALUE dvector_delete_at(VALUE ary, long pos);
113
+ PRIVATE VALUE dvector_prune(VALUE ary, VALUE pos);
114
+ PRIVATE VALUE dvector_prune_bang(VALUE ary, VALUE pos);
113
115
  PRIVATE VALUE dvector_slice_bang(int argc, VALUE *argv, VALUE ary);
114
116
  PRIVATE VALUE dvector_reject_bang(VALUE ary);
115
117
  PRIVATE VALUE dvector_reject(VALUE ary);
@@ -31,6 +31,13 @@
31
31
 
32
32
  /* functions for handling Dvectors: */
33
33
 
34
+ DECLARE_SYMBOL(bool, isa_Dvector, (VALUE obj));
35
+ /* returns true if the obj is a Dvector */
36
+ DECLARE_SYMBOL(long, len_Dvector, (VALUE dvector));
37
+ /* returns length of the dvector */
38
+ DECLARE_SYMBOL(double, access_Dvector, (VALUE dvector, long idx));
39
+ /* returns the value of entry idx in dvector */
40
+
34
41
  DECLARE_SYMBOL(double *, Dvector_Data_for_Read, (VALUE dvector, long *len_ptr));
35
42
  /* returns pointer to the dvector's data (which may be shared) */
36
43
  DECLARE_SYMBOL(double *, Dvector_Data_Copy, (VALUE dvector, long *len_ptr));
@@ -46,6 +53,7 @@ DECLARE_SYMBOL(void, Dvector_Store_Double, (VALUE ary, long idx, double val));
46
53
  /* pushes one element onto the vector */
47
54
  DECLARE_SYMBOL(void, Dvector_Push_Double, (VALUE ary, double val));
48
55
 
56
+
49
57
  /* functions for interpolation */
50
58
  DECLARE_SYMBOL(double, c_dvector_spline_interpolate,
51
59
  (double x, int n_pts_data, double *Xs, double *Ys,
@@ -39,6 +39,18 @@ module Dobjects
39
39
  end
40
40
 
41
41
  class Dvector
42
+
43
+ # thanks to Dave MacMahon for from_na and to_na
44
+ # Create a Dvector from an NArray.
45
+ def Dvector.from_na(na)
46
+ _load([1, na.length, na.to_s].pack('CIa*'))
47
+ end
48
+
49
+ # Create an NArray with the same length and contents as +self+.
50
+ def to_na
51
+ ::NArray.to_na(_dump(nil)[5..-1], ::NArray::DFLOAT)
52
+ end
53
+
42
54
 
43
55
  def to_dvector
44
56
  self
@@ -21,27 +21,35 @@
21
21
  #ifndef _NAMESPACE_H
22
22
  #define _NAMESPACE_H
23
23
 
24
- /* This header file provides two OS-specific macros for the definition of
25
- extern symbols:
24
+ /* This header file provides three OS-specific macros for the definition of
25
+ extern (or NOT extern) symbols:
26
26
 
27
27
  * PUBLIC, which has to be used to mark objects that will be used
28
- outside the module
28
+ outside the module
29
29
 
30
- * PRIVATE, for symbols which are "extern" but intern to the module
30
+ * INTERN, for symbols which are shared among compilation units within a
31
+ module, but are NOT exported to other modules.
32
+
33
+ * PRIVATE, for symbols which are visible only within the containing
34
+ compilation unit (i.e. C source file) and, of course, are not exported to
35
+ other modules.
31
36
 
32
37
  Please don't add "extern" after the PRIVATE or PUBLIC declaration
33
38
  as this would break compilation on Darwin.
34
39
  */
35
40
 
36
- #ifdef __APPLE__
41
+ #if __GNUC__ >= 4 /* we have the visibility attribute */
42
+ # define INTERN __attribute__ ((visibility ("hidden")))
43
+ # define PUBLIC __attribute__ ((visibility ("default")))
44
+ # define INTERN_EXTERN extern
45
+ #elif defined __APPLE__
37
46
  # define INTERN __private_extern__
38
47
  # define PUBLIC
39
- #elif __GNUC__ >= 4 /* we have the visibility attribute */
40
- # define INTERN __attribute__ ((visibility ("hidden")))
41
- # define PUBLIC __attribute__ ((visibility ("default")))
48
+ # define INTERN_EXTERN
42
49
  #else /* not really good */
43
50
  # define INTERN
44
51
  # define PUBLIC
52
+ # define INTERN_EXTERN
45
53
  #endif /* __APPLE__ and __GNU_C_ >= 4*/
46
54
 
47
55
  /* In any case, PRIVATE is static */
@@ -22,7 +22,7 @@ PRIVATE void * rb_import_symbol_no_raise(VALUE module,
22
22
 
23
23
  #define DECLARE_SYMBOL(ret_type,name,args) \
24
24
  typedef ret_type (*rb_export_##name##_type) args;\
25
- INTERN rb_export_##name##_type name
25
+ INTERN INTERN_EXTERN rb_export_##name##_type name
26
26
 
27
27
  #define IMPLEMENT_SYMBOL(name)\
28
28
  INTERN rb_export_##name##_type name = 0;
@@ -21,27 +21,35 @@
21
21
  #ifndef _NAMESPACE_H
22
22
  #define _NAMESPACE_H
23
23
 
24
- /* This header file provides two OS-specific macros for the definition of
25
- extern symbols:
24
+ /* This header file provides three OS-specific macros for the definition of
25
+ extern (or NOT extern) symbols:
26
26
 
27
27
  * PUBLIC, which has to be used to mark objects that will be used
28
- outside the module
28
+ outside the module
29
29
 
30
- * PRIVATE, for symbols which are "extern" but intern to the module
30
+ * INTERN, for symbols which are shared among compilation units within a
31
+ module, but are NOT exported to other modules.
32
+
33
+ * PRIVATE, for symbols which are visible only within the containing
34
+ compilation unit (i.e. C source file) and, of course, are not exported to
35
+ other modules.
31
36
 
32
37
  Please don't add "extern" after the PRIVATE or PUBLIC declaration
33
38
  as this would break compilation on Darwin.
34
39
  */
35
40
 
36
- #ifdef __APPLE__
41
+ #if __GNUC__ >= 4 /* we have the visibility attribute */
42
+ # define INTERN __attribute__ ((visibility ("hidden")))
43
+ # define PUBLIC __attribute__ ((visibility ("default")))
44
+ # define INTERN_EXTERN extern
45
+ #elif defined __APPLE__
37
46
  # define INTERN __private_extern__
38
47
  # define PUBLIC
39
- #elif __GNUC__ >= 4 /* we have the visibility attribute */
40
- # define INTERN __attribute__ ((visibility ("hidden")))
41
- # define PUBLIC __attribute__ ((visibility ("default")))
48
+ # define INTERN_EXTERN
42
49
  #else /* not really good */
43
50
  # define INTERN
44
51
  # define PUBLIC
52
+ # define INTERN_EXTERN
45
53
  #endif /* __APPLE__ and __GNU_C_ >= 4*/
46
54
 
47
55
  /* In any case, PRIVATE is static */