You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ToolkitApi/ToolkitPCML.php
+82-71Lines changed: 82 additions & 71 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
<?php
2
2
namespaceToolkitApi;
3
3
4
-
useToolkitApi\ToolkitService;
5
4
useToolkitApi\ProgramParameter;
6
5
7
6
/*
@@ -18,21 +17,52 @@ class ToolkitPcml
18
17
// @todo a single array of countref names is OK for now, but won't jibe with official PCML logic of infinite hierarchical references.. To find the ref, we'd have to look at current section and work outward. Too much trouble. What we have here will work most of the time.
19
18
protected$_countRefNames = array(); // names of countRef fields (fields containing counts to return from programs)
20
19
protected$_countersAndCounted = array(); // 'CarCount' => 'Cars'. counter also used as label.
21
-
20
+
21
+
// array of simple types, PCML to XMLSERVICE toolkit, with sprintf-style percent formatting.
22
+
protected$_pcmlTypeMap = array('char' => "%sa",
23
+
'packed' => "%sp%s",
24
+
'float' => "4f", // 4-byte float
25
+
'struct' => "ds", // data structure
26
+
// omit INT from type map because we'll need program logic to determine if short or regular int.
27
+
// 'short' => "5i0", // int16, 2 bytes
28
+
// 'int' => "10i0", // int32, 4 bytes
29
+
'zoned' => "%ss%s", // e.g. 5s2
30
+
'byte' => "%sb", // binary (hex)
31
+
'hole' => "%sh", // not a PCML type but XMLSERVICE can handle it, so let's be prepared.
32
+
);
33
+
34
+
// PCML usage mapping
35
+
protected$_pcmlInoutMap = array('input' => 'in',
36
+
'output' => 'out',
37
+
'inputoutput' => 'both',
38
+
// inherit means inherit from parent element, and if no parent element, do INOUT.
39
+
// @todo implement "inherit" more precisely, checking parent element's usage.
@@ -374,52 +403,29 @@ public function singlePcmlToParam(\SimpleXmlElement $dataElement)
374
403
// @todo I think simply add 'counterLabel' and 'countedLabel'.
375
404
// count
376
405
$newCount = 0; // initialize
377
-
$countRef = '';
378
406
// @todo deal with this. Really need a better way to find the counter data elements.
379
407
// Allow a countref, too, in PCML??? Maybe! Count will be the dim (max) and countref is the actual name.
380
408
// Some customers have done it wrong. Instead of specifying a field as count, gave max count.
381
409
// "count can be a number where number defines a fixed, never-changing number of elements in a sized array.
382
-
// OR a data-name where data-name defines the name of a <data> element within the PCML document that will contain, at runtime, the number of elements in the array. The data-name specified can be a fully qualified name or a name that is relative to the current element. In either case, the name must reference a <data> element that is defined with type="int". See Resolving Relative Names for more information about how relative names are resolved.
383
-
// about finding the element: http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzahh%2Flengthprecisionrelative.htm
410
+
// OR a data-name where data-name defines the name of a <data> element within the PCML document that will contain, at runtime, the number of elements in the array. The data-name specified can be a fully qualified name or a name that is relative to the current element. In either case, the name must reference a <data> element that is defined with type="int". See Resolving Relative Names for more information about how relative names are resolved.
411
+
// about finding the element: http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzahh%2Flengthprecisionrelative.htm
384
412
// Names are resolved by seeing if the name can be resolved as a child or descendent of the tag containing the current tag. If the name cannot be resolved at this level, the search continues with the next highest containing tag. This resolution must eventually result in a match of a tag that is contained by either the <pcml> tag or the <rfml> tag, in which case the name is considered to be an absolute name, not a relative name.""
385
-
// Let's simply use $countersAndCounted. If necessary, pre-process PCML to create $countersAndCounted.
413
+
// Let's simply use $countersAndCounted. If necessary, pre-process PCML to create $countersAndCounted.
0 commit comments