@@ -1,10 +1,18 @@
#ifndef COMPILER_H
#define COMPILER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "vm/ByteCode.h"
ByteCode* cCompile();
const char* cGetError();
int cGetLine();
+}
#endif
@@ -1,6 +1,10 @@
#ifndef DATATYPE_H
#define DATATYPE_H
#include <stdbool.h>
#include "Types.h"
@@ -86,4 +90,8 @@ void gstsDelete();
Structs* gstsGet();
Struct* gstsAdd(const char* name);
@@ -1,6 +1,14 @@
#ifndef TEST_H
#define TEST_H
void tsStart(const char* path);
#ifndef TYPES_H
#define TYPES_H
#include <stdint.h>
typedef int8_t int8;
@@ -8,4 +12,8 @@ typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
#ifndef MATH_H
#define MATH_H
void lMathRegister();
#ifndef TIME_H
#define TIME_H
void lTimeRegister();
@@ -23,7 +23,7 @@ mathDep = cc.find_library('m', required : true)
args = ['-Wall', '-Wextra', '-pedantic', '-Werror', '-O3']
-library('lonely_tiger',
+static_library('lonely_tiger',
sources: src,
dependencies : mathDep,
c_args: args)
#ifndef FILE_H
#define FILE_H
typedef void (*FileError)(const char*, ...);
@@ -12,4 +16,8 @@ int fRead();
int fPeek();
bool fReadIf(int c);
#ifndef TOKEN_H
#define TOKEN_H
typedef enum {
T_VOID,
T_INT32,
@@ -76,4 +80,8 @@ typedef enum {
const char* tGetName(Token token);
Token tFromName(const char* name);
#ifndef TOKENIZER_H
#define TOKENIZER_H
@@ -21,4 +25,8 @@ const char* tReadString();
int tGetMarker();
void tReset(int marker);
@@ -1,8 +1,16 @@
#ifndef BYTECODEPRINTER_H
#define BYTECODEPRINTER_H
void btPrint(ByteCode* bt);
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
#include "DataType.h"
@@ -43,4 +47,8 @@ bool gfsAdd(Function* f);
bool gfsCall(Script* sc, int id);
void gfsDelete();
#ifndef SNUVI_UTILS_H
#define SNUVI_UTILS_H
bool isLetter(int c);
bool isNumber(int c);
bool isAllowedInName(int c);
#ifndef STRINGINTMAP_H
#define STRINGINTMAP_H
@@ -36,4 +40,8 @@ void vsReset(Variables* v);
void vsEnterScope(Variables* v, Scope* s);
void vsLeaveScope(Variables* v, Scope* s);
#ifndef ARRAYS_H
#define ARRAYS_H
@@ -26,4 +30,8 @@ int asAllocate(SnuviArrays* as, int typeSize, int length);
SnuviArray* asGet(SnuviArrays* as, int p);
void asDeleteArray(SnuviArrays* as, SnuviArray* a, int p);
#ifndef BYTECODE_H
#define BYTECODE_H
#include "vm/Operation.h"
typedef struct {
@@ -18,4 +22,8 @@ void bcAddBytes(ByteCode* bc, const void* data, int length);
int bcGetAddress(ByteCode* bc);
void bcInsertBytes(ByteCode* bc, const void* data, int length, int address);
#ifndef OPERATION_H
#define OPERATION_H
#define OP_INTEGRAL(TYPE) OP_##TYPE##_INT32, OP_##TYPE##_INT64
#define OP_NUMBER(TYPE) OP_INTEGRAL(TYPE), OP_##TYPE##_FLOAT
#define OP_TYPE(TYPE) OP_NUMBER(TYPE), OP_##TYPE##_BOOL
@@ -74,4 +78,8 @@ typedef enum Operation {
OP_CALL
} Operation;
#ifndef SCRIPT_H
#define SCRIPT_H
#include "vm/Arrays.h"
@@ -40,4 +44,8 @@ bool sPushNullPointer(Script* sc);
void* sCheckAddress(Script* sc, Pointer* p, int length);
bool sGetPointerLength(Script* sc, Pointer* p, int32* length);