Well, I *thing* i have all figured out and I have the code for that in my repository, but I'm not pushing it yet, because some of that is a little controversial (and I have a feeling that I'm bossing around too much lately ;))
In addition to the 7 patches I sent previously, I'm attaching what effect my struggle had on documents. The most interesting is 0010, because it adds an attribute with a formal specification how to get specific parameter ids in a useparameters property (yes, I'm using it to generate code and it seems to work). The rest are mostly cleanups and some going back and forth witch changes ;) The thing is I don't know how to test it :) I know how to get order descriptions, but I can't find a way to get orders and see if the "extra data" can be correctly decoded. But the good news is that after some cleanups I can have an implementation of TP04 for free now :) -- KS "To an engineer, everyone looks like a chimp" - Dilbert ---------------------------------------------------------------------- Zasilila telefon nie wychodzac z domu >>> http://link.interia.pl/f1bb1
From 1372c2a87cdaddd762e5144d20e8766747df65e6 Mon Sep 17 00:00:00 2001
From: Krzysztof Sobolewski <[EMAIL PROTECTED]>
Date: Fri, 14 Sep 2007 00:51:04 +0200
Subject: [PATCH] Restore descstruct elements in ObjectParams parameterset in protocol.xml, because if there's for one parameter, there should be for all (that's polymorphism :)).
---
protocol/protocol.xml | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/protocol/protocol.xml b/protocol/protocol.xml
index 3ca559d..bf4697c 100644
--- a/protocol/protocol.xml
+++ b/protocol/protocol.xml
@@ -265,6 +265,9 @@
<parameter name="objectParamPosition3d" type="0">
<longname>Position in 3D</longname>
<description>A vector for the position.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<group>
@@ -293,6 +296,9 @@
<parameter name="objectParamVelocity3d" type="1">
<longname>Velocity in 3D</longname>
<description>A vector for the velocity.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<group>
@@ -321,6 +327,9 @@
<parameter name="objectParamAcceleration3d" type="2">
<longname>Acceleration in 3D</longname>
<description>A vector for the acceleration.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<group>
@@ -349,6 +358,9 @@
<parameter name="objectParamBoundPosition" type="3">
<longname>Bound Position</longname>
<description>Object is bound to ('in') an Object.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<integer type="signed" size="32" readonly="yes">
@@ -406,6 +418,9 @@
<parameter name="objectParamResourceList" type="5">
<longname>Resource List</longname>
<description>A list of resources.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<list>
@@ -441,6 +456,9 @@
<parameter name="objectParmReference" type="6">
<longname>Reference</longname>
<description>A generic reference to something.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<integer type="signed" size="32">
@@ -458,6 +476,9 @@
<parameter name="objectParamReferenceQuantityList" type="7">
<longname>Reference Quality List</longname>
<description>Gives a list of references and how many of each of them.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<list>
@@ -486,6 +507,9 @@
<parameter name="objectParamInteger" type="8">
<longname>Integer</longname>
<description>An Integer, informational.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<integer type="unsigned" size="32">
@@ -499,6 +523,9 @@
<parameter name="objectParamSize" type="9">
<longname>Size</longname>
<description>The diameter of the object.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<integer type="unsigned" size="64" readonly="yes">
@@ -512,6 +539,9 @@
<parameter name="objectParamMedia" type="10">
<longname>Media Url</longname>
<description>The url for the media for this object, either relative to the base url given in the Game frame, of absolute.</description>
+ <descstruct>
+ <structure />
+ </descstruct>
<usestruct>
<structure>
<string readonly="yes">
--
1.5.2.4
From e981188af10100daf73e89f428b3d6e612e2b1ae Mon Sep 17 00:00:00 2001 From: Krzysztof Sobolewski <[EMAIL PROTECTED]> Date: Fri, 14 Sep 2007 01:04:16 +0200 Subject: [PATCH] Reintroduce ObjectParams into protocol3.xml as a parameterset describing TP03 objects in terms of "direct" object parameters. --- protocol/protocol3.xml | 112 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 112 insertions(+), 0 deletions(-) diff --git a/protocol/protocol3.xml b/protocol/protocol3.xml index b05744f..41b31c1 100644 --- a/protocol/protocol3.xml +++ b/protocol/protocol3.xml @@ -259,6 +259,114 @@ </usestruct> </parameter> </parameterset> + <parameterset name="ObjectParams"> + <longname>Game Objects</longname> + <description>These are the "parameters" that define structures of Objects.</description> + <parameter name="Universe" type="0"> + <longname>the Universe</longname> + <descstruct> + <structure /> + </descstruct> + <usestruct> + <structure> + <integer type="unsigned" readonly="yes" size="32"> + <name>age</name> + <longname>the current year/turn number</longname> + </integer> + </structure> + </usestruct> + </parameter> + <parameter name="Galaxy" type="1"> + <longname>a galaxy, a collection of star systems</longname> + <descstruct> + <structure /> + </descstruct> + <usestruct> + <structure> + <!-- empty --> + </structure> + </usestruct> + </parameter> + <parameter name="StarSystem" type="2"> + <longname>a star system, a collection of planets</longname> + <descstruct> + <structure /> + </descstruct> + <usestruct> + <structure> + <!-- empty --> + </structure> + </usestruct> + </parameter> + <parameter name="Planet" type="3"> + <longname>a celestial object that can be inhabited</longname> + <descstruct> + <structure /> + </descstruct> + <usestruct> + <structure> + <integer type="semisigned" readonly="yes" size="32"> + <name>owner</name> + <longname>the id of the player who "owns" this planet or -1 if not owned or unknown</longname> + </integer> + <list> + <name>resources</name> + <longname>a list of resources available on this planet</longname> + <structure> + <integer type="unsigned" readonly="yes" size="32"> + <name>id</name> + <longname>the resource id</longname> + </integer> + <integer type="unsigned" readonly="yes" size="32"> + <name>units</name> + <longname>the units of this resource on the "surface"</longname> + </integer> + <integer type="unsigned" readonly="yes" size="32"> + <name>unitsminable</name> + <longname>the maximum units of this resource remaining which are minable</longname> + </integer> + <integer type="unsigned" readonly="yes" size="32"> + <name>unitsinaccessible</name> + <longname>the maximum units of this resource remaining which are inaccessable</longname> + </integer> + </structure> + </list> + </structure> + </usestruct> + </parameter> + <parameter name="Fleet" type="4"> + <longname>a group of ships</longname> + <descstruct> + <structure /> + </descstruct> + <usestruct> + <structure> + <integer type="semisigned" readonly="yes" size="32"> + <name>owner</name> + <longname>the id of the player who owns this fleet or -1 if not owned or unknown</longname> + </integer> + <list> + <name>ships</name> + <longname>a list of ships in this fleet</longname> + <structure> + <integer type="unsigned" readonly="yes" size="32"> + <name>type</name> + <longname>the type of the ship</longname> + </integer> + <integer type="unsigned" readonly="yes" size="32"> + <name>count</name> + <longname>the number of the ships in the fleet</longname> + </integer> + </structure> + </list> + <integer type="unsigned" readonly="yes" size="32"> + <name>damage</name> + <longname>the amount of damage the fleet currently has</longname> + </integer> + </structure> + </usestruct> + </parameter> + </parameterset> <packet name="Header"> @@ -734,6 +842,10 @@ <character size="8"> <name>padding</name> </character> + <useparameters ref="ObjectParams" typefield="otype"> + <name>object</name> + <longname>the objet's data</longname> + </useparameters> </structure> <note> Note: The number of orders should be the number of orders the person can see on the -- 1.5.2.4
From 29d8628fc5303749807d3676b328d96caadc2e67 Mon Sep 17 00:00:00 2001 From: Krzysztof Sobolewski <[EMAIL PROTECTED]> Date: Fri, 14 Sep 2007 17:06:19 +0200 Subject: [PATCH] Define and use the syntax of magical [EMAIL PROTECTED] attribute. --- protocol/protocol.dtd | 30 ++++++++++++++++++++++++++++-- protocol/protocol.xml | 6 ++---- protocol/protocol3.xml | 5 ++--- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/protocol/protocol.dtd b/protocol/protocol.dtd index 5289dc7..835e8b2 100644 --- a/protocol/protocol.dtd +++ b/protocol/protocol.dtd @@ -32,9 +32,35 @@ <!ATTLIST list readonly CDATA "no" > <!ELEMENT group (name, longname, description?, structure, example?, note*) > <!ELEMENT useparameters (name, longname, description?) > -<!ATTLIST useparameters ref IDREF #REQUIRED typefield CDATA #IMPLIED > +<!-- + [EMAIL PROTECTED] format: (as a regex) + (\w+)(=(\w+)(\[(\w+)\])?.(((\w+)([.:]|$))+))? + 1 2 3 4 5 678 9 + + groups: + 1 = local field with type + 2 = indirect clause (if not present, typefield is direct) + 3 = indirect frame's name + 4 = optional indirect frame's id field clause (for consistency checks) + 5 = indirect frame's id field name + 6 = search path clauses + 7 = single search path clause + 8 = search path element field name + 9 = search path type; '.' is a simple field access; ':' is list traversal; none at the end + + examples: + "otype" + (simple direct parameter; object data in Object frame in TP03) + + "otype=OrderDesc[id].parameters:type" + (indirect parameters; order params in TP03) + + "otype=ObjectDesc[id].propertygroups:parameters:type" + (indirect parameters; object params in TP04) +--> +<!ATTLIST useparameters ref IDREF #REQUIRED typefield CDATA #REQUIRED > <!ELEMENT descparameter (name, longname, description?) > -<!ATTLIST descparameter ref IDREF #REQUIRED typefield CDATA #IMPLIED > +<!ATTLIST descparameter ref IDREF #REQUIRED typefield CDATA #REQUIRED > <!-- Parameterset --> <!ELEMENT parameterset (longname?, description?, parameter+, note*) > diff --git a/protocol/protocol.xml b/protocol/protocol.xml index bf4697c..d9760c2 100644 --- a/protocol/protocol.xml +++ b/protocol/protocol.xml @@ -1290,8 +1290,7 @@ <character size="16"> <name>padding</name> </character> - <!-- FIXME: otype is actually indirect through ObjectDesc --> - <useparameters ref="ObjectParams" typefield="otype"> + <useparameters ref="ObjectParams" typefield="otype=ObjectDesc[id].propertygroups:parameters:type"> <name>parameters</name> <longname>the object's parameters</longname> </useparameters> @@ -1492,8 +1491,7 @@ </integer> </structure> </list> - <!-- FIXME: otype is actually indirect through OrderDesc --> - <useparameters ref="OrderParams" typefield="otype"> + <useparameters ref="OrderParams" typefield="otype=OrderDesc[id].parameters:type"> <name>parameters</name> <longname>this order's parameters</longname> <description>extra data, required by the order is appended to the end</description> diff --git a/protocol/protocol3.xml b/protocol/protocol3.xml index 41b31c1..4f814b6 100644 --- a/protocol/protocol3.xml +++ b/protocol/protocol3.xml @@ -1038,9 +1038,8 @@ </integer> </structure> </list> - <!-- FIXME: otype is actually indirect through OrderDesc --> - <useparameters ref="OrderParams" typefield="otype"> - <name>oderparams</name> + <useparameters ref="OrderParams" typefield="otype=OrderDesc[id].parameters:type"> + <name>orderparams</name> <longname>the order's parameter</longname> <description>extra data, required by the order is appended to the end</description> </useparameters> -- 1.5.2.4
From 9dc8f2e61ffe712ae33487622beb60160afc9fbf Mon Sep 17 00:00:00 2001 From: Krzysztof Sobolewski <[EMAIL PROTECTED]> Date: Fri, 14 Sep 2007 17:07:56 +0200 Subject: [PATCH] Re-remove descstruct elements from object definitions in protocol3.xml. --- protocol/protocol3.xml | 15 --------------- 1 files changed, 0 insertions(+), 15 deletions(-) diff --git a/protocol/protocol3.xml b/protocol/protocol3.xml index 4f814b6..02698d0 100644 --- a/protocol/protocol3.xml +++ b/protocol/protocol3.xml @@ -264,9 +264,6 @@ <description>These are the "parameters" that define structures of Objects.</description> <parameter name="Universe" type="0"> <longname>the Universe</longname> - <descstruct> - <structure /> - </descstruct> <usestruct> <structure> <integer type="unsigned" readonly="yes" size="32"> @@ -278,9 +275,6 @@ </parameter> <parameter name="Galaxy" type="1"> <longname>a galaxy, a collection of star systems</longname> - <descstruct> - <structure /> - </descstruct> <usestruct> <structure> <!-- empty --> @@ -289,9 +283,6 @@ </parameter> <parameter name="StarSystem" type="2"> <longname>a star system, a collection of planets</longname> - <descstruct> - <structure /> - </descstruct> <usestruct> <structure> <!-- empty --> @@ -300,9 +291,6 @@ </parameter> <parameter name="Planet" type="3"> <longname>a celestial object that can be inhabited</longname> - <descstruct> - <structure /> - </descstruct> <usestruct> <structure> <integer type="semisigned" readonly="yes" size="32"> @@ -336,9 +324,6 @@ </parameter> <parameter name="Fleet" type="4"> <longname>a group of ships</longname> - <descstruct> - <structure /> - </descstruct> <usestruct> <structure> <integer type="semisigned" readonly="yes" size="32"> -- 1.5.2.4
From f5aa5ae04fbb5b58ce48371e73af8995aabfaf6f Mon Sep 17 00:00:00 2001 From: Krzysztof Sobolewski <[EMAIL PROTECTED]> Date: Fri, 14 Sep 2007 17:14:07 +0200 Subject: [PATCH] That document describes TP04+ :) --- protocol/protocol.xml | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/protocol/protocol.xml b/protocol/protocol.xml index d9760c2..5d405d3 100644 --- a/protocol/protocol.xml +++ b/protocol/protocol.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE protocol SYSTEM "protocol.dtd"> -<protocol version="TP03"> +<protocol version="TP04"> <parameterset name="OrderParams"> <longname>Order Parameters</longname> <description>These are the parameters for Orders and OrderDescriptions.</description> -- 1.5.2.4
From a96606d0c8b35be1a8022b066f3893b17df9e600 Mon Sep 17 00:00:00 2001 From: Krzysztof Sobolewski <[EMAIL PROTECTED]> Date: Fri, 14 Sep 2007 17:34:26 +0200 Subject: [PATCH] Some cleanups from indent police and for property names. --- protocol/protocol.xml | 55 ++++++++++++++++++++++++++--------------------- protocol/protocol3.xml | 18 +++++++------- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/protocol/protocol.xml b/protocol/protocol.xml index 5d405d3..20f3bf3 100644 --- a/protocol/protocol.xml +++ b/protocol/protocol.xml @@ -789,9 +789,9 @@ <description>Modification Times of each ID</description> <structure> <integer type="unsigned" size="32"> - <name>ID</name> - <longname>the IDs</longname> - <description>the IDs</description> + <name>id</name> + <longname>the ID</longname> + <description>the ID</description> </integer> <integer type="unsigned" size="64"> <name>modtime</name> @@ -1039,6 +1039,7 @@ <longname>Protocol Versions</longname> <description>Supported protocol versions.</description> <structure> + <!-- TODO: integer? otherwise, what's the format? --> <string> <name>proto</name> <longname>Protocol version</longname> @@ -1276,9 +1277,9 @@ <description>IDs of the objects contained by this object.</description> <structure> <integer type="unsigned" size="32" readonly="yes"> - <name>ID</name> - <longname>the IDs</longname> - <description>the IDs</description> + <name>id</name> + <longname>the ID</longname> + <description>the ID</description> </integer> </structure> </list> @@ -1782,7 +1783,7 @@ <structure> <integer type="unsigned" size="32"> - <name>Resource ID</name> + <name>id</name> <longname>Resource ID</longname> <description>Resource ID</description> </integer> @@ -1944,12 +1945,12 @@ <description>The time at which this design was last modified.</description> </integer> <list> - <name>catlist</name> - <longname>Category List</longname> + <name>catlist</name> + <longname>Category List</longname> <structure> <integer type="unsigned" size="32"> <name>catid</name> - <longname>Category ID</longname> + <longname>Category ID</longname> </integer> </structure> </list> @@ -1958,7 +1959,7 @@ <longname>name of the design</longname> </string> <string type="formatted"> - <name>description</name> + <name>description</name> <longname>description of the design</longname> </string> <integer type="semisigned" size="32"> @@ -1987,7 +1988,7 @@ </structure> </list> <string type="formatted"> - <name>feedback</name> + <name>feedback</name> <longname>human readable feedback on the design</longname> </string> <list> @@ -2001,7 +2002,7 @@ </integer> <string type="formatted"> <name>displaystring</name> - <longname>String value of the property</longname> + <longname>String value of the property</longname> </string> </structure> </list> @@ -2052,7 +2053,7 @@ <longname>Component</longname> <structure> <integer type="unsigned" size="32"> - <name>component ID</name> + <name>id</name> <longname>component ID</longname> <description>component ID</description> </integer> @@ -2062,18 +2063,21 @@ <description>The time at which this component was last modified.</description> </integer> <list> - <name>catlist</name> - <longname>Category List</longname> + <name>catlist</name> + <longname>Category List</longname> <structure> - <integer type="unsigned" size="32"><name>categories this component is in</name></integer> + <integer type="unsigned" size="32"> + <name>catid</name> + <longname>category this component is in</longname> + </integer> </structure> </list> <string type="formatted"> - <name>name</name> + <name>name</name> <longname>name of the component</longname> </string> <string type="formatted"> - <name>description</name> + <name>description</name> <longname>description of the component</longname> </string> <string> @@ -2130,16 +2134,17 @@ <description>The time at which this property was last modified.</description> </integer> <list> - <name>catlist</name> - <longname>Category List</longname> + <name>catlist</name> + <longname>Category List</longname> <structure> <integer type="unsigned" size="32"> - <name>categories this component is in</name> + <name>catid</name> + <longname>category this component is in</longname> </integer> </structure> </list> <integer type="unsigned" size="32"> - <name>rank of the property</name> + <name>rank</name> <longname>rank of the property</longname> <description>rank of the property</description> </integer> @@ -2149,11 +2154,11 @@ <description>A valid TPCL identifier for this property.</description> </string> <string type="formatted"> - <name>dispalyname</name> + <name>dispalyname</name> <longname>display name of the property</longname> </string> <string type="formatted"> - <name>description</name> + <name>description</name> <longname>description of the property</longname> </string> <string> diff --git a/protocol/protocol3.xml b/protocol/protocol3.xml index 02698d0..ce06483 100644 --- a/protocol/protocol3.xml +++ b/protocol/protocol3.xml @@ -552,9 +552,9 @@ <description>Modification Times of each ID</description> <structure> <integer type="unsigned" size="32"> - <name>ID</name> - <longname>the IDs</longname> - <description>the IDs</description> + <name>id</name> + <longname>the ID</longname> + <description>the ID</description> </integer> <integer type="unsigned" size="64"> <name>modtime</name> @@ -796,9 +796,9 @@ <description>IDs of the objects contained by this object.</description> <structure> <integer type="unsigned" size="32"> - <name>ID</name> - <longname>the IDs</longname> - <description>the IDs</description> + <name>id</name> + <longname>the ID</longname> + <description>the ID</description> </integer> </structure> </list> @@ -808,9 +808,9 @@ <description>The order types that a player can send to this object.</description> <structure> <integer type="unsigned" size="32"> - <name>ID</name> - <longname>the IDs</longname> - <description>the IDs</description> + <name>id</name> + <longname>the ID</longname> + <description>the ID</description> </integer> </structure> </list> -- 1.5.2.4
From 1f85a9d0d338faf78bc85c5c049c84c113a8dd08 Mon Sep 17 00:00:00 2001 From: Krzysztof Sobolewski <[EMAIL PROTECTED]> Date: Fri, 14 Sep 2007 17:35:58 +0200 Subject: [PATCH] Rename a property named "int" to "intvalue", because generated code doesn't like it ;) --- protocol/protocol.xml | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/protocol/protocol.xml b/protocol/protocol.xml index 20f3bf3..7483610 100644 --- a/protocol/protocol.xml +++ b/protocol/protocol.xml @@ -513,7 +513,7 @@ <usestruct> <structure> <integer type="unsigned" size="32"> - <name>int</name> + <name>intvalue</name> <longname>Value</longname> <description>The value of the integer parameter.</description> </integer> -- 1.5.2.4
From e124eb7c29586f09c8ef409aaaa4935e38cfbf06 Mon Sep 17 00:00:00 2001 From: Krzysztof Sobolewski <[EMAIL PROTECTED]> Date: Fri, 14 Sep 2007 18:46:09 +0200 Subject: [PATCH] Forgot that dot has a special meaning in regexps ;) --- protocol/protocol.dtd | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/protocol.dtd b/protocol/protocol.dtd index 835e8b2..3155a34 100644 --- a/protocol/protocol.dtd +++ b/protocol/protocol.dtd @@ -34,8 +34,8 @@ <!ELEMENT useparameters (name, longname, description?) > <!-- [EMAIL PROTECTED] format: (as a regex) - (\w+)(=(\w+)(\[(\w+)\])?.(((\w+)([.:]|$))+))? - 1 2 3 4 5 678 9 + (\w+)(=(\w+)(\[(\w+)\])?\.(((\w+)([.:]|$))+))? + 1 2 3 4 5 678 9 groups: 1 = local field with type -- 1.5.2.4
From 5bbc6a4b7b05d97a0f6bde30c982db44da0004e9 Mon Sep 17 00:00:00 2001 From: Krzysztof Sobolewski <[EMAIL PROTECTED]> Date: Fri, 14 Sep 2007 22:02:44 +0200 Subject: [PATCH] Remove descparameter for OrderParams in protocol.xml, as there are none for orders. --- protocol/protocol.xml | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/protocol/protocol.xml b/protocol/protocol.xml index 7483610..d3f1bec 100644 --- a/protocol/protocol.xml +++ b/protocol/protocol.xml @@ -1408,10 +1408,6 @@ <longname></longname> <description></description> </string> - <descparameter ref="OrderParams" typefield="type"> - <name>extradata</name> - <longname>extra data for this parameter</longname> - </descparameter> </structure> </list> <integer type="unsigned" size="64"> -- 1.5.2.4
signature.asc
Description: OpenPGP digital signature
_______________________________________________ tp-devel mailing list [email protected] http://www.thousandparsec.net/tp/mailman.php/listinfo/tp-devel
