Refactoring (MAY BE BUGGY)
This commit is contained in:
66
src/data/data.h
Normal file
66
src/data/data.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
#include "../main.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
|
||||
/*
|
||||
functions map
|
||||
Contains the code of functions and types of their values
|
||||
*/
|
||||
extern std::map<std::string, Function> functions;
|
||||
|
||||
/*
|
||||
structs map
|
||||
Contains structs (see the Struct struct for more info)
|
||||
*/
|
||||
extern std::map<std::string, Struct> structs;
|
||||
|
||||
/*
|
||||
fnArgs vector
|
||||
Containst the arguments to be passed to a function
|
||||
*/
|
||||
extern std::vector<Literal> fnArgs;
|
||||
|
||||
// External library functions and other things
|
||||
|
||||
// Handle to loaded libraries
|
||||
extern std::map<std::string, void*> loadedLibraries;
|
||||
|
||||
// Map of function name to function pointer
|
||||
extern std::map<std::string, void*> externalFunctions;
|
||||
|
||||
// Libraries currently imported
|
||||
extern std::vector<std::string> libraries;
|
||||
|
||||
// catches stackmap
|
||||
extern std::stack<std::map<std::string, Direct>> catches;
|
||||
|
||||
// labelStack stack
|
||||
extern std::stack<std::map<std::string, int>> labelStack;
|
||||
|
||||
// variables map
|
||||
extern std::map<std::string, Literal> variables;
|
||||
|
||||
GroundValue literalToGroundValue(const Literal& lit);
|
||||
Literal groundValueToLiteral(const GroundValue& gv);
|
||||
void setVal(std::string varName, Literal value);
|
||||
|
||||
bool isInt(std::string in);
|
||||
bool isDouble(std::string in);
|
||||
bool isBool(std::string in);
|
||||
bool isString(std::string in);
|
||||
bool isChar(std::string in);
|
||||
bool isValue(std::string in);
|
||||
bool isDirect(std::string in);
|
||||
bool isLine(std::string in);
|
||||
bool isLabel(std::string in);
|
||||
bool isType(std::string in);
|
||||
bool isFunction(std::string in);
|
||||
bool isReferencingStruct(std::string in);
|
||||
|
||||
Types getType(std::string in);
|
||||
Types getLitType(Literal in);
|
||||
|
||||
void setVal(std::string varName, Literal value);
|
||||
Reference in New Issue
Block a user