ACTIVEPERL_VERSION used to be a string and so fails =822 test

2007-09-14 Thread Suresh Govindachar

  Jan Dubois wrote:
  
   should be written more general like this:
  
 /* ActivePerl build 822 still identifies itself as 5.8.8 but 
  * already contains many of the changes from the upcoming 
  * Perl 5.8.9 release.
  */
 #if (ACTIVEPERL_VERSION = 822)
 #  define PERL589_OR_LATER
 #endif
 #if (PERL_REVISION == 5)  (PERL_VERSION == 8)  (PERL_SUBVERSION = 9)
 #  define PERL589_OR_LATER
 #endif
 #if (PERL_REVISION == 5)  (PERL_VERSION = 10))
 #  define PERL589_OR_LATER
 #endif
  
   And then later you just check for PERL589_OR_LATER
  
  #ifdef PERL589_OR_LATER 
  ...
  #endif

  Your suggestions were incorporated in if_perl.xs, but older
  versions of perl define

 #define ACTIVEPERL_VERSION Built  __DATE__   __TIME__

  and compilers complain about the test to compare
  ACTIVEPERL_VERSION with a number.

  One would use eq in perl, but this is C pre-processing -- how 
  could one check if ACTIVEPERL_VERSION = 822?

  Thanks,

  --Suresh


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: ACTIVEPERL_VERSION used to be a string and so fails =822 test

2007-09-14 Thread Suresh Govindachar

  ACTIVEPERL_VERSION is a string in older versions of ActivePerl.
  Googling showed ACTIVEPERL_VERSION as a number in 5.8.7 build 813;
  and we are only concerned with later buids of 5.8.8.  So I decided 
  to use the following guard:
   
  #if (PERL_REVISION == 5)  (PERL_VERSION == 8)  (PERL_SUBVERSION = 8) 
  #  if (ACTIVEPERL_VERSION = 822)
  #define PERL589_OR_LATER
  #  endif
  #endif


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Big endian C to perl on x86 of binary file into structure

2007-09-14 Thread Suresh Govindachar

Hello,

  The following code is meant for a Big-endian processor running
  linux.  The code reads binary files and assigns values to
  structures.  I would like to read the same data files in perl on
  Windows on little endian x86.  Any tips on doing the translation?

typedef struct s_str_boo
{
unsigned short  type;  
int   x;   
int   y;   
int   w;   
int   h;   
int   v1;  
int   v2;  
unsigned short  s1; 
unsigned short  s2;  
} str_boo;

typedef struct s_str_foo 
{
unsigned int   aui;
str_booboo[16];
unsigned short aus;
struct s_str_foo  *next;
} str_foo;


file = fopen(foo.dat, r+b);

fread((void*)an_uint, sizeof(char), sizeof(unsigned int), file);
fread((void*)tmpfoo,   sizeof(char), sizeof(str_foo), file);

  Thanks,

  --Suresh


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs