Beamline Instrument Software Support |
|
SPEC Macro documentation:
[ Macro Index |
BCU Home ]
|
XML_utils.mac | ||||||
[ source code | installed at | configured at ] | ||||||
See other macros in category: All | ||||||
Description:
| ||||||
Documentation:
To do global XML_tmp[] global _XML_lp DEPENDENCIES | ||||||
Macros:
Usage: setHwrHost [host hwr] defines the host (host) and hardware repository server name (hwr) managing the hardware repository xml files xml_view Usage: xml_view (hw_obj) dumps an XML object situated from the Hardware Repository Location xml object can be on the form: xxx xxx/xx ... with possibly the path from the Hardware Repository Location ex: xml_view("pslit") ACCESS TO XML file xml_read Usage: xml_read (hw_obj,level,[key]) reading a hardware object, with a level access,(and possibly a key), sets the global associative array XML_tmp. If no key is provided: reurns a 2 dim assocoative array ex: xml_read("pslit","/*/*/blades/device") XML_tmp["0"]["role"] = "vo" XML_tmp["1"]["role"] = "vg" XML_tmp["2"]["role"] = "ho" XML_tmp["3"]["role"] = "hg" XML_tmp["0"]["hwrid"] = "/motors/psvo" XML_tmp["1"]["hwrid"] = "/motors/psvg" XML_tmp["2"]["hwrid"] = "/motors/psho" XML_tmp["3"]["hwrid"] = "/motors/pshg" XML_tmp["0"]["__path__"] = "/equipment[1]/motors[1]/blades[1]/device[1]" XML_tmp["1"]["__path__"] = "/equipment[1]/motors[1]/blades[1]/device[2]" XML_tmp["2"]["__path__"] = "/equipment[1]/motors[1]/blades[1]/device[3]" XML_tmp["3"]["__path__"] = "/equipment[1]/motors[1]/blades[1]/device[4]" XML_tmp["0"]["__value__"] = "" XML_tmp["1"]["__value__"] = "" XML_tmp["2"]["__value__"] = "" XML_tmp["3"]["__value__"] = "" XML_tmp["0"]["__children__"] = "" XML_tmp["1"]["__children__"] = "" XML_tmp["2"]["__children__"] = "" XML_tmp["3"]["__children__"] = "" if a key is provided: provides a one key associative array ex: xml_read("pslit","/*/*/blades/device","role") XML_tmp["0"] = "vo" XML_tmp["1"] = "vg" XML_tmp["2"] = "ho" XML_tmp["3"] = "hg" .... returns 0 if OK returns -1 if NOT OK, in that case XML_tmp["__error__"] contains error message. ACCESS TO XML file xml_readRoles Usage: xml_readRoles (hw_obj) From an hardware object, set the global XML_tmp associative array, first indexed by the roles This is a quick way to get an information without giving the path to it. ex: xml_readroles("pslit") returns 0 if OK, and: XML_tmp will have: XML_tmp["down"]["__children__"] = "" XML_tmp["down"]["__path__"] = "/equipment[1]/motors[1]/slits[1]/device[2]" XML_tmp["down"]["__value__"] = "" XML_tmp["down"]["hwrid"] = "/demo/psd" XML_tmp["down"]["role"] = "down" XML_tmp["hg"]["__children__"] = "" XML_tmp["hg"]["__path__"] = "/equipment[1]/motors[1]/blades[1]/device[4]" XML_tmp["hg"]["__value__"] = "" XML_tmp["hg"]["hwrid"] = "/demo/pshg" XML_tmp["hg"]["role"] = "hg" .... returns -1 if NOT OK and: XML_tmp["__error__"] = "an error string" ACCESS TO XML file xml_readProperties Usage: xml_readProperties (hw_obj) From an hardware object, set the global XML_tmp associative array, first indexed by the properties This is a quick way to get an information without giving the path to it. ex: xml_readProperties("motors/mydac0") returns 0 if OK, and: XML_tmp["dev"]["__path__"] = "/device[1]/dev[1]" XML_tmp["dev"]["__value__"] = "id/icvdac/0" XML_tmp["maxstep"]["__path__"] = "/device[1]/maxstep[1]" XML_tmp["maxstep"]["__value__"] = 3 XML_tmp["reading"]["__path__"] = "/device[1]/reading[1]" XML_tmp["reading"]["__value__"] = 1 XML_tmp["stepsize"]["__path__"] = "/device[1]/stepsize[1]" XML_tmp["stepsize"]["__value__"] = 0.2 .... returns -1 if NOT OK, and: XML_tmp["__error__"] = "an error string" ACCESS TO XML file xml_setDebug Usage: xml_setDebug (db) set debug on (0) or off (1) ass_copy Usage: ass_copy (aa,bb) makes a copy of array aa to bb | ||||||
Internal Macros: | ||||||
Usage: xml_readMotorsByRoles(ho) xml_cache_write Usage: xml_cache_write(hw_obj, path, value) xml_do_write Usage: xml_do_write() xml_debug Usage: xml_debug <list> if debug is set, writes <list> asso_len Usage: asso_len <arr> arr being a 2 dimension associative array with numerical first key, this function return its length. asso_keys Usage: asso_keys <arr> arr being a 2 dimension associative array. | ||||||
|