Skip to content

Commit d4edfa0

Browse files
committed
Fixed compilation issue with non up-to-date JSON library
1 parent b0fa87d commit d4edfa0

File tree

4 files changed

+187
-8
lines changed

4 files changed

+187
-8
lines changed

CJ-client-safe.ecf

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
</option>
1212
<setting name="concurrency" value="thread"/>
1313
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
14-
<library name="cj" location="..\CJ\library\cj-safe.ecf"/>
14+
<library name="cj" location="lib\CJ\library\cj-safe.ecf"/>
1515
<library name="docking" location="$ISE_LIBRARY\library\docking\docking-safe.ecf"/>
16-
<library name="encoder" location="..\..\EWF\library\text\encoder\encoder-safe.ecf"/>
17-
<library name="http_client" location="..\..\EWF\library\network\http_client\http_client-safe.ecf"/>
18-
<library name="json" location="..\..\EWF\contrib\library\text\parser\json\library\json-safe.ecf"/>
16+
<library name="encoder" location="lib\EWF\library\text\encoder\encoder-safe.ecf"/>
17+
<library name="http_client" location="lib\EWF\library\network\http_client\http_client-safe.ecf"/>
18+
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf"/>
1919
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
2020
<library name="vision2" location="$ISE_LIBRARY\library\vision2\vision2-safe.ecf"/>
2121
<cluster name="src" location=".\src\" recursive="true"/>
22+
<override name="override" location="./override\" recursive="true"/>
2223
</target>
2324
</system>

CJ-client.ecf

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
</option>
1212
<setting name="concurrency" value="thread"/>
1313
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
14-
<library name="cj" location="..\CJ\library\cj.ecf"/>
14+
<library name="cj" location="lib\CJ\library\cj.ecf"/>
1515
<library name="docking" location="$ISE_LIBRARY\library\docking\docking.ecf"/>
16-
<library name="encoder" location="..\..\EWF\library\text\encoder\encoder.ecf"/>
17-
<library name="http_client" location="..\..\EWF\library\network\http_client\http_client.ecf"/>
18-
<library name="json" location="$ISE_LIBRARY/library/json.ecf/json.ecf.ecf"/>
16+
<library name="encoder" location="lib\EWF\library\text\encoder\encoder.ecf"/>
17+
<library name="http_client" location="lib\EWF\library\network\http_client\http_client.ecf"/>
18+
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf"/>
1919
<library name="thread" location="$ISE_LIBRARY/library/thread/thread.ecf"/>
2020
<library name="vision2" location="$ISE_LIBRARY\library\vision2\vision2.ecf"/>
2121
<cluster name="src" location="./src" recursive="true"/>

override/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This class should be included in recent version of the lib json
2+
but this is not yet in 7.2
3+
so let's use an override cluster

override/json_pretty_string_visitor.e

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
note
2+
description: "JSON_PRETTY_STRING_VISITOR Generates the JSON-String for a JSON_VALUE"
3+
revision: "0.1"
4+
5+
class
6+
JSON_PRETTY_STRING_VISITOR
7+
8+
inherit
9+
JSON_VISITOR
10+
11+
create
12+
make,
13+
make_custom
14+
15+
feature -- Initialization
16+
17+
make (a_output: like output)
18+
-- Create a new instance
19+
do
20+
make_custom (a_output, 1, 1)
21+
end
22+
23+
make_custom (a_output: like output; a_object_count_inlining, a_array_count_inlining: INTEGER)
24+
-- Create a new instance
25+
do
26+
output := a_output
27+
create indentation.make_empty
28+
indentation_step := "%T"
29+
30+
object_count_inlining := a_object_count_inlining
31+
array_count_inlining := a_array_count_inlining
32+
end
33+
34+
feature -- Access
35+
36+
output: STRING_32
37+
-- JSON representation
38+
39+
indentation: like output
40+
41+
indentation_step: like indentation
42+
43+
line_number: INTEGER
44+
45+
indent
46+
do
47+
indentation.append (indentation_step)
48+
end
49+
50+
exdent
51+
do
52+
indentation.remove_tail (indentation_step.count)
53+
end
54+
55+
new_line
56+
do
57+
output.append ("%N")
58+
output.append (indentation)
59+
line_number := line_number + 1
60+
end
61+
62+
object_count_inlining: INTEGER
63+
array_count_inlining: INTEGER
64+
65+
feature -- Visitor Pattern
66+
67+
visit_json_array (a_json_array: JSON_ARRAY)
68+
-- Visit `a_json_array'.
69+
local
70+
value: JSON_VALUE
71+
l_json_array: ARRAYED_LIST [JSON_VALUE]
72+
l_line: like line_number
73+
l_multiple_lines: BOOLEAN
74+
do
75+
l_json_array := a_json_array.array_representation
76+
l_multiple_lines := l_json_array.count >= array_count_inlining or across l_json_array as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
77+
output.append ("[")
78+
l_line := line_number
79+
indent
80+
from
81+
l_json_array.start
82+
until
83+
l_json_array.off
84+
loop
85+
if
86+
line_number > l_line or
87+
l_multiple_lines
88+
then
89+
new_line
90+
end
91+
value := l_json_array.item
92+
value.accept (Current)
93+
l_json_array.forth
94+
if not l_json_array.after then
95+
output.append (", ")
96+
end
97+
end
98+
exdent
99+
if
100+
line_number > l_line or
101+
l_json_array.count >= array_count_inlining
102+
then
103+
new_line
104+
end
105+
output.append ("]")
106+
end
107+
108+
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
109+
-- Visit `a_json_boolean'.
110+
do
111+
output.append (a_json_boolean.item.out)
112+
end
113+
114+
visit_json_null (a_json_null: JSON_NULL)
115+
-- Visit `a_json_null'.
116+
do
117+
output.append ("null")
118+
end
119+
120+
visit_json_number (a_json_number: JSON_NUMBER)
121+
-- Visit `a_json_number'.
122+
do
123+
output.append (a_json_number.item)
124+
end
125+
126+
visit_json_object (a_json_object: JSON_OBJECT)
127+
-- Visit `a_json_object'.
128+
local
129+
l_pairs: HASH_TABLE [JSON_VALUE, JSON_STRING]
130+
l_line: like line_number
131+
l_multiple_lines: BOOLEAN
132+
do
133+
l_pairs := a_json_object.map_representation
134+
l_multiple_lines := l_pairs.count >= object_count_inlining or across l_pairs as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
135+
output.append ("{")
136+
l_line := line_number
137+
indent
138+
from
139+
l_pairs.start
140+
until
141+
l_pairs.off
142+
loop
143+
if
144+
line_number > l_line or
145+
l_multiple_lines
146+
then
147+
new_line
148+
end
149+
l_pairs.key_for_iteration.accept (Current)
150+
output.append (": ")
151+
l_pairs.item_for_iteration.accept (Current)
152+
l_pairs.forth
153+
if not l_pairs.after then
154+
output.append (", ")
155+
end
156+
end
157+
exdent
158+
if
159+
line_number > l_line or
160+
l_pairs.count >= object_count_inlining
161+
then
162+
new_line
163+
end
164+
output.append ("}")
165+
end
166+
167+
visit_json_string (a_json_string: JSON_STRING)
168+
-- Visit `a_json_string'.
169+
do
170+
output.append ("%"")
171+
output.append (a_json_string.item)
172+
output.append ("%"")
173+
end
174+
175+
end

0 commit comments

Comments
 (0)