From b51b46ea81c3d51d81e4ed2eb39f38b6e667d734 Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Fri, 9 Jun 2023 15:43:36 +0100 Subject: [PATCH 01/11] Adds SnapVisualize() --- rooms/rMain/rMain.yy | 4 +- scripts/SnapVisualize/SnapVisualize.gml | 211 ++++++++++++++++++++++++ scripts/SnapVisualize/SnapVisualize.yy | 11 ++ snap.yyp | 27 +-- 4 files changed, 238 insertions(+), 15 deletions(-) create mode 100644 scripts/SnapVisualize/SnapVisualize.gml create mode 100644 scripts/SnapVisualize/SnapVisualize.yy diff --git a/rooms/rMain/rMain.yy b/rooms/rMain/rMain.yy index 624a977..83422d3 100644 --- a/rooms/rMain/rMain.yy +++ b/rooms/rMain/rMain.yy @@ -17,7 +17,7 @@ ], "layers": [ {"resourceType":"GMRInstanceLayer","resourceVersion":"1.0","name":"Instances","instances":[ - {"resourceType":"GMRInstance","resourceVersion":"1.0","name":"inst_53BCBEF","properties":[],"isDnd":false,"objectId":{"name":"oTestVDF","path":"objects/oTestVDF/oTestVDF.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":32.0,"y":32.0,}, + {"resourceType":"GMRInstance","resourceVersion":"1.0","name":"inst_25D39681","properties":[],"isDnd":false,"objectId":{"name":"oTestXML","path":"objects/oTestXML/oTestXML.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":32.0,"y":32.0,}, ],"visible":true,"depth":0,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"effectEnabled":true,"effectType":null,"properties":[],}, {"resourceType":"GMRBackgroundLayer","resourceVersion":"1.0","name":"Background","spriteId":null,"colour":4278190080,"x":0,"y":0,"htiled":false,"vtiled":false,"hspeed":0.0,"vspeed":0.0,"stretch":false,"animationFPS":15.0,"animationSpeedType":0,"userdefinedAnimFPS":false,"visible":true,"depth":100,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"effectEnabled":true,"effectType":null,"properties":[],}, ], @@ -25,7 +25,7 @@ "creationCodeFile": "", "inheritCode": false, "instanceCreationOrder": [ - {"name":"inst_53BCBEF","path":"rooms/rMain/rMain.yy",}, + {"name":"inst_25D39681","path":"rooms/rMain/rMain.yy",}, ], "inheritCreationOrder": false, "sequenceId": null, diff --git a/scripts/SnapVisualize/SnapVisualize.gml b/scripts/SnapVisualize/SnapVisualize.gml new file mode 100644 index 0000000..dd7ba9c --- /dev/null +++ b/scripts/SnapVisualize/SnapVisualize.gml @@ -0,0 +1,211 @@ +/// @param value +/// @param [ascii=false] + +function SnapVisualize(_value, _ascii = false) +{ + static _buffer = buffer_create(1024, buffer_grow, 1); + buffer_seek(_buffer, buffer_seek_start, 0); + + if (_ascii) + { + __SnapVisualizeASCIIInner(_buffer, " ", _value); + } + else + { + __SnapVisualizeInner(_buffer, " ", _value); + } + + buffer_write(_buffer, buffer_u8, 0x00); + return buffer_peek(_buffer, 0, buffer_string); +} + +function __SnapVisualizeInner(_buffer, _prefix, _value) +{ + if (is_struct(_value)) + { + if (variable_struct_names_count(_value) == 0) + { + buffer_write(_buffer, buffer_text, "{}"); + } + else + { + var _struct = _value; + + buffer_write(_buffer, buffer_text, "{}"); + buffer_write(_buffer, buffer_u8, 0x0a); // newline + + var _oldPrefix = _prefix; + var _nameArray = variable_struct_get_names(_struct); + var _i = 0; + repeat(array_length(_nameArray)-1) + { + var _name = _nameArray[_i]; + _prefix = _oldPrefix + "| "; + repeat(string_length(_name)) _prefix += " "; + + buffer_write(_buffer, buffer_text, _oldPrefix); + buffer_write(_buffer, buffer_text, "├─ "); + buffer_write(_buffer, buffer_text, _name); + buffer_write(_buffer, buffer_text, ":"); + __SnapVisualizeInner(_buffer, _prefix, _struct[$ _name]); + buffer_write(_buffer, buffer_u8, 0x0a); // newline + + ++_i; + } + + var _name = _nameArray[_i]; + buffer_write(_buffer, buffer_text, _oldPrefix); + buffer_write(_buffer, buffer_text, "└─ "); + buffer_write(_buffer, buffer_text, _name); + buffer_write(_buffer, buffer_text, ":"); + + _prefix = _oldPrefix + " "; + repeat(string_length(_name)) _prefix += " "; + __SnapVisualizeInner(_buffer, _prefix, _struct[$ _name]); + } + } + else if (is_array(_value)) + { + if (array_length(_value) <= 0) + { + buffer_write(_buffer, buffer_text, "[]"); + } + else + { + var _array = _value; + + buffer_write(_buffer, buffer_text, "[]\n"); + + var _oldPrefix = _prefix; + _prefix += "│ "; + + var _i = 0; + repeat(array_length(_array)-1) + { + buffer_write(_buffer, buffer_text, _oldPrefix); + buffer_write(_buffer, buffer_text, "├─"); + __SnapVisualizeInner(_buffer, _prefix, _array[_i]); + buffer_write(_buffer, buffer_u8, 0x0a); // newline + ++_i; + } + + _prefix = _oldPrefix + " "; + buffer_write(_buffer, buffer_text, _oldPrefix); + buffer_write(_buffer, buffer_text, "└─"); + __SnapVisualizeInner(_buffer, _prefix, _array[_i]); + } + } + else if (is_string(_value)) + { + if (_value == "") + { + buffer_write(_buffer, buffer_text, " \"\""); + } + else + { + buffer_write(_buffer, buffer_text, " \""); + buffer_write(_buffer, buffer_text, _value); + buffer_write(_buffer, buffer_text, "\""); + } + } + else + { + buffer_write(_buffer, buffer_text, " "); // space + buffer_write(_buffer, buffer_text, string(_value)); + } +} + +function __SnapVisualizeASCIIInner(_buffer, _prefix, _value) +{ + if (is_struct(_value)) + { + if (variable_struct_names_count(_value) == 0) + { + buffer_write(_buffer, buffer_text, "{}"); // {} + } + else + { + var _struct = _value; + + buffer_write(_buffer, buffer_text, "{}\n"); + + var _oldPrefix = _prefix; + var _nameArray = variable_struct_get_names(_struct); + var _i = 0; + repeat(array_length(_nameArray)-1) + { + var _name = _nameArray[_i]; + _prefix = _oldPrefix + "| "; + repeat(string_length(_name)) _prefix += " "; + + buffer_write(_buffer, buffer_text, _oldPrefix); + buffer_write(_buffer, buffer_text, "|- "); + buffer_write(_buffer, buffer_text, _name); + buffer_write(_buffer, buffer_text, ":"); + __SnapVisualizeASCIIInner(_buffer, _prefix, _struct[$ _name]); + buffer_write(_buffer, buffer_text, "\n"); + + ++_i; + } + + var _name = _nameArray[_i]; + buffer_write(_buffer, buffer_text, _oldPrefix); + buffer_write(_buffer, buffer_text, "\\- "); + buffer_write(_buffer, buffer_text, _name); + buffer_write(_buffer, buffer_text, ":"); + + _prefix = _oldPrefix + " "; + repeat(string_length(_name)) _prefix += " "; + __SnapVisualizeASCIIInner(_buffer, _prefix, _struct[$ _name]); + } + } + else if (is_array(_value)) + { + if (array_length(_value) <= 0) + { + buffer_write(_buffer, buffer_text, "[]"); + } + else + { + buffer_write(_buffer, buffer_text, "[]\n"); + + var _oldPrefix = _prefix; + _prefix += "| "; + + var _array = _value; + var _i = 0; + repeat(array_length(_array)-1) + { + buffer_write(_buffer, buffer_text, _oldPrefix); + buffer_write(_buffer, buffer_text, "|-"); + __SnapVisualizeASCIIInner(_buffer, _prefix, _array[_i]); + buffer_write(_buffer, buffer_text, "\n"); + ++_i; + } + + buffer_write(_buffer, buffer_text, _oldPrefix); + _prefix = _oldPrefix + " "; + + buffer_write(_buffer, buffer_text, "\\-"); + __SnapVisualizeASCIIInner(_buffer, _prefix, _array[_i]); + } + } + else if (is_string(_value)) + { + if (_value == "") + { + buffer_write(_buffer, buffer_text, " \"\""); + } + else + { + buffer_write(_buffer, buffer_text, " \""); + buffer_write(_buffer, buffer_text, _value); + buffer_write(_buffer, buffer_text, "\""); + } + } + else + { + buffer_write(_buffer, buffer_text, " "); + buffer_write(_buffer, buffer_text, string(_value)); + } +} \ No newline at end of file diff --git a/scripts/SnapVisualize/SnapVisualize.yy b/scripts/SnapVisualize/SnapVisualize.yy new file mode 100644 index 0000000..440c1b6 --- /dev/null +++ b/scripts/SnapVisualize/SnapVisualize.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "SnapVisualize", + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "Utility", + "path": "folders/SNAP/Utility.yy", + }, +} \ No newline at end of file diff --git a/snap.yyp b/snap.yyp index b10b9aa..ba6a329 100644 --- a/snap.yyp +++ b/snap.yyp @@ -10,13 +10,13 @@ {"id":{"name":"SnapToYAML","path":"scripts/SnapToYAML/SnapToYAML.yy",},"order":0,}, {"id":{"name":"SnapBufferWrite2DArray","path":"scripts/SnapBufferWrite2DArray/SnapBufferWrite2DArray.yy",},"order":2,}, {"id":{"name":"SnapBufferReadTilemapOverwrite","path":"scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.yy",},"order":7,}, - {"id":{"name":"SnapStringToFile","path":"scripts/SnapStringToFile/SnapStringToFile.yy",},"order":8,}, + {"id":{"name":"SnapStringToFile","path":"scripts/SnapStringToFile/SnapStringToFile.yy",},"order":9,}, {"id":{"name":"Snap2DArrayToStructArray","path":"scripts/Snap2DArrayToStructArray/Snap2DArrayToStructArray.yy",},"order":4,}, {"id":{"name":"SnapBufferWriteNSV","path":"scripts/SnapBufferWriteNSV/SnapBufferWriteNSV.yy",},"order":1,}, - {"id":{"name":"SnapDeepAdd","path":"scripts/SnapDeepAdd/SnapDeepAdd.yy",},"order":2,}, + {"id":{"name":"SnapDeepAdd","path":"scripts/SnapDeepAdd/SnapDeepAdd.yy",},"order":3,}, {"id":{"name":"SnapToQML","path":"scripts/SnapToQML/SnapToQML.yy",},"order":0,}, - {"id":{"name":"SnapDeepCopy","path":"scripts/SnapDeepCopy/SnapDeepCopy.yy",},"order":1,}, - {"id":{"name":"SnapNumberToString","path":"scripts/SnapNumberToString/SnapNumberToString.yy",},"order":6,}, + {"id":{"name":"SnapDeepCopy","path":"scripts/SnapDeepCopy/SnapDeepCopy.yy",},"order":2,}, + {"id":{"name":"SnapNumberToString","path":"scripts/SnapNumberToString/SnapNumberToString.yy",},"order":7,}, {"id":{"name":"SnapBufferWriteGrid","path":"scripts/SnapBufferWriteGrid/SnapBufferWriteGrid.yy",},"order":0,}, {"id":{"name":"SnapBufferReadVDF","path":"scripts/SnapBufferReadVDF/SnapBufferReadVDF.yy",},"order":3,}, {"id":{"name":"oTestCSV","path":"objects/oTestCSV/oTestCSV.yy",},"order":11,}, @@ -30,29 +30,29 @@ {"id":{"name":"oTestString","path":"objects/oTestString/oTestString.yy",},"order":3,}, {"id":{"name":"SnapBufferReadINI","path":"scripts/SnapBufferReadINI/SnapBufferReadINI.yy",},"order":2,}, {"id":{"name":"SnapFromJSON","path":"scripts/SnapFromJSON/SnapFromJSON.yy",},"order":1,}, - {"id":{"name":"SnapBufferWriteBOM","path":"scripts/SnapBufferWriteBOM/SnapBufferWriteBOM.yy",},"order":9,}, + {"id":{"name":"SnapBufferWriteBOM","path":"scripts/SnapBufferWriteBOM/SnapBufferWriteBOM.yy",},"order":10,}, {"id":{"name":"SnapBufferReadGrid","path":"scripts/SnapBufferReadGrid/SnapBufferReadGrid.yy",},"order":1,}, {"id":{"name":"SnapToCSV","path":"scripts/SnapToCSV/SnapToCSV.yy",},"order":0,}, {"id":{"name":"__QMLExampleScript","path":"scripts/__QMLExampleScript/__QMLExampleScript.yy",},"order":22,}, - {"id":{"name":"SnapForeach","path":"scripts/SnapForeach/SnapForeach.yy",},"order":0,}, + {"id":{"name":"SnapForeach","path":"scripts/SnapForeach/SnapForeach.yy",},"order":1,}, {"id":{"name":"SnapToGML","path":"scripts/SnapToGML/SnapToGML.yy",},"order":0,}, {"id":{"name":"SnapBufferWriteJSON","path":"scripts/SnapBufferWriteJSON/SnapBufferWriteJSON.yy",},"order":2,}, {"id":{"name":"SnapBufferWriteLooseJSON","path":"scripts/SnapBufferWriteLooseJSON/SnapBufferWriteLooseJSON.yy",},"order":2,}, - {"id":{"name":"SnapStringFromFile","path":"scripts/SnapStringFromFile/SnapStringFromFile.yy",},"order":7,}, + {"id":{"name":"SnapStringFromFile","path":"scripts/SnapStringFromFile/SnapStringFromFile.yy",},"order":8,}, {"id":{"name":"SnapFromVDF","path":"scripts/SnapFromVDF/SnapFromVDF.yy",},"order":1,}, {"id":{"name":"oTestNSV","path":"objects/oTestNSV/oTestNSV.yy",},"order":12,}, {"id":{"name":"SnapBufferWriteXML","path":"scripts/SnapBufferWriteXML/SnapBufferWriteXML.yy",},"order":2,}, {"id":{"name":"oTestVDF","path":"objects/oTestVDF/oTestVDF.yy",},"order":21,}, - {"id":{"name":"SnapStringify","path":"scripts/SnapStringify/SnapStringify.yy",},"order":5,}, + {"id":{"name":"SnapStringify","path":"scripts/SnapStringify/SnapStringify.yy",},"order":6,}, {"id":{"name":"SnapBufferReadBinary","path":"scripts/SnapBufferReadBinary/SnapBufferReadBinary.yy",},"order":1,}, {"id":{"name":"SnapBufferRead2DArray","path":"scripts/SnapBufferRead2DArray/SnapBufferRead2DArray.yy",},"order":3,}, {"id":{"name":"SnapBufferReadXML","path":"scripts/SnapBufferReadXML/SnapBufferReadXML.yy",},"order":3,}, - {"id":{"name":"SnapShallowAdd","path":"scripts/SnapShallowAdd/SnapShallowAdd.yy",},"order":4,}, + {"id":{"name":"SnapShallowAdd","path":"scripts/SnapShallowAdd/SnapShallowAdd.yy",},"order":5,}, {"id":{"name":"SnapBufferWriteGML","path":"scripts/SnapBufferWriteGML/SnapBufferWriteGML.yy",},"order":2,}, {"id":{"name":"oTestJSON","path":"objects/oTestJSON/oTestJSON.yy",},"order":6,}, {"id":{"name":"SnapFromCSV","path":"scripts/SnapFromCSV/SnapFromCSV.yy",},"order":1,}, {"id":{"name":"SnapBufferWriteBinary","path":"scripts/SnapBufferWriteBinary/SnapBufferWriteBinary.yy",},"order":0,}, - {"id":{"name":"SnapMerge","path":"scripts/SnapMerge/SnapMerge.yy",},"order":3,}, + {"id":{"name":"SnapMerge","path":"scripts/SnapMerge/SnapMerge.yy",},"order":4,}, {"id":{"name":"oTestDeepCopy","path":"objects/oTestDeepCopy/oTestDeepCopy.yy",},"order":4,}, {"id":{"name":"SnapFromXML","path":"scripts/SnapFromXML/SnapFromXML.yy",},"order":1,}, {"id":{"name":"SnapFromYAML","path":"scripts/SnapFromYAML/SnapFromYAML.yy",},"order":1,}, @@ -71,15 +71,16 @@ {"id":{"name":"SnapBufferReadYAML","path":"scripts/SnapBufferReadYAML/SnapBufferReadYAML.yy",},"order":3,}, {"id":{"name":"oTestGML","path":"objects/oTestGML/oTestGML.yy",},"order":16,}, {"id":{"name":"SnapBufferWriteCSV","path":"scripts/SnapBufferWriteCSV/SnapBufferWriteCSV.yy",},"order":2,}, - {"id":{"name":"SnapBufferReadBOM","path":"scripts/SnapBufferReadBOM/SnapBufferReadBOM.yy",},"order":10,}, - {"id":{"name":"SnapMD5","path":"scripts/SnapMD5/SnapMD5.yy",},"order":11,}, + {"id":{"name":"SnapBufferReadBOM","path":"scripts/SnapBufferReadBOM/SnapBufferReadBOM.yy",},"order":11,}, + {"id":{"name":"SnapMD5","path":"scripts/SnapMD5/SnapMD5.yy",},"order":12,}, {"id":{"name":"ScratchBuffer","path":"scripts/ScratchBuffer/ScratchBuffer.yy",},"order":2,}, {"id":{"name":"SnapBufferWriteVDF","path":"scripts/SnapBufferWriteVDF/SnapBufferWriteVDF.yy",},"order":2,}, {"id":{"name":"SnapBufferWriteTilemap","path":"scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.yy",},"order":5,}, {"id":{"name":"SnapToXML","path":"scripts/SnapToXML/SnapToXML.yy",},"order":0,}, {"id":{"name":"SnapToVDF","path":"scripts/SnapToVDF/SnapToVDF.yy",},"order":0,}, + {"id":{"name":"SnapVisualize","path":"scripts/SnapVisualize/SnapVisualize.yy",},"order":0,}, {"id":{"name":"SnapBufferWriteYAML","path":"scripts/SnapBufferWriteYAML/SnapBufferWriteYAML.yy",},"order":2,}, - {"id":{"name":"__SnapSystem","path":"scripts/__SnapSystem/__SnapSystem.yy",},"order":12,}, + {"id":{"name":"__SnapSystem","path":"scripts/__SnapSystem/__SnapSystem.yy",},"order":13,}, {"id":{"name":"SnapFromGML","path":"scripts/SnapFromGML/SnapFromGML.yy",},"order":1,}, {"id":{"name":"oTestXML","path":"objects/oTestXML/oTestXML.yy",},"order":13,}, {"id":{"name":"oTestQML","path":"objects/oTestQML/oTestQML.yy",},"order":20,}, From 67fa89efdfcfb03b42d065b667c73245c5ef2aef Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Fri, 9 Jun 2023 16:00:18 +0100 Subject: [PATCH 02/11] Sets up SnapVisualize() to use instanceof() --- scripts/SnapVisualize/SnapVisualize.gml | 41 +++++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/scripts/SnapVisualize/SnapVisualize.gml b/scripts/SnapVisualize/SnapVisualize.gml index dd7ba9c..636e3a9 100644 --- a/scripts/SnapVisualize/SnapVisualize.gml +++ b/scripts/SnapVisualize/SnapVisualize.gml @@ -23,19 +23,29 @@ function __SnapVisualizeInner(_buffer, _prefix, _value) { if (is_struct(_value)) { - if (variable_struct_names_count(_value) == 0) + var _struct = _value; + + var _instanceOf = instanceof(_struct); + if (_instanceOf == "struct") { buffer_write(_buffer, buffer_text, "{}"); } else { - var _struct = _value; - - buffer_write(_buffer, buffer_text, "{}"); - buffer_write(_buffer, buffer_u8, 0x0a); // newline + buffer_write(_buffer, buffer_text, "{"); + buffer_write(_buffer, buffer_text, _instanceOf); + buffer_write(_buffer, buffer_text, "}"); + } + + if (variable_struct_names_count(_struct) > 0) + { + buffer_write(_buffer, buffer_text, "\n"); var _oldPrefix = _prefix; + var _nameArray = variable_struct_get_names(_struct); + array_sort(_nameArray, true); + var _i = 0; repeat(array_length(_nameArray)-1) { @@ -119,18 +129,29 @@ function __SnapVisualizeASCIIInner(_buffer, _prefix, _value) { if (is_struct(_value)) { - if (variable_struct_names_count(_value) == 0) + var _struct = _value; + + var _instanceOf = instanceof(_struct); + if (_instanceOf == "struct") { - buffer_write(_buffer, buffer_text, "{}"); // {} + buffer_write(_buffer, buffer_text, "{}"); } else { - var _struct = _value; - - buffer_write(_buffer, buffer_text, "{}\n"); + buffer_write(_buffer, buffer_text, "{"); + buffer_write(_buffer, buffer_text, _instanceOf); + buffer_write(_buffer, buffer_text, "}"); + } + + if (variable_struct_names_count(_value) > 0) + { + buffer_write(_buffer, buffer_text, "\n"); var _oldPrefix = _prefix; + var _nameArray = variable_struct_get_names(_struct); + array_sort(_nameArray, true); + var _i = 0; repeat(array_length(_nameArray)-1) { From 45f0af3aba65c0868856f16177a8b0c433afd0a8 Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Fri, 9 Jun 2023 16:00:35 +0100 Subject: [PATCH 03/11] Uses SnapVisualize() in more places --- objects/oTestBinary/Create_0.gml | 2 +- objects/oTestConfigJSON/Create_0.gml | 2 +- objects/oTestDeepCopy/Create_0.gml | 4 ++-- objects/oTestGML/Create_0.gml | 2 +- objects/oTestINI/Create_0.gml | 4 ++-- objects/oTestMerge/Create_0.gml | 2 +- objects/oTestMessagepack/Create_0.gml | 2 +- objects/oTestQML/Create_0.gml | 2 +- objects/oTestVDF/Create_0.gml | 4 ++-- objects/oTestXML/Create_0.gml | 2 +- objects/oTestYAML/Create_0.gml | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/objects/oTestBinary/Create_0.gml b/objects/oTestBinary/Create_0.gml index 91710a4..d1b5113 100644 --- a/objects/oTestBinary/Create_0.gml +++ b/objects/oTestBinary/Create_0.gml @@ -29,4 +29,4 @@ struct = { }; buffer = SnapBufferWriteBinary(ScratchBuffer(), struct); -show_debug_message(SnapToJSON(SnapBufferReadBinary(buffer, 0), true, true, true)); \ No newline at end of file +show_debug_message(SnapVisualize(SnapBufferReadBinary(buffer, 0))); \ No newline at end of file diff --git a/objects/oTestConfigJSON/Create_0.gml b/objects/oTestConfigJSON/Create_0.gml index dcf964a..133c168 100644 --- a/objects/oTestConfigJSON/Create_0.gml +++ b/objects/oTestConfigJSON/Create_0.gml @@ -34,4 +34,4 @@ var _string = @"{ }"; var _json = SnapFromConfigJSON(_string); -show_debug_message(SnapToLooseJSON(_json, true, true, true)); \ No newline at end of file +show_debug_message(SnapVisualize(_json)); \ No newline at end of file diff --git a/objects/oTestDeepCopy/Create_0.gml b/objects/oTestDeepCopy/Create_0.gml index 1e2e6c8..b3e2499 100644 --- a/objects/oTestDeepCopy/Create_0.gml +++ b/objects/oTestDeepCopy/Create_0.gml @@ -27,6 +27,6 @@ struct = { func : function() { d += 1 }, }; -show_debug_message(SnapToJSON(struct, true, true)); +show_debug_message(SnapVisualize(struct)); copy = SnapDeepCopy(struct); -show_debug_message(SnapToJSON(copy, true, true)); \ No newline at end of file +show_debug_message(SnapVisualize(copy)); \ No newline at end of file diff --git a/objects/oTestGML/Create_0.gml b/objects/oTestGML/Create_0.gml index 5a9117b..44521f1 100644 --- a/objects/oTestGML/Create_0.gml +++ b/objects/oTestGML/Create_0.gml @@ -28,7 +28,7 @@ struct = { }; show_debug_message(SnapToGML(struct, true)); -show_debug_message(SnapToJSON(SnapFromGML(SnapToGML(struct, true)), true, true)); +show_debug_message(SnapVisualize(SnapFromGML(SnapToGML(struct, true)))); var _string = @" //Here's a comment diff --git a/objects/oTestINI/Create_0.gml b/objects/oTestINI/Create_0.gml index 35a8b84..c4120f5 100644 --- a/objects/oTestINI/Create_0.gml +++ b/objects/oTestINI/Create_0.gml @@ -19,5 +19,5 @@ bool1 = 1 bool2 = on bool3=f'; -show_debug_message(SnapToJSON(SnapFromINIString(_text, false), true, true)); -show_debug_message(SnapToJSON(SnapFromINIString(_text, true), true, true)); \ No newline at end of file +show_debug_message(SnapVisualize(SnapFromINIString(_text, false))); +show_debug_message(SnapVisualize(SnapFromINIString(_text, true))); \ No newline at end of file diff --git a/objects/oTestMerge/Create_0.gml b/objects/oTestMerge/Create_0.gml index 3854794..2b9bff3 100644 --- a/objects/oTestMerge/Create_0.gml +++ b/objects/oTestMerge/Create_0.gml @@ -27,4 +27,4 @@ b = { }; SnapMerge(b, a); -show_debug_message(SnapToJSON(a, true, true)); \ No newline at end of file +show_debug_message(SnapVisualize(a)); \ No newline at end of file diff --git a/objects/oTestMessagepack/Create_0.gml b/objects/oTestMessagepack/Create_0.gml index 0100708..b160b40 100644 --- a/objects/oTestMessagepack/Create_0.gml +++ b/objects/oTestMessagepack/Create_0.gml @@ -33,4 +33,4 @@ struct = { buffer = ScratchBuffer(); SnapBufferWriteMessagePack(buffer, struct); -show_debug_message(SnapToJSON(SnapBufferReadMessagePack(buffer, 0), true, true, true)); \ No newline at end of file +show_debug_message(SnapVisualize(SnapBufferReadMessagePack(buffer, 0))); \ No newline at end of file diff --git a/objects/oTestQML/Create_0.gml b/objects/oTestQML/Create_0.gml index becebe1..0abad08 100644 --- a/objects/oTestQML/Create_0.gml +++ b/objects/oTestQML/Create_0.gml @@ -31,5 +31,5 @@ var _instanceofDict = { var _string = SnapToQML(root, _instanceofDict); show_debug_message(_string); -show_debug_message(SnapToJSON(SnapFromQML(_string, _instanceofDict), true, true, true)); +show_debug_message(SnapVisualize(SnapFromQML(_string, _instanceofDict))); show_debug_message(SnapToQML(SnapFromQML(_string, _instanceofDict), _instanceofDict)); \ No newline at end of file diff --git a/objects/oTestVDF/Create_0.gml b/objects/oTestVDF/Create_0.gml index e30c0bc..346e688 100644 --- a/objects/oTestVDF/Create_0.gml +++ b/objects/oTestVDF/Create_0.gml @@ -25,7 +25,7 @@ show_debug_message(SnapToVDF(struct, false, true)); show_debug_message("---------------------------------------------------------------------------------------"); show_debug_message(SnapToVDF(struct, true, true)); show_debug_message("---------------------------------------------------------------------------------------"); -show_debug_message(SnapToJSON(SnapFromVDF("\"a\" { \"b\" \"c\" }"), true, true, true)); +show_debug_message(SnapVisualize(SnapFromVDF("\"a\" { \"b\" \"c\" }"))); show_debug_message("---------------------------------------------------------------------------------------"); -show_debug_message(SnapToJSON(SnapFromVDF(SnapToVDF(struct)), true, true, true)); +show_debug_message(SnapVisualize(SnapFromVDF(SnapToVDF(struct)))); show_debug_message("---------------------------------------------------------------------------------------"); \ No newline at end of file diff --git a/objects/oTestXML/Create_0.gml b/objects/oTestXML/Create_0.gml index 806a738..b27051d 100644 --- a/objects/oTestXML/Create_0.gml +++ b/objects/oTestXML/Create_0.gml @@ -22,6 +22,6 @@ var _string = @' '; var _struct = SnapFromXML(_string); -show_debug_message(SnapToJSON(_struct, true, true)); +show_debug_message(SnapVisualize(_struct)); show_debug_message(SnapToXML(_struct, false)); show_debug_message(SnapToXML(_struct, true )); \ No newline at end of file diff --git a/objects/oTestYAML/Create_0.gml b/objects/oTestYAML/Create_0.gml index 7702a17..bda2495 100644 --- a/objects/oTestYAML/Create_0.gml +++ b/objects/oTestYAML/Create_0.gml @@ -36,7 +36,7 @@ struct = { show_debug_message(""); show_debug_message("--- Test 1 ---"); var _string = "{\"hello\" : \"world\", \"more\" : \"data\"}"; -show_debug_message(SnapToJSON(SnapFromYAML(_string), true, true)); +show_debug_message(SnapVisualize(SnapFromYAML(_string))); show_debug_message(""); show_debug_message("--- Test 2 ---"); From 220883d4ec70691cd75dd5cf996dcf26d6afed92 Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Fri, 9 Jun 2023 16:06:40 +0100 Subject: [PATCH 04/11] Update SnapVisualize.gml --- scripts/SnapVisualize/SnapVisualize.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/SnapVisualize/SnapVisualize.gml b/scripts/SnapVisualize/SnapVisualize.gml index 636e3a9..3ecee2a 100644 --- a/scripts/SnapVisualize/SnapVisualize.gml +++ b/scripts/SnapVisualize/SnapVisualize.gml @@ -50,7 +50,7 @@ function __SnapVisualizeInner(_buffer, _prefix, _value) repeat(array_length(_nameArray)-1) { var _name = _nameArray[_i]; - _prefix = _oldPrefix + "| "; + _prefix = _oldPrefix + "│ "; repeat(string_length(_name)) _prefix += " "; buffer_write(_buffer, buffer_text, _oldPrefix); From e0665bb40a2f8fb2fb733b603a8e5a5ec3d6a074 Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Fri, 9 Jun 2023 16:49:50 +0100 Subject: [PATCH 05/11] Update SnapVisualize.gml --- scripts/SnapVisualize/SnapVisualize.gml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/SnapVisualize/SnapVisualize.gml b/scripts/SnapVisualize/SnapVisualize.gml index 3ecee2a..a211a0f 100644 --- a/scripts/SnapVisualize/SnapVisualize.gml +++ b/scripts/SnapVisualize/SnapVisualize.gml @@ -65,7 +65,7 @@ function __SnapVisualizeInner(_buffer, _prefix, _value) var _name = _nameArray[_i]; buffer_write(_buffer, buffer_text, _oldPrefix); - buffer_write(_buffer, buffer_text, "└─ "); + buffer_write(_buffer, buffer_text, "╰─ "); buffer_write(_buffer, buffer_text, _name); buffer_write(_buffer, buffer_text, ":"); @@ -101,7 +101,7 @@ function __SnapVisualizeInner(_buffer, _prefix, _value) _prefix = _oldPrefix + " "; buffer_write(_buffer, buffer_text, _oldPrefix); - buffer_write(_buffer, buffer_text, "└─"); + buffer_write(_buffer, buffer_text, "╰─"); __SnapVisualizeInner(_buffer, _prefix, _array[_i]); } } From 0649d585749255e0146b3832b0244c61d98c2d96 Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Fri, 28 Jul 2023 12:30:48 +0100 Subject: [PATCH 06/11] Adds multiline support to SnapBufferReadLooseJSON() --- .../SnapBufferReadLooseJSON.gml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml b/scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml index d084d14..4e6ebb4 100644 --- a/scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml +++ b/scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml @@ -253,6 +253,11 @@ function __SnapBufferReadLooseJSONValue(_buffer, _bufferSize, _firstByte) { return __SnapBufferReadLooseJSONDelimitedString(_buffer, _bufferSize); } + else if ((_firstByte == ord("@")) && (buffer_peek(_buffer, buffer_tell(_buffer), buffer_u8) == ord("'"))) + { + buffer_seek(_buffer, buffer_seek_relative, 1); + return __SnapBufferReadLooseJSONMultilineString(_buffer, _bufferSize); + } else { return __SnapBufferReadLooseJSONString(_buffer, _bufferSize); @@ -380,6 +385,41 @@ function __SnapBufferReadLooseJSONDelimitedString(_buffer, _bufferSize) show_error("SNAP:\nFound unterminated string\n ", true); } +function __SnapBufferReadLooseJSONMultilineString(_buffer, _bufferSize) +{ + static _cacheBuffer = buffer_create(1024, buffer_grow, 1); + buffer_seek(_cacheBuffer, buffer_seek_start, 0); + + var _start = buffer_tell(_buffer); + var _inString = false; + + while(buffer_tell(_buffer) < _bufferSize) + { + var _byte = buffer_read(_buffer, buffer_u8); + + if (_byte == ord("\"")) + { + if ((buffer_peek(_buffer, buffer_tell(_buffer)-2, buffer_u8) != ord("\\")) + && (buffer_peek(_buffer, buffer_tell(_buffer)-3, buffer_u8) != ord("\\"))) + { + _inString = !_inString; + } + } + else if (!_inString && (_byte == ord("'"))) + { + var _end = buffer_tell(_buffer)-1; + var _oldByte = buffer_peek(_buffer, _end, buffer_u8); + buffer_poke(_buffer, _end, buffer_u8, 0x00); + var _result = buffer_peek(_buffer, _start, buffer_string); + buffer_poke(_buffer, _end, buffer_u8, _oldByte); + + return _result; + } + } + + show_error("SNAP:\nFound unterminated multiline string\n ", true); +} + function __SnapBufferReadLooseJSONString(_buffer, _bufferSize) { static _cacheBuffer = buffer_create(1024, buffer_grow, 1); From 5c59c63c91ae493a565ab4ceeb98161251c9b36e Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Fri, 28 Jul 2023 12:30:53 +0100 Subject: [PATCH 07/11] Update Create_0.gml --- objects/oTestLooseJSON/Create_0.gml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/objects/oTestLooseJSON/Create_0.gml b/objects/oTestLooseJSON/Create_0.gml index 598e050..49f2b01 100644 --- a/objects/oTestLooseJSON/Create_0.gml +++ b/objects/oTestLooseJSON/Create_0.gml @@ -46,7 +46,8 @@ b: "2" */ c: /*oops*/3, d: 4//done -}'; +e: "string! //"'; +_string += "\nf: @'multiline\n\nstring'\n}"; show_debug_message(SnapFromLooseJSON(_string)); From 1a8932d5498260617dab4724bb03ba712c544895 Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Fri, 28 Jul 2023 20:05:47 +0100 Subject: [PATCH 08/11] Adds "//Feather disable all" to all scripts --- scripts/ScratchBuffer/ScratchBuffer.gml | 3 ++- .../Snap2DArrayToStructArray/Snap2DArrayToStructArray.gml | 3 ++- scripts/SnapBufferRead2DArray/SnapBufferRead2DArray.gml | 3 ++- scripts/SnapBufferReadBOM/SnapBufferReadBOM.gml | 3 ++- scripts/SnapBufferReadBinary/SnapBufferReadBinary.gml | 3 ++- scripts/SnapBufferReadCSV/SnapBufferReadCSV.gml | 1 + .../SnapBufferReadConfigJSON/SnapBufferReadConfigJSON.gml | 3 ++- scripts/SnapBufferReadGML/SnapBufferReadGML.gml | 3 ++- scripts/SnapBufferReadGrid/SnapBufferReadGrid.gml | 3 ++- scripts/SnapBufferReadINI/SnapBufferReadINI.gml | 5 +++-- scripts/SnapBufferReadJSON/SnapBufferReadJSON.gml | 3 ++- scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml | 3 ++- .../SnapBufferReadMessagePack/SnapBufferReadMessagePack.gml | 3 ++- scripts/SnapBufferReadNSV/SnapBufferReadNSV.gml | 1 + scripts/SnapBufferReadQML/SnapBufferReadQML.gml | 1 + .../SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml | 3 ++- .../SnapBufferReadTilemapOverwrite.gml | 3 ++- scripts/SnapBufferReadVDF/SnapBufferReadVDF.gml | 3 ++- scripts/SnapBufferReadXML/SnapBufferReadXML.gml | 3 ++- scripts/SnapBufferReadYAML/SnapBufferReadYAML.gml | 1 + scripts/SnapBufferWrite2DArray/SnapBufferWrite2DArray.gml | 3 ++- scripts/SnapBufferWriteBOM/SnapBufferWriteBOM.gml | 3 ++- scripts/SnapBufferWriteBinary/SnapBufferWriteBinary.gml | 3 ++- scripts/SnapBufferWriteCSV/SnapBufferWriteCSV.gml | 3 ++- scripts/SnapBufferWriteGML/SnapBufferWriteGML.gml | 3 ++- scripts/SnapBufferWriteGrid/SnapBufferWriteGrid.gml | 3 ++- scripts/SnapBufferWriteJSON/SnapBufferWriteJSON.gml | 1 + .../SnapBufferWriteLooseJSON/SnapBufferWriteLooseJSON.gml | 1 + .../SnapBufferWriteMessagePack.gml | 3 ++- scripts/SnapBufferWriteNSV/SnapBufferWriteNSV.gml | 1 + scripts/SnapBufferWriteQML/SnapBufferWriteQML.gml | 1 + scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml | 3 ++- scripts/SnapBufferWriteVDF/SnapBufferWriteVDF.gml | 1 + scripts/SnapBufferWriteXML/SnapBufferWriteXML.gml | 3 ++- scripts/SnapBufferWriteYAML/SnapBufferWriteYAML.gml | 3 ++- scripts/SnapDeepAdd/SnapDeepAdd.gml | 1 + scripts/SnapDeepCopy/SnapDeepCopy.gml | 1 + scripts/SnapForeach/SnapForeach.gml | 1 + scripts/SnapFromCSV/SnapFromCSV.gml | 3 ++- scripts/SnapFromConfigJSON/SnapFromConfigJSON.gml | 3 ++- scripts/SnapFromGML/SnapFromGML.gml | 3 ++- scripts/SnapFromINIFile/SnapFromINIFile.gml | 3 ++- scripts/SnapFromINIString/SnapFromINIString.gml | 5 +++-- scripts/SnapFromJSON/SnapFromJSON.gml | 3 ++- scripts/SnapFromLooseJSON/SnapFromLooseJSON.gml | 3 ++- scripts/SnapFromQML/SnapFromQML.gml | 3 ++- scripts/SnapFromVDF/SnapFromVDF.gml | 3 ++- scripts/SnapFromXML/SnapFromXML.gml | 3 ++- scripts/SnapFromYAML/SnapFromYAML.gml | 3 ++- scripts/SnapMD5/SnapMD5.gml | 3 ++- scripts/SnapMerge/SnapMerge.gml | 3 ++- scripts/SnapNumberToString/SnapNumberToString.gml | 3 ++- scripts/SnapShallowAdd/SnapShallowAdd.gml | 1 + scripts/SnapStringFromFile/SnapStringFromFile.gml | 3 ++- scripts/SnapStringToFile/SnapStringToFile.gml | 3 ++- scripts/SnapStringify/SnapStringify.gml | 3 ++- scripts/SnapToCSV/SnapToCSV.gml | 3 ++- scripts/SnapToGML/SnapToGML.gml | 3 ++- scripts/SnapToJSON/SnapToJSON.gml | 3 ++- scripts/SnapToLooseJSON/SnapToLooseJSON.gml | 3 ++- scripts/SnapToQML/SnapToQML.gml | 3 ++- scripts/SnapToVDF/SnapToVDF.gml | 3 ++- scripts/SnapToXML/SnapToXML.gml | 3 ++- scripts/SnapToYAML/SnapToYAML.gml | 3 ++- scripts/SnapVisualize/SnapVisualize.gml | 3 ++- scripts/__QMLExampleScript/__QMLExampleScript.gml | 3 ++- scripts/__SnapSystem/__SnapSystem.gml | 3 ++- 67 files changed, 123 insertions(+), 56 deletions(-) diff --git a/scripts/ScratchBuffer/ScratchBuffer.gml b/scripts/ScratchBuffer/ScratchBuffer.gml index 042cfef..8f55b43 100644 --- a/scripts/ScratchBuffer/ScratchBuffer.gml +++ b/scripts/ScratchBuffer/ScratchBuffer.gml @@ -1,4 +1,5 @@ +// Feather disable all function ScratchBuffer() { return buffer_create(1024, buffer_grow, 1); -} \ No newline at end of file +} diff --git a/scripts/Snap2DArrayToStructArray/Snap2DArrayToStructArray.gml b/scripts/Snap2DArrayToStructArray/Snap2DArrayToStructArray.gml index a47e152..61df5cb 100644 --- a/scripts/Snap2DArrayToStructArray/Snap2DArrayToStructArray.gml +++ b/scripts/Snap2DArrayToStructArray/Snap2DArrayToStructArray.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Config struct should be in this format: /// /// { @@ -63,4 +64,4 @@ function Snap2DArrayToStructArray(_inputArray, _configStruct = {}) } return _outputArray; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferRead2DArray/SnapBufferRead2DArray.gml b/scripts/SnapBufferRead2DArray/SnapBufferRead2DArray.gml index 289d7dd..1f41ed6 100644 --- a/scripts/SnapBufferRead2DArray/SnapBufferRead2DArray.gml +++ b/scripts/SnapBufferRead2DArray/SnapBufferRead2DArray.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer /// @param offset /// @@ -36,4 +37,4 @@ function SnapBufferRead2DArray(_buffer, _inOffset) if (_inOffset != undefined) buffer_seek(_buffer, buffer_seek_start, _oldOffset); return _array; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadBOM/SnapBufferReadBOM.gml b/scripts/SnapBufferReadBOM/SnapBufferReadBOM.gml index 890f639..ba48d46 100644 --- a/scripts/SnapBufferReadBOM/SnapBufferReadBOM.gml +++ b/scripts/SnapBufferReadBOM/SnapBufferReadBOM.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Attempts to read a UTF-8 byte order mark from a buffer, and returns if a BOM is found /// /// @param buffer Buffer to try to read the byte order mark from @@ -17,4 +18,4 @@ function SnapBufferReadBOM(_buffer) } return false; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadBinary/SnapBufferReadBinary.gml b/scripts/SnapBufferReadBinary/SnapBufferReadBinary.gml index 1e00670..fc14504 100644 --- a/scripts/SnapBufferReadBinary/SnapBufferReadBinary.gml +++ b/scripts/SnapBufferReadBinary/SnapBufferReadBinary.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data encoded from the buffer, using a proprietary format /// /// @param buffer Binary data to be decoded, created by SnapBufferWriteBinary() @@ -101,4 +102,4 @@ function __SnapFromBinaryValue(_buffer) show_error("SNAP:\nUnsupported datatype " + string(buffer_peek(_buffer, buffer_u8, buffer_tell(_buffer)-1)) + " (position = " + string(buffer_tell(_buffer) - 1) + ")\n ", false); break; } -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadCSV/SnapBufferReadCSV.gml b/scripts/SnapBufferReadCSV/SnapBufferReadCSV.gml index 10c440c..4c028b1 100644 --- a/scripts/SnapBufferReadCSV/SnapBufferReadCSV.gml +++ b/scripts/SnapBufferReadCSV/SnapBufferReadCSV.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Decodes CSV data stored in a buffer and outputs a 2D array /// /// @return 2D array that represents the contents of the CSV string diff --git a/scripts/SnapBufferReadConfigJSON/SnapBufferReadConfigJSON.gml b/scripts/SnapBufferReadConfigJSON/SnapBufferReadConfigJSON.gml index 168b378..6521a0a 100644 --- a/scripts/SnapBufferReadConfigJSON/SnapBufferReadConfigJSON.gml +++ b/scripts/SnapBufferReadConfigJSON/SnapBufferReadConfigJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the "Config JSON" string /// /// @param buffer Buffer to read data from @@ -659,4 +660,4 @@ function __SnapBufferReadConfigJSONDeepCopyInner(_value, _oldStruct, _newStruct) } return _copy; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadGML/SnapBufferReadGML.gml b/scripts/SnapBufferReadGML/SnapBufferReadGML.gml index 986dae2..f9731b9 100644 --- a/scripts/SnapBufferReadGML/SnapBufferReadGML.gml +++ b/scripts/SnapBufferReadGML/SnapBufferReadGML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the JSON string. The root node will always be a struct /// /// @param buffer The GML string to be decoded @@ -507,4 +508,4 @@ function __SnapBufferReadGMLParser(_buffer, _buffer_size) constructor } read_root(); -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadGrid/SnapBufferReadGrid.gml b/scripts/SnapBufferReadGrid/SnapBufferReadGrid.gml index d3e04c0..bc2e323 100644 --- a/scripts/SnapBufferReadGrid/SnapBufferReadGrid.gml +++ b/scripts/SnapBufferReadGrid/SnapBufferReadGrid.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer /// @param offset /// @@ -33,4 +34,4 @@ function SnapBufferReadGrid(_buffer, _inOffset) if (_inOffset != undefined) buffer_seek(_buffer, buffer_seek_start, _oldOffset); return _grid; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadINI/SnapBufferReadINI.gml b/scripts/SnapBufferReadINI/SnapBufferReadINI.gml index a2d8bde..dcb9e2f 100644 --- a/scripts/SnapBufferReadINI/SnapBufferReadINI.gml +++ b/scripts/SnapBufferReadINI/SnapBufferReadINI.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Struct/array that represents the data in the INI file /// /// N.B. That this script is only intended to read the .ini files that GM generates @@ -104,8 +105,8 @@ function SnapBufferReadINI(_buffer, _offset, _size, _tryReal = true) if (_value == ord("\"")) _in_string = true; } - if (_value > 32) _last_non_whitespace = buffer_tell(_buffer) - 1; - if ((_value == 32) && (buffer_peek(_buffer, buffer_tell(_buffer) - 2, buffer_u8) == ord("\\"))) _last_non_whitespace = buffer_tell(_buffer) - 1; + if (_in_string || (_value > 32)) _last_non_whitespace = buffer_tell(_buffer) - 1; + if (!_in_string && (_value == 32) && (buffer_peek(_buffer, buffer_tell(_buffer) - 2, buffer_u8) == ord("\\"))) _last_non_whitespace = buffer_tell(_buffer) - 1; if (_value == ord("\\")) _seen_backslash = true; } } diff --git a/scripts/SnapBufferReadJSON/SnapBufferReadJSON.gml b/scripts/SnapBufferReadJSON/SnapBufferReadJSON.gml index ab96309..9f2db1a 100644 --- a/scripts/SnapBufferReadJSON/SnapBufferReadJSON.gml +++ b/scripts/SnapBufferReadJSON/SnapBufferReadJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the JSON string /// /// @param buffer Buffer to read data from @@ -499,4 +500,4 @@ function SnapBufferReadJSON(_buffer, _inOffset = undefined) } return _root; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml b/scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml index 4e6ebb4..875d980 100644 --- a/scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml +++ b/scripts/SnapBufferReadLooseJSON/SnapBufferReadLooseJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the "Loose JSON" string /// /// @param buffer Buffer to read data from @@ -654,4 +655,4 @@ function __SnapBufferReadLooseJSONDeepCopyInner(_value, _oldStruct, _newStruct) } return _copy; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadMessagePack/SnapBufferReadMessagePack.gml b/scripts/SnapBufferReadMessagePack/SnapBufferReadMessagePack.gml index 9b56e23..8049b4d 100644 --- a/scripts/SnapBufferReadMessagePack/SnapBufferReadMessagePack.gml +++ b/scripts/SnapBufferReadMessagePack/SnapBufferReadMessagePack.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data decoded from the buffer, using the messagepack standard /// /// More information on messagepack can be found here: https://msgpack.org/index.html @@ -219,4 +220,4 @@ function __SnapFromMessagepackLittleEndian(_buffer, _datatype) } return buffer_peek(_flipBuffer, 0, _datatype); -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadNSV/SnapBufferReadNSV.gml b/scripts/SnapBufferReadNSV/SnapBufferReadNSV.gml index 12f4bd6..81a6406 100644 --- a/scripts/SnapBufferReadNSV/SnapBufferReadNSV.gml +++ b/scripts/SnapBufferReadNSV/SnapBufferReadNSV.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Decodes an NSV buffer and outputs a 2D array /// /// @return 2D array that represents the contents of the NSV buffer diff --git a/scripts/SnapBufferReadQML/SnapBufferReadQML.gml b/scripts/SnapBufferReadQML/SnapBufferReadQML.gml index 65aba3c..1e6148c 100644 --- a/scripts/SnapBufferReadQML/SnapBufferReadQML.gml +++ b/scripts/SnapBufferReadQML/SnapBufferReadQML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the QML string /// /// @param buffer Buffer to read data from diff --git a/scripts/SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml b/scripts/SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml index b20187a..129966e 100644 --- a/scripts/SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml +++ b/scripts/SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer /// @param offset /// @param layer @@ -40,4 +41,4 @@ function SnapBufferReadTilemapNew(_buffer, _inOffset, _layer) } if (_inOffset != undefined) buffer_seek(_buffer, buffer_seek_start, _oldOffset); -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.gml b/scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.gml index bcdd02a..5979ae0 100644 --- a/scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.gml +++ b/scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer /// @param offset /// @param tilemap @@ -49,4 +50,4 @@ function SnapBufferReadTilemapOverwrite(_buffer, _inOffset, _tilemap, _readPosit } if (_inOffset != undefined) buffer_seek(_buffer, buffer_seek_start, _oldOffset); -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadVDF/SnapBufferReadVDF.gml b/scripts/SnapBufferReadVDF/SnapBufferReadVDF.gml index f2d563a..1d8d46d 100644 --- a/scripts/SnapBufferReadVDF/SnapBufferReadVDF.gml +++ b/scripts/SnapBufferReadVDF/SnapBufferReadVDF.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct data that represents the contents of the VDF string /// /// @param buffer Buffer to read data from @@ -276,4 +277,4 @@ function SnapBufferReadVDF(_buffer, _inOffset = undefined, _inSize = undefined) } return _root; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadXML/SnapBufferReadXML.gml b/scripts/SnapBufferReadXML/SnapBufferReadXML.gml index 602c3e1..4a9c679 100644 --- a/scripts/SnapBufferReadXML/SnapBufferReadXML.gml +++ b/scripts/SnapBufferReadXML/SnapBufferReadXML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Decodes XML data stored in a buffer and outputs a sorta-JSON equivalent /// /// @return Nested struct/array data that represents the contents of the XML data @@ -302,4 +303,4 @@ function SnapBufferReadXML(_buffer, _offset, _size) buffer_seek(_buffer, buffer_seek_start, _oldOffset); return _root; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferReadYAML/SnapBufferReadYAML.gml b/scripts/SnapBufferReadYAML/SnapBufferReadYAML.gml index 16da8d7..5fe6cf1 100644 --- a/scripts/SnapBufferReadYAML/SnapBufferReadYAML.gml +++ b/scripts/SnapBufferReadYAML/SnapBufferReadYAML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the YAML string /// /// N.B. This is not a full implementation of the YAML spec and doesn't try to be. This YAML parser doesn't support: diff --git a/scripts/SnapBufferWrite2DArray/SnapBufferWrite2DArray.gml b/scripts/SnapBufferWrite2DArray/SnapBufferWrite2DArray.gml index 3ababba..2706a32 100644 --- a/scripts/SnapBufferWrite2DArray/SnapBufferWrite2DArray.gml +++ b/scripts/SnapBufferWrite2DArray/SnapBufferWrite2DArray.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer /// @param array2D /// @param datatype @@ -31,4 +32,4 @@ function SnapBufferWrite2DArray(_buffer, _array, _datatype) ++_x; } -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteBOM/SnapBufferWriteBOM.gml b/scripts/SnapBufferWriteBOM/SnapBufferWriteBOM.gml index fdf8bd2..fb43077 100644 --- a/scripts/SnapBufferWriteBOM/SnapBufferWriteBOM.gml +++ b/scripts/SnapBufferWriteBOM/SnapBufferWriteBOM.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer /// /// @jujuadams 2022-10-30 @@ -7,4 +8,4 @@ function SnapBufferWriteBOM(_buffer) buffer_write(_buffer, buffer_u8, 0xEF); buffer_write(_buffer, buffer_u8, 0xBB); buffer_write(_buffer, buffer_u8, 0xBF); -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteBinary/SnapBufferWriteBinary.gml b/scripts/SnapBufferWriteBinary/SnapBufferWriteBinary.gml index a65d27f..0fba11a 100644 --- a/scripts/SnapBufferWriteBinary/SnapBufferWriteBinary.gml +++ b/scripts/SnapBufferWriteBinary/SnapBufferWriteBinary.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Buffer that contains binary encoded struct/array nested data, using a proprietary format /// /// @param buffer Buffer to write data to @@ -121,4 +122,4 @@ function SnapBufferWriteBinary(_buffer, _value, _alphabetizeStructs = false) } return _buffer; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteCSV/SnapBufferWriteCSV.gml b/scripts/SnapBufferWriteCSV/SnapBufferWriteCSV.gml index ee17b5e..dc0f80b 100644 --- a/scripts/SnapBufferWriteCSV/SnapBufferWriteCSV.gml +++ b/scripts/SnapBufferWriteCSV/SnapBufferWriteCSV.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return CSV string that encodes the provided 2D array /// /// @param buffer @@ -99,4 +100,4 @@ function SnapBufferWriteCSV(_buffer, _root_array, _cellDelimiter = ",", _stringD } return _buffer; -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteGML/SnapBufferWriteGML.gml b/scripts/SnapBufferWriteGML/SnapBufferWriteGML.gml index cc58c53..5d66ffb 100644 --- a/scripts/SnapBufferWriteGML/SnapBufferWriteGML.gml +++ b/scripts/SnapBufferWriteGML/SnapBufferWriteGML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return GML string that encodes the struct /// /// @param buffer @@ -181,4 +182,4 @@ function __SnapBufferWriteGMLInner(_buffer, _value, _alphabetise, _depth, _inden buffer_write(_buffer, buffer_text, string(_value)); } } -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteGrid/SnapBufferWriteGrid.gml b/scripts/SnapBufferWriteGrid/SnapBufferWriteGrid.gml index ae53e3a..93619e8 100644 --- a/scripts/SnapBufferWriteGrid/SnapBufferWriteGrid.gml +++ b/scripts/SnapBufferWriteGrid/SnapBufferWriteGrid.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer /// @param grid /// @param datatype @@ -30,4 +31,4 @@ function SnapBufferWriteGrid(_buffer, _grid, _datatype) ++_x; } -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteJSON/SnapBufferWriteJSON.gml b/scripts/SnapBufferWriteJSON/SnapBufferWriteJSON.gml index 6a17c0a..1ad381d 100644 --- a/scripts/SnapBufferWriteJSON/SnapBufferWriteJSON.gml +++ b/scripts/SnapBufferWriteJSON/SnapBufferWriteJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return JSON string that encodes the struct/array nested data /// /// @param buffer Buffer to write data into diff --git a/scripts/SnapBufferWriteLooseJSON/SnapBufferWriteLooseJSON.gml b/scripts/SnapBufferWriteLooseJSON/SnapBufferWriteLooseJSON.gml index 923bf5b..8c2f30f 100644 --- a/scripts/SnapBufferWriteLooseJSON/SnapBufferWriteLooseJSON.gml +++ b/scripts/SnapBufferWriteLooseJSON/SnapBufferWriteLooseJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return "Loose JSON" string that encodes the struct/array nested data /// /// @param buffer Buffer to write data into diff --git a/scripts/SnapBufferWriteMessagePack/SnapBufferWriteMessagePack.gml b/scripts/SnapBufferWriteMessagePack/SnapBufferWriteMessagePack.gml index f49cbd9..3facf40 100644 --- a/scripts/SnapBufferWriteMessagePack/SnapBufferWriteMessagePack.gml +++ b/scripts/SnapBufferWriteMessagePack/SnapBufferWriteMessagePack.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Buffer that represents the struct/array nested data, using the MessagePack standard /// /// More information on messagepack can be found here: https://msgpack.org/index.html @@ -343,4 +344,4 @@ function __SnapToMessagepackString(_buffer, _string) } buffer_write(_buffer, buffer_text, _string); -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteNSV/SnapBufferWriteNSV.gml b/scripts/SnapBufferWriteNSV/SnapBufferWriteNSV.gml index 1653809..f25dc85 100644 --- a/scripts/SnapBufferWriteNSV/SnapBufferWriteNSV.gml +++ b/scripts/SnapBufferWriteNSV/SnapBufferWriteNSV.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Buffer that encodes the provided 2D array /// /// @param buffer Buffer to write to diff --git a/scripts/SnapBufferWriteQML/SnapBufferWriteQML.gml b/scripts/SnapBufferWriteQML/SnapBufferWriteQML.gml index e2aa25e..3f53b55 100644 --- a/scripts/SnapBufferWriteQML/SnapBufferWriteQML.gml +++ b/scripts/SnapBufferWriteQML/SnapBufferWriteQML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return QML string that encodes the struct/array nested data /// /// @param buffer Buffer to write data into diff --git a/scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml b/scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml index dfbc6c5..b0372da 100644 --- a/scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml +++ b/scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer /// @param tilemap /// @@ -26,4 +27,4 @@ function SnapBufferWriteTilemap(_buffer, _tilemap) ++_x; } -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteVDF/SnapBufferWriteVDF.gml b/scripts/SnapBufferWriteVDF/SnapBufferWriteVDF.gml index db78755..1de7ef2 100644 --- a/scripts/SnapBufferWriteVDF/SnapBufferWriteVDF.gml +++ b/scripts/SnapBufferWriteVDF/SnapBufferWriteVDF.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return VDF string that encodes the struct/array nested data /// /// N.B. This function cannot encode arrays, and any numbers will be stringified diff --git a/scripts/SnapBufferWriteXML/SnapBufferWriteXML.gml b/scripts/SnapBufferWriteXML/SnapBufferWriteXML.gml index 76abe65..b90846d 100644 --- a/scripts/SnapBufferWriteXML/SnapBufferWriteXML.gml +++ b/scripts/SnapBufferWriteXML/SnapBufferWriteXML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param buffer Buffer to write the data to /// @param struct The data to be encoded /// @@ -113,4 +114,4 @@ function __SnapToXMLBufferInner(_buffer, _struct, _indent) buffer_write(_buffer, buffer_text, ""); -} \ No newline at end of file +} diff --git a/scripts/SnapBufferWriteYAML/SnapBufferWriteYAML.gml b/scripts/SnapBufferWriteYAML/SnapBufferWriteYAML.gml index 8309be4..e7b4017 100644 --- a/scripts/SnapBufferWriteYAML/SnapBufferWriteYAML.gml +++ b/scripts/SnapBufferWriteYAML/SnapBufferWriteYAML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return YAML string that encodes the struct/array nested data /// /// @param struct/array The data to be encoded. Can contain structs, arrays, strings, and numbers. N.B. Will not encode ds_list, ds_map etc. @@ -191,4 +192,4 @@ function __SnapToYAMLBufferValue(_buffer, _value, _alphabetise, _accurateFloats, } return _buffer; -} \ No newline at end of file +} diff --git a/scripts/SnapDeepAdd/SnapDeepAdd.gml b/scripts/SnapDeepAdd/SnapDeepAdd.gml index 4a9ad3c..a48d4e5 100644 --- a/scripts/SnapDeepAdd/SnapDeepAdd.gml +++ b/scripts/SnapDeepAdd/SnapDeepAdd.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @returm N/A (undefined) /// /// This function recursively adds numbers stored in one struct/array to numbers stored in another struct/array. diff --git a/scripts/SnapDeepCopy/SnapDeepCopy.gml b/scripts/SnapDeepCopy/SnapDeepCopy.gml index 17f8cb2..315b96c 100644 --- a/scripts/SnapDeepCopy/SnapDeepCopy.gml +++ b/scripts/SnapDeepCopy/SnapDeepCopy.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @returm Copy of the given struct/array, including a copy of any nested structs and arrays /// /// This function is designed to copy simple tree-like structures that have been imported from SNAP functions. diff --git a/scripts/SnapForeach/SnapForeach.gml b/scripts/SnapForeach/SnapForeach.gml index 16462fb..c351583 100644 --- a/scripts/SnapForeach/SnapForeach.gml +++ b/scripts/SnapForeach/SnapForeach.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return N/A (0) /// /// Executes a method call for each element of the given struct/array/data structure. diff --git a/scripts/SnapFromCSV/SnapFromCSV.gml b/scripts/SnapFromCSV/SnapFromCSV.gml index c4713f7..d42b9b7 100644 --- a/scripts/SnapFromCSV/SnapFromCSV.gml +++ b/scripts/SnapFromCSV/SnapFromCSV.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Decodes an CSV string and outputs a 2D array /// /// @param string The CSV string to be decoded @@ -13,4 +14,4 @@ function SnapFromCSV(_string, _cellDelimiter = ",", _stringDelimiter = "\"") var _data = SnapBufferReadCSV(_buffer, 0, buffer_get_size(_buffer), _cellDelimiter, _stringDelimiter); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromConfigJSON/SnapFromConfigJSON.gml b/scripts/SnapFromConfigJSON/SnapFromConfigJSON.gml index 26baff3..f1b1616 100644 --- a/scripts/SnapFromConfigJSON/SnapFromConfigJSON.gml +++ b/scripts/SnapFromConfigJSON/SnapFromConfigJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the "Config JSON" string /// /// @param string The "Config JSON" string to be decoded @@ -11,4 +12,4 @@ function SnapFromConfigJSON(_string) var _data = SnapBufferReadConfigJSON(_buffer, 0); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromGML/SnapFromGML.gml b/scripts/SnapFromGML/SnapFromGML.gml index 6d11d4f..d78314e 100644 --- a/scripts/SnapFromGML/SnapFromGML.gml +++ b/scripts/SnapFromGML/SnapFromGML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the GML string. The root node will always be a struct /// /// @param string The GML string to be decoded @@ -11,4 +12,4 @@ function SnapFromGML(_string) var _data = SnapBufferReadGML(_buffer, 0, buffer_get_size(_buffer)); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromINIFile/SnapFromINIFile.gml b/scripts/SnapFromINIFile/SnapFromINIFile.gml index 1317f68..993ec2a 100644 --- a/scripts/SnapFromINIFile/SnapFromINIFile.gml +++ b/scripts/SnapFromINIFile/SnapFromINIFile.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Struct/array that represents the data in the INI file /// /// N.B. That this script is only intended to read the .ini files that GM generates @@ -21,4 +22,4 @@ function SnapFromINIFile(_filename, _tryReal = true) var _result = SnapBufferReadINI(_buffer, 0, buffer_get_size(_buffer), _tryReal); buffer_delete(_buffer); return _result; -} \ No newline at end of file +} diff --git a/scripts/SnapFromINIString/SnapFromINIString.gml b/scripts/SnapFromINIString/SnapFromINIString.gml index 0f5bd39..385170c 100644 --- a/scripts/SnapFromINIString/SnapFromINIString.gml +++ b/scripts/SnapFromINIString/SnapFromINIString.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Struct/array that represents the data in the INI file /// /// N.B. That this script is only intended to read the .ini files that GM generates @@ -11,9 +12,9 @@ function SnapFromINIString(_string, _tryReal = true) { - var _buffer = buffer_create(string_byte_length(_string), buffer_fixed, 1); + var _buffer = buffer_create(string_byte_length(_string)+1, buffer_fixed, 1); buffer_write(_buffer, buffer_text, _string); var _data = SnapBufferReadINI(_buffer, 0, buffer_get_size(_buffer), _tryReal); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromJSON/SnapFromJSON.gml b/scripts/SnapFromJSON/SnapFromJSON.gml index b7463d0..6ade14f 100644 --- a/scripts/SnapFromJSON/SnapFromJSON.gml +++ b/scripts/SnapFromJSON/SnapFromJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the JSON string /// @@ -12,4 +13,4 @@ function SnapFromJSON(_string) var _data = SnapBufferReadJSON(_buffer, 0); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromLooseJSON/SnapFromLooseJSON.gml b/scripts/SnapFromLooseJSON/SnapFromLooseJSON.gml index 0af615f..2c40c87 100644 --- a/scripts/SnapFromLooseJSON/SnapFromLooseJSON.gml +++ b/scripts/SnapFromLooseJSON/SnapFromLooseJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the "Loose JSON" string /// /// @param string The "Loose JSON" string to be decoded @@ -11,4 +12,4 @@ function SnapFromLooseJSON(_string) var _data = SnapBufferReadLooseJSON(_buffer, 0); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromQML/SnapFromQML.gml b/scripts/SnapFromQML/SnapFromQML.gml index 58f726c..a949e7a 100644 --- a/scripts/SnapFromQML/SnapFromQML.gml +++ b/scripts/SnapFromQML/SnapFromQML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the QML string /// /// @param string The QML string to be decoded @@ -13,4 +14,4 @@ function SnapFromQML(_string, _instanceofDict, _relaxed = false) var _data = SnapBufferReadQML(_buffer, _instanceofDict, _relaxed, 0); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromVDF/SnapFromVDF.gml b/scripts/SnapFromVDF/SnapFromVDF.gml index a7a336e..57bb1ea 100644 --- a/scripts/SnapFromVDF/SnapFromVDF.gml +++ b/scripts/SnapFromVDF/SnapFromVDF.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct data that represents the contents of the VDF string /// /// @param string The VDF string to be decoded @@ -11,4 +12,4 @@ function SnapFromVDF(_string) var _data = SnapBufferReadVDF(_buffer, 0, buffer_get_size(_buffer)); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromXML/SnapFromXML.gml b/scripts/SnapFromXML/SnapFromXML.gml index 92e36b8..d98571c 100644 --- a/scripts/SnapFromXML/SnapFromXML.gml +++ b/scripts/SnapFromXML/SnapFromXML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Decodes an XML string and outputs a struct /// /// @param string String to decode @@ -11,4 +12,4 @@ function SnapFromXML(_string) var _data = SnapBufferReadXML(_buffer, 0, buffer_get_size(_buffer)); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapFromYAML/SnapFromYAML.gml b/scripts/SnapFromYAML/SnapFromYAML.gml index 42de010..b36a691 100644 --- a/scripts/SnapFromYAML/SnapFromYAML.gml +++ b/scripts/SnapFromYAML/SnapFromYAML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return Nested struct/array data that represents the contents of the YAML string /// /// @param string The YAML string to be decoded @@ -14,4 +15,4 @@ function SnapFromYAML(_string, _replaceKeywords = true, _tracekFieldOrder = fals var _data = SnapBufferReadYAML(_buffer, 0, _replaceKeywords, _tracekFieldOrder, _tabSize); buffer_delete(_buffer); return _data; -} \ No newline at end of file +} diff --git a/scripts/SnapMD5/SnapMD5.gml b/scripts/SnapMD5/SnapMD5.gml index b9eb5a1..a7f125f 100644 --- a/scripts/SnapMD5/SnapMD5.gml +++ b/scripts/SnapMD5/SnapMD5.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Generates an MD5 hash of the data in a struct/array /// This function can also be used on non-struct/array data, though the hash may not line up with other MD5 implementations /// @@ -12,4 +13,4 @@ function SnapMD5(_value) var _hash = buffer_md5(_buffer, 0, buffer_tell(_buffer)); buffer_delete(_buffer); return _hash; -} \ No newline at end of file +} diff --git a/scripts/SnapMerge/SnapMerge.gml b/scripts/SnapMerge/SnapMerge.gml index 2871ccd..5f97014 100644 --- a/scripts/SnapMerge/SnapMerge.gml +++ b/scripts/SnapMerge/SnapMerge.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @returm N/A (undefined) /// /// This function is designed to merge one simple tree-like structures into another. Values from the source tree are copied @@ -97,4 +98,4 @@ function __SnapMerge(_src, _dst, _resolveToSource) { return _src; } -} \ No newline at end of file +} diff --git a/scripts/SnapNumberToString/SnapNumberToString.gml b/scripts/SnapNumberToString/SnapNumberToString.gml index cf078e0..7d0912e 100644 --- a/scripts/SnapNumberToString/SnapNumberToString.gml +++ b/scripts/SnapNumberToString/SnapNumberToString.gml @@ -1,3 +1,4 @@ +// Feather disable all function SnapNumberToString(_value, _accurateFloats) { if (_accurateFloats && is_real(_value) && (floor(_value) != _value)) @@ -23,4 +24,4 @@ function SnapNumberToString(_value, _accurateFloats) { return string(_value); } -} \ No newline at end of file +} diff --git a/scripts/SnapShallowAdd/SnapShallowAdd.gml b/scripts/SnapShallowAdd/SnapShallowAdd.gml index 96161b4..668c5a2 100644 --- a/scripts/SnapShallowAdd/SnapShallowAdd.gml +++ b/scripts/SnapShallowAdd/SnapShallowAdd.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @returm N/A (undefined) /// /// This function adds numbers stored in one struct/array to numbers stored in another struct/array. This is a non-recursive operation. diff --git a/scripts/SnapStringFromFile/SnapStringFromFile.gml b/scripts/SnapStringFromFile/SnapStringFromFile.gml index 18cc41a..992f6da 100644 --- a/scripts/SnapStringFromFile/SnapStringFromFile.gml +++ b/scripts/SnapStringFromFile/SnapStringFromFile.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return String that represents all the text inside the file /// /// @param filename File to parse @@ -18,4 +19,4 @@ function SnapStringFromFile(_filename, _removeBOM = true) buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapStringToFile/SnapStringToFile.gml b/scripts/SnapStringToFile/SnapStringToFile.gml index 958c9e2..b2865b3 100644 --- a/scripts/SnapStringToFile/SnapStringToFile.gml +++ b/scripts/SnapStringToFile/SnapStringToFile.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return The result of the save operation, see documentation for buffer_save() /// /// @param string String to save @@ -22,4 +23,4 @@ function SnapStringToFile(_string, _filename, _addBOM = false) buffer_delete(_buffer); return _result; -} \ No newline at end of file +} diff --git a/scripts/SnapStringify/SnapStringify.gml b/scripts/SnapStringify/SnapStringify.gml index 33ee79c..9c99272 100644 --- a/scripts/SnapStringify/SnapStringify.gml +++ b/scripts/SnapStringify/SnapStringify.gml @@ -1,3 +1,4 @@ +// Feather disable all /// Stringifies an input value in the same vein as GameMaker's native string() function /// The string that this function is not intended to be parseable back into data - please use SnapToJSON() for that /// If the value is a nested struct/array then circular references will be handled gracefully @@ -97,4 +98,4 @@ function __SnapStringifyValue(_value, _longName, _foundMap, _stringifyBuffer) { buffer_write(_stringifyBuffer, buffer_text, string(_value)); } -} \ No newline at end of file +} diff --git a/scripts/SnapToCSV/SnapToCSV.gml b/scripts/SnapToCSV/SnapToCSV.gml index 304e51b..1552cf6 100644 --- a/scripts/SnapToCSV/SnapToCSV.gml +++ b/scripts/SnapToCSV/SnapToCSV.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return CSV string that encodes the provided 2D array /// /// @param array2D The 2D array to encode @@ -15,4 +16,4 @@ function SnapToCSV(_array, _cellDelimiter = ",", _stringDelimiter = "\"", _accur var _string = buffer_read(_buffer, buffer_string); buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapToGML/SnapToGML.gml b/scripts/SnapToGML/SnapToGML.gml index 9aa95ec..43cffe3 100644 --- a/scripts/SnapToGML/SnapToGML.gml +++ b/scripts/SnapToGML/SnapToGML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return GML string that encodes the provided struct /// /// @param struct The struct to be encoded. Can contain structs, arrays, strings, and numbers (but the root must be a struct). N.B. Will not encode ds_list, ds_map etc. @@ -13,4 +14,4 @@ function SnapToGML(_struct, _alphabetise = false) var _string = buffer_read(_buffer, buffer_string); buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapToJSON/SnapToJSON.gml b/scripts/SnapToJSON/SnapToJSON.gml index 8c8cac4..c9b1f85 100644 --- a/scripts/SnapToJSON/SnapToJSON.gml +++ b/scripts/SnapToJSON/SnapToJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return JSON string that encodes the struct/array nested data /// /// @param struct/array The data to be encoded. Can contain structs, arrays, strings, and numbers. N.B. Will not encode ds_list, ds_map etc. @@ -15,4 +16,4 @@ function SnapToJSON(_ds, _pretty = false, _alphabetise = false, _accurateFloats var _string = buffer_read(_buffer, buffer_string); buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapToLooseJSON/SnapToLooseJSON.gml b/scripts/SnapToLooseJSON/SnapToLooseJSON.gml index 011599c..f9b4945 100644 --- a/scripts/SnapToLooseJSON/SnapToLooseJSON.gml +++ b/scripts/SnapToLooseJSON/SnapToLooseJSON.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return "Loose JSON" string that encodes the struct/array nested data /// /// @param struct/array The data to be encoded. Can contain structs, arrays, strings, and numbers. N.B. Will not encode ds_list, ds_map etc. @@ -15,4 +16,4 @@ function SnapToLooseJSON(_ds, _pretty = false, _alphabetise = false, _accurateFl var _string = buffer_read(_buffer, buffer_string); buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapToQML/SnapToQML.gml b/scripts/SnapToQML/SnapToQML.gml index fe0710d..a87b031 100644 --- a/scripts/SnapToQML/SnapToQML.gml +++ b/scripts/SnapToQML/SnapToQML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return QML string that encodes the struct/array nested data /// /// @param struct/array The data to be encoded. Can contain structs, arrays, strings, and numbers. N.B. Will not encode ds_list, ds_map etc. @@ -15,4 +16,4 @@ function SnapToQML(_ds, _instanceofDict, _relaxed = false, _accurateFloats = fal var _string = buffer_read(_buffer, buffer_string); buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapToVDF/SnapToVDF.gml b/scripts/SnapToVDF/SnapToVDF.gml index a1527b1..864463c 100644 --- a/scripts/SnapToVDF/SnapToVDF.gml +++ b/scripts/SnapToVDF/SnapToVDF.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return VDF string that encodes the struct data /// /// N.B. This function cannot encode arrays, and any numbers will be stringified @@ -16,4 +17,4 @@ function SnapToVDF(_ds, _alphabetise = false, _accurateFloats = false) var _string = buffer_read(_buffer, buffer_string); buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapToXML/SnapToXML.gml b/scripts/SnapToXML/SnapToXML.gml index 2fda898..8902c66 100644 --- a/scripts/SnapToXML/SnapToXML.gml +++ b/scripts/SnapToXML/SnapToXML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return XML string that encodes the provided struct /// /// @param struct The data to encode @@ -12,4 +13,4 @@ function SnapToXML(_struct) var _string = buffer_read(_buffer, buffer_string); buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapToYAML/SnapToYAML.gml b/scripts/SnapToYAML/SnapToYAML.gml index ac13b7a..72611e8 100644 --- a/scripts/SnapToYAML/SnapToYAML.gml +++ b/scripts/SnapToYAML/SnapToYAML.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @return YAML string that encodes the struct/array nested data /// /// @param struct/array The data to be encoded. Can contain structs, arrays, strings, and numbers. N.B. Will not encode ds_list, ds_map etc. @@ -14,4 +15,4 @@ function SnapToYAML(_ds, _alphabetise = false, _accurateFloats = false) var _string = buffer_read(_buffer, buffer_string); buffer_delete(_buffer); return _string; -} \ No newline at end of file +} diff --git a/scripts/SnapVisualize/SnapVisualize.gml b/scripts/SnapVisualize/SnapVisualize.gml index a211a0f..7f77130 100644 --- a/scripts/SnapVisualize/SnapVisualize.gml +++ b/scripts/SnapVisualize/SnapVisualize.gml @@ -1,3 +1,4 @@ +// Feather disable all /// @param value /// @param [ascii=false] @@ -229,4 +230,4 @@ function __SnapVisualizeASCIIInner(_buffer, _prefix, _value) buffer_write(_buffer, buffer_text, " "); buffer_write(_buffer, buffer_text, string(_value)); } -} \ No newline at end of file +} diff --git a/scripts/__QMLExampleScript/__QMLExampleScript.gml b/scripts/__QMLExampleScript/__QMLExampleScript.gml index a73ea44..d71c58b 100644 --- a/scripts/__QMLExampleScript/__QMLExampleScript.gml +++ b/scripts/__QMLExampleScript/__QMLExampleScript.gml @@ -1,3 +1,4 @@ +// Feather disable all function ExampleClassRoot() constructor { children = []; @@ -10,4 +11,4 @@ function ExampleClassRectangle() constructor x2 = 0; y2 = 0; children = []; -} \ No newline at end of file +} diff --git a/scripts/__SnapSystem/__SnapSystem.gml b/scripts/__SnapSystem/__SnapSystem.gml index 4ad4e24..770cbe9 100644 --- a/scripts/__SnapSystem/__SnapSystem.gml +++ b/scripts/__SnapSystem/__SnapSystem.gml @@ -1,4 +1,5 @@ +// Feather disable all #macro __SNAP_VERSION "5.8.1" #macro __SNAP_DATE "2023-04-30" -show_debug_message("SNAP: Welcome to SNAP by @jujuadams! This is version " + __SNAP_VERSION + ", " + __SNAP_DATE); \ No newline at end of file +show_debug_message("SNAP: Welcome to SNAP by @jujuadams! This is version " + __SNAP_VERSION + ", " + __SNAP_DATE); From 4cc790d95cb7831bf1651f7988f935d9e21ce517 Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Sat, 21 Oct 2023 12:22:40 +0100 Subject: [PATCH 09/11] Updates tilemap docs --- .../SnapBufferReadTilemapNew.gml | 13 ++++++++++--- .../SnapBufferReadTilemapOverwrite.gml | 18 ++++++++++++++---- .../SnapBufferWriteTilemap.gml | 9 +++++++-- snap.yyp | 2 +- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/scripts/SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml b/scripts/SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml index 129966e..5dcb20c 100644 --- a/scripts/SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml +++ b/scripts/SnapBufferReadTilemapNew/SnapBufferReadTilemapNew.gml @@ -1,7 +1,14 @@ // Feather disable all -/// @param buffer -/// @param offset -/// @param layer +/// Creates a new tilemap on the given layer. The tilemap's dimensions and position will be set to +/// whatever is in the data found in the buffer. If you do **not** specify an offset then SNAP will +/// modify the buffer's "head" position. This allows you to read sequential data more easily. +/// +/// N.B. The name of the tileset to use is embedded in the tilemap data so any renamed or +/// deleted tilesets will fail to read. +/// +/// @param buffer Buffer to write the data into +/// @param offset The position in the buffer to read the tilemap from, relative to the start of the buffer. If set to , the buffer's head position is used +/// @param layer Name of room layer to create the tilemap on /// /// @jujuadams 2023-04-25 diff --git a/scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.gml b/scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.gml index 5979ae0..b1b90d0 100644 --- a/scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.gml +++ b/scripts/SnapBufferReadTilemapOverwrite/SnapBufferReadTilemapOverwrite.gml @@ -1,8 +1,18 @@ // Feather disable all -/// @param buffer -/// @param offset -/// @param tilemap -/// @param [readPosition=false] +/// Overwrites the contents of an already existing tilemap based on data serialized by +/// SnapBufferWriteTilemap(). If the width or height of the incoming tilemap is larger than the +/// current tilemap, extra tiles will not be created. If the width or height is smaller than the +/// current tilemap, the empty space will be set to 0 (no tile). If you do **not** specify an +/// offset then SNAP will modify the buffer's "head" position. This allows you to read sequential +/// data more easily. +/// +/// N.B. The name of the tileset to use is embedded in the tilemap data so any renamed or +/// deleted tilesets will fail to read. +/// +/// @param buffer Buffer to write the data into +/// @param offset The position in the buffer to read the tilemap from, relative to the start of the buffer. If set to , the buffer's head position is used +/// @param tilemap Tilemap whose contents this function should overwrite +/// @param [readPosition=false] Whether to set the position of the tilemap based on the coordinates in the tilemap data. Defaults to if not specified /// /// @jujuadams 2023-04-25 diff --git a/scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml b/scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml index b0372da..83d9cb5 100644 --- a/scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml +++ b/scripts/SnapBufferWriteTilemap/SnapBufferWriteTilemap.gml @@ -1,6 +1,11 @@ // Feather disable all -/// @param buffer -/// @param tilemap +/// Stores the contents of a tilemap in a buffer, starting at the buffer's current head position. +/// +/// N.B. The name of the tileset to use is embedded in the tilemap data so any renamed or +/// deleted tilesets will fail to read. +/// +/// @param buffer Buffer to write the data into +/// @param tilemap Tilemap to serialize /// /// @jujuadams 2023-04-25 diff --git a/snap.yyp b/snap.yyp index ba6a329..a17dd56 100644 --- a/snap.yyp +++ b/snap.yyp @@ -142,6 +142,6 @@ ], "IncludedFiles": [], "MetaData": { - "IDEVersion": "2022.0.0.19", + "IDEVersion": "2022.0.2.51", }, } \ No newline at end of file From 17cd544c8abaf64112250adb1ec3cc26c63a3efd Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Sat, 21 Oct 2023 12:26:05 +0100 Subject: [PATCH 10/11] Update SnapVisualize.gml --- scripts/SnapVisualize/SnapVisualize.gml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/SnapVisualize/SnapVisualize.gml b/scripts/SnapVisualize/SnapVisualize.gml index 7f77130..2d1bfcb 100644 --- a/scripts/SnapVisualize/SnapVisualize.gml +++ b/scripts/SnapVisualize/SnapVisualize.gml @@ -1,6 +1,8 @@ // Feather disable all -/// @param value -/// @param [ascii=false] +/// Returns a human-readable "ASCII art" diagram showing the structure of the input struct/array. +/// +/// @param value Value to process for display +/// @param [ascii=false] Whether to use ASCII compatibility mode function SnapVisualize(_value, _ascii = false) { From e50798d5fef4a0f409ffa75fa99b7f0e0e21a82d Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Sat, 21 Oct 2023 12:27:31 +0100 Subject: [PATCH 11/11] 5.9.0 --- README.md | 2 +- options/windows/options_windows.yy | 2 +- scripts/__SnapSystem/__SnapSystem.gml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5ae7566..bab2c1c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

SNAP 5.8.1

+

SNAP 5.9.0

Data format converters for GameMaker Studio 2022 LTS by @jujuadams

diff --git a/options/windows/options_windows.yy b/options/windows/options_windows.yy index 77f33fc..471c833 100644 --- a/options/windows/options_windows.yy +++ b/options/windows/options_windows.yy @@ -4,7 +4,7 @@ "name": "Windows", "option_windows_display_name": "SNAP", "option_windows_executable_name": "${project_name}.exe", - "option_windows_version": "5.8.1.0", + "option_windows_version": "5.9.0.0", "option_windows_company_info": "@jujuadams", "option_windows_product_info": "SNAP", "option_windows_copyright_info": "@jujuadams 2023", diff --git a/scripts/__SnapSystem/__SnapSystem.gml b/scripts/__SnapSystem/__SnapSystem.gml index 770cbe9..2a4620a 100644 --- a/scripts/__SnapSystem/__SnapSystem.gml +++ b/scripts/__SnapSystem/__SnapSystem.gml @@ -1,5 +1,5 @@ // Feather disable all -#macro __SNAP_VERSION "5.8.1" -#macro __SNAP_DATE "2023-04-30" +#macro __SNAP_VERSION "5.9.0" +#macro __SNAP_DATE "2023-10-21" show_debug_message("SNAP: Welcome to SNAP by @jujuadams! This is version " + __SNAP_VERSION + ", " + __SNAP_DATE);