update templates working
parent
09b5000aca
commit
8778fa522c
26
.r3_history
26
.r3_history
|
@ -3,29 +3,3 @@ r3 create AnotherClass extends R3Object
|
|||
r3 create OneMore extends R3Object
|
||||
r3 create AgainMore extends R3Object
|
||||
r3 create AgainMoreAgain extends R3Object
|
||||
r3 update-templates
|
||||
r3 update-templates
|
||||
r3 create AnotherClass extends R3Object
|
||||
r3 create VectorApplierAgain extends Event
|
||||
r3 update-templates
|
||||
r3 update-templates
|
||||
r3 update-options
|
||||
r3 create AnotherClass extends R3Object
|
||||
r3 create AnotherClass extends R3Object
|
||||
r3 create VectorApplierAgain extends Event
|
||||
r3 create VectorApplierAgain extends Event
|
||||
r3 update-templates
|
||||
r3 create AnotherClass extends R3Object
|
||||
r3 create AnotherClass extends R3Object
|
||||
r3 create VectorApplierAgain extends Event
|
||||
r3 create VectorApplierAgain extends Event
|
||||
r3 update-templates
|
||||
r3 update-templates
|
||||
r3 update-templates
|
||||
r3 update-templates
|
||||
r3 update-templates
|
||||
r3 create AnotherClass extends R3Object
|
||||
r3 create AnotherClass extends R3Object
|
||||
r3 create VectorApplierAgain extends Event
|
||||
r3 create VectorApplierAgain extends Event
|
||||
r3 update-templates
|
||||
|
|
|
@ -4,28 +4,24 @@ const Utils = require('r3-utils');
|
|||
|
||||
/**
|
||||
|
||||
|
||||
|
||||
OPTIONS_START
|
||||
x=0
|
||||
y=1
|
||||
z=2
|
||||
x=1
|
||||
y=2
|
||||
z=3
|
||||
register=true
|
||||
OPTIONS_END
|
||||
|
||||
|
||||
|
||||
INSTANCE_OPTIONS_MAPPING_START
|
||||
x=side.x
|
||||
y=side.y
|
||||
z=side.z
|
||||
INSTANCE_OPTIONS_MAPPING_END
|
||||
|
||||
|
||||
|
||||
LINKED_OBJECTS_START
|
||||
LINKED_OBJECTS_END
|
||||
|
||||
|
||||
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
register
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
**/
|
||||
|
@ -48,26 +44,24 @@ class AnotherClass extends R3Object {
|
|||
|
||||
//OPTIONS_INIT_START
|
||||
if (Utils.UndefinedOrNull(options.x)) {
|
||||
options.x = 0;
|
||||
options.x = 1;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.y)) {
|
||||
options.y = 1;
|
||||
options.y = 2;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.z)) {
|
||||
options.z = 2;
|
||||
options.z = 3;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.register)) {
|
||||
options.register = true;
|
||||
}
|
||||
//OPTIONS_INIT_END
|
||||
|
||||
|
||||
//CUSTOM_OPTIONS_INIT_START
|
||||
//CUSTOM_OPTIONS_INIT_END
|
||||
|
||||
Object.assign(this, options);
|
||||
|
||||
|
||||
//CUSTOM_BEFORE_INIT_START
|
||||
//CUSTOM_BEFORE_INIT_END
|
||||
|
||||
|
@ -86,10 +80,9 @@ class AnotherClass extends R3Object {
|
|||
this.graphics.createInstance(
|
||||
{
|
||||
//CREATE_INSTANCE_OPTIONS_START
|
||||
'x': this.x,
|
||||
'y': this.y,
|
||||
'z': this.z,
|
||||
'register': this.register
|
||||
'side.x': this.x,
|
||||
'side.y': this.y,
|
||||
'side.z': this.z
|
||||
//CREATE_INSTANCE_OPTIONS_END
|
||||
},
|
||||
this
|
||||
|
@ -97,7 +90,6 @@ class AnotherClass extends R3Object {
|
|||
}
|
||||
//CREATE_INSTANCE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_CREATE_INSTANCE_START
|
||||
//CUSTOM_CREATE_INSTANCE_END
|
||||
|
||||
|
@ -117,24 +109,19 @@ class AnotherClass extends R3Object {
|
|||
|
||||
//UPDATE_INSTANCE_OPTIONS_START
|
||||
if (property === 'x') {
|
||||
this.instance.x = this.x;
|
||||
this.instance.side.x = this.x;
|
||||
return;
|
||||
}
|
||||
if (property === 'y') {
|
||||
this.instance.y = this.y;
|
||||
this.instance.side.y = this.y;
|
||||
return;
|
||||
}
|
||||
if (property === 'z') {
|
||||
this.instance.z = this.z;
|
||||
return;
|
||||
}
|
||||
if (property === 'register') {
|
||||
this.instance.register = this.register;
|
||||
this.instance.side.z = this.z;
|
||||
return;
|
||||
}
|
||||
//UPDATE_INSTANCE_OPTIONS_END
|
||||
|
||||
|
||||
//CUSTOM_UPDATE_INSTANCE_START
|
||||
//CUSTOM_UPDATE_INSTANCE_END
|
||||
|
||||
|
@ -154,24 +141,19 @@ class AnotherClass extends R3Object {
|
|||
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||
if (property === 'x') {
|
||||
this.x = this.instance.x;
|
||||
this.x = this.instance.side.x;
|
||||
return;
|
||||
}
|
||||
if (property === 'y') {
|
||||
this.y = this.instance.y;
|
||||
this.y = this.instance.side.y;
|
||||
return;
|
||||
}
|
||||
if (property === 'z') {
|
||||
this.z = this.instance.z;
|
||||
return;
|
||||
}
|
||||
if (property === 'register') {
|
||||
this.register = this.instance.register;
|
||||
this.z = this.instance.side.z;
|
||||
return;
|
||||
}
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||
|
||||
|
@ -189,7 +171,6 @@ class AnotherClass extends R3Object {
|
|||
this.emit(Event.DISPOSE_OBJECT, this);
|
||||
//DISPOSE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_DISPOSE_START
|
||||
//CUSTOM_DISPOSE_END
|
||||
|
||||
|
@ -208,7 +189,6 @@ class AnotherClass extends R3Object {
|
|||
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||
//DISPOSE_INSTANCE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_DISPOSE_INSTANCE_START
|
||||
//CUSTOM_DISPOSE_INSTANCE_END
|
||||
|
||||
|
@ -219,7 +199,6 @@ class AnotherClass extends R3Object {
|
|||
}
|
||||
//DISPOSE_INSTANCE_TEMPLATE_END
|
||||
|
||||
|
||||
//CUSTOM_IMPLEMENTATION_START
|
||||
//CUSTOM_IMPLEMENTATION_END
|
||||
|
||||
|
|
|
@ -4,21 +4,20 @@ const Utils = require('r3-utils');
|
|||
|
||||
/**
|
||||
|
||||
|
||||
|
||||
OPTIONS_START
|
||||
a=2.0
|
||||
b=3.0
|
||||
something='hello'
|
||||
OPTIONS_END
|
||||
|
||||
|
||||
INSTANCE_OPTIONS_MAPPING_START
|
||||
INSTANCE_OPTIONS_MAPPING_END
|
||||
|
||||
|
||||
LINKED_OBJECTS_START
|
||||
LINKED_OBJECTS_END
|
||||
|
||||
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
b
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
**/
|
||||
|
@ -40,15 +39,22 @@ class VectorApplierAgain extends Event {
|
|||
this.emit(Event.OBJECT_CREATED, this);
|
||||
|
||||
//OPTIONS_INIT_START
|
||||
if (Utils.UndefinedOrNull(options.a)) {
|
||||
options.a = 2.0;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.b)) {
|
||||
options.b = 3.0;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.something)) {
|
||||
options.something = 'hello';
|
||||
}
|
||||
//OPTIONS_INIT_END
|
||||
|
||||
|
||||
//CUSTOM_OPTIONS_INIT_START
|
||||
//CUSTOM_OPTIONS_INIT_END
|
||||
|
||||
Object.assign(this, options);
|
||||
|
||||
|
||||
//CUSTOM_BEFORE_INIT_START
|
||||
//CUSTOM_BEFORE_INIT_END
|
||||
|
||||
|
@ -67,7 +73,8 @@ class VectorApplierAgain extends Event {
|
|||
this.graphics.createInstance(
|
||||
{
|
||||
//CREATE_INSTANCE_OPTIONS_START
|
||||
|
||||
'a': this.a,
|
||||
'something': this.something
|
||||
//CREATE_INSTANCE_OPTIONS_END
|
||||
},
|
||||
this
|
||||
|
@ -75,7 +82,6 @@ class VectorApplierAgain extends Event {
|
|||
}
|
||||
//CREATE_INSTANCE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_CREATE_INSTANCE_START
|
||||
//CUSTOM_CREATE_INSTANCE_END
|
||||
|
||||
|
@ -94,9 +100,16 @@ class VectorApplierAgain extends Event {
|
|||
//UPDATE_INSTANCE_BEFORE_END
|
||||
|
||||
//UPDATE_INSTANCE_OPTIONS_START
|
||||
if (property === 'a') {
|
||||
this.instance.a = this.a;
|
||||
return;
|
||||
}
|
||||
if (property === 'something') {
|
||||
this.instance.something = this.something;
|
||||
return;
|
||||
}
|
||||
//UPDATE_INSTANCE_OPTIONS_END
|
||||
|
||||
|
||||
//CUSTOM_UPDATE_INSTANCE_START
|
||||
//CUSTOM_UPDATE_INSTANCE_END
|
||||
|
||||
|
@ -115,9 +128,16 @@ class VectorApplierAgain extends Event {
|
|||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||
if (property === 'a') {
|
||||
this.a = this.instance.a;
|
||||
return;
|
||||
}
|
||||
if (property === 'something') {
|
||||
this.something = this.instance.something;
|
||||
return;
|
||||
}
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||
|
||||
|
@ -135,7 +155,6 @@ class VectorApplierAgain extends Event {
|
|||
this.emit(Event.DISPOSE_OBJECT, this);
|
||||
//DISPOSE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_DISPOSE_START
|
||||
//CUSTOM_DISPOSE_END
|
||||
|
||||
|
@ -154,7 +173,6 @@ class VectorApplierAgain extends Event {
|
|||
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||
//DISPOSE_INSTANCE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_DISPOSE_INSTANCE_START
|
||||
//CUSTOM_DISPOSE_INSTANCE_END
|
||||
|
||||
|
@ -165,7 +183,6 @@ class VectorApplierAgain extends Event {
|
|||
}
|
||||
//DISPOSE_INSTANCE_TEMPLATE_END
|
||||
|
||||
|
||||
//CUSTOM_IMPLEMENTATION_START
|
||||
//CUSTOM_IMPLEMENTATION_END
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class R3 {
|
|||
}
|
||||
|
||||
static version() {
|
||||
return 'Sat Jun 19 2021 14:40:43 GMT+0000 (Coordinated Universal Time)';
|
||||
return 'Sun Jun 20 2021 06:12:04 GMT+0000 (Coordinated Universal Time)';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1772,7 +1772,7 @@ var R3 = /*#__PURE__*/function () {
|
|||
_createClass(R3, null, [{
|
||||
key: "version",
|
||||
value: function version() {
|
||||
return 'Sat Jun 19 2021 14:40:43 GMT+0000 (Coordinated Universal Time)';
|
||||
return 'Sun Jun 20 2021 06:12:04 GMT+0000 (Coordinated Universal Time)';
|
||||
}
|
||||
}]);
|
||||
|
||||
|
|
|
@ -4,28 +4,24 @@ const Utils = require('r3-utils');
|
|||
|
||||
/**
|
||||
|
||||
|
||||
|
||||
OPTIONS_START
|
||||
x=0
|
||||
y=1
|
||||
z=2
|
||||
x=1
|
||||
y=2
|
||||
z=3
|
||||
register=true
|
||||
OPTIONS_END
|
||||
|
||||
|
||||
|
||||
INSTANCE_OPTIONS_MAPPING_START
|
||||
x=side.x
|
||||
y=side.y
|
||||
z=side.z
|
||||
INSTANCE_OPTIONS_MAPPING_END
|
||||
|
||||
|
||||
|
||||
LINKED_OBJECTS_START
|
||||
LINKED_OBJECTS_END
|
||||
|
||||
|
||||
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
register
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
**/
|
||||
|
@ -48,26 +44,24 @@ class AnotherClass extends R3Object {
|
|||
|
||||
//OPTIONS_INIT_START
|
||||
if (Utils.UndefinedOrNull(options.x)) {
|
||||
options.x = 0;
|
||||
options.x = 1;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.y)) {
|
||||
options.y = 1;
|
||||
options.y = 2;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.z)) {
|
||||
options.z = 2;
|
||||
options.z = 3;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.register)) {
|
||||
options.register = true;
|
||||
}
|
||||
//OPTIONS_INIT_END
|
||||
|
||||
|
||||
//CUSTOM_OPTIONS_INIT_START
|
||||
//CUSTOM_OPTIONS_INIT_END
|
||||
|
||||
Object.assign(this, options);
|
||||
|
||||
|
||||
//CUSTOM_BEFORE_INIT_START
|
||||
//CUSTOM_BEFORE_INIT_END
|
||||
|
||||
|
@ -86,10 +80,9 @@ class AnotherClass extends R3Object {
|
|||
this.graphics.createInstance(
|
||||
{
|
||||
//CREATE_INSTANCE_OPTIONS_START
|
||||
'x': this.x,
|
||||
'y': this.y,
|
||||
'z': this.z,
|
||||
'register': this.register
|
||||
'side.x': this.x,
|
||||
'side.y': this.y,
|
||||
'side.z': this.z
|
||||
//CREATE_INSTANCE_OPTIONS_END
|
||||
},
|
||||
this
|
||||
|
@ -97,7 +90,6 @@ class AnotherClass extends R3Object {
|
|||
}
|
||||
//CREATE_INSTANCE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_CREATE_INSTANCE_START
|
||||
//CUSTOM_CREATE_INSTANCE_END
|
||||
|
||||
|
@ -117,24 +109,19 @@ class AnotherClass extends R3Object {
|
|||
|
||||
//UPDATE_INSTANCE_OPTIONS_START
|
||||
if (property === 'x') {
|
||||
this.instance.x = this.x;
|
||||
this.instance.side.x = this.x;
|
||||
return;
|
||||
}
|
||||
if (property === 'y') {
|
||||
this.instance.y = this.y;
|
||||
this.instance.side.y = this.y;
|
||||
return;
|
||||
}
|
||||
if (property === 'z') {
|
||||
this.instance.z = this.z;
|
||||
return;
|
||||
}
|
||||
if (property === 'register') {
|
||||
this.instance.register = this.register;
|
||||
this.instance.side.z = this.z;
|
||||
return;
|
||||
}
|
||||
//UPDATE_INSTANCE_OPTIONS_END
|
||||
|
||||
|
||||
//CUSTOM_UPDATE_INSTANCE_START
|
||||
//CUSTOM_UPDATE_INSTANCE_END
|
||||
|
||||
|
@ -154,24 +141,19 @@ class AnotherClass extends R3Object {
|
|||
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||
if (property === 'x') {
|
||||
this.x = this.instance.x;
|
||||
this.x = this.instance.side.x;
|
||||
return;
|
||||
}
|
||||
if (property === 'y') {
|
||||
this.y = this.instance.y;
|
||||
this.y = this.instance.side.y;
|
||||
return;
|
||||
}
|
||||
if (property === 'z') {
|
||||
this.z = this.instance.z;
|
||||
return;
|
||||
}
|
||||
if (property === 'register') {
|
||||
this.register = this.instance.register;
|
||||
this.z = this.instance.side.z;
|
||||
return;
|
||||
}
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||
|
||||
|
@ -189,7 +171,6 @@ class AnotherClass extends R3Object {
|
|||
this.emit(Event.DISPOSE_OBJECT, this);
|
||||
//DISPOSE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_DISPOSE_START
|
||||
//CUSTOM_DISPOSE_END
|
||||
|
||||
|
@ -208,7 +189,6 @@ class AnotherClass extends R3Object {
|
|||
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||
//DISPOSE_INSTANCE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_DISPOSE_INSTANCE_START
|
||||
//CUSTOM_DISPOSE_INSTANCE_END
|
||||
|
||||
|
@ -219,7 +199,6 @@ class AnotherClass extends R3Object {
|
|||
}
|
||||
//DISPOSE_INSTANCE_TEMPLATE_END
|
||||
|
||||
|
||||
//CUSTOM_IMPLEMENTATION_START
|
||||
//CUSTOM_IMPLEMENTATION_END
|
||||
|
||||
|
|
|
@ -4,21 +4,20 @@ const Utils = require('r3-utils');
|
|||
|
||||
/**
|
||||
|
||||
|
||||
|
||||
OPTIONS_START
|
||||
a=2.0
|
||||
b=3.0
|
||||
something='hello'
|
||||
OPTIONS_END
|
||||
|
||||
|
||||
INSTANCE_OPTIONS_MAPPING_START
|
||||
INSTANCE_OPTIONS_MAPPING_END
|
||||
|
||||
|
||||
LINKED_OBJECTS_START
|
||||
LINKED_OBJECTS_END
|
||||
|
||||
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||
b
|
||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
**/
|
||||
|
@ -40,15 +39,22 @@ class VectorApplierAgain extends Event {
|
|||
this.emit(Event.OBJECT_CREATED, this);
|
||||
|
||||
//OPTIONS_INIT_START
|
||||
if (Utils.UndefinedOrNull(options.a)) {
|
||||
options.a = 2.0;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.b)) {
|
||||
options.b = 3.0;
|
||||
}
|
||||
if (Utils.UndefinedOrNull(options.something)) {
|
||||
options.something = 'hello';
|
||||
}
|
||||
//OPTIONS_INIT_END
|
||||
|
||||
|
||||
//CUSTOM_OPTIONS_INIT_START
|
||||
//CUSTOM_OPTIONS_INIT_END
|
||||
|
||||
Object.assign(this, options);
|
||||
|
||||
|
||||
//CUSTOM_BEFORE_INIT_START
|
||||
//CUSTOM_BEFORE_INIT_END
|
||||
|
||||
|
@ -67,7 +73,8 @@ class VectorApplierAgain extends Event {
|
|||
this.graphics.createInstance(
|
||||
{
|
||||
//CREATE_INSTANCE_OPTIONS_START
|
||||
|
||||
'a': this.a,
|
||||
'something': this.something
|
||||
//CREATE_INSTANCE_OPTIONS_END
|
||||
},
|
||||
this
|
||||
|
@ -75,7 +82,6 @@ class VectorApplierAgain extends Event {
|
|||
}
|
||||
//CREATE_INSTANCE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_CREATE_INSTANCE_START
|
||||
//CUSTOM_CREATE_INSTANCE_END
|
||||
|
||||
|
@ -94,9 +100,16 @@ class VectorApplierAgain extends Event {
|
|||
//UPDATE_INSTANCE_BEFORE_END
|
||||
|
||||
//UPDATE_INSTANCE_OPTIONS_START
|
||||
if (property === 'a') {
|
||||
this.instance.a = this.a;
|
||||
return;
|
||||
}
|
||||
if (property === 'something') {
|
||||
this.instance.something = this.something;
|
||||
return;
|
||||
}
|
||||
//UPDATE_INSTANCE_OPTIONS_END
|
||||
|
||||
|
||||
//CUSTOM_UPDATE_INSTANCE_START
|
||||
//CUSTOM_UPDATE_INSTANCE_END
|
||||
|
||||
|
@ -115,9 +128,16 @@ class VectorApplierAgain extends Event {
|
|||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||
if (property === 'a') {
|
||||
this.a = this.instance.a;
|
||||
return;
|
||||
}
|
||||
if (property === 'something') {
|
||||
this.something = this.instance.something;
|
||||
return;
|
||||
}
|
||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||
|
||||
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||
|
||||
|
@ -135,7 +155,6 @@ class VectorApplierAgain extends Event {
|
|||
this.emit(Event.DISPOSE_OBJECT, this);
|
||||
//DISPOSE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_DISPOSE_START
|
||||
//CUSTOM_DISPOSE_END
|
||||
|
||||
|
@ -154,7 +173,6 @@ class VectorApplierAgain extends Event {
|
|||
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||
//DISPOSE_INSTANCE_BEFORE_END
|
||||
|
||||
|
||||
//CUSTOM_DISPOSE_INSTANCE_START
|
||||
//CUSTOM_DISPOSE_INSTANCE_END
|
||||
|
||||
|
@ -165,7 +183,6 @@ class VectorApplierAgain extends Event {
|
|||
}
|
||||
//DISPOSE_INSTANCE_TEMPLATE_END
|
||||
|
||||
|
||||
//CUSTOM_IMPLEMENTATION_START
|
||||
//CUSTOM_IMPLEMENTATION_END
|
||||
|
||||
|
|
|
@ -10,47 +10,35 @@ else {
|
|||
echo "argc and argv disabled\n";
|
||||
}
|
||||
|
||||
$save = [
|
||||
'options' => '/^\s*\bOPTIONS_START\b.*\bOPTIONS_END\b/sm',
|
||||
'instance_mappings' => '/^\s*\bINSTANCE_OPTIONS_MAPPING_START\b.*\bINSTANCE_OPTIONS_MAPPING_END\b/sm',
|
||||
'linked_objects' => '/^\s*\bLINKED_OBJECTS_START\b.*\bLINKED_OBJECTS_END\b/sm',
|
||||
'excluded_options' => '/^\s*\bEXCLUDED_FROM_INSTANCE_OPTIONS_START\b.*\bEXCLUDED_FROM_INSTANCE_OPTIONS_END\b/sm',
|
||||
'custom_options' => '/^\s*\/\/\bCUSTOM_OPTIONS_INIT_START\b.*\/\/\bCUSTOM_OPTIONS_INIT_END\b/sm',
|
||||
'custom_before_init' => '/^\s*\/\/\bCUSTOM_BEFORE_INIT_START\b.*\/\/\bCUSTOM_BEFORE_INIT_END\b/sm',
|
||||
'custom_create_instance' => '/^\s*\/\/\bCUSTOM_CREATE_INSTANCE_START\b.*\/\/\bCUSTOM_CREATE_INSTANCE_END\b/sm',
|
||||
'custom_update_instance' => '/^\s*\/\/\bCUSTOM_UPDATE_INSTANCE_START\b.*\/\/\bCUSTOM_UPDATE_INSTANCE_END\b/sm',
|
||||
'custom_update_from_instance' => '/^\s*\/\/\bCUSTOM_UPDATE_FROM_INSTANCE_START\b.*\/\/\bCUSTOM_UPDATE_FROM_INSTANCE_END\b/sm',
|
||||
'custom_dispose' => '/^\s*\/\/\bCUSTOM_DISPOSE_START\b.*\/\/\bCUSTOM_DISPOSE_END\b/sm',
|
||||
'custom_dispose_instance' => '/^\s*\/\/\bCUSTOM_DISPOSE_INSTANCE_START\b.*\/\/\bCUSTOM_DISPOSE_INSTANCE_END\b/sm',
|
||||
'custom_implementation' => '/^\s*\/\/\bCUSTOM_IMPLEMENTATION_START\b.*\/\/\bCUSTOM_IMPLEMENTATION_END\b/sm'
|
||||
$tokens = [
|
||||
'OPTIONS_START' => 'OPTIONS_END',
|
||||
'INSTANCE_OPTIONS_MAPPING_START' => 'INSTANCE_OPTIONS_MAPPING_END',
|
||||
'LINKED_OBJECTS_START' => 'LINKED_OBJECTS_END',
|
||||
'EXCLUDED_FROM_INSTANCE_OPTIONS_START' => 'EXCLUDED_FROM_INSTANCE_OPTIONS_END',
|
||||
'CUSTOM_OPTIONS_INIT_START' => 'CUSTOM_OPTIONS_INIT_END',
|
||||
'CUSTOM_BEFORE_INIT_START' => 'CUSTOM_BEFORE_INIT_END',
|
||||
'CUSTOM_CREATE_INSTANCE_START' => 'CUSTOM_CREATE_INSTANCE_END',
|
||||
'CUSTOM_UPDATE_INSTANCE_START' => 'CUSTOM_UPDATE_INSTANCE_END',
|
||||
'CUSTOM_UPDATE_FROM_INSTANCE_START' => 'CUSTOM_UPDATE_FROM_INSTANCE_END',
|
||||
'CUSTOM_DISPOSE_START' => 'CUSTOM_DISPOSE_END',
|
||||
'CUSTOM_DISPOSE_INSTANCE_START' => 'CUSTOM_DISPOSE_INSTANCE_END',
|
||||
'CUSTOM_IMPLEMENTATION_START' => 'CUSTOM_IMPLEMENTATION_END'
|
||||
];
|
||||
|
||||
if ($argv[2] == 'all') {
|
||||
|
||||
$files = scandir('src/r3', SCANDIR_SORT_DESCENDING);
|
||||
|
||||
$newFiles = [];
|
||||
|
||||
for ($i = 0; $i < sizeof($files); $i++) {
|
||||
if (preg_match('/\.js$/', $files[$i])) {
|
||||
array_push($newFiles, 'src/r3/' . $files[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$files = $newFiles;
|
||||
|
||||
} else {
|
||||
$files = [$argv[2]];
|
||||
|
||||
function getIndex($needle, $haystack) {
|
||||
|
||||
$index = 0;
|
||||
|
||||
foreach ($haystack as $value) {
|
||||
if (preg_match('/\b' . $needle . '\b/', $value)) {
|
||||
return $index;
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
|
||||
function getContents($contents, $regex) {
|
||||
$matches = [];
|
||||
preg_match($regex, $contents, $matches);
|
||||
if (sizeof($matches) > 0) {
|
||||
return $matches[0];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
@ -59,39 +47,119 @@ foreach ($files as $file) {
|
|||
|
||||
echo "saving file " . $file . "\n";
|
||||
|
||||
$contents = file_get_contents($file);
|
||||
|
||||
$saved = [];
|
||||
$startSaving = false;
|
||||
|
||||
foreach ($save as $key => $regex) {
|
||||
$fn = fopen($file, "r");
|
||||
|
||||
$value = getContents($contents, $regex);
|
||||
if ($value) {
|
||||
array_push($saved, "\n");
|
||||
array_push($saved, $value);
|
||||
array_push($saved, "\n");
|
||||
while (!feof($fn)) {
|
||||
|
||||
$line = fgets($fn);
|
||||
|
||||
foreach ($tokens as $startToken => $endToken) {
|
||||
|
||||
if (preg_match('/\b' . $startToken . '\b/', $line)) {
|
||||
$startSaving = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($startSaving) {
|
||||
array_push($saved, $line);
|
||||
}
|
||||
|
||||
foreach ($tokens as $startToken => $endToken) {
|
||||
|
||||
if (preg_match('/\b' . $endToken . '\b/', $line)) {
|
||||
$startSaving = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fclose($fn);
|
||||
|
||||
file_put_contents($file . '.saved', $saved);
|
||||
echo "saved file " . $file . ".saved\n";
|
||||
|
||||
} else if ($argv[1] == 'restore') {
|
||||
|
||||
echo "restoring file " . $file . "\n";
|
||||
$saveFile = $file . '.saved';
|
||||
|
||||
$saved = file_get_contents($file . '.saved');
|
||||
$new = file_get_contents($file);
|
||||
echo "restoring file " . $saveFile . "\n";
|
||||
|
||||
foreach ($save as $key => $regex) {
|
||||
$value = getContents($saved, $regex);
|
||||
echo "restoring " . $key . " in " . $file;
|
||||
if ($value && preg_match($regex, $new)) {
|
||||
$new = preg_replace($regex, $value, $new);
|
||||
$sh = fopen($saveFile, "r");
|
||||
|
||||
$saved = [];
|
||||
|
||||
while (!feof($sh)) {
|
||||
|
||||
$line = fgets($sh);
|
||||
|
||||
array_push($saved, $line);
|
||||
|
||||
}
|
||||
|
||||
fclose($sh);
|
||||
|
||||
$fh = fopen($file, "r");
|
||||
|
||||
$merged = [];
|
||||
|
||||
$restoreTokenPair = [];
|
||||
|
||||
$startRestoring = false;
|
||||
|
||||
while (!feof($fh)) {
|
||||
|
||||
$line = fgets($fh);
|
||||
|
||||
foreach ($tokens as $startToken => $endToken) {
|
||||
if (preg_match('/\b' . $startToken . '\b/', $line)) {
|
||||
$startRestoring = true;
|
||||
$restoreTokenPair = [$startToken, $endToken];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($file, $new);
|
||||
foreach ($tokens as $startToken => $endToken) {
|
||||
if (preg_match('/\b' . $endToken . '\b/', $line)) {
|
||||
$startRestoring = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($startRestoring) {
|
||||
|
||||
$startToken = $restoreTokenPair[0];
|
||||
$endToken = $restoreTokenPair[1];
|
||||
|
||||
$startIndex = getIndex($startToken, $saved);
|
||||
$endIndex = getIndex($endToken, $saved);
|
||||
|
||||
if ($startIndex === false || $endIndex === false) {
|
||||
echo "Could not find data to be restored : startIndex = " . $startIndex . ", endIndex = " . $endIndex;
|
||||
echo "Restore token pair = ";
|
||||
print_r($restoreTokenPair);
|
||||
array_push($merged, $line);
|
||||
} else {
|
||||
$restored = array_splice($saved, $startIndex, $endIndex - $startIndex);
|
||||
$merged = array_merge($merged, $restored);
|
||||
}
|
||||
} else {
|
||||
array_push($merged, $line);
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fh);
|
||||
|
||||
file_put_contents($file, $merged);
|
||||
|
||||
echo "Restored file " . $file;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue