2020-10-28 05:16:30 +00:00
|
|
|
#ifndef COSMOMAIN_H
|
|
|
|
#define COSMOMAIN_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2020-12-04 06:04:14 +00:00
|
|
|
//#define NAN_BOXXED
|
|
|
|
|
2020-10-28 05:16:30 +00:00
|
|
|
// forward declare *most* stuff so our headers are cleaner
|
|
|
|
typedef struct CState CState;
|
|
|
|
typedef struct CChunk CChunk;
|
2020-12-04 06:04:14 +00:00
|
|
|
#ifdef NAN_BOXXED
|
|
|
|
typedef union CValue CValue;
|
|
|
|
#else
|
2020-10-28 05:16:30 +00:00
|
|
|
typedef struct CValue CValue;
|
2020-12-04 06:04:14 +00:00
|
|
|
#endif
|
2020-10-28 05:16:30 +00:00
|
|
|
|
|
|
|
// objs
|
|
|
|
typedef struct CObj CObj;
|
|
|
|
typedef struct CObjString CObjString;
|
|
|
|
typedef struct CObjUpval CObjUpval;
|
|
|
|
typedef struct CObjFunction CObjFunction;
|
|
|
|
typedef struct CObjCFunction CObjCFunction;
|
2020-11-10 01:44:12 +00:00
|
|
|
typedef struct CObjMethod CObjMethod;
|
2020-11-17 01:58:16 +00:00
|
|
|
typedef struct CObjObject CObjObject;
|
2020-10-28 05:16:30 +00:00
|
|
|
typedef struct CObjClosure CObjClosure;
|
|
|
|
|
|
|
|
typedef uint8_t INSTRUCTION;
|
|
|
|
|
|
|
|
#define COSMOMAX_UPVALS 80
|
|
|
|
#define FRAME_MAX 64
|
|
|
|
#define STACK_MAX (256 * FRAME_MAX)
|
|
|
|
|
|
|
|
#define COSMO_API extern
|
|
|
|
#define UNNAMEDCHUNK "_main"
|
|
|
|
|
|
|
|
#define CERROR(err) \
|
|
|
|
printf("%s : %s\n", "[ERROR]", err)
|
|
|
|
|
|
|
|
#endif
|