diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index f0605dfa..40be8e88 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -249,9 +249,6 @@ namespace CRL { System::get(); AllianceFramework* af = new AllianceFramework (); af->_postCreate(); - //if (not (flags & NoPythonInit)) - // System::runPythonInit(); - //_singleton->bindLibraries(); } return _singleton; diff --git a/crlcore/src/ccore/CConfig.h.in b/crlcore/src/ccore/CConfig.h similarity index 97% rename from crlcore/src/ccore/CConfig.h.in rename to crlcore/src/ccore/CConfig.h index dd386f19..cb67df0d 100644 --- a/crlcore/src/ccore/CConfig.h.in +++ b/crlcore/src/ccore/CConfig.h @@ -24,9 +24,6 @@ # define __CCONFIG_H__ -/* The root directory where CORIOLIS is to be installed. */ -#undef CORIOLIS_TOP - /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H diff --git a/crlcore/src/ccore/CConfig.h.cmake b/crlcore/src/ccore/CConfig.h.cmake deleted file mode 100644 index 2682acca..00000000 --- a/crlcore/src/ccore/CConfig.h.cmake +++ /dev/null @@ -1 +0,0 @@ -#cmakedefine CORIOLIS_TOP diff --git a/crlcore/src/ccore/Environment.cpp b/crlcore/src/ccore/Environment.cpp index d7fabfbd..0c1ae608 100644 --- a/crlcore/src/ccore/Environment.cpp +++ b/crlcore/src/ccore/Environment.cpp @@ -56,8 +56,7 @@ namespace CRL { // Class : "Environment". Environment::Environment () - : _CORIOLIS_TOP (CORIOLIS_TOP) - , _displayStyle () + : _displayStyle () , _SCALE_X (10) , _IN_LO ("vst") , _IN_PH ("ap") @@ -335,7 +334,6 @@ namespace CRL { Record *Environment::_getRecord () const { Record* record = new Record ( "" ); - record->add ( getSlot ( "_CORIOLIS_TOP" , &_CORIOLIS_TOP ) ); record->add ( getSlot ( "_displayStyle" , &_displayStyle ) ); record->add ( getSlot ( "_SCALE_X" , &_SCALE_X ) ); record->add ( getSlot ( "_IN_LO" , &_IN_LO ) ); @@ -357,7 +355,6 @@ namespace CRL { { w->startObject(); jsonWrite( w, "@typename" , _getTypeName() ); - jsonWrite( w, "_CORIOLIS_TOP", _CORIOLIS_TOP ); jsonWrite( w, "_displayStyle", _displayStyle ); jsonWrite( w, "_SCALE_X" , _SCALE_X ); jsonWrite( w, "_IN_LO" , _IN_LO ); @@ -387,7 +384,6 @@ namespace CRL { JsonEnvironment::JsonEnvironment ( unsigned long flags ) : JsonObject(flags) { - add( "_CORIOLIS_TOP", typeid(string) ); add( "_displayStyle", typeid(string) ); add( "_SCALE_X" , typeid(int64_t) ); add( "_IN_LO" , typeid(string) ); diff --git a/crlcore/src/ccore/ToolEngine.cpp b/crlcore/src/ccore/ToolEngine.cpp index 599a0786..c5645c70 100644 --- a/crlcore/src/ccore/ToolEngine.cpp +++ b/crlcore/src/ccore/ToolEngine.cpp @@ -193,8 +193,8 @@ namespace CRL { ToolEngine::ToolEngine ( Cell* cell, bool verbose ) : Super() - , _verbose (verbose) , _cell (cell) + , _verbose (verbose) , _placementModificationFlag(0) , _routingModificationFlag (0) , _inRelationDestroy (false) diff --git a/crlcore/src/ccore/Utilities.cpp b/crlcore/src/ccore/Utilities.cpp index 98a6d3c7..1861d530 100644 --- a/crlcore/src/ccore/Utilities.cpp +++ b/crlcore/src/ccore/Utilities.cpp @@ -114,9 +114,7 @@ namespace { std::string environmentMapper ( std::string environmentName ) { - if ( environmentName == "HOME" ) return "home"; - else if ( environmentName == "CORIOLIS_TOP" ) return "coriolis_top"; - else if ( environmentName == "STRATUS_MAPPING_NAME" ) return "stratus_mapping_name"; + if ( environmentName == "STRATUS_MAPPING_NAME" ) return "stratus_mapping_name"; return ""; } @@ -254,10 +252,6 @@ namespace CRL { // Environment variables reading. boptions::options_description options ("Environment Variables"); options.add_options() - ( "home" , boptions::value() - , "User's home directory." ) - ( "coriolis_top" , boptions::value()->default_value(CORIOLIS_TOP) - , "The root directory of the Coriolis installation tree." ) ( "stratus_mapping_name", boptions::value() , "Stratus virtual cells mapping." ); @@ -265,77 +259,6 @@ namespace CRL { boptions::store ( boptions::parse_environment(options,environmentMapper), arguments ); boptions::notify ( arguments ); - // Force creation of singleton at this stage. - // cerr << "In System singleton creation." << endl; - // AllianceFramework::get(); - // cerr << "AllianceFramework has been allocated." << endl; - - // cerr << "std::string typeid name:" << typeid(string).name() << endl; - - // Check for duplicated type_info initialization. - const boptions::variable_value& value = arguments["coriolis_top"]; - if ( value.value().type() != typeid(string) ) { - throw Error("type_info RTTI tree has been initialized twice.\n\n" - " This may be due to incorrect import of Python modules, please ensure\n" - " that the CRL module is always imported first." - ); - } - - if ( arguments.count("coriolis_top") ) { - _pathes.insert ( make_pair("coriolis_top", arguments["coriolis_top"].as()) ); - } - - Utilities::Path sysConfDir ( SYS_CONF_DIR ); - if ( not sysConfDir.absolute() ) { - if ( arguments.count("coriolis_top") ) { - // const boptions::variable_value& value = arguments["coriolis_top"]; - // cerr << "value:" - // << " empty:" << boolalpha << value.empty() - // << " defaulted:" << boolalpha << value.defaulted() - // << endl; - // const type_info& info = value.value().type(); - // cerr << "type_info:" << info.name() - // << " vs. " << typeid(string).name() << endl; - // cerr << "Equal:" << boolalpha << (info == typeid(std::string)) << endl; - - // const type_info& info2 = typeid(string); - // cerr << (void*)&(typeid(string)) - // << " vs. " << (void*)&info2 - // << " vs. " << (void*)&info - // << endl; - // cerr << "any_cast:" << boost::any_cast(value.value()) << endl; - - sysConfDir = arguments["coriolis_top"].as() / sysConfDir; - } else { - cerr << Error("Environment variable CORIOLIS_TOP not set," - " may be unable to read configuration...") << endl; - } - } - sysConfDir /= "coriolis2"; - _pathes.insert ( make_pair("etc" ,sysConfDir ) ); - _pathes.insert ( make_pair("home",arguments["home"].as()) ); - - // Early setting of python pathes to be able to execute configuration scripts. - Utilities::Path pythonSitePackages ( PYTHON_SITE_PACKAGES ); - pythonSitePackages = arguments["coriolis_top"].as() / pythonSitePackages; - _pathes.insert ( make_pair("pythonSitePackages",pythonSitePackages.toString()) ); - // Utilities::Path crlcoreDir = pythonSitePackages / "crlcore"; - // Utilities::Path stratusDir = pythonSitePackages / "stratus"; - // Utilities::Path cumulusDir = pythonSitePackages / "cumulus"; - // Utilities::Path oroshiDir = pythonSitePackages / "oroshi"; - // Utilities::Path karakazeDir = pythonSitePackages / "karakaze"; - Utilities::Path etcDir = _pathes["etc"]; - - Isobar::Script::addPath ( etcDir.toString() ); - Isobar::Script::addPath ( sysConfDir.toString() ); - Isobar::Script::addPath ( pythonSitePackages.toString() ); - // Isobar::Script::addPath ( crlcoreDir.toString() ); - // Isobar::Script::addPath ( stratusDir.toString() ); - // Isobar::Script::addPath ( cumulusDir.toString() ); - // Isobar::Script::addPath ( oroshiDir.toString() ); - // Isobar::Script::addPath ( karakazeDir.toString() ); - - // Triggers Configuration singleton creation. Cfg::Configuration::get (); Cfg::getParamBool ("misc.catchCore" ,false )->registerCb ( this, catchCoreChanged ); @@ -349,16 +272,6 @@ namespace CRL { Cfg::getParamInt ("misc.maxTraceLevel" ,0 )->registerCb ( this, maxTraceLevelChanged ); Cfg::getParamString("stratus1.mappingName","" )->registerCb ( this, stratus1MappingNameChanged ); - // Immediate update from the configuration. - //catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) ); - //verboseLevel1Changed ( Cfg::getParamBool("misc.verboseLevel1") ); - //verboseLevel2Changed ( Cfg::getParamBool("misc.verboseLevel2") ); - //infoChanged ( Cfg::getParamBool("misc.info" ) ); - //paranoidChanged ( Cfg::getParamBool("misc.paranoid" ) ); - //bugChanged ( Cfg::getParamBool("misc.bug" ) ); - //logModeChanged ( Cfg::getParamBool("misc.logMode" ) ); - //traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) ); - Utilities::Path stratusMappingName; if ( arguments.count("stratus_mapping_name") ) { Cfg::getParamString( "stratus1.mappingName")->setString ( arguments["stratus_mapping_name"].as() ); @@ -366,6 +279,7 @@ namespace CRL { } + System *System::get () { if ( _singleton == NULL ) { @@ -459,37 +373,6 @@ namespace CRL { return (*ipath).second; } - - void System::_runPythonInit () - { - Utilities::Path sysConfDir = getPath("etc"); - Utilities::Path pythonSitePackages = getPath("pythonSitePackages"); - - //bool systemConfFound = false; - Utilities::Path systemConfFile = pythonSitePackages / "crlcore" / "coriolisInit.py"; - if ( systemConfFile.exists() ) { - //systemConfFound = true; - //cout << " o Reading python dot configuration:" << endl; - //cout << " - <" << systemConfFile.string() << ">." << endl; - - Isobar::Script* systemScript = Isobar::Script::create(systemConfFile.stem().toString()); - systemScript->runFunction("coriolisConfigure",NULL,Isobar::Script::NoScriptArgs); - systemScript->destroy(); - } else { - cerr << Warning("System configuration file:\n <%s> not found." - ,systemConfFile.toString().c_str()) << endl; - } - - // Delayed printing, as we known only now whether VerboseLevel1 is requested. - //if ( cmess1.enabled() ) { - // cmess1 << " o Reading Configuration. " << endl; - // if (systemConfFound) cmess1 << " - <" << systemConfFile.string() << ">." << endl; - // if (homeConfFound) cmess1 << " - <" << homeConfFile.string() << ">." << endl; - // if (dotConfFound) cmess1 << " - <" << dotConfFile.string() << ">." << endl; - //} - } - - // ------------------------------------------------------------------- // Class : "CRL::IoFile". diff --git a/crlcore/src/ccore/crlcore/CConfig.h b/crlcore/src/ccore/crlcore/CConfig.h deleted file mode 100644 index 8899b736..00000000 --- a/crlcore/src/ccore/crlcore/CConfig.h +++ /dev/null @@ -1 +0,0 @@ -/* #undef CORIOLIS_TOP */ diff --git a/crlcore/src/ccore/crlcore/Environment.h b/crlcore/src/ccore/crlcore/Environment.h index a42bd697..80b9d9d8 100644 --- a/crlcore/src/ccore/crlcore/Environment.h +++ b/crlcore/src/ccore/crlcore/Environment.h @@ -40,7 +40,6 @@ namespace CRL { Environment (); ~Environment (); // Accessors. - inline const std::string& getCORIOLIS_TOP () const; inline const std::string& getDisplayStyle () const; inline long getSCALE_X () const; inline const std::string& getDISPLAY () const; @@ -90,7 +89,6 @@ namespace CRL { Record* _getRecord () const; protected: // Internal: Attributes. - std::string _CORIOLIS_TOP; std::string _displayStyle; long _SCALE_X; std::string _IN_LO; @@ -117,7 +115,6 @@ namespace CRL { // Inline Member Functions. - inline const std::string& Environment::getCORIOLIS_TOP () const { return _CORIOLIS_TOP; } inline const std::string& Environment::getDisplayStyle () const { return _displayStyle; } inline long Environment::getSCALE_X () const { return _SCALE_X; } inline const std::string& Environment::getIN_LO () const { return _IN_LO; } diff --git a/crlcore/src/ccore/crlcore/Utilities.h b/crlcore/src/ccore/crlcore/Utilities.h index 7a15d4b5..732c23e4 100644 --- a/crlcore/src/ccore/crlcore/Utilities.h +++ b/crlcore/src/ccore/crlcore/Utilities.h @@ -46,7 +46,6 @@ namespace CRL { static inline bool getCatchCore (); static inline const Utilities::Path& getPath ( const std::string& ); static inline bool setCatchCore ( bool catchCore ); - static inline void runPythonInit (); private: static System* _singleton; bool _catchCore; @@ -59,14 +58,12 @@ namespace CRL { inline bool _getCatchCore (); const Utilities::Path& _getPath ( const std::string& ); inline bool _setCatchCore ( bool catchCore ); - void _runPythonInit (); }; inline bool System::getCatchCore () { return get()->_getCatchCore(); } inline const Utilities::Path& System::getPath ( const std::string& key ) { return get()->_getPath(key); } inline bool System::setCatchCore ( bool catchCore ) { return get()->_setCatchCore(catchCore); } - inline void System::runPythonInit () { return get()->_runPythonInit(); } // ------------------------------------------------------------------- diff --git a/crlcore/src/pyCRL/PyCRL.cpp b/crlcore/src/pyCRL/PyCRL.cpp index 614a95fb..6adbbd93 100644 --- a/crlcore/src/pyCRL/PyCRL.cpp +++ b/crlcore/src/pyCRL/PyCRL.cpp @@ -106,16 +106,13 @@ extern "C" { static PyModuleDef PyCRL_ModuleDef = - { PyModuleDef_HEAD_INIT - , "CRL" /* m_name */ - , "Coriolis Core I/O framework" - /* m_doc */ - , -1 /* m_size */ - , PyCRL_Methods /* m_methods */ - , NULL /* m_reload */ - , NULL /* m_traverse */ - , NULL /* m_clear */ - , NULL /* m_free */ + { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "CRL", + .m_doc = "Coriolis Core I/O framework", + .m_size = -1, + .m_methods = PyCRL_Methods, +// .m_slots = PyCRL_Slots }; diff --git a/crlcore/src/pyCRL/PyEnvironment.cpp b/crlcore/src/pyCRL/PyEnvironment.cpp index 67403533..07b6bfaa 100644 --- a/crlcore/src/pyCRL/PyEnvironment.cpp +++ b/crlcore/src/pyCRL/PyEnvironment.cpp @@ -145,7 +145,6 @@ extern "C" { // Standart Accessors (Attributes). - DirectGetStringAttribute(PyEnvironment_getCORIOLIS_TOP,getCORIOLIS_TOP,PyEnvironment,Environment) DirectGetStringAttribute(PyEnvironment_getDisplayStyle,getDisplayStyle,PyEnvironment,Environment) DirectGetLongAttribute (PyEnvironment_getSCALE_X ,getSCALE_X ,PyEnvironment,Environment) DirectGetStringAttribute(PyEnvironment_getIN_LO ,getIN_LO ,PyEnvironment,Environment) @@ -190,9 +189,7 @@ extern "C" { PyMethodDef PyEnvironment_Methods[] = - { { "getCORIOLIS_TOP" , (PyCFunction)PyEnvironment_getCORIOLIS_TOP , METH_NOARGS - , "Gets the symbolic technology file." } - , { "getDisplayStyle" , (PyCFunction)PyEnvironment_getDisplayStyle , METH_NOARGS + { { "getDisplayStyle" , (PyCFunction)PyEnvironment_getDisplayStyle , METH_NOARGS , "Gets the name of the display style currently in use." } , { "getSCALE_X" , (PyCFunction)PyEnvironment_getSCALE_X , METH_NOARGS , "Gets the SCALE_X factor (for fixed point computation)." } diff --git a/crlcore/src/pyCRL/meson.build b/crlcore/src/pyCRL/meson.build new file mode 100644 index 00000000..8b096d12 --- /dev/null +++ b/crlcore/src/pyCRL/meson.build @@ -0,0 +1,68 @@ +py.extension_module( + 'Constant', + 'PyConstant.cpp', + dependencies: [qt_deps, py_deps, boost, Hurricane], + include_directories: crlcore_includes + subdir: 'coriolis' +) + +py.extension_module( + 'CRL', + + 'PyCRL.cpp', + 'PySystem.cpp', + 'PyBanner.cpp', + 'PyCatalog.cpp', + 'PyCatalogState.cpp', + 'PyEnvironment.cpp', + 'PyAllianceLibrary.cpp', + 'PyCellGauge.cpp', + 'PyRoutingGauge.cpp', + 'PyRoutingLayerGauge.cpp', + 'PyAllianceFramework.cpp', + 'PyToolBox.cpp', + 'PyToolEngine.cpp', + 'PyToolEngineCollection.cpp', + 'PyGraphicToolEngine.cpp', + 'PyAcmSigda.cpp', + 'PySpice.cpp', + 'PyBlif.cpp', + 'PyGds.cpp', + 'PyLefImport.cpp', + 'PyDefImport.cpp', + 'PyLefExport.cpp', + 'PyDefExport.cpp', + + dependencies: [qt_deps, py_deps, boost, Hurricane], + include_directories: crlcore_includes +) + +py.install_sources( + '__init__.py', + '', + 'helpers/__init__.py', + 'helpers/io.py', + 'helpers/utils.py', + 'helpers/overlay.py', + 'helpers/analogtechno.py', + 'helpers/technology.py', + '', + 'technos/__init__.py', + 'technos/common', + 'technos/symbolic', + 'technos/node600', + 'technos/node180', + 'technos/node45', + subdir: 'coriolis' +) + +pypathdir = meson.current_build_dir() + +# Create a test script that runs a python script that uses +# the C external module. Must populate PYTHONPATH to include +# a path that includes the mymath.so dynamic library. +test('pyCRL', + py, + args : files('mymath_test.py'), + env : ['PYTHONPATH=' + pypathdir]) +