125 |
125 |
126 class Interface(ClbrBaseClasses.Class, VisibilityMixin): |
126 class Interface(ClbrBaseClasses.Class, VisibilityMixin): |
127 """ |
127 """ |
128 Class to represent a CORBA IDL interface. |
128 Class to represent a CORBA IDL interface. |
129 """ |
129 """ |
130 def __init__(self, module, name, super, file, lineno): |
130 def __init__(self, module, name, superClasses, file, lineno): |
131 """ |
131 """ |
132 Constructor |
132 Constructor |
133 |
133 |
134 @param module name of the module containing this class |
134 @param module name of the module containing this class |
135 @param name name of this interface |
135 @param name name of this interface |
136 @param super list of interface names this interface is inherited from |
136 @param superClasses list of interface names this interface is |
|
137 inherited from |
137 @param file filename containing this interface |
138 @param file filename containing this interface |
138 @param lineno linenumber of the interface definition |
139 @param lineno linenumber of the interface definition |
139 """ |
140 """ |
140 ClbrBaseClasses.Class.__init__(self, module, name, super, file, lineno) |
141 ClbrBaseClasses.Class.__init__(self, module, name, superClasses, file, |
|
142 lineno) |
141 VisibilityMixin.__init__(self) |
143 VisibilityMixin.__init__(self) |
142 |
144 |
143 |
145 |
144 class Function(ClbrBaseClasses.Function, VisibilityMixin): |
146 class Function(ClbrBaseClasses.Function, VisibilityMixin): |
145 """ |
147 """ |
188 @param path path the file should be searched in (list of strings) |
190 @param path path the file should be searched in (list of strings) |
189 @return the resulting dictionary |
191 @return the resulting dictionary |
190 """ |
192 """ |
191 global _modules |
193 global _modules |
192 |
194 |
193 dict = {} |
195 dictionary = {} |
194 dict_counts = {} |
196 dict_counts = {} |
195 |
197 |
196 if module in _modules: |
198 if module in _modules: |
197 # we've seen this file before... |
199 # we've seen this file before... |
198 return _modules[module] |
200 return _modules[module] |
203 f, file, (suff, mode, type) = ClassBrowsers.find_module(module, fullpath) |
205 f, file, (suff, mode, type) = ClassBrowsers.find_module(module, fullpath) |
204 if f: |
206 if f: |
205 f.close() |
207 f.close() |
206 if type not in SUPPORTED_TYPES: |
208 if type not in SUPPORTED_TYPES: |
207 # not CORBA IDL source, can't do anything with this module |
209 # not CORBA IDL source, can't do anything with this module |
208 _modules[module] = dict |
210 _modules[module] = dictionary |
209 return dict |
211 return dictionary |
210 |
212 |
211 _modules[module] = dict |
213 _modules[module] = dictionary |
212 classstack = [] # stack of (class, indent) pairs |
214 classstack = [] # stack of (class, indent) pairs |
213 indent = 0 |
215 indent = 0 |
214 try: |
216 try: |
215 src = Utilities.readEncodedFile(file)[0] |
217 src = Utilities.readEncodedFile(file)[0] |
216 except (UnicodeError, IOError): |
218 except (UnicodeError, IOError): |
217 # can't do anything with this module |
219 # can't do anything with this module |
218 _modules[module] = dict |
220 _modules[module] = dictionary |
219 return dict |
221 return dictionary |
220 |
222 |
221 lineno, last_lineno_pos = 1, 0 |
223 lineno, last_lineno_pos = 1, 0 |
222 lastGlobalEntry = None |
224 lastGlobalEntry = None |
223 cur_obj = None |
225 cur_obj = None |
224 i = 0 |
226 i = 0 |
265 dict_counts[meth_name] += 1 |
267 dict_counts[meth_name] += 1 |
266 meth_name = "{0}_{1:d}".format( |
268 meth_name = "{0}_{1:d}".format( |
267 meth_name, dict_counts[meth_name]) |
269 meth_name, dict_counts[meth_name]) |
268 else: |
270 else: |
269 dict_counts[meth_name] = 0 |
271 dict_counts[meth_name] = 0 |
270 dict[meth_name] = f |
272 dictionary[meth_name] = f |
271 if not classstack: |
273 if not classstack: |
272 if lastGlobalEntry: |
274 if lastGlobalEntry: |
273 lastGlobalEntry.setEndLine(lineno - 1) |
275 lastGlobalEntry.setEndLine(lineno - 1) |
274 lastGlobalEntry = f |
276 lastGlobalEntry = f |
275 if cur_obj and isinstance(cur_obj, Function): |
277 if cur_obj and isinstance(cur_obj, Function): |
304 inherit = [_commentsub('', inherit)] |
306 inherit = [_commentsub('', inherit)] |
305 # remember this interface |
307 # remember this interface |
306 cur_class = Interface(module, class_name, inherit, |
308 cur_class = Interface(module, class_name, inherit, |
307 file, lineno) |
309 file, lineno) |
308 if not classstack: |
310 if not classstack: |
309 dict[class_name] = cur_class |
311 dictionary[class_name] = cur_class |
310 else: |
312 else: |
311 cls = classstack[-1][0] |
313 cls = classstack[-1][0] |
312 cls._addclass(class_name, cur_class) |
314 cls._addclass(class_name, cur_class) |
313 if not classstack: |
315 if not classstack: |
314 if lastGlobalEntry: |
316 if lastGlobalEntry: |
334 last_lineno_pos = start |
336 last_lineno_pos = start |
335 module_name = m.group("ModuleName") |
337 module_name = m.group("ModuleName") |
336 # remember this module |
338 # remember this module |
337 cur_class = Module(module, module_name, file, lineno) |
339 cur_class = Module(module, module_name, file, lineno) |
338 if not classstack: |
340 if not classstack: |
339 dict[module_name] = cur_class |
341 dictionary[module_name] = cur_class |
340 if lastGlobalEntry: |
342 if lastGlobalEntry: |
341 lastGlobalEntry.setEndLine(lineno - 1) |
343 lastGlobalEntry.setEndLine(lineno - 1) |
342 lastGlobalEntry = cur_class |
344 lastGlobalEntry = cur_class |
343 if cur_obj and isinstance(cur_obj, Function): |
345 if cur_obj and isinstance(cur_obj, Function): |
344 cur_obj.setEndLine(lineno - 1) |
346 cur_obj.setEndLine(lineno - 1) |