Compare commits

...

2 Commits

Author SHA1 Message Date
Theunis J. Botha 68fb504899 fix systems 2021-09-09 13:21:15 +02:00
Theunis J. Botha d96164a82c fix systems 2021-09-09 13:20:20 +02:00
8 changed files with 214 additions and 3 deletions

34
r3.php
View File

@ -428,6 +428,34 @@ function generateInherited($file, $restoreTokens)
updateSection($file, 'GENERATED_INHERITED' , $updates);
}
function generateConstructors($file, $command)
{
echo $file;
$token = 'GENERATED_CONSTRUCTOR';
if (preg_match('/system_base/', $command)) {
$constructor = file_get_contents('src/templates/system_base_constructor.template');
}
if (preg_match('/\bsystem\b/', $command)) {
$constructor = file_get_contents('src/templates/system_extends_constructor.template');
$token = 'GENERATED_CONSTRUCTOR_EXTENDS';
}
if (preg_match('/\bnormal\b/', $command)) {
$constructor = file_get_contents('src/templates/constructor.template');
}
if (preg_match('/\bextends\b/', $command)) {
$constructor = file_get_contents('src/templates/constructor_extends.template');
$token = 'GENERATED_CONSTRUCTOR_EXTENDS';
}
updateSection($file, $token , $constructor);
}
function generateInitOptions($file, $tokens)
{
$token = 'CUSTOM_OPTIONS';
@ -1168,7 +1196,7 @@ function generateR3($nodes, $graph)
$tokens = loadSaved($r3File, getTokens('CUSTOM'));
$template = file_get_contents('src/templates/r3-base.template');
$template = file_get_contents('src/templates/r3_base.template');
$version = file_get_contents('version');
@ -1302,7 +1330,7 @@ function generateR3Dist($nodes)
{
$r3jsFile = 'dist/r3.js';
$r3jsSource = 'src/r3/r3-r3.js';
$r3jsBaseTemplate = 'src/templates/r3-base.template';
$r3jsBaseTemplate = 'src/templates/r3_base.template';
$r3js = fopen($r3jsFile, "w");
ftruncate($r3js, 0);
@ -1615,6 +1643,8 @@ foreach ($files as $file) {
}
}
generateConstructors($file, $argv[3]);
generateMethods($file, $tokens);
generateStaticMethods($file, $tokens);

View File

@ -0,0 +1,15 @@
class R3 {
static version = 'VERSION';
static compileDate = 'DATE';
}
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//GENERATED_DEFINES_START
//GENERATED_DEFINES_END
//CUSTOM_CONVENIENT_DEFINES_START
//CUSTOM_CONVENIENT_DEFINES_END
module.exports = R3;

View File

@ -0,0 +1,57 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
/**
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_STATIC_OPTIONS_START
CUSTOM_STATIC_OPTIONS_END
CUSTOM_EVENT_LISTENERS_START
CUSTOM_EVENT_LISTENERS_END
CUSTOM_STATIC_EVENT_LISTENERS_START
CUSTOM_STATIC_EVENT_LISTENERS_END
CUSTOM_METHODS_START
CUSTOM_METHODS_END
CUSTOM_STATIC_METHODS_START
CUSTOM_STATIC_METHODS_END
**/
class CLASS_NAME {
//GENERATED_CONSTRUCTOR_START
//GENERATED_CONSTRUCTOR_END
//GENERATED_METHODS_START
//GENERATED_METHODS_END
//GENERATED_STATIC_METHODS_START
//GENERATED_STATIC_METHODS_END
//GENERATED_EVENT_LISTENER_METHODS_START
//GENERATED_EVENT_LISTENER_METHODS_END
//GENERATED_STATIC_EVENT_LISTENER_METHODS_START
//GENERATED_STATIC_EVENT_LISTENER_METHODS_END
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
//GENERATED_STATIC_OPTIONS_INIT_START
//GENERATED_STATIC_OPTIONS_INIT_END
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = CLASS_NAME;

View File

@ -0,0 +1,20 @@
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
//CUSTOM_OPTIONS_INIT_END
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
//CUSTOM_AFTER_INIT_START
//CUSTOM_AFTER_INIT_END
}

View File

@ -0,0 +1,66 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
/**
GENERATED_INHERITED_START
GENERATED_INHERITED_END
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_STATIC_OPTIONS_START
Started=false
Subscriptions={}
CUSTOM_STATIC_OPTIONS_END
CUSTOM_EVENT_LISTENERS_START
CUSTOM_EVENT_LISTENERS_END
CUSTOM_STATIC_EVENT_LISTENERS_START
CUSTOM_STATIC_EVENT_LISTENERS_END
CUSTOM_METHODS_START
CUSTOM_METHODS_END
CUSTOM_STATIC_METHODS_START
Start(options) - Starts the system by registering subscriptions to events
Stop(options) - Stops the system by removing these subscriptions to events
CUSTOM_STATIC_METHODS_END
**/
class CLASS_NAME extends EXTEND_CLASS {
//GENERATED_CONSTRUCTOR_EXTENDS_START
//GENERATED_CONSTRUCTOR_EXTENDS_END
//GENERATED_METHODS_START
//GENERATED_METHODS_END
//GENERATED_STATIC_METHODS_START
//GENERATED_STATIC_METHODS_END
//GENERATED_EVENT_LISTENER_METHODS_START
//GENERATED_EVENT_LISTENER_METHODS_END
//GENERATED_STATIC_EVENT_LISTENER_METHODS_START
//GENERATED_STATIC_EVENT_LISTENER_METHODS_END
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
//GENERATED_STATIC_OPTIONS_INIT_START
//GENERATED_STATIC_OPTIONS_INIT_END
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END
module.exports = CLASS_NAME;

View File

@ -0,0 +1,22 @@
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
//CUSTOM_OPTIONS_INIT_END
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
//CUSTOM_AFTER_INIT_START
//CUSTOM_AFTER_INIT_END
}

View File

@ -57,6 +57,7 @@ CUSTOM_ASYNC_METHOD
CUSTOM_BEFORE_INIT
CUSTOM_BEFORE_STATIC_SYSTEM_START
CUSTOM_BEFORE_STATIC_SYSTEM_STOP
CUSTOM_BEFORE_SYSTEM
CUSTOM_BEFORE_SYSTEM_START
CUSTOM_BEFORE_SYSTEM_STOP
CUSTOM_CONVENIENT_DEFINES

View File

@ -1 +1 @@
2.0.228
2.0.440