Added the beginnings of flying fox platform support.

Removed some annoying debug.
Made it easier to compile unmodified on non-UNIX systems.


git-svn-id: http://picoc.googlecode.com/svn/trunk@274 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-05-04 12:02:16 +00:00
parent 997f0c119f
commit bd9cb90e02
7 changed files with 79 additions and 10 deletions

View file

@ -1,5 +1,5 @@
CC=gcc
CFLAGS=-Wall -g
CFLAGS=-Wall -g -DUNIX_HOST
LIBS=-lm
TARGET = picoc

View file

@ -794,9 +794,6 @@ int ExpressionParse(struct ParseState *Parser, struct Value **Result)
(Token == TokenCloseBracket && BracketPrecedence != 0)) &&
(Token != TokenColon || TernaryDepth != 0) )
{
if (Token == TokenColon)
printf("It's a colon\n");
/* it's an operator with precedence */
if (PrefixState)
{

2
heap.c
View file

@ -69,8 +69,6 @@ int HeapPopStack(void *Addr, int Size)
return FALSE;
HeapStackTop -= ToLose;
if (HeapStackTop != Addr)
printf("fail\n");
assert(HeapStackTop == Addr);
return TRUE;

2
lex.c
View file

@ -501,7 +501,7 @@ void LexInitParser(struct ParseState *Parser, void *TokenSource, const char *Fil
/* get the next token given a parser state */
enum LexToken LexGetToken(struct ParseState *Parser, struct Value **Value, int IncPos)
{
enum LexToken Token;
enum LexToken Token = TokenNone;
int ValueSize;
do

12
library_ffox.c Normal file
View file

@ -0,0 +1,12 @@
#include "picoc.h"
void PlatformLibraryInit()
{
}
/* list of all library functions and their prototypes */
struct LibraryFunction PlatformLibrary[] =
{
{ NULL, NULL }
};

View file

@ -3,9 +3,11 @@
#define PLATFORM_H
/* configurable options */
#define UNIX_HOST /* select your host type */
#undef FLYINGFOX_HOST
#undef SURVEYOR_HOST
/* select your host type (or do it in the Makefile):
* #define UNIX_HOST
* #define FLYINGFOX_HOST
* #define SURVEYOR_HOST
*/
#ifndef SURVEYOR_HOST
#define HEAP_SIZE 16384 /* space for the heap and the stack */
@ -47,6 +49,15 @@ extern jmp_buf ExitBuf;
#else
# ifdef FLYINGFOX_HOST
# define NO_HASH_INCLUDE
# include <stdlib.h>
# include <ctype.h>
# include <string.h>
# include <sys/types.h>
# include <stdarg.h>
# include <setjmp.h>
# include <math.h>
# define assert(x)
# else
# ifdef SURVEYOR_HOST

51
platform_ffox.c Normal file
View file

@ -0,0 +1,51 @@
#include "picoc.h"
/* deallocate any storage */
void PlatformCleanup()
{
}
/* get a line of interactive input */
char *PlatformGetLine(char *Buf, int MaxLen)
{
// XXX - unimplemented so far
return NULL;
}
/* get a character of interactive input */
int PlatformGetCharacter()
{
// XXX - unimplemented so far
return 0;
}
/* write a character to the console */
void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream)
{
// XXX - unimplemented so far
}
/* read a file into memory */
char *PlatformReadFile(const char *FileName)
{
// XXX - unimplemented so far
return NULL;
}
/* read and scan a file for definitions */
void PlatformScanFile(const char *FileName)
{
char *SourceStr = PlatformReadFile(FileName);
Parse(FileName, SourceStr, strlen(SourceStr), TRUE);
//free(SourceStr);
}
/* mark where to end the program for platforms which require this */
jmp_buf ExitBuf;
/* exit the program */
void PlatformExit()
{
longjmp(ExitBuf, 1);
}