discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: version checking


From: Kevin Mitchell
Subject: Fwd: version checking
Date: Wed, 26 Feb 2014 05:54:03 -0800

Thanks, that got me on the right track. It turns out those variables are also defined in GSVersions.h. I decided that it was easier to define  OLD_BEZIER_PATH with the preprocessor since make can't do numeric comparisons by itself:

#if defined(GNUSTEP_GUI_MINOR_VERSION) && GNUSTEP_GUI_MINOR_VERSION < 24
#define OLD_BEZIER_PATH
#endif

and then

#ifdef OLD_BEZIER_PATH
  static float phase=0;
  static const float pattern[2]={5.0,2.0};
#else
  static CGFloat phase=0;
  static const CGFloat pattern[2]={5.0,2.0};
#endif
  [bezierPath setLineDash:pattern count:2 phase:phase];

I'm not sure how close this is to the actual changed version, but it works for the versions that I have available.


On Wed, Feb 26, 2014 at 3:20 AM, Richard Frith-Macdonald <richardfrithmacdonald@gmail.com> wrote:

On 26 Feb 2014, at 10:15, Kevin Mitchell <kevmitch@gmail.com> wrote:

> I have been experimenting with different versions of the GNUstep libraries. I have discovered that somewhere between gnustep-gui=0.20.0-3 (in Debian unstable) and 0.24.0 (the latest svn), the
> -[NSBezierPath setLineDash:(const float *)pattern count:(int)count phase:(float)phase]
> has been fixed to be more consistent with the apple implementation
> -[NSBezierPath setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase]
>
> Previously, I succeeded in compiling code that used this method using both GNUStep and Cocoa with an #ifdef GNUSTEP hack. Of course, this no longer works for the newer gnustep version.
>
> I have tried using something like
>
> #if GS_API_VERSION(012200, GS_API_LATEST)

The above is used by the gnustep headers to control visibility of APIs depending on what version you have declared you want (see gnustep.org/resources/documentation/Developer/Base/Reference/index.html).  That's not what you are trying to do.

> but this doesn't seem to evaluate to false on gnustep-gui=0.20.0
>
> what is the proper way to detect and handle different gnustep versions?

You mean GUI version here ... you want to check what version of GUI you are building against and have your code behave differently for different versions of the GUI.

The information you need is made available within your makefile environment.  The gui.make fragment (installed when gnustep-gui was installed) will have defined something like:

  GNUSTEP_GUI_VERSION = 0.24.0
  GNUSTEP_GUI_MAJOR_VERSION = 0
  GNUSTEP_GUI_MINOR_VERSION = 24
  GNUSTEP_GUI_SUBMINOR_VERSION = 0

These variables are available in the make files in your project;
So you can have your makefile examine the variables and add some define to the flags used when building your code (eg define OLDBEZIERPATH)

Then in your source code you could have:

#if defined(OLDBEZIERPATH)
...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]