pygccxml-commit Mailing List for C++ Python language bindings (Page 34)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(190) |
Apr
(166) |
May
(170) |
Jun
(75) |
Jul
(105) |
Aug
(131) |
Sep
(99) |
Oct
(84) |
Nov
(67) |
Dec
(54) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(66) |
Feb
(49) |
Mar
(25) |
Apr
(62) |
May
(21) |
Jun
(34) |
Jul
(9) |
Aug
(21) |
Sep
(5) |
Oct
|
Nov
(63) |
Dec
(34) |
2008 |
Jan
(10) |
Feb
(42) |
Mar
(26) |
Apr
(25) |
May
(6) |
Jun
(40) |
Jul
(18) |
Aug
(29) |
Sep
(6) |
Oct
(32) |
Nov
(14) |
Dec
(56) |
2009 |
Jan
(127) |
Feb
(52) |
Mar
(2) |
Apr
(10) |
May
(29) |
Jun
(3) |
Jul
|
Aug
(16) |
Sep
(4) |
Oct
(11) |
Nov
(8) |
Dec
(14) |
2010 |
Jan
(31) |
Feb
(1) |
Mar
(7) |
Apr
(9) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(8) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rom...@us...> - 2007-05-05 19:19:10
|
Revision: 1033 http://svn.sourceforge.net/pygccxml/?rev=1033&view=rev Author: roman_yakovenko Date: 2007-05-05 12:19:11 -0700 (Sat, 05 May 2007) Log Message: ----------- updating the comment Modified Paths: -------------- pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py Modified: pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py 2007-05-05 19:18:21 UTC (rev 1032) +++ pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py 2007-05-05 19:19:11 UTC (rev 1033) @@ -42,7 +42,7 @@ , 'hash_map' : "boost/python/suite/indexing/map.hpp" , 'set' : "boost/python/suite/indexing/set.hpp" , 'hash_set' : "boost/python/suite/indexing/set.hpp" - #TODO: queue, priority, stack, multimap, hash_multimap, multiset, hash_multiset + #TODO: queue, priority, stack, hash_multimap, multiset, hash_multiset } class indexing_suite2_t( object ): @@ -82,7 +82,7 @@ def set_use_container_suite( self, value ): self._use_container_suite = value use_container_suite = property( get_use_container_suite, set_use_container_suite ) - + def _get_container_class( self ): return self.__container_class container_class = property( _get_container_class @@ -99,12 +99,12 @@ element_type = property( _get_element_type , doc="Reference to container value_type( mapped_type ) type" ) - def _get_call_policies( self ): + def _get_call_policies( self ): if self.__call_policies: return self.__call_policies if self.container_traits not in declarations.sequential_container_traits: #TODO: find out why map's don't like the policy - return self.__call_policies + return self.__call_policies element_type = None try: element_type = self.element_type @@ -115,7 +115,7 @@ if declarations.is_pointer( element_type ): self.__call_policies = call_policies.return_internal_reference() return self.__call_policies - + def _set_call_policies( self, call_policies ): self.__call_policies = call_policies call_policies = property( _get_call_policies, _set_call_policies @@ -175,7 +175,7 @@ if name not in containers: self.__include_files = [] #not supported else: - #impl details: the order of header files is IMPORTANT + #impl details: the order of header files is IMPORTANT self.__include_files = [ "boost/python/suite/indexing/container_suite.hpp" , containers[ name ] ] return self.__include_files This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-05-05 19:18:20
|
Revision: 1032 http://svn.sourceforge.net/pygccxml/?rev=1032&view=rev Author: roman_yakovenko Date: 2007-05-05 12:18:21 -0700 (Sat, 05 May 2007) Log Message: ----------- removing dependency on boost::python::len function Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_repository/convenience.py Modified: pyplusplus_dev/pyplusplus/code_repository/convenience.py =================================================================== --- pyplusplus_dev/pyplusplus/code_repository/convenience.py 2007-05-04 13:31:21 UTC (rev 1031) +++ pyplusplus_dev/pyplusplus/code_repository/convenience.py 2007-05-05 19:18:21 UTC (rev 1032) @@ -35,15 +35,21 @@ boost::python::throw_error_already_set(); } -inline void -ensure_sequence( boost::python::object seq, index_type expected_length=-1 ){ - PyObject* seq_impl = seq.ptr(); - - if( !PySequence_Check( seq_impl ) ){ +inline index_type sequence_len(boost::python::object const& obj){ + if( !PySequence_Check( obj.ptr() ) ){ raise_error( PyExc_TypeError, "Sequence expected" ); } - index_type length = PySequence_Length( seq_impl ); + index_type result = PyObject_Length( obj.ptr() ); + if( PyErr_Occurred() ){ + boost::python::throw_error_already_set(); + } + return result; +} + +inline void +ensure_sequence( boost::python::object seq, index_type expected_length=-1 ){ + index_type length = sequence_len( seq ); if( expected_length != -1 && length != expected_length ){ std::stringstream err; err << "Expected sequence length is " << expected_length << ". " @@ -56,7 +62,7 @@ void ensure_uniform_sequence( boost::python::object seq, index_type expected_length=-1 ){ ensure_sequence( seq, expected_length ); - index_type length = boost::python::len( seq ); + index_type length = sequence_len( seq ); for( index_type index = 0; index < length; ++index ){ boost::python::object item = seq[index]; @@ -86,7 +92,7 @@ template< class Inserter > void copy_sequence( boost::python::object const& seq, Inserter inserter ){ - index_type length = boost::python::len( seq ); + index_type length = sequence_len( seq ); for( index_type index = 0; index < length; ++index ){ inserter = seq[index]; } @@ -94,7 +100,7 @@ template< class Inserter, class TItemType > void copy_sequence( boost::python::object const& seq, Inserter inserter, boost::type< TItemType > ){ - index_type length = boost::python::len( seq ); + index_type length = sequence_len( seq ); for( index_type index = 0; index < length; ++index ){ boost::python::object item = seq[index]; inserter = boost::python::extract< TItemType >( item ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2007-05-04 13:31:21
|
Revision: 1031 http://svn.sourceforge.net/pygccxml/?rev=1031&view=rev Author: alex_eisen Date: 2007-05-04 06:31:21 -0700 (Fri, 04 May 2007) Log Message: ----------- Fixed some complains of Roman Modified Paths: -------------- pyplusplus_dev/ide/controllers/controller_main.py pyplusplus_dev/ide/model/code_generator.py pyplusplus_dev/ide/views/frame_main.py Modified: pyplusplus_dev/ide/controllers/controller_main.py =================================================================== --- pyplusplus_dev/ide/controllers/controller_main.py 2007-05-02 19:22:25 UTC (rev 1030) +++ pyplusplus_dev/ide/controllers/controller_main.py 2007-05-04 13:31:21 UTC (rev 1031) @@ -319,8 +319,8 @@ Open dialog to get header file ''' self._open_file_dlg_text_ctrl( self._view.textHeader, - "Choose a Header file", - "Header (*.h)|*.h|All Files(*)|*") + "Choose a Header file","C/C++ files (*.h,*.hpp,*.hxx,*.c,"\ + "*.cpp,*.cxx)|*.h;*.hpp;*.hxx;*.c;*.cpp;*.cxx|All Files(*)|*") def OpenDlgGccXml(self): ''' @@ -415,7 +415,7 @@ dialog = wx.FileDialog(self._view, "Load existing Py++ project", self.param.last_prj_path.get(), - "", "Project files (*.xml)|*.xml|All Files(*)|*", wx.OPEN) + "", "Project files (*.pypp)|*.pypp|All Files(*)|*", wx.OPEN) try: if dialog.ShowModal() == wx.ID_OK: @@ -544,7 +544,7 @@ dialog = wx.FileDialog(self._view, "Save Py++ project to new file", self.param.last_prj_path.get(), "", - "Project files (*.xml)|*.xml|All Files(*)|*", wx.FD_SAVE) + "Project files (*.pypp)|*.pypp|All Files(*)|*", wx.FD_SAVE) if dialog.ShowModal() == wx.ID_OK: @@ -594,6 +594,12 @@ file_filter="All Files(*)|*", dir_path="."): """Open file open dialog and insert file in related wxText ctrl""" + + cur_file = related_wx_text.GetValue() + + if cur_file != "": + dir_path = os.path.dirname(related_wx_text.GetValue()) + dialog = wx.FileDialog(self._view, caption_txt, dir_path, "", file_filter, wx.OPEN) try: @@ -643,17 +649,23 @@ prj_list.reverse() for prj in prj_list: self._add_to_prj_history(prj) - + + # Change the title string: + # tilte := "<ConstPart> (<prj_name> in <prj_path>) <changedTag>" def _set_prj_filename_in_title(self, filename): - + if filename == self._prjTemplateFile: - filename = "New project" + prj_description = "New project" + else: + prj_name = os.path.basename(filename) + prj_path = os.path.dirname(filename) + prj_description = prj_name + " in " + prj_path title_str = self._view.GetTitle() start_idx = title_str.find("(") end_idx = title_str.find(")") fnamstr = title_str[start_idx:end_idx+1] - title_str = title_str.replace(fnamstr, "(" + filename + ")") + title_str = title_str.replace(fnamstr, "(" + prj_description + ")") self._view.SetTitle(title_str) def _reset_settings_changed(self): Modified: pyplusplus_dev/ide/model/code_generator.py =================================================================== --- pyplusplus_dev/ide/model/code_generator.py 2007-05-02 19:22:25 UTC (rev 1030) +++ pyplusplus_dev/ide/model/code_generator.py 2007-05-04 13:31:21 UTC (rev 1031) @@ -64,7 +64,7 @@ , working_directory=os.path.split( header_file )[0] , include_paths=include_paths , define_symbols=params[2] ) - + mb.build_code_creator( "pyplusplus" ) mb.code_creator.user_defined_directories.extend( include_paths ) code = mb.code_creator.create() Modified: pyplusplus_dev/ide/views/frame_main.py =================================================================== --- pyplusplus_dev/ide/views/frame_main.py 2007-05-02 19:22:25 UTC (rev 1030) +++ pyplusplus_dev/ide/views/frame_main.py 2007-05-04 13:31:21 UTC (rev 1031) @@ -318,69 +318,71 @@ self.panelSHUp = wx.Panel(id=wxID_MAINFRAMEPANELSHUP, name=u'panelSHUp', parent=self.splitterHorizontal, pos=wx.Point(0, 0), - size=wx.Size(782, 40), style=wx.TAB_TRAVERSAL) + size=wx.Size(782, 290), style=wx.TAB_TRAVERSAL) self.panelSHLow = wx.Panel(id=wxID_MAINFRAMEPANELSHLOW, name=u'panelSHLow', parent=self.splitterHorizontal, - pos=wx.Point(0, 44), size=wx.Size(782, 469), + pos=wx.Point(0, 294), size=wx.Size(782, 219), style=wx.TAB_TRAVERSAL) self.splitterHorizontal.SplitHorizontally(self.panelSHUp, self.panelSHLow, 300) self.nbLow = wx.Notebook(id=wxID_MAINFRAMENBLOW, name=u'nbLow', parent=self.panelSHLow, pos=wx.Point(0, 0), size=wx.Size(782, - 469), style=0) + 219), style=0) self.nbLow.SetLabel(u'Label') self.textOutput = wx.TextCtrl(id=wxID_MAINFRAMETEXTOUTPUT, name=u'textOutput', parent=self.nbLow, pos=wx.Point(0, 0), - size=wx.Size(774, 443), + size=wx.Size(774, 193), style=wx.TE_RICH | wx.TE_READONLY | wx.TE_MULTILINE, value=u'') self.splitterVertical = wx.SplitterWindow(id=wxID_MAINFRAMESPLITTERVERTICAL, name=u'splitterVertical', parent=self.panelSHUp, pos=wx.Point(0, - 0), size=wx.Size(782, 35), style=wx.SP_3D) + 0), size=wx.Size(782, 285), style=wx.SP_3D) self.splitterVertical.SetMinimumPaneSize(40) self.panelUpLeft = wx.Panel(id=wxID_MAINFRAMEPANELUPLEFT, name=u'panelUpLeft', parent=self.splitterVertical, pos=wx.Point(0, - 0), size=wx.Size(40, 35), style=wx.TAB_TRAVERSAL) + 0), size=wx.Size(298, 285), style=wx.TAB_TRAVERSAL) self.panelUpRight = wx.Panel(id=wxID_MAINFRAMEPANELUPRIGHT, name=u'panelUpRight', parent=self.splitterVertical, - pos=wx.Point(44, 0), size=wx.Size(738, 35), + pos=wx.Point(302, 0), size=wx.Size(480, 285), style=wx.TAB_TRAVERSAL) self.splitterVertical.SplitVertically(self.panelUpLeft, self.panelUpRight, 50) self.nbUpLeft = wx.Notebook(id=wxID_MAINFRAMENBUPLEFT, name=u'nbUpLeft', - parent=self.panelUpLeft, pos=wx.Point(0, 0), size=wx.Size(40, 35), - style=0) + parent=self.panelUpLeft, pos=wx.Point(0, 0), size=wx.Size(298, + 285), style=0) self.nbUpLeft.SetLabel(u'Label') self.nbUpLeft.SetHelpText(u'') self.nbUpRight = wx.Notebook(id=wxID_MAINFRAMENBUPRIGHT, name=u'nbUpRight', parent=self.panelUpRight, pos=wx.Point(0, 0), - size=wx.Size(738, 35), style=0) + size=wx.Size(480, 285), style=0) self.panelNbSettings = wx.Panel(id=wxID_MAINFRAMEPANELNBSETTINGS, name=u'panelNbSettings', parent=self.nbUpLeft, pos=wx.Point(0, 0), - size=wx.Size(32, 9), style=wx.TAB_TRAVERSAL) + size=wx.Size(290, 259), style=wx.TAB_TRAVERSAL) self.panelNbSettings.Show(True) self.panelNbSettings.SetMinSize(wx.Size(100, 100)) self.panelNbCode = wx.Panel(id=wxID_MAINFRAMEPANELNBCODE, name=u'panelNbCode', parent=self.nbUpRight, pos=wx.Point(0, 0), - size=wx.Size(730, 9), style=wx.TAB_TRAVERSAL) + size=wx.Size(472, 259), style=wx.TAB_TRAVERSAL) self.textCode = wx.TextCtrl(id=wxID_MAINFRAMETEXTCODE, name=u'textCode', - parent=self.panelNbCode, pos=wx.Point(0, 0), size=wx.Size(730, 0), - style=wx.TE_READONLY | wx.TE_MULTILINE, value=u'') + parent=self.panelNbCode, pos=wx.Point(0, 0), size=wx.Size(472, + 225), + style=wx.VSCROLL | wx.HSCROLL | wx.TE_READONLY | wx.TE_MULTILINE, + value=u'') self.textCode.SetHelpText(u'') self.panelButtons = wx.Panel(id=wxID_MAINFRAMEPANELBUTTONS, - name=u'panelButtons', parent=self.panelNbCode, pos=wx.Point(156, - -20), size=wx.Size(418, 24), style=wx.TAB_TRAVERSAL) + name=u'panelButtons', parent=self.panelNbCode, pos=wx.Point(27, + 230), size=wx.Size(418, 24), style=wx.TAB_TRAVERSAL) self.butGenXml = wx.Button(id=wxID_MAINFRAMEBUTGENXML, label=u'Generate XML code', name=u'butGenXml', @@ -407,17 +409,17 @@ self.textHeader = wx.TextCtrl(id=wxID_MAINFRAMETEXTHEADER, name=u'textHeader', parent=self.panelNbSettings, pos=wx.Point(56, - 20), size=wx.Size(0, 21), style=wx.TE_READONLY, value=u'') + 20), size=wx.Size(181, 21), style=wx.TE_READONLY, value=u'') self.butHeaders = wx.Button(id=wxID_MAINFRAMEBUTHEADERS, label=u'...', - name=u'butHeaders', parent=self.panelNbSettings, pos=wx.Point(-11, + name=u'butHeaders', parent=self.panelNbSettings, pos=wx.Point(247, 19), size=wx.Size(28, 23), style=0) self.butHeaders.Bind(wx.EVT_BUTTON, self.OnButHeadersButton, id=wxID_MAINFRAMEBUTHEADERS) self.textGccXml = wx.TextCtrl(id=wxID_MAINFRAMETEXTGCCXML, name=u'textGccXml', parent=self.panelNbSettings, pos=wx.Point(56, - 61), size=wx.Size(0, 21), style=wx.TE_READONLY, value=u'') + 61), size=wx.Size(181, 21), style=wx.TE_READONLY, value=u'') self.staticText1 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT1, label=u'Header\nFile', name='staticText1', @@ -426,26 +428,27 @@ self.staticText4 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT4, label=u'Macros', name='staticText4', parent=self.panelNbSettings, - pos=wx.Point(5, 31), size=wx.Size(51, 25), style=wx.ALIGN_CENTRE) + pos=wx.Point(5, 212), size=wx.Size(51, 25), + style=wx.ALIGN_CENTRE) self.staticText2 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT2, label=u'GccXml', name='staticText2', parent=self.panelNbSettings, pos=wx.Point(5, 60), size=wx.Size(51, 23), style=wx.ALIGN_CENTRE) self.butGccXml = wx.Button(id=wxID_MAINFRAMEBUTGCCXML, label=u'...', - name=u'butGccXml', parent=self.panelNbSettings, pos=wx.Point(-11, + name=u'butGccXml', parent=self.panelNbSettings, pos=wx.Point(247, 60), size=wx.Size(28, 23), style=0) self.butGccXml.Bind(wx.EVT_BUTTON, self.OnButGccXmlButton, id=wxID_MAINFRAMEBUTGCCXML) self.staticText3 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT3, label=u'Include\nPath', name='staticText3', - parent=self.panelNbSettings, pos=wx.Point(5, 74), size=wx.Size(51, - 37), style=wx.ALIGN_CENTRE) + parent=self.panelNbSettings, pos=wx.Point(5, 123), + size=wx.Size(51, 37), style=wx.ALIGN_CENTRE) self.listIncludes = wx.ListCtrl(id=wxID_MAINFRAMELISTINCLUDES, name=u'listIncludes', parent=self.panelNbSettings, - pos=wx.Point(56, 102), size=wx.Size(0, 0), + pos=wx.Point(56, 102), size=wx.Size(219, 80), style=wx.LC_HRULES | wx.LC_NO_HEADER | wx.LC_REPORT) self.listIncludes.Bind(wx.EVT_RIGHT_DOWN, self.OnListIncludesRightDown) self.listIncludes.Bind(wx.EVT_SIZE, self.OnListIncludesSize) @@ -460,7 +463,7 @@ self.listMacros = wx.ListCtrl(id=wxID_MAINFRAMELISTMACROS, name=u'listMacros', parent=self.panelNbSettings, pos=wx.Point(56, - 53), size=wx.Size(0, 0), + 202), size=wx.Size(219, 46), style=wx.LC_HRULES | wx.LC_NO_HEADER | wx.LC_REPORT) self.listMacros.Bind(wx.EVT_RIGHT_DOWN, self.OnListMacrosRightDown) self.listMacros.Bind(wx.EVT_SIZE, self.OnListMacrosSize) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-05-02 19:22:32
|
Revision: 1030 http://svn.sourceforge.net/pygccxml/?rev=1030&view=rev Author: roman_yakovenko Date: 2007-05-02 12:22:25 -0700 (Wed, 02 May 2007) Log Message: ----------- adding generate xml, code functionality Modified Paths: -------------- pyplusplus_dev/ide/controllers/controller_main.py pyplusplus_dev/ide/model/code_generator.py Added Paths: ----------- pyplusplus_dev/ide/_dev_run_ide_.py Added: pyplusplus_dev/ide/_dev_run_ide_.py =================================================================== --- pyplusplus_dev/ide/_dev_run_ide_.py (rev 0) +++ pyplusplus_dev/ide/_dev_run_ide_.py 2007-05-02 19:22:25 UTC (rev 1030) @@ -0,0 +1,11 @@ +import sys + +sys.path.append( '..' ) +sys.path.append( '../../pygccxml_dev' ) + +import pygccxml +import pyplusplus + +import ide + +ide.main() \ No newline at end of file Modified: pyplusplus_dev/ide/controllers/controller_main.py =================================================================== --- pyplusplus_dev/ide/controllers/controller_main.py 2007-05-02 14:58:58 UTC (rev 1029) +++ pyplusplus_dev/ide/controllers/controller_main.py 2007-05-02 19:22:25 UTC (rev 1030) @@ -311,7 +311,6 @@ self.CountCodeGenSec(reset=True) params = self._get_gccxml_params(False) - gen_xml_obj = AsyncExecHandler(code_generator.gen_xml, params) self._start_async_exec(gen_xml_obj) @@ -626,14 +625,15 @@ 'gccXmlSettings.includePathList')) macro_list = eval(self._prj_settings.get_param( 'gccXmlSettings.macroList')) - + header_file = self._prj_settings.get_param('gccXmlSettings.headerPath') if verbose: self._append_out_text(" "+ gcc_xml) self._append_out_text(" "+ str(inc_path_list)) self._append_out_text(" "+ str(macro_list)) + self._append_out_text(" "+ header_file) - return (gcc_xml, inc_path_list, macro_list) + return (gcc_xml, inc_path_list, macro_list, header_file) def _setup_ide_settings(self): Modified: pyplusplus_dev/ide/model/code_generator.py =================================================================== --- pyplusplus_dev/ide/model/code_generator.py 2007-05-02 14:58:58 UTC (rev 1029) +++ pyplusplus_dev/ide/model/code_generator.py 2007-05-02 19:22:25 UTC (rev 1030) @@ -10,7 +10,10 @@ are used. ''' +import os import time +from pygccxml import parser +from pyplusplus import module_builder def gen_xml(params, q_result, q_error): ''' @@ -20,17 +23,26 @@ @param q_error: python queue to put error in @return None (isn't evaluated) ''' - - gcc_xml = params[0] - inc_path_list = params[1] - macro_list = params[2] + try: + config = parser.config_t( gccxml_path=params[0] + , include_paths=params[1] + , define_symbols=params[2]) - time.sleep(1) - q_result.put("This is dummy data of gen_xml\n") - q_error.put("This is dummy error gen_xml") - time.sleep(4) - q_result.put("This is dummy data of gen_xml") - q_error.put("This is dummy error of gen_xml") + header_file = params[3] + config.include_paths.append( os.path.split( header_file )[0] ) + config.working_directory = os.path.split( header_file )[0] + reader = parser.source_reader_t( config=config ) + xml_file = reader.create_xml_file( header_file ) + + xml_file_obj = file( xml_file ) + q_result.put( xml_file_obj.read() ) + xml_file_obj.close() + os.remove( xml_file ) + #self._statistics.set_parse_time( parsed_time ) + #self._statistics.set_code_generation_time( 0 ) + except Exception, error: + q_result.put(str( error )) + q_error.put(str( error )) def gen_cpp(params, q_result, q_error): ''' @@ -40,8 +52,30 @@ @param q_error: python queue to put error in @return None (isn't evaluated) ''' - pass + try: + header_file = params[3] + + include_paths = params[1] + include_paths.append( os.path.split( header_file )[0] ) + + mb = module_builder.module_builder_t( + [ header_file ] + , gccxml_path=params[0] + , working_directory=os.path.split( header_file )[0] + , include_paths=include_paths + , define_symbols=params[2] ) + mb.build_code_creator( "pyplusplus" ) + mb.code_creator.user_defined_directories.extend( include_paths ) + code = mb.code_creator.create() + code = code.replace( '\n\r', '\n' ) + code = code.replace( '\r\n', '\n' ) + + q_result.put( code ) + except Exception, error: + q_result.put(str( error )) + q_error.put(str( error )) + def gen_pypp(params, q_result, q_error): ''' Generate Python (Py++) code This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2007-05-02 14:59:12
|
Revision: 1029 http://svn.sourceforge.net/pygccxml/?rev=1029&view=rev Author: alex_eisen Date: 2007-05-02 07:58:58 -0700 (Wed, 02 May 2007) Log Message: ----------- Working ide without code generation Modified Paths: -------------- pyplusplus_dev/ide/controllers/__init__.py pyplusplus_dev/ide/controllers/controller_main.py pyplusplus_dev/ide/ide.py pyplusplus_dev/ide/model/__init__.py pyplusplus_dev/ide/views/frame_main.py Added Paths: ----------- pyplusplus_dev/ide/IdeTemplate.xml pyplusplus_dev/ide/ProjectTemplate.xml pyplusplus_dev/ide/doc/ pyplusplus_dev/ide/doc/EnterpriseArchitectModel.eap pyplusplus_dev/ide/doc/IdeInBoa.png pyplusplus_dev/ide/doc/PackageOverview.png pyplusplus_dev/ide/doc/ReadmeForDevelopment.odt pyplusplus_dev/ide/model/code_generator.py pyplusplus_dev/ide/model/etree_extension.py pyplusplus_dev/ide/model/settings.py pyplusplus_dev/ide/test/ pyplusplus_dev/ide/test/test_attrib_finder.py Removed Paths: ------------- pyplusplus_dev/ide/model/ProjectFileTemplatate.xml Added: pyplusplus_dev/ide/IdeTemplate.xml =================================================================== --- pyplusplus_dev/ide/IdeTemplate.xml (rev 0) +++ pyplusplus_dev/ide/IdeTemplate.xml 2007-05-02 14:58:58 UTC (rev 1029) @@ -0,0 +1,9 @@ +<!-- Template file for pyplusplus IDE --> +<pyPPIde> + <project + maxNumInMenue="6" + recentProjects="[]" + lastPrjPath="." + lastIncPath="." + /> +</pyPPIde> \ No newline at end of file Added: pyplusplus_dev/ide/ProjectTemplate.xml =================================================================== --- pyplusplus_dev/ide/ProjectTemplate.xml (rev 0) +++ pyplusplus_dev/ide/ProjectTemplate.xml 2007-05-02 14:58:58 UTC (rev 1029) @@ -0,0 +1,11 @@ +<pyPPProject> + <gccXmlSettings + gccXmlPath="" + headerPath="" + includePathList="[]" + macroList="[]" /> + <guiGeometry + horizontalSplitter="350" + size="(0, 0, 800, 600)" + verticalSplitter="300" /> +</pyPPProject> \ No newline at end of file Modified: pyplusplus_dev/ide/controllers/__init__.py =================================================================== --- pyplusplus_dev/ide/controllers/__init__.py 2007-05-01 18:06:08 UTC (rev 1028) +++ pyplusplus_dev/ide/controllers/__init__.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# Copyright 2004 Roman Yakovenko. +# 2007 Alexander Eisenhuth +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) Modified: pyplusplus_dev/ide/controllers/controller_main.py =================================================================== --- pyplusplus_dev/ide/controllers/controller_main.py 2007-05-01 18:06:08 UTC (rev 1028) +++ pyplusplus_dev/ide/controllers/controller_main.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -4,63 +4,338 @@ # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) - +from threading import Timer +from Queue import Queue, Empty +import os import wx from views import dialog_macro +from model.settings import ProjectSettings, IdeSettings, ParameterContainer +import model.code_generator as code_generator -""" Contoller class. Part of MVC -Responsibility: Glue view and model code: -- Handle all events from view (p.e. button) """ +class MainParameter(object): + ''' + Abstract main parameters + ''' + def __init__(self): + + object.__init__(self) + + # Following attributes are parameters of the ide (realized as properties) + self.max_num_recent_projects = ParameterContainer(int, 0) + self.recent_prj_list = ParameterContainer(list, []) + self.last_prj_path = ParameterContainer(unicode, "") + self.last_inc_path = ParameterContainer(unicode, "") + +class AsyncExecHandler(wx.EvtHandler): + ''' + This class handles async execution. It exec the callable given in the + constructor. There are some callbacs for misc. issues + ''' + + def __init__(self, async_callable, args): + wx.EvtHandler.__init__(self) + self._async_callable = async_callable + self._args = args + self._cur_timer_calls = 0 + self._ui_eventhanler = None + self._timer_res = 100 # 100 msec + + def GetRunning(self): + ''' + Return boolean if async execution is running + ''' + return not self._thread.finished.isSet() + + def Start(self): + ''' + Start async execution + ''' + self._start_in_thread() + + def SetErrorOutput(self, err_cb): + ''' + Set callback for error output + @param err_cb: callback + ''' + self._err_cb = err_cb + + def SetResultOutput(self, result_cb): + ''' + Set callback for result + @param result_cb: callback + ''' + self._result_cb = result_cb + + def SetProgressCb(self, progress_cb, progress_tm_100msec): + ''' + Set callback for progress. Param progress_tm_100msec defines the time + to call the callback while async execution is running + @param progress_cb: callback + @param progress_tm_100msec: time in 100 msec + ''' + assert(isinstance(progress_tm_100msec, int)) + self._progress_cb = progress_cb + self._num_timer_calls = progress_tm_100msec + + def SetFinishedCb(self, finished_cb): + ''' + Set callback, when async execution has finished + @param finished_cb: callback + ''' + self.finished_cb = finished_cb + + def _notify(self, event): + # Read from result queue and error queue + for que_obj, cb_obj in zip( \ + [self._q_err, self._q_result], + [self._err_cb, self._result_cb]): + + try: + txt_element = que_obj.get(False) + cb_obj(txt_element) + except Empty: + pass + + if self._thread.finished.isSet(): + self._wxtimer.Stop() + self.finished_cb() + else: + pass + + self._cur_timer_calls += 1 + + # self._num_timer_calls is set in SetProgressCb + if self._cur_timer_calls % self._num_timer_calls == 0: + self._progress_cb() + + event.Skip() + + def _start_in_thread(self): + # Start python thread and wx timer + self._q_result = Queue() + self._q_err = Queue() + + self._thread = Timer(0, self._async_callable, [self._args, + self._q_result, self._q_err]) + self._thread.start() + + self._wxtimer = wx.Timer(self) + self._wxtimer.SetOwner(self) + self.Bind(wx.EVT_TIMER, self._notify) + self._wxtimer.Start(self._timer_res) + + class MainController: + """ Contoller class. Part of MVC + Responsibility: Glue view and model code: + - Handle all events from view (p.e. button) + """ def __init__(self, view): self._view = view # Give controller object to the view self._view.set_controller(self) - + + # Template file for new project + self._prjTemplateFile = "./ProjectTemplate.xml" + + # Tag to appera in title of main window + self._changedTag = " [changed]" + + # Dict with id's of recent projects + self._recentPrjDict = {} + + # Parameters + self.param = MainParameter() + + # To access prj settings (settings are related to view) + self._prj_settings = ProjectSettings(self._view, None) + + # To access ide settings (settings are related to MainParameter) + self._ide_settings = IdeSettings(None, self.param) + + # To count code generation durance + self._tm_code_gen = 0 + + # Object to control async execution + self._async_runner = None + + self._setup_ide_settings() + + def ExitIde(self): + ''' + Exit IDE. Exit can be canceled. + @return: False if exit is canceled else True + ''' + if not self._check_and_save_project(): + return False + + if self._async_runner != None: + if self._async_runner.GetRunning(): + self.OutputWarning("Cannot exit. "\ + "Ide is doing async execution ...") + return False + + new_list = [] + + # build list with max max_num_recent_projects elements + last_idxs = self._recentPrjDict.keys() + last_idxs.reverse() # Last added should be saved + for idx in last_idxs: + new_list.append(self._recentPrjDict[idx]) + if len(new_list) >= self.param.max_num_recent_projects.get(): + break + + self.param.recent_prj_list.set(new_list) + + self._ide_settings.save() + + self._view.Destroy() + + return True + + def OnRecentPrjLoad(self, event): + ''' + Callback from the file menue. (Recent projects) + @param event: wx event. + ''' + project_file_name = self._recentPrjDict[event.GetId()] + self._load_project(project_file_name) + def DoRemoveCurInclude(self): - """Remove current selected Include item""" + ''' + Remove current selected Include item + ''' + cur_num = self._view.currentItemInclude if None == cur_num: return self._view.listIncludes.DeleteItem(cur_num) + self._set_settings_changed() def DoRemoveCurMacro(self): - """Remove current selected Macro item""" + ''' + Remove current selected Macro item + ''' + cur_num = self._view.currentItemMacro if None == cur_num: return self._view.listMacros.DeleteItem(cur_num) + self._set_settings_changed() + + + def CountCodeGenSec(self, reset=False): + ''' + Count the time of code generation. Must be called once per second. + Update UI + @param reset: Boolean to reset the counter + ''' + if reset: + self._tm_code_gen = 0 + else: + self._tm_code_gen += 1 + self._view.statusBar.SetStatusText(number=1, text=u'Time: %d sec' % \ + self._tm_code_gen) - def GenXmlCode(self): - """ Generate XML code""" - self._appendOutText("Generation of XML code staretd") + def OutputError(self, err_txt): + ''' + Print error text in output window + @param err_txt: Text to display + ''' + self._append_out_text(err_txt, self._text_error) - for i in range(0,5): - self._view.listIncludes.InsertStringItem(i, "First Element - this is a long") - + def OutputWarning(self, err_txt): + ''' + Print warning text in output window + @param err_txt: Text to display + ''' + self._append_out_text(err_txt, self._text_warn) + + def OutputInfo(self, inf_txt): + ''' + Print info text in output window + @param inf_txt: + ''' + self._append_out_text(inf_txt, self._text_info) + + def OutputCode(self, code_txt): + ''' + Append text in the code window + @param code_txt: Text to append + ''' + self._view.textCode.AppendText(code_txt) + + def GenCodeFinished(self): + ''' + Inform that code generation has finished + ''' + self._enable_generation_widgets(True) + + def GenCppCode(self): - """ Generate Boost.Python code""" - self._appendOutText("Generation of C++ code for Boost.Python started") + ''' + Generate Boost.Python code + ''' + self._enable_generation_widgets(False) + self._view.textCode.SetValue("") + self._append_out_text("Generation of C++ code for Boost.Python started") + self.CountCodeGenSec(reset=True) + params = self._get_gccxml_params(False) + + gen_xml_obj = AsyncExecHandler(code_generator.gen_cpp, params) + self._start_async_exec(gen_xml_obj) + def GenPyPPCode(self): - """ Generate Py++ code""" - self._appendOutText("Generation of Py++ code started") + ''' + Generate Py++ code + ''' + self._enable_generation_widgets(False) + self._view.textCode.SetValue("") + self._append_out_text("Generation of Py++ code started") + self.CountCodeGenSec(reset=True) + params = self._get_gccxml_params(False) + + gen_xml_obj = AsyncExecHandler(code_generator.gen_pypp, params) + self._start_async_exec(gen_xml_obj) + + def GenXmlCode(self): + ''' + Generate XML code + ''' + self._enable_generation_widgets(False) + self._append_out_text("Generation of XML code started") + self._view.textCode.SetValue("") + self.CountCodeGenSec(reset=True) + + params = self._get_gccxml_params(False) + + gen_xml_obj = AsyncExecHandler(code_generator.gen_xml, params) + self._start_async_exec(gen_xml_obj) + def OpenDlgHeader(self): - """Open dialog to get header file""" - self._openFileDlgWithRelatedWxText( self._view.textHeader, + ''' + Open dialog to get header file + ''' + self._open_file_dlg_text_ctrl( self._view.textHeader, "Choose a Header file", "Header (*.h)|*.h|All Files(*)|*") def OpenDlgGccXml(self): - """Open dialog to get GccXml executable""" - self._openFileDlgWithRelatedWxText( self._view.textGccXml, + ''' + Open dialog to get GccXml executable + ''' + + self._open_file_dlg_text_ctrl( self._view.textGccXml, "Choose GccXml executable", "All Files(*)|*") def OpenDlgEditCurInclude(self): - """ """ + ''' + Open dialog to edit current include + ''' cur_num = self._view.currentItemInclude if None == cur_num: return @@ -71,11 +346,14 @@ self._view.listIncludes.DeleteItem(cur_num) self._view.listIncludes.InsertStringItem( cur_num, dialog.GetPath()) + self._set_settings_changed() finally: dialog.Destroy() def OpenDlgEditCurMacro(self): - """ """ + ''' + Open dialog to edit current macro + ''' cur_num = self._view.currentItemMacro if None == cur_num: return @@ -87,12 +365,16 @@ new_macro = dialog.textMacro.GetLineText(0) self._view.listMacros.InsertStringItem(cur_num, new_macro) + self._set_settings_changed() finally: dialog.Destroy() def OpenDlgAddInclude(self): - """ """ - dialog = wx.DirDialog(self._view, "Choose include directory", ".") + ''' + Open Dialog to add a include path + ''' + dialog = wx.DirDialog(self._view, "Choose include directory", + self.param.last_inc_path.get()) try: if dialog.ShowModal() == wx.ID_OK: @@ -100,16 +382,20 @@ dir_path = dialog.GetPath() # Check weather path is already in list - if not self._checkItemIsInList(dir_path, + if not self._check_item_in_list(dir_path, self._view.listIncludes): self._view.listIncludes.InsertStringItem( cur_num, dir_path) + self.param.last_inc_path.set(str(dir_path)) + self._set_settings_changed() finally: dialog.Destroy() def OpenDlgAddMacro(self): - """ """ + ''' + Open dialog to add a macro + ''' dialog = dialog_macro.MacroDialog(self._view) if dialog.ShowModal() == wx.OK: @@ -118,12 +404,192 @@ new_macro = dialog.textMacro.GetLineText(0) # Check weather macro is already in list - if not self._checkItemIsInList(new_macro, self._view.listMacros): + if not self._check_item_in_list(new_macro, self._view.listMacros): self._view.listMacros.InsertStringItem(cur_num, new_macro) + self._set_settings_changed() + + def OpenDlgLoadProject(self): + ''' + Open dialog to load a project + ''' + from xml.parsers.expat import ExpatError + + dialog = wx.FileDialog(self._view, "Load existing Py++ project", + self.param.last_prj_path.get(), + "", "Project files (*.xml)|*.xml|All Files(*)|*", wx.OPEN) + + try: + if dialog.ShowModal() == wx.ID_OK: + self.ClearUi() + project_file_name = dialog.GetPath() + self._load_project(project_file_name) + + except ExpatError: + self._append_out_text("XML parser error in file:%s" % \ + dialog.GetPath(), self._text_error) + except Exception: + self._append_out_text("Error loading file:%s" % \ + dialog.GetPath(), self._text_error) + raise + + finally: + dialog.Destroy() + + def OpenDlgSaveProject(self, new_file=False): + ''' + Open dialog to save a project + @param new_file: Boolean weather to use a new file + @return: False if project save was canceled + ''' + # Is current file prj template? + if self._prj_settings.get_file_name() == self._prjTemplateFile: + project_file_name = self._open_new_prj_file() + else: + if new_file: + project_file_name = self._open_new_prj_file() + else: + project_file_name = self._prj_settings.get_file_name() + + try: + if project_file_name == None: + return False # prior dialog skipped + + if not self._save_project(project_file_name): + return False + except Exception: + self._append_out_text("Error saving file:%s" % \ + project_file_name, self._text_error) + raise + + return True + + def DoProjectNew(self): + ''' + Open dialog for new Project + ''' + self._load_project(self._prjTemplateFile) + + def ClearUi(self): + ''' + Clear all controls of UI + ''' + + # Clear text ctrls + for textCtrl in [self._view.textHeader, self._view.textGccXml, + self._view.textOutput, self._view.textCode]: + textCtrl.Clear() + + # clear list ctrls + for listCtrl in [self._view.listMacros, self._view.listIncludes]: + tot_num = listCtrl.GetItemCount() + for cur_num in range(tot_num, 0, -1): + listCtrl.DeleteItem(cur_num-1) + def _cancel_if_file_exist(self, project_file_name, parent_dlg=None): + # check for overwriting of file + if os.path.exists(project_file_name): + dialog = wx.MessageDialog(parent_dlg, + "%s exists. Should it be overwritten?" % \ + (project_file_name), pos=self._view.GetPosition()) + + if dialog.ShowModal() == wx.ID_CANCEL: + return True + else: + return False - def _openFileDlgWithRelatedWxText(self, + # Return True if successfull + def _check_and_save_project(self): + if self._prj_settings.get_changed(): + + # Anyhow pos is working + dialog = wx.MessageDialog(self._view, "Current project changed. "\ + "Should project be saved?", style = (wx.YES_NO), + pos=self._view.GetPosition()) + + user_input = dialog.ShowModal() + dialog.Destroy() + + if user_input == wx.ID_NO: + return True + elif user_input == wx.ID_YES: + return self.OpenDlgSaveProject() + else: + return True + + def _load_project(self, project_file_name): + self._check_and_save_project() + self.ClearUi() + self._prj_settings.load(project_file_name) + self._set_prj_filename_in_title(project_file_name) + + if project_file_name != self._prjTemplateFile: + self.param.last_prj_path.set(unicode(os.path.dirname(project_file_name))) + + self._add_to_prj_history(project_file_name) + + def _save_project(self, project_file_name): + + self._prj_settings.save(project_file_name) + self._reset_settings_changed() + self.param.last_prj_path.set(os.path.dirname(project_file_name)) + self._set_prj_filename_in_title(project_file_name) + self._add_to_prj_history(project_file_name) + + return True + + + def _open_new_prj_file(self): + + project_file_name = None + + dialog = wx.FileDialog(self._view, + "Save Py++ project to new file", self.param.last_prj_path.get(), "", + "Project files (*.xml)|*.xml|All Files(*)|*", wx.FD_SAVE) + + if dialog.ShowModal() == wx.ID_OK: + + project_file_name = dialog.GetPath() + + if self._cancel_if_file_exist(project_file_name, dialog): + project_file_name = None + + dialog.Destroy() + + return project_file_name + + def _add_to_prj_history(self, prj_filename): + +# This don't work, see below +# max_num_history = self.param.max_num_recent_projects.get() + + + if prj_filename in self._recentPrjDict.values(): + return + + if prj_filename == self._prjTemplateFile: + return + + file_name = os.path.split(prj_filename)[1] + + menue = self._view.menueRecentPrj + new_item_id = id=wx.NewId() + new_item = wx.MenuItem(menue, help=prj_filename, + id=new_item_id, + kind=wx.ITEM_NORMAL, text=file_name) + + menue.PrependItem(new_item) + + self._view.Bind(wx.EVT_MENU, self.OnRecentPrjLoad, + id=new_item_id) + + self._recentPrjDict[new_item_id] = prj_filename + +# Doesn't work. Dont know why +# if menue.GetMenuItemCount() > max_num_history: +# menue.Remove(max_num_history) + + def _open_file_dlg_text_ctrl(self, related_wx_text, caption_txt="", file_filter="All Files(*)|*", @@ -135,10 +601,67 @@ if dialog.ShowModal() == wx.ID_OK: related_wx_text.Clear() related_wx_text.AppendText(dialog.GetPath()) + self._set_settings_changed() finally: dialog.Destroy() - def _checkItemIsInList(self, item, wx_list): + def _set_settings_changed(self): + self._prj_settings.set_changed() + title_str = self._view.GetTitle() + if not self._changedTag in title_str: + title_str += self._changedTag + self._view.SetTitle(title_str) + + def _enable_generation_widgets(self, state): + ctrls = [self._view.butGenCpp, self._view.butGenXml, \ + self._view.butGenPyPP] + + for ctrl in ctrls: + ctrl.Enable(state) + + def _get_gccxml_params(self, verbose): + + gcc_xml = self._prj_settings.get_param('gccXmlSettings.gccXmlPath') + inc_path_list = eval(self._prj_settings.get_param( + 'gccXmlSettings.includePathList')) + macro_list = eval(self._prj_settings.get_param( + 'gccXmlSettings.macroList')) + + if verbose: + self._append_out_text(" "+ gcc_xml) + self._append_out_text(" "+ str(inc_path_list)) + self._append_out_text(" "+ str(macro_list)) + + + return (gcc_xml, inc_path_list, macro_list) + + def _setup_ide_settings(self): + + # load ide settings + self._ide_settings.load() + prj_list = self.param.recent_prj_list.get() + prj_list.reverse() + for prj in prj_list: + self._add_to_prj_history(prj) + + def _set_prj_filename_in_title(self, filename): + + if filename == self._prjTemplateFile: + filename = "New project" + + title_str = self._view.GetTitle() + start_idx = title_str.find("(") + end_idx = title_str.find(")") + fnamstr = title_str[start_idx:end_idx+1] + title_str = title_str.replace(fnamstr, "(" + filename + ")") + self._view.SetTitle(title_str) + + def _reset_settings_changed(self): + title_str = self._view.GetTitle() + title_str = title_str.replace(self._changedTag, "") + self._view.SetTitle(title_str) + + def _check_item_in_list(self, item, wx_list): idx = wx_list.FindItem(0, item) if idx == -1: return False @@ -146,7 +669,7 @@ return True - def _appendOutText(self, text, type_of_text = 0): + def _append_out_text(self, text, type_of_text = 0): """ append text with different error level""" text_ctrl = self._view.textOutput type_txt = "INFO" @@ -164,7 +687,16 @@ text_ctrl.SetDefaultStyle(wx.TextAttr(wx.BLACK)) text_ctrl.AppendText(type_txt + ": " + text + "\n") + # Start async execution + def _start_async_exec(self, async_runner): + self._async_runner = async_runner + self._async_runner.SetErrorOutput(self.OutputError) + self._async_runner.SetResultOutput(self.OutputCode) + self._async_runner.SetFinishedCb(self.GenCodeFinished) + self._async_runner.SetProgressCb(self.CountCodeGenSec, 10) + self._async_runner.Start() + # levels _text_info = 0 # Text has informational character _text_warn = 1 # Text has warning character _text_error = 2 # Text has error character Added: pyplusplus_dev/ide/doc/EnterpriseArchitectModel.eap =================================================================== (Binary files differ) Property changes on: pyplusplus_dev/ide/doc/EnterpriseArchitectModel.eap ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pyplusplus_dev/ide/doc/IdeInBoa.png =================================================================== (Binary files differ) Property changes on: pyplusplus_dev/ide/doc/IdeInBoa.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pyplusplus_dev/ide/doc/PackageOverview.png =================================================================== (Binary files differ) Property changes on: pyplusplus_dev/ide/doc/PackageOverview.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pyplusplus_dev/ide/doc/ReadmeForDevelopment.odt =================================================================== (Binary files differ) Property changes on: pyplusplus_dev/ide/doc/ReadmeForDevelopment.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: pyplusplus_dev/ide/ide.py =================================================================== --- pyplusplus_dev/ide/ide.py 2007-05-01 18:06:08 UTC (rev 1028) +++ pyplusplus_dev/ide/ide.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -28,6 +28,9 @@ self.main.Show() self.SetTopWindow(self.main) + + controller.DoProjectNew() + return True def main(): Deleted: pyplusplus_dev/ide/model/ProjectFileTemplatate.xml =================================================================== --- pyplusplus_dev/ide/model/ProjectFileTemplatate.xml 2007-05-01 18:06:08 UTC (rev 1028) +++ pyplusplus_dev/ide/model/ProjectFileTemplatate.xml 2007-05-02 14:58:58 UTC (rev 1029) @@ -1,10 +0,0 @@ -<!-- Template file for pyplusplus IDE --> -<pyPPProject> - <gccXmlSettings - headerPath="" - includePathList="[]" - gccXmlPath="" - macroList="[]" - /> - </gccXmlSettings> -</pyPPProject> \ No newline at end of file Modified: pyplusplus_dev/ide/model/__init__.py =================================================================== --- pyplusplus_dev/ide/model/__init__.py 2007-05-01 18:06:08 UTC (rev 1028) +++ pyplusplus_dev/ide/model/__init__.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# Copyright 2004 Roman Yakovenko. +# 2007 Alexander Eisenhuth +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) Added: pyplusplus_dev/ide/model/code_generator.py =================================================================== --- pyplusplus_dev/ide/model/code_generator.py (rev 0) +++ pyplusplus_dev/ide/model/code_generator.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2004 Roman Yakovenko. +# 2007 Alexander Eisenhuth +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +''' +Code generation is started in a own thread. To exchange data, queues +are used. +''' + +import time + +def gen_xml(params, q_result, q_error): + ''' + Generate XML code + @param params: List of parameters [gccxml,incPath,macros] + @param q_result: python queue to put result in + @param q_error: python queue to put error in + @return None (isn't evaluated) + ''' + + gcc_xml = params[0] + inc_path_list = params[1] + macro_list = params[2] + + time.sleep(1) + q_result.put("This is dummy data of gen_xml\n") + q_error.put("This is dummy error gen_xml") + time.sleep(4) + q_result.put("This is dummy data of gen_xml") + q_error.put("This is dummy error of gen_xml") + +def gen_cpp(params, q_result, q_error): + ''' + Generate cpp (Boost.Python) code + @param params: List of parameters [gccxml,incPath,macros] + @param q_result: python queue to put result in + @param q_error: python queue to put error in + @return None (isn't evaluated) + ''' + pass + +def gen_pypp(params, q_result, q_error): + ''' + Generate Python (Py++) code + @param params: List of parameters [gccxml,incPath,macros] + @param q_result: python queue to put result in + @param q_error: python queue to put error in + @return None (isn't evaluated) + ''' + pass + + \ No newline at end of file Added: pyplusplus_dev/ide/model/etree_extension.py =================================================================== --- pyplusplus_dev/ide/model/etree_extension.py (rev 0) +++ pyplusplus_dev/ide/model/etree_extension.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- +# Copyright 2004 Roman Yakovenko. +# 2007 Alexander Eisenhuth +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +from xml.etree.ElementTree import ElementTree + +class ElNotFound(Exception): + ''' + Exception element not found + ''' + pass + +class AttribNotFound(Exception): + ''' + Execption attribute not found + ''' + pass + +class XmlElFinder: + ''' + Find a element in a Tree (xml.etree.ElementTree) + ''' + def __init__(self, root_el): + self._root = root_el # Must be of typ xml.etree.ElementTree + self._finder = None + + def get_obj(self, element_text): + ''' + Find and return XML element object (Element) + @param element_text: Textual description of element to find. Hirarchie + is seperated by '.' Ex.: 'rootNode.childNode.element' + @return: Element object + ''' + + child_el = None + self._finder = self._root + + for el_name in element_text.split("."): + child_el = self._finder.find(el_name) + + # Child not found + if child_el == None: + raise ElNotFound, "Cannot find Element %s in %s" % \ + (el_name, element_text) + + self._finder = ElementTree(child_el) + + return child_el + +class XmlAttribFinder: + '''Find a attribute in a Tree (xml.etree.ElementTree)''' + def __init__(self, root_el): + self._el_finder = XmlElFinder(root_el) + + def get_obj(self, attrib_text): + ''' + Find and return attribute as tuple + @param attrib_text: Textual description of attribute to find. Hirarchie + is seperated by '.' Ex.: 'rootNode.childNode.element.attrib1' + @return: (<allAttribDict>, <relatedAttribName>) This means a tuple + cintaining all attributes of parent element and name of attribute. + ''' + el_text = attrib_text[0 : attrib_text.rfind(".")] + attrib_name = attrib_text[attrib_text.rfind(".") + 1 : ] + element = self._el_finder.get_obj(el_text) + return (element.attrib, attrib_name) + + def get_val(self, attrib_text): + ''' + Find and return attribute value + @param attrib_text: Textual description of attribute to find. Hirarchie + is seperated by '.' Ex.: 'rootNode.childNode.element.attrib1' + @return Attribute value + ''' + attrib_value = None + + el_text = attrib_text[0 : attrib_text.rfind(".")] + attrib_name = attrib_text[attrib_text.rfind(".") + 1 : ] + element = self._el_finder.get_obj(el_text) + + try: + attrib_value = element.attrib[attrib_name] + + except KeyError: + raise AttribNotFound, "Cannot find attribute '%s' in element '%s'" \ + % (attrib_name, el_text) + + return attrib_value + + + \ No newline at end of file Added: pyplusplus_dev/ide/model/settings.py =================================================================== --- pyplusplus_dev/ide/model/settings.py (rev 0) +++ pyplusplus_dev/ide/model/settings.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -0,0 +1,383 @@ +# -*- coding: utf-8 -*- +# Copyright 2004 Roman Yakovenko. +# 2007 Alexander Eisenhuth +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +''' +This module contains classes for settings and parameters +''' +from model.etree_extension import XmlAttribFinder +from shutil import copyfile +# Python 2.5 +from xml.etree.ElementTree import ElementTree +import os +import wx + +class BaseSettings: + ''' + Base class for settings as a collection of parameters + ''' + def __init__(self, ide_ui, param_obj): + self._file_name = None # filename of settings + self._ide_ui = ide_ui + self._param_obj = param_obj + + def set_changed(self): + ''' + Inform, that any parameter has changed + ''' + self._changed = True + + def get_changed(self): + ''' + Access changed information + ''' + return self._changed + + def get_file_name(self): + ''' + Return file path of settings + ''' + return self._file_name + + def get_param(self, xml_attrib_name): + ''' + Return parameter as string + @param xml_attrib_name: Name of parameter + ''' + + ide_ui = self._ide_ui #@UnusedVariable + param_obj = self._param_obj #@UnusedVariable + + for cur_name, rel_obj_str in self._param_list: + if cur_name == xml_attrib_name: + param = ParameterAccess(eval(rel_obj_str)) + return param.get_related_object_value() + + raise RuntimeError, "Parameter:%s not defined" % xml_attrib_name + + def _load(self, file_name):#@UnusedVariable + ''' + Load settings from given file + @param file_name: path of file. Format is XML. + @param ide_ui: wxPython ctrl of ide + @param param_obj: object holding parameters + ''' + self._file_name = file_name + + ide_ui = self._ide_ui #@UnusedVariable + param_obj = self._param_obj #@UnusedVariable + + root_element = ElementTree(file=file_name).getroot() + attrib_finder = XmlAttribFinder(root_element) + + # Loop through our parameter list + for xml_attrib_name, rel_obj_str in self._param_list: + # In eval we need ide_ui and param_obj + # print "XML:%s obj_str:%s" % (xml_attrib_name, rel_obj_str) + param = ParameterAccess(eval(rel_obj_str)) + attrib_val = attrib_finder.get_val(xml_attrib_name) + param.update_related_object(attrib_val) + + def _save(self, file_name): + ''' + Save settings into the given file + @param file_name: path of file. Format is XML. + @param ide_ui: wxPython ctrl of ide + @param param_obj: object holding parameters + ''' + + self._file_name = file_name + + ide_ui = self._ide_ui #@UnusedVariable + param_obj = self._param_obj #@UnusedVariable + + etree = ElementTree(file=file_name) + root_element = etree.getroot() + + attrib_finder = XmlAttribFinder(root_element) + + for xml_attrib_name, rel_obj_str in self._param_list: + # In eval we need ide_ui and param_obj + param = ParameterAccess(eval(rel_obj_str)) + attrib, attrib_key = attrib_finder.get_obj(xml_attrib_name) + attrib[attrib_key] = param.get_related_object_value() + + # Write XML-File + etree.write(file_name) + + self._changed = False + + +class IdeSettings(BaseSettings): + ''' + Abstracts the settings of the ide + ''' + def __init__(self, ide_ui, param_obj): + + self._param_list = [ + ('project.maxNumInMenue', + 'param_obj.max_num_recent_projects'), + + ('project.recentProjects', + 'param_obj.recent_prj_list'), + + ('project.lastPrjPath', + 'param_obj.last_prj_path'), + + ('project.lastIncPath', + 'param_obj.last_inc_path') + + ] + + BaseSettings.__init__(self, ide_ui, param_obj) + + def load(self): + ''' + Load ide settings + ''' + ide_file_name = self._get_ide_file_name() + self._load(ide_file_name) + + def save(self): + ''' + Save settings + + ''' + ide_file_name = self._get_ide_file_name() + self._save(ide_file_name) + + def _get_ide_file_name(self): + ''' + Get the file name of the ide settings filE. If the file doesen't exist + we copy a template fiel into the location + @param file_path: File path to check + ''' + try: + home_dir = os.environ['HOME'] + except KeyError: + home_dir = os.getcwd() + + file_path = os.path.join(home_dir, self._ide_file_name ) + + if not os.path.exists(file_path): + print "File copied !!" + copyfile(self._ide_template_path, file_path) + + return file_path + + # Project template file + _ide_template_path = "./IdeTemplate.xml" + _ide_file_name = ".pyplusplus_ide" + +class ProjectSettings(BaseSettings): + ''' + Abstracts the settings of a project + ''' + def __init__(self, ide_ui, param_obj): + + BaseSettings.__init__(self, ide_ui, param_obj) + + # This list contains tuples of ui elements and the related + # attribute of the project file + self._param_list = [ + ('gccXmlSettings.headerPath', + 'ide_ui.textHeader'), + + ('gccXmlSettings.gccXmlPath', + 'ide_ui.textGccXml'), + + ('gccXmlSettings.includePathList', + 'ide_ui.listIncludes'), + + ('gccXmlSettings.macroList', + 'ide_ui.listMacros'), + + ('guiGeometry.size', + 'ide_ui'), + + ('guiGeometry.horizontalSplitter', + 'ide_ui.splitterHorizontal'), + + ('guiGeometry.verticalSplitter', + 'ide_ui.splitterVertical') + ] + + self._changed = False + + def load(self, file_name): + ''' + Load settings from given file + @param file_name: path of file. Format is XML. + ''' + self._load(file_name) + + def save(self, file_name): + ''' + Save settings into the given file + @param file_name: path of file. Format is XML. + ''' + # Assert new prj file + self._assert_prj_file(file_name) + self._save(file_name) + + def _assert_prj_file(self, file_path): + ''' + Assert that the given file exists. If not we copy the template + @param file_path: File path to check + ''' + if not os.path.exists(file_path): + copyfile(self._prj_template_path, file_path) + + # Project template file + _prj_template_path = "./ProjectTemplate.xml" + +class ParameterContainer: + ''' + Abstracts one parameter with getter and setter + ''' + def __init__(self, p_type, init_val=None): + self._type = p_type + self._val = init_val + + def set(self, val): + ''' + Set the related parameter + @param val: new value + ''' + self._val = self._type(val) + + def get(self): + ''' + Get the related parameter + ''' + + return self._val + + def get_type(self): + ''' + Get the (python) type of the parameter + ''' + return self._type + + +class ParameterAccess: + ''' + Abstracts the access (setting and getting) of a parameter. This class + has knowledge of wxPython controls (and know how to handle them). + Currently we support: + - wxTextCtrl + - wxListCtrl + - wxFrame + - wxSplitterWindow + - ParameterContainer + ''' + def __init__(self, related_object): + self._rel_obj = related_object + + def update_related_object(self, param_value): + ''' + Set the value of the related object with given param_value + @param param_value: parameter value to use + ''' + + #print ">>> rel obj:", self._rel_obj, "val:", param_value + + # Handle wxTextCtrl + if isinstance(self._rel_obj, wx.TextCtrl): + # We need a string + str_param_value = str(param_value) + self._rel_obj.SetValue(str_param_value) + + # Handle wxListCtrl + elif isinstance(self._rel_obj, wx.ListCtrl): + list_param_value = eval(param_value) + assert(isinstance(list_param_value, list)) + cur_num = 0 + for list_el in list_param_value: + self._rel_obj.InsertStringItem(cur_num, list_el) + cur_num += 1 + + # Handle wxFrame + elif isinstance(self._rel_obj, wx.Frame): + tup_size = eval(param_value) + assert(isinstance(tup_size, tuple)) + x = tup_size[0] + y = tup_size[1] + wid = tup_size[2] + high = tup_size[3] + self._rel_obj.SetDimensions(x, y, wid, high) + + # SplitterWindow + elif isinstance(self._rel_obj, wx.SplitterWindow): + int_sash_pos = int(param_value) + self._rel_obj.SetSashPosition(int_sash_pos, True) + + # ParameterContainer + elif isinstance(self._rel_obj, ParameterContainer): + if self._rel_obj.get_type() == list: + eval_param_value = eval(param_value) + elif self._rel_obj.get_type() == int: + eval_param_value = eval(param_value) + elif self._rel_obj.get_type() == str: + eval_param_value = param_value + elif self._rel_obj.get_type() == unicode: + eval_param_value = unicode(param_value) + else: + raise RuntimeError, "Unupported typ found", \ + self._rel_obj.get_type() + + cnv_param_val = self._rel_obj.get_type()(eval_param_value) + self._rel_obj.set(cnv_param_val) + + else: + raise RuntimeError, "Unsupported type %s" % self._rel_obj.__class__ + + def get_related_object_value(self): + ''' + Get value of the related object + @return value as string + ''' + + #print ">>>", self._rel_obj + + str_param_value = "Value not specified" + + # Handle wxTextCtrl + if isinstance(self._rel_obj, wx.TextCtrl): + # We need a string + str_param_value = self._rel_obj.GetValue() + + # Handle wxListCtrl + elif isinstance(self._rel_obj, wx.ListCtrl): + + list_of_ctrl = [] + + for cur_num in range(self._rel_obj.GetItemCount()): + list_el = self._rel_obj.GetItemText(cur_num) + list_of_ctrl.append(list_el) + cur_num += 1 + str_param_value = str(list_of_ctrl) + + # Handle wxFrame + elif isinstance(self._rel_obj, wx.Frame): + x,y = self._rel_obj.GetPositionTuple() + wid, high = self._rel_obj.GetSizeTuple() + dim = (x,y,wid,high) + str_param_value = str(dim) + + # SplitterWindow + elif isinstance(self._rel_obj, wx.SplitterWindow): + sash_pos = self._rel_obj.GetSashPosition() + str_param_value = str(sash_pos) + + # Handle ParameterContainer + elif isinstance(self._rel_obj, ParameterContainer): + str_param_value = str(self._rel_obj.get()) + + else: + raise RuntimeError, "Unsupported type %s" % self._rel_obj.__class__ + + return str_param_value + \ No newline at end of file Added: pyplusplus_dev/ide/test/test_attrib_finder.py =================================================================== --- pyplusplus_dev/ide/test/test_attrib_finder.py (rev 0) +++ pyplusplus_dev/ide/test/test_attrib_finder.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -0,0 +1,41 @@ +import sys +import unittest +# Python 2.5 +from xml.etree.ElementTree import ElementTree + +if ".." not in sys.path: + sys.path.append("..") + +from model.etree_extension import XmlAttribFinder, AttribNotFound +prj_template_file = "../model/ProjectTemplate.xml" + + +class TestAttribFinder(unittest.TestCase): + + def setUp(self): + ''' Executed before each test ''' + self._root_el_prj_file = ElementTree(file=prj_template_file).getroot() + + def test_find(self): + '''Test get_val methode with project template''' + af_obj = XmlAttribFinder(self._root_el_prj_file) + + header_path = af_obj.get_val('gccXmlSettings.headerPath') + self.assertEqual(header_path, "") + + inc_path_list = af_obj.get_val('gccXmlSettings.includePathList') + self.assertEqual(eval(inc_path_list), []) + + inc_path_list_obj = af_obj.get_obj('gccXmlSettings.includePathList') + + self.assertTrue(inc_path_list_obj[1], []) + + self.assertRaises(AttribNotFound, af_obj.get_val, + ('gccXmlSettings.xxx')) + + def tearDown(self): + ''' Executed after each test ''' + del self._root_el_prj_file + +if __name__ == "__main__": + unittest.main() Modified: pyplusplus_dev/ide/views/frame_main.py =================================================================== --- pyplusplus_dev/ide/views/frame_main.py 2007-05-01 18:06:08 UTC (rev 1028) +++ pyplusplus_dev/ide/views/frame_main.py 2007-05-02 14:58:58 UTC (rev 1029) @@ -15,10 +15,10 @@ def create(parent): return MainFrame(parent) -[wxID_MAINFRAMEMENUEFILEEXIT, wxID_MAINFRAMEMENUEFILENEW, - wxID_MAINFRAMEMENUEFILEOPEN, wxID_MAINFRAMEMENUEFILERECENT, - wxID_MAINFRAMEMENUEFILESAVE, -] = [wx.NewId() for _init_coll_menueFile_Items in range(5)] +[wxID_MAINFRAMEMENUEFILEEXIT, wxID_MAINFRAMEMENUEFILEITEMS7, + wxID_MAINFRAMEMENUEFILENEW, wxID_MAINFRAMEMENUEFILEOPEN, + wxID_MAINFRAMEMENUEFILERECENT, wxID_MAINFRAMEMENUEFILESAVE, +] = [wx.NewId() for _init_coll_menueFile_Items in range(6)] [wxID_MAINFRAMEMENUINCLUDESADDINC, wxID_MAINFRAMEMENUINCLUDESITEMS1, ] = [wx.NewId() for _init_coll_menuIncludes_Items in range(2)] @@ -154,20 +154,24 @@ def _init_coll_menueFile_Items(self, parent): # generated method, don't edit - parent.Append(help=u'Create new Project', id=wxID_MAINFRAMEMENUEFILENEW, - kind=wx.ITEM_NORMAL, text=u'&New Project') - parent.Append(help=u'Open existing Project', + parent.Append(help=u'Create new project with default settings', + id=wxID_MAINFRAMEMENUEFILENEW, kind=wx.ITEM_NORMAL, + text=u'&New project') + parent.Append(help=u'Open existing project', id=wxID_MAINFRAMEMENUEFILEOPEN, kind=wx.ITEM_NORMAL, - text=u'&Open Project') - parent.Append(help=u'Save current Project', + text=u'&Open project') + parent.Append(help=u'Save current project', id=wxID_MAINFRAMEMENUEFILESAVE, kind=wx.ITEM_NORMAL, - text=u'&Save Project') + text=u'&Save project') + parent.Append(help=u'Save current project under a different filename', + id=wxID_MAINFRAMEMENUEFILEITEMS7, kind=wx.ITEM_NORMAL, + text=u'S&ave as ...') parent.AppendSeparator() - parent.AppendMenu(help=u'Open recently used Project', - id=wxID_MAINFRAMEMENUEFILERECENT, submenu=wx.Menu(), - text=u'Recent Projects') + parent.AppendMenu(help=u'Open recently used project', + id=wxID_MAINFRAMEMENUEFILERECENT, submenu=self.menueRecentPrj, + text=u'&Recent projects') parent.AppendSeparator() - parent.Append(help='', id=wxID_MAINFRAMEMENUEFILEEXIT, + parent.Append(help=u'Exit IDE', id=wxID_MAINFRAMEMENUEFILEEXIT, kind=wx.ITEM_NORMAL, text=u'&Exit') self.Bind(wx.EVT_MENU, self.OnMenueFileNewMenu, id=wxID_MAINFRAMEMENUEFILENEW) @@ -177,6 +181,10 @@ id=wxID_MAINFRAMEMENUEFILESAVE) self.Bind(wx.EVT_MENU, self.OnMenueFileExitMenu, id=wxID_MAINFRAMEMENUEFILEEXIT) + self.Bind(wx.EVT_MENU, self.OnMenueFileSaveAsMenu, + id=wxID_MAINFRAMEMENUEFILEITEMS7) + self.Bind(wx.EVT_MENU, self.OnMenueFileRecentMenu, + id=wxID_MAINFRAMEMENUEFILERECENT) def _init_coll_menuMacros_Items(self, parent): # generated method, don't edit @@ -212,13 +220,12 @@ def _init_coll_statusBar_Fields(self, parent): # generated method, don't edit - parent.SetFieldsCount(3) + parent.SetFieldsCount(2) - parent.SetStatusText(number=0, text=u'<helptextOrStatus>') - parent.SetStatusText(number=1, text=u'<parseTime>') - parent.SetStatusText(number=2, text=u'<compileTime>') + parent.SetStatusText(number=0, text=u'') + parent.SetStatusText(number=1, text=u'') - parent.SetStatusWidths([-1, -1, -1]) + parent.SetStatusWidths([-1, -1]) def _init_sizers(self): # generated method, don't edit @@ -278,6 +285,8 @@ self.menuMacros = wx.Menu(title='') + self.menueRecentPrj = wx.Menu(title=u'') + self._init_coll_menueFile_Items(self.menueFile) self._init_coll_menuBar_Menus(self.menuBar) self._init_coll_menuIncludes_Items(self.menuIncludes) @@ -286,11 +295,12 @@ def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_MAINFRAME, name=u'MainFrame', - parent=prnt, pos=wx.Point(-3, -3), size=wx.Size(800, 600), - style=wx.DEFAULT_FRAME_STYLE, title=u'Py++ IDE') + parent=prnt, pos=wx.Point(0, 0), size=wx.Size(800, 600), + style=wx.DEFAULT_FRAME_STYLE, title=u'Py++ IDE ()') self._init_utils() self.SetClientSize(wx.Size(792, 566)) self.SetMenuBar(self.menuBar) + self.Bind(wx.EVT_CLOSE, self.OnMainFrameClose) self.statusBar = wx.StatusBar(id=wxID_MAINFRAMESTATUSBAR, name=u'statusBar', parent=self, style=0) @@ -366,7 +376,7 @@ self.textCode = wx.TextCtrl(id=wxID_MAINFRAMETEXTCODE, name=u'textCode', parent=self.panelNbCode, pos=wx.Point(0, 0), size=wx.Size(730, 0), style=wx.TE_READONLY | wx.TE_MULTILINE, value=u'') - self.textCode.SetToolTipString(u'textCtrl2') + self.textCode.SetHelpText(u'') self.panelButtons = wx.Panel(id=wxID_MAINFRAMEPANELBUTTONS, name=u'panelButtons', parent=self.panelNbCode, pos=wx.Point(156, @@ -376,6 +386,8 @@ label=u'Generate XML code', name=u'butGenXml', parent=self.panelButtons, pos=wx.Point(10, 0), size=wx.Size(120, 23), style=0) + self.butGenXml.SetToolTipString(u'') + self.butGenXml.SetHelpText(u'Help for button') self.butGenXml.Bind(wx.EVT_BUTTON, self.OnButGenXmlButton, id=wxID_MAINFRAMEBUTGENXML) @@ -465,28 +477,34 @@ self._init_sizers() def __init__(self, parent): - + self.currentItemInclude = None self.currentItemMacro = None self._init_ctrls(parent) - self._setup_ide_ctrls() - self.splitterVertical.SetSashPosition(300, True) - self.SetSize((self.GetSize()[0]+1,self.GetSize()[1]+1)) + self._setup_ide_ctrls() def OnMenueFileNewMenu(self, event): + self._controller.DoProjectNew() event.Skip() def OnMenueFileOpenMenu(self, event): + self._controller.OpenDlgLoadProject() event.Skip() def OnMenueFileSaveMenu(self, event): + self._controller.OpenDlgSaveProject() event.Skip() + + def OnMenueFileSaveAsMenu(self, event): + self._controller.OpenDlgSaveProject(new_file=True) + event.Skip() def OnMenueFileRecentMenu(self, event): event.Skip() def OnMenueFileExitMenu(self, event): + self._controller.ExitIde() event.Skip() def OnTextGenCodeRightDown(self, event): @@ -582,6 +600,17 @@ self.currentItemMacro = None event.Skip() + def OnMenueRecentPrjItems0Menu(self, event): + print "OnMenueRecentPrjItems0Menu" + event.Skip() + + def OnMainFrameClose(self, event): + if not self._controller.ExitIde(): + return() # Don't close + else: + event.Skip() + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-05-01 18:06:07
|
Revision: 1028 http://svn.sourceforge.net/pygccxml/?rev=1028&view=rev Author: roman_yakovenko Date: 2007-05-01 11:06:08 -0700 (Tue, 01 May 2007) Log Message: ----------- Modified Paths: -------------- pyplusplus_dev/announcement.txt Modified: pyplusplus_dev/announcement.txt =================================================================== --- pyplusplus_dev/announcement.txt 2007-04-30 19:08:49 UTC (rev 1027) +++ pyplusplus_dev/announcement.txt 2007-05-01 18:06:08 UTC (rev 1028) @@ -1,6 +1,6 @@ Hello! -I'm pleased to announce the 0.8.5 release of Py++. +I'm pleased to announce the 0.9.0 release of Py++. What is Py++? ============= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-30 19:14:14
|
Revision: 1027 http://svn.sourceforge.net/pygccxml/?rev=1027&view=rev Author: roman_yakovenko Date: 2007-04-30 12:08:49 -0700 (Mon, 30 Apr 2007) Log Message: ----------- updating docs Modified Paths: -------------- pyplusplus_dev/announcement.txt pyplusplus_dev/docs/history/history.rest Modified: pyplusplus_dev/announcement.txt =================================================================== --- pyplusplus_dev/announcement.txt 2007-04-30 18:30:35 UTC (rev 1026) +++ pyplusplus_dev/announcement.txt 2007-04-30 19:08:49 UTC (rev 1027) @@ -1,11 +1,11 @@ Hello! -I'm pleased to announce the 0.8.5 release of Py++. +I'm pleased to announce the 0.8.5 release of Py++. What is Py++? ============= -Py++ is an object-oriented framework for creating a code generator for +Py++ is an object-oriented framework for creating a code generator for Boost.Python library. Where is Py++? @@ -18,38 +18,38 @@ What's new? =========== -Features +Features -------- -* Added "Function Transformation" feature: - http://language-binding.net/pyplusplus/documentation/functions/transformation/transformation.html +* Added exposing of copy constructor, ``operator=`` and ``operator<<``. + * ``operator=`` is exposed under "assign" name + * ``operator<<`` is exposed under "__str__" name -* Added new functionality, which allows you to control messages and warnings: - http://language-binding.net/pyplusplus/documentation/feedback.html#how-to-disable-warning-s +* Added new call policies: + * as_tuple + * custom_call_policies + * return_range -* Adding new algorithm, which controls the registration order of the functions. - http://language-binding.net/pyplusplus/documentation/functions/registration_order.html - -* Added new "Py++" defined "return_pointee_value" call policy: - http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies - -* Opaque types are fully supported: - http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#special-case +* Added an initial support for multi-module development. Now you can mark your + declarations as ``already_exposed`` and `Py++`_ will do the rest. +* `input_c_buffer`_ - new functions transformation, which allows to pass a Python + sequence to C++ function, instead of pair of arguments: pointer to buffer and size. -Small features --------------- +* Added ability to control generated "include" directives. Now you can ask Py++ + to include a header file, when it generates code for some declaration. -* It is possible to configure "Py++" to generate faster ( compilation time ) - code for indexing suite version 2. See API documentation. +* Code generation improvements: system header files (Boost.Python or Py++ defined) + will be included from the generated files only in case the generated code + depends on them. -* The algorithm, which finds all class properties was improved. Now it provides - a better way to control properties creation. A property that would hide another - exposed declaration will not be registered\\created. +* Performance: Py++ runs 1.5 - 2 times faster. -* Work around for "custom smart pointer as member variable" Boost.Python bug - was introduced. +* Py++ will generate documentation for automatically constructed properties. +* Added iteration functionality to Boost.Python Indexing Suite V2 ``std::map`` + and ``std::multimap`` containers. -For a more complete list, please see the news: + +For a more complete list, with links to documentation, please see the news: http://language-binding.net/pyplusplus/history/history.html Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2007-04-30 18:30:35 UTC (rev 1026) +++ pyplusplus_dev/docs/history/history.rest 2007-04-30 19:08:49 UTC (rev 1027) @@ -63,11 +63,11 @@ * `return_range`_ .. _`as_tuple` : ../documentation/functions/call_policies.html#as-tuple -.. _`return_range`: ../documentation/functions/call_policies.html#custom-call-policies +.. _`return_range`: ../documentation/functions/call_policies.html#return-range .. _`custom_call_policies` : ../documentation/functions/call_policies.html#custom-call-policies -4. Added an initial support for multi-module development. Now you can mark you - declaration as ``already_exposed`` and `Py++`_ will do the rest. For more +4. Added an initial support for multi-module development. Now you can mark your + declarations as ``already_exposed`` and `Py++`_ will do the rest. For more information read `multi-module development guide`_. .. _`multi-module development guide` : ../documentation/multi_module_development.html @@ -105,7 +105,8 @@ .. _`properties guide`: ../documentation/properties.html#documentation -11. Added iteration functionality to ``std::map`` and ``std::multimap`` containers. +11. Added iteration functionality to Boost.Python Indexing Suite V2 ``std::map`` + and ``std::multimap`` containers. ------------- Version 0.8.5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-30 18:30:35
|
Revision: 1026 http://svn.sourceforge.net/pygccxml/?rev=1026&view=rev Author: roman_yakovenko Date: 2007-04-30 11:30:35 -0700 (Mon, 30 Apr 2007) Log Message: ----------- updating docs Modified Paths: -------------- pygccxml_dev/announcement.txt pygccxml_dev/docs/history/history.rest pygccxml_dev/unittests/data/core_cache.hpp Modified: pygccxml_dev/announcement.txt =================================================================== --- pygccxml_dev/announcement.txt 2007-04-29 19:15:15 UTC (rev 1025) +++ pygccxml_dev/announcement.txt 2007-04-30 18:30:35 UTC (rev 1026) @@ -1,16 +1,16 @@ Hello! -I'm pleased to announce the 0.8.5 release of pygccxml. +I'm pleased to announce the 0.9.0 release of pygccxml. What is pygccxml? ================= -"...The purpose of the GCC-XML extension is to generate an XML description of a +"...The purpose of the GCC-XML extension is to generate an XML description of a C++ program from GCC's internal representation. " -- Introduction to GCC-XML -The purpose of pygccxml is to read a generated file and provide a simple +The purpose of pygccxml is to read a generated file and provide a simple framework to navigate C++ declarations, using Python classes. Where is pygccxml? @@ -23,46 +23,33 @@ What's new? =========== -Features --------- +Performance +----------- -* Added new functionality: "I depend on them". Every declaration can report - types and declarations it depends on. This functionality helps code generators. - For example, Py++, the Boost.Python code generator, uses it to verify that all - relevant declarations were exposed. +Performance was improved. pygccxml is now 30-50% faster. The improvement was +achieved by using "cElementTree" package, "iterparse" functionality, instead of +standard XML SAX API. -* Declarations, read from GCC-XML generated file, could be saved in cache. Small features -------------- -* New type traits have been added: - * is_bool +* Class calldef_t has new property - "does_throw". It describes whether the + function throws any exception or not. -* Small improvement to algorithm, which extracts value_type - ( mapped_type ) from "std" containers. +* "is_base_and_derived" function arguments were changed. The second argument could be + a tuple, which contains classes. The function returns ``True`` if at least one + class derives from the base one. -* Few aliases to long method name were introduced: - ============================= ========================== - Name Alias - ============================= ========================== - scopedef_t.variable scopedef_t.var - scopedef_t.variables scopedef_t.vars - scopedef_t.member_function scopedef_t.mem_fun - scopedef_t.member_functions scopedef_t.mem_funs - scopedef_t.free_function scopedef_t.free_fun - scopedef_t.free_functions scopedef_t.free_funs - ============================= ========================== - Bug fixes --------- -* "signed char" and "char" are two different types. This bug was fixed and - now pygccxml treats them right. Many thanks to Gaetan Lehmann for reporting - the bug. +* C++ does not define implicit conversion between an integral type and ``void*``. + "declarations.is_convertible" type traits was fixed. -* Fixing bug related to array size and cache. +* Small bug was fixed in functionality that corrects GCC-XML reported function + default arguments. Reference to "enum" declaration extracted properly. For a more complete list, please see the news: Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2007-04-29 19:15:15 UTC (rev 1025) +++ pygccxml_dev/docs/history/history.rest 2007-04-30 18:30:35 UTC (rev 1026) @@ -33,7 +33,7 @@ .. _`cElementTree` : http://effbot.org/zone/celementtree.htm 2. ``is_base_and_derived`` function was changed. The second argument could be - a tuple, which contains classes. Function returns ``True`` if at least one + a tuple, which contains classes. The function returns ``True`` if at least one class derives from the base one. .. line separator Modified: pygccxml_dev/unittests/data/core_cache.hpp =================================================================== --- pygccxml_dev/unittests/data/core_cache.hpp 2007-04-29 19:15:15 UTC (rev 1025) +++ pygccxml_dev/unittests/data/core_cache.hpp 2007-04-30 18:30:35 UTC (rev 1026) @@ -22,4 +22,4 @@ #endif//__core_cache_hpp__ -//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file +//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-29 19:15:16
|
Revision: 1025 http://svn.sourceforge.net/pygccxml/?rev=1025&view=rev Author: roman_yakovenko Date: 2007-04-29 12:15:15 -0700 (Sun, 29 Apr 2007) Log Message: ----------- porting installer to linux Modified Paths: -------------- installers/config.py installers/install_gccxml.py Modified: installers/config.py =================================================================== --- installers/config.py 2007-04-29 07:58:36 UTC (rev 1024) +++ installers/config.py 2007-04-29 19:15:15 UTC (rev 1025) @@ -9,7 +9,11 @@ class setup_builder: #final\destination directory for ditributable package - dist_dir = os.path.split( sys.argv[0] )[0] + dist_dir = os.path.join( + os.path.split( + os.path.abspath( + os.path.dirname( sys.modules[__name__].__file__) ) )[0] + , 'gccxml_%s_installer' % sys.platform ) unzip = None gccxml_cvs_dir = None @@ -18,7 +22,11 @@ if 'win32' == sys.platform: gccxml_cvs_dir = r'D:\dev\gccxml_cvs\gccxml' unzip = 'unzip -d $target_dir $archive' #command line to run in order to unzip the file + else: #linux + gccxml_cvs_dir = r'/home/roman/gccxml-cvs' + unzip = 'tar -xvvzf $archive' #command line to run in order to unzip the file + class archives: cmake = 'cmake-%s.tar' % sys.platform gccxml = 'gccxml-cvs.tar' Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-04-29 07:58:36 UTC (rev 1024) +++ installers/install_gccxml.py 2007-04-29 19:15:15 UTC (rev 1025) @@ -107,67 +107,73 @@ def create_dist_package(): working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) - try: - gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] - gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) - utils.logger.info( 'coping gccxml directory ' ) - shutil.copytree( config.setup_builder.gccxml_cvs_dir, gccxml_cvs_dir_path ) - utils.logger.info( 'coping gccxml directory - done' ) - #TODO: remove cvs files from the directory - utils.logger.info( 'archiving gccxml "%s" directory ' % gccxml_cvs_dir_path ) - gccxml_tar_file = os.path.join( working_dir, config.archives.gccxml ) - tar = tarfile.open( gccxml_tar_file, "w" ) - tar.add( gccxml_cvs_dir_path, gccxml_cvs_dir_name ) - tar.close() - utils.logger.info( 'archiving gccxml "%s" directory - done' % gccxml_cvs_dir_path ) + + gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] + gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) + utils.logger.info( 'coping gccxml directory ' ) + shutil.copytree( config.setup_builder.gccxml_cvs_dir, gccxml_cvs_dir_path ) + utils.logger.info( 'coping gccxml directory - done' ) + #TODO: remove cvs files from the directory + utils.logger.info( 'archiving gccxml "%s" directory ' % gccxml_cvs_dir_path ) + gccxml_tar_file = os.path.join( working_dir, config.archives.gccxml ) + tar = tarfile.open( gccxml_tar_file, "w" ) + tar.add( gccxml_cvs_dir_path, gccxml_cvs_dir_name ) + tar.close() + utils.logger.info( 'archiving gccxml "%s" directory - done' % gccxml_cvs_dir_path ) + + if 'win32' == sys.platform: + cmake_zip_file = os.path.join( working_dir, config.setup_builder.cmake_windows ) + + utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_windows ) + urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_windows + , cmake_zip_file ) + utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_windows ) + + cmake_dir = os.path.splitext( cmake_zip_file )[0] + + utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_windows ) + unzip_cmd = string.Template( config.setup_builder.unzip ) + utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_zip_file + , target_dir='"%s"' % working_dir ) ) + utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_windows ) + - if 'win32' == sys.platform: - cmake_zip_file = os.path.join( working_dir, config.setup_builder.cmake_windows ) + else: #linux + cmake_zip_file = os.path.join( working_dir, config.setup_builder.cmake_linux ) - utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_windows ) - urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_windows - , cmake_zip_file ) - utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_windows ) + utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_linux ) + urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_linux + , cmake_zip_file ) + utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_linux ) - cmake_dir = os.path.splitext( cmake_zip_file )[0] - - utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_windows ) - unzip_cmd = string.Template( config.setup_builder.unzip ) - utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_zip_file - , target_dir='"%s"' % working_dir ) ) - utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_windows ) + cmake_dir = os.path.splitext( cmake_zip_file )[0] + if 'win32' != sys.platform: + cmake_dir = os.path.splitext( cmake_dir )[0] #remove xx.tar.gz + + utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_linux ) + unzip_cmd = string.Template( config.setup_builder.unzip ) + utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_zip_file + , target_dir='"%s"' % working_dir ) ) + utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_linux ) - cmake_archive_dir = os.path.join( working_dir, os.path.splitext( config.archives.cmake )[0] ) + cmake_archive_dir = os.path.join( working_dir, os.path.splitext( config.archives.cmake )[0] ) + if 'win32' != sys.platform: + cmake_archive_dir = os.path.splitext( cmake_archive_dir )[0] #remove xx.tar.gz - shutil.move( cmake_dir, cmake_archive_dir ) - utils.logger.info( 'archiving cmake "%s" directory ' % cmake_archive_dir ) - cmake_tar_file = os.path.join( working_dir, config.archives.cmake ) - tar = tarfile.open( cmake_tar_file, "w" ) - tar.add( cmake_archive_dir, os.path.splitext( config.archives.cmake )[0] ) - tar.close() - utils.logger.info( 'archiving cmake "%s" directory - done' % cmake_archive_dir ) - - #clean after yourself - os.remove( cmake_zip_file ) - utils.rmtree_safe( cmake_dir ) - utils.rmtree_safe( cmake_archive_dir ) - utils.rmtree_safe( gccxml_cvs_dir_path ) - - else: #linux - cmake_linux = os.path.join( working_dir, config.setup_builder.cmake_linux ) - if not os.path.exists( cmake_linux ): - utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_linux ) - urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_linux - , cmake_linux ) - utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_linux ) - utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_linux ) - unzip_cmd = string.Template( config.setup_builder.unzip ) - utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_linux - , target_dir='"%s"' % working_dir ) ) - utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_linux ) - finally: - pass - + shutil.move( cmake_dir, cmake_archive_dir ) + utils.logger.info( 'archiving cmake "%s" directory ' % cmake_archive_dir ) + cmake_tar_file = os.path.join( working_dir, config.archives.cmake ) + tar = tarfile.open( cmake_tar_file, "w" ) + tar.add( cmake_archive_dir, os.path.splitext( config.archives.cmake )[0] ) + tar.close() + utils.logger.info( 'archiving cmake "%s" directory - done' % cmake_archive_dir ) + + #clean after yourself + os.remove( cmake_zip_file ) + utils.rmtree_safe( cmake_dir ) + utils.rmtree_safe( cmake_archive_dir ) + utils.rmtree_safe( gccxml_cvs_dir_path ) + #create final zip file package_dir = os.path.join( os.path.split( working_dir )[0] , 'gccxml_%s_installer' % sys.platform ) @@ -178,5 +184,8 @@ os.remove( gccxml_tar_file ) if __name__ == "__main__": - install() - #create_dist_package() + if 2 == len( sys.argv ) and sys.argv[1] == '--build-setup': + create_dist_package() + else: + install() + # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-29 07:58:35
|
Revision: 1024 http://svn.sourceforge.net/pygccxml/?rev=1024&view=rev Author: roman_yakovenko Date: 2007-04-29 00:58:36 -0700 (Sun, 29 Apr 2007) Log Message: ----------- Modified Paths: -------------- installers/install_gccxml.py installers/utils.py Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-04-29 06:37:59 UTC (rev 1023) +++ installers/install_gccxml.py 2007-04-29 07:58:36 UTC (rev 1024) @@ -24,9 +24,7 @@ utils.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) if os.path.exists( config.gccxml_install_dir ): - utils.logger.info( 'creating GCC_XML install directory "%s"' % config.gccxml_install_dir) - shutil.rmtree( config.gccxml_install_dir ) - utils.logger.info( 'creating GCC_XML install directory "%s"- done' % config.gccxml_install_dir ) + utils.rmtree_safe( config.gccxml_install_dir ) else: utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) @@ -75,9 +73,7 @@ if not os.path.exists( ff_bin ): shutil.copyfile( ff_shared, ff_bin ) - utils.logger.info( 'removing GCC_XML build directory' ) - shutil.rmtree( build_dir, True ) - utils.logger.info( 'removing GCC_XML build directory - done' ) + utils.rmtree_safe( build_dir ) def install(): if 2 == len(sys.argv): @@ -104,15 +100,13 @@ build_gccxml(working_dir) finally: - utils.logger.info( 'removing temporal directory "%s"' % working_dir ) - shutil.rmtree( working_dir ) - utils.logger.info( 'removing temporal directory "%s" - done' % working_dir ) + utils.rmtree_safe( working_dir ) utils.logger.info( 'GCC_XML was successfully installed in "%s" directory' % config.gccxml_install_dir ) utils.logger.info( 'Uninstall instruction - delete GCC_XML install directory.' ) def create_dist_package(): - working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) + working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) try: gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) @@ -121,7 +115,8 @@ utils.logger.info( 'coping gccxml directory - done' ) #TODO: remove cvs files from the directory utils.logger.info( 'archiving gccxml "%s" directory ' % gccxml_cvs_dir_path ) - tar = tarfile.open( os.path.join( working_dir, config.archives.gccxml ), "w" ) + gccxml_tar_file = os.path.join( working_dir, config.archives.gccxml ) + tar = tarfile.open( gccxml_tar_file, "w" ) tar.add( gccxml_cvs_dir_path, gccxml_cvs_dir_name ) tar.close() utils.logger.info( 'archiving gccxml "%s" directory - done' % gccxml_cvs_dir_path ) @@ -146,8 +141,9 @@ shutil.move( cmake_dir, cmake_archive_dir ) utils.logger.info( 'archiving cmake "%s" directory ' % cmake_archive_dir ) - tar = tarfile.open( os.path.join( working_dir, config.archives.cmake ), "w" ) - tar.add( cmake_archive_dir, config.archives.cmake ) + cmake_tar_file = os.path.join( working_dir, config.archives.cmake ) + tar = tarfile.open( cmake_tar_file, "w" ) + tar.add( cmake_archive_dir, os.path.splitext( config.archives.cmake )[0] ) tar.close() utils.logger.info( 'archiving cmake "%s" directory - done' % cmake_archive_dir ) @@ -171,8 +167,16 @@ utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_linux ) finally: pass - #shutil.rmtree( working_dir ) + #create final zip file + package_dir = os.path.join( os.path.split( working_dir )[0] + , 'gccxml_%s_installer' % sys.platform ) + utils.rmtree_safe( package_dir ) + shutil.copytree( working_dir, package_dir ) + utils.rmtree_safe( os.path.join( package_dir, '.svn' ) ) + os.remove( cmake_tar_file ) + os.remove( gccxml_tar_file ) + if __name__ == "__main__": - #install() - create_dist_package() + install() + #create_dist_package() Modified: installers/utils.py =================================================================== --- installers/utils.py 2007-04-29 06:37:59 UTC (rev 1023) +++ installers/utils.py 2007-04-29 07:58:36 UTC (rev 1024) @@ -1,5 +1,6 @@ import os import sys +import stat import shutil import tarfile import zipfile @@ -63,10 +64,14 @@ def rmtree_safe( dir_ ): + for root, dirs, files in os.walk(dir_): + map( lambda f: os.chmod( os.path.join( root, f ), stat.S_IWRITE ) + , files ) + if not os.path.exists( dir_ ): return logger.info( 'removing "%s" directory ' % dir_ ) - shutil.rmtree( dir_ ) + shutil.rmtree( dir_, True ) logger.info( 'removing "%s" directory - done' % dir_ ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-29 06:38:03
|
Revision: 1023 http://svn.sourceforge.net/pygccxml/?rev=1023&view=rev Author: roman_yakovenko Date: 2007-04-28 23:37:59 -0700 (Sat, 28 Apr 2007) Log Message: ----------- few changes to create installer automatically Modified Paths: -------------- installers/config.py installers/install_gccxml.py installers/utils.py Modified: installers/config.py =================================================================== --- installers/config.py 2007-04-25 17:14:13 UTC (rev 1022) +++ installers/config.py 2007-04-29 06:37:59 UTC (rev 1023) @@ -1,3 +1,4 @@ +import os import sys import tempfile @@ -6,6 +7,18 @@ #temporal directory to extract archives and create executables working_dir = tempfile.gettempdir() +class setup_builder: + #final\destination directory for ditributable package + dist_dir = os.path.split( sys.argv[0] )[0] + unzip = None + + gccxml_cvs_dir = None + cmake_windows = 'cmake-2.4.6-win32-x86.zip' + cmake_linux = 'cmake-2.4.6-Linux-i386.tar.gz' + if 'win32' == sys.platform: + gccxml_cvs_dir = r'D:\dev\gccxml_cvs\gccxml' + unzip = 'unzip -d $target_dir $archive' #command line to run in order to unzip the file + class archives: cmake = 'cmake-%s.tar' % sys.platform gccxml = 'gccxml-cvs.tar' @@ -32,4 +45,3 @@ compiler="gcc" generator = 'Unix Makefiles' native_build = 'make' - Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-04-25 17:14:13 UTC (rev 1022) +++ installers/install_gccxml.py 2007-04-29 06:37:59 UTC (rev 1023) @@ -5,8 +5,12 @@ import utils import config import shutil +import urllib +import string +import tarfile import tempfile + def build_gccxml(working_dir): utils.logger.info( 'create environment for building GCC_XML' ) gccxml_src_dir = os.path.join( working_dir, os.path.splitext( config.archives.gccxml )[0] ) @@ -75,7 +79,7 @@ shutil.rmtree( build_dir, True ) utils.logger.info( 'removing GCC_XML build directory - done' ) -if __name__ == "__main__": +def install(): if 2 == len(sys.argv): config.gccxml_install_dir = sys.argv[1] else: @@ -107,3 +111,68 @@ utils.logger.info( 'GCC_XML was successfully installed in "%s" directory' % config.gccxml_install_dir ) utils.logger.info( 'Uninstall instruction - delete GCC_XML install directory.' ) +def create_dist_package(): + working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) + try: + gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] + gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) + utils.logger.info( 'coping gccxml directory ' ) + shutil.copytree( config.setup_builder.gccxml_cvs_dir, gccxml_cvs_dir_path ) + utils.logger.info( 'coping gccxml directory - done' ) + #TODO: remove cvs files from the directory + utils.logger.info( 'archiving gccxml "%s" directory ' % gccxml_cvs_dir_path ) + tar = tarfile.open( os.path.join( working_dir, config.archives.gccxml ), "w" ) + tar.add( gccxml_cvs_dir_path, gccxml_cvs_dir_name ) + tar.close() + utils.logger.info( 'archiving gccxml "%s" directory - done' % gccxml_cvs_dir_path ) + + if 'win32' == sys.platform: + cmake_zip_file = os.path.join( working_dir, config.setup_builder.cmake_windows ) + + utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_windows ) + urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_windows + , cmake_zip_file ) + utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_windows ) + + cmake_dir = os.path.splitext( cmake_zip_file )[0] + + utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_windows ) + unzip_cmd = string.Template( config.setup_builder.unzip ) + utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_zip_file + , target_dir='"%s"' % working_dir ) ) + utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_windows ) + + cmake_archive_dir = os.path.join( working_dir, os.path.splitext( config.archives.cmake )[0] ) + + shutil.move( cmake_dir, cmake_archive_dir ) + utils.logger.info( 'archiving cmake "%s" directory ' % cmake_archive_dir ) + tar = tarfile.open( os.path.join( working_dir, config.archives.cmake ), "w" ) + tar.add( cmake_archive_dir, config.archives.cmake ) + tar.close() + utils.logger.info( 'archiving cmake "%s" directory - done' % cmake_archive_dir ) + + #clean after yourself + os.remove( cmake_zip_file ) + utils.rmtree_safe( cmake_dir ) + utils.rmtree_safe( cmake_archive_dir ) + utils.rmtree_safe( gccxml_cvs_dir_path ) + + else: #linux + cmake_linux = os.path.join( working_dir, config.setup_builder.cmake_linux ) + if not os.path.exists( cmake_linux ): + utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_linux ) + urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_linux + , cmake_linux ) + utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_linux ) + utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_linux ) + unzip_cmd = string.Template( config.setup_builder.unzip ) + utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_linux + , target_dir='"%s"' % working_dir ) ) + utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_linux ) + finally: + pass + #shutil.rmtree( working_dir ) + +if __name__ == "__main__": + #install() + create_dist_package() Modified: installers/utils.py =================================================================== --- installers/utils.py 2007-04-25 17:14:13 UTC (rev 1022) +++ installers/utils.py 2007-04-29 06:37:59 UTC (rev 1023) @@ -1,6 +1,8 @@ import os import sys +import shutil import tarfile +import zipfile import logging import Tkinter import tkFileDialog @@ -9,7 +11,7 @@ def __create_logger(): logger = logging.getLogger('install') handler = logging.StreamHandler(sys.stdout) - handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) + handler.setFormatter( logging.Formatter( '%(message)s' ) ) logger.addHandler(handler) logger.setLevel(logging.INFO) return logger @@ -59,4 +61,12 @@ logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) return exit_status + +def rmtree_safe( dir_ ): + if not os.path.exists( dir_ ): + return + logger.info( 'removing "%s" directory ' % dir_ ) + shutil.rmtree( dir_ ) + logger.info( 'removing "%s" directory - done' % dir_ ) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-25 17:14:18
|
Revision: 1022 http://svn.sourceforge.net/pygccxml/?rev=1022&view=rev Author: roman_yakovenko Date: 2007-04-25 10:14:13 -0700 (Wed, 25 Apr 2007) Log Message: ----------- updating history document Modified Paths: -------------- pyplusplus_dev/docs/history/history.rest Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2007-04-25 05:53:58 UTC (rev 1021) +++ pyplusplus_dev/docs/history/history.rest 2007-04-25 17:14:13 UTC (rev 1022) @@ -105,7 +105,7 @@ .. _`properties guide`: ../documentation/properties.html#documentation -11. Added +11. Added iteration functionality to ``std::map`` and ``std::multimap`` containers. ------------- Version 0.8.5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-25 05:53:56
|
Revision: 1021 http://svn.sourceforge.net/pygccxml/?rev=1021&view=rev Author: roman_yakovenko Date: 2007-04-24 22:53:58 -0700 (Tue, 24 Apr 2007) Log Message: ----------- updating version in setup.py files Modified Paths: -------------- pygccxml_dev/setup.py pyplusplus_dev/setup.py Modified: pygccxml_dev/setup.py =================================================================== --- pygccxml_dev/setup.py 2007-04-25 05:41:44 UTC (rev 1020) +++ pygccxml_dev/setup.py 2007-04-25 05:53:58 UTC (rev 1021) @@ -52,7 +52,7 @@ setup( name = "pygccxml", - version = "0.8.6", + version = "0.9.0", description = "GCC-XML generated file reader", author = "Roman Yakovenko", author_email = "rom...@gm...", Modified: pyplusplus_dev/setup.py =================================================================== --- pyplusplus_dev/setup.py 2007-04-25 05:41:44 UTC (rev 1020) +++ pyplusplus_dev/setup.py 2007-04-25 05:53:58 UTC (rev 1021) @@ -90,7 +90,7 @@ setup( name = "Py++", - version = "0.8.6", + version = "0.9.0", description="Py++ is a framework of components for creating C++ code generator for Boost.Python library", author="Roman Yakovenko", author_email="rom...@gm...", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-25 05:41:45
|
Revision: 1020 http://svn.sourceforge.net/pygccxml/?rev=1020&view=rev Author: roman_yakovenko Date: 2007-04-24 22:41:44 -0700 (Tue, 24 Apr 2007) Log Message: ----------- fixing broken links Modified Paths: -------------- developer_scripts/check_links.bat pyplusplus_dev/docs/comparisons/pyste.rest pyplusplus_dev/docs/documentation/functions/call_policies.rest pyplusplus_dev/docs/documentation/functions/default_args.rest pyplusplus_dev/docs/documentation/functions/functions.rest pyplusplus_dev/docs/documentation/functions/overloading.rest pyplusplus_dev/docs/documentation/functions/registration_order.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/built_in.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/inout.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/input.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_c_buffer.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_static_array.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/output.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/output_static_array.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest pyplusplus_dev/docs/documentation/functions/transformation/custom/custom.rest pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest pyplusplus_dev/docs/documentation/functions/transformation/terminology.rest pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest pyplusplus_dev/docs/documentation/index.rest Modified: developer_scripts/check_links.bat =================================================================== --- developer_scripts/check_links.bat 2007-04-25 05:15:33 UTC (rev 1019) +++ developer_scripts/check_links.bat 2007-04-25 05:41:44 UTC (rev 1020) @@ -1 +1,3 @@ -E:\Python24\Scripts\linkchecker.bat ..\..\language-binding\production\www\index.html +cd D:\dev\language-binding\production\www\ +E:\Python25\Scripts\linkchecker.bat index.html + Modified: pyplusplus_dev/docs/comparisons/pyste.rest =================================================================== --- pyplusplus_dev/docs/comparisons/pyste.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/comparisons/pyste.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -424,7 +424,7 @@ thought about them, long before I created `Py++`_. But unfortunately, lack of time and motivation prevents him to work on `Pyste`_. -.. _`screenshot` : ./../documentation/tutorials/pyplusplus_demo.png +.. _`screenshot` : ./../documentation/tutorials/pyplusplus_gui.html .. _`Py++` : ./../pyplusplus.html .. _`pygccxml` : ./../../pygccxml/pygccxml.html .. _`Pyste`: http://www.boost.org/libs/python/doc/index.html Modified: pyplusplus_dev/docs/documentation/functions/call_policies.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/call_policies.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/call_policies.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -548,7 +548,7 @@ .. _`ResultConverterGenerator` : http://boost.org/libs/python/doc/v2/ResultConverter.html#ResultConverterGenerator-concept .. _`CallPolicies` : http://www.boost.org/libs/python/doc/v2/CallPolicies.html#CallPolicies-concept -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/default_args.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/default_args.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/default_args.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -142,7 +142,7 @@ I am sure we will be able to help you. -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/functions.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/functions.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/functions.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -13,7 +13,7 @@ to export your functions, using desired `Boost.Python`_ functionality. -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/overloading.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/overloading.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/overloading.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -167,7 +167,7 @@ .. _`default arguments` : ./default_args.html -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/registration_order.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/registration_order.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/registration_order.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -144,7 +144,7 @@ -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/built_in.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/built_in.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/built_in.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -45,7 +45,7 @@ value. `Py++`_ handles pretty well such use cases. -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/inout.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/inout.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/inout.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -61,7 +61,7 @@ bp::def( "hello_world", &hello_world_a3478182294a057b61508c30b1361318 ); } -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/input.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/input.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/input.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -54,7 +54,7 @@ bp::def( "hello_world", &hello_world_a3478182294a057b61508c30b1361318 ); } -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_c_buffer.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_c_buffer.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_c_buffer.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -68,7 +68,7 @@ , ( bp::arg("inst"), bp::arg("buffer") ) ); } -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_static_array.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_static_array.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_static_array.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -71,7 +71,7 @@ .def_readwrite( "z", &ft::vector3::z ); } -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -65,7 +65,7 @@ bp::def( "hello_world", &hello_world_a3478182294a057b61508c30b1361318 ); } -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/output.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/output.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/output.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -59,7 +59,7 @@ } -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/output_static_array.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/output_static_array.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/output_static_array.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -71,7 +71,7 @@ .def_readwrite( "z", &ft::vector3::z ); } -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -64,7 +64,7 @@ bp::def( "do_smth", &do_smth_4cf7cde5fca92efcdb8519f8c1a4bccd, ( bp::arg("r") ) ); } -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/custom/custom.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/custom/custom.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/custom/custom.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -26,7 +26,7 @@ .. _`built-in transformers` : ../built_in/built_in.html -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -79,7 +79,7 @@ 2. If you forgot to give an alias to a function, your users will still be able to call the function. So no need to rush and create new release. -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/terminology.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/terminology.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/terminology.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -31,7 +31,7 @@ Name under which `Python`_ users see the exposed function -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -78,7 +78,7 @@ A thanks goes to Matthias Baas for his efforts and hard work. He did a research, implemented the initial working version and wrote a lot of documentation. -.. _`Py++` : ./../pyplusplus.html +.. _`Py++` : ./../../../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org .. _`GCC-XML`: http://www.gccxml.org Modified: pyplusplus_dev/docs/documentation/index.rest =================================================================== --- pyplusplus_dev/docs/documentation/index.rest 2007-04-25 05:15:33 UTC (rev 1019) +++ pyplusplus_dev/docs/documentation/index.rest 2007-04-25 05:41:44 UTC (rev 1020) @@ -63,7 +63,7 @@ * `functions & operators`_ - contains a complete guide to exposing functions and operators, including "call policies" and description of different caveats -.. _`functions & operators` : ../functions/functions.html +.. _`functions & operators` : ./functions/functions.html * `hints`_ - describes few techniques, which will help you with exposing template instantiations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-25 05:15:36
|
Revision: 1019 http://svn.sourceforge.net/pygccxml/?rev=1019&view=rev Author: roman_yakovenko Date: 2007-04-24 22:15:33 -0700 (Tue, 24 Apr 2007) Log Message: ----------- fixing spelling errors Modified Paths: -------------- pygccxml_dev/docs/design.rest pygccxml_dev/docs/query_interface.rest pyplusplus_dev/docs/comparisons/compare_to.rest pyplusplus_dev/docs/comparisons/pyste.rest pyplusplus_dev/docs/documentation/best_practices.rest pyplusplus_dev/docs/documentation/containers.rest pyplusplus_dev/docs/documentation/functions/registration_order.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_static_array.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/output_static_array.rest pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest pyplusplus_dev/docs/documentation/functions/transformation/custom/custom.rest pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest pyplusplus_dev/docs/documentation/how_to.rest pyplusplus_dev/docs/documentation/index.rest pyplusplus_dev/docs/documentation/inserting_code.rest pyplusplus_dev/docs/documentation/multi_module_development.rest pyplusplus_dev/docs/documentation/tutorials/module_builder/module_builder.rest pyplusplus_dev/docs/documentation/warnings.rest pyplusplus_dev/docs/history/history.rest pyplusplus_dev/docs/peps/dsl_challenge.rest pyplusplus_dev/docs/peps/peps_index.rest pyplusplus_dev/docs/pyplusplus.rest pyplusplus_dev/docs/quotes.rest pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest Modified: pygccxml_dev/docs/design.rest =================================================================== --- pygccxml_dev/docs/design.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pygccxml_dev/docs/design.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -137,7 +137,7 @@ * cache - classes, those one will help you to eliminate unnecessary parsing -* patchers - classes, that fix `GCC-XML`_ generated declarations. ( Yes, sometimes +* patchers - classes, which fix `GCC-XML`_ generated declarations. ( Yes, sometimes GCC-XML generates wrong description of C++ declaration. ) Parser classes @@ -227,9 +227,8 @@ There are few cache classes, which implements different cache strategies. -1. ``file_configuration_t`` class, that keeps pass to C++ source file and path to - `GCC-XML`_ generated XML file. This class is not a cache class, but it also - allows you to save your time. +1. ``file_configuration_t`` class, that keeps path to C++ source file and path to + `GCC-XML`_ generated XML file. 2. ``file_cache_t`` class, will save all declarations from all files within single binary file. @@ -277,7 +276,7 @@ Summary ------- -Thats all. I hope I was clear, at least I tried. Any way, `pygccxml`_ is an open +That's all. I hope I was clear, at least I tried. Any way, `pygccxml`_ is an open source project. You always can take a look on the source code. If you need more information please read API documentation. Modified: pygccxml_dev/docs/query_interface.rest =================================================================== --- pygccxml_dev/docs/query_interface.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pygccxml_dev/docs/query_interface.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -24,8 +24,8 @@ query = query & ~declarations.access_type_matcher_t( 'public' ) global_ns.member_functions( function=query, arg_types=[None, 'int &'] ) -The example is complex, but still readable. In many cases you will find your -self looking for one or many declarations using one or two properties of that +The example is complex, but still readable. In many cases you will find +yourself looking for one or many declarations using one or two properties of that declaration(s). For example: .. code-block:: Python @@ -105,8 +105,8 @@ * ``return_type`` - Function return type. This argument can be Python string or an object that - describes C++ type. + the function return type. This argument can be string or an object that describes + C++ type. .. code-block:: Python @@ -129,7 +129,7 @@ mem_funcs = my_class.member_functions( arg_types=[ None, 'int'] ) - ``mem_funcs`` will contain all member functions, that have two arguments + ``mem_funcs`` will contain all member functions, which have two arguments and type of second argument is ``int``. * ``header_dir`` Modified: pyplusplus_dev/docs/comparisons/compare_to.rest =================================================================== --- pyplusplus_dev/docs/comparisons/compare_to.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/comparisons/compare_to.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -49,7 +49,7 @@ .. _`PyOgre` : http://www.ogre3d.org/wiki/index.php/PyOgre -Some other links, that compare Boost.Python, SWIG, SIP and other tools: +Some other links, which compares Boost.Python, SWIG, SIP and other tools: * `Evaluation of Python/C++ interfacing packages`_ Modified: pyplusplus_dev/docs/comparisons/pyste.rest =================================================================== --- pyplusplus_dev/docs/comparisons/pyste.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/comparisons/pyste.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -44,7 +44,7 @@ analyzes. If you identify one, please report it. I will try to fix it, as quick as possible. In the past, I created bindings to few projects using `Pyste`_. Code, generated by `Pyste`_, was pretty good and gave me a good start both with -my projects and with `Boost.Python`_ library. As for me, there are 2 main +my projects and with `Boost.Python`_ library. As for me, there are two main problems with `Pyste`_: 1. It is time-consuming operation to maintain `Pyste`_ scripts in a big, @@ -116,7 +116,7 @@ code. 2. Module creator package. This is code creators factory. Classes in this - package analyze C++ declarations and creates relevant code creators. + package, analyze C++ declarations and creates relevant code creators. 3. File writers package. This package contains classes that write generated code to file(s). @@ -167,7 +167,7 @@ * few parsing strategies: - + all files will be parsed as it was one file that include all them + + all files will be parsed as it was one file that includes all them + every file will be parsed alone, after this, duplicated declarations and types will be removed @@ -375,7 +375,7 @@ 1. It is easier to understand compilation error. - 2. If in future a developer decide to create overload to some function, + 2. If in future a developer decides to create overload to some function, this code will continue to compile. * `Py++`_ has small nice future - "license". User can specify the Modified: pyplusplus_dev/docs/documentation/best_practices.rest =================================================================== --- pyplusplus_dev/docs/documentation/best_practices.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/best_practices.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -38,7 +38,7 @@ couple minutes with a reasonable cache size. You can read more about different caches supported by `pygccxml`_ `here`__. - ``module_builder_t.__init__`` methods takes reference to an instance of cache + ``module_builder_t.__init__`` method takes reference to an instance of cache class or ``None``: .. code-block:: Python Modified: pyplusplus_dev/docs/documentation/containers.rest =================================================================== --- pyplusplus_dev/docs/documentation/containers.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/containers.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -185,7 +185,7 @@ 1. If you set ``equality_comparable`` or ``less_than_comparable`` to ``False``. The indexing suite will disable relevant functionality. You don't have - explicitly to disable method or mothods group. + explicitly to disable method or methods group. 2. The documentation of new indexing suite contains few small mistakes. I hope, I will have time to fix them. Any way, `Py++`_ generates Modified: pyplusplus_dev/docs/documentation/functions/registration_order.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/registration_order.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/functions/registration_order.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -91,7 +91,7 @@ overloaded functions, if it can convert `Python`_ arguments to C++ ones, it does this and calls the function. -Now, when you understand the behaviour, it should be pretty simple to provide +Now, when you understand the behavior, it should be pretty simple to provide a correct functionality: 1. You can change alias of the function, by mangling the type of the argument Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_static_array.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_static_array.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/input_static_array.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -14,7 +14,7 @@ "input_static_array" transformer takes as first argument name or index of the original function argument. The argument should have "array" or "pointer" type. -The second argument should an integer value, that represents array size. +The second argument should an integer value, which represents array size. ------- Example Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -16,7 +16,7 @@ 2. a callable, which takes as argument reference to type and returns new type -New in version grater than 0.8.5. +New in version greater than 0.8.5. Pay attention! -------------- Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/output_static_array.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/output_static_array.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/output_static_array.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -13,7 +13,7 @@ "output_static_array" transformer takes as first argument name or index of the original function argument. The argument should have "array" or "pointer" type. -The second argument should an integer value, that represents array size. +The second argument should an integer value, which represents array size. ------- Example Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -18,7 +18,7 @@ "transfer_ownership" transformer takes one argument, name or index of the original function argument. The argument type should be "pointer". -New in version grater than 0.8.5. +New in version greater than 0.8.5. ------- Example Modified: pyplusplus_dev/docs/documentation/functions/transformation/custom/custom.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/custom/custom.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/functions/transformation/custom/custom.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -18,8 +18,8 @@ How to ...? ----------- -Unfortunately I don't have enough time to write a complete documentation :-(. -Meanwhile fill free to `contact me`_. You also can take a look on `built-in transformers`_ +Unfortunately I don't have enough time to write a complete documentation :-(, +fill free to `contact me`_. You also can take a look on `built-in transformers`_ implementation. .. _`contact me` : ../../../../links.html#id5 Modified: pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -75,7 +75,7 @@ Thanks to --------- -Thanks goes to Matthias Baas for his efforts and hard work. He did a research, +A thanks goes to Matthias Baas for his efforts and hard work. He did a research, implemented the initial working version and wrote a lot of documentation. .. _`Py++` : ./../pyplusplus.html Modified: pyplusplus_dev/docs/documentation/how_to.rest =================================================================== --- pyplusplus_dev/docs/documentation/how_to.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/how_to.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -348,7 +348,7 @@ .. _`constraints` : http://www.python.org/doc/current/ref/identifiers.html -There are few pretty good reasons for this behaviour: +There are few pretty good reasons for this behavior: * when you just start to work on `Python`_ bindings concentrate your attention on really important things Modified: pyplusplus_dev/docs/documentation/index.rest =================================================================== --- pyplusplus_dev/docs/documentation/index.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/index.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -14,7 +14,7 @@ How can you help? * Lets face it: today it is not possible to use `Py++`_ without eventually - looking into source code. `Py++`_ uses `Epydoc`_ to generate documentation + looking into source code. `Py++`_ uses `epydoc`_ to generate documentation from source files. So, if you found some undocumented piece of code and you understand what it does, please write documentation string. @@ -48,7 +48,7 @@ .. _`best practices`: ./best_practices.html -* `documentation string`_ - explains how to automaticly extract a documentation +* `documentation string`_ - explains how to automatically extract a documentation from the source files and put it as Python documentation string .. _`documentation string` : ./doc_string.html @@ -56,7 +56,7 @@ * `warnings`_ - `Py++`_ could be used as some kind of validator. It checks the exposed declarations and reports the potential errors. Thus you are able to create high quality Python bindings from the beginning. This document also - describes how to supress the errors\\warnings. + describes how to suppress the errors\\warnings. .. _`warnings` : ./warnings.html @@ -65,7 +65,7 @@ .. _`functions & operators` : ../functions/functions.html -* `hints`_ - describes few techinques, which will help you with exposing template +* `hints`_ - describes few techniques, which will help you with exposing template instantiations .. _`hints`: ./hints.html @@ -94,7 +94,7 @@ .. _`tutorials` : ./tutorials/tutorials.html -.. _`Epydoc` : http://epydoc.sourceforge.net/ +.. _`epydoc` : http://epydoc.sourceforge.net/ .. _`Py++` : ./../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org Modified: pyplusplus_dev/docs/documentation/inserting_code.rest =================================================================== --- pyplusplus_dev/docs/documentation/inserting_code.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/inserting_code.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -100,7 +100,7 @@ This method will add the code to the declaration section within the module. If you split your module to few files, `Py++`_ will add this code to the - cpp file, class registration code will be written in. + "cpp" file, class registration code will be written in. Attention: there is no defined order between wrapper code and declaration section code. If you have dependencies between code from declaration section and class Modified: pyplusplus_dev/docs/documentation/multi_module_development.rest =================================================================== --- pyplusplus_dev/docs/documentation/multi_module_development.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/multi_module_development.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -8,7 +8,7 @@ Introduction ------------ -It is a common practises to construct final program or a package from few +It is a common practices to construct final program or a package from few different dependent or independent C++ libraries. Many time these libraries reuse classes\\functions defined in some other library. I think this is a must requirement from a code generator to be able to expose these libraries to `Python`_ , Modified: pyplusplus_dev/docs/documentation/tutorials/module_builder/module_builder.rest =================================================================== --- pyplusplus_dev/docs/documentation/tutorials/module_builder/module_builder.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/tutorials/module_builder/module_builder.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -114,8 +114,8 @@ Now it is a time to create module code creator. Do you remember, in introduction to `Py++`_, I told you that before writing code to disc, `Py++`_ will create some -kind of `AST`_. Well this is done by calling ``module_builder_t.build_code_creator`` -function. Right now, the only important argument to the function is ``module_name``. +kind of `AST`_. Well calling module_builder_t.build_code_creator function does this. +Right now, the only important argument to the function is ``module_name``. Self explained, is it? Modified: pyplusplus_dev/docs/documentation/warnings.rest =================================================================== --- pyplusplus_dev/docs/documentation/warnings.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/documentation/warnings.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -35,7 +35,7 @@ virtual Y& do_smth(); }; - Member function ``do_smth`` can not be overridden in Python because... [FILL IN HERE]. + Member function ``do_smth`` cannot be overridden in Python because ... . * .. code-block:: C++ @@ -45,7 +45,7 @@ void get_size( int& height, int& width ) const; }; - Member function ``get_size`` can be exposed to Python, but it will not be callable because [FILL IN HERE]. + Member function ``get_size`` can be exposed to Python, but it will not be callable because ... . * In order to expose free/member function that takes more than 10 arguments user should define ``BOOST_PYTHON_MAX_ARITY`` macro. @@ -75,8 +75,8 @@ In previous paragraph, I described some pretty useful functionality but what should you do to enable it? - *Nothing!* By default, `Py++`_ only prints the -important messages to ``stdout``. More over it prints them only for declarations -that are going to be exported. +important messages to ``stdout``. More over, it prints them only for to be exposed +declarations. `Py++`_ uses the python `logging`_ package to write all user messages. By default, messages with ``DEBUG`` level will be skipped, all other messages will Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/history/history.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -81,7 +81,7 @@ 6. Added ability to control generated "include" directives. Now you can ask `Py++`_ to include a header file, when it generates code for some declaration. For more - information refer to `inserting code guide`_. + information refers to `inserting code guide`_. .. _`inserting code guide` : ../documentation/inserting_code.html#header-files @@ -95,7 +95,7 @@ .. line-separator -9. Added ability to add code before overriden and default function calls. +9. Added ability to add code before overridden and default function calls. For more information refer to `member function API documentation`_. .. _`member function API documentation` : ../documentation/apidocs/pyplusplus.decl_wrappers.calldef_wrapper.member_function_t-class.html Modified: pyplusplus_dev/docs/peps/dsl_challenge.rest =================================================================== --- pyplusplus_dev/docs/peps/dsl_challenge.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/peps/dsl_challenge.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -117,7 +117,7 @@ PointTmpl = mb.module.template('Point') Point = PointTmpl( 'int' ) - This is a trivial example, that is why it looks grate. Consider next class: + This is a trivial example, which is why it looks grate. Consider next class: .. code-block:: C++ Modified: pyplusplus_dev/docs/peps/peps_index.rest =================================================================== --- pyplusplus_dev/docs/peps/peps_index.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/peps/peps_index.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -60,13 +60,13 @@ In version 0.8.1 `Py++`_ introduced nice feature: automatic extraction and integration of documentation strings. I estimated wrong the influence of the feature on the project. First user, who actually tried it, was Gottfried Ganssauge. -He asked me to add support for documentation string that contains unicode characters. +He asked me to add support for documentation string that contains Unicode characters. These days I understand the influence. I should convert all strings in the whole -project to be unicode strings, with encoding specified by the user. This is a +project to be Unicode strings, with encoding specified by the user. This is a lot of work, but I think this is really important. So this is high priority "TODO". http://www.joelonsoftware.com/articles/Unicode.html - a nice article, which -explains what is unicode, encoding and character sets. +explains what is Unicode, encoding and character sets. .. _`Py++` : ./../pyplusplus.html Modified: pyplusplus_dev/docs/pyplusplus.rest =================================================================== --- pyplusplus_dev/docs/pyplusplus.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/pyplusplus.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -81,7 +81,7 @@ mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude() The developer can create custom criteria, for example exclude all declarations -that have 'impl' ( implementation ) string within the name. +with 'impl' ( implementation ) string within the name. .. code-block:: Python @@ -118,7 +118,7 @@ ----------------------- During this step Py++ reads code creators tree and writes code to the disc. The result of code generation process should not be different from the one, -that would be achieved by human. For small project writing all code into single +which would be achieved by human. For small project writing all code into single file is good approach, for big ones code should be written into multiple files. Py++ implements both strategies. Modified: pyplusplus_dev/docs/quotes.rest =================================================================== --- pyplusplus_dev/docs/quotes.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/quotes.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -36,7 +36,7 @@ Lakin Wecker, the author of `Python-OGRE`_ project "... Py++ allows the wrappers to be "automagically" created, which means it's much -easier to keep things up to date (the maintainence on the Py++ based wrapper is +easier to keep things up to date (the maintenance on the Py++ based wrapper is tiny compared to any other system I've used). It also allows us to wrap other libraries fairly easily. " Modified: pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -8,7 +8,7 @@ Preamble -------- -Software development is an interactrive process. During `Py++`_ development +Software development is an interactive process. During `Py++`_ development I see many interesting problems and even more interesting solutions. On this page you will find my collection of the solutions to some of the problems. Modified: pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest 2007-04-25 04:10:48 UTC (rev 1018) +++ pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest 2007-04-25 05:15:33 UTC (rev 1019) @@ -16,7 +16,7 @@ There are two possible solutions to the problem. The first one is to fix Boost.Python library: `pointer_holder.hpp.patch`_ . The patch was contributed -to the library ( 8-December-2006 ) and some day it will be commited to the CVS. +to the library ( 8-December-2006 ) and some day it will be committed to the CVS. It is also possible to solve the problem, without changing Boost.Python library: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-25 04:10:46
|
Revision: 1018 http://svn.sourceforge.net/pygccxml/?rev=1018&view=rev Author: roman_yakovenko Date: 2007-04-24 21:10:48 -0700 (Tue, 24 Apr 2007) Log Message: ----------- updating documentation Modified Paths: -------------- pyplusplus_dev/docs/documentation/best_practices.rest Modified: pyplusplus_dev/docs/documentation/best_practices.rest =================================================================== --- pyplusplus_dev/docs/documentation/best_practices.rest 2007-04-24 17:31:08 UTC (rev 1017) +++ pyplusplus_dev/docs/documentation/best_practices.rest 2007-04-25 04:10:48 UTC (rev 1018) @@ -141,7 +141,34 @@ option using the ``start_with_declarations`` attribute of the ``pygccxml.parser.config_t`` object that you are passing to the parser. +* Use `Py++`_ repository of generated files md5 sum. + `Py++`_ is able to store md5 sum of generated files in a file. Next time you + will generate code, `Py++`_ will compare generated file content against the sum, + instead of loading the content of the previously generated file from the disk + and comparing against it. + + .. code-block:: Python + + mb = module_builder_t( ... ) + ... + my_big_class = mb.class_( my_big_class ) + mb.split_module( ..., use_files_sum_repository=True ) + + `Py++`_ will generate file named "<your module name>.md5.sum" in the directory + it will generate all the files. + + Enabling this functionality should give you 10-15% of performance boost. + + * **Caveats** + + If you changed manually some of the files - don't forget to delete the relevant + line from "md5.sum" file. You can also delete the whole file. If the file is + missing, `Py++`_ will use old plain method of comparing content of the files. + It will not re-write "unchanged" files and you will not be forced to recompile + the whole project. + + .. _`Py++` : ./../pyplusplus.html .. _`pygccxml` : ./../../pygccxml/pygccxml.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-24 17:31:09
|
Revision: 1017 http://svn.sourceforge.net/pygccxml/?rev=1017&view=rev Author: roman_yakovenko Date: 2007-04-24 10:31:08 -0700 (Tue, 24 Apr 2007) Log Message: ----------- updating documentation Modified Paths: -------------- pygccxml_dev/docs/history/history.rest pygccxml_dev/pygccxml/__init__.py pyplusplus_dev/docs/documentation/functions/call_policies.rest pyplusplus_dev/docs/documentation/properties.rest pyplusplus_dev/docs/history/history.rest pyplusplus_dev/docs/pyplusplus.rest pyplusplus_dev/pyplusplus/__init__.py pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2007-04-23 17:15:08 UTC (rev 1016) +++ pygccxml_dev/docs/history/history.rest 2007-04-24 17:31:08 UTC (rev 1017) @@ -22,65 +22,69 @@ ------------- -Version 0.8.* +Version 0.9.0 ------------- -1. ``is_base_and_derived`` function was changed. The second argument could be +1. Performance was improved. `pygccxml`_ is now 30-50% faster. The improvement + was achieved by using `cElementTree`_ package, ``iterparse`` functionality, + instead of standard XML SAX API. If `cElementTree`_ package is not available, + the built-in XML SAX package is used. + +.. _`cElementTree` : http://effbot.org/zone/celementtree.htm + +2. ``is_base_and_derived`` function was changed. The second argument could be a tuple, which contains classes. Function returns ``True`` if at least one class derives from the base one. .. line separator -2. Class ``calldef_t`` has property - ``does_throw``. It describes +3. Class ``calldef_t`` has property - ``does_throw``. It describes whether the function throws any exception or not. .. line separator -3. Bug fixes: small bug was fixed in functionality that corrects GCC-XML reported +4. Bug fixes: small bug was fixed in functionality that corrects GCC-XML reported function default arguments. Reference to "enum" declaration extracted properly. Many thanks to Martin Preisler for reporting the bug. .. line separator -4. New type traits have been added: +5. New type traits have been added: + * ``is_std_ostream`` * ``is_std_wostream`` .. line separator - -5. C++ does not define implicit conversion between an integral type and ``void*``. - ``declarations.is_convertible`` type traitswas fixed. +6. C++ does not define implicit conversion between an integral type and ``void*``. + ``declarations.is_convertible`` type traits was fixed. + .. line separator -6. ``declarations.is_noncopyable`` type traits implementation was slightly changed. +7. ``declarations.is_noncopyable`` type traits implementation was slightly changed. Now it checks explicitly that class has: - + * default constructor * copy constructor * ``operator=`` * destructor - If all listed functions exists, than the algorithm returns ``False``, otherwise + If all listed functions exist, than the algorithm returns ``False``, otherwise it will continue to execute previous logic. - + .. line separator -7. ``declarations.class_declaration_t`` has new property - ``aliases``. This is +8. ``declarations.class_declaration_t`` has new property - ``aliases``. This is a list of all aliases to the class declaration. .. line separator - -8. The message of the exception, which is raised from ``declarations.mdecl_wrapper_t`` + +9. The message of the exception, which is raised from ``declarations.mdecl_wrapper_t`` class was improved and now clearly explains what the problem is. -.. line separator +.. line separator -9. Small improvment was done for ``parser.default_argument_patcher_t`` class. - ``enum`` extraction is done using functionality provided by type traits module. - - ------------- Version 0.8.5 ------------- Modified: pygccxml_dev/pygccxml/__init__.py =================================================================== --- pygccxml_dev/pygccxml/__init__.py 2007-04-23 17:15:08 UTC (rev 1016) +++ pygccxml_dev/pygccxml/__init__.py 2007-04-24 17:31:08 UTC (rev 1017) @@ -33,8 +33,8 @@ import pygccxml.parser as parser import pygccxml.utils as utils -#TODO: +#TODO: # 1. Write documentation for filtering functionality. # 2. Add "explicit" property for constructors -__version__ = '0.8.6' +__version__ = '0.9.0' Modified: pyplusplus_dev/docs/documentation/functions/call_policies.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/call_policies.rest 2007-04-23 17:15:08 UTC (rev 1016) +++ pyplusplus_dev/docs/documentation/functions/call_policies.rest 2007-04-24 17:31:08 UTC (rev 1017) @@ -115,6 +115,10 @@ * return type is ``T&``, for member ``operator[]`` +* ``return_self`` + + This call policy will be used for ``operator=``. + --------------------- Missing call policies --------------------- @@ -181,6 +185,30 @@ Py++ defined call policies -------------------------- +custom_call_policies +-------------------- + +``custom_call_policies`` policies functionality was born to allow you to define +your own call polices and use them with same level of convenience as built-in ones. + +The usage is pretty simple: + +.. code-block:: Python + + from pyplusplus import module_builder + from pyplusplus.module_builder import call_policies + + mb = module_builder.module_builder_t( ... ) + mb.free_function( ... ).call_policies \ + = call_policies.custom_call_policies( your call policies code ) + + Optionally you can specify name of the header file, which should be included: + +.. code-block:: Python + + mb.free_function( ... ).call_policies \ + = call_policies.custom_call_policies( your call policies code, "xyz.hpp" ) + return_pointee_value -------------------- Modified: pyplusplus_dev/docs/documentation/properties.rest =================================================================== --- pyplusplus_dev/docs/documentation/properties.rest 2007-04-23 17:15:08 UTC (rev 1016) +++ pyplusplus_dev/docs/documentation/properties.rest 2007-04-24 17:31:08 UTC (rev 1017) @@ -153,6 +153,13 @@ It is also aware of few common prefixes for set\\get accessors: get, is, has, set, <<empty prefix for get accessor>>. +------------- +Documentation +------------- +You can use ``doc`` attribute to specify the property documentation. If you +don't, than `Py++`_ will construct documentation, which will describe from what +functions this property was built from. + .. _`Py++` : ./../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2007-04-23 17:15:08 UTC (rev 1016) +++ pyplusplus_dev/docs/history/history.rest 2007-04-24 17:31:08 UTC (rev 1017) @@ -35,37 +35,78 @@ ------------- -Version 0.8.* +Version 0.9.0 ------------- 1. Bug fixes: - - * Declaration of virtual functions that have an exception specification with + + * Declaration of virtual functions that have an exception specification with an empty throw was fixed. Now the exception specification is generated properly. Many thanks to Martin Preisler for reporting the bug. .. line-separator -2. Added exposing of copy constructor and ``operator=``. ``operator=`` is exposed - under "assign" name. +2. Added exposing of copy constructor, ``operator=`` and ``operator<<``. + * ``operator=`` is exposed under "assign" name + + * ``operator<<`` is exposed under "__str__" name + .. line-separator -3. Added new call policy - `as_tuple`_ +3. Added new call policies: + * `as_tuple`_ + + * `custom_call_policies`_ + + * `return_range`_ + .. _`as_tuple` : ../documentation/functions/call_policies.html#as-tuple +.. _`return_range`: ../documentation/functions/call_policies.html#custom-call-policies +.. _`custom_call_policies` : ../documentation/functions/call_policies.html#custom-call-policies -4. Added initial support for multi-module development. Now you can mark you declaration - as ``already_exposed``. "Py++" will not create code for it, but will +4. Added an initial support for multi-module development. Now you can mark you + declaration as ``already_exposed`` and `Py++`_ will do the rest. For more + information read `multi-module development guide`_. +.. _`multi-module development guide` : ../documentation/multi_module_development.html + .. line-separator 5. `input_c_buffer`_ - new functions transformation, which allows to pass a Python sequence to function, instead of pair of arguments: pointer to buffer and size. - + .. _`input_c_buffer` : ../documentation/functions/transformation/built_in/input_c_buffer.html +6. Added ability to control generated "include" directives. Now you can ask `Py++`_ + to include a header file, when it generates code for some declaration. For more + information refer to `inserting code guide`_. +.. _`inserting code guide` : ../documentation/inserting_code.html#header-files + +7. Code generation improvements: system header files ( Boost.Python or Py++ defined ) + will be included from the generated files only in case the generated code + depends on them. + +.. line-separator + +8. Performance improvements: Py++ runs 1.5 - 2 times faster, than the previous one. + +.. line-separator + +9. Added ability to add code before overriden and default function calls. + For more information refer to `member function API documentation`_. + +.. _`member function API documentation` : ../documentation/apidocs/pyplusplus.decl_wrappers.calldef_wrapper.member_function_t-class.html + +10. `Py++`_ will generate documentation for automatically constructed properties. + For more information refer to `properties guide`_ + +.. _`properties guide`: ../documentation/properties.html#documentation + +11. Added + ------------- Version 0.8.5 ------------- Modified: pyplusplus_dev/docs/pyplusplus.rest =================================================================== --- pyplusplus_dev/docs/pyplusplus.rest 2007-04-23 17:15:08 UTC (rev 1016) +++ pyplusplus_dev/docs/pyplusplus.rest 2007-04-24 17:31:08 UTC (rev 1017) @@ -126,13 +126,17 @@ Features list ------------- -* `Py++`_ support almost all features found in `Boost.Python`_ library +* `Py++`_ supports almost all features found in `Boost.Python`_ library +* Using `Py++`_ you can develop few extension modules simultaneously, especially + when they share the code. -* `Py++`_ generates code, which will help you to understand compiler generated - error messages +* `Py++`_ generates code, which will help you: + * to understand compiler generated error messages + * to minimize project built time + * `Py++`_ has few modes of writing code into files: * single file @@ -141,9 +145,6 @@ * multiple files, where single class code is split to few files -* `Py++`_ will save your compilation time - it will rewrite a file, only in case - of change - * You have full control over generated code. Your code could be inserted almost anywhere. Modified: pyplusplus_dev/pyplusplus/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/__init__.py 2007-04-23 17:15:08 UTC (rev 1016) +++ pyplusplus_dev/pyplusplus/__init__.py 2007-04-24 17:31:08 UTC (rev 1017) @@ -15,11 +15,11 @@ in the headers. You can then modify (decorate) this tree to customize the bindings. After that, a I{code creators} tree is created where each node represents a block of C++ source code. So you can change any piece of -code befor it is written to disk. As a last step, these source code blocks are -finally written into one or more C++ source files, which can then be compiled to +code befor it is written to disk. As a last step, these source code blocks are +finally written into one or more C++ source files, which can then be compiled to generate the final Python module. -If you are just starting with U{Py++<http://www.language-binding.net>}, +If you are just starting with U{Py++<http://www.language-binding.net>}, then consider to read documentation of L{module_builder} package. """ @@ -34,7 +34,7 @@ from _logging_ import multi_line_formatter_t -__version__ = '0.8.6' +__version__ = '0.9.0' #Known issues: #3. @@ -46,7 +46,7 @@ #~ > > In one header file you define class, in an other you #~ > > define function that takes #~ > > as argument shared_ptr to the class. -#~ > +#~ > #~ > You don't need to use a shared_ptr holder for that purpose. The #~ > *only* reason you'd ever want to use a share_ptr holder is if you #~ > expect people to wrap functions taking non-const references to these Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-04-23 17:15:08 UTC (rev 1016) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-04-24 17:31:08 UTC (rev 1017) @@ -98,21 +98,21 @@ def set_overridable( self, overridable ): self._overridable = overridable - + overridable = property( get_overridable, set_overridable , doc = get_overridable.__doc__ ) - @property + @property def non_overridable_reason( self ): """returns the reason the function could not be overriden""" return self._non_overridable_reason def mark_as_non_overridable( self, reason ): """mark this function as non-overridable - + Not all fucntions could be overrided from Python, for example virtual function that returns non const reference to a member variable. Py++ allows you to - mark these functions and provide and explanation to the user. + mark these functions and provide and explanation to the user. """ self.overridable = False self._non_overridable_reason = messages.W0000 % reason @@ -129,7 +129,7 @@ def add_transformation(self, *transformer_creators, **keywd): """add new function transformation. - transformer_creators - list of transformer creators, which should be applied on the function + transformer_creators - list of transformer creators, which should be applied on the function keywd - keyword arguments for L{function_transformation_t} class initialization """ self.transformations.append( ft.function_transformation_t( self, transformer_creators, **keywd ) ) @@ -167,31 +167,31 @@ return False base = declarations.remove_pointer( type_ ) return declarations.is_pointer( base ) - + def suspicious_type( type_ ): if not declarations.is_reference( type_ ): return False type_no_ref = declarations.remove_reference( type_ ) return not declarations.is_const( type_no_ref ) \ - and ( declarations.is_fundamental( type_no_ref ) + and ( declarations.is_fundamental( type_no_ref ) or declarations.is_enum( type_no_ref ) ) msgs = [] #TODO: functions that takes as argument pointer to pointer to smth, could not be exported #see http://www.boost.org/libs/python/doc/v2/faq.html#funcptr - + if len( self.arguments ) > calldef_t.BOOST_PYTHON_MAX_ARITY: msgs.append( messages.W1007 % ( calldef_t.BOOST_PYTHON_MAX_ARITY, len( self.arguments ) ) ) - + if self.transformations: #if user defined transformation, than I think it took care of the problems ft = self.transformations[0] if ft.alias == ft.unique_name: msgs.append( messages.W1044 % ft.alias ) return msgs - + if suspicious_type( self.return_type ) and None is self.call_policies: msgs.append( messages.W1008 ) - + if ( declarations.is_pointer( self.return_type ) or is_double_ptr( self.return_type ) ) \ and None is self.call_policies: msgs.append( messages.W1050 % str(self.return_type) ) @@ -204,7 +204,7 @@ if False == self.overridable: msgs.append( self._non_overridable_reason) - + problematics = algorithm.registration_order.select_problematics( self ) if problematics: tmp = [] @@ -223,19 +223,23 @@ self._default_precall_code = [] def add_override_precall_code(self, code): + """add code, which should be executed, before overrided member function call""" self._override_precall_code.append( code ) - + @property def override_precall_code(self): + """code, which should be executed, before overrided member function call""" return self._override_precall_code - + def add_default_precall_code(self, code): + """add code, which should be executed, before this member function call""" self._default_precall_code.append( code ) - + @property def default_precall_code(self): + """code, which should be executed, before this member function call""" return self._default_precall_code - + def get_use_overload_macro(self): return self._use_overload_macro def set_use_overload_macro(self, use_macro): @@ -249,14 +253,14 @@ and self.virtuality == declarations.VIRTUALITY_TYPES.NOT_VIRTUAL: return messages.W1011 return '' - + def _readme_impl( self ): msgs = super( member_function_t, self )._readme_impl() if self.does_throw == False \ and self.virtuality != declarations.VIRTUALITY_TYPES.NOT_VIRTUAL: msgs.append( messages.W1046 ) return msgs - + class constructor_t( declarations.constructor_t, calldef_t ): """defines a set of properties, that will instruct Py++ how to expose the constructor""" def __init__(self, *arguments, **keywords): @@ -321,7 +325,7 @@ """helps Py++ to deal with C++ operators""" inplace = [ '+=', '-=', '*=', '/=', '%=', '>>=', '<<=', '&=', '^=', '|=' ] comparison = [ '==', '!=', '<', '>', '<=', '>=' ] - non_member = [ '+', '-', '*', '/', '%', '&', '^', '|', ] + non_member = [ '+', '-', '*', '/', '%', '&', '^', '|', ] unary = [ '!', '~', '+', '-' ] all = inplace + comparison + non_member + unary @@ -334,7 +338,7 @@ return False if oper.symbol != '<<': return oper.symbol in operators_helper.all - + args_len = len( oper.arguments ) if isinstance( oper, declarations.member_operator_t ):# and args_len != 1: return False #Boost.Python does not support member operator<< :-( @@ -377,18 +381,18 @@ def add_override_precall_code(self, code): self._override_precall_code.append( code ) - + @property def override_precall_code(self): return self._override_precall_code - + def add_default_precall_code(self, code): self._default_precall_code.append( code ) - + @property def default_precall_code(self): return self._default_precall_code - + def _get_alias( self): alias = super( member_operator_t, self )._get_alias() if alias == self.name: @@ -493,7 +497,7 @@ calldef_t.__init__( self ) self._use_overload_macro = False self._declaration_code = [] - + def add_declaration_code( self, code ): """adds the code to the declaration section""" self.declaration_code.append( user_text.user_text_t( code ) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-23 17:15:08
|
Revision: 1016 http://svn.sourceforge.net/pygccxml/?rev=1016&view=rev Author: roman_yakovenko Date: 2007-04-23 10:15:08 -0700 (Mon, 23 Apr 2007) Log Message: ----------- moving smart_ptr_t class to a namespace Modified Paths: -------------- pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/bindings.cpp pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/classes.hpp pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/sconstruct pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/smart_ptr.h pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/smart_ptrs.zip Modified: pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/bindings.cpp =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/bindings.cpp 2007-04-22 18:45:10 UTC (rev 1015) +++ pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/bindings.cpp 2007-04-23 17:15:08 UTC (rev 1016) @@ -3,22 +3,20 @@ namespace bp = boost::python; -//namespace boost{ +namespace smart_pointers{ // "get_pointer" function returns pointer to the object managed by smart pointer // class instance template<class T> - inline T * get_pointer(smart_ptr_t<T> const& p){ + inline T * get_pointer(smart_pointers::smart_ptr_t<T> const& p){ return p.get(); } inline derived_t * get_pointer(derived_ptr_t const& p){ return p.get(); } -//} +} -//using boost::get_pointer; - namespace boost{ namespace python{ using boost::get_pointer; @@ -29,7 +27,7 @@ // http://boost.org/libs/python/doc/v2/pointee.html template <class T> - struct pointee< smart_ptr_t<T> >{ + struct pointee< smart_pointers::smart_ptr_t<T> >{ typedef T type; }; @@ -85,37 +83,49 @@ }; BOOST_PYTHON_MODULE( custom_sptr ){ - bp::class_< base_wrapper_t, boost::noncopyable, smart_ptr_t< base_wrapper_t > >( "base_i" ) - // ---------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + bp::class_< base_wrapper_t + , boost::noncopyable + , smart_pointers::smart_ptr_t< base_wrapper_t > >( "base_i" ) + // -----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // HeldType of the abstract class, which is managed by custom smart pointer - // should be smart_ptr_t< base_wrapper_t >. + // should be smart_pointers::smart_ptr_t< base_wrapper_t >. .def( "get_value", bp::pure_virtual( &base_i::get_value ) ); // Register implicit conversion between smart pointers. Boost.Python library // can not discover relationship between classes. You have to tell about the // relationship to it. This will allow Boost.Python to treat right, the - // functions, which expect to get as argument smart_ptr_t< base_i > class - // instance, when smart_ptr_t< derived from base_i > class instance is passed. + // functions, which expect to get as argument smart_pointers::smart_ptr_t< base_i > class + // instance, when smart_pointers::smart_ptr_t< derived from base_i > class instance is passed. // // For more information about implicitly_convertible see the documentation: // http://boost.org/libs/python/doc/v2/implicit.html . - bp::implicitly_convertible< smart_ptr_t< base_wrapper_t >, smart_ptr_t< base_i > >(); + bp::implicitly_convertible< + smart_pointers::smart_ptr_t< base_wrapper_t > + , smart_pointers::smart_ptr_t< base_i > >(); // The register_ptr_to_python functionality is explaned very well in the // documentation: // http://boost.org/libs/python/doc/v2/register_ptr_to_python.html . - bp::register_ptr_to_python< smart_ptr_t< base_i > >(); + bp::register_ptr_to_python< smart_pointers::smart_ptr_t< base_i > >(); - bp::class_< derived_wrapper_t, bp::bases< base_i >, smart_ptr_t<derived_wrapper_t> >( "derived_t" ) - // -------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + bp::class_< derived_wrapper_t + , bp::bases< base_i > + , smart_pointers::smart_ptr_t<derived_wrapper_t> >( "derived_t" ) + // -----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // Pay attention on the class HeldType. It will allow us to create new classes // in Python, which derive from the derived_t class. .def( "get_value", &derived_t::get_value, &derived_wrapper_t::default_get_value ); // Now register all existing conversion: - bp::implicitly_convertible< smart_ptr_t< derived_wrapper_t >, smart_ptr_t< derived_t > >(); - bp::implicitly_convertible< smart_ptr_t< derived_t >, smart_ptr_t< base_i > >(); - bp::implicitly_convertible< derived_ptr_t, smart_ptr_t< derived_t > >(); + bp::implicitly_convertible< + smart_pointers::smart_ptr_t< derived_wrapper_t > + , smart_pointers::smart_ptr_t< derived_t > >(); + bp::implicitly_convertible< + smart_pointers::smart_ptr_t< derived_t > + , smart_pointers::smart_ptr_t< base_i > >(); + bp::implicitly_convertible< + derived_ptr_t + , smart_pointers::smart_ptr_t< derived_t > >(); bp::register_ptr_to_python< derived_ptr_t >(); bp::def( "const_ref_get_value", &::const_ref_get_value ); @@ -125,7 +135,7 @@ bp::def( "create_base", &::create_base ); - bp::class_< numeric_t, smart_ptr_t< numeric_t > >( "numeric_t" ) + bp::class_< numeric_t, smart_pointers::smart_ptr_t< numeric_t > >( "numeric_t" ) .def_readwrite( "value", &numeric_t::value ); bp::def( "create_numeric", &::create_numeric ); @@ -136,13 +146,13 @@ bp::class_< shared_data::buffer_t >( "buffer_t" ) .def_readwrite( "size", &shared_data::buffer_t::size ); - bp::register_ptr_to_python< smart_ptr_t< shared_data::buffer_t > >(); + bp::register_ptr_to_python< smart_pointers::smart_ptr_t< shared_data::buffer_t > >(); bp::class_< shared_data::buffer_holder_t >( "buffer_holder_t" ) .def( "get_data", &shared_data::buffer_holder_t::get_data ) .def_readwrite( "data_naive", &shared_data::buffer_holder_t::data ) // If you will try to access "data_naive" you will get - // TypeError: No Python class registered for C++ class smart_ptr_t<shared_data::buffer_t> + // TypeError: No Python class registered for C++ class smart_pointers::smart_ptr_t<shared_data::buffer_t> // Next lines of code contain work around .add_property( "data" , bp::make_getter( &shared_data::buffer_holder_t::data Modified: pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/classes.hpp =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/classes.hpp 2007-04-22 18:45:10 UTC (rev 1015) +++ pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/classes.hpp 2007-04-23 17:15:08 UTC (rev 1016) @@ -17,21 +17,21 @@ // Some smart pointer classes does not have reach interface as boost ones. // In order to provide same level of convenience, users are forced to create // classes, which derive from smart pointer class. -struct derived_ptr_t : public smart_ptr_t< derived_t >{ +struct derived_ptr_t : public smart_pointers::smart_ptr_t< derived_t >{ derived_ptr_t() - : smart_ptr_t< derived_t >() + : smart_pointers::smart_ptr_t< derived_t >() {} explicit derived_ptr_t(derived_t* rep) - : smart_ptr_t<derived_t>(rep) + : smart_pointers::smart_ptr_t<derived_t>(rep) {} derived_ptr_t(const derived_ptr_t& r) - : smart_ptr_t<derived_t>(r) {} + : smart_pointers::smart_ptr_t<derived_t>(r) {} - derived_ptr_t( const smart_ptr_t< base_i >& r) - : smart_ptr_t<derived_t>() + derived_ptr_t( const smart_pointers::smart_ptr_t< base_i >& r) + : smart_pointers::smart_ptr_t<derived_t>() { m_managed = static_cast<derived_t*>(r.get()); m_use_count = r.use_count_ptr(); @@ -41,7 +41,7 @@ } } - derived_ptr_t& operator=(const smart_ptr_t< base_i >& r) + derived_ptr_t& operator=(const smart_pointers::smart_ptr_t< base_i >& r) { if (m_managed == static_cast<derived_t*>(r.get())) return *this; @@ -63,8 +63,8 @@ return derived_ptr_t( new derived_t() ); } -smart_ptr_t< base_i > create_base(){ - return smart_ptr_t< base_i >( new derived_t() ); +smart_pointers::smart_ptr_t< base_i > create_base(){ + return smart_pointers::smart_ptr_t< base_i >( new derived_t() ); } @@ -72,25 +72,25 @@ // the argument is the instance of a derived class. // // This is the explanation David Abrahams gave: -// Naturally; there is no instance of smart_ptr_t<base_i> anywhere in the +// Naturally; there is no instance of smart_pointers::smart_ptr_t<base_i> anywhere in the // Python object for the reference to bind to. The rules are the same as in C++: // -// int f(smart_ptr_t<base>& x); -// smart_ptr_t<derived> y; +// int f(smart_pointers::smart_ptr_t<base>& x); +// smart_pointers::smart_ptr_t<derived> y; // int z = f(y); // fails to compile inline int -ref_get_value( smart_ptr_t< base_i >& a ){ +ref_get_value( smart_pointers::smart_ptr_t< base_i >& a ){ return a->get_value(); } inline int -val_get_value( smart_ptr_t< base_i > a ){ +val_get_value( smart_pointers::smart_ptr_t< base_i > a ){ return a->get_value(); } inline int -const_ref_get_value( const smart_ptr_t< base_i >& a ){ +const_ref_get_value( const smart_pointers::smart_ptr_t< base_i >& a ){ return a->get_value(); } @@ -103,13 +103,13 @@ int value; }; -smart_ptr_t< numeric_t > create_numeric( int value ){ - smart_ptr_t< numeric_t > num( new numeric_t() ); +smart_pointers::smart_ptr_t< numeric_t > create_numeric( int value ){ + smart_pointers::smart_ptr_t< numeric_t > num( new numeric_t() ); num->value = value; return num; } -int get_numeric_value( smart_ptr_t< numeric_t > n ){ +int get_numeric_value( smart_pointers::smart_ptr_t< numeric_t > n ){ if( n.get() ){ return n->value; } @@ -138,9 +138,9 @@ : data( new buffer_t() ) {} - smart_ptr_t< buffer_t > get_data(){ return data; } + smart_pointers::smart_ptr_t< buffer_t > get_data(){ return data; } - smart_ptr_t< buffer_t > data; + smart_pointers::smart_ptr_t< buffer_t > data; }; } Modified: pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/sconstruct =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/sconstruct 2007-04-22 18:45:10 UTC (rev 1015) +++ pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/sconstruct 2007-04-23 17:15:08 UTC (rev 1016) @@ -2,7 +2,7 @@ SharedLibrary( target=r'custom_sptr' , source=[ r'bindings.cpp' ] , LIBS=[ r"boost_python" ] - , LIBPATH=[ r"/home/roman/boost_cvs/bin",r"" ] + , LIBPATH=[ r"/home/roman/boost_cvs/libs/python/build/bin-stage",r"" ] , CPPPATH=[ r"/home/roman/boost_cvs" , r"/usr/include/python2.4" ] , SHLIBPREFIX='' Modified: pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/smart_ptr.h =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/smart_ptr.h 2007-04-22 18:45:10 UTC (rev 1015) +++ pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/smart_ptr.h 2007-04-23 17:15:08 UTC (rev 1016) @@ -3,10 +3,11 @@ #include <assert.h> - //The smart_ptr_t class has been created based on Ogre::SharedPtr class //http://www.ogre3d.org/docs/api/html/OgreSharedPtr_8h-source.html +namespace smart_pointers{ + template<class T> class smart_ptr_t { protected: @@ -128,6 +129,7 @@ } }; +} //smart_pointers #endif //smart_ptr_t_19_09_2006 Modified: pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/smart_ptrs.zip =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-22 18:45:08
|
Revision: 1015 http://svn.sourceforge.net/pygccxml/?rev=1015&view=rev Author: roman_yakovenko Date: 2007-04-22 11:45:10 -0700 (Sun, 22 Apr 2007) Log Message: ----------- minor bug fix Modified Paths: -------------- pyplusplus_dev/pyplusplus/file_writers/__init__.py Modified: pyplusplus_dev/pyplusplus/file_writers/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/__init__.py 2007-04-22 08:52:09 UTC (rev 1014) +++ pyplusplus_dev/pyplusplus/file_writers/__init__.py 2007-04-22 18:45:10 UTC (rev 1015) @@ -41,7 +41,7 @@ def write_multiple_files( extmodule, dir_path, files_sum_repository=None ): """writes extmodule to multiple files""" - mfs = multiple_files_t( extmodule, dir_path, files_sum_repository, files_sum_repository=files_sum_repository ) + mfs = multiple_files_t( extmodule, dir_path, files_sum_repository=files_sum_repository ) mfs.write() return mfs.written_files This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-22 08:52:09
|
Revision: 1014 http://svn.sourceforge.net/pygccxml/?rev=1014&view=rev Author: roman_yakovenko Date: 2007-04-22 01:52:09 -0700 (Sun, 22 Apr 2007) Log Message: ----------- don't update files on first use of md5sum Modified Paths: -------------- pyplusplus_dev/pyplusplus/file_writers/writer.py Modified: pyplusplus_dev/pyplusplus/file_writers/writer.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-04-22 08:41:55 UTC (rev 1013) +++ pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-04-22 08:52:09 UTC (rev 1014) @@ -89,6 +89,7 @@ fcontent_new = ''.join( fcontent_new ) new_hash_value = None + curr_hash_value = None if files_sum_repository: new_hash_value = files_sum_repository.get_text_value( fcontent_new ) curr_hash_value = files_sum_repository.get_file_value( fname ) @@ -96,7 +97,10 @@ writer_t.logger.debug( 'file was not changed( hash ) - done( %f seconds )' % ( time.clock() - start_time ) ) return - elif os.path.exists( fpath ): + + if os.path.exists( fpath ) and None is curr_hash_value: + #It could be a first time the user uses files_sum_repository, don't force him + #to recompile the code #small optimization to cut down compilation time f = file( fpath, 'rb' ) fcontent = f.read() @@ -105,8 +109,8 @@ writer_t.logger.debug( 'file was not changed( content ) - done( %f seconds )' % ( time.clock() - start_time ) ) return - else: - writer_t.logger.debug( 'file changed or it does not exist' ) + + writer_t.logger.debug( 'file changed or it does not exist' ) writer_t.create_backup( fpath ) f = file( fpath, 'w+b' ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-22 08:41:55
|
Revision: 1013 http://svn.sourceforge.net/pygccxml/?rev=1013&view=rev Author: roman_yakovenko Date: 2007-04-22 01:41:55 -0700 (Sun, 22 Apr 2007) Log Message: ----------- performance improvement - Py++ will store md5sum of the generated files and will compare against next time it will generate code. This save the need to load alll generated files from disk Modified Paths: -------------- pyplusplus_dev/pyplusplus/file_writers/__init__.py pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py pyplusplus_dev/pyplusplus/file_writers/multiple_files.py pyplusplus_dev/pyplusplus/file_writers/writer.py pyplusplus_dev/pyplusplus/module_builder/builder.py pyplusplus_dev/unittests/algorithms_tester.py Added Paths: ----------- pyplusplus_dev/pyplusplus/file_writers/md5sum_repository.py Modified: pyplusplus_dev/pyplusplus/file_writers/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/__init__.py 2007-04-21 17:21:44 UTC (rev 1012) +++ pyplusplus_dev/pyplusplus/file_writers/__init__.py 2007-04-22 08:41:55 UTC (rev 1013) @@ -21,6 +21,8 @@ from single_file import single_file_t from multiple_files import multiple_files_t from class_multiple_files import class_multiple_files_t +from md5sum_repository import repository_t +from md5sum_repository import cached_repository_t def has_pypp_extenstion( fname ): """returns True if file has Py++ specific extension, otherwise False""" @@ -37,14 +39,14 @@ sf = single_file_t( data, file_path ) sf.write() -def write_multiple_files( extmodule, dir_path ): +def write_multiple_files( extmodule, dir_path, files_sum_repository=None ): """writes extmodule to multiple files""" - mfs = multiple_files_t( extmodule, dir_path ) + mfs = multiple_files_t( extmodule, dir_path, files_sum_repository, files_sum_repository=files_sum_repository ) mfs.write() return mfs.written_files -def write_class_multiple_files( extmodule, dir_path, huge_classes ): +def write_class_multiple_files( extmodule, dir_path, huge_classes, files_sum_repository ): """writes extmodule to multiple files and splits huge classes to few source files""" - mfs = class_multiple_files_t( extmodule, dir_path, huge_classes ) + mfs = class_multiple_files_t( extmodule, dir_path, huge_classes, files_sum_repository=files_sum_repository ) mfs.write() return mfs.written_files Modified: pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2007-04-21 17:21:44 UTC (rev 1012) +++ pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2007-04-22 08:41:55 UTC (rev 1013) @@ -29,8 +29,16 @@ alias + _main h/cpp this class will contain main registration function. """ - def __init__(self, extmodule, directory_path, huge_classes, num_of_functions_per_file=20): - multiple_files.multiple_files_t.__init__(self, extmodule, directory_path) + def __init__( self + , extmodule + , directory_path + , huge_classes + , num_of_functions_per_file=20 + , files_sum_repository=None ): + multiple_files.multiple_files_t.__init__(self + , extmodule + , directory_path + , files_sum_repository=files_sum_repository) self.huge_classes = huge_classes self.num_of_functions_per_file = num_of_functions_per_file self.internal_splitters = [ Added: pyplusplus_dev/pyplusplus/file_writers/md5sum_repository.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/md5sum_repository.py (rev 0) +++ pyplusplus_dev/pyplusplus/file_writers/md5sum_repository.py 2007-04-22 08:41:55 UTC (rev 1013) @@ -0,0 +1,97 @@ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""defines interface for repository of generated files hash""" + +import os +try: + from hashlib import md5 +except: + from md5 import new as md5 + + +def get_md5_text_value( text ): + m = md5() + m.update( text ) + return m.hexdigest() + +def get_md5_file_value( fpath ): + if not os.path.exists( fpath ): + return None #file does not exist + f = file( fpath, 'rb' ) + fcontent = f.read() + f.close() + return get_md5_text_value( fcontent ) + +class repository_t( object ): + def __init__( self ): + object.__init__( self ) + + def get_file_value( self, fpath ): + return NotImplementedError( self.__class__.__name__ ) + + def get_text_value( self, fpath ): + return NotImplementedError( self.__class__.__name__ ) + + def update_value( self, fpath, hash_value ): + return NotImplementedError( self.__class__.__name__ ) + + def save_values( self ): + return NotImplementedError( self.__class__.__name__ ) + +class dummy_repository_t( repository_t ): + def __init__( self ): + repository_t.__init__( self ) + + def get_file_value( self, fpath ): + return get_md5_file_value( fpath ) + + def get_text_value( self, text ): + return get_md5_text_value( text ) + + def update_value( self, fpath, hash_value ): + pass + + def save_values( self ): + pass + +class cached_repository_t( repository_t ): + separator = ' ' + hexdigest_len = 32 + hexdigest_separator_len = 33 + + def __init__( self, file_name ): + repository_t.__init__( self ) + self.__repository = {} + self.__repository_file = file_name + if os.path.exists( self.__repository_file ): + f = file( self.__repository_file, 'r' ) + for line in f: + if len(line) < self.hexdigest_separator_len: + continue + hexdigest = line[:self.hexdigest_len] + fname = line[self.hexdigest_separator_len:].rstrip() + self.__repository[ fname ] = hexdigest + f.close() + + def get_file_value( self, fpath ): + try: + return self.__repository[ fpath ] + except KeyError: + return None + + def get_text_value( self, text ): + return get_md5_text_value( text ) + + def update_value( self, fpath, hash_value ): + self.__repository[ fpath ] = hash_value + + def save_values( self ): + lines = [] + for fpath, hexdigest in self.__repository.iteritems(): + lines.append( '%s%s%s%s' % ( hexdigest, self.separator, fpath, os.linesep ) ) + f = file( self.__repository_file, 'w+' ) + f.writelines( lines ) + f.close() Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-04-21 17:21:44 UTC (rev 1012) +++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-04-22 08:41:55 UTC (rev 1013) @@ -22,7 +22,7 @@ HEADER_EXT = '.pypp.hpp' SOURCE_EXT = '.pypp.cpp' - def __init__(self, extmodule, directory_path, write_main=True): + def __init__(self, extmodule, directory_path, write_main=True, files_sum_repository=None): """Constructor. @param extmodule: The root of a code creator tree @@ -34,7 +34,7 @@ that calls all the registration methods. @type write_main: boolean """ - writer.writer_t.__init__(self, extmodule) + writer.writer_t.__init__( self, extmodule, files_sum_repository ) self.__directory_path = directory_path self.create_dir( directory_path ) self.include_creators = [] # List of include_t creators that contain the generated headers @@ -49,7 +49,7 @@ def write_file( self, fpath, content ): self.written_files.append( fpath ) - writer.writer_t.write_file( fpath, content ) + writer.writer_t.write_file( fpath, content, self.files_sum_repository ) def create_dir( self, directory_path ): """Create the output directory if it doesn't already exist. @@ -385,3 +385,4 @@ , self.include_creators ) main_cpp = os.path.join( self.directory_path, self.extmodule.body.name + '.main.cpp' ) self.write_file( main_cpp, self.extmodule.create() + os.linesep ) + self.files_sum_repository.save_values() Modified: pyplusplus_dev/pyplusplus/file_writers/writer.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-04-21 17:21:44 UTC (rev 1012) +++ pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-04-22 08:41:55 UTC (rev 1013) @@ -10,6 +10,7 @@ from pyplusplus import _logging_ from pyplusplus import code_creators from pyplusplus import code_repository +import md5sum_repository class writer_t(object): """Base class for all module/code writers. @@ -21,17 +22,22 @@ """ logger = _logging_.loggers.file_writer - def __init__(self, extmodule): + def __init__(self, extmodule, files_sum_repository=None): object.__init__(self) self.__extmodule = extmodule - - - def _get_extmodule(self): + self.__files_sum_repository = files_sum_repository + if None is files_sum_repository: + self.__files_sum_repository = md5sum_repository.dummy_repository_t() + + @property + def extmodule(self): + """The root of the code creator tree ( code_creators.module_t )""" return self.__extmodule - extmodule = property( _get_extmodule, - doc="""The root of the code creator tree. - @type: module_t""") - + + @property + def files_sum_repository( self ): + return self.__files_sum_repository + def write(self): """ Main write method. Should be overridden by derived classes. """ raise NotImplementedError() @@ -57,7 +63,7 @@ self.write_file( os.path.join( dir, code_repository.named_tuple.file_name ) , code_repository.named_tuple.code ) @staticmethod - def write_file( fpath, content ): + def write_file( fpath, content, files_sum_repository=None ): """Write a source file. This method writes the string content into the specified file. @@ -82,22 +88,32 @@ fcontent_new.append( os.linesep ) #keep gcc happy fcontent_new = ''.join( fcontent_new ) - if os.path.exists( fpath ): + new_hash_value = None + if files_sum_repository: + new_hash_value = files_sum_repository.get_text_value( fcontent_new ) + curr_hash_value = files_sum_repository.get_file_value( fname ) + if new_hash_value == curr_hash_value: + writer_t.logger.debug( 'file was not changed( hash ) - done( %f seconds )' + % ( time.clock() - start_time ) ) + return + elif os.path.exists( fpath ): #small optimization to cut down compilation time f = file( fpath, 'rb' ) fcontent = f.read() f.close() if fcontent == fcontent_new: - writer_t.logger.debug( 'file was not changed - done( %f seconds )' + writer_t.logger.debug( 'file was not changed( content ) - done( %f seconds )' % ( time.clock() - start_time ) ) return else: - writer_t.logger.debug( 'file does not exist' ) + writer_t.logger.debug( 'file changed or it does not exist' ) writer_t.create_backup( fpath ) f = file( fpath, 'w+b' ) f.write( fcontent_new ) f.close() + if new_hash_value: + files_sum_repository.update_value( fname, new_hash_value ) writer_t.logger.info( 'file "%s" - updated( %f seconds )' % ( fname, time.clock() - start_time ) ) def get_user_headers( self, creators ): Modified: pyplusplus_dev/pyplusplus/module_builder/builder.py =================================================================== --- pyplusplus_dev/pyplusplus/module_builder/builder.py 2007-04-21 17:21:44 UTC (rev 1012) +++ pyplusplus_dev/pyplusplus/module_builder/builder.py 2007-04-22 08:41:55 UTC (rev 1013) @@ -303,7 +303,11 @@ self.__merge_user_code() file_writers.write_file( self.code_creator, file_name ) - def split_module(self, dir_name, huge_classes=None, on_unused_file_found=os.remove): + def split_module( self + , dir_name + , huge_classes=None + , on_unused_file_found=os.remove + , use_files_sum_repository=False): """ Writes module to multiple files @@ -314,13 +318,30 @@ @param on_unused_file_found: callable object that represents the action that should be taken on file, which is no more in use + + @use_files_sum_repository: Py++ can generate file, which will contain md5 sum of every generated file. + Next time you generate code, md5sum will be loaded from the file and compared. + This could speed-up code generation process by 10-15%. """ self.__merge_user_code() + + files_sum_repository = None + if use_files_sum_repository: + cache_file = os.path.join( dir_name, self.code_creator.body.name + '.md5.sum' ) + files_sum_repository = file_writers.cached_repository_t( cache_file ) + written_files = [] if None is huge_classes: - written_files = file_writers.write_multiple_files( self.code_creator, dir_name ) + written_files = file_writers.write_multiple_files( + self.code_creator + , dir_name + , files_sum_repository=files_sum_repository ) else: - written_files = file_writers.write_class_multiple_files( self.code_creator, dir_name, huge_classes ) + written_files = file_writers.write_class_multiple_files( + self.code_creator + , dir_name + , huge_classes + , files_sum_repository=files_sum_repository ) all_files = os.listdir( dir_name ) all_files = map( lambda fname: os.path.join( dir_name, fname ), all_files ) Modified: pyplusplus_dev/unittests/algorithms_tester.py =================================================================== --- pyplusplus_dev/unittests/algorithms_tester.py 2007-04-21 17:21:44 UTC (rev 1012) +++ pyplusplus_dev/unittests/algorithms_tester.py 2007-04-22 08:41:55 UTC (rev 1013) @@ -184,7 +184,8 @@ mb.build_code_creator('x_class_multi') mb.split_module( autoconfig.build_dir , [ mb.class_( '::tester::x' ) ] - , on_unused_file_found=lambda fpath: fpath ) + , on_unused_file_found=lambda fpath: fpath + , use_files_sum_repository=True) class split_sequence_tester_t(unittest.TestCase): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-21 17:21:42
|
Revision: 1012 http://svn.sourceforge.net/pygccxml/?rev=1012&view=rev Author: roman_yakovenko Date: 2007-04-21 10:21:44 -0700 (Sat, 21 Apr 2007) Log Message: ----------- adding another set of performance optimizations, basically to reduce the number of "isinstance" calls Modified Paths: -------------- pygccxml_dev/pygccxml/parser/patcher.py pygccxml_dev/pygccxml/parser/scanner.py pygccxml_dev/pygccxml/parser/source_reader.py Modified: pygccxml_dev/pygccxml/parser/patcher.py =================================================================== --- pygccxml_dev/pygccxml/parser/patcher.py 2007-04-20 20:22:23 UTC (rev 1011) +++ pygccxml_dev/pygccxml/parser/patcher.py 2007-04-21 17:21:44 UTC (rev 1012) @@ -177,12 +177,11 @@ _casting_oper_patcher_ = casting_operator_patcher_t() -def fix_decls(decls, enums): +def fix_calldef_decls(decls, enums): default_arg_patcher = default_argument_patcher_t(enums) #decls should be flat list of all declarations, you want to apply patch on for decl in decls: - if isinstance( decl, declarations.calldef_t ): - default_arg_patcher( decl ) + default_arg_patcher( decl ) if isinstance( decl, declarations.casting_operator_t): _casting_oper_patcher_( decl ) Modified: pygccxml_dev/pygccxml/parser/scanner.py =================================================================== --- pygccxml_dev/pygccxml/parser/scanner.py 2007-04-20 20:22:23 UTC (rev 1011) +++ pygccxml_dev/pygccxml/parser/scanner.py 2007-04-21 17:21:44 UTC (rev 1012) @@ -127,7 +127,7 @@ #mapping from id -> decl self.__declarations = {} #list of all read declarations - self.__all_declarations = [] + self.__calldefs = [] #list of enums I need later self.__enums = [] #mapping from id -> type @@ -157,8 +157,8 @@ def declarations(self): return self.__declarations - def all_declarations( self ): - return self.__all_declarations + def calldefs( self ): + return self.__calldefs def enums(self): return self.__enums @@ -194,7 +194,6 @@ self.__read_access( attrs ) element_id = attrs.get(XML_AN_ID, None) if isinstance( obj, declaration_t ): - self.__all_declarations.append( obj ) self.__update_membership( attrs ) self.__declarations[ element_id ] = obj if not isinstance( obj, namespace_t ): @@ -335,10 +334,11 @@ argument.default_value = None self.__inst.arguments.append( argument ) - def __read_calldef( self, calldef, attrs ): + def __read_calldef( self, calldef, attrs, is_declaration ): #destructor for example doesn't have return type calldef.return_type = attrs.get( XML_AN_RETURNS, None ) - if isinstance( calldef, declaration_t ): + if is_declaration: + self.__calldefs.append( calldef ) calldef.name = attrs.get(XML_AN_NAME, '') calldef.has_extern = attrs.get( XML_AN_EXTERN, False ) throw_stmt = attrs.get( XML_AN_THROW, None ) @@ -352,10 +352,10 @@ calldef.does_throw = True calldef.exceptions = throw_stmt.split() - def __read_member_function( self, calldef, attrs ): - self.__read_calldef( calldef, attrs ) + def __read_member_function( self, calldef, attrs, is_declaration ): + self.__read_calldef( calldef, attrs, is_declaration ) calldef.has_const = attrs.get( XML_AN_CONST, False ) - if isinstance( calldef, declaration_t ): + if is_declaration: calldef.has_static = attrs.get( XML_AN_STATIC, False ) if attrs.has_key( XML_AN_PURE_VIRTUAL ): calldef.virtuality = VIRTUALITY_TYPES.PURE_VIRTUAL @@ -368,12 +368,12 @@ def __read_function_type(self, attrs): answer = free_function_type_t() - self.__read_calldef( answer, attrs ) + self.__read_calldef( answer, attrs, False ) return answer def __read_method_type(self, attrs): answer = member_function_type_t() - self.__read_member_function( answer, attrs ) + self.__read_member_function( answer, attrs, False ) return answer def __read_typedef(self, attrs ): @@ -420,33 +420,33 @@ def __read_casting_operator(self, attrs ): operator = self.__decl_factory.create_casting_operator() - self.__read_member_function( operator, attrs ) + self.__read_member_function( operator, attrs, True ) return operator def __read_constructor( self, attrs ): constructor = self.__decl_factory.create_constructor() - self.__read_member_function( constructor, attrs ) + self.__read_member_function( constructor, attrs, True ) return constructor def __read_function(self, attrs): gfunction = self.__decl_factory.create_free_function() - self.__read_calldef( gfunction, attrs ) + self.__read_calldef( gfunction, attrs, True ) return gfunction def __read_method(self, attrs): mfunction = self.__decl_factory.create_member_function() - self.__read_member_function( mfunction, attrs ) + self.__read_member_function( mfunction, attrs, True ) return mfunction def __read_destructor(self, attrs): destructor = self.__decl_factory.create_destructor() - self.__read_member_function( destructor, attrs ) + self.__read_member_function( destructor, attrs, True ) destructor.name = '~' + destructor.name return destructor def __read_free_operator(self, attrs ): operator = self.__decl_factory.create_free_operator() - self.__read_member_function( operator, attrs ) + self.__read_member_function( operator, attrs, True ) if 'new' in operator.name or 'delete' in operator.name: operator.name = 'operator ' + operator.name else: @@ -455,7 +455,7 @@ def __read_member_operator(self, attrs): operator = self.__decl_factory.create_member_operator() - self.__read_member_function( operator, attrs ) + self.__read_member_function( operator, attrs, True ) if 'new' in operator.name or 'delete' in operator.name: operator.name = 'operator ' + operator.name else: Modified: pygccxml_dev/pygccxml/parser/source_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-20 20:22:23 UTC (rev 1011) +++ pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-21 17:21:44 UTC (rev 1012) @@ -338,7 +338,7 @@ #template< typename X> #void ddd(){ typedef typename X::Y YY;} #if I will fail on this bug next time, the right way to fix it may be different - patcher.fix_decls( scanner_.all_declarations(), scanner_.enums() ) + patcher.fix_calldef_decls( scanner_.calldefs(), scanner_.enums() ) decls = filter( lambda inst: isinstance( inst, namespace_t ) and not inst.parent , decls.itervalues() ) return ( decls, files.values() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-20 20:22:26
|
Revision: 1011 http://svn.sourceforge.net/pygccxml/?rev=1011&view=rev Author: roman_yakovenko Date: 2007-04-20 13:22:23 -0700 (Fri, 20 Apr 2007) Log Message: ----------- adding another set of performance optimizations, basically to reduce the number of "make_flatten" calls Modified Paths: -------------- pygccxml_dev/pygccxml/parser/patcher.py pygccxml_dev/pygccxml/parser/scanner.py pygccxml_dev/pygccxml/parser/source_reader.py pygccxml_dev/unittests/patcher_tester.py pygccxml_dev/unittests/test_performance.py Added Paths: ----------- pygccxml_dev/docs/links.rest pygccxml_dev/unittests/results.txt Added: pygccxml_dev/docs/links.rest =================================================================== --- pygccxml_dev/docs/links.rest (rev 0) +++ pygccxml_dev/docs/links.rest 2007-04-20 20:22:23 UTC (rev 1011) @@ -0,0 +1,31 @@ +============== +C++ Reflection +============== + +.. contents:: Table of contents + +----- +Links +----- + +* `CppReflect`_ - extracts reflection information from executables, which were + build with debug information. It works with executables that has COFF or ELF + format. + +.. _`CppReflect` : http://www.garret.ru/~knizhnik/cppreflection/docs/reflect.html + +* `XTI An Extended Type Information Library`_ - Bjarne Stroustrup talk about adding + reflection information to C++ program. + + + +.. _`XTI An Extended Type Information Library` : http://lcgapp.cern.ch/project/architecture/XTI_accu.pdf + +.. _`pygccxml`: ./pygccxml.html +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: Modified: pygccxml_dev/pygccxml/parser/patcher.py =================================================================== --- pygccxml_dev/pygccxml/parser/patcher.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/pygccxml/parser/patcher.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -8,8 +8,9 @@ class default_argument_patcher_t( object ): - def __init__( self ): + def __init__( self, enums ): object.__init__( self ) + self.__enums = enums def __call__(self, decl): for arg in decl.arguments: @@ -102,10 +103,10 @@ #this algorithm could be improved: it could take into account #1. unnamed namespaced #2. location within files - enumeration_t = declarations.enumeration_t - for decl in scope.declarations: - if isinstance( decl, enumeration_t ) and decl.has_value_name( default_value ): - return decl + + for enum in self.__enums: + if enum.parent is scope and enum.has_value_name( default_value ): + return enum return None def __is_double_call( self, func, arg ): @@ -174,14 +175,14 @@ def __call__(self, decl): decl.name = 'operator ' + decl.return_type.decl_string -_default_arg_patcher_ = default_argument_patcher_t() _casting_oper_patcher_ = casting_operator_patcher_t() -def fix_decls(decls): +def fix_decls(decls, enums): + default_arg_patcher = default_argument_patcher_t(enums) #decls should be flat list of all declarations, you want to apply patch on for decl in decls: if isinstance( decl, declarations.calldef_t ): - _default_arg_patcher_( decl ) + default_arg_patcher( decl ) if isinstance( decl, declarations.casting_operator_t): _casting_oper_patcher_( decl ) Modified: pygccxml_dev/pygccxml/parser/scanner.py =================================================================== --- pygccxml_dev/pygccxml/parser/scanner.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/pygccxml/parser/scanner.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -126,6 +126,10 @@ #mapping from id -> decl self.__declarations = {} + #list of all read declarations + self.__all_declarations = [] + #list of enums I need later + self.__enums = [] #mapping from id -> type self.__types = {} #mapping from id -> file @@ -153,6 +157,12 @@ def declarations(self): return self.__declarations + def all_declarations( self ): + return self.__all_declarations + + def enums(self): + return self.__enums + def types(self): return self.__types @@ -184,6 +194,7 @@ self.__read_access( attrs ) element_id = attrs.get(XML_AN_ID, None) if isinstance( obj, declaration_t ): + self.__all_declarations.append( obj ) self.__update_membership( attrs ) self.__declarations[ element_id ] = obj if not isinstance( obj, namespace_t ): @@ -211,7 +222,7 @@ self.__inst = None def __read_location(self, decl, attrs): - decl.location = location_t( file_name=attrs[XML_AN_FILE], line=int( attrs[XML_AN_LINE])) + decl.location = location_t( file_name=attrs[XML_AN_FILE], line=int(attrs[XML_AN_LINE])) def __update_membership(self, attrs): parent = attrs.get( XML_AN_CONTEXT, None ) @@ -259,7 +270,9 @@ if '$_' in enum_name or '._' in enum_name: #it means that this is unnamed enum. in c++ enum{ x }; enum_name = '' - return self.__decl_factory.create_enumeration( name=enum_name ) + decl = self.__decl_factory.create_enumeration( name=enum_name ) + self.__enums.append( decl ) + return decl def __read_enumeration_value( self, attrs ): name = attrs.get( XML_AN_NAME, '' ) Modified: pygccxml_dev/pygccxml/parser/source_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -337,9 +337,9 @@ #it happens for example in next situation #template< typename X> #void ddd(){ typedef typename X::Y YY;} - decls = filter( lambda inst: isinstance(inst, declaration_t) and not inst.parent - , decls.itervalues() ) - patcher.fix_decls( make_flatten( decls ) ) - decls = filter( lambda inst: isinstance( inst, namespace_t ), decls ) + #if I will fail on this bug next time, the right way to fix it may be different + patcher.fix_decls( scanner_.all_declarations(), scanner_.enums() ) + decls = filter( lambda inst: isinstance( inst, namespace_t ) and not inst.parent + , decls.itervalues() ) return ( decls, files.values() ) Modified: pygccxml_dev/unittests/patcher_tester.py =================================================================== --- pygccxml_dev/unittests/patcher_tester.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/unittests/patcher_tester.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -60,8 +60,11 @@ self.failUnless( typedef__func.arguments[0].default_value == u"::typedef_::alias( )" ) if 32 == self.architecture: clone_tree = self.global_ns.free_fun( 'clone_tree' ) - default_value = 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >()' - self.failUnless( default_value == clone_tree.arguments[0].default_value ) + default_values = [ + 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >()' + , 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >((&allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >()))' + ] + self.failUnless( clone_tree.arguments[0].default_value in default_values) class tester_32_t( tester_impl_t ): def __init__(self, *args): Added: pygccxml_dev/unittests/results.txt =================================================================== --- pygccxml_dev/unittests/results.txt (rev 0) +++ pygccxml_dev/unittests/results.txt 2007-04-20 20:22:23 UTC (rev 1011) @@ -0,0 +1,242 @@ +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 15815730 function calls (15569178 primitive calls) in 102.347 CPU seconds + + Ordered by: internal time, call count + List reduced from 424 to 20 due to restriction <20> + + ncalls tottime percall cumtime percall filename:lineno(function) + 1324 8.493 0.006 16.359 0.012 ../pygccxml/parser/patcher.py:115(__find_enum) + 3188314 7.700 0.000 7.700 0.000 ../pygccxml/parser/patcher.py:119(<lambda>) + 735216 7.090 0.000 7.090 0.000 posixpath.py:56(join) + 582283 6.519 0.000 6.894 0.000 posixpath.py:156(islink) + 76466 5.295 0.000 21.655 0.000 posixpath.py:410(realpath) + 271521 3.945 0.000 3.945 0.000 <string>:55(__iter__) + 135760 2.234 0.000 19.078 0.000 ../pygccxml/parser/scanner.py:174(startElement) + 141610 2.018 0.000 2.441 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) + 38689 1.917 0.000 4.648 0.000 ../pygccxml/parser/scanner.py:344(__read_member_function) + 1 1.784 1.784 88.092 88.092 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) + 76466 1.624 0.000 25.001 0.000 ../pygccxml/parser/source_reader.py:304(__produce_full_file) + 76466 1.616 0.000 1.616 0.000 posixpath.py:373(normpath) + 1 1.594 1.594 24.988 24.988 ../pygccxml/parser/etree_scanner.py:45(read) +225592/69633 1.582 0.000 1.835 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) +141499/141100 1.510 0.000 2.789 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 27828/6 1.490 0.000 2.173 0.362 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) + 41683 1.463 0.000 2.122 0.000 ../pygccxml/parser/scanner.py:315(__read_argument) + 76194 1.449 0.000 1.795 0.000 ../pygccxml/parser/scanner.py:215(__read_location) + 90232 1.300 0.000 1.981 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:24(_set_inst) + 1 1.218 1.218 4.453 4.453 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + + +running - done +>Exit code: 0 + + + + + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 12627416 function calls (12380864 primitive calls) in 77.817 CPU seconds + + Ordered by: internal time, call count + List reduced from 423 to 20 due to restriction <20> + + ncalls tottime percall cumtime percall filename:lineno(function) + 735216 6.205 0.000 6.205 0.000 posixpath.py:56(join) + 582283 5.645 0.000 6.005 0.000 posixpath.py:156(islink) + 76466 4.705 0.000 19.188 0.000 posixpath.py:410(realpath) + 271521 3.354 0.000 3.354 0.000 <string>:55(__iter__) + 1324 2.394 0.002 2.534 0.002 ../pygccxml/parser/patcher.py:115(__find_enum) + 135760 1.929 0.000 15.088 0.000 ../pygccxml/parser/scanner.py:174(startElement) + 1 1.704 1.704 63.984 63.984 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) +225592/69633 1.590 0.000 1.846 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) +141499/141100 1.498 0.000 2.742 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 76466 1.486 0.000 1.486 0.000 posixpath.py:373(normpath) + 1 1.451 1.451 20.204 20.204 ../pygccxml/parser/etree_scanner.py:45(read) + 90232 1.219 0.000 1.869 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:24(_set_inst) + 76466 1.195 0.000 21.955 0.000 ../pygccxml/parser/source_reader.py:304(__produce_full_file) + 41683 1.062 0.000 1.892 0.000 ../pygccxml/parser/scanner.py:312(__read_argument) + 76205 1.053 0.000 1.855 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 65791 1.047 0.000 3.838 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 41652 0.981 0.000 1.682 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:61(__link_calldef) + 76466 0.957 0.000 0.957 0.000 posixpath.py:168(exists) + 27828/6 0.954 0.000 1.592 0.265 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) + 557669 0.936 0.000 0.936 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) + + +running - done +>Exit code: 0 + +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 10073090 function calls (9835812 primitive calls) in 58.827 CPU seconds + + Ordered by: internal time, call count + List reduced from 419 to 20 due to restriction <20> + + ncalls tottime percall cumtime percall filename:lineno(function) + 271521 3.735 0.000 3.735 0.000 <string>:55(__iter__) + 1324 2.521 0.002 2.667 0.002 ../pygccxml/parser/patcher.py:101(__find_enum) +225592/69633 2.357 0.000 2.613 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) + 135760 2.218 0.000 16.325 0.000 ../pygccxml/parser/scanner.py:174(startElement) + 141610 1.943 0.000 2.325 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) + 76194 1.807 0.000 2.137 0.000 ../pygccxml/parser/scanner.py:213(__read_location) + 1 1.531 1.531 21.903 21.903 ../pygccxml/parser/etree_scanner.py:45(read) +141499/141100 1.527 0.000 2.830 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 1 1.457 1.457 4.782 4.782 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + 90232 1.205 0.000 1.866 0.000 ../pygccxml/parser/linker.py:24(_set_inst) + 41683 1.123 0.000 1.737 0.000 ../pygccxml/parser/scanner.py:313(__read_argument) + 65791 1.075 0.000 4.162 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 41652 1.012 0.000 1.727 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) + 38526 0.941 0.000 2.268 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) + 76205 0.908 0.000 1.459 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 518982 0.861 0.000 0.861 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) + 76204 0.782 0.000 2.501 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) + 41652 0.728 0.000 2.552 0.000 ../pygccxml/parser/scanner.py:325(__read_calldef) + 516848 0.711 0.000 0.711 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) + 71642 0.678 0.000 2.597 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) + + +running - done +>Exit code: 0 + +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 10583171 function calls (10350530 primitive calls) in 60.270 CPU seconds + + Ordered by: internal time, call count + List reduced from 421 to 20 due to restriction <20> + + ncalls tottime percall cumtime percall filename:lineno(function) + 271521 3.893 0.000 3.893 0.000 <string>:55(__iter__) + 135760 2.191 0.000 16.832 0.000 ../pygccxml/parser/scanner.py:179(startElement) + 141610 2.124 0.000 2.545 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) +225592/69633 1.774 0.000 2.064 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) + 1 1.607 1.607 22.649 22.649 ../pygccxml/parser/etree_scanner.py:45(read) +141499/141100 1.567 0.000 3.062 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 76194 1.555 0.000 1.908 0.000 ../pygccxml/parser/scanner.py:219(__read_location) + 1324 1.546 0.001 2.569 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) + 41683 1.308 0.000 1.938 0.000 ../pygccxml/parser/scanner.py:319(__read_argument) + 90232 1.197 0.000 1.899 0.000 ../pygccxml/parser/linker.py:24(_set_inst) + 1 1.178 1.178 4.614 4.614 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + 65791 1.113 0.000 4.126 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 76205 1.084 0.000 1.084 0.000 ../pygccxml/parser/patcher.py:182(<lambda>) + 608538 1.006 0.000 1.006 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) + 41652 1.000 0.000 1.761 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) + 76205 0.975 0.000 1.488 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 518982 0.934 0.000 0.934 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) + 516848 0.910 0.000 0.910 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) + 76204 0.818 0.000 2.456 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) + 38526 0.812 0.000 2.163 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) + + +running - done +>Exit code: 0 + + +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 31749399 function calls (31051476 primitive calls) in 188.225 CPU seconds + + Ordered by: internal time, call count + List reduced from 421 to 30 due to restriction <30> + + ncalls tottime percall cumtime percall filename:lineno(function) + 814563 12.143 0.000 12.143 0.000 <string>:55(__iter__) + 424830 7.973 0.000 9.177 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) + 407280 7.053 0.000 56.374 0.000 ../pygccxml/parser/scanner.py:179(startElement) +676776/208899 5.302 0.000 6.200 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) + 3 5.219 1.740 74.732 24.911 ../pygccxml/parser/etree_scanner.py:45(read) +424497/423300 5.084 0.000 9.270 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 125049 4.247 0.000 6.629 0.000 ../pygccxml/parser/scanner.py:319(__read_argument) + 3972 4.153 0.001 7.367 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) + 228615 4.025 0.000 5.306 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 124956 4.000 0.000 6.375 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) + 270696 3.940 0.000 6.193 0.000 ../pygccxml/parser/linker.py:24(_set_inst) + 197373 3.522 0.000 13.509 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 228582 3.355 0.000 4.619 0.000 ../pygccxml/parser/scanner.py:219(__read_location) + 1825614 3.128 0.000 3.128 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) + 3 3.087 1.029 14.448 4.816 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + 228612 2.998 0.000 8.169 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) + 1550544 2.991 0.000 2.991 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) + 1556946 2.905 0.000 2.905 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) + 115578 2.626 0.000 6.350 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) + 124956 2.494 0.000 8.618 0.000 ../pygccxml/parser/scanner.py:331(__read_calldef) + 214926 2.125 0.000 8.512 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) + 6 1.954 0.326 9.310 1.552 ../pygccxml/parser/source_reader.py:27(bind_aliases) + 987228 1.940 0.000 1.940 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) + 3 1.873 0.624 138.282 46.094 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) + 3 1.761 0.587 15.909 5.303 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:452(__declarated_types) + 270696 1.729 0.000 29.906 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:265(apply_visitor) + 425985 1.719 0.000 2.409 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:43(_set_access_type) + 116067 1.701 0.000 10.146 0.000 ../pygccxml/parser/scanner.py:348(__read_member_function) + 13914 1.696 0.000 16.956 0.001 ../pygccxml/parser/linker.py:46(__link_members) + 41742/9 1.642 0.000 2.707 0.301 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) + + +running - done +>Exit code: 0 + +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 31520787 function calls (30822864 primitive calls) in 199.769 CPU seconds + + Ordered by: internal time, call count + List reduced from 421 to 30 due to restriction <30> + + ncalls tottime percall cumtime percall filename:lineno(function) + 814563 12.595 0.000 12.595 0.000 <string>:55(__iter__) + 424830 8.190 0.000 9.620 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) + 407280 6.869 0.000 57.260 0.000 ../pygccxml/parser/scanner.py:184(startElement) +424497/423300 5.643 0.000 10.489 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) +676776/208899 5.519 0.000 6.542 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) + 3 5.488 1.829 76.478 25.493 ../pygccxml/parser/etree_scanner.py:45(read) + 3972 4.797 0.001 8.675 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) + 125049 4.328 0.000 6.655 0.000 ../pygccxml/parser/scanner.py:326(__read_argument) + 228615 4.253 0.000 5.794 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 124956 4.168 0.000 6.604 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) + 270696 3.926 0.000 6.478 0.000 ../pygccxml/parser/linker.py:24(_set_inst) + 1825614 3.770 0.000 3.770 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) + 197373 3.757 0.000 13.898 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 228582 3.485 0.000 4.765 0.000 ../pygccxml/parser/scanner.py:224(__read_location) + 1556946 3.162 0.000 3.162 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) + 3 3.091 1.030 14.798 4.933 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + 115578 3.047 0.000 7.004 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) + 228612 2.726 0.000 8.139 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) + 1550544 2.720 0.000 2.720 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) + 124956 2.413 0.000 8.018 0.000 ../pygccxml/parser/scanner.py:338(__read_calldef) + 6 2.260 0.377 10.256 1.709 ../pygccxml/parser/source_reader.py:27(bind_aliases) + 214926 2.179 0.000 8.457 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) + 987228 2.063 0.000 2.063 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) + 3 1.956 0.652 145.544 48.515 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) + 116067 1.946 0.000 10.222 0.000 ../pygccxml/parser/scanner.py:355(__read_member_function) + 3 1.928 0.643 17.163 5.721 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:452(__declarated_types) + 13914 1.902 0.000 17.540 0.001 ../pygccxml/parser/linker.py:46(__link_members) + 425985 1.879 0.000 2.584 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:43(_set_access_type) + 270696 1.799 0.000 30.748 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:265(apply_visitor) + 547467 1.679 0.000 1.679 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:581(_get_declaration) + + +running - done +>Exit code: 0 Modified: pygccxml_dev/unittests/test_performance.py =================================================================== --- pygccxml_dev/unittests/test_performance.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/unittests/test_performance.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -6,8 +6,8 @@ import os import sys import time -import pstats -import cProfile +import hotshot +import hotshot.stats import autoconfig from pygccxml import * @@ -85,8 +85,9 @@ def parse_big_file(): reader = parser.project_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path) ) - reader.read_files([parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'big.xml' ) )]) + reader.read_files([parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'big.xml' ) )]) + reader.read_files([parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'big.xml' ) )]) if __name__ == "__main__": @@ -95,15 +96,19 @@ #~ test_source_on_include_std_dot_hpp() #~ test_project_on_include_std_dot_hpp() print 'running' - cProfile.run('parse_big_file()', 'pygccxml.profile') + prof = hotshot.Profile( 'parser.prof' ) + prof.runcall(parse_big_file ) + stats = hotshot.stats.load("parser.prof") + stats.sort_stats('time', 'calls') + stats.print_stats(30) print 'running - done' - print 'loading file' - pdata = pstats.Stats('pygccxml.profile') - print 'loading file - done' - print 'striping dirs' - pdata.strip_dirs() - print 'striping dirs - done' - print 'sorting stats' - pdata.sort_stats('cumulative', 'time').print_stats(476) - print 'sorting stats - done' + #~ print 'loading file' + #~ pdata = pstats.Stats('pygccxml.profile') + #~ print 'loading file - done' + #~ print 'striping dirs' + #~ pdata.strip_dirs() + #~ print 'striping dirs - done' + #~ print 'sorting stats' + #~ pdata.sort_stats('time').print_stats(476) + #~ print 'sorting stats - done' #pdata.print_callers('find_all_declarations') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2007-04-20 14:58:11
|
Revision: 1010 http://svn.sourceforge.net/pygccxml/?rev=1010&view=rev Author: alex_eisen Date: 2007-04-20 07:58:08 -0700 (Fri, 20 Apr 2007) Log Message: ----------- Work on GUI functionality Modified Paths: -------------- pyplusplus_dev/ide/controllers/controller_main.py pyplusplus_dev/ide/ide.py pyplusplus_dev/ide/views/dialog_macro.py pyplusplus_dev/ide/views/frame_main.py Added Paths: ----------- pyplusplus_dev/ide/model/ProjectFileTemplatate.xml Modified: pyplusplus_dev/ide/controllers/controller_main.py =================================================================== --- pyplusplus_dev/ide/controllers/controller_main.py 2007-04-19 21:50:46 UTC (rev 1009) +++ pyplusplus_dev/ide/controllers/controller_main.py 2007-04-20 14:58:08 UTC (rev 1010) @@ -17,7 +17,21 @@ # Give controller object to the view self._view.set_controller(self) + + def DoRemoveCurInclude(self): + """Remove current selected Include item""" + cur_num = self._view.currentItemInclude + if None == cur_num: + return + self._view.listIncludes.DeleteItem(cur_num) + def DoRemoveCurMacro(self): + """Remove current selected Macro item""" + cur_num = self._view.currentItemMacro + if None == cur_num: + return + self._view.listMacros.DeleteItem(cur_num) + def GenXmlCode(self): """ Generate XML code""" self._appendOutText("Generation of XML code staretd") @@ -44,29 +58,71 @@ self._openFileDlgWithRelatedWxText( self._view.textGccXml, "Choose GccXml executable", "All Files(*)|*") + + def OpenDlgEditCurInclude(self): + """ """ + cur_num = self._view.currentItemInclude + if None == cur_num: + return + start_dir = self._view.listIncludes.GetItemText(cur_num) + dialog = wx.DirDialog(self._view, "Edit include directory", start_dir) + try: + if dialog.ShowModal() == wx.ID_OK: + self._view.listIncludes.DeleteItem(cur_num) + self._view.listIncludes.InsertStringItem( + cur_num, dialog.GetPath()) + finally: + dialog.Destroy() + + def OpenDlgEditCurMacro(self): + """ """ + cur_num = self._view.currentItemMacro + if None == cur_num: + return + macro = self._view.listMacros.GetItemText(cur_num) + dialog = dialog_macro.MacroDialog(self._view, macro) + try: + if dialog.ShowModal() == wx.OK: + self._view.listMacros.DeleteItem(cur_num) + + new_macro = dialog.textMacro.GetLineText(0) + self._view.listMacros.InsertStringItem(cur_num, new_macro) + finally: + dialog.Destroy() def OpenDlgAddInclude(self): """ """ - self._appendOutText("Add inc") dialog = wx.DirDialog(self._view, "Choose include directory", ".") try: if dialog.ShowModal() == wx.ID_OK: + cur_num = self._view.listIncludes.GetItemCount() - self._view.listIncludes.InsertStringItem( - cur_num, dialog.GetPath()) + dir_path = dialog.GetPath() + + # Check weather path is already in list + if not self._checkItemIsInList(dir_path, + self._view.listIncludes): + + self._view.listIncludes.InsertStringItem( + cur_num, dir_path) finally: dialog.Destroy() def OpenDlgAddMacro(self): """ """ dialog = dialog_macro.MacroDialog(self._view) + if dialog.ShowModal() == wx.OK: - cur_num = self._view.listDefines.GetItemCount() - self._view.listDefines.InsertStringItem( - cur_num, dialog.textMacro.GetLineText(0)) + cur_num = self._view.listMacros.GetItemCount() + new_macro = dialog.textMacro.GetLineText(0) + # Check weather macro is already in list + if not self._checkItemIsInList(new_macro, self._view.listMacros): + self._view.listMacros.InsertStringItem(cur_num, new_macro) + + def _openFileDlgWithRelatedWxText(self, related_wx_text, caption_txt="", @@ -82,6 +138,14 @@ finally: dialog.Destroy() + def _checkItemIsInList(self, item, wx_list): + idx = wx_list.FindItem(0, item) + if idx == -1: + return False + else: + return True + + def _appendOutText(self, text, type_of_text = 0): """ append text with different error level""" text_ctrl = self._view.textOutput Modified: pyplusplus_dev/ide/ide.py =================================================================== --- pyplusplus_dev/ide/ide.py 2007-04-19 21:50:46 UTC (rev 1009) +++ pyplusplus_dev/ide/ide.py 2007-04-20 14:58:08 UTC (rev 1010) @@ -14,8 +14,8 @@ from controllers.controller_main import MainController modules ={u'dialog_macro': [0, '', u'views/dialog_macro.py'], - u'main controller': [0, '', u'controllers/main_controller.py'], - u'main view': [1, 'Main frame of ide', u'views/main_frame.py']} + u'main controller': [0, '', u'controllers/controller_main.py'], + u'main view': [1, 'Main frame of ide', u'views/frame_main.py']} class BoaApp(wx.App): def OnInit(self): Added: pyplusplus_dev/ide/model/ProjectFileTemplatate.xml =================================================================== --- pyplusplus_dev/ide/model/ProjectFileTemplatate.xml (rev 0) +++ pyplusplus_dev/ide/model/ProjectFileTemplatate.xml 2007-04-20 14:58:08 UTC (rev 1010) @@ -0,0 +1,10 @@ +<!-- Template file for pyplusplus IDE --> +<pyPPProject> + <gccXmlSettings + headerPath="" + includePathList="[]" + gccXmlPath="" + macroList="[]" + /> + </gccXmlSettings> +</pyPPProject> \ No newline at end of file Modified: pyplusplus_dev/ide/views/dialog_macro.py =================================================================== --- pyplusplus_dev/ide/views/dialog_macro.py 2007-04-19 21:50:46 UTC (rev 1009) +++ pyplusplus_dev/ide/views/dialog_macro.py 2007-04-20 14:58:08 UTC (rev 1010) @@ -15,22 +15,22 @@ def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_MACRODIALOG, name=u'MacroDialog', - parent=prnt, pos=wx.Point(127, 171), size=wx.Size(376, 231), - style=wx.DEFAULT_DIALOG_STYLE, title=u'Enter new Macro') - self.SetClientSize(wx.Size(368, 197)) - self.SetMaxSize(wx.Size(376, 231)) - self.SetMinSize(wx.Size(376, 231)) + parent=prnt, pos=wx.Point(2, 2), size=wx.Size(359, 166), + style=wx.DEFAULT_DIALOG_STYLE, title=u'Enter new macro') + self.SetClientSize(wx.Size(351, 132)) + self.SetMaxSize(wx.Size(-1, -1)) + self.SetMinSize(wx.Size(-1, -1)) self.panelUp = wx.Panel(id=wxID_MACRODIALOGPANELUP, name=u'panelUp', - parent=self, pos=wx.Point(0, -8), size=wx.Size(368, 152), + parent=self, pos=wx.Point(0, 0), size=wx.Size(368, 72), style=wx.TAB_TRAVERSAL) self.panelDown = wx.Panel(id=wxID_MACRODIALOGPANELDOWN, - name=u'panelDown', parent=self, pos=wx.Point(0, 144), - size=wx.Size(368, 74), style=wx.TAB_TRAVERSAL) + name=u'panelDown', parent=self, pos=wx.Point(0, 80), + size=wx.Size(368, 58), style=wx.TAB_TRAVERSAL) self.buttonOk = wx.Button(id=wxID_MACRODIALOGBUTTONOK, label=u'Ok', - name=u'buttonOk', parent=self.panelDown, pos=wx.Point(40, 17), + name=u'buttonOk', parent=self.panelDown, pos=wx.Point(32, 16), size=wx.Size(75, 23), style=0) self.buttonOk.Bind(wx.EVT_BUTTON, self.OnButtonOk, id=wxID_MACRODIALOGBUTTONOK) @@ -42,20 +42,23 @@ id=wxID_MACRODIALOGBUTTONCANCEL) self.staticLine1 = wx.StaticLine(id=wxID_MACRODIALOGSTATICLINE1, - name='staticLine1', parent=self.panelDown, pos=wx.Point(9, 0), - size=wx.Size(343, 2), style=0) + name='staticLine1', parent=self.panelDown, pos=wx.Point(0, 0), + size=wx.Size(359, 2), style=0) self.textMacro = wx.TextCtrl(id=wxID_MACRODIALOGTEXTMACRO, - name=u'textMacro', parent=self.panelUp, pos=wx.Point(32, 40), - size=wx.Size(304, 88), style=wx.TE_MULTILINE, value=u'') + name=u'textMacro', parent=self.panelUp, pos=wx.Point(24, 40), + size=wx.Size(304, 24), style=0, value=u'') self.staticText1 = wx.StaticText(id=wxID_MACRODIALOGSTATICTEXT1, - label=u'Definition of macro (ABS=12)', name='staticText1', - parent=self.panelUp, pos=wx.Point(32, 24), size=wx.Size(140, 13), - style=0) + label=u'Definition of macro (example: max(a,b)=a<b?b:a)', + name='staticText1', parent=self.panelUp, pos=wx.Point(24, 16), + size=wx.Size(241, 13), style=0) - def __init__(self, parent): + def __init__(self, parent, macro=""): self._init_ctrls(parent) + if macro != "": + self.textMacro.SetValue(macro) + def OnButtonOk(self, event): """End modal dialog with True""" Modified: pyplusplus_dev/ide/views/frame_main.py =================================================================== --- pyplusplus_dev/ide/views/frame_main.py 2007-04-19 21:50:46 UTC (rev 1009) +++ pyplusplus_dev/ide/views/frame_main.py 2007-04-20 14:58:08 UTC (rev 1010) @@ -23,41 +23,36 @@ [wxID_MAINFRAMEMENUINCLUDESADDINC, wxID_MAINFRAMEMENUINCLUDESITEMS1, ] = [wx.NewId() for _init_coll_menuIncludes_Items in range(2)] -[wxID_MAINFRAMEMENUDEFINESADDDEF, wxID_MAINFRAMEMENUDEFINESREMOVEDEF, -] = [wx.NewId() for _init_coll_menuDefines_Items in range(2)] +[wxID_MAINFRAMEMENUMACROSADDDEF, wxID_MAINFRAMEMENUMACROSREMOVEDEF, +] = [wx.NewId() for _init_coll_menuMacros_Items in range(2)] [wxID_MAINFRAME, wxID_MAINFRAMEBUTGCCXML, wxID_MAINFRAMEBUTGENCPP, wxID_MAINFRAMEBUTGENPYPP, wxID_MAINFRAMEBUTGENXML, wxID_MAINFRAMEBUTHEADERS, - wxID_MAINFRAMELISTDEFINES, wxID_MAINFRAMELISTINCLUDES, - wxID_MAINFRAMENBSETTINGS, wxID_MAINFRAMENOTEBOOK1, - wxID_MAINFRAMEPANELBUTTONS, wxID_MAINFRAMEPANELCODE, wxID_MAINFRAMEPANELMAIN, - wxID_MAINFRAMEPANELNBSETTINGS, wxID_MAINFRAMEPANELSETTINGS, - wxID_MAINFRAMEPANELSHLOW, wxID_MAINFRAMEPANELSHUP, - wxID_MAINFRAMESPLITTERHORIZONTAL, wxID_MAINFRAMESPLITTERVERTICAL, - wxID_MAINFRAMESTATICTEXT1, wxID_MAINFRAMESTATICTEXT2, - wxID_MAINFRAMESTATICTEXT3, wxID_MAINFRAMESTATICTEXT4, - wxID_MAINFRAMESTATICTEXT5, wxID_MAINFRAMESTATUSBAR, wxID_MAINFRAMETEXTCTRL2, + wxID_MAINFRAMELISTINCLUDES, wxID_MAINFRAMELISTMACROS, wxID_MAINFRAMENBLOW, + wxID_MAINFRAMENBUPLEFT, wxID_MAINFRAMENBUPRIGHT, wxID_MAINFRAMEPANELBUTTONS, + wxID_MAINFRAMEPANELMAIN, wxID_MAINFRAMEPANELNBCODE, + wxID_MAINFRAMEPANELNBSETTINGS, wxID_MAINFRAMEPANELSHLOW, + wxID_MAINFRAMEPANELSHUP, wxID_MAINFRAMEPANELUPLEFT, + wxID_MAINFRAMEPANELUPRIGHT, wxID_MAINFRAMESPLITTERHORIZONTAL, + wxID_MAINFRAMESPLITTERVERTICAL, wxID_MAINFRAMESTATICTEXT1, + wxID_MAINFRAMESTATICTEXT2, wxID_MAINFRAMESTATICTEXT3, + wxID_MAINFRAMESTATICTEXT4, wxID_MAINFRAMESTATUSBAR, wxID_MAINFRAMETEXTCODE, wxID_MAINFRAMETEXTGCCXML, wxID_MAINFRAMETEXTHEADER, wxID_MAINFRAMETEXTOUTPUT, -] = [wx.NewId() for _init_ctrls in range(29)] +] = [wx.NewId() for _init_ctrls in range(30)] class MainFrame(wx.Frame): """ Main frame class. Part of MVC """ - def _init_coll_bsGccXml_Items(self, parent): + def _init_coll_bsHeader_Items(self, parent): # generated method, don't edit - parent.AddWindow(self.staticText2, 0, border=5, - flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT) - parent.AddWindow(self.textGccXml, 1, border=10, - flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM) - parent.AddWindow(self.butGccXml, 0, border=10, + parent.AddWindow(self.staticText1, 0, border=5, + flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) + parent.AddWindow(self.textHeader, 1, border=10, + flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.TOP) + parent.AddWindow(self.butHeaders, 0, border=10, flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL) - def _init_coll_bsMURCompile_Items(self, parent): - # generated method, don't edit - - parent.AddWindow(self.textCtrl2, 1, border=0, flag=wx.EXPAND) - def _init_coll_bsMain_Items(self, parent): # generated method, don't edit @@ -72,22 +67,39 @@ parent.AddWindow(self.listIncludes, 1, border=10, flag=wx.RIGHT | wx.BOTTOM | wx.TOP | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) - def _init_coll_bsHeader_Items(self, parent): + def _init_coll_bsULSettings_Items(self, parent): # generated method, don't edit - parent.AddWindow(self.staticText1, 0, border=5, - flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) - parent.AddWindow(self.textHeader, 1, border=10, - flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.TOP) - parent.AddWindow(self.butHeaders, 0, border=10, + parent.AddSpacer((10, 10), border=0, flag=0) + parent.AddSizer(self.bsHeader, 0, border=5, flag=wx.RIGHT | wx.EXPAND) + parent.AddSizer(self.bsGccXml, 0, border=5, flag=wx.RIGHT | wx.EXPAND) + parent.AddSizer(self.bsIncPath, 3, border=5, flag=wx.RIGHT | wx.EXPAND) + parent.AddSizer(self.bsMacros, 2, border=5, flag=wx.RIGHT | wx.EXPAND) + + def _init_coll_bsGccXml_Items(self, parent): + # generated method, don't edit + + parent.AddWindow(self.staticText2, 0, border=5, + flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT) + parent.AddWindow(self.textGccXml, 1, border=10, + flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM) + parent.AddWindow(self.butGccXml, 0, border=10, flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL) + def _init_coll_bsMacros_Items(self, parent): + # generated method, don't edit + + parent.AddWindow(self.staticText4, 0, border=5, + flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT) + parent.AddWindow(self.listMacros, 1, border=10, + flag=wx.RIGHT | wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) + def _init_coll_bsUpLeft_Items(self, parent): # generated method, don't edit - parent.AddWindow(self.nbSettings, 1, border=0, flag=wx.ALL | wx.EXPAND) + parent.AddWindow(self.nbUpLeft, 1, border=0, flag=wx.ALL | wx.EXPAND) - def _init_coll_bsMURButtons_Items(self, parent): + def _init_coll_bsURButtons_Items(self, parent): # generated method, don't edit parent.AddWindow(self.butGenXml, 0, border=10, @@ -106,33 +118,20 @@ def _init_coll_bsMainLow_Items(self, parent): # generated method, don't edit - parent.AddWindow(self.notebook1, 1, border=0, flag=wx.EXPAND) + parent.AddWindow(self.nbLow, 1, border=0, flag=wx.EXPAND) def _init_coll_bsUpRight_Items(self, parent): # generated method, don't edit - parent.AddWindow(self.staticText5, 0, border=0, flag=0) - parent.AddSizer(self.bsMURCompile, 1, border=4, flag=wx.TOP | wx.EXPAND) - parent.AddWindow(self.panelButtons, 0, border=10, - flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP) + parent.AddWindow(self.nbUpRight, 1, border=0, flag=wx.EXPAND) - def _init_coll_bsMULSettings_Items(self, parent): + def _init_coll_bsURCode_Items(self, parent): # generated method, don't edit - parent.AddSpacer((10, 10), border=0, flag=0) - parent.AddSizer(self.bsHeader, 0, border=5, flag=wx.RIGHT | wx.EXPAND) - parent.AddSizer(self.bsGccXml, 0, border=5, flag=wx.RIGHT | wx.EXPAND) - parent.AddSizer(self.bsIncPath, 0, border=5, flag=wx.RIGHT | wx.EXPAND) - parent.AddSizer(self.bsDefines, 0, border=5, flag=wx.RIGHT | wx.EXPAND) + parent.AddWindow(self.textCode, 1, border=0, flag=wx.EXPAND) + parent.AddWindow(self.panelButtons, 0, border=5, + flag=wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL) - def _init_coll_bsDefines_Items(self, parent): - # generated method, don't edit - - parent.AddWindow(self.staticText4, 0, border=5, - flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT) - parent.AddWindow(self.listDefines, 1, border=10, - flag=wx.RIGHT | wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) - def _init_coll_menuBar_Menus(self, parent): # generated method, don't edit @@ -179,32 +178,38 @@ self.Bind(wx.EVT_MENU, self.OnMenueFileExitMenu, id=wxID_MAINFRAMEMENUEFILEEXIT) - def _init_coll_menuDefines_Items(self, parent): + def _init_coll_menuMacros_Items(self, parent): # generated method, don't edit parent.Append(help=u'Add new define for gcc', - id=wxID_MAINFRAMEMENUDEFINESADDDEF, kind=wx.ITEM_NORMAL, + id=wxID_MAINFRAMEMENUMACROSADDDEF, kind=wx.ITEM_NORMAL, text=u'Add ...') parent.Append(help=u'Remove selected define', - id=wxID_MAINFRAMEMENUDEFINESREMOVEDEF, kind=wx.ITEM_NORMAL, + id=wxID_MAINFRAMEMENUMACROSREMOVEDEF, kind=wx.ITEM_NORMAL, text=u'Remove') - self.Bind(wx.EVT_MENU, self.OnMenueDefinesAddDefine, - id=wxID_MAINFRAMEMENUDEFINESADDDEF) - self.Bind(wx.EVT_MENU, self.OnMenueDefinesRemoveDefine, - id=wxID_MAINFRAMEMENUDEFINESREMOVEDEF) + self.Bind(wx.EVT_MENU, self.OnMenueMacroAddMacro, + id=wxID_MAINFRAMEMENUMACROSADDDEF) + self.Bind(wx.EVT_MENU, self.OnMenueMacrosRemoveMacro, + id=wxID_MAINFRAMEMENUMACROSREMOVEDEF) - def _init_coll_nbSettings_Pages(self, parent): + def _init_coll_nbLow_Pages(self, parent): # generated method, don't edit - parent.AddPage(imageId=-1, page=self.panelNbSettings, select=True, - text=u'Settings') + parent.AddPage(imageId=-1, page=self.textOutput, select=True, + text=u'Output') - def _init_coll_notebook1_Pages(self, parent): + def _init_coll_nbUpRight_Pages(self, parent): # generated method, don't edit - parent.AddPage(imageId=-1, page=self.textOutput, select=True, - text=u'Output') + parent.AddPage(imageId=-1, page=self.panelNbCode, select=True, + text=u'Code') + def _init_coll_nbUpLeft_Pages(self, parent): + # generated method, don't edit + + parent.AddPage(imageId=-1, page=self.panelNbSettings, select=True, + text=u'Settings') + def _init_coll_statusBar_Fields(self, parent): # generated method, don't edit parent.SetFieldsCount(3) @@ -225,42 +230,43 @@ self.bsUpLeft = wx.BoxSizer(orient=wx.VERTICAL) - self.bsUpRight = wx.BoxSizer(orient=wx.VERTICAL) + self.bsULSettings = wx.BoxSizer(orient=wx.VERTICAL) - self.bsMULSettings = wx.BoxSizer(orient=wx.VERTICAL) + self.bsURButtons = wx.BoxSizer(orient=wx.HORIZONTAL) - self.bsMURCompile = wx.BoxSizer(orient=wx.VERTICAL) - - self.bsMURButtons = wx.BoxSizer(orient=wx.HORIZONTAL) - self.bsHeader = wx.BoxSizer(orient=wx.HORIZONTAL) self.bsGccXml = wx.BoxSizer(orient=wx.HORIZONTAL) self.bsIncPath = wx.BoxSizer(orient=wx.HORIZONTAL) - self.bsDefines = wx.BoxSizer(orient=wx.HORIZONTAL) + self.bsMacros = wx.BoxSizer(orient=wx.HORIZONTAL) + self.bsUpRight = wx.BoxSizer(orient=wx.VERTICAL) + + self.bsURCode = wx.BoxSizer(orient=wx.VERTICAL) + self._init_coll_bsMain_Items(self.bsMain) self._init_coll_bsMainUpper_Items(self.bsMainUpper) self._init_coll_bsMainLow_Items(self.bsMainLow) self._init_coll_bsUpLeft_Items(self.bsUpLeft) - self._init_coll_bsUpRight_Items(self.bsUpRight) - self._init_coll_bsMULSettings_Items(self.bsMULSettings) - self._init_coll_bsMURCompile_Items(self.bsMURCompile) - self._init_coll_bsMURButtons_Items(self.bsMURButtons) + self._init_coll_bsULSettings_Items(self.bsULSettings) + self._init_coll_bsURButtons_Items(self.bsURButtons) self._init_coll_bsHeader_Items(self.bsHeader) self._init_coll_bsGccXml_Items(self.bsGccXml) self._init_coll_bsIncPath_Items(self.bsIncPath) - self._init_coll_bsDefines_Items(self.bsDefines) + self._init_coll_bsMacros_Items(self.bsMacros) + self._init_coll_bsUpRight_Items(self.bsUpRight) + self._init_coll_bsURCode_Items(self.bsURCode) self.panelSHUp.SetSizer(self.bsMainUpper) - self.panelSettings.SetSizer(self.bsUpLeft) - self.panelButtons.SetSizer(self.bsMURButtons) + self.panelNbCode.SetSizer(self.bsURCode) + self.panelUpLeft.SetSizer(self.bsUpLeft) + self.panelButtons.SetSizer(self.bsURButtons) self.panelSHLow.SetSizer(self.bsMainLow) self.panelMain.SetSizer(self.bsMain) - self.panelCode.SetSizer(self.bsUpRight) - self.panelNbSettings.SetSizer(self.bsMULSettings) + self.panelUpRight.SetSizer(self.bsUpRight) + self.panelNbSettings.SetSizer(self.bsULSettings) def _init_utils(self): # generated method, don't edit @@ -270,20 +276,20 @@ self.menuIncludes = wx.Menu(title='') - self.menuDefines = wx.Menu(title='') + self.menuMacros = wx.Menu(title='') self._init_coll_menueFile_Items(self.menueFile) self._init_coll_menuBar_Menus(self.menuBar) self._init_coll_menuIncludes_Items(self.menuIncludes) - self._init_coll_menuDefines_Items(self.menuDefines) + self._init_coll_menuMacros_Items(self.menuMacros) def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_MAINFRAME, name=u'MainFrame', - parent=prnt, pos=wx.Point(0, -2), size=wx.Size(851, 620), - style=wx.DEFAULT_FRAME_STYLE, title=u'Py++ Code generator') + parent=prnt, pos=wx.Point(-3, -3), size=wx.Size(800, 600), + style=wx.DEFAULT_FRAME_STYLE, title=u'Py++ IDE') self._init_utils() - self.SetClientSize(wx.Size(843, 586)) + self.SetClientSize(wx.Size(792, 566)) self.SetMenuBar(self.menuBar) self.statusBar = wx.StatusBar(id=wxID_MAINFRAMESTATUSBAR, @@ -292,158 +298,180 @@ self.SetStatusBar(self.statusBar) self.panelMain = wx.Panel(id=wxID_MAINFRAMEPANELMAIN, name=u'panelMain', - parent=self, pos=wx.Point(0, 0), size=wx.Size(843, 543), + parent=self, pos=wx.Point(0, 0), size=wx.Size(792, 523), style=wx.TAB_TRAVERSAL) self.splitterHorizontal = wx.SplitterWindow(id=wxID_MAINFRAMESPLITTERHORIZONTAL, name=u'splitterHorizontal', parent=self.panelMain, pos=wx.Point(5, - 5), size=wx.Size(833, 533), style=0) - self.splitterHorizontal.SetNeedUpdating(False) - self.splitterHorizontal.SetMinimumPaneSize(0) + 5), size=wx.Size(782, 513), style=0) + self.splitterHorizontal.SetMinimumPaneSize(40) self.panelSHUp = wx.Panel(id=wxID_MAINFRAMEPANELSHUP, name=u'panelSHUp', parent=self.splitterHorizontal, pos=wx.Point(0, 0), - size=wx.Size(833, 10), style=wx.TAB_TRAVERSAL) + size=wx.Size(782, 40), style=wx.TAB_TRAVERSAL) self.panelSHLow = wx.Panel(id=wxID_MAINFRAMEPANELSHLOW, name=u'panelSHLow', parent=self.splitterHorizontal, - pos=wx.Point(0, 14), size=wx.Size(833, 519), + pos=wx.Point(0, 44), size=wx.Size(782, 469), style=wx.TAB_TRAVERSAL) self.splitterHorizontal.SplitHorizontally(self.panelSHUp, self.panelSHLow, 300) - self.notebook1 = wx.Notebook(id=wxID_MAINFRAMENOTEBOOK1, - name='notebook1', parent=self.panelSHLow, pos=wx.Point(0, 0), - size=wx.Size(833, 519), style=0) - self.notebook1.SetLabel(u'Label') + self.nbLow = wx.Notebook(id=wxID_MAINFRAMENBLOW, name=u'nbLow', + parent=self.panelSHLow, pos=wx.Point(0, 0), size=wx.Size(782, + 469), style=0) + self.nbLow.SetLabel(u'Label') self.textOutput = wx.TextCtrl(id=wxID_MAINFRAMETEXTOUTPUT, - name=u'textOutput', parent=self.notebook1, pos=wx.Point(0, 0), - size=wx.Size(825, 493), + name=u'textOutput', parent=self.nbLow, pos=wx.Point(0, 0), + size=wx.Size(774, 443), style=wx.TE_RICH | wx.TE_READONLY | wx.TE_MULTILINE, value=u'') self.splitterVertical = wx.SplitterWindow(id=wxID_MAINFRAMESPLITTERVERTICAL, name=u'splitterVertical', parent=self.panelSHUp, pos=wx.Point(0, - 0), size=wx.Size(833, 5), style=wx.SP_3D) - self.splitterVertical.SetNeedUpdating(True) - self.splitterVertical.SetMinimumPaneSize(0) + 0), size=wx.Size(782, 35), style=wx.SP_3D) + self.splitterVertical.SetMinimumPaneSize(40) - self.panelSettings = wx.Panel(id=wxID_MAINFRAMEPANELSETTINGS, - name=u'panelSettings', parent=self.splitterVertical, - pos=wx.Point(0, 0), size=wx.Size(10, 5), style=wx.TAB_TRAVERSAL) + self.panelUpLeft = wx.Panel(id=wxID_MAINFRAMEPANELUPLEFT, + name=u'panelUpLeft', parent=self.splitterVertical, pos=wx.Point(0, + 0), size=wx.Size(40, 35), style=wx.TAB_TRAVERSAL) - self.panelCode = wx.Panel(id=wxID_MAINFRAMEPANELCODE, name=u'panelCode', - parent=self.splitterVertical, pos=wx.Point(14, 0), - size=wx.Size(819, 5), style=wx.TAB_TRAVERSAL) - self.splitterVertical.SplitVertically(self.panelSettings, - self.panelCode, 300) + self.panelUpRight = wx.Panel(id=wxID_MAINFRAMEPANELUPRIGHT, + name=u'panelUpRight', parent=self.splitterVertical, + pos=wx.Point(44, 0), size=wx.Size(738, 35), + style=wx.TAB_TRAVERSAL) + self.splitterVertical.SplitVertically(self.panelUpLeft, + self.panelUpRight, 50) - self.nbSettings = wx.Notebook(id=wxID_MAINFRAMENBSETTINGS, - name=u'nbSettings', parent=self.panelSettings, pos=wx.Point(0, 0), - size=wx.Size(10, 5), style=0) - self.nbSettings.SetLabel(u'Label') - self.nbSettings.SetHelpText(u'') + self.nbUpLeft = wx.Notebook(id=wxID_MAINFRAMENBUPLEFT, name=u'nbUpLeft', + parent=self.panelUpLeft, pos=wx.Point(0, 0), size=wx.Size(40, 35), + style=0) + self.nbUpLeft.SetLabel(u'Label') + self.nbUpLeft.SetHelpText(u'') + self.nbUpRight = wx.Notebook(id=wxID_MAINFRAMENBUPRIGHT, + name=u'nbUpRight', parent=self.panelUpRight, pos=wx.Point(0, 0), + size=wx.Size(738, 35), style=0) + self.panelNbSettings = wx.Panel(id=wxID_MAINFRAMEPANELNBSETTINGS, - name=u'panelNbSettings', parent=self.nbSettings, pos=wx.Point(0, - 0), size=wx.Size(2, 0), style=wx.TAB_TRAVERSAL) + name=u'panelNbSettings', parent=self.nbUpLeft, pos=wx.Point(0, 0), + size=wx.Size(32, 9), style=wx.TAB_TRAVERSAL) self.panelNbSettings.Show(True) self.panelNbSettings.SetMinSize(wx.Size(100, 100)) - self.textCtrl2 = wx.TextCtrl(id=wxID_MAINFRAMETEXTCTRL2, - name='textCtrl2', parent=self.panelCode, pos=wx.Point(0, 17), - size=wx.Size(819, 0), style=wx.TE_MULTILINE, value=u'') + self.panelNbCode = wx.Panel(id=wxID_MAINFRAMEPANELNBCODE, + name=u'panelNbCode', parent=self.nbUpRight, pos=wx.Point(0, 0), + size=wx.Size(730, 9), style=wx.TAB_TRAVERSAL) + self.textCode = wx.TextCtrl(id=wxID_MAINFRAMETEXTCODE, name=u'textCode', + parent=self.panelNbCode, pos=wx.Point(0, 0), size=wx.Size(730, 0), + style=wx.TE_READONLY | wx.TE_MULTILINE, value=u'') + self.textCode.SetToolTipString(u'textCtrl2') + self.panelButtons = wx.Panel(id=wxID_MAINFRAMEPANELBUTTONS, - name=u'panelButtons', parent=self.panelCode, pos=wx.Point(166, - -18), size=wx.Size(486, 23), style=wx.TAB_TRAVERSAL) + name=u'panelButtons', parent=self.panelNbCode, pos=wx.Point(156, + -20), size=wx.Size(418, 24), style=wx.TAB_TRAVERSAL) self.butGenXml = wx.Button(id=wxID_MAINFRAMEBUTGENXML, label=u'Generate XML code', name=u'butGenXml', - parent=self.panelButtons, pos=wx.Point(10, 0), size=wx.Size(140, + parent=self.panelButtons, pos=wx.Point(10, 0), size=wx.Size(120, 23), style=0) self.butGenXml.Bind(wx.EVT_BUTTON, self.OnButGenXmlButton, id=wxID_MAINFRAMEBUTGENXML) self.butGenCpp = wx.Button(id=wxID_MAINFRAMEBUTGENCPP, label=u'Generate C++ code', name=u'butGenCpp', - parent=self.panelButtons, pos=wx.Point(170, 0), size=wx.Size(142, - 23), style=0) + parent=self.panelButtons, pos=wx.Point(150, 0), size=wx.Size(120, + 24), style=0) self.butGenCpp.Bind(wx.EVT_BUTTON, self.OnButGenCppButton, id=wxID_MAINFRAMEBUTGENCPP) self.butGenPyPP = wx.Button(id=wxID_MAINFRAMEBUTGENPYPP, label=u'Generate Py++ code', name=u'butGenPyPP', - parent=self.panelButtons, pos=wx.Point(332, 0), size=wx.Size(144, + parent=self.panelButtons, pos=wx.Point(290, 0), size=wx.Size(118, 23), style=0) self.butGenPyPP.Bind(wx.EVT_BUTTON, self.OnButGenPyPPButton, id=wxID_MAINFRAMEBUTGENPYPP) self.textHeader = wx.TextCtrl(id=wxID_MAINFRAMETEXTHEADER, name=u'textHeader', parent=self.panelNbSettings, pos=wx.Point(56, - 20), size=wx.Size(0, 21), style=0, value=u'') + 20), size=wx.Size(0, 21), style=wx.TE_READONLY, value=u'') self.butHeaders = wx.Button(id=wxID_MAINFRAMEBUTHEADERS, label=u'...', - name=u'butHeaders', parent=self.panelNbSettings, pos=wx.Point(-38, + name=u'butHeaders', parent=self.panelNbSettings, pos=wx.Point(-11, 19), size=wx.Size(28, 23), style=0) self.butHeaders.Bind(wx.EVT_BUTTON, self.OnButHeadersButton, id=wxID_MAINFRAMEBUTHEADERS) + self.textGccXml = wx.TextCtrl(id=wxID_MAINFRAMETEXTGCCXML, + name=u'textGccXml', parent=self.panelNbSettings, pos=wx.Point(56, + 61), size=wx.Size(0, 21), style=wx.TE_READONLY, value=u'') + self.staticText1 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT1, label=u'Header\nFile', name='staticText1', parent=self.panelNbSettings, pos=wx.Point(5, 15), size=wx.Size(51, 30), style=wx.ALIGN_CENTRE) + self.staticText4 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT4, + label=u'Macros', name='staticText4', parent=self.panelNbSettings, + pos=wx.Point(5, 31), size=wx.Size(51, 25), style=wx.ALIGN_CENTRE) + self.staticText2 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT2, label=u'GccXml', name='staticText2', parent=self.panelNbSettings, pos=wx.Point(5, 60), size=wx.Size(51, 23), style=wx.ALIGN_CENTRE) - self.textGccXml = wx.TextCtrl(id=wxID_MAINFRAMETEXTGCCXML, - name=u'textGccXml', parent=self.panelNbSettings, pos=wx.Point(56, - 61), size=wx.Size(0, 21), style=0, value=u'') - self.butGccXml = wx.Button(id=wxID_MAINFRAMEBUTGCCXML, label=u'...', - name=u'butGccXml', parent=self.panelNbSettings, pos=wx.Point(-38, + name=u'butGccXml', parent=self.panelNbSettings, pos=wx.Point(-11, 60), size=wx.Size(28, 23), style=0) self.butGccXml.Bind(wx.EVT_BUTTON, self.OnButGccXmlButton, id=wxID_MAINFRAMEBUTGCCXML) self.staticText3 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT3, label=u'Include\nPath', name='staticText3', - parent=self.panelNbSettings, pos=wx.Point(5, 116), - size=wx.Size(51, 37), style=wx.ALIGN_CENTRE) + parent=self.panelNbSettings, pos=wx.Point(5, 74), size=wx.Size(51, + 37), style=wx.ALIGN_CENTRE) self.listIncludes = wx.ListCtrl(id=wxID_MAINFRAMELISTINCLUDES, name=u'listIncludes', parent=self.panelNbSettings, - pos=wx.Point(56, 102), size=wx.Size(0, 66), + pos=wx.Point(56, 102), size=wx.Size(0, 0), style=wx.LC_HRULES | wx.LC_NO_HEADER | wx.LC_REPORT) self.listIncludes.Bind(wx.EVT_RIGHT_DOWN, self.OnListIncludesRightDown) self.listIncludes.Bind(wx.EVT_SIZE, self.OnListIncludesSize) + self.listIncludes.Bind(wx.EVT_LEFT_DCLICK, + self.OnListIncludesLeftDclick) + self.listIncludes.Bind(wx.EVT_LIST_ITEM_SELECTED, + self.OnListIncludesListItemSelected, + id=wxID_MAINFRAMELISTINCLUDES) + self.listIncludes.Bind(wx.EVT_LIST_ITEM_DESELECTED, + self.OnListIncludesListItemDeselected, + id=wxID_MAINFRAMELISTINCLUDES) - self.staticText4 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT4, - label=u'Defines', name='staticText4', parent=self.panelNbSettings, - pos=wx.Point(5, 209), size=wx.Size(51, 25), - style=wx.ALIGN_CENTRE) - - self.listDefines = wx.ListCtrl(id=wxID_MAINFRAMELISTDEFINES, - name=u'listDefines', parent=self.panelNbSettings, pos=wx.Point(56, - 188), size=wx.Size(0, 68), + self.listMacros = wx.ListCtrl(id=wxID_MAINFRAMELISTMACROS, + name=u'listMacros', parent=self.panelNbSettings, pos=wx.Point(56, + 53), size=wx.Size(0, 0), style=wx.LC_HRULES | wx.LC_NO_HEADER | wx.LC_REPORT) - self.listDefines.Bind(wx.EVT_RIGHT_DOWN, self.OnListDefinesRightDown) - self.listDefines.Bind(wx.EVT_SIZE, self.OnListDefinesSize) + self.listMacros.Bind(wx.EVT_RIGHT_DOWN, self.OnListMacrosRightDown) + self.listMacros.Bind(wx.EVT_SIZE, self.OnListMacrosSize) + self.listMacros.Bind(wx.EVT_LEFT_DCLICK, self.OnListMacrosLeftDclick) + self.listMacros.Bind(wx.EVT_LIST_ITEM_SELECTED, + self.OnListMacrosListItemSelected, id=wxID_MAINFRAMELISTMACROS) + self.listMacros.Bind(wx.EVT_LIST_ITEM_DESELECTED, + self.OnListMacrosListItemDeselected, id=wxID_MAINFRAMELISTMACROS) - self.staticText5 = wx.StaticText(id=wxID_MAINFRAMESTATICTEXT5, - label=u'Code', name='staticText5', parent=self.panelCode, - pos=wx.Point(0, 0), size=wx.Size(25, 13), style=0) + self._init_coll_nbLow_Pages(self.nbLow) + self._init_coll_nbUpLeft_Pages(self.nbUpLeft) + self._init_coll_nbUpRight_Pages(self.nbUpRight) - self._init_coll_notebook1_Pages(self.notebook1) - self._init_coll_nbSettings_Pages(self.nbSettings) - self._init_sizers() def __init__(self, parent): + + self.currentItemInclude = None + self.currentItemMacro = None + self._init_ctrls(parent) self._setup_ide_ctrls() + self.splitterVertical.SetSashPosition(300, True) self.SetSize((self.GetSize()[0]+1,self.GetSize()[1]+1)) def OnMenueFileNewMenu(self, event): @@ -467,8 +495,8 @@ def OnListIncludesRightDown(self, event): self.PopupMenu(self.menuIncludes) - def OnListDefinesRightDown(self, event): - self.PopupMenu(self.menuDefines) + def OnListMacrosRightDown(self, event): + self.PopupMenu(self.menuMacros) def OnButGenXmlButton(self, event): self._controller.GenXmlCode() @@ -496,7 +524,7 @@ def _setup_ide_ctrls(self): """Do ide related settings in ctrls""" list_inc = self.listIncludes - list_def = self.listDefines + list_def = self.listMacros # Init list controls for list_ctrl in (list_inc, list_def): @@ -508,9 +536,9 @@ list_ctrl.SetColumnWidth(0, list_ctrl.GetSize().GetWidth() - 30 ) event.Skip() - def OnListDefinesSize(self, event): - """Handle resize of listDefines""" - list_ctrl = self.listDefines + def OnListMacrosSize(self, event): + """Handle resize of listMacros""" + list_ctrl = self.listMacros list_ctrl.SetColumnWidth(0, list_ctrl.GetSize().GetWidth() - 30 ) event.Skip() @@ -519,15 +547,41 @@ event.Skip() def OnMenueIncludesRemove(self, event): + self._controller.DoRemoveCurInclude() event.Skip() - def OnMenueDefinesAddDefine(self, event): + def OnMenueMacroAddMacro(self, event): self._controller.OpenDlgAddMacro() event.Skip() - def OnMenueDefinesRemoveDefine(self, event): + def OnMenueMacrosRemoveMacro(self, event): + self._controller.DoRemoveCurMacro() event.Skip() + def OnListIncludesLeftDclick(self, event): + self._controller.OpenDlgEditCurInclude() + event.Skip() + + def OnListMacrosLeftDclick(self, event): + self._controller.OpenDlgEditCurMacro() + event.Skip() + + def OnListIncludesListItemSelected(self, event): + self.currentItemInclude = event.m_itemIndex + event.Skip() + + def OnListMacrosListItemSelected(self, event): + self.currentItemMacro = event.m_itemIndex + event.Skip() + + def OnListIncludesListItemDeselected(self, event): + self.currentItemInclude = None + event.Skip() + + def OnListMacrosListItemDeselected(self, event): + self.currentItemMacro = None + event.Skip() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-19 21:50:47
|
Revision: 1009 http://svn.sourceforge.net/pygccxml/?rev=1009&view=rev Author: roman_yakovenko Date: 2007-04-19 14:50:46 -0700 (Thu, 19 Apr 2007) Log Message: ----------- another performance optimization - on file 31Mb the number of functions calls was reduced from 15815730 to 10073090 and it is not the limit Modified Paths: -------------- pygccxml_dev/pygccxml/parser/patcher.py pygccxml_dev/pygccxml/parser/source_reader.py Modified: pygccxml_dev/pygccxml/parser/patcher.py =================================================================== --- pygccxml_dev/pygccxml/parser/patcher.py 2007-04-19 21:13:19 UTC (rev 1008) +++ pygccxml_dev/pygccxml/parser/patcher.py 2007-04-19 21:50:46 UTC (rev 1009) @@ -6,33 +6,19 @@ from pygccxml import utils from pygccxml import declarations -class patcher_base_t(object): - def __init__( self, decls ): + +class default_argument_patcher_t( object ): + def __init__( self ): object.__init__( self ) - self.__decls = decls + + def __call__(self, decl): + for arg in decl.arguments: + if not arg.default_value: + continue + fixer = self.__find_fixer( decl, arg ) + if fixer: + arg.default_value = fixer( decl, arg ) - def _get_decls(self): - return self.__decls - decls = property( _get_decls ) - - def patch_it(self): - raise NotImplementedError() - -class default_argument_patcher_t( patcher_base_t ): - def __init__( self, decls ): - patcher_base_t.__init__( self, decls ) - - def patch_it(self): - for decl in declarations.make_flatten( self.decls ): - if not isinstance( decl, declarations.calldef_t ): - continue - for arg in decl.arguments: - if not arg.default_value: - continue - fixer = self.__find_fixer( decl, arg ) - if fixer: - arg.default_value = fixer( decl, arg ) - def __find_fixer(self, func, arg): if not arg.default_value: return False @@ -116,11 +102,10 @@ #this algorithm could be improved: it could take into account #1. unnamed namespaced #2. location within files - enums = filter( lambda decl: isinstance( decl, declarations.enumeration_t ) - , scope.declarations ) - for enum_decl in enums: - if enum_decl.has_value_name( default_value ): - return enum_decl + enumeration_t = declarations.enumeration_t + for decl in scope.declarations: + if isinstance( decl, enumeration_t ) and decl.has_value_name( default_value ): + return decl return None def __is_double_call( self, func, arg ): @@ -182,20 +167,21 @@ return call_invocation.join( f_q_name, args ) -class fix_casting_operator_name_patcher_t( patcher_base_t ): - def __init__( self, decls ): - patcher_base_t.__init__( self, decls ) +class casting_operator_patcher_t( object ): + def __init__( self ): + object.__init__( self ) - def patch_it(self): - for decl in declarations.make_flatten( self.decls ): - if not isinstance( decl, declarations.casting_operator_t): - continue - decl.name = 'operator ' + decl.return_type.decl_string + def __call__(self, decl): + decl.name = 'operator ' + decl.return_type.decl_string -def patch_it(decls): - patcher = default_argument_patcher_t( decls ) - patcher.patch_it() - patcher2 = fix_casting_operator_name_patcher_t( decls ) - patcher2.patch_it() - return patcher.decls +_default_arg_patcher_ = default_argument_patcher_t() +_casting_oper_patcher_ = casting_operator_patcher_t() + +def fix_decls(decls): + #decls should be flat list of all declarations, you want to apply patch on + for decl in decls: + if isinstance( decl, declarations.calldef_t ): + _default_arg_patcher_( decl ) + if isinstance( decl, declarations.casting_operator_t): + _casting_oper_patcher_( decl ) Modified: pygccxml_dev/pygccxml/parser/source_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-19 21:13:19 UTC (rev 1008) +++ pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-19 21:50:46 UTC (rev 1009) @@ -318,14 +318,14 @@ decls = scanner_.declarations() types = scanner_.types() files = {} - for file_id, file_path in scanner_.files().items(): + for file_id, file_path in scanner_.files().iteritems(): files[file_id] = self.__produce_full_file(file_path) linker_ = linker.linker_t( decls=decls , types=types , access=scanner_.access() , membership=scanner_.members() , files=files ) - for type_ in list( types.itervalues() ): + for type_ in types.values(): #I need this copy because internaly linker change types collection linker_.instance = type_ apply_visitor( linker_, type_ ) @@ -333,16 +333,13 @@ linker_.instance = decl apply_visitor( linker_, decl ) bind_aliases( decls.itervalues() ) - decls = filter( lambda inst: isinstance(inst, declaration_t) and not inst.parent, decls.itervalues() ) #some times gccxml report typedefs defined in no namespace #it happens for example in next situation #template< typename X> - #void ddd(){ typedef typename X::Y YY;} + #void ddd(){ typedef typename X::Y YY;} + decls = filter( lambda inst: isinstance(inst, declaration_t) and not inst.parent + , decls.itervalues() ) + patcher.fix_decls( make_flatten( decls ) ) decls = filter( lambda inst: isinstance( inst, namespace_t ), decls ) - decls = patcher.patch_it( decls ) - decls_all = make_flatten( decls ) - for decl in decls_all: - if decl.location: - decl.location.file_name = self.__produce_full_file( decl.location.file_name ) return ( decls, files.values() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |