コード例 #1
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
コード例 #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)

    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
コード例 #3
0
def generate(idl_file, preproc_args, impl_suffix, skel_suffix = "Skel", fd_h=None, fd_cpp=None):
	basename = idl_file.replace(".idl","")
	preprocessor_cmd = "omnicpp"
	preprocessor_opt = "-I" + string.join(preproc_args, " -I")

	preproc_cmd = '%s %s %s' % (preprocessor_cmd,\
				  preprocessor_opt, idl_file)

	file = os.popen(preproc_cmd, "r")

	skel_filename = basename + skel_suffix + ".h"
	idl_filename = idl_file

	# ignore the following operations
	ignore_operations = ["profile"]
	
	tree = _omniidl.compile(file)
	ast.__init__(tree)

	cxx_svc_impl.__init__(idl_filename, \
					  basename, \
					  skel_filename, \
					  impl_suffix, \
					  ignore_operations, \
					  fd_h, \
					  fd_cpp)
	ifs = cxx_svc_impl.run(tree)
	file.close()
	_omniidl.clear()
	return ifs
コード例 #4
0
ファイル: omni.py プロジェクト: stefanseefeld/synopsis
def parse(ir, cppfile, src, primary_file_only,
          base_path, verbose, debug):
   global basename, strip, sourcefile

   if base_path:
      basename = base_path

   _omniidl.keepComments(1)
   _omniidl.noForwardWarning()
   tree = _omniidl.compile(open(cppfile, 'r+'))
   if tree == None:
      sys.stderr.write("omni: Error parsing %s\n"%cppfile)
      sys.exit(1)

   sourcefile = SourceFile(strip_filename(src), src, 'IDL')
   sourcefile.annotations['primary'] = True
   new_ir = IR.IR()
   new_ir.files[sourcefile.name] = sourcefile
   type_trans = TypeTranslator(new_ir.asg.types)
   ast_trans = ASGTranslator(new_ir.asg.declarations, type_trans, primary_file_only)
   tree.accept(ast_trans)
   sourcefile.declarations[:] = new_ir.asg.declarations
   ir.merge(new_ir)
   _omniidl.clear()
   return ir
コード例 #5
0
ファイル: cxx_svc_impl.py プロジェクト: ogata-lab/rtmsdk-mac
def generate(idl_file, preproc_args, impl_suffix, skel_suffix = "Skel", fd_h=None, fd_cpp=None):
	basename = idl_file.replace(".idl","")
	preprocessor_cmd = "omnicpp"
	preprocessor_opt = "-I" + string.join(preproc_args, " -I")

	preproc_cmd = '%s %s %s' % (preprocessor_cmd,\
				  preprocessor_opt, idl_file)

	file = os.popen(preproc_cmd, "r")

	skel_filename = basename + skel_suffix + ".h"
	idl_filename = idl_file

	# ignore the following operations
	ignore_operations = ["profile"]
	
	tree = _omniidl.compile(file)
	ast.__init__(tree)

	cxx_svc_impl.__init__(idl_filename, \
					  basename, \
					  skel_filename, \
					  impl_suffix, \
					  ignore_operations, \
					  fd_h, \
					  fd_cpp)
	ifs = cxx_svc_impl.run(tree)
	file.close()
	_omniidl.clear()
	return ifs
コード例 #6
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 Exception, e:
        print e
        ints = []
        #print popen_cmd
        #print filename
        pass
コード例 #7
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 Exception, e:
        print e
        ints = []
        #print popen_cmd
        #print filename
        pass
コード例 #8
0
        exit
    tmpdir = options.tmpdir
    idlfile = os.path.abspath(idlfile)
    idldir = os.path.split(idlfile)[0]
    basedir = os.path.split(idldir)[0]
    if options.package_name:
        pkgname = options.package_name
    else:
        pkgname = os.path.split(basedir)[1]  # global var

    # preproccess and compile idl
    if options.idlpath:
        pathlist = options.idlpath.strip('"')
        option = ' '.join(
            ['-I' + d for d in filter(None, pathlist.split(' '))])
    else:
        option = ''

    fd = os.popen('/usr/bin/omnicpp %s "%s"' % (option, idlfile), 'r')
    try:
        tree = _omniidl.compile(fd, idlfile)  # newer version API
    except:
        tree = _omniidl.compile(fd)  # old version API

    # output msg/srv and bridge component src
    if options.interfaces:
        tree.accept(InterfaceNameVisitor())
    else:
        tree.accept(ServiceVisitor())
        tree.accept(InterfaceNameVisitor())
コード例 #9
0
ファイル: idl2srv.py プロジェクト: emijah/rtmros_common
    idlfile = options.idlfile
    if not os.path.exists(idlfile):
        exit
    tmpdir = options.tmpdir
    idlfile = os.path.abspath(idlfile)
    idldir = os.path.split(idlfile)[0]
    basedir = os.path.split(idldir)[0]
    if options.package_name:
        pkgname = options.package_name
    else:
        pkgname = os.path.split(basedir)[1] # global var

    # preproccess and compile idl
    if options.idlpath:
        pathlist = options.idlpath.strip('"')
        option = ' '.join(['-I'+d for d in pathlist.split(' ')])
    else:
        option = ''

    fd = os.popen('/usr/bin/omnicpp %s "%s"' % (option, idlfile), 'r')
    try:
        tree = _omniidl.compile(fd, idlfile) # newer version API
    except:
        tree = _omniidl.compile(fd)          # old version API

    # output msg/srv and bridge component src
    if options.interfaces:
        tree.accept(InterfaceNameVisitor())
    else:
        tree.accept(ServiceVisitor())
コード例 #10
0
                file = os.popen(preproc_cmd, "r")

        else:  # No preprocessor
            file = name

        if verbose: sys.stderr.write(cmdname + ": Running front end\n")

        if dump_only:
            if verbose:
                sys.stderr.write(cmdname + ": Dumping\n")
            _omniidl.dump(file, name)
            if not isinstance(file, StringType):
                file.close()
            if temp_file: os.remove(temp_file)
        else:
            tree = _omniidl.compile(file, name)

            if not isinstance(file, StringType):
                if file.close():
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    sys.exit(1)

            if tree is None:
                sys.exit(1)

            if cd_to is not None:
                old_wd = os.getcwd()
                os.chdir(cd_to)
コード例 #11
0
ファイル: main.py プロジェクト: kaihumuc/openhrp
                file = os.popen(preproc_cmd, "r")

        else: # No preprocessor
            file = name

        if verbose: sys.stderr.write(cmdname + ": Running front end\n")

        if dump_only:
            if verbose:
                sys.stderr.write(cmdname + ": Dumping\n")
            _omniidl.dump(file, name)
            if not isinstance(file, StringType):
                file.close()
            if temp_file: os.remove(temp_file)
        else:
            tree = _omniidl.compile(file, name)

            if not isinstance(file, StringType):
                if file.close():
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    sys.exit(1)

            if tree is None:
                sys.exit(1)

            if cd_to is not None:
                old_wd = os.getcwd()
                os.chdir(cd_to)
            
コード例 #12
0
ファイル: main.py プロジェクト: orioli/MAID-ROBOT
                file = os.popen(preproc_cmd, "r")

        else: # No preprocessor
            file = name

        if verbose: sys.stderr.write(cmdname + ": Running front end\n")

        if dump_only:
            if verbose:
                sys.stderr.write(cmdname + ": Dumping\n")
            _omniidl.dump(file)
            if not isinstance(file, StringType):
                file.close()
            if temp_file: os.remove(temp_file)
        else:
            tree = _omniidl.compile(file)

            if not isinstance(file, StringType):
                if file.close():
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    sys.exit(1)

            if tree is None:
                sys.exit(1)

            if cd_to is not None:
                old_wd = os.getcwd()
                os.chdir(cd_to)
            
