#ifndef SCRIPT_H
#define SCRIPT_H

#include <stdbool.h>

#include "Object.h"

#define SCRIPT_STACK_SIZE 50
#define SCRIPT_ERROR_SIZE 256

typedef struct Script {
    char error[SCRIPT_ERROR_SIZE];
    unsigned char* byteCode;
    int byteCodeLength;
    int readIndex;
    Object stack[SCRIPT_STACK_SIZE];
    int stackIndex;
    int line;
} Script;

Script* sInit(unsigned char* byteCode, int codeLength);
void sDelete(Script* sc);

void sRun(Script* sc);

typedef bool (*ObjectPrinter)(Object*);
void sSetPrinter(ObjectPrinter p);

#endif