11<?php
22namespace ToolkitApi ;
33
4- use ToolkitApi \ ProgramParameter ;
4+
55
66/**
77 * Functionality for parsing PCML
@@ -104,10 +104,6 @@ public function __construct($pcml, ToolkitService $connection, $countersAndCount
104104 throw new \Exception ("PCML file must contain program tag " );
105105 }
106106
107- $ programNode = $ pcmlObj ->program ;
108-
109- $ pgmAttrs = $ programNode ->attributes ();
110-
111107 /**
112108 * sample:
113109 * <program name="name"
@@ -120,30 +116,11 @@ public function __construct($pcml, ToolkitService $connection, $countersAndCount
120116 * </program>
121117 */
122118
123- // let's focus on name, path, and entrypoint, the only attributes likely to be used here.
124- $ givenPgmName = (isset ($ pgmAttrs ['name ' ])) ? $ pgmAttrs ['name ' ] : '' ; // ignored!
125- $ path = (isset ($ pgmAttrs ['path ' ])) ? $ pgmAttrs ['path ' ] : '' ;
126- $ entrypoint = (isset ($ pgmAttrs ['entrypoint ' ])) ? $ pgmAttrs ['entrypoint ' ] : '' ;
127-
128- // Note: if entrypoint is supplied, it's the function in a service program. "name" will be the same as entrypoint.
129- // if entrypoint is not supplied, name is the actual program name.
130- // Therefore, "name" seems somewhat worthless.
131-
132- // break up path, separated now by slashes. can be varied lib and pgm.
133- // remove the /qsys.lib that may be in front but only if it's simply qualifying another library. qsys may be the actual program library, too.
134-
135- $ objArray = $ this ->splitPcmlProgramPath ($ path );
136-
137- $ pgmLib = ($ objArray ['lib ' ]) ? $ objArray ['lib ' ] : '' ;
138- $ pgmName = $ objArray ['obj ' ];
139- $ pgmProcedure = ($ entrypoint ) ? $ entrypoint : '' ; // optional procedure (aka function)
140-
141119 // Now create data description array.
142120 // @todo create separate method to convert PCML to param array.
143121 $ dataDescriptionArray = $ this ->pcmlToArray ($ xmlObj );
144122
145123 //Change the encoding back to the one wanted by the user, since SimpleXML encodes its output always in UTF-8
146- $ pgmName = mb_convert_encoding ($ pgmName , $ encoding , 'UTF-8 ' );
147124 mb_convert_variables ($ encoding , 'UTF-8 ' , $ dataDescriptionArray );
148125
149126 $ this ->_description = $ dataDescriptionArray ;
@@ -353,8 +330,6 @@ public function singlePcmlToParam(\SimpleXmlElement $dataElement)
353330 $ passBy = 'val ' ; // rare. PCML calls it 'value'. XMLSERVICE calls it 'val'.
354331 }
355332
356- $ newtype = '' ;
357-
358333 // find new toolkit equivalent of PCML data type
359334 if (isset ($ this ->_pcmlTypeMap [$ type ])) {
360335 // a simple type mapping
@@ -378,24 +353,12 @@ public function singlePcmlToParam(\SimpleXmlElement $dataElement)
378353 // well, it's already handled by toolkit....try and see, though.
379354 // poss. eliminate extra object levels, at least?
380355
381- // @todo (I think I did it!) handle this better. Use 'dim'.
382- // See if Count can replace $dim as I did.
383- // if $dim, it's an array. Otherwise a single value.
384356 if ($ count > 1 ) {
385- // array of dummy values, dimension of $dim
386- // @todo: should be able to use a single ProgramParameter object with the 'dim' value set.
387- // Or try to fix into a DS mold.
388- // $dataValue = array_fill(0, $count, '');
389357 $ isArray = true ;
390358 } else {
391359 // no need for any dummy value.Could be 'init' from above, or leave the default.
392- // $dataValue = '';
393360 $ isArray = false ;
394- // and leave $dim alone to flow into the ProgramParmeter below.
395361 }
396-
397- // done with $dim. PHP wrapper handles dim differently.
398- $ dim = 0 ;
399362 }
400363
401364 // @todo I think simply add 'counterLabel' and 'countedLabel'.
@@ -440,10 +403,10 @@ public function singlePcmlToParam(\SimpleXmlElement $dataElement)
440403 /**
441404 * given an XML object containing a PCML program definition, return an old toolkit style of data description array.
442405 *
443- * @param SimpleXMLElement $xmlObj
406+ * @param \ SimpleXMLElement $xmlObj
444407 * @return array
445408 */
446- public function pcmlToArray (SimpleXMLElement $ xmlObj )
409+ public function pcmlToArray (\ SimpleXMLElement $ xmlObj )
447410 {
448411 $ dataDescription = array ();
449412
0 commit comments