Header File Docs

To make module development as easy as possible, Modules can be written like a C header file, or at least as close as it could be

Types

Types are the least C-like, just because it needs a lot more information than a typical C declaration provides.

// Syntax is as follows:
//typedef [name], [letter id], [unconnected icon], [connected icon], [colour], [output], [input tag type];
typedef bool, b, circle-thin, circle, #FF0000, %, checkbox;

The names auto and exec are already taken, as well as the letters ids g and e

Name

The name of the type

Letter ID

The id that the editor uses to build the nodes, can be anything but I'd recommend using a letter

Unconnected Icon

The Font Awesome 4 Icon to use on unconnected nubs

Connected Icon

The Font Awesome 4 Icon to use on connected nubs

Colour

Colour that represents that type, it will influence the icon, gradients, and lines connecting nubs

Output

The format for the input value, where % will be replaced. To make a string type you would put in "%"

Input Tag Type

Type attribute for the input tag where the input value comes from

Nodes

Functions that can be called inside the compiled language can be declared exactly how you'd expect for C

FILE* fopen(char* filename, char* mode);
void rewind(FILE* stream);
// If it's just a declaration, the node will output a function call

If the function is defined, everything inside the brackets will be the node's output

// auto means to use a generic nub that accepts any type
bool Equal(auto a, auto b)
{
    (a == b)
}
// The code inside is trim()'d so the white-space around it won't affect things

The parameters can be used in the function to reference that input on the node.

If a comment is put at the end of the function, it will replace the name. With this you can include any character in the name

bool BoolOr(bool a, bool b)
{
    (a || b)
} // Or (||)

int IntOr(int a, int b)
{
    (a | b)
} // Or (|)

Multiple named outputs can be added as well, though it's not very C

float out_float, bool out_bool ThatFunction(float in_float, bool in_bool); 

If the function starts with the start keyword, then it will be a starting node that spawns when a new document is created.

start exec Begin()
{
	%c0
}

If you need to, the custom keyword can be used to insert a node in the module-file format

custom If, 1, if (%0)\n{\n%o0\n}\nelse\n{\n%o1}\n%c2, e.;b.Condition;o.;e.True;e.False;e.Then; if

See the module-file docs for more info on this format

Structs/Classes

'struct' and 'class' mean the same thing, it creates a structure that can contain properties and methods.

struct Vector
{
    // Properties will have Get and Set nodes automatically created
    // But if you don't want a Set node created, use the 'const' keyword
    float x;
    float y;
    const float z;
    float GetLength();

    // colour is treated like a property, it doesn't matter what the name is, the type has to be colour
    colour c = "#0000FF";
}

The struct itself can have the 'const' keyword, which means it won't create break and make nodes, just a Get node for the struct's name.

// This could be used to represent libraries for example
const struct stdlib
{
    const int EOF;
    int fopen(char* filename, char* mode);
}

If the struct's name is Settings, it will be treated like the settings area in the module file format

struct Settings
{
	doc-link=https://link-to-documentation
	separator=;\n
	...
}

Check out the C or PHP module as an example