def __init__(self, includedir, srcdir, xmldir): self.includedir = includedir self.srcdir = srcdir project = CApi.Project() project.initFromDir(xmldir) project.check() self.parser = AbsApi.CParser(project) self.parser.functionBl += [ 'linphone_factory_create_shared_core', 'linphone_factory_create_shared_core_with_config', 'linphone_config_new_for_shared_core', 'linphone_push_notification_message_new', 'linphone_push_notification_message_ref', 'linphone_push_notification_message_unref', 'linphone_push_notification_message_is_using_user_defaults', 'linphone_push_notification_message_get_call_id', 'linphone_push_notification_message_is_text', 'linphone_push_notification_message_get_text_content', 'linphone_push_notification_message_get_subject', 'linphone_push_notification_message_get_from_addr', 'linphone_push_notification_message_get_local_addr', 'linphone_push_notification_message_get_peer_addr', 'linphone_core_get_new_message_from_callid', 'linphone_core_get_new_chat_room_from_conf_addr' ] self.parser.parse_all() self.translator = CppTranslator(self.parser.namespace) self.renderer = pystache.Renderer() self.mainHeader = MainHeader() self.impl = ClassImpl()
def __init__(self, srcdir, javadir, package, xmldir, exceptions): self.srcdir = srcdir self.javadir = javadir self.package = package self.exceptions = exceptions project = CApi.Project() project.initFromDir(xmldir) project.check() self.parser = AbsApi.CParser(project) self.parser.functionBl = [ 'linphone_factory_create_core_with_config', 'linphone_factory_create_core', 'linphone_factory_create_core_2', 'linphone_factory_create_core_with_config_2', 'linphone_vcard_get_belcard', 'linphone_core_get_current_vtable', 'linphone_factory_get', 'linphone_factory_clean', 'linphone_call_zoom_video', 'linphone_core_get_zrtp_cache_db', 'linphone_config_get_range' ] self.parser.parse_all() self.translator = JavaTranslator(package, exceptions) self.renderer = pystache.Renderer() self.jni = Jni(package) self.proguard = Proguard(package) self.enums = {} self.interfaces = {} self.classes = {}
def __init__(self, includedir, srcdir, xmldir): self.includedir = includedir self.srcdir = srcdir project = CApi.Project() project.initFromDir(xmldir) project.check() self.parser = AbsApi.CParser(project) self.parser.parse_all() self.translator = CppTranslator(self.parser.namespace) self.renderer = pystache.Renderer() self.mainHeader = MainHeader() self.impl = ClassImpl()
def __init__(self, srcdir, javadir, package, xmldir, exceptions): self.srcdir = srcdir self.javadir = javadir self.package = package self.exceptions = exceptions project = CApi.Project() project.initFromDir(xmldir) project.check() self.parser = AbsApi.CParser(project) self.parser.functionBl = [ 'linphone_factory_create_core_with_config', 'linphone_factory_create_core', 'linphone_factory_create_core_2', 'linphone_factory_create_core_with_config_2', 'linphone_vcard_get_belcard', 'linphone_core_get_current_vtable', 'linphone_factory_get', 'linphone_factory_clean', 'linphone_call_zoom_video', 'linphone_core_get_zrtp_cache_db', 'linphone_config_get_range', 'linphone_factory_create_shared_core', 'linphone_factory_create_shared_core_with_config', 'linphone_config_new_for_shared_core', 'linphone_push_notification_message_new', 'linphone_push_notification_message_ref', 'linphone_push_notification_message_unref', 'linphone_push_notification_message_is_using_user_defaults', 'linphone_push_notification_message_get_call_id', 'linphone_push_notification_message_is_text', 'linphone_push_notification_message_get_text_content', 'linphone_push_notification_message_get_subject', 'linphone_push_notification_message_get_from_addr', 'linphone_push_notification_message_get_local_addr', 'linphone_push_notification_message_get_peer_addr', 'linphone_core_get_new_message_from_callid', 'linphone_core_get_new_chat_room_from_conf_addr' ] self.parser.parse_all() self.translator = JavaTranslator(package, exceptions) self.renderer = pystache.Renderer() self.jni = Jni(package) self.proguard = Proguard(package) self.enums = {} self.interfaces = {} self.classes = {}
dest='verbose_mode', default=False, help='Verbose mode.') args = argparser.parse_args() loglevel = logging.INFO if args.verbose_mode else logging.ERROR logging.basicConfig(format='%(levelname)s[%(name)s]: %(message)s', level=loglevel) entries = os.listdir(args.outputdir) project = CApi.Project() project.initFromDir(args.xmldir) project.check() parser = AbsApi.CParser(project) parser.functionBl = \ ['linphone_vcard_get_belcard',\ 'linphone_core_get_current_vtable'] parser.classBl += 'LinphoneCoreVTable' parser.methodBl.remove('getCurrentCallbacks') parser.enum_relocations = { } # No nested enums in C#, will cause ambiguousness between Call.State (the enum) and call.State (the property) parser.parse_all() translator = CsharpTranslator() renderer = pystache.Renderer() enums = [] interfaces = [] classes = [] for _interface in parser.namespace.interfaces:
def main(): argparser = argparse.ArgumentParser( description='Generate source files for the C++ wrapper') argparser.add_argument( 'xmldir', type=str, help= 'Directory where the XML documentation of the Linphone\'s API generated by Doxygen is placed' ) argparser.add_argument( '-o --output', type=str, help='the directory where to generate the source files', dest='outputdir', default='.') argparser.add_argument('-n --name', type=str, help='the name of the genarated source file', dest='outputfile', default='LinphoneWrapper.cs') args = argparser.parse_args() entries = os.listdir(args.outputdir) project = CApi.Project() project.initFromDir(args.xmldir) project.check() parser = AbsApi.CParser(project) parser.functionBl = \ ['linphone_vcard_get_belcard',\ 'linphone_core_get_current_vtable',\ 'linphone_call_set_native_video_window_id',\ 'linphone_call_get_native_video_window_id',\ 'linphone_core_get_native_preview_window_id',\ 'linphone_core_set_native_preview_window_id',\ 'linphone_core_set_native_video_window_id',\ 'linphone_core_get_native_video_window_id'] parser.classBl += 'LinphoneCoreVTable' parser.methodBl.remove('getCurrentCallbacks') parser.parse_all() translator = CsharpTranslator() renderer = pystache.Renderer() enums = [] for item in parser.enumsIndex.items(): if item[1] is not None: impl = EnumImpl(item[1], translator) enums.append(impl) else: print( 'warning: {0} enum won\'t be translated because of parsing errors' .format(item[0])) interfaces = [] classes = [] for index in [parser.classesIndex, parser.interfacesIndex]: for _class in index.values(): if _class is not None: try: if type(_class) is AbsApi.Class: impl = ClassImpl(_class, translator) classes.append(impl) else: impl = InterfaceImpl(_class, translator) interfaces.append(impl) except AbsApi.Error as e: print('Could not translate {0}: {1}'.format( _class.name.to_camel_case(fullName=True), e.args[0])) wrapper = WrapperImpl(enums, interfaces, classes) render(renderer, wrapper, args.outputdir + "/" + args.outputfile)
def main(): argparser = argparse.ArgumentParser( description='Generate source files for the C++ wrapper') argparser.add_argument( 'xmldir', type=str, help= 'Directory where the XML documentation of the Linphone\'s API generated by Doxygen is placed' ) argparser.add_argument( '-o --output', type=str, help='the directory where to generate the source files', dest='outputdir', default='.') args = argparser.parse_args() includedir = args.outputdir + '/include/linphone++' srcdir = args.outputdir + '/src' try: os.makedirs(includedir) except OSError as e: if e.errno != errno.EEXIST: print("Cannot create '{0}' dircetory: {1}".format( includedir, e.strerror)) sys.exit(1) try: os.makedirs(srcdir) except OSError as e: if e.errno != errno.EEXIST: print("Cannot create '{0}' dircetory: {1}".format( srcdir, e.strerror)) sys.exit(1) project = CApi.Project() project.initFromDir(args.xmldir) project.check() parser = AbsApi.CParser(project) parser.parse_all() translator = CppTranslator() renderer = pystache.Renderer() header = EnumsHeader(translator) for item in parser.enumsIndex.items(): if item[1] is not None: header.add_enum(item[1]) else: print( 'warning: {0} enum won\'t be translated because of parsing errors' .format(item[0])) render(renderer, header, includedir + '/enums.hh') mainHeader = MainHeader() mainHeader.add_include('enums.hh') impl = ClassImpl() for _class in parser.classesIndex.values() + parser.interfacesIndex.values( ): if _class is not None: try: header = ClassHeader(_class, translator) headerName = _class.name.to_snake_case() + '.hh' mainHeader.add_include(headerName) render(renderer, header, includedir + '/' + header.filename) if type(_class) is not AbsApi.Interface: impl.classes.append(header._class) except AbsApi.Error as e: print('Could not translate {0}: {1}'.format( _class.name.to_camel_case(fullName=True), e.args[0])) render(renderer, mainHeader, includedir + '/linphone.hh') render(renderer, impl, srcdir + '/linphone++.cc')
type=str, help= 'directory holding the XML documentation of the C API generated by Doxygen' ) argparser.add_argument( '-o --output', type=str, help='directory into where Sphinx source files will be written', dest='outputdir', default='.') argparser.add_argument('-v --verbose', action='store_true', default=False, dest='verbose_mode', help='Show warning and info messages') args = argparser.parse_args() loglevel = logging.INFO if args.verbose_mode else logging.ERROR logging.basicConfig(format='%(levelname)s[%(name)s]: %(message)s', level=loglevel) cProject = capi.Project() cProject.initFromDir(args.xmldir) cProject.check() absApiParser = abstractapi.CParser(cProject) absApiParser.parse_all() docGenerator = DocGenerator(absApiParser) docGenerator.generate(args.outputdir)
def main(): argparser = argparse.ArgumentParser( description='Generate source files for the C++ wrapper') argparser.add_argument( 'xmldir', type=str, help= 'Directory where the XML documentation of the Linphone\'s API generated by Doxygen is placed' ) argparser.add_argument( '-o --output', type=str, help='the directory where to generate the source files', dest='outputdir', default='.') args = argparser.parse_args() entries = os.listdir(args.outputdir) if 'include' not in entries: os.mkdir(args.outputdir + '/include') if 'src' not in entries: os.mkdir(args.outputdir + '/src') project = CApi.Project() project.initFromDir(args.xmldir) project.check() parser = AbsApi.CParser(project) parser.parse_all() translator = CppTranslator() renderer = pystache.Renderer() header = EnumsHeader(translator) for item in parser.enumsIndex.items(): if item[1] is not None: header.add_enum(item[1]) else: print( 'warning: {0} enum won\'t be translated because of parsing errors' .format(item[0])) with open(args.outputdir + '/include/enums.hh', mode='w') as f: f.write(renderer.render(header)) mainHeader = MainHeader() cmakelists = CMakeLists() for _class in parser.classesIndex.values() + parser.interfacesIndex.values( ): if _class is not None: try: header = ClassHeader(_class, translator, ignore=['LinphoneBuffer']) impl = ClassImpl(_class, header._class) headerName = _class.name.to_snake_case() + '.hh' sourceName = _class.name.to_snake_case() + '.cc' mainHeader.add_include(headerName) if type(_class) is AbsApi.Class: cmakelists.classes.append({ 'header': headerName, 'source': sourceName }) else: cmakelists.interfaces.append({'header': headerName}) with open(args.outputdir + '/include/' + header.filename, mode='w') as f: f.write(renderer.render(header)) if type(_class) is AbsApi.Class: with open(args.outputdir + '/src/' + impl.filename, mode='w') as f: f.write(renderer.render(impl)) except AbsApi.Error as e: print('Could not translate {0}: {1}'.format( _class.name.to_camel_case(fullName=True), e.args[0])) with open(args.outputdir + '/include/linphone.hh', mode='w') as f: f.write(renderer.render(mainHeader)) with open(args.outputdir + '/CMakeLists.txt', mode='w') as f: f.write(renderer.render(cmakelists))