From: Grzegorz J. <ja...@he...> - 2004-01-15 01:34:56
|
Hi, I checked in new a revised code into 'jakacki_sandbox_frontend1' branch. The changes/additions include: 'occ2' --- shell script that uses libtool for all linking and compilation needs. This is an implementation of a solution that has been discussed long time ago. This script is my candidate for the main occ command-line interface point. (In fact occ2's iface tries to mimic occ's iface as closely as possible.) My plan is to migrate toward this solution and remove platform-specific lining/compilation code from driver.cc and driver2.cc (possibly leaving Windows support, since occ2 being a bash script will not work with vanila VC++). 'occ2-test' --- shell script that tests functionality of 'occ2'. 'tester2' --- new much much simpler test script. I decided that existing solution proved to be way overengineered. The new one has the same functionality but less code. It is also easier to add and/or disable testcases. --disable-gc configure options (this was suggested either on the list on in private e-mails) --enable-opt=[none,medium,high] configure option --- sets optimization level, default is medium (-O2 on gcc). Currently works for gcc only, all other compilers must go with default level. If you know how to specify other levels on your compiler, please add this knowledge to configure.in (this was suggested either on the list or in private e-mails) 'make test' now runs 'make install' and runs tests against the installed headers and executables. This should solve a couple of problems with libtool linking, that Alex Tolmos hit on MacOS X. 'make tests' makes sure that ${prefix} is equal to ${builddir}/testbed, so that 'make test' does not install in e.g. system-wide directory. Source code is broken into smaller pieces, roughly one component per class or a set of a few tightly coupled classes (e.g. container and iterator). Some upward and superfluous dependencies have been removed (e.g. dependency of Ptree on ProgramString). Most of the items in a patch submitted by Marc Ordinas i Llopis have been applied. 'MetaclassRegistry' singleton class that does not rely on static initialization has been introduced in place of 'opcxx_ListOfMetaclass'. 'ErrorLog' abstract base has been introduced as universal error reporing mechanism along with hierarchy derived from (abstract) Msg class. This enables writting unit tests that capture error messages using mock implementation of ErrorLog. Standard implementation 'CerrErrorLog' prints the error messages to stderr. As interim solution the singleton object conforming to ErrorLog interface is accessible through namespace-level function 'TheErrorLog()'. Responsibility for stopping compilation in case of too many errors has been moved into ErrorLog, which can throw exception if it thinks it had too much. Foo-init.so now does not rely on static initialization of dlopened libraries (which does not work on all platforms). Metaclass has to be initialized explicitly and metaclass loading code does it no matter what the platform is. As many filenames changed (due to breakdown) and the CVS continuity has been lost anyway, I decided to do two things at once and move sources from 'src/' to 'opencxx/'. This makes it easier to install all the sources in ${includedir}/opencxx and at the same time use '#include <opencxx/...>' internally within OpenC++. Consequently it isolates OpenC++ from accidentally including a file that has the same name as OpenC++ component, but is located earlier in inclusion search path. For every blackbox testcase a corresponding testcase has been added to check the same functionality using compilation via dlopenable metaclass module. The ultimate goals of the changes are: * moving platform-awarness from driver{,2}.cc to libtool * isolating parser, so that it can be tested independently from the rest of the system. The latter goal has not been accomplished yet, see TODO for the list of things that need to be done. Independent testing of parser makes it easier to implement and test correct tempalate parsing (e.g. 'x < 1 > (2)'), which is a step towards better templates support. A nice side-effect is parser reusability. I would very much appreciate any comments and/or criticism of the code in 'sandbox_jakacki_frontend1'. If there are no huge objections I will merge it to MAIN. The source code was tested with gcc-2.95 on Linux. Best regards Grzegorz ################################################################## # Grzegorz Jakacki Huada Electronic Design # # Senior Engineer, CAD Dept. 1 Gaojiayuan, Chaoyang # # tel. +86-10-64365577 x2074 Beijing 100015, China # # Copyright (C) 2003 Grzegorz Jakacki, HED. All Rights Reserved. # ################################################################## |