From stefan at synopsis.fresco.org Wed Nov 5 01:57:03 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:42 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/bin synopsis,1.8,1.9 Message-ID: Update of /cvs/synopsis/Synopsis/bin In directory frida:/tmp/cvs-serv10236/bin Modified Files: synopsis Log Message: rename C++ -> Cxx Index: synopsis =================================================================== RCS file: /cvs/synopsis/Synopsis/bin/synopsis,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -d -r1.8 -r1.9 --- synopsis 21 Sep 2003 19:37:49 -0000 1.8 +++ synopsis 5 Nov 2003 01:57:00 -0000 1.9 @@ -164,6 +164,9 @@ def parseArgs(args): o,a = opt if o == "-p" or o == "--parser": + # accept old 'C++' name for backward compatibility + if a == 'C++': + a = 'Cxx' parser_cmd = a config_args['parser'] = a From stefan at synopsis.fresco.org Wed Nov 5 01:57:03 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:42 2005 Subject: [Synopsis-changes] Synopsis/Synopsis setup.py,1.7,1.8 autogen.sh,1.2,1.3 Message-ID: Update of /cvs/synopsis/Synopsis In directory frida:/tmp/cvs-serv10236 Modified Files: setup.py autogen.sh Log Message: rename C++ -> Cxx Index: setup.py =================================================================== RCS file: /cvs/synopsis/Synopsis/setup.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -d -r1.7 -r1.8 --- setup.py 7 Oct 2003 03:52:22 -0000 1.7 +++ setup.py 5 Nov 2003 01:56:59 -0000 1.8 @@ -31,7 +31,7 @@ py_packages = ["Synopsis", "Synopsis.Core", "Synopsis.Parser", "Synopsis.Parser.IDL", "Synopsis.Parser.Python", - "Synopsis.Parser.C", "Synopsis.Parser.C++", + "Synopsis.Parser.C", "Synopsis.Parser.Cxx", "Synopsis.Linker", "Synopsis.Formatter", "Synopsis.Formatter.HTML", @@ -39,8 +39,8 @@ py_packages = ["Synopsis", "Synopsis.UI.Qt"] ext_modules = [('Synopsis/Parser/C', 'ctool' + module_ext), - ('Synopsis/Parser/C++', 'occ' + module_ext), - ('Synopsis/Parser/C++', 'link' + module_ext), + ('Synopsis/Parser/Cxx', 'occ' + module_ext), + ('Synopsis/Parser/Cxx', 'link' + module_ext), ] scripts = ['synopsis', 'synopsis-qt', 'compile-xref', 'search-xref'] Index: autogen.sh =================================================================== RCS file: /cvs/synopsis/Synopsis/autogen.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- autogen.sh 18 Sep 2003 04:10:05 -0000 1.2 +++ autogen.sh 5 Nov 2003 01:56:59 -0000 1.3 @@ -10,5 +10,5 @@ conf() } conf Synopsis/Parser/C -conf Synopsis/Parser/C++ -conf Synopsis/Parser/C++/gc +conf Synopsis/Parser/Cxx +conf Synopsis/Parser/Cxx/gc From stefan at synopsis.fresco.org Wed Nov 5 01:57:03 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:43 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/dist/command build_doc.py,1.3,1.4 config.py,1.4,1.5 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/dist/command In directory frida:/tmp/cvs-serv10236/Synopsis/dist/command Modified Files: build_doc.py config.py Log Message: rename C++ -> Cxx Index: build_doc.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/dist/command/build_doc.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- build_doc.py 9 Oct 2003 20:30:08 -0000 1.3 +++ build_doc.py 5 Nov 2003 01:57:00 -0000 1.4 @@ -82,7 +82,7 @@ class build_doc(build.build): filter(lambda f, re=py: re.match(f), names))) def add_cxx(arg, dirname, names): # only parse the C++ parser for now - if dirname[:19] != 'Synopsis/Parser/C++': + if dirname[:19] != 'Synopsis/Parser/Cxx': return arg.extend(map(lambda f, d=dirname: os.path.join(d, f), filter(lambda f, re=cxx: re.match(f), names))) @@ -106,7 +106,7 @@ class build_doc(build.build): py_syn = Target(self, synopsis + " -o %(output)s %(input)s", py_syns, output='py.syn', input=map(lambda f:re.sub('\.py$', '.syn', f), py_sources)) - command = synopsis + " -I ../../Synopsis/Parser/C++ -I ../../Synopsis/Parser/C++/gc/include -I " + sysconfig.get_python_inc() + command = synopsis + " -I ../../Synopsis/Parser/Cxx -I ../../Synopsis/Parser/CXX/gc/include -I " + sysconfig.get_python_inc() command += " -Wc,parser=C++,linker=C++ -Wp,-s,syn/%s-links,%s" cxx_syns = map(lambda f,s=self:Target(s, command%(f[0], f[1]) + " -o %(output)s %(input)s", [], output=f[0] + ".syn", @@ -123,7 +123,7 @@ class build_doc(build.build): [py_syn], output="core-type.syn", input=['py.syn']) core_util_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Core::Util' -o %(output)s %(input)%", [py_syn], output="core-util.syn", input=['py.syn']) - parser_cxx_py_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Parser::C++' -o %(output)s %(input)%", + parser_cxx_py_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Parser::Cxx' -o %(output)s %(input)%", [py_syn], output="parser-c++-py.syn", input=['py.syn']) parser_cxx_cpp_syn = Target(self, synopsis + " -Wc,linker=All -o %(output)s %(input)%", [py_syn], output="parser-c++-cpp.syn", input=['py.syn']) Index: config.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/dist/command/config.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -d -r1.4 -r1.5 --- config.py 21 Sep 2003 19:56:46 -0000 1.4 +++ config.py 5 Nov 2003 01:57:00 -0000 1.5 @@ -44,7 +44,7 @@ class config(build.build): for ext in self.extensions: self.config_extension(ext) if not self.disable_gc: - self.config_extension('Synopsis/Parser/C++/gc') + self.config_extension('Synopsis/Parser/Cxx/gc') def config_extension(self, ext): @@ -61,7 +61,7 @@ class config(build.build): os.chdir(tempdir) command = "%s/configure --with-python=%s"%(srcdir, sys.executable) - if ext == 'Synopsis/Parser/C++' and self.disable_gc: + if ext == 'Synopsis/Parser/Cxx' and self.disable_gc: command += ' --disable-gc' self.announce(command) spawn(['sh', '-c', command], self.verbose, self.dry_run) From stefan at synopsis.fresco.org Wed Nov 5 01:57:03 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:43 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis Config.py,1.23,1.24 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis In directory frida:/tmp/cvs-serv10236/Synopsis Modified Files: Config.py Log Message: rename C++ -> Cxx Index: Config.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Config.py,v retrieving revision 1.23 retrieving revision 1.24 diff -u -p -d -r1.23 -r1.24 --- Config.py 9 Oct 2003 05:02:39 -0000 1.23 +++ Config.py 5 Nov 2003 01:57:00 -0000 1.24 @@ -124,9 +124,9 @@ class Base: main_file = 1 def __init__(self, argv): if argv.has_key('verbose'): self.verbose = 1 - class CXX: + class Cxx: """Config object for the C++ parser. - @attr name Name of this config object: 'C++' + @attr name Name of this config object: 'Cxx' @attr verbose Verbosity flag. This attribute is set by __init__(), but only if 'verbose' was passed as a config option. @attr main_file Flag that selects if should only store the AST @@ -189,9 +189,9 @@ class Base: should have a Simple rule first which is the main sourcefile, and any number of other rules to select other files to record the AST for. - @see Synopsis.Parser.C++.__init__ + @see Synopsis.Parser.Cxx.__init__ """ - name = 'C++' + name = 'Cxx' include_path = [] def __init__(self, argv): if argv.has_key('verbose'): self.verbose = 1 @@ -213,7 +213,7 @@ class Base: if argv.has_key('verbose'): self.verbose = 1 self.main_file = 1 - modules = {'C++': CXX, + modules = {'Cxx': Cxx, 'IDL': IDL, 'Python': Python} From stefan at synopsis.fresco.org Wed Nov 5 17:17:32 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:43 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Core Processor.py,1.1,1.2 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Core In directory frida:/tmp/cvs-serv32101/Synopsis/Core Modified Files: Processor.py Log Message: refined the 'process()' handling of arguments; more convenience Processors Index: Processor.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Core/Processor.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -d -r1.1 -r1.2 --- Processor.py 30 Oct 2003 05:54:36 -0000 1.1 +++ Processor.py 5 Nov 2003 17:17:29 -0000 1.2 @@ -2,11 +2,12 @@ # # Copyright (C) 2003 Stefan Seefeld # All rights reserved. -# Licensed to the public under the terms of the GNU GPL (>= 2), +# Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import sys +import AST class Processor(object): """Processor overrides the __new__ operator @@ -70,9 +71,68 @@ class Processor(object): """Use named values to override default attributes.""" self.__dict__.update(kwds); - def process(self, **kwds): - """provide the processor specific code here""" - self.__dict__.update(kwds); + def process(self, ast, **kwds): + """The process method provides the interface to be implemented by subclasses. + + Commonly used arguments are 'input' and 'output'. If 'input' is defined, + it is interpreted as one or more input file names. Of 'output' is defined, it + is interpreted as an output file (or directory) name.""" + return ast + +class Composite(Processor): + """A Composite processor.""" + + processors=[] + + def __init__(self, *processors, **kwds): + """This __init__ is a convenience constructor that takes a var list + to list the desired processors. If the named values contain 'processors', + they override the var list.""" + self.processors = processors + self.__dict__.update(kwds) + + def process(self, ast, **kwds): + """apply a list of processors. The 'input' value is passed to the first + processor only, the 'output' to the last.""" + + if not self.processors: + return ast + + elif len(self.processors) == 1: + return self.processors(ast, **kwds) + + # first_kwds is a copy of kwds, but without 'output' defined + first_kwds = kwds.copy() + if first_kwds.has_key('output'): + del first_kwds['output'] + # last_kwds is a copy of kwds, but without 'input' defined + last_kwds = kwds.copy() + if last_kwds.has_key('input'): + del last_kwds['input'] + # remove 'input' and 'output' from kwds for all other processors + # in the pipeline + if kwds.has_key('input'): + del kwds['input'] + if kwds.has_key('output'): + del kwds['output'] + + ast = self.processors[0].process(ast, **first_kwds) + + if len(self.processors) > 2: + for p in self.processors[1:-1]: + ast = p.process(ast, **kwds) + + return self.processors[-1].process(ast, **last_kwds) + +class Store(Processor): + + output='' + + def process(self, ast, **kwds): + """Simply store the current ast in the 'output' file.""" + self.__dict__.update(kwds) + AST.save(self.output, ast) + return ast def error(msg): """Write an error message and exit.""" @@ -94,19 +154,30 @@ def process(**kwds): command = sys.argv[1] props = {} args = sys.argv[2:] - while args and args[0].find('=') != -1: - l = args[0].split('=') - if len(l) < 2: - raise Error, 'argument "%s" not propname=value'%args[0] - key, value = l[0], '='.join(l[1:]) - if value: - try: - props[key] = eval(value) - except: - error("""an error occured trying to evaluate \'%s\' -to pass this as a string, please use %s="'%s'" """%(value, key, value)) + # process all option arguments (i.e. those containing a '=' + while args: + arg = args[0] + if arg.find('=') == -1 and not arg.startswith('--'): + break + attribute = arg.split('=', 1) + if len(attribute) == 2: + name, value = attribute + if name.startswith('--'): + props[name[2:]] = value # it's a string + else: + try: + props[name] = eval(value) # it's a python expression + except: + error("""an error occured trying to evaluate the value of \'%s\' (\'%s\') +to pass this as a string, please use %s="'%s'" """%(name, value, name, value)) else: - props[key] = None + name = attribute[0] + if name.startswith('--'): + props[name[2:]] = True # flag the attribute as 'set' + else: + # the nearest thing to 'no python expression' + # is None... + props[name] = None args = args[1:] # remaining arguments are mapped to the 'input' value, @@ -115,15 +186,10 @@ to pass this as a string, please use %s= props['input'] = args if command in kwds: + ast = AST.AST() try: - kwds[command].process(**props) + kwds[command].process(ast, **props) except KeyError, e: error('missing argument "%s"'%e) else: error('no command "%s"'%command) - -# -# $Log$ -# Revision 1.1 2003/10/30 05:54:36 stefan -# add Processor base class -# From stefan at synopsis.fresco.org Wed Nov 5 17:21:52 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:43 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parser/Python Parser.py,1.1,1.2 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parser/Python In directory frida:/tmp/cvs-serv32245/Synopsis/Parser/Python Modified Files: Parser.py Log Message: adapt to new Processor interface Index: Parser.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/Python/Parser.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -d -r1.1 -r1.2 --- Parser.py 30 Oct 2003 05:54:36 -0000 1.1 +++ Parser.py 5 Nov 2003 17:21:50 -0000 1.2 @@ -2,23 +2,22 @@ # # Copyright (C) 2003 Stefan Seefeld # All rights reserved. -# Licensed to the public under the terms of the GNU GPL (>= 2), +# Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Core.Processor import Processor +from Synopsis.Core import AST from python import parse class Parser(Processor): basename='' - def process(self, **kwds): + def process(self, ast, **kwds): for file in kwds['input']: - print file - parse(file, 0, {}, None) -# -# $Log$ -# Revision 1.1 2003/10/30 05:54:36 stefan -# add Processor base class -# + ast.merge(parse(file, 0, {}, None)) + output = kwds.get('output') + if output: + AST.save(output, ast) + return ast From stefan at synopsis.fresco.org Wed Nov 5 17:23:03 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:43 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parser/Cxx/syn filter.cc,1.5,1.6 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/syn In directory frida:/tmp/cvs-serv32272/Synopsis/Parser/Cxx/syn Modified Files: filter.cc Log Message: add trailing '/' if not yet set Index: filter.cc =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/syn/filter.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -d -r1.5 -r1.6 --- filter.cc 16 Jan 2003 17:14:10 -0000 1.5 +++ filter.cc 5 Nov 2003 17:23:01 -0000 1.6 @@ -150,6 +150,9 @@ void FileFilter::set_xref_filename(const void FileFilter::set_syntax_prefix(const char* filename) { m->syntax_prefix = filename; + if (m->syntax_prefix.size() > 0 + && m->syntax_prefix[m->syntax_prefix.size()-1] != '/') + m->syntax_prefix.append("/"); m->syntax = Private::Prefix; } @@ -157,6 +160,9 @@ void FileFilter::set_syntax_prefix(const void FileFilter::set_xref_prefix(const char* filename) { m->xref_prefix = filename; + if (m->xref_prefix.size() > 0 + && m->xref_prefix[m->xref_prefix.size()-1] != '/') + m->xref_prefix.append("/"); m->xref = Private::Prefix; } From stefan at synopsis.fresco.org Wed Nov 5 17:36:59 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:43 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parser/Cxx Parser.py,NONE,1.1 __init__.py,1.8,1.9 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx In directory frida:/tmp/cvs-serv32648/Synopsis/Parser/Cxx Modified Files: __init__.py Added Files: Parser.py Log Message: C++ parser fe refactoring to suite the Processor interface --- NEW FILE: Parser.py --- # $Id: Parser.py,v 1.1 2003/11/05 17:36:55 stefan Exp $ # # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Parser for C++ using OpenC++ for low-level parsing. This parser is written entirely in C++, and compiled into shared libraries for use by python. @see C++/Synopsis @see C++/SWalker """ from Synopsis.Core.Processor import Processor from Synopsis.Core import AST import occ class Parser(Processor): cppflags = [] main_file_only = True preprocessor = 'gcc' base_path = '' extract_tails = True syntax_prefix = None xref_prefix = None def process(self, ast, **kwds): self.__dict__.update(kwds) for file in self.input: ast = occ.parse(ast, file, [], self.verbose, self.main_file_only, self.base_path, self.preprocessor, self.cppflags, self.extract_tails, self.syntax_prefix, self.xref_prefix) output = kwds.get('output') if output: AST.save(output, ast) return ast Index: __init__.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -d -r1.8 -r1.9 --- __init__.py 5 Jul 2003 21:36:19 -0000 1.8 +++ __init__.py 5 Nov 2003 17:36:55 -0000 1.9 @@ -1,17 +1,61 @@ -"""Parser for C++ using OpenC++ for low-level parsing. -This parser is written entirely in C++, and compiled into shared libraries for -use by python. -@see C++/Synopsis -@see C++/SWalker -""" +# $Id$ # -# configure for the parser you want here... +# Copyright (C) 2003 Stefan Seefeld +# All rights reserved. +# Licensed to the public under the terms of the GNU LGPL (>= 2), +# see the file COPYING for details. # + +from Parser import * + try: - from occ import parse, usage + import occ except: import sys print sys.exc_type, sys.exc_value import emul + +def usage(): + """Prints a usage message""" + print """ + -I Specify include path to be used by the preprocessor + -D Specify macro to be used by the preprocessor + -m Only keep declarations from the main file + -b basepath Strip basepath from start of filenames""" + +def parse(file, extra_files, args, config): + # ignore the config, as it is phased out and will be replaced + # by the processor interface + + import getopt + import occ + from Synopsis.Core import AST + + cppflags = [] + main_file = False + basepath = None + verbose = False + extract_tails = False + xref_prefix = None + syntax_prefix = None + preprocessor = None + opts,remainder = getopt.getopt(args, "I:D:mb:vtx:s:g") + for o,a in opts: + if o == '-I': cppflags.extend(['-I', a]) + elif o == '-D': cppflags.extend(['-D', a]) + elif o == '-m': main_file = True + elif o == '-b': basepath = a + elif o == '-v': verbose = True + elif o == '-t': extract_tails = True + elif o == '-x': xref_prefix = a + elif o == '-s': syntax_prefix = a + elif o == '-g': preprocessor = 'gcc' + + ast = AST.AST() + + ast = occ.parse(ast, file, [], verbose, main_file, basepath, preprocessor, + cppflags, extract_tails, syntax_prefix, xref_prefix) + + return ast # THIS-IS-A-PARSER From stefan at synopsis.fresco.org Wed Nov 5 17:36:59 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:44 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parser/Cxx/syn occ.cc,1.88,1.89 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/syn In directory frida:/tmp/cvs-serv32648/Synopsis/Parser/Cxx/syn Modified Files: occ.cc Log Message: C++ parser fe refactoring to suite the Processor interface Index: occ.cc =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/syn/occ.cc,v retrieving revision 1.88 retrieving revision 1.89 diff -u -p -d -r1.88 -r1.89 --- occ.cc 1 Aug 2003 00:23:16 -0000 1.88 +++ occ.cc 5 Nov 2003 17:36:55 -0000 1.89 @@ -24,6 +24,9 @@ // 02111-1307, USA. // $Log$ +// Revision 1.89 2003/11/05 17:36:55 stefan +// C++ parser fe refactoring to suite the Processor interface +// // Revision 1.88 2003/08/01 00:23:16 stefan // accept '-Wp,-I,' and '-Wp,-D,' // @@ -105,9 +108,16 @@ extern "C" int ucpp_main(int argc, char* /* The following aren't used anywhere. Though it has to be defined and initialized to some dummy default * values since it is required by the opencxx.a module, which I don't want to modify... */ -bool showProgram, doCompile, makeExecutable, doPreprocess, doTranslate; -bool verboseMode, regularCpp, makeSharedLibrary, preprocessTwice; -char* sharedLibraryName; +bool showProgram = false; +bool doCompile = false; +bool makeExecutable = false; +bool doPreprocess = true; +bool doTranslate = false; +bool verboseMode = false; +bool regularCpp = false; +bool makeSharedLibrary = false; +bool preprocessTwice = false; +char* sharedLibraryName = 0; /* These also are just dummies needed by the opencxx module */ void RunSoCompiler(const char *) @@ -147,7 +157,7 @@ bool syn_extract_tails, syn_use_gcc, syn bool syn_multi_files; // If set then this is stripped from the start of all filenames -const char* syn_basename = ""; +const char* syn_base_path = ""; // If set then this is the prefix for the filename to store links to const char* syn_syntax_prefix = 0; @@ -155,17 +165,11 @@ const char* syn_syntax_prefix = 0; // If set then this is the prefix for the filename to store xref info to const char* syn_xref_prefix = 0; -// If set then this is the filename to store links to -const char* syn_file_syntax = 0; - -// If set then this is the filename to store xref to -const char* syn_file_xref = 0; - // This is the compiler to emulate const char* syn_emulate_compiler = "c++"; // A list of extra filenames to store info for -std::vector* syn_extra_filenames = NULL; +std::vector syn_extra_filenames; // A place to temporarily store Python's thread state PyThreadState* pythread_save; @@ -189,191 +193,12 @@ void unexpected() throw std::bad_exception(); } -void getopts(PyObject *args, std::vector &cppflags, - std::vector &occflags, PyObject* config, PyObject* extra_files) -{ - // Initialise defaults - showProgram = doCompile = verboseMode = makeExecutable = false; - doTranslate = regularCpp = makeSharedLibrary = preprocessTwice = false; - doPreprocess = true; - sharedLibraryName = 0; - verbose = false; - syn_main_only = false; - syn_extract_tails = false; - syn_use_gcc = false; - syn_fake_std = false; - syn_multi_files = false; - Class::do_init_static(); - Metaclass::do_init_static(); - Environment::do_init_static(); - Encoding::do_init_static(); - -#define IsType(obj, type) (Py##type##_Check(obj)) - -#define OPT_FLAG(syn_flag, config_name) \ -if ((value = PyObject_GetAttrString(config, config_name)) != 0)\ - syn_flag = PyObject_IsTrue(value);\ -Py_XDECREF(value); - -#define OPT_STRING(syn_name, config_name) \ -if ((value = PyObject_GetAttrString(config, config_name)) != 0)\ -{ if (!IsType(value, String)) throw "Error: " config_name " must be a string.";\ - syn_name = PyString_AsString(value);\ -}\ -Py_XDECREF(value); - - // Check config object first - if (config) - { - PyObject* value; - OPT_FLAG(verbose, "verbose"); - OPT_FLAG(syn_main_only, "main_file"); - // Grab the include paths - if ((value = PyObject_GetAttrString(config, "include_path")) != 0) - { - if (!IsType(value, List)) - { - std::cerr << "Error: include_path must be a list of strings." << std::endl; - exit(1); - } - // Loop through the include paths - for (int i=0, end=PyList_Size(value); i < end; i++) - { - PyObject* item = PyList_GetItem(value, i); - if (!item || !IsType(item, String)) - { - std::cerr << "Error: include_path must be a list of strings." << std::endl; - exit(1); - } - // mem leak.. how to fix? - char* buf = new char[PyString_Size(item)+3]; - strcpy(buf, "-I"); - strcat(buf, PyString_AsString(item)); - cppflags.push_back(buf); - } // for - } - Py_XDECREF(value); - // Grab the list of defines - if ((value = PyObject_GetAttrString(config, "defines")) != 0) - { - if (!IsType(value, List)) - { - std::cerr << "Error: defines must be a list of strings." << std::endl; - exit(1); - } - // Loop through the include paths - for (int i=0, end=PyList_Size(value); i < end; i++) - { - PyObject* item = PyList_GetItem(value, i); - if (!item || !IsType(item, String)) - { - std::cerr << "Error: defines must be a list of strings." << std::endl; - exit(1); - } - // mem leak.. how to fix? - char* buf = new char[PyString_Size(item)+3]; - strcpy(buf, "-D"); - strcat(buf, PyString_AsString(item)); - cppflags.push_back(buf); - } // for - } - Py_XDECREF(value); - - // Basename is the prefix to strip from filenames - OPT_STRING(syn_basename, "basename"); - // Extract tails tells the parser to find tail comments - OPT_FLAG(syn_extract_tails, "extract_tails"); - // 'storage' defines the filename to write syntax hilite info to (OBSOLETE) - OPT_STRING(syn_file_syntax, "storage"); - // 'syntax_prefix' defines the prefix for the filename to write syntax hilite info to - OPT_STRING(syn_syntax_prefix, "syntax_prefix"); - // 'syntax_file' defines the filename to write syntax hilite info to - OPT_STRING(syn_file_syntax, "syntax_file"); - // 'xref_prefix' defines the prefix for the xrefname to write syntax hilite info to - OPT_STRING(syn_xref_prefix, "xref_prefix"); - // 'xref_file' defines the filename to write syntax hilite info to - OPT_STRING(syn_file_xref, "xref_file"); - // 'preprocessor' defines whether to use gcc or not - char* temp_string = NULL; - OPT_STRING(temp_string, "preprocessor"); - if (temp_string) - { - syn_use_gcc = !strcmp("gcc", temp_string); - } - // 'emulate_compiler' specifies the compiler to emulate in terms of - // include paths and macros - OPT_STRING(syn_emulate_compiler, "emulate_compiler"); - OPT_FLAG(syn_fake_std, "fake_std"); - // If multiple_files is set then the parser handles multiple files - // included from the main one at the same time (they get into the AST, - // plus they get their own xref and links files). - OPT_FLAG(syn_multi_files, "multiple_files"); - } // if config -#undef OPT_STRING -#undef OPT_FLAG -#undef IsType - - // Now check command line args - size_t argsize = PyList_Size(args); - for (size_t i = 0; i != argsize; ++i) - { - const char *argument = PyString_AsString(PyList_GetItem(args, i)); - if (strncmp(argument, "-I", 2) == 0) - { - cppflags.push_back(argument); - if (strlen(argument) == 2) - cppflags.push_back(PyString_AsString(PyList_GetItem(args, ++i))); - } - else if (strncmp(argument, "-D", 2) == 0) - { - cppflags.push_back(argument); - if (strlen(argument) == 2) - cppflags.push_back(PyString_AsString(PyList_GetItem(args, ++i))); - } - else if (strcmp(argument, "-v") == 0) - verbose = true; - else if (strcmp(argument, "-m") == 0) - syn_main_only = true; - else if (strcmp(argument, "-b") == 0) - syn_basename = PyString_AsString(PyList_GetItem(args, ++i)); - else if (strcmp(argument, "-t") == 0) - syn_extract_tails = true; - else if (strcmp(argument, "-s") == 0) - syn_file_syntax = PyString_AsString(PyList_GetItem(args, ++i)); - else if (strcmp(argument, "-x") == 0) - syn_file_xref = PyString_AsString(PyList_GetItem(args, ++i)); - else if (strcmp(argument, "-g") == 0) - syn_use_gcc = true; - else if (strcmp(argument, "-f") == 0) - syn_fake_std = true; - } - - // If multi_files is set, we check the extra_files argument to see if it - // has a list of filenames like it should do - if (extra_files && PyList_Check(extra_files)) - { - size_t extra_size = PyList_Size(extra_files); - if (extra_size > 0) - { - PyObject* item; - const char* string; - syn_extra_filenames = new std::vector; - for (size_t i = 0; i < extra_size; i++) - { - item = PyList_GetItem(extra_files, i); - string = PyString_AsString(item); - syn_extra_filenames->push_back(string); - } - } - } -} - //. Emulates the compiler in 'syn_emulate_compiler' by calling the Python //. module Synopsis.Parser.C++.emul to get a list of include paths and macros to //. add to the args vector. void emulate_compiler(std::vector& args) { - PyObject* emul_module = PyImport_ImportModule("Synopsis.Parser.C++.emul"); + PyObject* emul_module = PyImport_ImportModule("Synopsis.Parser.Cxx.emul"); if (!emul_module) return; PyObject* info = PyObject_CallMethod(emul_module, "get_compiler_info", "s", syn_emulate_compiler); @@ -608,7 +433,7 @@ void RunOpencxx(const char *src, const c Parser parse(&lex); #if 0 // Make sure basename ends in a '/' - std::string basename = syn_basename; + std::string basename = syn_base_path; if (basename.size() > 0 && basename[basename.size()-1] != '/') basename.append("/"); // Calculate source filename @@ -661,9 +486,7 @@ void RunOpencxx(const char *src, const c std::ofstream* of_xref = 0; char syn_buffer[1024]; size_t baselen = basename.size(); - if (syn_file_syntax) - of_syntax = new std::ofstream(syn_file_syntax); - else if (syn_syntax_prefix) + if (syn_syntax_prefix) { strcpy(syn_buffer, syn_syntax_prefix); if (!strncmp(basename.c_str(), src, baselen)) @@ -673,9 +496,7 @@ void RunOpencxx(const char *src, const c makedirs(syn_buffer); of_syntax = new std::ofstream(syn_buffer); } - if (syn_file_xref) - of_xref = new std::ofstream(syn_file_xref); - else if (syn_xref_prefix) + if (syn_xref_prefix) { strcpy(syn_buffer, syn_xref_prefix); if (!strncmp(basename.c_str(), src, baselen)) @@ -733,10 +554,8 @@ void do_parse(const char *src, FileFilter filter; filter.set_only_main(syn_main_only); filter.set_main_filename(src); - filter.set_basename(syn_basename); - if (syn_extra_filenames) filter.add_extra_filenames(*syn_extra_filenames); - if (syn_file_syntax) filter.set_syntax_filename(syn_file_syntax); - if (syn_file_xref) filter.set_xref_filename(syn_file_xref); + filter.set_basename(syn_base_path); + filter.add_extra_filenames(syn_extra_filenames); if (syn_syntax_prefix) filter.set_syntax_prefix(syn_syntax_prefix); if (syn_xref_prefix) filter.set_xref_prefix(syn_xref_prefix); @@ -748,48 +567,87 @@ void do_parse(const char *src, unlink(cppfile); } +bool extract(PyObject *list, std::vector &out) +{ + size_t argsize = PyList_Size(list); + for (size_t i = 0; i != argsize; ++i) + { + const char *value = PyString_AsString(PyList_GetItem(list, i)); + if (!value) return false; + out.push_back(value); + } + return true; +} + PyObject *occParse(PyObject *self, PyObject *args) { Trace trace("occParse"); + + Class::do_init_static(); + Metaclass::do_init_static(); + Environment::do_init_static(); + Encoding::do_init_static(); + #if 0 Ptree::show_encoded = true; #endif + PyObject *ast; char *src; - PyObject *extra_files, *parserargs, *types, *declarations, *config, *ast; - if (!PyArg_ParseTuple(args, "sOO!O", &src, &extra_files, &PyList_Type, &parserargs, &config)) + PyObject *py_extra_files; + std::vector extra_files; + int verbose, main_file_only; + char *preprocessor; + PyObject *py_cppflags; + std::vector cppflags; + int extract_tails; + if (!PyArg_ParseTuple(args, "OsO!iizzO!izz", + &ast, + &src, + &PyList_Type, &py_extra_files, + &verbose, + &main_file_only, + &syn_base_path, + &preprocessor, + &PyList_Type, &py_cppflags, + &extract_tails, + &syn_syntax_prefix, + &syn_xref_prefix) + || !extract(py_extra_files, extra_files) + || !extract(py_cppflags, cppflags)) return 0; - std::vector cppargs; - std::vector occargs; - getopts(parserargs, cppargs, occargs, config, extra_files); + + Py_INCREF(ast); + + if (verbose) ::verbose = true; + if (main_file_only) syn_main_only = true; + if (extract_tails) syn_extract_tails = true; + if (preprocessor) syn_use_gcc = true; + + for (std::vector::iterator i = extra_files.begin(); + i != extra_files.end(); + ++i) + syn_extra_filenames.push_back(*i); + if (!src || *src == '\0') { - std::cerr << "No source file" << std::endl; - exit(-1); + PyErr_SetString(PyExc_RuntimeError, "no input file"); + return 0; } // Make AST object #define assertObject(pyo) if (!pyo) PyErr_Print(); assert(pyo) - PyObject* ast_module = PyImport_ImportModule("Synopsis.Core.AST"); - assertObject(ast_module); - ast = PyObject_CallMethod(ast_module, "AST", ""); - assertObject(ast); PyObject* files = PyObject_CallMethod(ast, "files", ""); assertObject(files); - declarations = PyObject_CallMethod(ast, "declarations", ""); + PyObject *declarations = PyObject_CallMethod(ast, "declarations", ""); assertObject(declarations); - types = PyObject_CallMethod(ast, "types", ""); + PyObject *types = PyObject_CallMethod(ast, "types", ""); assertObject(types); #undef assertObject - do_parse(src, cppargs, occargs, ast, types, declarations, files); + std::vector dummy; + do_parse(src, cppflags, dummy, ast, types, declarations, files); - if (syn_extra_filenames) - { - delete syn_extra_filenames; - syn_extra_filenames = 0; - } - Py_DECREF(ast_module); Py_DECREF(declarations); Py_DECREF(files); Py_DECREF(types); @@ -826,28 +684,11 @@ PyObject *occParse(PyObject *self, PyObj // Clear the link map LinkMap::instance()->clear(); - return ast; } -PyObject *occUsage(PyObject *self, PyObject *) -{ - Trace trace("occParse"); - std::cout - << " -I Specify include path to be used by the preprocessor\n" - << " -D Specify macro to be used by the preprocessor\n" - << " -m Unly keep declarations from the main file\n" - << " -b basepath Strip basepath from start of filenames" << std::endl; - Py_INCREF(Py_None); - return Py_None; -} - -PyMethodDef occ_methods[] = - { - {(char*)"parse", occParse, METH_VARARGS}, - {(char*)"usage", occUsage, METH_VARARGS}, - {0, 0} - }; +PyMethodDef occ_methods[] = {{(char*)"parse", occParse, METH_VARARGS}, + {0, 0}}; }; extern "C" void initocc() @@ -883,6 +724,12 @@ int main(int argc, char **argv) all_args = true; else PyList_SetItem(pylist, py_i++, PyString_FromString(argv[i])); + + Class::do_init_static(); + Metaclass::do_init_static(); + Environment::do_init_static(); + Encoding::do_init_static(); + getopts(pylist, cppargs, occargs, NULL, NULL); if (!src || *src == '\0') { From stefan at synopsis.fresco.org Wed Nov 5 19:52:26 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:44 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parser/Cxx/syn occ.cc,1.89,1.90 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/syn In directory frida:/tmp/cvs-serv3508/Synopsis/Parser/Cxx/syn Modified Files: occ.cc Log Message: forgot support for emulate_compiler... Index: occ.cc =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/syn/occ.cc,v retrieving revision 1.89 retrieving revision 1.90 diff -u -p -d -r1.89 -r1.90 --- occ.cc 5 Nov 2003 17:36:55 -0000 1.89 +++ occ.cc 5 Nov 2003 19:52:24 -0000 1.90 @@ -24,6 +24,9 @@ // 02111-1307, USA. // $Log$ +// Revision 1.90 2003/11/05 19:52:24 stefan +// forgot support for emulate_compiler... +// // Revision 1.89 2003/11/05 17:36:55 stefan // C++ parser fe refactoring to suite the Processor interface // @@ -602,7 +605,7 @@ PyObject *occParse(PyObject *self, PyObj PyObject *py_cppflags; std::vector cppflags; int extract_tails; - if (!PyArg_ParseTuple(args, "OsO!iizzO!izz", + if (!PyArg_ParseTuple(args, "OsO!iizzO!izzz", &ast, &src, &PyList_Type, &py_extra_files, @@ -613,7 +616,8 @@ PyObject *occParse(PyObject *self, PyObj &PyList_Type, &py_cppflags, &extract_tails, &syn_syntax_prefix, - &syn_xref_prefix) + &syn_xref_prefix, + &syn_emulate_compiler) || !extract(py_extra_files, extra_files) || !extract(py_cppflags, cppflags)) return 0; From stefan at synopsis.fresco.org Wed Nov 5 19:52:26 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:44 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parser/Cxx Parser.py,1.1,1.2 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx In directory frida:/tmp/cvs-serv3508/Synopsis/Parser/Cxx Modified Files: Parser.py Log Message: forgot support for emulate_compiler... Index: Parser.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/Parser.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -d -r1.1 -r1.2 --- Parser.py 5 Nov 2003 17:36:55 -0000 1.1 +++ Parser.py 5 Nov 2003 19:52:24 -0000 1.2 @@ -19,14 +19,15 @@ import occ class Parser(Processor): + preprocessor = None + emulate_compiler = None cppflags = [] main_file_only = True - preprocessor = 'gcc' base_path = '' extract_tails = True syntax_prefix = None xref_prefix = None - + def process(self, ast, **kwds): self.__dict__.update(kwds) @@ -40,7 +41,8 @@ class Parser(Processor): self.cppflags, self.extract_tails, self.syntax_prefix, - self.xref_prefix) + self.xref_prefix, + self.emulate_compiler) output = kwds.get('output') if output: AST.save(output, ast) From stefan at synopsis.fresco.org Sat Nov 8 19:49:57 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:44 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Core AST.py,1.27,1.28 Executor.py,1.16,1.17 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Core In directory frida:/home/stefan/Synopsis/Synopsis/Core Modified Files: AST.py Executor.py Log Message: replace statcache.stat by os.stat Index: AST.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Core/AST.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -p -d -r1.27 -r1.28 --- AST.py 27 Jan 2003 06:53:36 -0000 1.27 +++ AST.py 8 Nov 2003 19:49:54 -0000 1.28 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.28 2003/11/08 19:49:54 stefan +# replace statcache.stat by os.stat +# # Revision 1.27 2003/01/27 06:53:36 chalky # Added macro support for C++. # @@ -107,7 +110,7 @@ Also defined in module scope are the con PRIVATE. """ -import string, sys, cPickle, types, stat, statcache +import string, sys, cPickle, types, stat import Util, Type # The version of the file format - this should be increased everytime @@ -187,7 +190,7 @@ def make_deps(ast): for file in ast.files().values(): filename = file.full_filename() try: - info = statcache.stat(filename) + info = os.stat(filename) except: # Ignore any file we can't stat continue Index: Executor.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Core/Executor.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -p -d -r1.16 -r1.17 --- Executor.py 16 Jan 2003 17:14:10 -0000 1.16 +++ Executor.py 8 Nov 2003 19:49:54 -0000 1.17 @@ -6,7 +6,7 @@ data needed for the execution of an Acti Executor class. """ -import string, re, os, stat, sys, statcache +import string, re, os, stat, sys from Action import ActionVisitor from Synopsis.Core import Util @@ -328,7 +328,7 @@ class CacherExecutor (Executor): def _get_timestamp(self, filename): """Returns the timestamp of the given file, or 0 if not found""" try: - stats = statcache.stat(filename) + stats = os.stat(filename) return stats[stat.ST_MTIME] except OSError: # NB: will catch any type of error caused by the stat call, not From stefan at synopsis.fresco.org Sat Nov 8 19:49:57 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:44 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatter/HTML DirBrowse.py,1.6,1.7 RawFilePages.py,1.4,1.5 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML In directory frida:/home/stefan/Synopsis/Synopsis/Formatter/HTML Modified Files: DirBrowse.py RawFilePages.py Log Message: replace statcache.stat by os.stat Index: DirBrowse.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML/DirBrowse.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -d -r1.6 -r1.7 --- DirBrowse.py 13 Nov 2002 03:17:19 -0000 1.6 +++ DirBrowse.py 8 Nov 2003 19:49:54 -0000 1.7 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.7 2003/11/08 19:49:54 stefan +# replace statcache.stat by os.stat +# # Revision 1.6 2002/11/13 03:17:19 chalky # Fix directory heading links when using Nested layout # @@ -41,7 +44,7 @@ # System modules -import os, stat, statcache, os.path, string, time +import os, stat, os.path, string, time # Synopsis modules from Synopsis.Core import AST, Util @@ -100,7 +103,7 @@ class DirBrowse(Page.Page): if exclude: continue entry_path = os.path.join(dir, entry) - info = statcache.stat(entry_path) + info = os.stat(entry_path) if not stat.S_ISDIR(info[stat.ST_MODE]): continue filename = self.filename_for_dir(dir) Index: RawFilePages.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML/RawFilePages.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -d -r1.4 -r1.5 --- RawFilePages.py 13 Nov 2002 04:11:00 -0000 1.4 +++ RawFilePages.py 8 Nov 2003 19:49:54 -0000 1.5 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.5 2003/11/08 19:49:54 stefan +# replace statcache.stat by os.stat +# # Revision 1.4 2002/11/13 04:11:00 chalky # Fix exclude_globs bug # @@ -35,7 +38,7 @@ # # System modules -import time, os, stat, statcache, os.path, string +import time, os, stat, os.path, string # Synopsis modules from Synopsis.Core import AST, Util @@ -84,7 +87,7 @@ class RawFilePages (Page.Page): if exclude: continue entry_path = os.path.join(dir, entry) - info = statcache.stat(entry_path) + info = os.stat(entry_path) if stat.S_ISDIR(info[stat.ST_MODE]): dirs.append(entry_path) else: From stefan at synopsis.fresco.org Tue Nov 11 02:56:20 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:45 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis Processor.py,NONE,1.1 process.py,NONE,1.1 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis In directory frida:/tmp/cvs-serv6622/Synopsis Added Files: Processor.py process.py Log Message: new scripting frontend --- NEW FILE: Processor.py --- # $Id: Processor.py,v 1.1 2003/11/11 02:56:17 stefan Exp $ # # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Core import AST class Parameter(object): """A Parameter is a documented value, kept inside a Processor.""" def __init__(self, value, doc): self.value = value self.doc = doc class Type(type): """Type is the Processor's __metaclass__.""" def __init__(cls, name, bases, dict): """Generate a '_parameters' dictionary holding all the 'Parameter' objects. Then replace 'Parameter' objects by their values for convenient use inside the code.""" parameters = {} for i in dict: if isinstance(dict[i], Parameter): parameters[i] = dict[i] for i in parameters: setattr(cls, i, dict[i].value) setattr(cls, '_parameters', parameters) class Processor(object): """Processor documentation...""" __metaclass__ = Type def __new__(cls, *args, **kwds): """merge all parameter catalogs for easy access to documentation, then use keyword arguments to override default values.""" instance = object.__new__(cls) # iterate over all base classes, starting at the 'Processor' base class # i.e. remove mixin classes hierarchy = list(filter(lambda i:isinstance(i, Processor), cls.__mro__)) hierarchy.reverse() parameters = {} for c in hierarchy: parameters.update(c._parameters) setattr(instance, '_parameters', parameters) for p in kwds: if not p in instance._parameters: raise KeyError, "'%s' processor doesn't have '%s' parameter"%(cls.__name__, p) else: setattr(cls, p, kwds[p]) return instance verbose = Parameter(False, "operate verbosely") def get_parameters(self): return self._parameters def set_parameters(self, kwds): """Sets the given parameters to override the default values.""" for i in kwds: if i in self._parameters: setattr(self, i, kwds[i]) elif i == 'input' or i == 'output': setattr(self, i, kwds[i]) # these are not in self._parameters but are legal else: raise TypeError, "No parameter '%s' in processor '%s'"%(i, self.__class__.__name__) def merge_input(self, ast): """Join the given ast with a set of asts to be read from 'input' parameter""" input = getattr(self, 'input', []) for file in input: ast.merge(AST.load(file)) return ast def output_and_return_ast(self): """writes output if the 'output' attribute is set, then returns""" output = getattr(self, 'output', None) if output: AST.save(output, self.ast) return self.ast def process(self, ast, **kwds): """The process method provides the interface to be implemented by subclasses. Commonly used arguments are 'input' and 'output'. If 'input' is defined, it is interpreted as one or more input file names. If 'output' is defined, it is interpreted as an output file (or directory) name. This implementation may serve as a template for real processors.""" # override default parameter values self.set_parameters(kwds) # merge in ast from 'input' parameter if given self.merge_input(ast) # do the real work here... # write to output (if given) and return ast return self.output_and_return_ast() class Composite(Processor): """A Composite processor.""" processors = Parameter([], 'the list of processors this is composed of') def __init__(self, *processors, **kwds): """This __init__ is a convenience constructor that takes a var list to list the desired processors. If the named values contain 'processors', they override the var list.""" if processors: self.processors = processors self.__dict__.update(kwds) def process(self, ast, **kwds): """apply a list of processors. The 'input' value is passed to the first processor only, the 'output' to the last.""" if not self.processors: return ast elif len(self.processors) == 1: return self.processors[0].process(ast, **kwds) # first_kwds is a copy of kwds, but without 'output' defined first_kwds = kwds.copy() if first_kwds.has_key('output'): del first_kwds['output'] # last_kwds is a copy of kwds, but without 'input' defined last_kwds = kwds.copy() if last_kwds.has_key('input'): del last_kwds['input'] # remove 'input' and 'output' from kwds for all other processors # in the pipeline if kwds.has_key('input'): del kwds['input'] if kwds.has_key('output'): del kwds['output'] ast = self.processors[0].process(ast, **first_kwds) if len(self.processors) > 2: for p in self.processors[1:-1]: ast = p.process(ast, **kwds) return self.processors[-1].process(ast, **last_kwds) class Store(Processor): """Store is a convenience class useful to write out the intermediate state of the ast within a pipeline such as represented by the 'Composite'""" output = Parameter('', 'the output filename') def process(self, ast, **kwds): """Simply store the current ast in the 'output' file.""" self.__dict__.update(kwds) return self.output_and_return() --- NEW FILE: process.py --- # $Id: process.py,v 1.1 2003/11/11 02:56:17 stefan Exp $ # # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Processor import Processor from Core import AST import sys def error(msg): """Write an error message and exit.""" sys.stderr.write(msg) sys.stderr.write('\n') sys.exit(-1) def process(**commands): """Accept a set of commands and process according to command line options. The typical call will start with the name of the processor to be executed, followed by a set of parameters, followed by non-parameter arguments. All parameters are either of the form 'name=value', or '--name=value'. The first form expects 'value' to be valid python, the second a string. The remaining non-parameter arguments are associated with the 'input' parameter. Once this initialization is done, the named command's 'process' method is executed. """ #first make sure the function was called with the correct argument types for c in commands: if not isinstance(commands[c], Processor): error("command '%s' isn't a valid processor"%c) if len(sys.argv) < 2: error("Usage : %s [args] [input files]'%sys.argv[0]") elif sys.argv[1] == '--help': print "Usage: %s --help"%sys.argv[0] print " or: %s --help"%sys.argv[0] print " or: %s [parameters]"%sys.argv[0] print "" print "Available commands:" for c in commands: print " %s"%c sys.exit(0) command = sys.argv[1] args = sys.argv[2:] if '--help' in args: print "Parameters for command '%s'"%command parameters = commands[command].get_parameters() tab = max(map(lambda x:len(x), parameters.keys())) for p in parameters: print " %-*s %s"%(tab, p, parameters[p].doc) sys.exit(0) props = {} # process all option arguments (i.e. those containing a '=' while args: arg = args[0] if arg.find('=') == -1 and not arg.startswith('--'): break attribute = arg.split('=', 1) if len(attribute) == 2: name, value = attribute if name.startswith('--'): props[name[2:]] = value # it's a string else: try: props[name] = eval(value) # it's a python expression except: error("""an error occured trying to evaluate the value of \'%s\' (\'%s\') to pass this as a string, please use %s="'%s'" """%(name, value, name, value)) else: name = attribute[0] if name.startswith('--'): props[name[2:]] = True # flag the attribute as 'set' else: # the nearest thing to 'no python expression' # is None... props[name] = None args = args[1:] # remaining arguments are mapped to the 'input' value, # if that is not yet defined if args and 'input' not in props: props['input'] = args if command in commands: ast = AST.AST() try: commands[command].process(ast, **props) except KeyError, e: error('missing argument "%s"'%e) else: error('no command "%s"'%command) From stefan at synopsis.fresco.org Tue Nov 11 02:57:17 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:45 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatter Dump.py,1.2,1.3 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Formatter In directory frida:/tmp/cvs-serv6646/Synopsis/Formatter Modified Files: Dump.py Log Message: new 'stylesheet' parameter Index: Dump.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatter/Dump.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- Dump.py 9 Oct 2003 05:09:06 -0000 1.2 +++ Dump.py 11 Nov 2003 02:57:15 -0000 1.3 @@ -1,181 +1,199 @@ # $Id$ # -# This file is a part of Synopsis. # Copyright (C) 2003 Stefan Seefeld +# All rights reserved. +# Licensed to the public under the terms of the GNU LGPL (>= 2), +# see the file COPYING for details. # -# Synopsis is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# -# $Log$ -# Revision 1.2 2003/10/09 05:09:06 stefan -# fix option parsing -# -# Revision 1.1 2003/10/09 05:02:39 stefan -# a new Dump formatter using xml for easy validation -# -# + """ Verbose attribute-oriented xml dump of AST, useful for validation, introspection, and debugging. """ -# THIS-IS-A-FORMATTER +from Synopsis.Processor import Processor, Parameter + import sys, getopt, os, os.path, string, types import xml from xml.dom.minidom import getDOMImplementation + dom = getDOMImplementation().createDocument(None, "dump", None) from Synopsis.Core import Type, AST -verbose = 0 __dom_implementation = xml.dom.minidom.getDOMImplementation() class Writer: - def __init__(self): - self.handlers = {types.NoneType : self.visit_none, - types.TypeType : self.visit_type, - types.IntType : self.visit_string, - types.LongType : self.visit_string, - types.FloatType : self.visit_string, - types.StringType : self.visit_string, - types.TupleType : self.visit_tuple, - types.ListType : self.visit_list, - types.DictType : self.visit_dict, - types.InstanceType : self.visit_instance} - self.visited = {} + def __init__(self, output): + self.output = output + self.handlers = {types.NoneType : self.visit_none, + types.TypeType : self.visit_type, + types.IntType : self.visit_string, + types.LongType : self.visit_string, + types.FloatType : self.visit_string, + types.StringType : self.visit_string, + types.TupleType : self.visit_tuple, + types.ListType : self.visit_list, + types.DictType : self.visit_dict, + types.InstanceType : self.visit_instance} + self.visited = {} - def push(self, name): - element = dom.createElement(name) - self.node.appendChild(element) - self.node = element - def pop(self): - self.node = self.node.parentNode - def add_text(self, text): - node = dom.createTextNode(text) - self.node.appendChild(node) + def push(self, name): + element = dom.createElement(name) + self.node.appendChild(element) + self.node = element - def visit(self, obj): - i,t = id(obj), type(obj) - if self.visited.has_key(i): - self.node.setAttribute('xref', str(i)) - return - if self.handlers.has_key(t): - self.handlers[t](obj) - else: - print "Unknown type %s for object: '%s'"%(t,obj) + def pop(self): + self.node = self.node.parentNode - def visit_none(self, obj): pass - def visit_string(self, obj): self.add_text(str(obj)) - def visit_type(self, obj): self.write(obj) # where is that used ?? + def add_text(self, text): + node = dom.createTextNode(text) + self.node.appendChild(node) - def visit_tuple(self, obj): - if len(obj) == 0: return - for i in obj: - self.push('item') - self.visit(i) - self.pop() + def visit(self, obj): + i,t = id(obj), type(obj) + if self.visited.has_key(i): + self.node.setAttribute('xref', str(i)) + return + if self.handlers.has_key(t): + self.handlers[t](obj) + else: + print "Unknown type %s for object: '%s'"%(t,obj) - def visit_list(self, obj): - if len(obj) == 0: return - for i in obj: - self.push('item') - self.visit(i) - self.pop() + def visit_none(self, obj): pass + def visit_string(self, obj): self.add_text(str(obj)) + def visit_type(self, obj): self.write(obj) # where is that used ?? - def visit_dict(self, dict): - items = dict.items() - if len(items) == 0: return - items.sort() - for i in items: - self.push("key") - self.visit(i[0]) - self.pop() - self.push("value") - self.visit(i[1]) + def visit_tuple(self, obj): + if len(obj) == 0: return + for i in obj: + #self.push('item') + self.visit(i) + #self.pop() + + def visit_list(self, obj): + if len(obj) == 0: return + for i in obj: + #self.push('item') + self.visit(i) + #self.pop() + + def visit_dict(self, dict): + items = dict.items() + if len(items) == 0: return + items.sort() + for i in items: + self.push("key") + self.visit(i[0]) + self.pop() + self.push("value") + self.visit(i[1]) + self.pop() + + def visit_instance(self, obj): + if isinstance(obj, AST.SourceFile): # just write down the filename + self.add_text(obj.filename()) + return + if isinstance(obj, AST.Include): + self.write("Include: (macro:%d, next:%d) '%s'"%(obj.is_macro(), + obj.is_next(), + obj.target().filename())) + return + self.visited[id(obj)] = None + self.push("instance") + self.node.setAttribute('class', "%s.%s"%(obj.__class__.__module__,obj.__class__.__name__)) + self.node.setAttribute('id', str(id(obj))) + attrs = obj.__dict__.items() + attrs.sort() + for name, value in attrs: + # ignore None values + if (value == None + or value == [] + or value == ()): + continue + # special case for some known attributes... + if name == '_Named__name': + self.node.setAttribute('name', string.join(value, '.')) + continue + if name == '_Declaration__name': + self.node.setAttribute('name', string.join(value, '.')) + continue + if name == '_Declaration__file': + if value: + self.node.setAttribute('file', value.filename()) + continue + if name[0] == '_': + index = string.find(name, '__') + if index >= 0: + #name = "%s.%s"%(name[1:index],name[index+2:]) + name = name[index+2:] + if (self.handlers[type(value)] == self.visit_string + and not (obj.__class__.__name__ == 'Comment' + and (name == 'summary' or name == 'text'))): + self.node.setAttribute(name, str(value)) + else: + self.push(name) + self.visit(value) self.pop() + self.pop() - def visit_instance(self, obj): - if isinstance(obj, AST.SourceFile): # just write down the filename - self.add_text(obj.filename()) - return - if isinstance(obj, AST.Include): - self.write("Include: (macro:%d, next:%d) '%s'"%(obj.is_macro(), - obj.is_next(), - obj.target().filename())) - return - self.visited[id(obj)] = None - self.push("%s.%s"%(obj.__class__.__module__,obj.__class__.__name__)) - self.node.setAttribute('id', str(id(obj))) - attrs = obj.__dict__.items() - attrs.sort() - for name, value in attrs: - # ignore None values - if (value == None - or value == [] - or value == ()): - continue - # special case for some known attributes... - if name == '_Named__name': - self.node.setAttribute('name', string.join(value, '.')) - continue - if name == '_Declaration__name': - self.node.setAttribute('name', string.join(value, '.')) - continue - if name == '_Declaration__file': - if value: - self.node.setAttribute('file', value.filename()) - continue - if name[0] == '_': - index = string.find(name, '__') - if index >= 0: - #name = "%s.%s"%(name[1:index],name[index+2:]) - name = name[index+2:] - if (self.handlers[type(value)] == self.visit_string - and not (obj.__class__.__name__ == 'Comment' - and (name == 'summary' or name == 'text'))): - self.node.setAttribute(name, str(value)) - else: - self.push(name) - self.visit(value) - self.pop() - self.pop() + def write_declarations(self, declarations): + self.node = dom.createElement("declarations") + for d in declarations: self.visit(d) + self.node.writexml(self.output, indent=" ", addindent=" ", newl="\n") + self.node.unlink() + del self.node - def write_declarations(self, declarations): - self.node = dom.createElement("declarations") - for d in declarations: self.visit(d) - self.node.writexml(output, indent=" ", addindent=" ", newl="\n") - self.node.unlink() - del self.node + def write_types(self, types): + self.node = dom.createElement("types") + for t in types.values(): self.visit(t) + self.node.writexml(self.output, indent=" ", addindent=" ", newl="\n") + self.node.unlink() + del self.node - def write_types(self, types): - self.node = dom.createElement("types") - for t in types.values(): self.visit(t) - self.node.writexml(output, indent=" ", addindent=" ", newl="\n") - self.node.unlink() - del self.node + def write_files(self, files): + self.node = dom.createElement("files") + for f in files: self.visit(f) + self.node.writexml(self.output, indent=" ", addindent=" ", newl="\n") + self.node.unlink() + del self.node - def write_files(self, files): - self.node = dom.createElement("files") - for f in files: self.visit(f) - self.node.writexml(output, indent=" ", addindent=" ", newl="\n") - self.node.unlink() - del self.node +class Formatter(Processor): + + show_declarations = Parameter(True, 'output declarations') + show_types = Parameter(True, 'output types') + show_files = Parameter(True, 'output files') + stylesheet = Parameter('dump.css', 'stylesheet to be referenced for rendering') + + def process(self, ast, **kwds): + + self.set_parameters(kwds) + self.ast = self.merge_input(ast) + output = open(self.output, "w") + output.write("\n") + if self.stylesheet: + output.write("\n"%self.stylesheet) + + output.write("\n") + + writer = Writer(output) + + if self.show_declarations: + writer.write_declarations(ast.declarations()) + + if self.show_types: + writer.write_types(ast.types()) + + if self.show_files: + writer.write_files(ast.files()) + + output.write("\n") + + return ast def usage(): - """Print usage to stdout""" - print \ + """Print usage to stdout""" + print \ """ -o Output file -d Show declarations @@ -185,45 +203,39 @@ def usage(): """ def __parseArgs(args): - global output, verbose, show_decls, show_types, show_files - # Set defaults - output = sys.stdout - show_decls = 0 - show_types = 0 - show_files = 0 - - try: - opts,remainder = getopt.getopt(args, "o:vdtf") - except getopt.error, e: - sys.stderr.write("Error in arguments: " + str(e) + "\n") - sys.exit(1) - - for opt in opts: - o,a = opt - if o == "-o": output = open(a, "w") - elif o == "-v": verbose = 1 - elif o == "-d": show_decls = 1 - elif o == "-t": show_types = 1 - elif o == "-f": show_files = 1 + global output, verbose, show_declarations, show_types, show_files + # Set defaults + output = sys.stdout + verbose = 0 + show_declarations = 0 + show_types = 0 + show_files = 0 - # Consolidate - if no show_ selected, show decls and types - if not (show_decls or show_types or show_files): - show_decls = 1 - show_types = 1 - show_files = 1 + try: + opts,remainder = getopt.getopt(args, "o:vdtf") + except getopt.error, e: + sys.stderr.write("Error in arguments: " + str(e) + "\n") + sys.exit(1) + for opt in opts: + o,a = opt + if o == "-o": output = open(a, "w") + elif o == "-v": verbose = 1 + elif o == "-d": show_declarations = 1 + elif o == "-t": show_types = 1 + elif o == "-f": show_files = 1 + + # Consolidate - if no show_ selected, show decls and types + if not (show_declarations or show_types or show_files): + show_declarations = 1 + show_types = 1 + show_files = 1 + +# THIS-IS-A-FORMATTER def format(args, ast, config_obj): - global output, show_files - __parseArgs(args) - - # Write out the prologue. - output.write("\n") - output.write("\n") - writer = Writer() - if show_decls: - writer.write_declarations(ast.declarations()) - if show_types: - writer.write_types(ast.types()) - if show_files: - writer.write_files(ast.files()) - output.write("\n") + global output, verbose, show_declarations, show_types, show_files + __parseArgs(args) + formatter = Formatter(verbose=verbose, + show_declarations=show_declarations, + show_types=show_types, + show_files=show_files) From stefan at synopsis.fresco.org Tue Nov 11 02:58:33 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:45 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parser/Cxx Parser.py,1.2,1.3 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx In directory frida:/tmp/cvs-serv6682/Synopsis/Parser/Cxx Modified Files: Parser.py Log Message: refinements Index: Parser.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/Cxx/Parser.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- Parser.py 5 Nov 2003 19:52:24 -0000 1.2 +++ Parser.py 11 Nov 2003 02:58:31 -0000 1.3 @@ -13,37 +13,39 @@ use by python. @see C++/SWalker """ -from Synopsis.Core.Processor import Processor +from Synopsis.Processor import Processor, Parameter from Synopsis.Core import AST import occ class Parser(Processor): - preprocessor = None - emulate_compiler = None - cppflags = [] - main_file_only = True - base_path = '' - extract_tails = True - syntax_prefix = None - xref_prefix = None + preprocessor = Parameter(None, 'the preprocessor to use (defaults to internal)') + emulate_compiler = Parameter(None, 'a compiler to emulate (defaults to \'c++\')') + cppflags = Parameter([], 'list of preprocessor flags such as -I or -D') + main_file_only = Parameter(True, 'should only main file be processed') + base_path = Parameter('', 'path prefix to strip off of the file names') + extract_tails = Parameter(True, 'consider comments at the end of declarations') + syntax_prefix = Parameter(None, 'path prefix (directory) to contain syntax info') + xref_prefix = Parameter(None, 'path prefix (directory) to contain xref info') + + extra_files = Parameter([], 'extra files for which to keep info. Highly Deprecated !!!') def process(self, ast, **kwds): - - self.__dict__.update(kwds) - for file in self.input: - ast = occ.parse(ast, file, [], - self.verbose, - self.main_file_only, - self.base_path, - self.preprocessor, - self.cppflags, - self.extract_tails, - self.syntax_prefix, - self.xref_prefix, - self.emulate_compiler) - output = kwds.get('output') - if output: - AST.save(output, ast) - return ast + input = kwds.get('input') + self.set_parameters(kwds) + self.ast = ast + for file in input: + self.ast = occ.parse(self.ast, file, + self.extra_files, + self.verbose, + self.main_file_only, + self.base_path, + self.preprocessor, + self.cppflags, + self.extract_tails, + self.syntax_prefix, + self.xref_prefix, + self.emulate_compiler) + + return self.output_and_return_ast() From stefan at synopsis.fresco.org Tue Nov 11 03:03:23 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:45 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parser/Python Parser.py,1.2,1.3 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parser/Python In directory frida:/tmp/cvs-serv6850/Synopsis/Parser/Python Modified Files: Parser.py Log Message: refinements Index: Parser.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/Python/Parser.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- Parser.py 5 Nov 2003 17:21:50 -0000 1.2 +++ Parser.py 11 Nov 2003 03:03:19 -0000 1.3 @@ -6,18 +6,19 @@ # see the file COPYING for details. # -from Synopsis.Core.Processor import Processor -from Synopsis.Core import AST +from Processor import Processor, Parameter +from Core import AST from python import parse class Parser(Processor): - basename='' + basename = Parameter('', 'basename to strip off of the parsed modules') - def process(self, ast, **kwds): - for file in kwds['input']: - ast.merge(parse(file, 0, {}, None)) - output = kwds.get('output') - if output: - AST.save(output, ast) - return ast + def process(self, ast, **kwds): + + input = kwds.get('input') + self.set_parameters(kwds) + for file in input: + ast.merge(parse(file, 0, {}, None)) + + return output_and_return_ast(self) From stefan at synopsis.fresco.org Tue Nov 11 04:51:20 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:45 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Linker EmptyNS.py,1.2,1.3 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Linker In directory frida:/tmp/cvs-serv9397/Synopsis/Linker Modified Files: EmptyNS.py Log Message: remove debug output Index: EmptyNS.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Linker/EmptyNS.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- EmptyNS.py 11 Nov 2003 02:57:57 -0000 1.2 +++ EmptyNS.py 11 Nov 2003 04:51:17 -0000 1.3 @@ -51,7 +51,6 @@ class EmptyNS (Processor, AST.Visitor): def add(self, decl): """Adds the given decl to the current scope""" - print 'add %s', decl self.__currscope.append(decl) def currscope(self): @@ -76,16 +75,11 @@ class EmptyNS (Processor, AST.Visitor): def visitModule(self, module): """Visits all children of the module, and if there are no declarations after that removes the module""" - print 'visiting module', module self.push() - print 'module contains', len(module.declarations()), 'declarations' for decl in module.declarations(): - print decl.name(), decl.type() decl.accept(self) module.declarations()[:] = self.currscope() count = self._count_not_forwards(self.currscope()) - #print string.join(module.name(),'::'),"%d (%d)"%(len(self.currscope()),count),"children" - print module, 'has ', count, 'declarations' if count: self.pop(module) else: self.pop_only() From stefan at synopsis.fresco.org Tue Nov 11 04:53:43 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:45 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatter/HTML Formatter.py,NONE,1.1 __init__.py,1.6,1.7 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML In directory frida:/tmp/cvs-serv9440/Synopsis/Formatter/HTML Modified Files: __init__.py Added Files: Formatter.py Log Message: move HTML formatter towards processor scheme --- NEW FILE: Formatter.py --- # $Id: Formatter.py,v 1.1 2003/11/11 04:53:41 stefan Exp $ # # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor, Parameter from Synopsis.Core import AST from FramesIndex import * from ScopePages import * from ModuleListing import * from ModuleIndexer import * from FileListing import * from FileIndexer import * from FileDetails import * from InheritanceTree import * from InheritanceGraph import * from FileSource import * from NameIndex import * from XRefPages import * from FileLayout import * from TreeFormatter import * from CommentFormatter import * from core import * class ConfigHTML: """This is a verbatim copy of the HTML class in Config.py. It should serve temporarily here so we can incrementally refactor the HTML formatter. The goal is to get rid of this monster...""" name = 'HTML' # Defaults datadir = '/usr/local' + '/share/synopsis' stylesheet = 'style.css' stylesheet_file = datadir + '/html.css' file_layout = 'Synopsis.Formatter.HTML.FileLayout.FileLayout' pages = ['FramesIndex', 'ScopePages', 'ModuleListing', 'ModuleIndexer', 'FileListing', 'FileIndexer', 'FileDetails', 'InheritanceTree', 'InheritanceGraph', 'NameIndex', 'FramesIndex'] comment_formatters = ['javadoc', 'section'] tree_formatter = 'TreeFormatter.TreeFormatter' structs_as_classes = 0 class FileSource: file_path = './%s' links_path = './%s-links' toc_files = [] scope = '' # Old name for FileSource: FilePages = FileSource class FileTree: link_to_pages = 0 class ScopePages: parts = ['Heading', 'Summary', 'Inheritance', 'Detail'] heading_formatters = ['Heading', 'ClassHierarchyGraph', 'DetailCommenter'] summary_formatters = ['SummaryAST', 'SummaryCommenter'] detail_formatters = ['DetailAST', 'DetailCommenter'] class InheritanceGraph: min_size = 1 min_group_size = 5 direction = 'vertical' class ModuleListing: pass def __init__(self, verbose): self.verbose = verbose class Formatter(Processor): stylesheet = Parameter('style.css', '') stylesheet_file = Parameter('../html.css', '') pages = Parameter(['FramesIndex', #these will become types, but that requires more refactoring 'ScopePages', 'ModuleListing', 'ModuleIndexer', 'FileListing', 'FileIndexer', 'FileDetails', 'InheritanceTree', 'InheritanceGraph', 'FileSource', 'NameIndex', 'XRefPages'], '') comment_formatter = Parameter([QuoteHTML, SectionFormatter], '') # this should go away ! datadir = Parameter('/usr/local/share/synopsis', '') file_layout = Parameter(NestedFileLayout, 'how to lay out the output files') tree_formatter = Parameter(TreeFormatter, 'define how to lay out tree views') structs_as_classes = Parameter(True, '') def process(self, ast, **kwds): self.set_parameters(kwds) self.ast = self.merge_input(ast) config_obj = ConfigHTML(self.verbose) format(['-o', self.output], self.ast, config_obj) return self.ast Index: __init__.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -d -r1.6 -r1.7 --- __init__.py 4 Jul 2001 08:17:48 -0000 1.6 +++ __init__.py 11 Nov 2003 04:53:41 -0000 1.7 @@ -1,40 +1,10 @@ # $Id$ # -# This file is a part of Synopsis. -# Copyright (C) 2000, 2001 Stephen Davies -# Copyright (C) 2000, 2001 Stefan Seefeld -# -# Synopsis is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# -# $Log$ -# Revision 1.6 2001/07/04 08:17:48 uid20151 -# Comments -# -# Revision 1.5 2001/02/13 10:07:33 chalky -# Fixed typo -# -# Revision 1.4 2001/02/13 06:55:23 chalky -# Made synopsis -l work again -# -# Revision 1.3 2001/02/01 15:28:43 chalky -# Imported usage so it works. -# -# Revision 1.2 2001/02/01 15:23:24 chalky -# Copywritten brown paper bag edition. -# +# Copyright (C) 2000 Stephen Davies +# Copyright (C) 2000 Stefan Seefeld +# All rights reserved. +# Licensed to the public under the terms of the GNU LGPL (>= 2), +# see the file COPYING for details. # """HTML Formatter package. @@ -48,22 +18,7 @@ include things like the file layout, the to use, etc. """ -# -# __init__.py -# -# The formatter has been split into a very modular format. -# The modules in the HTML package now contain the classes which may be -# overridden by user-specified modules - -try: - import core - - from core import format, usage - -except: - print "An error occurred loading the HTML module:" - import traceback - traceback.print_exc() - raise +from Formatter import Formatter -# THIS-IS-A-FORMATTER +import core +from core import format, usage From stefan at synopsis.fresco.org Tue Nov 11 04:54:24 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:46 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatter/HTML FileSource.py,1.2,1.3 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML In directory frida:/tmp/cvs-serv9462/Synopsis/Formatter/HTML Modified Files: FileSource.py Log Message: the C++ parser is now spelled Parser.Cxx... Index: FileSource.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML/FileSource.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- FileSource.py 1 Feb 2003 23:59:32 -0000 1.2 +++ FileSource.py 11 Nov 2003 04:54:22 -0000 1.3 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.3 2003/11/11 04:54:22 stefan +# the C++ parser is now spelled Parser.Cxx... +# # Revision 1.2 2003/02/01 23:59:32 chalky # Use full_filename() for file source so don't need file_path any more to # find the original source files. @@ -78,7 +81,7 @@ from Tags import * # Link module link = None try: - link = Util._import("Synopsis.Parser.C++.link") + link = Util._import("Synopsis.Parser.Cxx.link") except ImportError: print "Warning: unable to import link module. Continuing..." From stefan at synopsis.fresco.org Tue Nov 11 06:00:37 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:46 2005 Subject: [Synopsis-changes] Synopsis/Synopsis autogen.sh,1.3,1.4 setup.py,1.8,1.9 Message-ID: Update of /cvs/synopsis/Synopsis In directory frida:/tmp/cvs-serv11137 Modified Files: autogen.sh setup.py Log Message: adjust to directory/package layout changes Index: autogen.sh =================================================================== RCS file: /cvs/synopsis/Synopsis/autogen.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- autogen.sh 5 Nov 2003 01:56:59 -0000 1.3 +++ autogen.sh 11 Nov 2003 06:00:34 -0000 1.4 @@ -9,6 +9,6 @@ conf() ) } -conf Synopsis/Parser/C -conf Synopsis/Parser/Cxx -conf Synopsis/Parser/Cxx/gc +conf Synopsis/Parsers/C +conf Synopsis/Parsers/Cxx +conf Synopsis/Parsers/Cxx/gc Index: setup.py =================================================================== RCS file: /cvs/synopsis/Synopsis/setup.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -d -r1.8 -r1.9 --- setup.py 5 Nov 2003 01:56:59 -0000 1.8 +++ setup.py 11 Nov 2003 06:00:34 -0000 1.9 @@ -28,20 +28,21 @@ module_ext = sysconfig.get_config_var('S def prefix(list, pref): return map(lambda x, p=pref: p + x, list) py_packages = ["Synopsis", - "Synopsis.Core", - "Synopsis.Parser", - "Synopsis.Parser.IDL", "Synopsis.Parser.Python", - "Synopsis.Parser.C", "Synopsis.Parser.Cxx", - "Synopsis.Linker", - "Synopsis.Formatter", - "Synopsis.Formatter.HTML", - "Synopsis.UI", - "Synopsis.UI.Qt"] + "Synopsis.Parsers", + "Synopsis.Parsers.IDL", "Synopsis.Parsers.Python", + "Synopsis.Parsers.C", "Synopsis.Parsers.Cxx", + "Synopsis.Processors", + "Synopsis.Formatters", + "Synopsis.Formatters.HTML"] -ext_modules = [('Synopsis/Parser/C', 'ctool' + module_ext), - ('Synopsis/Parser/Cxx', 'occ' + module_ext), - ('Synopsis/Parser/Cxx', 'link' + module_ext), - ] +#"Synopsis.Core", +#"Synopsis.UI", +#"Synopsis.UI.Qt"] + + +ext_modules = [('Synopsis/Parsers/C', 'ctool' + module_ext), + ('Synopsis/Parsers/Cxx', 'occ' + module_ext), + ('Synopsis/Parsers/Cxx', 'link' + module_ext)] scripts = ['synopsis', 'synopsis-qt', 'compile-xref', 'search-xref'] From stefan at synopsis.fresco.org Tue Nov 11 06:00:37 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:46 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/dist/command build_doc.py,1.4,1.5 config.py,1.5,1.6 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/dist/command In directory frida:/tmp/cvs-serv11137/Synopsis/dist/command Modified Files: build_doc.py config.py Log Message: adjust to directory/package layout changes Index: build_doc.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/dist/command/build_doc.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -d -r1.4 -r1.5 --- build_doc.py 5 Nov 2003 01:57:00 -0000 1.4 +++ build_doc.py 11 Nov 2003 06:00:34 -0000 1.5 @@ -82,7 +82,7 @@ class build_doc(build.build): filter(lambda f, re=py: re.match(f), names))) def add_cxx(arg, dirname, names): # only parse the C++ parser for now - if dirname[:19] != 'Synopsis/Parser/Cxx': + if dirname[:19] != 'Synopsis/Parsers/Cxx': return arg.extend(map(lambda f, d=dirname: os.path.join(d, f), filter(lambda f, re=cxx: re.match(f), names))) @@ -106,7 +106,7 @@ class build_doc(build.build): py_syn = Target(self, synopsis + " -o %(output)s %(input)s", py_syns, output='py.syn', input=map(lambda f:re.sub('\.py$', '.syn', f), py_sources)) - command = synopsis + " -I ../../Synopsis/Parser/Cxx -I ../../Synopsis/Parser/CXX/gc/include -I " + sysconfig.get_python_inc() + command = synopsis + " -I ../../Synopsis/Parsers/Cxx -I ../../Synopsis/Parsers/CXX/gc/include -I " + sysconfig.get_python_inc() command += " -Wc,parser=C++,linker=C++ -Wp,-s,syn/%s-links,%s" cxx_syns = map(lambda f,s=self:Target(s, command%(f[0], f[1]) + " -o %(output)s %(input)s", [], output=f[0] + ".syn", @@ -117,39 +117,39 @@ class build_doc(build.build): output='c++.syn', input=map(lambda f:f + ".syn", cxx_sources)) - core_ast_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Core::AST' -o %(output)s %(input)%", - [py_syn], output="core-ast.syn", input=['py.syn']) - core_type_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Core::Type' -o %(output)s %(input)%", - [py_syn], output="core-type.syn", input=['py.syn']) - core_util_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Core::Util' -o %(output)s %(input)%", - [py_syn], output="core-util.syn", input=['py.syn']) - parser_cxx_py_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Parser::Cxx' -o %(output)s %(input)%", + ast_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::AST' -o %(output)s %(input)%", + [py_syn], output="ast.syn", input=['py.syn']) + type_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Type' -o %(output)s %(input)%", + [py_syn], output="type.syn", input=['py.syn']) + util_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Util' -o %(output)s %(input)%", + [py_syn], output="util.syn", input=['py.syn']) + parser_cxx_py_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Parsers::Cxx' -o %(output)s %(input)%", [py_syn], output="parser-c++-py.syn", input=['py.syn']) parser_cxx_cpp_syn = Target(self, synopsis + " -Wc,linker=All -o %(output)s %(input)%", [py_syn], output="parser-c++-cpp.syn", input=['py.syn']) parser_cxx_syn = Target(self, synopsis + " -Wc,linker=All -o %(output)s %(input)%", [parser_cxx_py_syn, parser_cxx_cpp_syn], output="parser-c++.syn", input=['py.syn']) - parser_idl_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Parser::IDL' -o %(output)s %(input)%", + parser_idl_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Parsers::IDL' -o %(output)s %(input)%", [py_syn], output="parser-idl.syn", input=['py.syn']) - parser_py_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Parser::Python' -o %(output)s %(input)%", + parser_py_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Parsers::Python' -o %(output)s %(input)%", [py_syn], output="parser-py.syn", input=['py.syn']) - linker_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Linker' -o %(output)s %(input)%", + linker_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Processors' -o %(output)s %(input)%", [py_syn], output="linker.syn", input=['py.syn']) - formatter_ascii_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatter::ASCII' -o %(output)s %(input)%", + formatter_ascii_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatters::ASCII' -o %(output)s %(input)%", [py_syn], output="formatter-ascii.syn", input=['py.syn']) - formatter_html_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatter::HTML' -o %(output)s %(input)%", + formatter_html_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatters::HTML' -o %(output)s %(input)%", [py_syn], output="formatter-html.syn", input=['py.syn']) - formatter_dump_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatter::DUMP' -o %(output)s %(input)%", + formatter_dump_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatters::DUMP' -o %(output)s %(input)%", [py_syn], output="formatter-dump.syn", input=['py.syn']) - formatter_dia_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatter::Dia' -o %(output)s %(input)%", + formatter_dia_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatters::Dia' -o %(output)s %(input)%", [py_syn], output="formatter-dia.syn", input=['py.syn']) - formatter_docbook_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatter::Docbook' -o %(output)s %(input)%", + formatter_docbook_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatters::Docbook' -o %(output)s %(input)%", [py_syn], output="formatter-docbook.syn", input=['py.syn']) - formatter_dot_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatter::Dot' -o %(output)s %(input)%", + formatter_dot_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatters::Dot' -o %(output)s %(input)%", [py_syn], output="formatter-dot.syn", input=['py.syn']) - formatter_html_simple_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatter::HTML_Simple' -o %(output)s %(input)%", + formatter_html_simple_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatters::HTML_Simple' -o %(output)s %(input)%", [py_syn], output="formatter-html-simple.syn", input=['py.syn']) - formatter_texi_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatter::TexInfo' -o %(output)s %(input)%", + formatter_texi_syn = Target(self, synopsis + " -Wc,linker=All -Wl,-s,'Synopsis::Formatters::TexInfo' -o %(output)s %(input)%", [py_syn], output="formatter-texi.syn", input=['py.syn']) all_syn = Target(self, synopsis + " -Wc,linker=All -o %(output)s %(input)s", Index: config.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/dist/command/config.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -d -r1.5 -r1.6 --- config.py 5 Nov 2003 01:57:00 -0000 1.5 +++ config.py 11 Nov 2003 06:00:34 -0000 1.6 @@ -32,8 +32,8 @@ class config(build.build): for e in self.distribution.ext_modules: if e[0] not in self.extensions: self.extensions.append(e[0]) - if not self.enable_c and 'Synopsis/Parser/C' in self.extensions: - self.extensions.remove('Synopsis/Parser/C') + if not self.enable_c and 'Synopsis/Parsers/C' in self.extensions: + self.extensions.remove('Synopsis/Parsers/C') def run(self): @@ -44,7 +44,7 @@ class config(build.build): for ext in self.extensions: self.config_extension(ext) if not self.disable_gc: - self.config_extension('Synopsis/Parser/Cxx/gc') + self.config_extension('Synopsis/Parsers/Cxx/gc') def config_extension(self, ext): @@ -61,7 +61,7 @@ class config(build.build): os.chdir(tempdir) command = "%s/configure --with-python=%s"%(srcdir, sys.executable) - if ext == 'Synopsis/Parser/Cxx' and self.disable_gc: + if ext == 'Synopsis/Parsers/Cxx' and self.disable_gc: command += ' --disable-gc' self.announce(command) spawn(['sh', '-c', command], self.verbose, self.dry_run) From stefan at synopsis.fresco.org Tue Nov 11 06:01:15 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:47 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatters/HTML ASTFormatter.py,1.32,1.33 CommentFormatter.py,1.20,1.21 DirBrowse.py,1.7,1.8 FileDetails.py,1.2,1.3 FileIndexer.py,1.2,1.3 FileLayout.py,1.21,1.22 FileListing.py,1.1,1.2 FileSource.py,1.3,1.4 FileTreeJS.py,1.7,1.8 FormatStrategy.py,1.30,1.31 Formatter.py,1.1,1.2 InheritanceGraph.py,1.24,1.25 InheritanceTree.py,1.10,1.11 ModuleIndexer.py,1.13,1.14 ModuleListing.py,1.11,1.12 ModuleListingJS.py,1.9,1.10 NameIndex.py,1.10,1.11 Page.py,1.17,1.18 RawFilePages.py,1.5,1.6 ScopePages.py,1.19,1.20 ScopeSorter.py,1.8,1.9 TreeFormatterJS.py,1.3,1.4 XRefPages.py,1.9,1.10 core.py,1.47,1.48 doxygen.py,1.5,1.6 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML In directory frida:/tmp/cvs-serv11169/Synopsis/Formatters/HTML Modified Files: ASTFormatter.py CommentFormatter.py DirBrowse.py FileDetails.py FileIndexer.py FileLayout.py FileListing.py FileSource.py FileTreeJS.py FormatStrategy.py Formatter.py InheritanceGraph.py InheritanceTree.py ModuleIndexer.py ModuleListing.py ModuleListingJS.py NameIndex.py Page.py RawFilePages.py ScopePages.py ScopeSorter.py TreeFormatterJS.py XRefPages.py core.py doxygen.py Log Message: adjust to directory/package layout changes Index: ASTFormatter.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/ASTFormatter.py,v retrieving revision 1.32 retrieving revision 1.33 diff -u -p -d -r1.32 -r1.33 --- ASTFormatter.py 20 Jan 2003 06:43:02 -0000 1.32 +++ ASTFormatter.py 11 Nov 2003 06:01:13 -0000 1.33 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.33 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.32 2003/01/20 06:43:02 chalky # Refactored comment processing. Added AST.CommentTag. Linker now determines # comment summary and extracts tags. Increased AST version number. @@ -134,7 +137,7 @@ and are defined in the FormatStrategy mo import types, os # Synopsis modules -from Synopsis.Core import AST, Type, Util +from Synopsis import AST, Type, Util # HTML modules import Tags, core, FormatStrategy @@ -174,7 +177,7 @@ class Part(Type.Visitor, AST.Visitor): def _init_formatters(self, config_option, type_msg): """Loads strategies from config file""" - base = 'Synopsis.Formatter.HTML.FormatStrategy.' + base = 'Synopsis.Formatters.HTML.FormatStrategy.' try: config_obj = getattr(config.obj.ScopePages, config_option) if type(config_obj) not in (types.ListType, types.TupleType): Index: CommentFormatter.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/CommentFormatter.py,v retrieving revision 1.20 retrieving revision 1.21 diff -u -p -d -r1.20 -r1.21 --- CommentFormatter.py 20 Jan 2003 06:43:02 -0000 1.20 +++ CommentFormatter.py 11 Nov 2003 06:01:13 -0000 1.21 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.21 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.20 2003/01/20 06:43:02 chalky # Refactored comment processing. Added AST.CommentTag. Linker now determines # comment summary and extracts tags. Increased AST version number. @@ -87,7 +90,7 @@ import re, string # Synopsis modules -from Synopsis.Core import AST, Type, Util +from Synopsis import AST, Type, Util # HTML modules import core Index: DirBrowse.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/DirBrowse.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -d -r1.7 -r1.8 --- DirBrowse.py 8 Nov 2003 19:49:54 -0000 1.7 +++ DirBrowse.py 11 Nov 2003 06:01:13 -0000 1.8 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.8 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.7 2003/11/08 19:49:54 stefan # replace statcache.stat by os.stat # @@ -47,7 +50,7 @@ import os, stat, os.path, string, time # Synopsis modules -from Synopsis.Core import AST, Util +from Synopsis import AST, Util # HTML modules import Page Index: FileDetails.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/FileDetails.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- FileDetails.py 16 Jan 2003 13:31:33 -0000 1.2 +++ FileDetails.py 11 Nov 2003 06:01:13 -0000 1.3 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.3 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.2 2003/01/16 13:31:33 chalky # Quote the scope name # @@ -47,7 +50,7 @@ import os # Synopsis modules -from Synopsis.Core import AST, Util +from Synopsis import AST, Util # HTML modules import Page Index: FileIndexer.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/FileIndexer.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- FileIndexer.py 20 Jan 2003 06:43:02 -0000 1.2 +++ FileIndexer.py 11 Nov 2003 06:01:13 -0000 1.3 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.3 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.2 2003/01/20 06:43:02 chalky # Refactored comment processing. Added AST.CommentTag. Linker now determines # comment summary and extracts tags. Increased AST version number. @@ -48,7 +51,7 @@ import os # Synopsis modules -from Synopsis.Core import AST, Util +from Synopsis import AST, Util # HTML modules import Page Index: FileLayout.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/FileLayout.py,v retrieving revision 1.21 retrieving revision 1.22 diff -u -p -d -r1.21 -r1.22 --- FileLayout.py 16 Jan 2003 12:46:46 -0000 1.21 +++ FileLayout.py 11 Nov 2003 06:01:13 -0000 1.22 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.22 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.21 2003/01/16 12:46:46 chalky # Renamed FilePages to FileSource, FileTree to FileListing. Added FileIndexer # (used to be part of FileTree) and FileDetails. @@ -92,8 +95,8 @@ default implementation stores everything import os, sys, stat, string, re # Synopsis modules -from Synopsis.Core import Util, AST -from Synopsis.Formatter import TOC +from Synopsis import Util, AST +from Synopsis.Formatters import TOC # HTML modules import core Index: FileListing.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/FileListing.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -d -r1.1 -r1.2 --- FileListing.py 16 Jan 2003 12:46:46 -0000 1.1 +++ FileListing.py 11 Nov 2003 06:01:13 -0000 1.2 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.2 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.1 2003/01/16 12:46:46 chalky # Renamed FilePages to FileSource, FileTree to FileListing. Added FileIndexer # (used to be part of FileTree) and FileDetails. @@ -44,8 +47,8 @@ import os # Synopsis modules -from Synopsis.Core import AST, Util -from Synopsis.Core.FileTree import FileTree +from Synopsis import AST, Util +from Synopsis.FileTree import FileTree # HTML modules import Page Index: FileSource.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/FileSource.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- FileSource.py 11 Nov 2003 04:54:22 -0000 1.3 +++ FileSource.py 11 Nov 2003 06:01:13 -0000 1.4 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.4 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.3 2003/11/11 04:54:22 stefan # the C++ parser is now spelled Parser.Cxx... # @@ -69,7 +72,7 @@ import time, os # Synopsis modules -from Synopsis.Core import AST, Util +from Synopsis import AST, Util # HTML modules import Page @@ -81,7 +84,7 @@ from Tags import * # Link module link = None try: - link = Util._import("Synopsis.Parser.Cxx.link") + link = Util._import("Synopsis.Parsers.Cxx.link") except ImportError: print "Warning: unable to import link module. Continuing..." Index: FileTreeJS.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/FileTreeJS.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -d -r1.7 -r1.8 --- FileTreeJS.py 2 Nov 2002 06:37:37 -0000 1.7 +++ FileTreeJS.py 11 Nov 2003 06:01:13 -0000 1.8 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.8 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.7 2002/11/02 06:37:37 chalky # Allow non-frames output, some refactoring of page layout, new modules. # @@ -59,7 +62,7 @@ import os # Synopsis modules -from Synopsis.Core import AST, Util +from Synopsis import AST, Util # HTML modules import JSTree Index: FormatStrategy.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/FormatStrategy.py,v retrieving revision 1.30 retrieving revision 1.31 diff -u -p -d -r1.30 -r1.31 --- FormatStrategy.py 20 Jan 2003 06:43:02 -0000 1.30 +++ FormatStrategy.py 11 Nov 2003 06:01:13 -0000 1.31 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.31 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.30 2003/01/20 06:43:02 chalky # Refactored comment processing. Added AST.CommentTag. Linker now determines # comment summary and extracts tags. Increased AST version number. @@ -136,7 +139,7 @@ comments. import types, os, string # Synopsis modules -from Synopsis.Core import AST, Type, Util +from Synopsis import AST, Type, Util # HTML modules import Tags, core @@ -568,12 +571,12 @@ class ClassHierarchySimple (Strategy): class ClassHierarchyGraph (ClassHierarchySimple): """Prints a graphical hierarchy for classes, using the Dot formatter. - @see Formatter.Dot + @see Formatters.Dot """ def formatClass(self, clas): try: import tempfile - from Synopsis.Formatter import Dot + from Synopsis.Formatters import Dot except: print "HierarchyGraph: Dot not found" return "" Index: Formatter.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Formatter.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -d -r1.1 -r1.2 --- Formatter.py 11 Nov 2003 04:53:41 -0000 1.1 +++ Formatter.py 11 Nov 2003 06:01:13 -0000 1.2 @@ -7,7 +7,7 @@ # from Synopsis.Processor import Processor, Parameter -from Synopsis.Core import AST +from Synopsis import AST from FramesIndex import * from ScopePages import * from ModuleListing import * @@ -37,7 +37,7 @@ class ConfigHTML: datadir = '/usr/local' + '/share/synopsis' stylesheet = 'style.css' stylesheet_file = datadir + '/html.css' - file_layout = 'Synopsis.Formatter.HTML.FileLayout.FileLayout' + file_layout = 'Synopsis.Formatters.HTML.FileLayout.FileLayout' pages = ['FramesIndex', 'ScopePages', 'ModuleListing', Index: InheritanceGraph.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/InheritanceGraph.py,v retrieving revision 1.24 retrieving revision 1.25 diff -u -p -d -r1.24 -r1.25 --- InheritanceGraph.py 1 Feb 2003 05:35:45 -0000 1.24 +++ InheritanceGraph.py 11 Nov 2003 06:01:13 -0000 1.25 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.25 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.24 2003/02/01 05:35:45 chalky # Remove warning # @@ -111,7 +114,7 @@ import os -from Synopsis.Core import AST, Type, Util +from Synopsis import AST, Type, Util import core, Page from core import config @@ -223,7 +226,7 @@ class InheritanceGraph(Page.Page): self.write(entity('h1', "Inheritance Graph")) try: - from Synopsis.Formatter import Dot + from Synopsis.Formatters import Dot except: print "InheritanceGraph: Can't load the Dot formatter" self.end_file() Index: InheritanceTree.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/InheritanceTree.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -p -d -r1.10 -r1.11 --- InheritanceTree.py 4 Jul 2002 06:43:18 -0000 1.10 +++ InheritanceTree.py 11 Nov 2003 06:01:13 -0000 1.11 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.11 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.10 2002/07/04 06:43:18 chalky # Improved support for absolute references - pages known their full path. # @@ -56,7 +59,7 @@ # import os -from Synopsis.Core import Util +from Synopsis import Util import core, Page from core import config Index: ModuleIndexer.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/ModuleIndexer.py,v retrieving revision 1.13 retrieving revision 1.14 diff -u -p -d -r1.13 -r1.14 --- ModuleIndexer.py 2 Nov 2002 06:37:37 -0000 1.13 +++ ModuleIndexer.py 11 Nov 2003 06:01:13 -0000 1.14 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.14 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.13 2002/11/02 06:37:37 chalky # Allow non-frames output, some refactoring of page layout, new modules. # @@ -66,7 +69,7 @@ # import os -from Synopsis.Core import AST, Util +from Synopsis import AST, Util import core, Page from core import config Index: ModuleListing.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/ModuleListing.py,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -d -r1.11 -r1.12 --- ModuleListing.py 2 Nov 2002 06:37:37 -0000 1.11 +++ ModuleListing.py 11 Nov 2003 06:01:13 -0000 1.12 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.12 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.11 2002/11/02 06:37:37 chalky # Allow non-frames output, some refactoring of page layout, new modules. # @@ -80,7 +83,7 @@ import os # Synopsis modules -from Synopsis.Core import AST, Util +from Synopsis import AST, Util # HTML modules import core Index: ModuleListingJS.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/ModuleListingJS.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -d -r1.9 -r1.10 --- ModuleListingJS.py 5 Jul 2001 05:39:58 -0000 1.9 +++ ModuleListingJS.py 11 Nov 2003 06:01:13 -0000 1.10 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.10 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.9 2001/07/05 05:39:58 stefan # advanced a lot in the refactoring of the HTML module. # Page now is a truely polymorphic (abstract) class. Some derived classes @@ -62,7 +65,7 @@ import os # Synopsis modules -from Synopsis.Core import AST, Util +from Synopsis import AST, Util # HTML modules import core Index: NameIndex.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/NameIndex.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -p -d -r1.10 -r1.11 --- NameIndex.py 1 Nov 2002 07:21:15 -0000 1.10 +++ NameIndex.py 11 Nov 2003 06:01:13 -0000 1.11 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.11 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.10 2002/11/01 07:21:15 chalky # More HTML formatting fixes eg: ampersands and stuff # @@ -60,8 +63,8 @@ # import os -from Synopsis.Core import AST, Type -from Synopsis.Formatter.HTML import core, Tags, Page +from Synopsis import AST, Type +from Synopsis.Formatters.HTML import core, Tags, Page from Tags import * from core import config Index: Page.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Page.py,v retrieving revision 1.17 retrieving revision 1.18 diff -u -p -d -r1.17 -r1.18 --- Page.py 21 Oct 2003 20:53:30 -0000 1.17 +++ Page.py 11 Nov 2003 06:01:13 -0000 1.18 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.18 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.17 2003/10/21 20:53:30 stefan # reenable logging of page instance to aid debugging # @@ -80,7 +83,7 @@ Page base class, contains base functiona """ import os.path, cStringIO -from Synopsis.Core import Util +from Synopsis import Util import core from core import config @@ -253,7 +256,7 @@ class Page: self.__os = None format_class = PageFormat if config.page_format: - format_class = Util.import_object(config.page_format, basePackage = 'Synopsis.Formatter.HTML.Page.') + format_class = Util.import_object(config.page_format, basePackage = 'Synopsis.Formatters.HTML.Page.') self.__format = format_class() def filename(self): Index: RawFilePages.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/RawFilePages.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -d -r1.5 -r1.6 --- RawFilePages.py 8 Nov 2003 19:49:54 -0000 1.5 +++ RawFilePages.py 11 Nov 2003 06:01:13 -0000 1.6 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.6 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.5 2003/11/08 19:49:54 stefan # replace statcache.stat by os.stat # @@ -41,7 +44,7 @@ import time, os, stat, os.path, string # Synopsis modules -from Synopsis.Core import AST, Util +from Synopsis import AST, Util # Formatter modules from Synopsis.Formatter import TOC Index: ScopePages.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/ScopePages.py,v retrieving revision 1.19 retrieving revision 1.20 diff -u -p -d -r1.19 -r1.20 --- ScopePages.py 7 Oct 2003 14:06:16 -0000 1.19 +++ ScopePages.py 11 Nov 2003 06:01:13 -0000 1.20 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.20 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.19 2003/10/07 14:06:16 stefan # refer to the new site # @@ -86,10 +89,10 @@ import time, os # Synopsis modules -from Synopsis.Core import AST +from Synopsis import AST # Formatter modules -from Synopsis.Formatter import TOC +from Synopsis.Formatters import TOC # HTML modules import Page @@ -105,7 +108,7 @@ class ScopePages (Page.Page): ASTFormatter to do the actual formatting. The classes to use may be controlled via the config script, resulting in a very configurable output. @see ASTFormatter The ASTFormatter module - @see Config.Formatter.HTML.ScopePages Config for ScopePages + @see Config.Formatters.HTML.ScopePages Config for ScopePages """ def __init__(self, manager): Page.Page.__init__(self, manager) @@ -124,7 +127,7 @@ class ScopePages (Page.Page): parts = config.obj.ScopePages.parts except AttributeError: parts = ['Heading', 'Summary', 'Detail'] - base = 'Synopsis.Formatter.HTML.ASTFormatter.' + base = 'Synopsis.Formatters.HTML.ASTFormatter.' for part in parts: obj = core.import_object(part, basePackage=base)(self) self.__parts.append(obj) Index: ScopeSorter.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/ScopeSorter.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -d -r1.8 -r1.9 --- ScopeSorter.py 28 Oct 2002 06:12:31 -0000 1.8 +++ ScopeSorter.py 11 Nov 2003 06:01:13 -0000 1.9 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.9 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.8 2002/10/28 06:12:31 chalky # Add structs_as_classes option # @@ -53,7 +56,7 @@ This module contains the class for sorti import string # Synopsis modules -from Synopsis.Core import AST +from Synopsis import AST # HTML modules import core Index: TreeFormatterJS.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/TreeFormatterJS.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- TreeFormatterJS.py 26 Jun 2001 04:32:16 -0000 1.3 +++ TreeFormatterJS.py 11 Nov 2003 06:01:13 -0000 1.4 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.4 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.3 2001/06/26 04:32:16 stefan # A whole slew of changes mostly to fix the HTML formatter's output generation, # i.e. to make the output more robust towards changes in the layout of files. @@ -45,7 +48,7 @@ import os -from Synopsis.Core import AST +from Synopsis import AST import Page from core import config from Tags import * Index: XRefPages.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/XRefPages.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -d -r1.9 -r1.10 --- XRefPages.py 9 Dec 2002 04:00:59 -0000 1.9 +++ XRefPages.py 11 Nov 2003 06:01:13 -0000 1.10 @@ -19,6 +19,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.10 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.9 2002/12/09 04:00:59 chalky # Added multiple file support to parsers, changed AST datastructure to handle # new information, added a demo to demo/C++. AST Declarations now have a @@ -53,10 +56,10 @@ import os # Synopsis modules -from Synopsis.Core import AST, Type, Util +from Synopsis import AST, Type, Util # Formatter modules -from Synopsis.Formatter import TOC +from Synopsis.Formatters import TOC # HTML modules import Page Index: core.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/core.py,v retrieving revision 1.47 retrieving revision 1.48 diff -u -p -d -r1.47 -r1.48 --- core.py 20 Jan 2003 06:43:02 -0000 1.47 +++ core.py 11 Nov 2003 06:01:13 -0000 1.48 @@ -19,6 +19,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.48 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.47 2003/01/20 06:43:02 chalky # Refactored comment processing. Added AST.CommentTag. Linker now determines # comment summary and extracts tags. Increased AST version number. @@ -215,12 +218,12 @@ import sys, getopt, os, os.path, string, # Synopsis modules from Synopsis.Config import Base -from Synopsis.Core import AST, Type, Util -from Synopsis.Core.FileTree import FileTree -from Synopsis.Formatter import TOC, ClassTree, xref -from Synopsis.Formatter.HTML import TreeFormatter +from Synopsis import AST, Type, Util +from Synopsis.FileTree import FileTree +from Synopsis.Formatters import TOC, ClassTree, xref +from Synopsis.Formatters.HTML import TreeFormatter -from Synopsis.Core.Util import import_object +from Synopsis.Util import import_object verbose=0 @@ -321,7 +324,7 @@ class Config: def _config_comment_formatters(self, comment_formatters): if self.verbose > 1: print "Using comment formatters:", comment_formatters - basePackage = 'Synopsis.Formatter.HTML.CommentFormatter.' + basePackage = 'Synopsis.Formatters.HTML.CommentFormatter.' for formatter in comment_formatters: if type(formatter) == types.StringType: if CommentFormatter.commentFormatters.has_key(formatter): @@ -348,7 +351,7 @@ class Config: def _config_tree_formatter(self, tree_class): if self.verbose > 1: print "Using tree class",tree_class - clas = import_object(tree_class, basePackage='Synopsis.Formatter.HTML.') + clas = import_object(tree_class, basePackage='Synopsis.Formatters.HTML.') self.treeFormatterClass = clas def _config_file_layout(self, layout): @@ -601,7 +604,7 @@ class PageManager: strings means load the module from the first string, and look for an attribute using the second string.""" defaultAttr = 'htmlPageClass' - basePackage = 'Synopsis.Formatter.HTML.' + basePackage = 'Synopsis.Formatters.HTML.' for page in list(config.pages): obj = self.addPage(import_object(page, defaultAttr, basePackage)) self.__page_objects[page] = obj Index: doxygen.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/doxygen.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -d -r1.5 -r1.6 --- doxygen.py 20 Jan 2003 06:43:02 -0000 1.5 +++ doxygen.py 11 Nov 2003 06:01:13 -0000 1.6 @@ -20,6 +20,9 @@ # 02111-1307, USA. # # $Log$ +# Revision 1.6 2003/11/11 06:01:13 stefan +# adjust to directory/package layout changes +# # Revision 1.5 2003/01/20 06:43:02 chalky # Refactored comment processing. Added AST.CommentTag. Linker now determines # comment summary and extracts tags. Increased AST version number. @@ -42,11 +45,11 @@ import string -from Synopsis.Core import AST -from Synopsis.Formatter.HTML import ScopeSorter, core -from Synopsis.Formatter.HTML.core import config -from Synopsis.Formatter.HTML.Tags import * -from Synopsis.Formatter.HTML import ASTFormatter, FormatStrategy +from Synopsis import AST +from Synopsis.Formatters.HTML import ScopeSorter, core +from Synopsis.Formatters.HTML.core import config +from Synopsis.Formatters.HTML.Tags import * +from Synopsis.Formatters.HTML import ASTFormatter, FormatStrategy class DOScopeSorter (ScopeSorter.ScopeSorter): From stefan at synopsis.fresco.org Tue Nov 11 06:01:47 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:48 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parsers/Cxx Parser.py,1.3,1.4 __init__.py,1.9,1.10 emul.py,1.8,1.9 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parsers/Cxx In directory frida:/tmp/cvs-serv11207/Synopsis/Parsers/Cxx Modified Files: Parser.py __init__.py emul.py Log Message: adjust to directory/package layout changes Index: Parser.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parsers/Cxx/Parser.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- Parser.py 11 Nov 2003 02:58:31 -0000 1.3 +++ Parser.py 11 Nov 2003 06:01:45 -0000 1.4 @@ -14,7 +14,7 @@ use by python. """ from Synopsis.Processor import Processor, Parameter -from Synopsis.Core import AST +from Synopsis import AST import occ class Parser(Processor): Index: __init__.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parsers/Cxx/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -d -r1.9 -r1.10 --- __init__.py 5 Nov 2003 17:36:55 -0000 1.9 +++ __init__.py 11 Nov 2003 06:01:45 -0000 1.10 @@ -8,11 +8,6 @@ from Parser import * -try: - import occ -except: - import sys - print sys.exc_type, sys.exc_value import emul def usage(): Index: emul.py =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parsers/Cxx/emul.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -d -r1.8 -r1.9 --- emul.py 29 Oct 2002 07:15:35 -0000 1.8 +++ emul.py 11 Nov 2003 06:01:45 -0000 1.9 @@ -23,6 +23,9 @@ # different compilers # $Log$ +# Revision 1.9 2003/11/11 06:01:45 stefan +# adjust to directory/package layout changes +# # Revision 1.8 2002/10/29 07:15:35 chalky # Define __STRICT_ANSI__ for gcc 2.x to avoid parse errors # @@ -50,7 +53,7 @@ # import sys, os, os.path, re, string, stat, tempfile -from Synopsis.Core import Util +from Synopsis import Util # The filename where infos are stored user_emulations_file = '~/.synopsis/cpp_emulations' From stefan at synopsis.fresco.org Tue Nov 11 06:01:48 2003 From: stefan at synopsis.fresco.org (Stefan Seefeld) Date: Wed Mar 2 21:06:48 2005 Subject: [Synopsis-changes] Synopsis/Synopsis/Synopsis/Parsers/Cxx/syn ast.hh,1.22,1.23 occ.cc,1.90,1.91 synopsis.cc,1.48,1.49 Message-ID: Update of /cvs/synopsis/Synopsis/Synopsis/Parsers/Cxx/syn In directory frida:/tmp/cvs-serv11207/Synopsis/Parsers/Cxx/syn Modified Files: ast.hh occ.cc synopsis.cc Log Message: adjust to directory/package layout changes Index: ast.hh =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parsers/Cxx/syn/ast.hh,v retrieving revision 1.22 retrieving revision 1.23 diff -u -p -d -r1.22 -r1.23 --- ast.hh 27 Jan 2003 06:53:36 -0000 1.22 +++ ast.hh 11 Nov 2003 06:01:45 -0000 1.23 @@ -24,7 +24,7 @@ // vim: set ts=8 sts=2 sw=2 et: // File: ast.h // A C++ class hierarchy that more or less mirrors the AST hierarchy in -// Python/Core.AST. +// Python/AST. #ifndef H_SYNOPSIS_CPP_AST #define H_SYNOPSIS_CPP_AST Index: occ.cc =================================================================== RCS file: /cvs/synopsis/Synopsis/Synopsis/Parsers/Cxx/syn/occ.cc,v retrieving revision 1.90 retrieving revision 1.91 diff -u -p -d -r1.90 -r1.91 --- occ.cc 5 Nov 2003 19:52:24 -0000 1.90 +++ occ.cc 11 Nov 2003 06:01:45 -0000 1.91 @@ -24,6 +24,9 @@ // 02111-1307, USA. // $Log$ +// Revision 1.91 2003/11/11 06:01:45 stefan +// adjust to directory/package layout changes +/