EnigmaDriver - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

EnigmaDriver is the LateralGM-ENIGMA Plugin's implementation of the ENIGMA-IDE interface specification.

The following set of key functions exist:

dllexport const char* libInit(EnigmaCallbacks ef) //Initializes the library with a toolkit of callbacks.
dllexport SyntaxError definitionsModified(char* wscode, char* yaml) //Passes in settings and C definitions (e.g. function definitions), as well as API selections, so that the library knows how to handle the code (along with future code and the compilation options)
dllexport SyntaxError syntaxCheck(int scriptCount, char** scriptNames, char* code) //Syntax checks a piece of code in accordance with an existing set of script names.
dllexport int compileEGMf(EnigmaStruct es, char* outname, int mode) //compiles the game according to mode. Resources are provided in the EnigmaStruct, and the desired output filename is provided by outname (how it is handled is determined by the mode).

The following compilation modes exist:

const int MODE_RUN = 0; //outname designates a temporary location that should immediately be run after compiling.
const int MODE_DEBUG = 1; //similar to run/compile, but compiles with many fail-safes in place to find problem areas quicker.
const int MODE_DESIGN = 2; //runs a game in ENIGMA's special Design Mode (see Design Mode). A file will be generated with the set of changes that result from the run.
const int MODE_COMPILE = 3; //outname designates a final location. Debug fail-safes will be turned off, so problem areas will probably lead to disaster (see segfault).
const int MODE_REBUILD = 4; //Cleans the build libraries, in case runs are misbehaving, since sometimes compiled files don't get rebuilt when they should.

Notes:

A set of functions for finding out available language constructs, such as functions, typenames, and globals exist. These are primarily used to syntax highlight keywords, as well as to provide a list of available constructs that the user can search through to see what they can use, and to get the arguments to functions.

dllexport const char* first_available_resource() //Returns the name of the first resource on the list, or "" otherwise.
dllexport bool resource_isFunction() //Returns whether the resource can be called as a function
dllexport int resource_argCountMin() //Returns the minimum number of arguments to the function
dllexport int resource_argCountMax() //Returns the maximum number of arguments to the function
dllexport int resource_overloadCount() //Returns the number of times the function was declared in the parsed sources
dllexport const char* resource_parameters(int i) //Returns a simple string of parameters and defaults that would serve as the prototype of this function
// WARNING: The returned pointer to the string is INVALIDATED upon the next call to definitionsModified().
dllexport bool resource_isTypeName() //Returns whether the resource can be used as a typename.
dllexport bool resource_isGlobal()   //Returns whether the resource is nothing but a global variable.
dllexport const char* next_available_resource() //Returns the name of the next resource on the list, or "" otherwise.
dllexport bool resources_atEnd() //Returns whether we're really done iterating the list