Diff of /trunk/json/json-pac/Functions/JSON_TO_STRUCT/Value/svnobj [r6] .. [r7]  Maximize  Restore

Switch to unified view

a/trunk/json/json-pac/Functions/JSON_TO_STRUCT/Value/svnobj b/trunk/json/json-pac/Functions/JSON_TO_STRUCT/Value/svnobj
1
Gx_lù!0…jüo’jOPA‡Šl+System.StringL{f8a58466-d7f6-439f-bbb8-d4600e41d099}ImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocumentL{f3878285-8e4f-490b-bb1b-9acbb7eb04db}TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}    Id
1
Gx_lu#!0jüot”N=>ÙH¬ùüSystem.StringL{f8a58466-d7f6-439f-bbb8-d4600e41d099}ImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocumentL{f3878285-8e4f-490b-bb1b-9acbb7eb04db}TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}    Id
2
longTagText
Ò(*=======================================================================================================Value()ªfound a ":" character, possible next characters are any combination of the following:,{ begin another object&[ begin a new arrayH" or a number or letter: value found°after all { and [ are found, and if any were found, the next thing will be a name stringºloop through until a value is found, incrementing obj_level or array definitions as necessaryÔ========================================================================================================*)œbufferposition:= bufferposition + 1;   //start searching after the ":" character6FOR valueloop:= 1 TO 20 DO †//loop through the next 20 characters (maximum) looking for a valueH  CASE JSONString^[bufferposition] OF      ^ ASCII.OPEN_BRACE:// {, beginning of new object     OpenObject(); *    lookforname:= TRUE;    b ASCII.OPEN_BRACKET: // [, beginning of new array!    OpenArray();"
2
longTagText
Ò(*=======================================================================================================Value()ªfound a ":" character, possible next characters are any combination of the following:,{ begin another object&[ begin a new arrayH" or a number or letter: value found°after all { and [ are found, and if any were found, the next thing will be a name stringºloop through until a value is found, incrementing obj_level or array definitions as necessaryÔ========================================================================================================*)œbufferposition:= bufferposition + 1;   //start searching after the ":" character†//loop through the next 20 characters (maximum) looking for a valueTWHILE (bufferposition < JSONStringSize) DOH    CASE JSONString^[bufferposition] OF      0 ASCII.CR: // '$r', skipJ      bufferposition := bufferposition+1;      CONTINUE;0   ASCII.LF: // '$n', skip 4   ASCII.SPACE:   // ' ', skip!^ ASCII.OPEN_BRACE:// {, beginning of new object"     OpenObject(); #*    lookforname:= TRUE;$   %b ASCII.OPEN_BRACKET: // [, beginning of new array&    OpenArray();'
3
    ELSE#*    IF lookforname THEN$¤     //a new object or array was found, and all nested objects have already been looped through, therefore this buffer position must start a new name%î       //there is no value here, so exit this loop, main loop should now continue at the name, and parse its name:value pair&         EXIT;'      END_IF(x    IF (JSONString^[bufferposition] = ASCII.DOUBLE_QUOTE) THEN)l    //value starts with a quote character--quoted string*z       value_start:= bufferposition + 1; //value follows : and " +    ELSE,|       value_start:= bufferposition; //value immediately follows :-‚     FOR j:= value_start TO (value_start+GPL_JSON.MAX_VALUE_SIZE) DO.b         IF (JSONString^[j] = ASCII.DOUBLE_QUOTE)  THEN/d       //end of value is is found at the closing quote0.            value_stop:= j - 1;1°           bufferposition:= j + 1; //main loop can resume at the next character after the quote2          EXIT;3ü        ELSIF (JSONString^[j] = ASCII.COMMA) OR (JSONString^[j] = ASCII.CLOSE_BRACE) OR (JSONString^[j] = ASCII.CLOSE_BRACKET) THEN4Z         //end of value is is found at , or }, or ]5¨             bufferposition:= j; //main loop can resume at the next character after the value6       END_IF7l       IF (j = (value_start+GPL_JSON.MAX_VALUE_SIZE)) THEN8z         //no closing quote was found after MAXVALUESIZE characters9&          ErrorHandler();:      END_FOR ;2    //clear previous string<      SysMemSet(=X       pDest:= ADR(NameValue[obj_level].Value), >"         udiValue:= 0, ?`       udiCount:= SIZEOF(NameValue[obj_level].Value)@      );A`    //copy buffer to temporary value (string type)B    SysMemCpy(CR       pSrc:= ADR(JSONString^[value_start]), DV       udiCount:= (value_stop+1) - value_start E
3
    ELSE(*    IF lookforname THEN)¤     //a new object or array was found, and all nested objects have already been looped through, therefore this buffer position must start a new name*î       //there is no value here, so exit this loop, main loop should now continue at the name, and parse its name:value pair+         EXIT;,      END_IF-x    IF (JSONString^[bufferposition] = ASCII.DOUBLE_QUOTE) THEN.l    //value starts with a quote character--quoted string/x       value_start:= bufferposition + 1; //value follows : and "02         quotedstring := TRUE; 1    ELSE2|       value_start:= bufferposition; //value immediately follows :3‚     FOR j:= value_start TO (value_start+GPL_JSON.MAX_VALUE_SIZE) DO4&         IF skipnext THEN5,          skipnext := FALSE;6b       ELSIF (JSONString^[j] = ASCII.BACKSLASH)  THEN7P          // on backslash, escape the next one8*          skipnext := TRUE;9h         ELSIF (JSONString^[j] = ASCII.DOUBLE_QUOTE)  THEN:d         //end of value is is found at the closing quote;.            value_stop:= j - 1;<°           bufferposition:= j + 1; //main loop can resume at the next character after the quote=          EXIT;>ª        ELSIF ((JSONString^[j] = ASCII.COMMA) OR (JSONString^[j] = ASCII.CLOSE_BRACE) OR (JSONString^[j] = ASCII.CLOSE_BRACKET)) AND NOT quotedstring THEN?Z       //end of value is is found at , or }, or ]@¨             bufferposition:= j; //main loop can resume at the next character after the valueA       END_IFBl       IF (j = (value_start+GPL_JSON.MAX_VALUE_SIZE)) THENCz         //no closing quote was found after MAXVALUESIZE charactersD&          ErrorHandler();E      END_FOR F2    //clear previous stringG      SysMemSet(HX       pDest:= ADR(NameValue[obj_level].Value), I"         udiValue:= 0, J`       udiCount:= SIZEOF(NameValue[obj_level].Value)K      );L`    //copy buffer to temporary value (string type)M    SysMemCpy(NR       pSrc:= ADR(JSONString^[value_start]), OV       udiCount:= (value_stop+1) - value_start P
4
       );   Fà       findname:= TRUE;      //there is a name:value pair in the NameValue array, check for a match with a local variableG    EXIT;H   END_CASEIEND_FORJInterfaceKL{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}LMETHOD ValueMVARN& valueloop:      UDINT;O& lookforname:   BOOL;P   j:            UDINT;QEND_VARÐÐÐEEÐÐ  
4
       );   Qà       findname:= TRUE;      //there is a name:value pair in the NameValue array, check for a match with a local variableR    EXIT;S   END_CASETEND_WHILEUInterfaceVL{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}WMETHOD ValueXVARY& lookforname:   BOOL;Z   j:            UDINT;[" skipnext:    BOOL;\(   quotedstring: BOOL;]END_VARÐÐÐEUÐÐ    
5
­8ÚÐ-
ÐÐ  
5
­8ÚÐ-
ÐÐ  
6
­9ÚÐ-ÐÐ  
6
­9ÚÐ-ÐÐ  
7
­?ÚÐ-ÐÐ  
7
­?ÚÐ-ÐÐ  
8
­BÚÐ-ÐÐ  
8
­BÚÐ-ÐÐ  
9
­AÚÐ-ÐÐ  
9
­AÚÐ-ÐÐ  
...
...
11
­‰ÚÐ-ÐÐ  
11
­‰ÚÐ-ÐÐ  
12
­DÚÐ-ÐÐ  
12
­DÚÐ-ÐÐ  
13
­ˆÚÐ-ÐÐ  
13
­ˆÚÐ-ÐÐ  
14
­‡ÚÐ-ÐÐ  
14
­‡ÚÐ-ÐÐ  
15
­†ÚÐ-ÐÐ  
15
­†ÚÐ-ÐÐ  
16
­ÚÐ-ÐÐ  
16
­HÚÐ-ÐÐ  
17
­HÚÐ-ÐÐ  
17
­¥ÚÐ-ÐÐ  
18
­IÚÐ-ÐÐ  
18
­IÚÐ-ÐÐ  
19
­KÚÐ-ÐÐ  
19
­KÚÐ-ÐÐ  
20
­PÚÐ-ÐÐ  
20
­œÚÐ-ÐÐ  
21
­ŒÚÐ-ÐÐ  
21
­£ÚÐ-ÐÐ  
22
­¤ÚÐ-ÐÐ  
23
­ ÚÐ-ÐÐ  
24
­¡ÚÐ-ÐÐ  
25
­¢ÚÐ-ÐÐ  
26
­ŸÚÐ- ÐÐ  
27
­›ÚÐ-ÐÐ  
28
­™ÚÐ-ÐÐ  
29
­šÚÐ-ÐÐ  
30
­˜ÚÐ-!ÐÐ  
31
­ŒÚÐ-"ÐÐ  
22
­LÚÐ-ÐÐ  
32
­LÚÐ-#ÐÐ  
23
­QÚÐ-ÐÐ  
33
­QÚÐ-$ÐÐ  
24
­RÚÐ- ÐÐ  
34
­RÚÐ-%ÐÐ  
25
­ÚÐ-!ÐÐ  
35
­ÚÐ-&ÐÐ  
26
­MÚÐ-ÐÐ  
36
­MÚÐ-ÐÐ  
27
­ŽÚÐ-"ÐÐ  
37
­ŽÚÐ-'ÐÐ  
28
­’ÚÐ-#ÐÐ  
38
­’ÚÐ-(ÐÐ  
29
­”ÚÐ-$ÐÐ  
39
­”ÚÐ-)ÐÐ  
30
­ÚÐ-%ÐÐ  
40
­ÚÐ-*ÐÐ  
31
­ÚÐ-&ÐÐ  
41
­ÚÐ-+ÐÐ  
32
­‘ÚÐ-'ÐÐ  
42
­‘ÚÐ-,ÐÐ  
33
­SÚÐ-ÐÐ  
43
­SÚÐ-ÐÐ  
34
­YÚÐ-(ÐÐ  
44
­YÚÐ--ÐÐ  
35
­ZÚÐ-)ÐÐ  
45
­ZÚÐ-.ÐÐ  
36
­[ÚÐ-*ÐÐ  
46
­[ÚÐ-/ÐÐ  
47
­µÚÐ-0ÐÐ  
37
­\ÚÐ-+ÐÐ  
48
­\ÚÐ-1ÐÐ  
38
­]ÚÐ-,ÐÐ  
49
­]ÚÐ-2ÐÐ  
39
­^ÚÐ-'ÐÐ  
50
­^ÚÐ-,ÐÐ  
40
­_ÚÐ--ÐÐ  
51
­_ÚÐ-3ÐÐ  
41
­`ÚÐ-.ÐÐ  
52
­´ÚÐ-4ÐÐ  
53
­²ÚÐ-5ÐÐ  
54
­¦ÚÐ-6ÐÐ  
42
­aÚÐ-/ÐÐ  
55
­³ÚÐ-7ÐÐ  
43
­bÚÐ-0ÐÐ  
56
­°ÚÐ-8ÐÐ  
44
­cÚÐ-1ÐÐ  
57
­¸ÚÐ-9ÐÐ  
45
­dÚÐ-2ÐÐ  
58
­¬ÚÐ-:ÐÐ  
59
­­ÚÐ-;ÐÐ  
60
­®ÚÐ-<ÐÐ  
61
­¯ÚÐ-=ÐÐ  
46
­eÚÐ-3ÐÐ  
62
­eÚÐ->ÐÐ  
47
­fÚÐ-4ÐÐ  
63
­fÚÐ-?ÐÐ  
48
­gÚÐ-0ÐÐ  
64
­gÚÐ-;ÐÐ  
49
­hÚÐ-5ÐÐ  
65
­hÚÐ-@ÐÐ  
50
­iÚÐ-2ÐÐ  
66
­iÚÐ-=ÐÐ  
51
­jÚÐ-6ÐÐ  
67
­jÚÐ-AÐÐ  
52
­kÚÐ-7ÐÐ  
68
­kÚÐ-BÐÐ  
53
­lÚÐ-8ÐÐ  
69
­lÚÐ-CÐÐ  
54
­pÚÐ-9ÐÐ  
70
­pÚÐ-DÐÐ  
55
­qÚÐ-6ÐÐ  
71
­qÚÐ-AÐÐ  
56
­rÚÐ-:ÐÐ  
72
­rÚÐ-EÐÐ  
57
­sÚÐ-ÐÐ  
73
­sÚÐ-ÐÐ  
58
­tÚÐ-;ÐÐ  
74
­tÚÐ-FÐÐ  
59
­uÚÐ-<ÐÐ  
75
­uÚÐ-GÐÐ  
60
­vÚÐ-=ÐÐ  
76
­vÚÐ-HÐÐ  
61
­wÚÐ->ÐÐ  
77
­wÚÐ-IÐÐ  
62
­xÚÐ-?ÐÐ  
78
­xÚÐ-JÐÐ  
63
­yÚÐ-@ÐÐ  
79
­yÚÐ-KÐÐ  
64
­zÚÐ-AÐÐ  
80
­zÚÐ-LÐÐ  
65
­{ÚÐ-BÐÐ  
81
­{ÚÐ-MÐÐ  
66
­|ÚÐ-=ÐÐ  
82
­|ÚÐ-HÐÐ  
67
­}ÚÐ-CÐÐ  
83
­}ÚÐ-NÐÐ  
68
­~ÚÐ-DÐÐ  
84
­~ÚÐ-OÐÐ  
69
­ÚÐ-EÐÐ  
85
­ÚÐ-PÐÐ  
70
­€ÚÐ-FÐÐ  
86
­€ÚÐ-QÐÐ  
71
­TÚÐ-GÐÐ  
87
­TÚÐ-RÐÐ  
72
­‚ÚÐ-HÐÐ  
88
­‚ÚÐ-SÐÐ  
73
­ÚÐ-IÐJKÐEÐÐ    
89
­ÚÐ-TÐUVÐEÐÐ    
74
­ÚÐ-LÐÐ  
90
­ÚÐ-WÐÐ  
75
­ƒÚÐ-MÐÐ  
91
­ƒÚÐ-XÐÐ  
92
­–ÚÐ-YÐÐ  
76
­ÚÐ-NÐÐ  
93
­ÚÐ-ZÐÐ  
77
­ÚÐ-OÐÐ  
94
­±ÚÐ-[ÐÐ  
78
­ÚÐ-PÐÐ  
95
­ÚÐ-\ÐÐ  
79
­ÚÐ-QÐÐ  
96
­ÚÐ-]ÐÐ  
80
­ÚÐ-
97
­ÚÐ-