Cleanup export.h

See #42
This commit is contained in:
Alexander Batalov 2022-06-18 16:39:39 +03:00
parent 233a13aee7
commit 4d5489cdea
2 changed files with 26 additions and 27 deletions

View File

@ -7,11 +7,35 @@
#include <ctype.h>
#include <string.h>
typedef struct ExternalVariable {
char name[32];
char* programName;
opcode_t type;
union {
int value;
char* stringValue;
};
} ExternalVariable;
typedef struct ExternalProcedure {
char name[32];
Program* program;
int argumentCount;
int address;
} ExternalProcedure;
static unsigned int _hashName(const char* identifier);
static ExternalProcedure* externalProcedureFind(const char* identifier);
static ExternalProcedure* externalProcedureAdd(const char* identifier);
static ExternalVariable* externalVariableFind(const char* identifier);
static ExternalVariable* externalVariableAdd(const char* identifier);
static void _removeProgramReferences(Program* program);
// 0x570C00
ExternalProcedure gExternalProcedures[1013];
static ExternalProcedure gExternalProcedures[1013];
// 0x57BA1C
ExternalVariable gExternalVariables[1013];
static ExternalVariable gExternalVariables[1013];
// NOTE: Inlined.
//

View File

@ -3,34 +3,9 @@
#include "interpreter.h"
typedef struct ExternalVariable {
char name[32];
char* programName;
opcode_t type;
union {
int value;
char* stringValue;
};
} ExternalVariable;
typedef struct ExternalProcedure {
char name[32];
Program* program;
int argumentCount;
int address;
} ExternalProcedure;
extern ExternalProcedure gExternalProcedures[1013];
extern ExternalVariable gExternalVariables[1013];
ExternalProcedure* externalProcedureFind(const char* identifier);
ExternalProcedure* externalProcedureAdd(const char* identifier);
ExternalVariable* externalVariableFind(const char* identifier);
ExternalVariable* externalVariableAdd(const char* identifier);
int externalVariableSetValue(Program* program, const char* identifier, opcode_t opcode, int data);
int externalVariableGetValue(Program* program, const char* name, opcode_t* opcodePtr, int* dataPtr);
int externalVariableCreate(Program* program, const char* identifier);
void _removeProgramReferences(Program* program);
void _initExport();
void externalVariablesClear();
Program* externalProcedureGetProgram(const char* identifier, int* addressPtr, int* argumentCountPtr);