diff --git a/resources/tag.yml b/resources/tag.yml index 41fcfc5..93461fb 100644 --- a/resources/tag.yml +++ b/resources/tag.yml @@ -26,61 +26,20 @@ - 2.2 - 3.2 - 4.2 - #~ !v!Gee.ArrayList type_gee_alobject : - #~ - toto : totovalue1 - #~ tata : tatavalue1 - #~ titi : 789 - #~ tutu : true - #~ - toto : totovalue2 - #~ tata : tatavalue2 - #~ titi : 456 - #~ tutu : false - #~ - toto : totovalue3 - #~ tata : tatavalue3 - #~ titi : 123 - #~ tutu : 1 - #~ - toto : totovalue4 - #~ tata : tatavalue4 - #~ titi : 44 - #~ tutu : 0 !v!Gee.ArrayList type_gee_alobject : - - !v!Pluie.Yaml.ExampleChild entry1: - toto : totovalue1 - tata : tatavalue1 - titi : 789 - tutu : true - - !v!Pluie.Yaml.ExampleChild entry2: - toto : totovalue2 - tata : tatavalue2 - titi : 456 - tutu : false - - !v!Pluie.Yaml.ExampleChild entry3: - toto : totovalue3 - tata : tatavalue3 - titi : 123 - tutu : 1 - - !v!Pluie.Yaml.ExampleChild entry4: - toto : totovalue4 - tata : tatavalue4 - titi : 44 - tutu : 0 - - - - #~ !v!Gee.ArrayList type_gee_alobject : - #~ - toto : totovalue1 - #~ tata : tatavalue1 - #~ titi : 789 - #~ tutu : true - #~ - toto : totovalue2 - #~ tata : tatavalue2 - #~ titi : 456 - #~ tutu : false - #~ - toto : totovalue3 - #~ tata : tatavalue3 - #~ titi : 123 - #~ tutu : 1 - #~ - toto : totovalue4 - #~ tata : tatavalue4 - #~ titi : 44 - #~ tutu : 0 + - toto : totovalue1 + tata : tatavalue1 + titi : 789 + tutu : true + - toto : totovalue2 + tata : tatavalue2 + titi : 456 + tutu : false + - toto : totovalue3 + tata : tatavalue3 + titi : 123 + tutu : 1 + - toto : totovalue4 + tata : tatavalue4 + titi : 44 + tutu : 0 diff --git a/samples/yaml-dump.vala b/samples/yaml-dump.vala index 8622ba0..f62bb5f 100644 --- a/samples/yaml-dump.vala +++ b/samples/yaml-dump.vala @@ -40,7 +40,7 @@ int main (string[] args) var done = false; of.title ("Pluie Yaml Library", Pluie.Yaml.VERSION, "a-sansara"); - Pluie.Yaml.DEBUG = true; + Pluie.Yaml.DEBUG = false; var config = new Yaml.Config (path, true); var root = config.root_node () as Yaml.Root; if ((done = root != null)) { @@ -50,8 +50,9 @@ int main (string[] args) of.action("Yaml.Node", "to_yaml_string"); string yaml = root.to_yaml_string (); try { + string genpath = "./tag-generated.yml"; // an output file in the current working directory - var file = File.new_for_path ( "./tag-generated.yml"); + var file = File.new_for_path (genpath); // delete if file already exists if (file.query_exists ()) { file.delete (); @@ -63,6 +64,7 @@ int main (string[] args) // sum of the bytes of 'text' that already have been written to the stream written += dos.write (data[written:data.length]); } + of.echo ("write %lld bytes in `%s`".printf ((long) written, genpath)); Yaml.Dumper.show_yaml_string (root, true, true, true); } catch (Error e) { stderr.printf ("%s\n", e.message); diff --git a/samples/yaml-test.vala b/samples/yaml-test.vala index 4ec23a0..0bf5a75 100644 --- a/samples/yaml-test.vala +++ b/samples/yaml-test.vala @@ -32,18 +32,6 @@ using GLib; using Gee; using Pluie; -class Foo { - public signal void sig (int x); -} - -class Bar { - private int data = 42; - - public void handler (int x) { - stdout.printf ("%d Data via instance: %d\n", x, this.data); - } -} - int main (string[] args) { Echo.init(false); @@ -92,19 +80,6 @@ int main (string[] args) of.rs (done); of.echo (); - var foo = new Foo (); - - int data = 52; - foo.sig.connect ((x) => { // 'user_data' in C code = variables from outer context - stdout.printf ("%d Data via closure: %d\n", x, data); - }); - - var bar = new Bar (); - foo.sig.connect (bar.handler); // 'user_data' in C code = 'bar' - - // Emit signal - foo.sig (73); - return (int) done; } diff --git a/src/vala/Pluie/Yaml.Dumper.vala b/src/vala/Pluie/Yaml.Dumper.vala index 7392b51..c04d8e7 100644 --- a/src/vala/Pluie/Yaml.Dumper.vala +++ b/src/vala/Pluie/Yaml.Dumper.vala @@ -195,7 +195,7 @@ public class Pluie.Yaml.Dumper } if (node.parent != null && node.parent.ntype.is_sequence ()) yaml.append (!SHOW_COLORS ? "- " : of.c (ECHO.DATE).s ("- ")); if (wrapseq) { - of.warn ("node %s wrapseq ? %s".printf (node.name, wrapseq.to_string ())); + if (Yaml.DEBUG) of.warn ("node %s wrapseq ? %s".printf (node.name, wrapseq.to_string ())); } yaml_tag (ref yaml, node, show_tags); if (!wrapseq) { diff --git a/src/vala/Pluie/Yaml.Processor.vala b/src/vala/Pluie/Yaml.Processor.vala index 56203b8..d4e1136 100644 --- a/src/vala/Pluie/Yaml.Processor.vala +++ b/src/vala/Pluie/Yaml.Processor.vala @@ -272,7 +272,6 @@ public class Pluie.Yaml.Processor if (e != null && e.evtype.is_value ()) { evt = this.next_event (); this.nextValueEvt = evt; - of.echo ("next value event is %s".printf (evt.evtype.infos ())); } return evt; } @@ -283,16 +282,12 @@ public class Pluie.Yaml.Processor private Yaml.Event? get_next_value_event () { Yaml.Event? evt = null; - of.echo(" :::: current event %s - index %d".printf (this.event.evtype.infos (), this.indexEvt)); var i = this.indexEvt+1; - of.echo(" :::: i = %d".printf (i)); var search = true; while (search) { if (i < this.events.size) { var e = this.events.get (i++); - of.echo(" :::: i = %d => event : %s".printf (i-1, e.evtype.infos ())); if (e != null && e.evtype.is_value ()) { - of.echo(" :::: IS VALUE RETURN NEXT EVENTi = %d => event : %s".printf (i, e.evtype.infos ())); evt = this.events.get (i); break; } @@ -325,17 +320,11 @@ public class Pluie.Yaml.Processor */ private void on_block_end () { - of.echo (" > [ ON BLOCK END ]"); if (!this.prev_node.ntype.is_collection ()) { - of.echo (" *** prev not a collection deal with parent"); this.prev_node = this.prev_node.parent; } - of.echo (" PREV WAS %s (%s)".printf (this.prev_node.ntype.infos (), this.prev_node.name)); - of.echo (" PARENT WAS %s (%s)".printf (this.parent_node.ntype.infos (), this.parent_node.name)); bool isSequenceWithBlock = this.prev_node.ntype.is_sequence () && !this.prev_node.empty() && this.prev_node.first ().ntype.is_collection (); - of.echo (" !! isSequenceWithBlock ? %s".printf (isSequenceWithBlock.to_string ())); if (!isSequenceWithBlock || (isSequenceWithBlock && (this.prev_node as Yaml.Sequence).close_block)) { - of.echo (" PREV IS NOT A SEQUENCE OR !! isSequenceWithBlock ? %s".printf (isSequenceWithBlock.to_string ())); this.parent_node = this.prev_node.parent != null && this.prev_node.parent != this.root ? this.prev_node.parent : this.root; @@ -347,9 +336,6 @@ public class Pluie.Yaml.Processor seq.close_block = true; } } - of.echo (" PREV IS %s (%s)".printf (this.prev_node.ntype.infos (), this.prev_node.name)); - of.echo (" PARENT IS %s (%s)".printf (this.parent_node.ntype.infos (), this.parent_node.name)); - of.echo (" < [ ON BLOCK END ]"); } /** @@ -357,16 +343,10 @@ public class Pluie.Yaml.Processor */ private void on_entry () { - of.echo (" >>> on_ENTRY : current event is %s".printf (this.event.evtype.infos ())); this.event = this.next_event(); - of.echo (" >>> on_ENTRY : ENTRY TYPE %s".printf (this.event.evtype.infos ())); Yaml.Event? e = null; e = get_next_value_event (); - if (e != null) { - of.echo (" >>> on_ENTRY : NEXT value event is %s".printf (e.evtype.infos ())); - } if (this.event.evtype.is_mapping_start () && (e!= null && !e.evtype.is_mapping_start ())) { - of.echo (" THE mapping start"); this.on_mapping_start (true); } else if (this.event.evtype.is_scalar ()) { @@ -410,7 +390,6 @@ public class Pluie.Yaml.Processor */ private void on_value () { - of.echo (" >>> ON VALUE : next value event is %s".printf (this.nextValueEvt.evtype.infos ())); this.on_tag (false); if (this.event.evtype.is_scalar ()) { this.on_scalar (); @@ -493,7 +472,6 @@ public class Pluie.Yaml.Processor if (entry) { this.ckey = "_%d".printf(this.parent_node.count()); } - of.echo ("ckey : %s".printf (this.ckey)); this.node = new Yaml.Mapping (this.parent_node, this.ckey); this.change = true; } @@ -538,15 +516,11 @@ public class Pluie.Yaml.Processor } } if (this.node.ntype.is_collection () && (this.node.empty() || (!this.node.first().ntype.is_scalar ()))) { - of.echo (" => SET *** **parent %s (%s) TO node %s (%s) ****".printf (this.parent_node.ntype.infos (), this.parent_node.name, this.node.ntype.infos (), this.node.name)); - of.echo (" => CURNODE %s (%s) has parent : %s (%s) ****".printf (this.node.ntype.infos (), this.node.name, this.node.parent.ntype.infos (), this.node.parent.name)); this.parent_node = this.node; } else { - of.echo (" => SET parent %s (%s) TO node %s (%s) ====".printf (this.parent_node.ntype.infos (), this.parent_node.name, this.node.parent.ntype.infos (), this.node.parent.name)); this.parent_node = this.node.parent; } - of.echo (" => SET prev_node %s (%s) TO node %s (%s) ====".printf (this.prev_node.ntype.infos (), this.prev_node.name, this.node.ntype.infos (), this.node.name)); this.prev_node = this.node; this.tagHandle = null; this.keyTag = null; diff --git a/src/vala/Pluie/Yaml.Register.vala b/src/vala/Pluie/Yaml.Register.vala index 44a8659..e9fe32d 100644 --- a/src/vala/Pluie/Yaml.Register.vala +++ b/src/vala/Pluie/Yaml.Register.vala @@ -170,7 +170,6 @@ public class Pluie.Yaml.Register Yaml.dbg ("resolve_namespace_type %u (%s) => %s".printf (serial, type.name (), name)); ns_resolved.set (serial, name); } - of.echo ("resolve_namespace_type %s => %s".printf (type.name (), get_resolved_ns (type))); return get_resolved_ns (type); }