コード例 #13
0
def parseOmniIdlArgs(args):
    global preprocessor_args, preprocessor_only, preprocessor_cmd
    global no_preprocessor, backend, backend_args, dump_only, cd_to
    global verbose, quiet, print_usage, interactive, temp_file

    files = parseArgs(args)

    if _omniidl.alwaysTempFile():
        temp_file = genTempFileName()

    #if len(backends) == 0 and \
    #   not (quiet or dump_only or preprocessor_only or interactive):
    #    sys.stderr.write(cmdname + ": Warning: No back-ends specified; " \
    #                     "checking IDL for validity\n")

    for name in files:
        if name != "-" and not os.path.isfile(name):
            if not quiet:
                sys.stderr.write(cmdname + ": '" + name + "' does not exist\n")
            raise Exception

        if sys.platform != 'OpenVMS' or len(preprocessor_args)==0:
            preproc_cmd = '%s %s "%s"' % (preprocessor_cmd,
                                          string.join(preprocessor_args, ' '),
                                          name)
        else:
            preproc_cmd = '%s "%s" %s' % (preprocessor_cmd,
                                          string.join(preprocessor_args,'" "'),
                                          name)
        if not no_preprocessor:
            if verbose:
                sys.stderr.write(cmdname + ": Preprocessing '" +\
                                 name + "' with '" + preproc_cmd + "'\n")

            if preprocessor_only:
                err = os.system(preproc_cmd)
                if err:
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    raise Exception
                raise Exception

            if temp_file:
                if verbose:
                    sys.stderr.write(cmdname + \
                                     ": cpp output to temporary file '" + \
                                     temp_file + "'\n")
                err = os.system(preproc_cmd + " >" + temp_file)
                if err:
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    try:
                        os.remove(temp_file)
                    except:
                        pass
                    sys.exit(1)
                file = temp_file

            else:
                file = os.popen(preproc_cmd, "r")

        else: # No preprocessor
            file = name

        if verbose: sys.stderr.write(cmdname + ": Running front end\n")

        tree = _omniidl.compile(file)

        if not isinstance(file, StringType):
            if file.close():
                if not quiet:
                    sys.stderr.write(cmdname + \
                                     ": Error running preprocessor\n")
                sys.exit(1)

        if temp_file and not no_preprocessor:
            os.remove(temp_file)
    
            #idlast.clear()
            #idltype.clear()
            #_omniidl.clear()
    return tree
コード例 #14
0
def main(argv=None):
    global preprocessor_args, preprocessor_only, preprocessor_cmd
    global no_preprocessor, backend, backend_args, dump_only, cd_to
    global verbose, quiet, print_usage, interactive, temp_file

    if argv is None: argv = sys.argv

    files = parseArgs(argv[1:])

    if _omniidl.alwaysTempFile():
        temp_file = genTempFileName()

    if print_usage:
        usage()

    elif len(files) == 0:
        if not quiet:
            sys.stderr.write(cmdname + ": No files specified. Use '" \
                             + cmdname + " -u' for usage.\n")
        sys.exit(1)

    # Import back-ends, and add any pre-processor arguments
    bemodules = []
    for backend in backends:
        if verbose:
            sys.stderr.write(cmdname + ": Importing back-end '" +\
                             backend + "'\n")
        try:
            be = be_import(backend)
        except ImportError as msg:
            if not quiet:
                sys.stderr.write(cmdname + \
                                 ": Could not import back-end '" + \
                                 backend + "'\n")
                sys.stderr.write(cmdname + \
                                 ": Maybe you need to use the -p option?\n")
                sys.stderr.write(cmdname + \
                                 ": (The error was '" + str(msg) + "')\n")
            sys.exit(1)

        if verbose:
            if hasattr(be, "__file__"):
                sys.stderr.write(cmdname + ": '" + backend + \
                                 "' imported from '" + be.__file__ + "'\n")
            else:
                sys.stderr.write(cmdname + ": '" + backend + \
                                 "' imported from unknown file\n")

        bemodules.append(be)
        if hasattr(be, "cpp_args"):
            preprocessor_args.extend(be.cpp_args)

        if print_usage and hasattr(be, "usage_string"):
            print("\nArguments for back-end '" + backend + "':\n")
            print(be.usage_string)

    if print_usage:
        sys.exit(0)

    if len(backends) == 0 and \
       not (quiet or dump_only or preprocessor_only or interactive):
        sys.stderr.write(cmdname + ": Warning: No back-ends specified; " \
                         "checking IDL for validity\n")

    for name in files:
        if name != "-" and not os.path.isfile(name):
            if not quiet:
                sys.stderr.write(cmdname + ": '" + name + "' does not exist\n")
            sys.exit(1)

        if sys.platform != 'OpenVMS' or len(preprocessor_args) == 0:
            preproc_cmd = '%s %s "%s"' % (preprocessor_cmd,
                                          " ".join(preprocessor_args), name)
        else:
            preproc_cmd = '%s "%s" %s' % (preprocessor_cmd,
                                          '" "'.join(preprocessor_args), name)
        if not no_preprocessor:
            if verbose:
                sys.stderr.write(cmdname + ": Preprocessing '" +\
                                 name + "' with '" + preproc_cmd + "'\n")

            if preprocessor_only:
                err = os.system(preproc_cmd)
                if err:
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    sys.exit(1)
                sys.exit(0)

            if temp_file:
                if verbose:
                    sys.stderr.write(cmdname + \
                                     ": cpp output to temporary file '" + \
                                     temp_file + "'\n")
                err = os.system(preproc_cmd + " >" + temp_file)
                if err:
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    try:
                        os.remove(temp_file)
                    except:
                        pass
                    sys.exit(1)
                file = temp_file

            else:
                file = os.popen(preproc_cmd, "r")

        else:  # No preprocessor
            file = name

        if verbose: sys.stderr.write(cmdname + ": Running front end\n")

        if dump_only:
            if verbose:
                sys.stderr.write(cmdname + ": Dumping\n")
            _omniidl.dump(file, name)
            if not isinstance(file, StringType):
                file.close()
            if temp_file: os.remove(temp_file)
        else:
            tree = _omniidl.compile(file, name)

            if not isinstance(file, StringType):
                if file.close():
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    sys.exit(1)

            if tree is None:
                sys.exit(1)

            if cd_to is not None:
                old_wd = os.getcwd()
                os.chdir(cd_to)

            i = 0
            for backend in backends:
                if verbose:
                    sys.stderr.write(cmdname + ": Running back-end '" +\
                                     backend + "'\n")

                bemodules[i].run(tree, backends_args[i])
                i = i + 1

            if interactive:
                if verbose:
                    sys.stderr.write(cmdname + ": Entering interactive loop\n")

                idlast.tree = tree
                _omniidl.runInteractiveLoop()
                del idlast.tree

            if cd_to is not None:
                os.chdir(old_wd)

            if temp_file and not no_preprocessor:
                os.remove(temp_file)

            idlast.clear()
            idltype.clear()
            _omniidl.clear()
