示例#1
0
文件: main.py 项目: reusee/gtk-go
  def __init__(self, filename, translator):
    self.translator = translator
    parser = GIRParser(False)
    parser.parse(filename)

    self.path = os.path.dirname(os.path.abspath(filename))
    self.package = os.path.basename(self.path)

    self.func_spec = {}
    func_spec_file = os.path.join(self.path, 'func_spec.py')
    func_spec_module = imp.load_source('func_spec', func_spec_file)
    self.func_spec = func_spec_module.func_specs

    config_file = os.path.join(self.path, 'config.py')
    config_module = imp.load_source('config', config_file)
    for name in dir(config_module):
      if name.startswith('_'): continue
      if name[0].islower(): continue
      setattr(self, name.lower(), getattr(config_module, name))

    self.namespace = parser.get_namespace()
    self.module_name = self.namespace.name.lower()
    self.translator.namespaces.add(self.namespace.name)
    self.pkgconfig_packages = list(parser.get_pkgconfig_packages())
    self.includes = list(parser.get_c_includes())
    self.prefixes = self.namespace.symbol_prefixes

    self.functions = []
    self.const_symbols = set()

    self.class_types = {}
    self.record_types = {}

    self.exported_functions = set()
    self.functions_to_handle = []
示例#2
0
文件: main.py 项目: reusee/gtk-go
    def __init__(self, filename, translator):
        self.translator = translator
        parser = GIRParser(False)
        parser.parse(filename)

        self.path = os.path.dirname(os.path.abspath(filename))
        self.package = os.path.basename(self.path)

        self.func_spec = {}
        func_spec_file = os.path.join(self.path, 'func_spec.py')
        func_spec_module = imp.load_source('func_spec', func_spec_file)
        self.func_spec = func_spec_module.func_specs

        config_file = os.path.join(self.path, 'config.py')
        config_module = imp.load_source('config', config_file)
        for name in dir(config_module):
            if name.startswith('_'): continue
            if name[0].islower(): continue
            setattr(self, name.lower(), getattr(config_module, name))

        self.namespace = parser.get_namespace()
        self.module_name = self.namespace.name.lower()
        self.translator.namespaces.add(self.namespace.name)
        self.pkgconfig_packages = list(parser.get_pkgconfig_packages())
        self.includes = list(parser.get_c_includes())
        self.prefixes = self.namespace.symbol_prefixes

        self.functions = []
        self.const_symbols = set()

        self.class_types = {}
        self.record_types = {}

        self.exported_functions = set()
        self.functions_to_handle = []
示例#3
0
文件: views.py 项目: anarey/GDN
def parse(request):
    parser = GIRParser()
    parser.parse(GIR_PATH % "Gtk-3.0")
    store_parser(parser)

    return HttpResponse(
        "<html><head><title>GIR to SQL transfusion completed</title></head><body><h1>GIR to SQL transfusion completed</h1></body></html>"
    )
def passthrough_gir(path, f):
    parser = GIRParser()
    parser.parse(path)

    writer = GIRWriter(parser.get_namespace(), parser.get_shared_libraries(),
                       parser.get_includes(), parser.get_pkgconfig_packages(),
                       parser.get_c_includes())
    f.write(writer.get_xml())
示例#5
0
def _build_includes_parsers(parser):
    incs = parser.get_includes()
    for inc in incs:
        if _ns_exists(inc):
            continue
        path = GIR_PATH % str(inc)
        p = GIRParser()
        p.parse(path)
        store_parser(p)
示例#6
0
文件: storage.py 项目: anarey/GDN
def _build_includes_parsers (parser):
	incs = parser.get_includes()
	for inc in incs:
		if _ns_exists (inc):
			continue
		path = GIR_PATH % str(inc)
		p = GIRParser()
		p.parse(path)
		store_parser (p)
示例#7
0
文件: parsegir.py 项目: aruiz/GDN
 def handle(self, *args, **kwargs):
     parser = GIRParser()
     if len(sys.argv) == 3:
         library = sys.argv[2]
     else:
         library = "Gtk-3.0"
     print "Parsing %s" % library
     parser.parse(GIR_PATH % library)
     store_parser(parser)
def passthrough_gir(path, f):
    parser = GIRParser()
    parser.parse(path)

    writer = GIRWriter(parser.get_namespace(),
                       parser.get_shared_libraries(),
                       parser.get_includes(),
                       parser.get_pkgconfig_packages(),
                       parser.get_c_includes())
    f.write(writer.get_xml())
示例#9
0
文件: storage.py 项目: aruiz/GDN
def _build_includes_parsers(parser):
    incs = parser.get_includes()
    for inc in incs:
        if _ns_exists(inc):
            continue
        path = GIR_PATH % str(inc)
        if os.path.exists(path):
            p = GIRParser()
            p.parse(path)
            store_parser(p)
        else:
            print "WARNING: GIR not found: %s" % inc
示例#10
0
def passthrough_gir(path, f):
    parser = GIRParser()
    parser.parse(path)

    writer = GIRWriter(parser.get_namespace())
    f.write(writer.get_xml())
示例#11
0
def passthrough_gir(path, f):
    parser = GIRParser()
    parser.parse(path)

    writer = GIRWriter(parser.get_namespace())
    f.write(writer.get_encoded_xml())
示例#12
0
文件: views.py 项目: anarey/GDN
def parse(request):
	parser = GIRParser()
	parser.parse(GIR_PATH % "Gtk-3.0")
	store_parser(parser)

	return HttpResponse("<html><head><title>GIR to SQL transfusion completed</title></head><body><h1>GIR to SQL transfusion completed</h1></body></html>")