From b5207c06ae6f4b317fb2fe52d9c63751927d8e23 Mon Sep 17 00:00:00 2001 From: Joseph Poirier Date: Wed, 10 Jun 2015 14:49:34 -0500 Subject: [PATCH] remove endian macros --- clibrary.c | 6 +++--- cstdlib/unistd.c | 6 +++--- platform.h | 8 -------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/clibrary.c b/clibrary.c index 7acbb09..55181d5 100644 --- a/clibrary.c +++ b/clibrary.c @@ -15,14 +15,14 @@ void LibraryInit(Picoc *pc) /* define the version number macro */ pc->VersionString = TableStrRegister(pc, PICOC_VERSION); - VariableDefinePlatformVar(pc, NULL, "PICOC_VERSION", pc->CharPtrType, (union AnyValue *)&pc->VersionString, false); + VariableDefinePlatformVar(pc, NULL, "PICOC_VERSION", pc->CharPtrType, (union AnyValue*)&pc->VersionString, false); /* define endian-ness macros */ BigEndian = ((*(char*)&__ENDIAN_CHECK__) == 0); LittleEndian = ((*(char*)&__ENDIAN_CHECK__) == 1); - VariableDefinePlatformVar(pc, NULL, "BIG_ENDIAN", &pc->IntType, (union AnyValue *)&BigEndian, false); - VariableDefinePlatformVar(pc, NULL, "LITTLE_ENDIAN", &pc->IntType, (union AnyValue *)&LittleEndian, false); + VariableDefinePlatformVar(pc, NULL, "BIG_ENDIAN", &pc->IntType, (union AnyValue*)&BigEndian, false); + VariableDefinePlatformVar(pc, NULL, "LITTLE_ENDIAN", &pc->IntType, (union AnyValue*)&LittleEndian, false); } /* add a library */ diff --git a/cstdlib/unistd.c b/cstdlib/unistd.c index 81cda87..70aae6b 100644 --- a/cstdlib/unistd.c +++ b/cstdlib/unistd.c @@ -80,11 +80,11 @@ void UnistdFchdir(struct ParseState *Parser, struct Value *ReturnValue, struct V void UnistdFdatasync(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { -#ifndef F_FULLSYNC - ReturnValue->Val->Integer = fdatasync(Param[0]->Val->Integer); -#else +#ifdef F_FULLSYNC /* Mac OS X equivalent */ ReturnValue->Val->Integer = fcntl(Param[0]->Val->Integer, F_FULLFSYNC); +#else + ReturnValue->Val->Integer = fdatasync(Param[0]->Val->Integer); #endif } diff --git a/platform.h b/platform.h index 24568c3..d658072 100644 --- a/platform.h +++ b/platform.h @@ -30,9 +30,6 @@ #undef DEBUG_LEXER #undef DEBUG_VAR_SCOPE -/* set based on the platform */ -#undef BIG_ENDIAN - #if defined(__hppa__) || defined(__sparc__) #define ALIGN_TYPE double /* the default data type to use for alignment */ @@ -40,10 +37,6 @@ #define ALIGN_TYPE void * /* the default data type to use for alignment */ #endif -#if defined(__powerpc__) || defined(__hppa__) || defined(__sparc__) -#define BIG_ENDIAN -#endif - #define GLOBAL_TABLE_SIZE (97) /* global variable table */ #define STRING_TABLE_SIZE (97) /* shared string table size */ #define STRING_LITERAL_TABLE_SIZE (97) /* string literal table size */ @@ -58,7 +51,6 @@ #define INTERACTIVE_PROMPT_LINE " > " - /* host platform includes */ #ifdef UNIX_HOST # include