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
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
Exemple #3
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
Exemple #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
    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):
    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)