Added stdbool.h module and removed old TRUE and FALSE defs which are not standard C
git-svn-id: http://picoc.googlecode.com/svn/trunk@451 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
d63865fd83
commit
fcb9255ba9
2
Makefile
2
Makefile
|
@ -7,7 +7,7 @@ SRCS = picoc.c table.c lex.c parse.c expression.c heap.c type.c \
|
|||
variable.c clibrary.c platform.c include.c \
|
||||
platform/platform_unix.c platform/library_unix.c \
|
||||
cstdlib/stdio.c cstdlib/math.c cstdlib/string.c cstdlib/stdlib.c \
|
||||
cstdlib/time.c cstdlib/errno.c cstdlib/ctype.c
|
||||
cstdlib/time.c cstdlib/errno.c cstdlib/ctype.c cstdlib/stdbool.c
|
||||
OBJS := $(SRCS:%.c=%.o)
|
||||
|
||||
all: depend $(TARGET)
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
FILE *CStdOut;
|
||||
|
||||
static int ZeroValue = 0;
|
||||
static int TRUEValue = 1;
|
||||
static int EOFValue = EOF;
|
||||
static int SEEK_SETValue = SEEK_SET;
|
||||
static int SEEK_CURValue = SEEK_CUR;
|
||||
|
@ -687,12 +686,6 @@ void StdioSetupFunc(void)
|
|||
/* define NULL, TRUE and FALSE */
|
||||
if (!VariableDefined(TableStrRegister("NULL")))
|
||||
VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE);
|
||||
|
||||
if (!VariableDefined(TableStrRegister("TRUE")))
|
||||
{
|
||||
VariableDefinePlatformVar(NULL, "TRUE", &IntType, (union AnyValue *)&TRUEValue, FALSE);
|
||||
VariableDefinePlatformVar(NULL, "FALSE", &IntType, (union AnyValue *)&ZeroValue, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* portability-related I/O calls */
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#ifndef BUILTIN_MINI_STDLIB
|
||||
|
||||
static int ZeroValue = 0;
|
||||
static int TRUEValue = 1;
|
||||
|
||||
void StdlibAtof(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||
{
|
||||
|
@ -164,12 +163,6 @@ void StdlibSetupFunc(void)
|
|||
/* define NULL, TRUE and FALSE */
|
||||
if (!VariableDefined(TableStrRegister("NULL")))
|
||||
VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE);
|
||||
|
||||
if (!VariableDefined(TableStrRegister("TRUE")))
|
||||
{
|
||||
VariableDefinePlatformVar(NULL, "TRUE", &IntType, (union AnyValue *)&TRUEValue, FALSE);
|
||||
VariableDefinePlatformVar(NULL, "FALSE", &IntType, (union AnyValue *)&ZeroValue, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !BUILTIN_MINI_STDLIB */
|
||||
|
|
|
@ -20,10 +20,11 @@ void IncludeInit()
|
|||
{
|
||||
IncludeRegister("ctype.h", NULL, &StdCtypeFunctions[0], NULL);
|
||||
IncludeRegister("errno.h", &StdErrnoSetupFunc, NULL, NULL);
|
||||
IncludeRegister("stdio.h", &StdioSetupFunc, &StdioFunctions[0], StdioDefs);
|
||||
IncludeRegister("math.h", &MathSetupFunc, &MathFunctions[0], NULL);
|
||||
IncludeRegister("string.h", &StringSetupFunc, &StringFunctions[0], NULL);
|
||||
IncludeRegister("stdbool.h", &StdboolSetupFunc, NULL, StdboolDefs);
|
||||
IncludeRegister("stdio.h", &StdioSetupFunc, &StdioFunctions[0], StdioDefs);
|
||||
IncludeRegister("stdlib.h", &StdlibSetupFunc, &StdlibFunctions[0], NULL);
|
||||
IncludeRegister("string.h", &StringSetupFunc, &StringFunctions[0], NULL);
|
||||
IncludeRegister("time.h", &StdTimeSetupFunc, &StdTimeFunctions[0], StdTimeDefs);
|
||||
}
|
||||
|
||||
|
|
4
picoc.h
4
picoc.h
|
@ -442,4 +442,8 @@ void StdErrnoSetupFunc(void);
|
|||
/* ctype.c */
|
||||
extern struct LibraryFunction StdCtypeFunctions[];
|
||||
|
||||
/* stdbool.c */
|
||||
extern const char StdboolDefs[];
|
||||
void StdboolSetupFunc(void);
|
||||
|
||||
#endif /* PICOC_H */
|
||||
|
|
|
@ -805,5 +805,5 @@ struct LibraryFunction SRV1Functions[] =
|
|||
|
||||
void PlatformLibraryInit()
|
||||
{
|
||||
IncludeRegister("srv1.h", &SRV1SetupFunc, &SRV1Functions, NULL);
|
||||
IncludeRegister("srv1.h", &SRV1SetupFunc, &SRV1Functions[0], NULL);
|
||||
}
|
||||
|
|
|
@ -25,5 +25,5 @@ struct LibraryFunction UnixFunctions[] =
|
|||
|
||||
void PlatformLibraryInit()
|
||||
{
|
||||
IncludeRegister("picoc_unix.h", &UnixSetupFunc, &UnixFunctions, NULL);
|
||||
IncludeRegister("picoc_unix.h", &UnixSetupFunc, &UnixFunctions[0], NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue