コード例 #1
0
def getInterfacesFromFile(filename, includepath=None):
    popen_cmd = main.preprocessor_cmd
    if includepath:
        for newpath in includepath:
            popen_cmd += ' -I "' + newpath + '"'
    popen_cmd += ' "' + filename + '"'
    f = os.popen(popen_cmd, 'r')
    try:
        tree = _omniidl.compile(f)
    except TypeError:
        tree = _omniidl.compile(f, filename)

    try:
        ints = run(tree,'')
    except:
        #print popen_cmd
        #print filename
        pass
    f.close()
    del tree
    idlast.clear()
    idltype.clear()
    _omniidl.clear()
    #store file name and location information for each interface
    for x in ints:
        x.fullpath = filename
        i = filename.rfind("/")
        if i >= 0:
            x.filename = filename[i+1:]

        x.filename = x.filename[:-4] #remove the .idl suffix

    return ints
コード例 #2
0
def getInterfacesFromFile(filename, includepath=None):
    popen_cmd = main.preprocessor_cmd
    if includepath:
        for newpath in includepath:
            popen_cmd += ' -I "' + newpath + '"'
    popen_cmd += ' "' + filename + '"'
    f = os.popen(popen_cmd, 'r')
    try:
        tree = _omniidl.compile(f)
    except TypeError:
        tree = _omniidl.compile(f, filename)

    if tree == None:
        return []

    try:
        ints = run(tree,'')
    except:
        pass
    f.close()
    del tree
    idlast.clear()
    idltype.clear()
    _omniidl.clear()
    #store file name and location information for each interface
    for x in ints:
        if not x.fullpath.startswith('/'):
            x.fullpath = _locateIncludedFile(x.fullpath, includepath)
        x.filename = os.path.basename(x.fullpath)
        x.filename = x.filename[:-4] #remove the .idl suffix

    return ints
コード例 #3
0
ファイル: importIDL.py プロジェクト: koonihc/framework-core
def getInterfacesFromFile(filename, includepath=None):
    popen_cmd = main.preprocessor_cmd
    if includepath:
        for newpath in includepath:
            popen_cmd += ' -I "' + newpath + '"'
    popen_cmd += ' "' + filename + '"'
    f = os.popen(popen_cmd, 'r')
    try:
        tree = _omniidl.compile(f)
    except TypeError:
        tree = _omniidl.compile(f, filename)

    if tree == None:
        return []

    try:
        ints = run(tree, '')
    except:
        pass
    f.close()
    del tree
    idlast.clear()
    idltype.clear()
    _omniidl.clear()
    #store file name and location information for each interface
    for x in ints:
        if not x.fullpath.startswith('/'):
            x.fullpath = _locateIncludedFile(x.fullpath, includepath)
        x.filename = os.path.basename(x.fullpath)
        x.filename = x.filename[:-4]  #remove the .idl suffix

    return ints
コード例 #4
0
def getInterfaces(filename):
  f = os.popen(main.preprocessor_cmd + ' -I "/usr/local/include" -I "/usr/local/include/ossie" -I "/usr/include" "' \
               + filename + '"','r')
  try:
      tree = _omniidl.compile(f, filename)
  except TypeError:
      tree = _omniidl.compile(f)
      
  ints = run(tree,'')
  f.close()
  del tree
  idlast.clear()
  idltype.clear()
  _omniidl.clear()
  #store file name and location information for each interface
  for x in ints:
      x.fullpath = filename
      i = filename.rfind("/")
      if i >= 0:
          x.filename = filename[i+1:]
          
      x.filename = x.filename[:-4] #remove the .idl suffix
    
      
  return ints
コード例 #5
0
    try:
        tree = _omniidl.compile(f)
    except TypeError:
        tree = _omniidl.compile(f, filename)

    try:
        ints = run(tree, '')
    except Exception, e:
        print e
        ints = []
        #print popen_cmd
        #print filename
        pass
    f.close()
    del tree
    idlast.clear()
    idltype.clear()
    _omniidl.clear()
    #store file name and location information for each interface
    for x in ints:
        x.fullpath = filename
        i = filename.rfind("/")
        if i >= 0:
            x.filename = filename[i + 1:]

        x.filename = x.filename[:-4]  #remove the .idl suffix

    return ints


def getInterfacesFromFileAsString(filename, includepath=None):
コード例 #6
0
    try:
        tree = _omniidl.compile(f)
    except TypeError:
        tree = _omniidl.compile(f, filename)

    try:
        ints = run(tree,'')
    except Exception, e:
        print e
        ints = []
        #print popen_cmd
        #print filename
        pass
    f.close()
    del tree
    idlast.clear()
    idltype.clear()
    _omniidl.clear()
    #store file name and location information for each interface
    for x in ints:
        x.fullpath = filename
        i = filename.rfind("/")
        if i >= 0:
            x.filename = filename[i+1:]

        x.filename = x.filename[:-4] #remove the .idl suffix

    return ints

def getInterfacesFromFileAsString(filename, includepath=None):
    ints = getInterfacesFromFile(filename, includepath)