1 | # -*- coding: utf-8 -*-
|
---|
2 | #
|
---|
3 | # TECS Generator
|
---|
4 | # Generator for TOPPERS Embedded Component System
|
---|
5 | #
|
---|
6 | # Copyright (C) 2008-2014 by TOPPERS Project
|
---|
7 | #--
|
---|
8 | # ä¸è¨èä½æ¨©è
|
---|
9 | ã¯ï¼ä»¥ä¸ã®(1)ï½(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
10 | # ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
11 | # å¤ã»åé
|
---|
12 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
13 | # (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
14 | # 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
15 | # ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
16 | # (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
17 | # ç¨ã§ããå½¢ã§åé
|
---|
18 | å¸ããå ´åã«ã¯ï¼åé
|
---|
19 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
20 | # è
|
---|
21 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
22 | # ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
23 | # (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
24 | # ç¨ã§ããªãå½¢ã§åé
|
---|
25 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
26 | # ã¨ï¼
|
---|
27 | # (a) åé
|
---|
28 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
29 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
30 | # ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
31 | # (b) åé
|
---|
32 | å¸ã®å½¢æ
|
---|
33 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
34 | # å ±åãããã¨ï¼
|
---|
35 | # (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
36 | # 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
37 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
38 | 責ãããã¨ï¼
|
---|
39 | # ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
40 | # ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
41 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
42 | # å
|
---|
43 | 責ãããã¨ï¼
|
---|
44 | #
|
---|
45 | # æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
46 | ã
|
---|
47 | # ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
48 | # ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
49 | # ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
50 | # ã®è²¬ä»»ãè² ããªãï¼
|
---|
51 | #
|
---|
52 | # $Id: GenParamCopy.rb 1011 2016-07-11 02:20:01Z coas-nagasima $
|
---|
53 | #++
|
---|
54 |
|
---|
55 | #= ParamCopy
|
---|
56 | #
|
---|
57 | # ãã©ã¡ã¼ã¿ã³ãã¼ãããã¼ã·ã£ã©ï¼ã¢ã³ãã¼ã·ã£ã©ã³ã¼ããçæããã¡ã½ãã print_param ãæä¾ããï¼
|
---|
58 | # RPCPlugin, OpaqueRPCPlugin ã« include ãããï¼
|
---|
59 | # RPCPlugin (ãã©ã³ã¹ãã¢ã¬ã³ã) ã§ã¯ãoneway é¢æ°ã§ in ã®ãã¤ã³ã¿å¼æ°ã®å ´åã«éã£ã¦ print_param ãç¨ããããï¼
|
---|
60 | #
|
---|
61 | module GenParamCopy
|
---|
62 |
|
---|
63 | #=== å¼æ°ã®è»¢éã³ã¼ããçæ
|
---|
64 |
|
---|
65 | def print_param( name, type, file, nest, dir, outer, outer2, b_marshal, b_get, alloc_cp = nil, alloc_cp_extra = nil, name_list = nil )
|
---|
66 | if type.get_original_type.kind_of?( ArrayType ) && b_get && dir != :OUT then
|
---|
67 | indent = " " * nest
|
---|
68 | subsc = type.get_subscript
|
---|
69 | if subsc == nil
|
---|
70 | raise "Unsubscripted Array Not Supported"
|
---|
71 | else
|
---|
72 | size_str = subsc.to_str( name_list, outer, outer2 )
|
---|
73 | file.print <<EOT
|
---|
74 | #{indent}if((ercd_=#{alloc_cp}(sizeof(#{type.get_type.get_type_str}#{type.get_type.get_type_str_post})*(#{size_str}),(void **)&#{outer}#{name}#{outer2}#{alloc_cp_extra}))!=E_OK)\t/* GenParamCopy 1 */
|
---|
75 | #{indent} goto error_reset;
|
---|
76 | EOT
|
---|
77 | if ( dir == :SEND || dir == :RECEIVE ) && type.get_type.has_pointer? then
|
---|
78 | # send, receive ã®å ´åã¯ãã¨ã©ã¼ãªã»ããã«åã NULL ã«ãã
|
---|
79 | file.print <<EOT
|
---|
80 | #{indent}memset( (void *)#{outer}#{name}#{outer2}#{alloc_cp_extra}, 0, sizeof(#{type.get_type.get_type_str}#{type.get_type.get_type_str_post})*(#{size_str}); /* GenParamCopy Alloc1 */
|
---|
81 | EOT
|
---|
82 | end
|
---|
83 | end
|
---|
84 | end
|
---|
85 | print_param0( name, type, file, nest, dir, outer, outer2, b_marshal, b_get, alloc_cp, alloc_cp_extra, name_list )
|
---|
86 | end
|
---|
87 |
|
---|
88 | def print_param0( name, type, file, nest, dir, outer, outer2, b_marshal, b_get, alloc_cp = nil, alloc_cp_extra = nil, name_list = nil )
|
---|
89 | indent = " " * nest
|
---|
90 |
|
---|
91 | case type
|
---|
92 | when DefinedType
|
---|
93 | print_param0( name, type.get_type, file, nest, dir, outer, outer2, b_marshal, b_get, alloc_cp, alloc_cp_extra )
|
---|
94 | when BoolType, IntType, FloatType
|
---|
95 | case type
|
---|
96 | when BoolType
|
---|
97 | type_str = "Bool"
|
---|
98 | when IntType
|
---|
99 | bit_size = type.get_bit_size
|
---|
100 | case type.get_sign
|
---|
101 | when :UNSIGNED
|
---|
102 | sign = "U"
|
---|
103 | when :SIGNED
|
---|
104 | if bit_size == -1 || bit_size == -11 then
|
---|
105 | sign = "S" # signed char ã®å ´åã®ã¿ S ãã¤ã
|
---|
106 | else
|
---|
107 | sign = ""
|
---|
108 | end
|
---|
109 | else
|
---|
110 | sign = ""
|
---|
111 | end
|
---|
112 |
|
---|
113 | case bit_size
|
---|
114 | when -1, -11 # -1: char_t, -11: char
|
---|
115 | type_str = "#{sign}Char"
|
---|
116 | when -2
|
---|
117 | type_str = "#{sign}Short"
|
---|
118 | when -3
|
---|
119 | type_str = "#{sign}Int"
|
---|
120 | when -4
|
---|
121 | type_str = "#{sign}Long"
|
---|
122 | when -5
|
---|
123 | type_str = "Intptr"
|
---|
124 | when 8, 16, 32, 64, 128
|
---|
125 | type_str = "#{sign}Int#{bit_size}"
|
---|
126 | else
|
---|
127 | raise "unknown bit_size '#{bit_size}' for int type "
|
---|
128 | end
|
---|
129 |
|
---|
130 | when FloatType
|
---|
131 | bit_size = type.get_bit_size
|
---|
132 | if bit_size == 32 then
|
---|
133 | type_str = "Float32"
|
---|
134 | else
|
---|
135 | type_str = "Double64"
|
---|
136 | end
|
---|
137 |
|
---|
138 | end
|
---|
139 |
|
---|
140 | if( b_get )then
|
---|
141 | file.print indent
|
---|
142 | file.print "if( ( ercd_ = cTDR_get#{type_str}( &(#{outer}#{name}#{outer2}) ) ) != E_OK )\t/* GenParamCopy 2 */\n"
|
---|
143 | file.print indent
|
---|
144 | file.print " goto error_reset;\n"
|
---|
145 | else
|
---|
146 | file.print indent
|
---|
147 | file.print "if( ( ercd_ = cTDR_put#{type_str}( #{outer}#{name}#{outer2} ) ) != E_OK )\t/* GenParamCopy 3 */\n"
|
---|
148 | file.print indent
|
---|
149 | file.print " goto error_reset;\n"
|
---|
150 | end
|
---|
151 |
|
---|
152 | when PtrType
|
---|
153 |
|
---|
154 | count = type.get_count; size = type.get_size; string = type.get_string
|
---|
155 | if count || size || string then
|
---|
156 | nest = print_nullable_pre( name, type, file, nest, dir, outer, outer2, b_marshal, b_get )
|
---|
157 | indent = "\t" * nest
|
---|
158 | loop_counter_type = IntType.new(32) # mikan åã size_is, count_is ã®å¼æ°ã®åã¨ãã
|
---|
159 | file.print "#{indent}{\t/* GenParamCopy 4 */\n"
|
---|
160 | file.print "#{indent} #{loop_counter_type.get_type_str} i__#{nest}, length__#{nest};\n"
|
---|
161 |
|
---|
162 | if size || count then
|
---|
163 | if size then
|
---|
164 | size_str = size.to_str( name_list, outer, outer2 )
|
---|
165 | end
|
---|
166 |
|
---|
167 | if count then
|
---|
168 | count_str = count.to_str( name_list, outer, outer2 )
|
---|
169 | else
|
---|
170 | # size_is ã¯å¿
|
---|
171 | é . count_is ã¯ãªãã·ã§ã³
|
---|
172 | count_str = size_str
|
---|
173 | end
|
---|
174 | file.print "#{indent} length__#{nest} = #{count_str};\t/* GenParamCopy 5 */\n"
|
---|
175 |
|
---|
176 | # size_is ã« max æå®ãããå ´åãlength ã max ãè¶
|
---|
177 | ãã¦ããããã§ãã¯ããã³ã¼ããçæ
|
---|
178 | # alloc_cp == nil ã®ã¨ã dir 㯠INOUT, OUT ã®ã¯ã (æ¡ä»¶ãåé·)ã試é¨ãçµãã£ã¦ããã®ã§ã次åè¦ç´ãæã«å¤ã
|
---|
179 | if b_get && type.get_max != nil && ! ( ( dir == :INOUT || dir == :OUT ) && alloc_cp == nil ) then
|
---|
180 | file.print "#{indent} if( length__#{nest} > #{type.get_max.to_s} ){\t/* GenParamCopy max check 1 */\n"
|
---|
181 | file.print "#{indent} ercd_ = E_PAR;\n"
|
---|
182 | file.print "#{indent} goto error_reset;\n"
|
---|
183 | file.print "#{indent} }\n"
|
---|
184 | end
|
---|
185 |
|
---|
186 | else # if string then
|
---|
187 | case type.get_type.get_bit_size
|
---|
188 | when -1 # char_t
|
---|
189 | b_size = 8
|
---|
190 | when 8, 16, 32, 64 # intN_t, uintN_t
|
---|
191 | b_size = type.get_type.get_bit_size
|
---|
192 | else
|
---|
193 | cdl_error( "R9999 $1: string specifier cannot be specified to '$2' in current implementation",
|
---|
194 | name, type.get_type.get_type_str + type.get_type.get_type_str_post )
|
---|
195 | end
|
---|
196 | if ! b_get then
|
---|
197 | if string.instance_of? Expression then
|
---|
198 | len = string.to_str( name_list, outer, outer2 )
|
---|
199 | file.print "#{indent} length__#{nest} = STRNLEN#{b_size}(#{outer}#{name}#{outer2},(#{len}-1))+1;\t/* GenParamCopy 6 */\n"
|
---|
200 | file.print "#{indent} if( length__#{nest} < #{len})\tlength__#{nest} += 1;\n"
|
---|
201 | else
|
---|
202 | file.print "#{indent} length__#{nest} = STRLEN#{b_size}(#{outer}#{name}#{outer2})+1;\t/* GenParamCopy 7 */\n"
|
---|
203 | end
|
---|
204 | size_str = "length__#{nest}" # string ã®å ´åãstrnlen 以ä¸ã®é åã確ä¿ããªã
|
---|
205 | else
|
---|
206 | if ( dir == :INOUT ) then
|
---|
207 | if ( string.instance_of? Expression ) then
|
---|
208 | len = string.to_str( name_list, outer, outer2 )
|
---|
209 | size_str = "#{len}" # string(len) ã®å ´å len ã確ä¿ãã
|
---|
210 | else
|
---|
211 | raise "unsuscripted string used for inout parameter #{name}"
|
---|
212 | end
|
---|
213 | else
|
---|
214 | size_str = "length__#{nest}" # string ã®å ´åãstrnlen 以ä¸ã®é åã確ä¿ããªã
|
---|
215 | end
|
---|
216 | end
|
---|
217 | print_param0( "length__#{nest}", loop_counter_type, file, nest + 1, dir, nil, nil, b_marshal, b_get )
|
---|
218 | end
|
---|
219 |
|
---|
220 | if b_get && ( dir == :IN || dir == :INOUT || dir == :SEND || dir == :RECEIVE ) && alloc_cp then
|
---|
221 | file.print <<EOT
|
---|
222 | #{indent} if((ercd_=#{alloc_cp}(sizeof(#{type.get_type.get_type_str}#{type.get_type.get_type_str_post})*(#{size_str}),(void **)&#{outer}#{name}#{outer2}#{alloc_cp_extra}))!=E_OK)\t/* GenParamCopy 8 */
|
---|
223 | #{indent} goto error_reset;
|
---|
224 | EOT
|
---|
225 | if ( dir == :SEND || dir == :RECEIVE ) && type.get_type.has_pointer? then
|
---|
226 | # send, receive ã®å ´åã¯ãã¨ã©ã¼ãªã»ããã«åã NULL ã«ãã
|
---|
227 | file.print <<EOT
|
---|
228 | #{indent} memset( (void *)#{outer}#{name}#{outer2}#{alloc_cp_extra}, 0, sizeof(#{type.get_type.get_type_str}#{type.get_type.get_type_str_post})*(#{size_str}) ); /* GenParamCopy Alloc2 */
|
---|
229 | EOT
|
---|
230 | end
|
---|
231 | end
|
---|
232 | file.print "#{indent} for( i__#{nest} = 0; i__#{nest} < length__#{nest}; i__#{nest}++ ){\t/* GenParamCopy 9 */\n"
|
---|
233 |
|
---|
234 | print_param0( name, type.get_type, file, nest + 2, dir, outer, "#{outer2}[i__#{nest}]", b_marshal, b_get, alloc_cp, alloc_cp_extra )
|
---|
235 | file.print "#{indent} }\n"
|
---|
236 | file.print "#{indent}}\n"
|
---|
237 |
|
---|
238 | nest = print_nullable_post( name, type, file, nest, dir, outer, outer2, b_marshal, b_get )
|
---|
239 | indent = "\t" * nest
|
---|
240 | else
|
---|
241 |
|
---|
242 | # nullable (pre)
|
---|
243 | nest = print_nullable_pre( name, type, file, nest, dir, outer, outer2, b_marshal, b_get )
|
---|
244 | indent = " " * nest
|
---|
245 |
|
---|
246 | # allocate memory for getting value
|
---|
247 | if b_get && ( dir == :IN || dir == :INOUT || dir == :SEND || dir == :RECEIVE ) && alloc_cp then
|
---|
248 | file.print <<EOT
|
---|
249 | #{indent}if((ercd_=#{alloc_cp}(sizeof(#{type.get_type.get_type_str}#{type.get_type.get_type_str_post}),(void **)&#{outer}#{name}#{outer2}#{alloc_cp_extra}))!=E_OK)\t/* GenParamCopy 10 */
|
---|
250 | #{indent} goto error_reset;
|
---|
251 | EOT
|
---|
252 | if ( dir == :SEND || dir == :RECEIVE ) && type.get_type.has_pointer? then
|
---|
253 | # send, receive ã®å ´åã¯ãã¨ã©ã¼ãªã»ããã«åã NULL ã«ãã
|
---|
254 | file.print <<EOT
|
---|
255 | #{indent}memset( (void *)#{outer}#{name}#{outer2}#{alloc_cp_extra}, 0, sizeof(#{type.get_type.get_type_str}#{type.get_type.get_type_str_post}) ); /* GenParamCopy Alloc3 */
|
---|
256 | EOT
|
---|
257 | end
|
---|
258 | end
|
---|
259 |
|
---|
260 | print_param0( name, type.get_type, file, nest, dir, "(*#{outer}", "#{outer2})", b_marshal, b_get, alloc_cp, alloc_cp_extra )
|
---|
261 | # nullable (post)
|
---|
262 | nest = print_nullable_post( name, type, file, nest, dir, outer, outer2, b_marshal, b_get )
|
---|
263 | indent = " " * nest
|
---|
264 | end
|
---|
265 | when StructType
|
---|
266 | members_decl =type.get_members_decl
|
---|
267 | members_decl.get_items.each { |m|
|
---|
268 | if m.is_referenced?
|
---|
269 | print_param0( m.get_name, m.get_type, file, nest, dir, "#{outer}#{name}#{outer2}.", nil, b_marshal, b_get, alloc_cp, alloc_cp_extra, members_decl )
|
---|
270 | end
|
---|
271 | }
|
---|
272 | members_decl.get_items.each { |m|
|
---|
273 | if ! m.is_referenced?
|
---|
274 | print_param0( m.get_name, m.get_type, file, nest, dir, "#{outer}#{name}#{outer2}.", nil, b_marshal, b_get, alloc_cp, alloc_cp_extra, members_decl )
|
---|
275 | end
|
---|
276 | }
|
---|
277 |
|
---|
278 | when VoidType
|
---|
279 | when EnumType # mikan EnumType
|
---|
280 | when FuncType # mikan FuncType
|
---|
281 | when ArrayType # mikan ArrayType
|
---|
282 | subsc = type.get_subscript
|
---|
283 | if subsc == nil
|
---|
284 | raise "Unsubscripted Array Not Supported"
|
---|
285 | else
|
---|
286 | size_str = subsc.to_str( name_list, outer, outer2 )
|
---|
287 |
|
---|
288 | loop_counter_type = IntType.new(32) # mikan åã size_is, count_is ã®å¼æ°ã®åã¨ãã
|
---|
289 | file.print "#{indent}{\t/* GenParamCopy 11 */\n"
|
---|
290 | file.print "#{indent} #{loop_counter_type.get_type_str} i__#{nest}, length__#{nest} = #{size_str};\n"
|
---|
291 |
|
---|
292 | file.print "#{indent} for( i__#{nest} = 0; i__#{nest} < length__#{nest}; i__#{nest}++ ){\n"
|
---|
293 | print_param0( name, type.get_type, file, nest + 2, dir, outer, "#{outer2}[i__#{nest}]", b_marshal, b_get, alloc_cp, alloc_cp_extra )
|
---|
294 | file.print "#{indent} }\n"
|
---|
295 | file.print "#{indent}}\n"
|
---|
296 | end
|
---|
297 | end
|
---|
298 | end
|
---|
299 |
|
---|
300 | #=== nullable (pre)
|
---|
301 | def print_nullable_pre( name, type, file, nest, dir, outer, outer2, b_marshal, b_get )
|
---|
302 | if type.is_nullable? then
|
---|
303 | indent = " " * nest
|
---|
304 | if dir == :OUT then # OUT ã®å ´å print_out_nullable 㧠NULL ãã©ããã®æ
|
---|
305 | å ±ã渡ã
|
---|
306 | # 'null or not' is sent in the function 'print_out_nullable'
|
---|
307 | if b_get then
|
---|
308 | file.print "#{indent}if( #{outer}#{name}#{outer2} ){\t/* GenParamCopy Null 10 */\n"
|
---|
309 | else
|
---|
310 | file.print "#{indent}if( ! b_#{name}_null_ ){\t/* GenParamCopy Null 11 */\n"
|
---|
311 | end
|
---|
312 | nest += 1
|
---|
313 | else # dir = :IN, :INOUT, :SEND, :RECEIVE
|
---|
314 | if b_get then
|
---|
315 | file.print "#{indent}{\n"
|
---|
316 | if ! ( dir == :INOUT && b_marshal == true ) then
|
---|
317 | file.print <<EOT
|
---|
318 | #{indent} int8_t b_null_;
|
---|
319 | #{indent} if((ercd_=cTDR_getInt8( &b_null_ )) != E_OK )\t/* GenParamCopy Null 20 */
|
---|
320 | #{indent} goto error_reset;
|
---|
321 | #{indent} if( ! b_null_ ){
|
---|
322 | EOT
|
---|
323 | else # dir = :INOUT, b_marshal = true, b_get = true ã®å ´åãNULL ãã©ããã®æ
|
---|
324 | å ±ã渡ããªã
|
---|
325 | file.print <<EOT
|
---|
326 | #{indent} int8_t b_null_ = (#{outer}#{name}#{outer2} == NULL);\t/* GenParamCopy Null 21 */
|
---|
327 | #{indent} if( ! b_null_ ){
|
---|
328 | EOT
|
---|
329 | end
|
---|
330 | else
|
---|
331 | file.print <<EOT
|
---|
332 | #{indent}{
|
---|
333 | #{indent} int8_t b_null_ = (int8_t)(#{outer}#{name}#{outer2} == NULL);\t/* GenParamCopy Null 31 */
|
---|
334 | EOT
|
---|
335 |
|
---|
336 | if ! ( dir == :INOUT && b_marshal == false ) then
|
---|
337 | # dir = :INOUT, b_marshal = false, b_get = false ã®å ´å
|
---|
338 | file.print <<EOT
|
---|
339 | #{indent} if((ercd_=cTDR_putInt8( b_null_ )) != E_OK )\t/* GenParamCopy Null 32 */
|
---|
340 | #{indent} goto error_reset;
|
---|
341 | EOT
|
---|
342 | end
|
---|
343 |
|
---|
344 | file.print <<EOT
|
---|
345 | #{indent} if( ! b_null_ ){\t/* GenParamCopy Null 33 */
|
---|
346 | EOT
|
---|
347 | end
|
---|
348 | nest += 2
|
---|
349 | end
|
---|
350 | end
|
---|
351 | return nest
|
---|
352 | end
|
---|
353 |
|
---|
354 | #== nullable (post)
|
---|
355 | def print_nullable_post( name, type, file, nest, dir, outer, outer2, b_marshal, b_get )
|
---|
356 | if type.is_nullable? then
|
---|
357 | if dir == :OUT then # OUT ã®å ´å print_out_nullable 㧠NULL ãã©ããã®æ
|
---|
358 | å ±ã渡ã
|
---|
359 | nest -= 1
|
---|
360 | indent = " " * nest
|
---|
361 | file.print "#{indent}} /* ! b_#{name}_null_ GenParamCopy Null 50 */\n"
|
---|
362 | else # ( dir == :IN || dir == :INOUT || dir == :SEND || dir == :RECEIVE )
|
---|
363 | nest -= 2
|
---|
364 | indent = " " * nest
|
---|
365 | if b_get then
|
---|
366 | if ! ( dir == :INOUT && b_marshal == true ) then
|
---|
367 | file.print <<EOT
|
---|
368 |
|
---|
369 | #{indent} } else { /* null GenParamCopy Null 51 */
|
---|
370 | #{indent} #{outer}#{name}#{outer2} = NULL;
|
---|
371 | #{indent} } /* ! b_null_ */
|
---|
372 | EOT
|
---|
373 | else # dir = :INOUT, b_marshal = true # inout ã® out æ¹å
|
---|
374 | file.print "#{indent} } /* ! b_null_ GenParamCopy Null 52 */\n"
|
---|
375 | end
|
---|
376 | else
|
---|
377 | file.print "#{indent} }\t/* GenParamCopy Null 53 */\n"
|
---|
378 | end
|
---|
379 | file.print "#{indent}}\t/* GenParamCopy Null 54 */\n"
|
---|
380 | end
|
---|
381 | end
|
---|
382 | return nest
|
---|
383 | end
|
---|
384 | end
|
---|