2008-10-12 20:53:28 -04:00
|
|
|
#ifndef PICOC_H
|
|
|
|
#define PICOC_H
|
|
|
|
|
2009-02-24 06:16:37 -05:00
|
|
|
#include "platform.h"
|
2009-02-01 06:31:18 -05:00
|
|
|
|
2008-10-12 20:53:28 -04:00
|
|
|
/* handy definitions */
|
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#define FALSE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
#define NULL 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef min
|
|
|
|
#define min(x,y) (((x)<(y))?(x):(y))
|
|
|
|
#endif
|
|
|
|
|
2009-01-20 19:52:42 -05:00
|
|
|
#define MEM_ALIGN(x) (((x) + ARCH_ALIGN_WORDSIZE - 1) & ~(ARCH_ALIGN_WORDSIZE-1))
|
|
|
|
|
2008-12-26 22:04:58 -05:00
|
|
|
#define LOG10E 0.43429448190325182765
|
2009-03-07 06:23:42 -05:00
|
|
|
#define INTERACTIVE_FILE_NAME "input"
|
2008-12-26 22:04:58 -05:00
|
|
|
|
2008-10-12 20:53:28 -04:00
|
|
|
#ifndef PATH_MAX
|
|
|
|
#define PATH_MAX 1024
|
|
|
|
#endif
|
|
|
|
|
2009-01-23 06:34:12 -05:00
|
|
|
struct Table;
|
|
|
|
|
2008-10-12 20:53:28 -04:00
|
|
|
/* lexical tokens */
|
|
|
|
enum LexToken
|
|
|
|
{
|
2009-03-29 07:08:03 -04:00
|
|
|
TokenNone,
|
2009-03-03 05:53:45 -05:00
|
|
|
TokenComma,
|
|
|
|
TokenAssign, TokenAddAssign, TokenSubtractAssign, TokenMultiplyAssign, TokenDivideAssign, TokenModulusAssign,
|
|
|
|
TokenShiftLeftAssign, TokenShiftRightAssign, TokenArithmeticAndAssign, TokenArithmeticOrAssign, TokenArithmeticExorAssign,
|
2009-03-04 05:09:56 -05:00
|
|
|
TokenQuestionMark, TokenColon,
|
2009-03-03 05:53:45 -05:00
|
|
|
TokenLogicalOr,
|
|
|
|
TokenLogicalAnd,
|
|
|
|
TokenArithmeticOr,
|
|
|
|
TokenArithmeticExor,
|
|
|
|
TokenAmpersand,
|
|
|
|
TokenEqual, TokenNotEqual,
|
|
|
|
TokenLessThan, TokenGreaterThan, TokenLessEqual, TokenGreaterEqual,
|
|
|
|
TokenShiftLeft, TokenShiftRight,
|
|
|
|
TokenPlus, TokenMinus,
|
|
|
|
TokenAsterisk, TokenSlash, TokenModulus,
|
|
|
|
TokenIncrement, TokenDecrement, TokenUnaryNot, TokenUnaryExor, TokenSizeof,
|
|
|
|
TokenLeftSquareBracket, TokenRightSquareBracket, TokenDot, TokenArrow,
|
2009-01-23 22:15:02 -05:00
|
|
|
TokenOpenBracket, TokenCloseBracket,
|
2009-03-03 05:53:45 -05:00
|
|
|
TokenIdentifier, TokenIntegerConstant, TokenFPConstant, TokenStringConstant, TokenCharacterConstant,
|
2009-03-04 05:09:56 -05:00
|
|
|
TokenSemicolon, TokenEllipsis,
|
2009-01-23 22:15:02 -05:00
|
|
|
TokenLeftBrace, TokenRightBrace,
|
|
|
|
TokenIntType, TokenCharType, TokenFloatType, TokenDoubleType, TokenVoidType, TokenEnumType,
|
|
|
|
TokenLongType, TokenSignedType, TokenShortType, TokenStructType, TokenUnionType, TokenUnsignedType, TokenTypedef,
|
2009-02-17 18:36:09 -05:00
|
|
|
TokenContinue, TokenDo, TokenElse, TokenFor, TokenIf, TokenWhile, TokenBreak, TokenSwitch, TokenCase, TokenDefault, TokenReturn,
|
2009-03-16 00:25:58 -04:00
|
|
|
TokenHashDefine, TokenHashInclude, TokenNew, TokenDelete,
|
2009-03-29 07:08:03 -04:00
|
|
|
TokenEOF, TokenEndOfLine, TokenEndOfFunction
|
2008-10-12 20:53:28 -04:00
|
|
|
};
|
|
|
|
|
2009-02-01 23:53:45 -05:00
|
|
|
/* used in dynamic memory allocation */
|
|
|
|
struct AllocNode
|
|
|
|
{
|
2009-02-03 01:27:34 -05:00
|
|
|
unsigned int Size;
|
2009-02-01 23:53:45 -05:00
|
|
|
struct AllocNode *NextFree;
|
|
|
|
};
|
|
|
|
|
2009-02-18 03:19:06 -05:00
|
|
|
/* whether we're running or skipping code */
|
|
|
|
enum RunMode
|
|
|
|
{
|
|
|
|
RunModeRun, /* we're running code as we parse it */
|
|
|
|
RunModeSkip, /* skipping code, not running */
|
|
|
|
RunModeReturn, /* returning from a function */
|
|
|
|
RunModeCaseSearch, /* searching for a case label */
|
|
|
|
RunModeBreak, /* breaking out of a switch/while/do */
|
|
|
|
RunModeContinue /* as above but repeat the loop */
|
|
|
|
};
|
|
|
|
|
2009-02-01 06:31:18 -05:00
|
|
|
/* parser state - has all this detail so we can parse nested files */
|
|
|
|
struct ParseState
|
2009-01-23 06:34:12 -05:00
|
|
|
{
|
2009-02-01 06:31:18 -05:00
|
|
|
const void *Pos;
|
2009-01-23 06:34:12 -05:00
|
|
|
int Line;
|
2009-02-01 06:31:18 -05:00
|
|
|
const char *FileName;
|
2009-02-18 03:19:06 -05:00
|
|
|
enum RunMode Mode; /* whether to skip or run code */
|
|
|
|
int SearchLabel; /* what case label we're searching for */
|
2008-10-12 20:53:28 -04:00
|
|
|
};
|
|
|
|
|
2008-12-18 19:22:52 -05:00
|
|
|
/* values */
|
2009-01-20 19:52:42 -05:00
|
|
|
enum BaseType
|
|
|
|
{
|
|
|
|
TypeVoid, /* no type */
|
|
|
|
TypeInt, /* integer */
|
2009-02-23 19:21:17 -05:00
|
|
|
#ifndef NO_FP
|
2009-01-20 19:52:42 -05:00
|
|
|
TypeFP, /* floating point */
|
2009-02-23 19:21:17 -05:00
|
|
|
#endif
|
2009-01-20 19:52:42 -05:00
|
|
|
TypeChar, /* a single character - acts like an integer except in machine memory access */
|
|
|
|
TypeFunction, /* a function */
|
|
|
|
TypeMacro, /* a macro */
|
|
|
|
TypePointer, /* a pointer */
|
|
|
|
TypeArray, /* an array of a sub-type */
|
2009-01-23 06:34:12 -05:00
|
|
|
TypeStruct, /* aggregate type */
|
|
|
|
TypeUnion, /* merged type */
|
|
|
|
TypeEnum, /* enumated integer type */
|
2009-01-20 19:52:42 -05:00
|
|
|
TypeType /* a type (eg. typedef) */
|
|
|
|
};
|
|
|
|
|
2009-02-01 06:31:18 -05:00
|
|
|
/* data type */
|
2009-01-20 19:52:42 -05:00
|
|
|
struct ValueType
|
|
|
|
{
|
2009-03-15 03:07:21 -04:00
|
|
|
enum BaseType Base; /* what kind of type this is */
|
|
|
|
int ArraySize; /* the size of an array type */
|
|
|
|
int Sizeof; /* the storage required */
|
|
|
|
const char *Identifier; /* the name of a struct or union */
|
|
|
|
struct ValueType *FromType; /* the type we're derived from (or NULL) */
|
2009-01-23 06:34:12 -05:00
|
|
|
struct ValueType *DerivedTypeList; /* first in a list of types derived from this one */
|
2009-03-15 03:07:21 -04:00
|
|
|
struct ValueType *Next; /* next item in the derived type list */
|
|
|
|
struct Table *Members; /* members of a struct or union */
|
|
|
|
int OnHeap; /* true if allocated on the heap */
|
2009-01-20 19:52:42 -05:00
|
|
|
};
|
|
|
|
|
2009-02-01 06:31:18 -05:00
|
|
|
/* function definition */
|
|
|
|
struct FuncDef
|
|
|
|
{
|
|
|
|
struct ValueType *ReturnType; /* the return value type */
|
|
|
|
int NumParams; /* the number of parameters */
|
2009-02-20 04:04:45 -05:00
|
|
|
int VarArgs; /* has a variable number of arguments after the explicitly specified ones */
|
2009-02-02 06:08:36 -05:00
|
|
|
struct ValueType **ParamType; /* array of parameter types */
|
2009-02-21 18:38:07 -05:00
|
|
|
char **ParamName; /* array of parameter names */
|
2009-02-01 06:31:18 -05:00
|
|
|
void (*Intrinsic)(); /* intrinsic call address or NULL */
|
|
|
|
struct ParseState Body; /* lexical tokens of the function body if not intrinsic */
|
|
|
|
};
|
|
|
|
|
2009-03-02 17:13:47 -05:00
|
|
|
/* values */
|
2009-01-20 19:52:42 -05:00
|
|
|
struct ArrayValue
|
|
|
|
{
|
2009-03-15 03:07:21 -04:00
|
|
|
unsigned int Size; /* the number of elements in the array */
|
|
|
|
void *Data; /* pointer to the array data */
|
2009-01-20 19:52:42 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PointerValue
|
2008-11-21 21:56:08 -05:00
|
|
|
{
|
2009-03-15 03:07:21 -04:00
|
|
|
struct Value *Segment; /* array or basic value which this points to, NULL for machine memory access */
|
|
|
|
unsigned int Offset; /* index into an array */
|
2008-11-21 21:56:08 -05:00
|
|
|
};
|
|
|
|
|
2008-10-14 07:46:42 -04:00
|
|
|
union AnyValue
|
|
|
|
{
|
2009-01-21 04:02:05 -05:00
|
|
|
unsigned char Character;
|
|
|
|
short ShortInteger;
|
|
|
|
int Integer;
|
2009-02-23 19:21:17 -05:00
|
|
|
#ifndef NO_FP
|
2009-01-21 04:02:05 -05:00
|
|
|
double FP;
|
2009-02-23 19:21:17 -05:00
|
|
|
#endif
|
2009-02-20 21:35:52 -05:00
|
|
|
char *Identifier;
|
2009-01-20 19:52:42 -05:00
|
|
|
struct ArrayValue Array;
|
|
|
|
struct PointerValue Pointer;
|
2009-02-01 06:31:18 -05:00
|
|
|
struct ParseState Parser;
|
2009-01-23 06:34:12 -05:00
|
|
|
struct ValueType *Typ;
|
2009-02-01 06:31:18 -05:00
|
|
|
struct FuncDef FuncDef;
|
2008-10-14 07:46:42 -04:00
|
|
|
};
|
2008-10-12 20:53:28 -04:00
|
|
|
|
2008-11-21 21:56:08 -05:00
|
|
|
struct Value
|
|
|
|
{
|
2009-03-15 03:07:21 -04:00
|
|
|
struct ValueType *Typ; /* the type of this value */
|
|
|
|
union AnyValue *Val; /* pointer to the AnyValue which holds the actual content */
|
|
|
|
struct Value *LValueFrom; /* if an LValue, this is a Value our LValue is contained within (or NULL) */
|
|
|
|
char ValOnHeap; /* the AnyValue is on the heap (but this Value is on the stack) */
|
|
|
|
char ValOnStack; /* the AnyValue is on the stack along with this Value */
|
|
|
|
char IsLValue; /* is modifiable and is allocated somewhere we can usefully modify it */
|
2008-11-21 21:56:08 -05:00
|
|
|
};
|
|
|
|
|
2008-12-18 19:22:52 -05:00
|
|
|
/* hash table data structure */
|
|
|
|
struct TableEntry
|
|
|
|
{
|
2009-03-15 03:07:21 -04:00
|
|
|
struct TableEntry *Next; /* next item in this hash chain */
|
2009-02-01 22:27:05 -05:00
|
|
|
union TableEntryPayload
|
|
|
|
{
|
|
|
|
struct ValueEntry
|
|
|
|
{
|
2009-03-15 03:07:21 -04:00
|
|
|
char *Key; /* points to the shared string table */
|
|
|
|
struct Value *Val; /* the value we're storing */
|
|
|
|
} v; /* used for tables of values */
|
2009-02-01 22:27:05 -05:00
|
|
|
|
2009-03-15 03:07:21 -04:00
|
|
|
char Key[1]; /* dummy size - used for the shared string table */
|
2009-02-01 22:27:05 -05:00
|
|
|
} p;
|
2008-12-18 19:22:52 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Table
|
|
|
|
{
|
|
|
|
short Size;
|
2009-01-29 17:26:04 -05:00
|
|
|
short OnHeap;
|
|
|
|
struct TableEntry **HashTable;
|
2008-12-18 19:22:52 -05:00
|
|
|
};
|
|
|
|
|
2008-12-21 21:29:19 -05:00
|
|
|
/* stack frame for function calls */
|
|
|
|
struct StackFrame
|
|
|
|
{
|
2009-02-01 06:31:18 -05:00
|
|
|
struct ParseState ReturnParser; /* how we got here */
|
2009-02-19 18:29:35 -05:00
|
|
|
struct Value *ReturnValue; /* copy the return value here */
|
|
|
|
struct Value **Parameter; /* array of parameter values */
|
|
|
|
int NumParams; /* the number of parameters */
|
2009-01-29 06:10:46 -05:00
|
|
|
struct Table LocalTable; /* the local variables and parameters */
|
2009-01-29 17:26:04 -05:00
|
|
|
struct TableEntry *LocalHashTable[LOCAL_TABLE_SIZE];
|
2009-01-29 06:10:46 -05:00
|
|
|
struct StackFrame *PreviousStackFrame; /* the next lower stack frame */
|
2008-12-21 21:29:19 -05:00
|
|
|
};
|
|
|
|
|
2009-02-20 21:35:52 -05:00
|
|
|
/* lexer state */
|
|
|
|
struct LexState
|
|
|
|
{
|
|
|
|
const char *Pos;
|
|
|
|
const char *End;
|
|
|
|
int Line;
|
|
|
|
const char *FileName;
|
|
|
|
};
|
|
|
|
|
2009-02-24 06:16:37 -05:00
|
|
|
/* library function definition */
|
|
|
|
struct LibraryFunction
|
|
|
|
{
|
2009-02-28 17:14:55 -05:00
|
|
|
void (*Func)(struct ParseState *Parser, struct Value *, struct Value **, int);
|
2009-02-24 06:16:37 -05:00
|
|
|
const char *Prototype;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* platform-specific method for writing characters to the console */
|
|
|
|
typedef void CharWriter(unsigned char);
|
|
|
|
|
2008-12-26 23:36:45 -05:00
|
|
|
/* globals */
|
2009-01-23 06:34:12 -05:00
|
|
|
extern struct Table GlobalTable;
|
2009-01-29 06:10:46 -05:00
|
|
|
extern struct StackFrame *TopStackFrame;
|
2009-01-23 06:34:12 -05:00
|
|
|
extern struct ValueType IntType;
|
|
|
|
extern struct ValueType CharType;
|
2009-02-23 19:21:17 -05:00
|
|
|
#ifndef NO_FP
|
2009-01-23 06:34:12 -05:00
|
|
|
extern struct ValueType FPType;
|
2009-02-23 19:21:17 -05:00
|
|
|
#endif
|
2009-01-21 04:02:05 -05:00
|
|
|
extern struct ValueType VoidType;
|
|
|
|
extern struct ValueType FunctionType;
|
2009-01-23 06:34:12 -05:00
|
|
|
extern struct ValueType MacroType;
|
2009-02-20 21:35:52 -05:00
|
|
|
extern struct ValueType *CharPtrType;
|
|
|
|
extern struct ValueType *CharArrayType;
|
|
|
|
extern char *StrEmpty;
|
2009-02-24 06:16:37 -05:00
|
|
|
extern struct LibraryFunction CLibrary[];
|
|
|
|
extern struct LibraryFunction PlatformLibrary[];
|
2008-10-12 20:53:28 -04:00
|
|
|
|
|
|
|
/* table.c */
|
2009-02-20 21:35:52 -05:00
|
|
|
void TableInit();
|
|
|
|
char *TableStrRegister(const char *Str);
|
|
|
|
char *TableStrRegister2(const char *Str, int Len);
|
|
|
|
void TableInitTable(struct Table *Tbl, struct TableEntry **HashTable, int Size, int OnHeap);
|
|
|
|
int TableSet(struct Table *Tbl, char *Key, struct Value *Val);
|
2009-02-01 06:31:18 -05:00
|
|
|
int TableGet(struct Table *Tbl, const char *Key, struct Value **Val);
|
2009-03-15 06:44:56 -04:00
|
|
|
struct Value *TableDelete(struct Table *Tbl, const char *Key);
|
2009-02-20 21:35:52 -05:00
|
|
|
char *TableSetIdentifier(struct Table *Tbl, const char *Ident, int IdentLen);
|
2009-03-10 22:19:18 -04:00
|
|
|
void TableStrFree();
|
2008-10-12 20:53:28 -04:00
|
|
|
|
|
|
|
/* lex.c */
|
2009-03-11 19:49:10 -04:00
|
|
|
void LexInit();
|
|
|
|
void LexCleanup();
|
2009-03-07 02:49:17 -05:00
|
|
|
void *LexAnalyse(const char *FileName, const char *Source, int SourceLen, int *TokenLen);
|
2009-02-18 03:19:06 -05:00
|
|
|
void LexInitParser(struct ParseState *Parser, void *TokenSource, const char *FileName, int Line, int RunIt);
|
2009-02-01 06:31:18 -05:00
|
|
|
enum LexToken LexGetToken(struct ParseState *Parser, struct Value **Value, int IncPos);
|
2009-03-07 01:17:11 -05:00
|
|
|
void LexToEndOfLine(struct ParseState *Parser);
|
|
|
|
void *LexCopyTokens(struct ParseState *StartParser, struct ParseState *EndParser);
|
2009-03-07 23:26:28 -05:00
|
|
|
void LexInteractiveClear(struct ParseState *Parser);
|
2009-03-07 06:23:42 -05:00
|
|
|
void LexInteractiveCompleted(struct ParseState *Parser);
|
2009-03-07 23:26:28 -05:00
|
|
|
void LexInteractiveStatementPrompt();
|
2008-10-12 20:53:28 -04:00
|
|
|
|
|
|
|
/* parse.c */
|
2009-02-18 03:19:06 -05:00
|
|
|
int ParseStatement(struct ParseState *Parser);
|
2009-02-20 21:35:52 -05:00
|
|
|
struct Value *ParseFunctionDefinition(struct ParseState *Parser, struct ValueType *ReturnType, char *Identifier, int IsProtoType);
|
2009-02-01 06:31:18 -05:00
|
|
|
void Parse(const char *FileName, const char *Source, int SourceLen, int RunIt);
|
2009-03-07 06:23:42 -05:00
|
|
|
void ParseInteractive();
|
2009-03-11 19:49:10 -04:00
|
|
|
void ParseCleanup();
|
2009-03-30 07:16:40 -04:00
|
|
|
void ParserCopyPos(struct ParseState *To, struct ParseState *From);
|
2009-01-23 06:34:12 -05:00
|
|
|
|
2009-03-08 03:56:28 -04:00
|
|
|
/* expression.c */
|
|
|
|
int ExpressionParse(struct ParseState *Parser, struct Value **Result);
|
|
|
|
int ExpressionParseInt(struct ParseState *Parser);
|
|
|
|
|
2009-01-23 06:34:12 -05:00
|
|
|
/* type.c */
|
|
|
|
void TypeInit();
|
2009-03-11 06:17:46 -04:00
|
|
|
void TypeCleanup();
|
2009-02-20 21:35:52 -05:00
|
|
|
int TypeSize(struct ValueType *Typ, int ArraySize);
|
|
|
|
int TypeSizeValue(struct Value *Val);
|
2009-03-02 17:13:47 -05:00
|
|
|
int TypeStackSizeValue(struct Value *Val);
|
2009-03-06 01:00:51 -05:00
|
|
|
int TypeParseFront(struct ParseState *Parser, struct ValueType **Typ);
|
|
|
|
void TypeParseIdentPart(struct ParseState *Parser, struct ValueType *BasicTyp, struct ValueType **Typ, char **Identifier);
|
2009-02-20 21:35:52 -05:00
|
|
|
void TypeParse(struct ParseState *Parser, struct ValueType **Typ, char **Identifier);
|
2009-02-10 17:25:20 -05:00
|
|
|
struct ValueType *TypeGetMatching(struct ParseState *Parser, struct ValueType *ParentType, enum BaseType Base, int ArraySize, const char *Identifier);
|
2008-12-26 23:36:45 -05:00
|
|
|
|
2009-01-20 19:52:42 -05:00
|
|
|
/* heap.c */
|
|
|
|
void HeapInit();
|
|
|
|
void *HeapAllocStack(int Size);
|
2009-01-26 03:57:32 -05:00
|
|
|
int HeapPopStack(void *Addr, int Size);
|
2009-01-20 19:52:42 -05:00
|
|
|
void HeapPushStackFrame();
|
|
|
|
int HeapPopStackFrame();
|
|
|
|
void *HeapAlloc(int Size);
|
|
|
|
void HeapFree(void *Mem);
|
2008-10-12 20:53:28 -04:00
|
|
|
|
2009-01-23 06:34:12 -05:00
|
|
|
/* variable.c */
|
|
|
|
void VariableInit();
|
2009-03-11 06:01:32 -04:00
|
|
|
void VariableCleanup();
|
2009-03-15 06:44:56 -04:00
|
|
|
void VariableFree(struct Value *Val);
|
2009-03-11 19:49:10 -04:00
|
|
|
void VariableTableCleanup(struct Table *HashTable);
|
2009-02-01 06:31:18 -05:00
|
|
|
void *VariableAlloc(struct ParseState *Parser, int Size, int OnHeap);
|
|
|
|
void VariableStackPop(struct ParseState *Parser, struct Value *Var);
|
2009-02-26 04:56:22 -05:00
|
|
|
struct Value *VariableAllocValueAndData(struct ParseState *Parser, int DataSize, int IsLValue, struct Value *LValueFrom, int OnHeap);
|
2009-02-01 06:31:18 -05:00
|
|
|
struct Value *VariableAllocValueAndCopy(struct ParseState *Parser, struct Value *FromValue, int OnHeap);
|
2009-02-26 04:56:22 -05:00
|
|
|
struct Value *VariableAllocValueFromType(struct ParseState *Parser, struct ValueType *Typ, int IsLValue, struct Value *LValueFrom);
|
|
|
|
struct Value *VariableAllocValueFromExistingData(struct ParseState *Parser, struct ValueType *Typ, union AnyValue *FromValue, int IsLValue, struct Value *LValueFrom);
|
2009-02-19 18:29:35 -05:00
|
|
|
struct Value *VariableAllocValueShared(struct ParseState *Parser, struct Value *FromValue);
|
2009-02-20 21:35:52 -05:00
|
|
|
void VariableDefine(struct ParseState *Parser, char *Ident, struct Value *InitValue);
|
2009-02-01 06:31:18 -05:00
|
|
|
int VariableDefined(const char *Ident);
|
|
|
|
void VariableGet(struct ParseState *Parser, const char *Ident, struct Value **LVal);
|
2009-02-28 15:46:02 -05:00
|
|
|
void VariableDefinePlatformVar(struct ParseState *Parser, char *Ident, struct ValueType *Typ, union AnyValue *FromValue, int IsWritable);
|
2009-02-19 18:29:35 -05:00
|
|
|
void VariableStackFrameAdd(struct ParseState *Parser, int NumParams);
|
2009-02-01 06:31:18 -05:00
|
|
|
void VariableStackFramePop(struct ParseState *Parser);
|
2009-03-11 18:28:42 -04:00
|
|
|
struct Value *VariableStringLiteralGet(char *Ident);
|
|
|
|
void VariableStringLiteralDefine(char *Ident, struct Value *Val);
|
2009-02-01 06:31:18 -05:00
|
|
|
|
2009-02-24 06:16:37 -05:00
|
|
|
/* library.c */
|
|
|
|
void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction (*FuncList)[]);
|
|
|
|
void PrintInt(int Num, CharWriter *PutCh);
|
|
|
|
void PrintStr(const char *Str, CharWriter *PutCh);
|
|
|
|
void PrintFP(double Num, CharWriter *PutCh);
|
|
|
|
|
|
|
|
/* platform_support.c */
|
|
|
|
void ProgramFail(struct ParseState *Parser, const char *Message, ...);
|
|
|
|
void LexFail(struct LexState *Lexer, const char *Message, ...);
|
2009-03-11 19:49:10 -04:00
|
|
|
void PlatformCleanup();
|
2009-02-24 06:16:37 -05:00
|
|
|
void PlatformScanFile(const char *FileName);
|
|
|
|
char *PlatformGetLine(char *Buf, int MaxLen);
|
2009-03-15 05:57:19 -04:00
|
|
|
int PlatformGetCharacter();
|
2009-02-24 06:16:37 -05:00
|
|
|
void PlatformPutc(unsigned char OutCh);
|
|
|
|
void PlatformPrintf(const char *Format, ...);
|
|
|
|
void PlatformVPrintf(const char *Format, va_list Args);
|
2009-02-28 00:43:28 -05:00
|
|
|
void PlatformExit();
|
2009-02-28 15:46:02 -05:00
|
|
|
void PlatformLibraryInit();
|
2009-02-24 06:16:37 -05:00
|
|
|
|
2009-01-23 06:34:12 -05:00
|
|
|
#endif /* PICOC_H */
|