@@ -413,5 +413,48 @@ This is the Schema which defines the form of the dispatch map</Description>
413413</xs:schema>
414414]]> </Data >
415415</XData >
416+
417+ <Method name =" POtoStr" >
418+ <ClassMethod >1</ClassMethod >
419+ <FormalSpec >config</FormalSpec >
420+ <ProcedureBlock >0</ProcedureBlock >
421+ <ReturnType >%String</ReturnType >
422+ <Implementation ><![CDATA[
423+
424+ set str=""
425+
426+ //Redirect IO to the current routine - makes use of the labels defined below
427+ use $io::("^"_$ZNAME)
428+
429+ //Enable redirection
430+ do ##class(%Device).ReDirectIO(1)
431+
432+ do config.%ToJSON()
433+
434+ //Disable redirection
435+ do ##class(%Device).ReDirectIO(0)
436+
437+ quit str
438+
439+ //Labels that allow for IO redirection
440+ //Read Character - we don't care about reading
441+ rchr(c) quit
442+ //Read a string - we don't care about reading
443+ rstr(sz,to) quit
444+ //Write a character - call the output label
445+ wchr(s) do output($char(s)) quit
446+ //Write a form feed - call the output label
447+ wff() do output($char(12)) quit
448+ //Write a newline - call the output label
449+ wnl() do output($char(13,10)) quit
450+ //Write a string - call the output label
451+ wstr(s) do output(s) quit
452+ //Write a tab - call the output label
453+ wtab(s) do output($char(9)) quit
454+ //Output label - this is where you would handle what you actually want to do.
455+ // in our case, we want to write to myStream
456+ output(s) set str=str_s quit
457+ ]]> </Implementation >
458+ </Method >
416459</Class >
417460</Export >
0 commit comments