コード例 #15
0
ファイル: main.py プロジェクト: DiegoReiriz/p2p-corba
def main(argv=None):
    global preprocessor_args, preprocessor_only, preprocessor_cmd
    global no_preprocessor, backend, backend_args, dump_only, cd_to
    global verbose, quiet, print_usage, interactive, temp_file

    if argv is None: argv = sys.argv

    files = parseArgs(argv[1:])

    if _omniidl.alwaysTempFile():
        temp_file = genTempFileName()

    if print_usage:
        usage()        

    elif len(files) == 0:
        if not quiet:
            sys.stderr.write(cmdname + ": No files specified. Use '" \
                             + cmdname + " -u' for usage.\n")
        sys.exit(1)

    # Import back-ends, and add any pre-processor arguments
    bemodules = []
    for backend in backends:
        if verbose:
            sys.stderr.write(cmdname + ": Importing back-end '" +\
                             backend + "'\n")
        try:
            be = be_import(backend)
        except ImportError as msg:
            if not quiet:
                sys.stderr.write(cmdname + \
                                 ": Could not import back-end '" + \
                                 backend + "'\n")
                sys.stderr.write(cmdname + \
                                 ": Maybe you need to use the -p option?\n")
                sys.stderr.write(cmdname + \
                                 ": (The error was '" + str(msg) + "')\n")
            sys.exit(1)

        if verbose:
            if hasattr(be, "__file__"):
                sys.stderr.write(cmdname + ": '" + backend + \
                                 "' imported from '" + be.__file__ + "'\n")
            else:
                sys.stderr.write(cmdname + ": '" + backend + \
                                 "' imported from unknown file\n")

        bemodules.append(be)
        if hasattr(be, "cpp_args"):
            preprocessor_args.extend(be.cpp_args)

        if print_usage and hasattr(be, "usage_string"):
            print("\nArguments for back-end '" + backend + "':\n")
            print(be.usage_string)

    if print_usage:
        sys.exit(0)

    if len(backends) == 0 and \
       not (quiet or dump_only or preprocessor_only or interactive):
        sys.stderr.write(cmdname + ": Warning: No back-ends specified; " \
                         "checking IDL for validity\n")

    for name in files:
        if name != "-" and not os.path.isfile(name):
            if not quiet:
                sys.stderr.write(cmdname + ": '" + name + "' does not exist\n")
            sys.exit(1)

        if sys.platform != 'OpenVMS' or len(preprocessor_args)==0:
            preproc_cmd = '%s %s "%s"' % (preprocessor_cmd,
                                          " ".join(preprocessor_args),
                                          name)
        else:
            preproc_cmd = '%s "%s" %s' % (preprocessor_cmd,
                                          '" "'.join(preprocessor_args),
                                          name)
        if not no_preprocessor:
            if verbose:
                sys.stderr.write(cmdname + ": Preprocessing '" +\
                                 name + "' with '" + preproc_cmd + "'\n")

            if preprocessor_only:
                err = os.system(preproc_cmd)
                if err:
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    sys.exit(1)
                sys.exit(0)

            if temp_file:
                if verbose:
                    sys.stderr.write(cmdname + \
                                     ": cpp output to temporary file '" + \
                                     temp_file + "'\n")
                err = os.system(preproc_cmd + " >" + temp_file)
                if err:
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    try:
                        os.remove(temp_file)
                    except:
                        pass
                    sys.exit(1)
                file = temp_file

            else:
                file = os.popen(preproc_cmd, "r")

        else: # No preprocessor
            file = name

        if verbose: sys.stderr.write(cmdname + ": Running front end\n")

        if dump_only:
            if verbose:
                sys.stderr.write(cmdname + ": Dumping\n")
            _omniidl.dump(file, name)
            if not isinstance(file, StringType):
                file.close()
            if temp_file: os.remove(temp_file)
        else:
            tree = _omniidl.compile(file, name)

            if not isinstance(file, StringType):
                if file.close():
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    sys.exit(1)

            if tree is None:
                sys.exit(1)

            if cd_to is not None:
                old_wd = os.getcwd()
                os.chdir(cd_to)
            
            i = 0
            for backend in backends:
                if verbose:
                    sys.stderr.write(cmdname + ": Running back-end '" +\
                                     backend + "'\n")

                bemodules[i].run(tree, backends_args[i])
                i = i + 1

            if interactive:
                if verbose:
                    sys.stderr.write(cmdname + ": Entering interactive loop\n")

                idlast.tree = tree
                _omniidl.runInteractiveLoop()
                del idlast.tree

            if cd_to is not None:
                os.chdir(old_wd)

            if temp_file and not no_preprocessor:
                os.remove(temp_file)

            idlast.clear()
            idltype.clear()
            _omniidl.clear()
