[R-gregmisc-users] SF.net SVN: r-gregmisc:[1850] trunk/SASxport/src
Brought to you by:
warnes
From: <wa...@us...> - 2014-07-20 02:17:28
|
Revision: 1850 http://sourceforge.net/p/r-gregmisc/code/1850 Author: warnes Date: 2014-07-20 02:17:21 +0000 (Sun, 20 Jul 2014) Log Message: ----------- Finish rename of 'HTOBE' to 'TO_BIGEND' Modified Paths: -------------- trunk/SASxport/src/writeSAS.c trunk/SASxport/src/writeSAS.h Modified: trunk/SASxport/src/writeSAS.c =================================================================== --- trunk/SASxport/src/writeSAS.c 2014-07-20 02:15:13 UTC (rev 1849) +++ trunk/SASxport/src/writeSAS.c 2014-07-20 02:17:21 UTC (rev 1850) @@ -32,9 +32,6 @@ #include "writeSAS.h" - - - /* Fill <target> buffer with <len> blanks without any terminating nulls */ void blankFill(char *target, int len) { @@ -198,7 +195,6 @@ ) { struct NAMESTR_HEADER namestr_header; - char tmpBuf[5]; blankCopy( namestr_header.l1, 54, "HEADER RECORD*******NAMESTR HEADER RECORD!!!!!!!000000"); blankCopy( namestr_header.nvar, 4, nvar[0] ); @@ -260,17 +256,17 @@ zeroFill(namestr_record.rest, 52); /* remaining fields are irrelevant */ - HTOBE_SHORT( namestr_record.ntype ); - HTOBE_SHORT( namestr_record.nhfun ); - HTOBE_SHORT( namestr_record.nlng ); - HTOBE_SHORT( namestr_record.nvar0 ); - HTOBE_SHORT( namestr_record.nfl ); - HTOBE_SHORT( namestr_record.nfd ); - HTOBE_SHORT( namestr_record.nfj ); - HTOBE_SHORT( namestr_record.nifl ); - HTOBE_SHORT( namestr_record.nifd ); + TO_BIGEND_SHORT( namestr_record.ntype ); + TO_BIGEND_SHORT( namestr_record.nhfun ); + TO_BIGEND_SHORT( namestr_record.nlng ); + TO_BIGEND_SHORT( namestr_record.nvar0 ); + TO_BIGEND_SHORT( namestr_record.nfl ); + TO_BIGEND_SHORT( namestr_record.nfd ); + TO_BIGEND_SHORT( namestr_record.nfj ); + TO_BIGEND_SHORT( namestr_record.nifl ); + TO_BIGEND_SHORT( namestr_record.nifd ); - HTOBE_INT ( namestr_record.npos ); + TO_BIGEND_INT ( namestr_record.npos ); /* copy filled struct to return area */ memcpy( raw_buffer, &namestr_record, sizeof(namestr_record) ); @@ -306,7 +302,7 @@ /* convert to IBM floating point */ /* first convert to big-endian layout */ - HTOBE_DOUBLE( value ); + TO_BIGEND_DOUBLE( value ); /* now convert to ibm flaoting point format */ ieee2ibm( (unsigned char *) raw_buffer, (unsigned char *) value, 1); Modified: trunk/SASxport/src/writeSAS.h =================================================================== --- trunk/SASxport/src/writeSAS.h 2014-07-20 02:15:13 UTC (rev 1849) +++ trunk/SASxport/src/writeSAS.h 2014-07-20 02:17:21 UTC (rev 1850) @@ -30,6 +30,8 @@ #include <R.h> #include <Rinternals.h> #include <sys/types.h> +#include "to_bigend.h" +#include "ibm2ieee.h" /***** @@ -49,14 +51,9 @@ #define ASSERT(x) if(!(x)) error("Assertion failed: x") #endif -/* Convert (if necessary) to Big-Endian */ -#define HTOBE_SHORT(a) host_to_be( (unsigned char*) &a, sizeof(short) ) -#define HTOBE_INT(a) host_to_be( (unsigned char*) &a, sizeof(int) ) -#define HTOBE_DOUBLE(a) host_to_be( (unsigned char*) &a, sizeof(double) ) - /* Alternative definition using system functions: */ -/* #define HTOBE_SHORT(a) (a) = htons( a ) */ -/* #define HTOBE_INT(a) (a) = htonl( a ) */ +/* #define TO_BIGEND_SHORT(a) (a) = htons( a ) */ +/* #define TO_BIGEND_INT(a) (a) = htonl( a ) */ /***** * File Record Structures @@ -172,7 +169,6 @@ void doTest(); -void host_to_be( unsigned char *intp, size_t size); void ieee2ibm(register unsigned char *out, register const unsigned char *in, int count); -#endif /* FIELDS_H */ +#endif /* WRITESAS_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |