[Synopsis-changes] Synopsis/Synopsis/Synopsis/Processors XRefCompiler.py,1.6,1.7

Stefan Seefeld stefan at synopsis.fresco.org
Mon Nov 17 01:26:20 UTC 2003


Update of /cvs/synopsis/Synopsis/Synopsis/Processors
In directory frida:/tmp/cvs-serv14652/Synopsis/Processors

Modified Files:
	XRefCompiler.py 
Log Message:
use 'xref_prefix' and 'output' instead of 'xref_path' and 'xref_file'

Index: XRefCompiler.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Processors/XRefCompiler.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -d -r1.6 -r1.7
--- XRefCompiler.py	11 Nov 2003 06:03:59 -0000	1.6
+++ XRefCompiler.py	17 Nov 2003 01:26:18 -0000	1.7
@@ -10,7 +10,7 @@
 from Synopsis.Processor import Processor, Parameter
 from Synopsis import AST, Type, Util
 
-import string, cPickle, urllib
+import os.path, string, cPickle, urllib
 
 class XRefCompiler(Processor):
    """This class compiles a set of text-based xref files from the C++ parser
@@ -30,8 +30,7 @@ class XRefCompiler(Processor):
    dictionary.
    """
 
-   xref_path = Parameter('./%s-xref', '')
-   xref_file = Parameter('compiled.xref', '')
+   xref_prefix = Parameter('', 'where to look for xref files')
    no_locals = Parameter(True, '')
 
    def process(self, ast, **kwds):
@@ -41,12 +40,17 @@ class XRefCompiler(Processor):
 
       filenames = map(lambda x: x[0], 
                       filter(lambda x: x[1].is_main(), ast.files().items()))
-      filenames = map(lambda x:self.xref_path%x, filenames)
-      self.do_compile(filenames, self.xref_file, self.no_locals)
+      filenames = map(lambda x:os.path.join(self.xref_prefix, x), filenames)
+      self.do_compile(filenames, self.output, self.no_locals)
 
-      return self.output_and_return_ast()
+      return self.ast
+
+   def do_compile(self, input_files, output, no_locals):
+
+      if not output:
+         if self.verbose: print "XRefCompiler: no output given"
+         return
 
-   def do_compile(self, input_files, output_file, no_locals):
       # Init data structures
       data = {}
       index = {}
@@ -110,8 +114,8 @@ class XRefCompiler(Processor):
          if paren != -1:
             index.setdefault(name[:paren],[]).append(target)
 
-      if self.verbose: print "XRefCompiler: Writing",output_file
-      f = open(output_file, 'wb')
+      if self.verbose: print "XRefCompiler: Writing",output
+      f = open(output, 'wb')
       cPickle.dump(file_data, f)
       f.close()
 





More information about the Synopsis-changes mailing list