[R-gregmisc-users] SF.net SVN: r-gregmisc:[1838] trunk/SASxport/src/writeSAS.h
Brought to you by:
warnes
From: <wa...@us...> - 2014-07-18 17:03:50
|
Revision: 1838 http://sourceforge.net/p/r-gregmisc/code/1838 Author: warnes Date: 2014-07-18 17:03:46 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Re-ename optimization on BIG_ENDIAN systems Modified Paths: -------------- trunk/SASxport/src/writeSAS.h Modified: trunk/SASxport/src/writeSAS.h =================================================================== --- trunk/SASxport/src/writeSAS.h 2014-07-18 15:29:30 UTC (rev 1837) +++ trunk/SASxport/src/writeSAS.h 2014-07-18 17:03:46 UTC (rev 1838) @@ -5,7 +5,7 @@ * Author: Gregory R. Warnes <gr...@wa...> * * Copyright (C) 2007 Gregory R. Warnes <gr...@wa...> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -33,23 +33,21 @@ /***** - * Useful constants + * Useful constants *****/ #define MISSING 0x2e000000 /* Standard SAS missing value: '.' */ /***** REVERSE macro, used as a wrapper for the reverse() function to avoid - compiling/calling it on little-endian. + compiling/calling it on big-endian, where it is a NOOP. *****/ -/* #ifdef BIG_ENDIAN */ -/* # define REVERSE(a,b) */ -/* #elif defined(LITTLE_ENDIAN) */ -/* # define REVERSE(a,b) reverse( (unsigned char*) a, (size_t) b) */ -/* #else */ -# define REVERSE(a,b) reverse( (unsigned char*) a, (size_t) b) -/*#endif*/ +#if ( defined(BIG_ENDIAN) && BIG_ENDIAN ) || ( defined(LITTLE_ENDIAN) && !LITTLE_ENDIAN ) +# define REVERSE(a,b) ( a ) +#else +# define REVERSE(a,b) reverse( (unsigned char*) a, (size_t) b ) +#endif /***** * Useful macro functions @@ -64,7 +62,7 @@ /***** - * File Record Structures + * File Record Structures *****/ struct FILE_HEADER { @@ -73,7 +71,7 @@ /* Line 2 */ char sas_symbol1[8]; - char sas_symbol2[8]; + char sas_symbol2[8]; char saslib[8]; char sasver[8]; char sas_os[8]; @@ -98,12 +96,12 @@ char sasdata[8]; char sasver[8]; char sas_osname[8]; - char blanks[24]; + char blanks[24]; char sas_create[16]; /* Line 4 */ char sas_modified[16]; - //char blanks2[64]; + //char blanks2[64]; char padding[16]; char dslabel[40]; char dstype[8]; @@ -124,7 +122,7 @@ short nvar0; /* VARNUM */ char nname[8]; /* NAME OF VARIABLE */ char nlabel[40]; /* LABEL OF VARIABLE */ - + char nform[8]; /* NAME OF FORMAT */ short nfl; /* FORMAT FIELD LENGTH OR 0 */ short nfd; /* FORMAT NUMBER OF DECIMALS */ @@ -137,7 +135,7 @@ short nifd; /* INFORMAT NUMBER OF DECIMALS */ int npos; /* POSITION OF VALUE IN OBSERVATION */ - + char rest[52]; /* remaining fields are irrelevant */ }; @@ -157,18 +155,18 @@ void zeroCopy(char *target, int len, char *source); void fill_file_header(char **cDate, char **mDate, char **sasVer, char **osType); -void fill_member_header(char **dfName, char **sasVer, char **osType, char **cDate, +void fill_member_header(char **dfName, char **sasVer, char **osType, char **cDate, char **mDate, char **dfLabel, char **dfType); -void fill_namestr(int *isChar, int *nlng, int *nvar0, char **nname, char **nlabel, - char **nform, int *nfl, int *nfd, int *nfj, char **niform, +void fill_namestr(int *isChar, int *nlng, int *nvar0, char **nname, char **nlabel, + char **nform, int *nfl, int *nfd, int *nfj, char **niform, int *nifl, int *nifd, int *npos); void fill_namestr_header(char **nvar); void fill_obs_header(); void fill_numeric_field(double *value); -void fill_character_field(char **value, int *width); +void fill_character_field(char **value, int *width); void fill_numeric_NA(); void fill_space(int *type, int *width); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |