From 3655278bcd617d8a02cbdb8eb20bb5caba9e76bd Mon Sep 17 00:00:00 2001 From: Joseph Poirier Date: Wed, 10 Jun 2015 14:37:21 -0500 Subject: [PATCH] minor cleanup --- clibrary.c | 1 - cstdlib/ctype.c | 2 +- cstdlib/errno.c | 2 +- cstdlib/math.c | 2 +- cstdlib/stdbool.c | 2 +- cstdlib/stdio.c | 2 +- cstdlib/stdlib.c | 2 +- cstdlib/string.c | 4 ++-- cstdlib/time.c | 2 +- cstdlib/unistd.c | 4 +--- interpreter.h | 12 ++++++++++-- platform.h | 4 ++-- 12 files changed, 22 insertions(+), 17 deletions(-) diff --git a/clibrary.c b/clibrary.c index e8ce47d..7acbb09 100644 --- a/clibrary.c +++ b/clibrary.c @@ -1,5 +1,4 @@ /* */ - #include "picoc.h" #include "interpreter.h" diff --git a/cstdlib/ctype.c b/cstdlib/ctype.c index 9c59fe5..f7118db 100644 --- a/cstdlib/ctype.c +++ b/cstdlib/ctype.c @@ -1,4 +1,4 @@ -/* string.h library for large systems - small embedded systems use clibrary.c instead */ +/* */ #include #include "../interpreter.h" diff --git a/cstdlib/errno.c b/cstdlib/errno.c index e92bb7b..fd56c76 100644 --- a/cstdlib/errno.c +++ b/cstdlib/errno.c @@ -1,4 +1,4 @@ -/* string.h library for large systems - small embedded systems use clibrary.c instead */ +/* */ #include #include "../interpreter.h" diff --git a/cstdlib/math.c b/cstdlib/math.c index f2575ba..f302b7c 100644 --- a/cstdlib/math.c +++ b/cstdlib/math.c @@ -1,4 +1,4 @@ -/* stdio.h library for large systems - small embedded systems use clibrary.c instead */ +/* */ #include "../interpreter.h" diff --git a/cstdlib/stdbool.c b/cstdlib/stdbool.c index fb2a4c2..8cc34e3 100644 --- a/cstdlib/stdbool.c +++ b/cstdlib/stdbool.c @@ -1,4 +1,4 @@ -/* string.h library for large systems - small embedded systems use clibrary.c instead */ +/* */ #include "../interpreter.h" diff --git a/cstdlib/stdio.c b/cstdlib/stdio.c index 0066ab1..acc16cf 100644 --- a/cstdlib/stdio.c +++ b/cstdlib/stdio.c @@ -1,4 +1,4 @@ -/* stdio.h library for large systems - small embedded systems use clibrary.c instead */ +/* */ #include #include "../interpreter.h" diff --git a/cstdlib/stdlib.c b/cstdlib/stdlib.c index c5dc7cd..8c59ef2 100644 --- a/cstdlib/stdlib.c +++ b/cstdlib/stdlib.c @@ -1,4 +1,4 @@ -/* stdlib.h library for large systems - small embedded systems use clibrary.c instead */ +/* */ #include "../interpreter.h" diff --git a/cstdlib/string.c b/cstdlib/string.c index 3a98e69..4d0c525 100644 --- a/cstdlib/string.c +++ b/cstdlib/string.c @@ -1,4 +1,4 @@ -/* string.h library for large systems - small embedded systems use clibrary.c instead */ +/* */ #include "../interpreter.h" @@ -171,7 +171,7 @@ struct LibraryFunction StringFunctions[] = {StringStrdup, "char *strdup(char *);"}, {StringStrtok_r,"char *strtok_r(char *,char *,char **);"}, #endif - {NULL, NULL } + {NULL, NULL } }; /* creates various system-dependent definitions */ diff --git a/cstdlib/time.c b/cstdlib/time.c index 08ae3ae..6e667c0 100644 --- a/cstdlib/time.c +++ b/cstdlib/time.c @@ -1,4 +1,4 @@ -/* string.h library for large systems - small embedded systems use clibrary.c instead */ +/* */ #include #include "../interpreter.h" diff --git a/cstdlib/unistd.c b/cstdlib/unistd.c index f66bbad..81cda87 100644 --- a/cstdlib/unistd.c +++ b/cstdlib/unistd.c @@ -1,6 +1,4 @@ -/* stdlib.h library */ -/*#include */ -/*#include */ +/* */ #include #include #include "../interpreter.h" diff --git a/interpreter.h b/interpreter.h index d747b7f..f50e1a9 100644 --- a/interpreter.h +++ b/interpreter.h @@ -11,16 +11,24 @@ #define NULL 0 #endif +/* #ifndef min #define min(x,y) (((x)<(y))?(x):(y)) #endif +#ifndef min +#define max(a, b) (((a) > (b)) ? (a) : (b)) +#endif +*/ -#define MEM_ALIGN(x) (((x) + sizeof(ALIGN_TYPE) - 1) & ~(sizeof(ALIGN_TYPE)-1)) +#define MEM_ALIGN(x) (((x) + sizeof(ALIGN_TYPE)-1) & ~(sizeof(ALIGN_TYPE)-1)) /* for debugging */ #define PRINT_SOURCE_POS() { \ PrintSourceTextErrorLine(Parser->pc->CStdOut, \ - Parser->FileName, Parser->SourceText, Parser->Line, Parser->CharacterPos); \ + Parser->FileName, \ + Parser->SourceText, \ + Parser->Line, \ + Parser->CharacterPos); \ PlatformPrintf(Parser->pc->CStdOut, "\n"); \ } diff --git a/platform.h b/platform.h index 10b3731..24568c3 100644 --- a/platform.h +++ b/platform.h @@ -20,6 +20,7 @@ #define DEBUGGER #define USE_READLINE (defined by default for UNIX_HOST) */ +#define USE_READLINE /* undocumented, but probably useful */ #undef DEBUG_HEAP @@ -62,9 +63,8 @@ #ifdef UNIX_HOST # include # include -# define USE_READLINE #elif defined(WIN32) /*(predefined on MSVC)*/ - +#undef USE_READLINE #else # error ***** A platform must be explicitly defined! ***** #endif