def __create_function_symbol (self, node): comment = self.doc_tool.get_comment (node.spelling) parameters = [] if comment: return_tag = comment.tags.get('returns') return_comment = comment_from_tag(return_tag) else: return_comment = None type_tokens = self.make_c_style_type_name (node.result_type) return_value = [ReturnItemSymbol (type_tokens=type_tokens, comment=return_comment)] for param in node.get_arguments(): if comment: param_comment = comment.params.get (param.displayname) else: param_comment = None type_tokens = self.make_c_style_type_name (param.type) parameter = ParameterSymbol (argname=param.displayname, type_tokens=type_tokens, comment=param_comment) parameters.append (parameter) sym = self.doc_tool.get_or_create_symbol(FunctionSymbol, parameters=parameters, return_value=return_value, comment=comment, display_name=node.spelling, filename=str(node.location.file), lineno=node.location.line) return sym
def translate_tags(self, comment, link_resolver): """Banana banana """ for tname in ('deprecated',): tag = comment.tags.get(tname) if tag is not None and tag.description: comment = comment_from_tag(tag) ast = self.comment_to_ast(comment, link_resolver) tag.description = self.ast_to_html(ast, link_resolver) or ''
def update_children_comments(self): """ Banana banana """ for sym in self.get_children_symbols(): if type(sym) == ParameterSymbol: sym.comment = self.comment.params.get(sym.argname) elif type(sym) == FieldSymbol: sym.comment = self.comment.params.get(sym.member_name) elif type(sym) == ReturnItemSymbol: tag = self.comment.tags.get('returns') sym.comment = comment_from_tag(tag) elif type(sym) == Symbol: sym.comment = self.comment.params.get(sym.display_name)
def update_children_comments(self): """ Banana banana """ if self.comment is None: return for sym in self.get_children_symbols(): if type(sym) == ParameterSymbol: sym.comment = self.comment.params.get(sym.argname) elif type(sym) == FieldSymbol: sym.comment = self.comment.params.get(sym.member_name) elif type(sym) == ReturnItemSymbol: tag = self.comment.tags.get('returns') sym.comment = comment_from_tag(tag) elif type(sym) == Symbol: sym.comment = self.comment.params.get(sym.display_name)
def __create_function_macro_symbol (self, node, comment, original_text): return_value = [None] if comment: return_tag = comment.tags.get ('returns') if return_tag: return_comment = comment_from_tag (return_tag) return_value = [ReturnItemSymbol (comment=return_comment)] parameters = [] if comment: for param_name, param_comment in comment.params.iteritems(): parameter = ParameterSymbol (argname=param_name, comment = param_comment) parameters.append (parameter) sym = self.doc_tool.get_or_create_symbol(FunctionMacroSymbol, return_value=return_value, parameters=parameters, original_text=original_text, comment=comment, display_name=node.spelling, filename=str(node.location.file), lineno=node.location.line) return sym
def __create_callback_symbol (self, node, comment): parameters = [] if comment: return_tag = comment.tags.get('returns') return_comment = comment_from_tag(return_tag) else: return_comment = None return_value = None for child in node.get_children(): if not return_value: t = node.underlying_typedef_type res = t.get_pointee().get_result() type_tokens = self.make_c_style_type_name (res) return_value = [ReturnItemSymbol(type_tokens=type_tokens, comment=return_comment)] else: if comment: param_comment = comment.params.get (child.displayname) else: param_comment = None type_tokens = self.make_c_style_type_name (child.type) parameter = ParameterSymbol (argname=child.displayname, type_tokens=type_tokens, comment=param_comment) parameters.append (parameter) if not return_value: return_value = [ReturnItemSymbol(type_tokens=[], comment=None)] sym = self.doc_tool.get_or_create_symbol(CallbackSymbol, parameters=parameters, return_value=return_value, comment=comment, display_name=node.spelling, filename=str(node.location.file), lineno=node.location.line) return sym
def __create_return_value_symbol (self, gi_retval, comment, out_parameters): if comment: return_tag = comment.tags.get ('returns', None) return_comment = comment_from_tag (return_tag) else: return_comment = None type_tokens, gi_name = self.__type_tokens_and_gi_name_from_gi_node(gi_retval) if gi_name == 'none': ret_item = None else: ret_item = ReturnItemSymbol (type_tokens=type_tokens, comment=return_comment) ret_item.add_extension_attribute('gi-extension', 'gi_name', gi_name) res = [ret_item] for out_param in out_parameters: ret_item = ReturnItemSymbol (type_tokens=out_param.input_tokens, comment=out_param.comment, name=out_param.argname) res.append(ret_item) return res