PICOC_VERSION is now defined as a macro in picoc
git-svn-id: http://picoc.googlecode.com/svn/trunk@528 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
ea6f2c006a
commit
e17f6f955f
10
Makefile
10
Makefile
|
@ -16,11 +16,18 @@ all: depend $(TARGET)
|
|||
$(TARGET): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
|
||||
|
||||
# rebuild the version number every time so we always have the
|
||||
# correct subversion version
|
||||
version.h:
|
||||
echo "#define PICOC_SUBVERSION_VERSION \"`svnversion`\"" > version.h
|
||||
|
||||
.PHONY: version.h
|
||||
|
||||
test: all
|
||||
(cd tests; make test)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) $(OBJS) *~
|
||||
rm -f $(TARGET) $(OBJS) version.h *~
|
||||
|
||||
count:
|
||||
@echo "Core:"
|
||||
|
@ -30,6 +37,7 @@ count:
|
|||
@cat $(SRCS) *.h */*.h | wc
|
||||
|
||||
depend:
|
||||
touch version.h
|
||||
$(CC) -MM $(SRCS) >.depend
|
||||
|
||||
-include .depend
|
||||
|
|
19
clibrary.c
19
clibrary.c
|
@ -1,7 +1,21 @@
|
|||
#include "picoc.h"
|
||||
#include "version.h"
|
||||
|
||||
/* initialise a library */
|
||||
void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList)
|
||||
/* the picoc version string */
|
||||
#define PICOC_VERSION "v2.1 beta r" PICOC_SUBVERSION_VERSION
|
||||
static const char *VersionString = NULL;
|
||||
|
||||
|
||||
/* global initialisation for libraries */
|
||||
void LibraryInit()
|
||||
{
|
||||
/* define the version number macro */
|
||||
VersionString = TableStrRegister(PICOC_VERSION);
|
||||
VariableDefinePlatformVar(NULL, "PICOC_VERSION", CharPtrType, (union AnyValue *)&VersionString, FALSE);
|
||||
}
|
||||
|
||||
/* add a library */
|
||||
void LibraryAdd(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList)
|
||||
{
|
||||
struct ParseState Parser;
|
||||
int Count;
|
||||
|
@ -11,6 +25,7 @@ void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct Libr
|
|||
void *Tokens;
|
||||
const char *IntrinsicName = TableStrRegister("c library");
|
||||
|
||||
/* read all the library definitions */
|
||||
for (Count = 0; FuncList[Count].Prototype != NULL; Count++)
|
||||
{
|
||||
Tokens = LexAnalyse(IntrinsicName, FuncList[Count].Prototype, strlen((char *)FuncList[Count].Prototype), NULL);
|
||||
|
|
|
@ -95,7 +95,7 @@ void IncludeFile(char *FileName)
|
|||
|
||||
/* set up the library functions */
|
||||
if (LInclude->FuncList != NULL)
|
||||
LibraryInit(&GlobalTable, FileName, LInclude->FuncList);
|
||||
LibraryAdd(&GlobalTable, FileName, LInclude->FuncList);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
3
picoc.c
3
picoc.c
|
@ -17,8 +17,9 @@ void Initialise(int StackSize)
|
|||
#ifndef NO_HASH_INCLUDE
|
||||
IncludeInit();
|
||||
#endif
|
||||
LibraryInit();
|
||||
#ifdef BUILTIN_MINI_STDLIB
|
||||
LibraryInit(&GlobalTable, "c library", &CLibrary[0]);
|
||||
LibraryAdd(&GlobalTable, "c library", &CLibrary[0]);
|
||||
CLibraryInit();
|
||||
#endif
|
||||
PlatformLibraryInit();
|
||||
|
|
3
picoc.h
3
picoc.h
|
@ -408,7 +408,8 @@ void *VariableDereferencePointer(struct ParseState *Parser, struct Value *Pointe
|
|||
|
||||
/* clibrary.c */
|
||||
void BasicIOInit();
|
||||
void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList);
|
||||
void LibraryInit();
|
||||
void LibraryAdd(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList);
|
||||
void CLibraryInit();
|
||||
void PrintCh(char OutCh, IOFILE *Stream);
|
||||
void PrintSimpleInt(long Num, IOFILE *Stream);
|
||||
|
|
Loading…
Reference in a new issue