134 if (enum_value_size != 0) print "" |
134 if (enum_value_size != 0) print "" |
135 |
135 |
136 # Static methods |
136 # Static methods |
137 mlen = 0 |
137 mlen = 0 |
138 for (i = 1; i <= static_method_size; i++) { |
138 for (i = 1; i <= static_method_size; i++) { |
139 if (mlen <= length(static_methods[i])) mlen = length(static_methods[i]) |
139 if (mlen <= length(static_methods[i, 0])) mlen = length(static_methods[i, 0]) |
140 } |
140 } |
141 for (i = 1; i <= static_method_size; i++) { |
141 for (i = 1; i <= static_method_size; i++) { |
142 print " SQ" cls ".DefSQStaticMethod(engine, &" cls "::" static_methods[i] ", " substr(spaces, 1, mlen - length(static_methods[i])) "\"" static_methods[i] "\");" |
142 print " SQ" cls ".DefSQStaticMethod(engine, &" cls "::" static_methods[i, 0] ", " substr(spaces, 1, mlen - length(static_methods[i, 0])) "\"" static_methods[i, 0] "\", " substr(spaces, 1, mlen - length(static_methods[i, 0])) "" static_methods[i, 1] ", \"" static_methods[i, 2] "\");" |
143 delete static_methods[i] |
143 delete static_methods[i] |
144 } |
144 } |
145 if (static_method_size != 0) print "" |
145 if (static_method_size != 0) print "" |
146 |
146 |
147 # Non-static methods |
147 # Non-static methods |
148 mlen = 0 |
148 mlen = 0 |
149 for (i = 1; i <= method_size; i++) { |
149 for (i = 1; i <= method_size; i++) { |
150 if (mlen <= length(methods[i])) mlen = length(methods[i]) |
150 if (mlen <= length(methods[i, 0])) mlen = length(methods[i, 0]) |
151 } |
151 } |
152 for (i = 1; i <= method_size; i++) { |
152 for (i = 1; i <= method_size; i++) { |
153 print " SQ" cls ".DefSQMethod(engine, &" cls "::" methods[i] ", " substr(spaces, 1, mlen - length(methods[i])) "\"" methods[i] "\");" |
153 print " SQ" cls ".DefSQMethod(engine, &" cls "::" methods[i, 0] ", " substr(spaces, 1, mlen - length(methods[i, 0])) "\"" methods[i, 0] "\", " substr(spaces, 1, mlen - length(methods[i, 0])) "" methods[i, 1] ", \"" methods[i, 2] "\");" |
154 delete methods[i] |
154 delete methods[i] |
155 } |
155 } |
156 if (method_size != 0) print "" |
156 if (method_size != 0) print "" |
157 |
157 |
158 print " SQ" cls ".PostRegister(engine);" |
158 print " SQ" cls ".PostRegister(engine);" |
188 |
188 |
189 is_static = match($0, "static") |
189 is_static = match($0, "static") |
190 gsub("virtual", "", $0) |
190 gsub("virtual", "", $0) |
191 gsub("static", "", $0) |
191 gsub("static", "", $0) |
192 gsub("const", "", $0) |
192 gsub("const", "", $0) |
|
193 param_s = $0 |
193 gsub("\\*", "", $0) |
194 gsub("\\*", "", $0) |
194 gsub("\\(.*", "", $0) |
195 gsub("\\(.*", "", $0) |
195 if ($2 == "") next |
196 func = $2 |
|
197 if (func == "") next |
|
198 |
|
199 sub(".*\\(", "", param_s) |
|
200 sub("\\).*", "", param_s) |
|
201 |
|
202 split(param_s, params, ",") |
|
203 types = "x" |
|
204 len = 1; |
|
205 for (len = 1; params[len] != ""; len++) { |
|
206 sub("^[ ]*", "", params[len]) |
|
207 if (match(params[len], "\*")) { |
|
208 if (match(params[len], "^char")) { |
|
209 types = types "s" |
|
210 } else { |
|
211 types = types "p" |
|
212 } |
|
213 } else if (match(params[len], "^bool")) { |
|
214 types = types "b" |
|
215 } else { |
|
216 types = types "i" |
|
217 } |
|
218 } |
|
219 |
196 if (is_static) { |
220 if (is_static) { |
197 static_method_size++ |
221 static_method_size++ |
198 static_methods[static_method_size] = $2 |
222 static_methods[static_method_size, 0] = func |
|
223 static_methods[static_method_size, 1] = len |
|
224 static_methods[static_method_size, 2] = types |
199 } else { |
225 } else { |
200 method_size++ |
226 method_size++ |
201 methods[method_size] = $2 |
227 methods[method_size, 0] = func |
|
228 methods[method_size, 1] = len |
|
229 methods[method_size, 2] = types |
202 } |
230 } |
203 next |
231 next |
204 } |
232 } |