PureBoard http://forums.purebasic.com/german/ |
|
debug Structure http://forums.purebasic.com/german/viewtopic.php?f=16&t=31809 |
Seite 1 von 1 |
Autor: | marcelx [ 11.01.2020 21:31 ] |
Betreff des Beitrags: | debug Structure |
Hallo, wie kann ich Daten mit structure ausgeben ohne einzelnen zu ausgeben per Debug? Code: Structure _pos x.i y.i EndStructure Structure _dimension w.i h.i EndStructure Structure _list name.s pos.i EndStructure Structure _specifications List._list pos._pos dimension._dimension name.s EndStructure NewList specifications._specifications() AddElement(specifications()) With specifications() \name = "Test" \pos\x = 10 \pos\y = 20 \dimension\h = 15 \dimension\w = 25 \list\name = "Test list" \list\pos = 1 EndWith Debug specifications() ??? Gruss MarcelX |
Autor: | STARGÅTE [ 11.01.2020 21:38 ] |
Betreff des Beitrags: | Re: debug Structure |
z.B. mit JSON, die Hilfe zeigt hier sogar ein Beispiel wie du es hast: https://www.purebasic.com/documentation/json/insertjsonstructure.html |
Autor: | #NULL [ 11.01.2020 21:41 ] |
Betreff des Beitrags: | Re: debug Structure |
Code: json = CreateJSON(#PB_Any)
InsertJSONList(JSONValue(json), specifications()) Debug ComposeJSON(json, #PB_JSON_PrettyPrint) FreeJSON(json) |
Autor: | marcelx [ 11.01.2020 21:45 ] |
Betreff des Beitrags: | Re: debug Structure |
Wunderbar - danke STARGÅTE das war eine schnelle Antwort Code: If CreateJSON(0)
InsertJSONStructure(JSONValue(0), @specifications(), _specifications) Debug ComposeJSON(0, #PB_JSON_PrettyPrint) EndIf |
Autor: | marcelx [ 11.01.2020 22:42 ] |
Betreff des Beitrags: | Re: debug Structure |
wie kann ich eine Structure an eine Procedure übergeben? Ich möchte mit eine allgemeine Procedure strukturierten Daten anzeigen: Code: Procedure debugStr(*adr, str) Debug "----------------------" If CreateJSON(0) InsertJSONStructure(JSONValue(0), *adr, str) Debug ComposeJSON(0, #PB_JSON_PrettyPrint) EndIf Debug "----------------------" EndProcedure debugStr(@specifications(), _specifications) So funktioniert nicht. EDIT: so funktioniert - ich hatte _specifications in Hochkomma gesetzt und geht auch nicht |
Autor: | mk-soft [ 12.01.2020 04:17 ] |
Betreff des Beitrags: | Re: debug Structure |
Das geht leider nicht, da die Strukturen zur Compilerzeit aufgelöst werden. Mit Macros kann man einiges lösen. Code: Structure sFoo
iVal.i sVal.s List ListVal.i() EndStructure Macro debugStr(adr, str) Debug "----------------------" If CreateJSON(0) InsertJSONStructure(JSONValue(0), adr, str) Debug ComposeJSON(0, #PB_JSON_PrettyPrint) EndIf Debug "----------------------" EndMacro data1.sfoo debugStr(data1, sfoo) |
Autor: | marcelx [ 12.01.2020 11:07 ] |
Betreff des Beitrags: | Re: debug Structure |
Danke mk-soft für die Erläuterung der Hintergrund. Daran habe ich nicht gedacht. |
Seite 1 von 1 | Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |