コード例 #1
0
ファイル: idl_c_header.py プロジェクト: Devic1573/Chromium
    def GenerateFile(self, filenode, releases, options):
        savename = GetOutFileName(filenode, GetOption('dstroot'))
        unique_releases = filenode.GetUniqueReleases(releases)
        if not unique_releases:
            if os.path.isfile(savename):
                print "Removing stale %s for this range." % filenode.GetName()
                os.remove(os.path.realpath(savename))
            return False

        out = IDLOutFile(savename)
        self.GenerateHead(out, filenode, releases, options)
        self.GenerateBody(out, filenode, releases, options)
        self.GenerateTail(out, filenode, releases, options)
        return out.Close()
コード例 #2
0
ファイル: idl_c_header.py プロジェクト: yubb/chromium.src
  def GenerateFile(self, filenode, releases, options):
    savename = GetOutFileName(filenode, GetOption('dstroot'))
    my_min, my_max = filenode.GetMinMax(releases)
    if my_min > releases[-1] or my_max < releases[0]:
      if os.path.isfile(savename):
        print "Removing stale %s for this range." % filenode.GetName()
        os.remove(os.path.realpath(savename))
      return False

    out = IDLOutFile(savename)
    self.GenerateHead(out, filenode, releases, options)
    self.GenerateBody(out, filenode, releases, options)
    self.GenerateTail(out, filenode, releases, options)
    return out.Close()
コード例 #3
0
ファイル: idl_gen_rpc.py プロジェクト: adeshkp/moebius
def main(args):
    filenames = ParseOptions(args)
    ast = ParseFiles(filenames)
    rpcgen = RPCGen()
    files = ast.GetListOf('File')
    outname = GetOption('out')
    if outname == '':
        outname = 'out.cc'
    outfile = IDLOutFile(outname)
    emitted = set()
    for f in files:
        if f.GetName() == 'pp_macros.idl':
            GenerateDep(outfile, emitted, f, ast.releases)
    for f in files:
        GenerateDep(outfile, emitted, f, ast.releases)
    out = ''
    out += '#include "host/rpc.h"\n'
    out += '#include "json/json.cpp"\n'
    out += 'using namespace std;\n'
    out += 'using namespace JSON;\n'
    for declareOnly in [True, False]:
        for f in files:
            if f.GetProperty('ERRORS') > 0:
                print 'Skipping %s' % f.GetName()
                continue
            for node in f.GetChildren()[2:]:
                out += rpcgen.Define(node, ast.releases, declareOnly)
    out += 'static map<string, void*> gInterfaces;\n'
    out += '\n'
    out += 'typedef char* (*InterfaceMemberCallFunc)(const void*, JSONIterator&);\n'
    out += 'static map<string, InterfaceMemberCallFunc> gInterfaceMemberCallers;\n'
    out += '\n'
    out += 'void InitializeInterfaceList() {\n'
    for (interfaceString, interfaceStruct) in rpcgen.interfaceStructs:
        if interfaceString == "PPB_Flash_File_FileRef;2.0":
            interfaceString = "PPB_Flash_File_FileRef;2"
        elif interfaceString == "PPB_Flash_File_ModuleLocal;3.0":
            interfaceString = "PPB_Flash_File_ModuleLocal;3"
        elif interfaceString == "PPB_PDF;0.1":
            interfaceString = "PPB_PDF;1"
        out += '  gInterfaces.insert(pair<string, void*>("' + interfaceString + '", &' + interfaceStruct + '));\n'
    for (interfaceString, caller) in rpcgen.pppInterfaceGetters:
        out += '  gInterfaceMemberCallers.insert(pair<string, InterfaceMemberCallFunc>("' + interfaceString + '", ' + caller + '));\n'
    out += '};\n'
    out += '\n'
    outfile.Write(out)
    outfile.Close()
コード例 #4
0
ファイル: idl_thunk.py プロジェクト: mlieberman85/netflixoss
  def GenerateFile(self, filenode, releases, options):
    savename = _GetThunkFileName(filenode, GetOption('thunkroot'))
    my_min, my_max = filenode.GetMinMax(releases)
    if my_min > releases[-1] or my_max < releases[0]:
      if os.path.isfile(savename):
        print "Removing stale %s for this range." % filenode.GetName()
        os.remove(os.path.realpath(savename))
      return False
    do_generate = filenode.GetProperty('generate_thunk')
    if not do_generate:
      return False

    thunk_out = IDLOutFile(savename)
    body, meta = self.GenerateBody(thunk_out, filenode, releases, options)
    self.WriteHead(thunk_out, filenode, releases, options, meta)
    thunk_out.Write('\n\n'.join(body))
    self.WriteTail(thunk_out, filenode, releases, options)
    return thunk_out.Close()
コード例 #5
0
    def GenerateRange(self, ast, releases, options):
        """Generate shim code for a range of releases.
    """

        # Remember to set the output filename before running this.
        out_filename = self.output_file
        if out_filename is None:
            ErrOut.Log('Did not set filename for writing out wrapper\n')
            return 1

        InfoOut.Log("Generating %s for %s" %
                    (out_filename, self.wrapper_prefix))

        out = IDLOutFile(out_filename)

        # Get a list of all the interfaces along with metadata.
        iface_releases = self.DetermineInterfaces(ast, releases)

        # Generate the includes.
        self.GenerateIncludes(iface_releases, out)

        # Write out static helper functions (mystrcmp).
        self.GenerateHelperFunctions(out)

        # Declare list of WrapperInfo before actual wrapper methods, since
        # they reference each other.
        self.DeclareWrapperInfos(iface_releases, out)

        # Generate wrapper functions for each wrapped method in the interfaces.
        result = self.GenerateWrapperForMethods(iface_releases)
        out.Write(result)

        # Collect all the wrapper functions into interface structs.
        self.GenerateWrapperInterfaces(iface_releases, out)

        # Generate a table of the wrapped interface structs that can be looked up.
        self.GenerateWrapperInfoAndCollection(iface_releases, out)

        # Write out the IDL-invariant functions.
        self.GenerateFixedFunctions(out)

        out.Close()
        return 0
コード例 #6
0
ファイル: idl_thunk.py プロジェクト: Azile-Ttenneb/ppapi
    def GenerateFile(self, filenode, releases, options):
        savename = _GetThunkFileName(filenode, GetOption('thunkroot'))
        my_min, my_max = filenode.GetMinMax(releases)
        if my_min > releases[-1] or my_max < releases[0]:
            if os.path.isfile(savename):
                print("Removing stale %s for this range." % filenode.GetName())
                os.remove(os.path.realpath(savename))
            return False
        do_generate = filenode.GetProperty('generate_thunk')
        if not do_generate:
            return False

        thunk_out = IDLOutFile(savename)
        body, meta = self.GenerateBody(thunk_out, filenode, releases, options)
        # TODO(teravest): How do we handle repeated values?
        if filenode.GetProperty('thunk_include'):
            meta.AddInclude(filenode.GetProperty('thunk_include'))
        self.WriteHead(thunk_out, filenode, releases, options, meta)
        thunk_out.Write('\n\n'.join(body))
        self.WriteTail(thunk_out, filenode, releases, options)
        thunk_out.ClangFormat()
        return thunk_out.Close()
コード例 #7
0
ファイル: idl_c_sharp.py プロジェクト: vzolotov/WebSharp
  def GenerateFile(self, filenode, releases, options):


    #
    # BlackListed
    #
    # A dictionary of idl files that we should not generate code for.  Ex. Files in development.
    #
    BlackListed = [
    'ppb_audio_input_dev.idl',
    'pp_video_capture_dev.idl',
    'ppb_device_ref_dev.idl',
    'ppb_video_capture_dev.idl',
    'ppb_device_ref_dev.idl'
    ]

    # make sure we are not generating for certain source files.
    if filenode.GetName() in BlackListed:
        print('Skipping generation of %s' % filenode.GetName())
        return False;

    CheckTypedefs(filenode, releases)
    CheckPassByValue(filenode, releases)
    savename = GetSourceFileFromNode(filenode, GetOption('cs_root'))
    my_min, my_max = filenode.GetMinMax(releases)
    if my_min > releases[-1] or my_max < releases[0]:
      if os.path.isfile(savename):
        print "Removing stale %s for this range." % filenode.GetName()
        os.remove(os.path.realpath(savename))
      return False

    out = IDLOutFile(savename)
    self.GenerateHead(out, filenode, releases, options)
    self.GenerateBody(out, filenode, releases, options)
    self.GenerateTail(out, filenode, releases, options)
    return out.Close()
コード例 #8
0
 def GetOutFile(self, filenode, options):
     savename = GetOutFileName(filenode, GetOption('dstroot'))
     return IDLOutFile(savename)