コード例 #16
0
def parseOmniIdlArgs(args):
    global preprocessor_args, preprocessor_only, preprocessor_cmd
    global no_preprocessor, backend, backend_args, dump_only, cd_to
    global verbose, quiet, print_usage, interactive, temp_file

    files = parseArgs(args)

    if _omniidl.alwaysTempFile():
        temp_file = genTempFileName()

    #if len(backends) == 0 and \
    #   not (quiet or dump_only or preprocessor_only or interactive):
    #    sys.stderr.write(cmdname + ": Warning: No back-ends specified; " \
    #                     "checking IDL for validity\n")

    for name in files:
        if name != "-" and not os.path.isfile(name):
            if not quiet:
                sys.stderr.write(cmdname + ": '" + name + "' does not exist\n")
            raise Exception

        if sys.platform != 'OpenVMS' or len(preprocessor_args) == 0:
            preproc_cmd = '%s %s "%s"' % (
                preprocessor_cmd, string.join(preprocessor_args, ' '), name)
        else:
            preproc_cmd = '%s "%s" %s' % (
                preprocessor_cmd, string.join(preprocessor_args, '" "'), name)
        if not no_preprocessor:
            if verbose:
                sys.stderr.write(cmdname + ": Preprocessing '" +\
                                 name + "' with '" + preproc_cmd + "'\n")

            if preprocessor_only:
                err = os.system(preproc_cmd)
                if err:
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    raise Exception
                raise Exception

            if temp_file:
                if verbose:
                    sys.stderr.write(cmdname + \
                                     ": cpp output to temporary file '" + \
                                     temp_file + "'\n")
                err = os.system(preproc_cmd + " >" + temp_file)
                if err:
                    if not quiet:
                        sys.stderr.write(cmdname + \
                                         ": Error running preprocessor\n")
                    try:
                        os.remove(temp_file)
                    except:
                        pass
                    sys.exit(1)
                file = temp_file

            else:
                file = os.popen(preproc_cmd, "r")

        else:  # No preprocessor
            file = name

        if verbose: sys.stderr.write(cmdname + ": Running front end\n")

        tree = _omniidl.compile(file)

        if not isinstance(file, StringType):
            if file.close():
                if not quiet:
                    sys.stderr.write(cmdname + \
                                     ": Error running preprocessor\n")
                sys.exit(1)

        if temp_file and not no_preprocessor:
            os.remove(temp_file)

            #idlast.clear()
            #idltype.clear()
            #_omniidl.clear()
    return tree