[pygccxml-commit] SF.net SVN: pygccxml:[1571] ui/web
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2009-01-14 13:20:21
|
Revision: 1571
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1571&view=rev
Author: roman_yakovenko
Date: 2009-01-14 13:20:11 +0000 (Wed, 14 Jan 2009)
Log Message:
-----------
web ui - main success scenarios work!
Modified Paths:
--------------
ui/web/code_generator.py
ui/web/form_processor.py
ui/web/static/generator.css
ui/web/templates/generator_tmpl.html
Modified: ui/web/code_generator.py
===================================================================
--- ui/web/code_generator.py 2009-01-14 09:53:39 UTC (rev 1570)
+++ ui/web/code_generator.py 2009-01-14 13:20:11 UTC (rev 1571)
@@ -4,6 +4,7 @@
from pyplusplus import _logging_
from pygccxml import declarations
from pyplusplus import module_builder
+from pyplusplus.module_builder import ctypes_module_builder_t
import xml.sax.saxutils
class manager_t:
@@ -36,10 +37,6 @@
user_msg.append( str( error ) )
return '', '\n'.join( user_msg )
-
- def generate_pypp_code( self, source_code ):
- return "import pyplusplus"
-
def generate_bpl_code( self, file_configuration ):
try:
_logging_.loggers.make_inmemory()
@@ -61,6 +58,26 @@
user_msg.append( str( error ) )
return '', '\n'.join( user_msg )
+ def generate_ctypes_code( self, file_configuration, symbols_file ):
+ try:
+ _logging_.loggers.make_inmemory()
+ mb = ctypes_module_builder_t( [ file_configuration ], symbols_file, config.gccxml )
+ mb.build_code_creator( symbols_file )
+ code = mb.code_creator.create()
+ code = code.replace( '\n\r', '\n' )
+ code = code.replace( '\r\n', '\n' )
+ warnings = _logging_.loggers.stream.getvalue()
+ _logging_.loggers.stream.close()
+ return code, warnings
+ except Exception, error:
+ user_msg = [ 'Error occured during code generation process!' ]
+ user_msg.append( 'Error:' )
+ user_msg.append( str( error ) )
+ return '', '\n'.join( user_msg )
+
+
+
+
if __name__ == '__main__':
m = manager_t()
m.generate_bpl_code( 'int do_smth( int &);int do_smth( int, int);' )
Modified: ui/web/form_processor.py
===================================================================
--- ui/web/form_processor.py 2009-01-14 09:53:39 UTC (rev 1570)
+++ ui/web/form_processor.py 2009-01-14 13:20:11 UTC (rev 1571)
@@ -10,8 +10,8 @@
self.__handlers = {
"VIEW_XML" : self.on_view_xml
, "VIEW_DECLS" : self.on_view_decls
- , "GENERATE_BP_CODE" : self.on_generate_bp_code
- , "GENERATE_BP_PYPP_CODE" : self.on_generate_bp_pypp_code
+ , "GENERATE_BP_CODE" : self.on_generate_bpl_code
+ , "GENERATE_BP_PYPP_CODE" : self.on_generate_bpl_pypp_code
, "GENERATE_CTYPES_CODE" : self.on_generate_ctypes_code
, "GENERATE_CTYPES_PYPP_CODE" : self.on_generate_ctypes_pypp_code
}
@@ -35,18 +35,21 @@
decls_tree, warnings = self.__code_generator.show_declarations( fc )
return decls_tree, warnings
- def on_generate_bp_code( self ):
- fc = self.__create_fc( 'BP' )
+ def on_generate_bpl_code( self ):
+ fc = self.__create_fc( 'BPL' )
code, warnings = self.__code_generator.generate_bpl_code( fc )
return code, warnings
- def on_generate_bp_pypp_code( self ):
+ def on_generate_bpl_pypp_code( self ):
w = wizard.wizard_t()
- code = w.create_bpl_code( config.gccxml, self.__create_fc( 'BP' ) )
+ code = w.create_bpl_code( config.gccxml, self.__create_fc( 'BPL' ) )
return code, ''
def on_generate_ctypes_code( self ):
- pass
+ fc = parser.create_source_fc( self.__input[ "CTYPES_FILE_NAME" ] )
+ symbols_file = self.__input[ "CTYPES_SHLIB_FILE_NAME" ]
+ code, warnings = self.__code_generator.generate_ctypes_code( fc, symbols_file )
+ return code, warnings
def on_generate_ctypes_pypp_code( self ):
pass
Modified: ui/web/static/generator.css
===================================================================
--- ui/web/static/generator.css 2009-01-14 09:53:39 UTC (rev 1570)
+++ ui/web/static/generator.css 2009-01-14 13:20:11 UTC (rev 1571)
@@ -17,15 +17,16 @@
}
textarea{
- margin-top: 3px;
- margin-right: 5px;
- margin-left: 5px;
- margin-bottom: 3px;
+ margin-top: 2mm;
+ margin-right: 2mm;
+ margin-left: 2mm;
+ margin-bottom: 2mm;
}
input{
- margin-top: 5px;
- margin-right: 5px;
- margin-left: 5px;
- margin-bottom: 5px;
+ margin-top: 2mm;
+ margin-right: 2mm;
+ margin-left: 2mm;
+ margin-bottom: 2mm;
}
+
Modified: ui/web/templates/generator_tmpl.html
===================================================================
--- ui/web/templates/generator_tmpl.html 2009-01-14 09:53:39 UTC (rev 1570)
+++ ui/web/templates/generator_tmpl.html 2009-01-14 13:20:11 UTC (rev 1571)
@@ -11,23 +11,23 @@
</head>
<body>
<h2>pygccxml & py++ demo</h2>
- <form action="/generated.html" method="post" name="CODE_GENERATOR_FORM">
+ <form action="/generated.html" method="post">
<p>In the following tabs you can configurate GCC-XML compiler. It is not a must</p>
<div class="tabber">
<div class="tabbertab">
<h2>Include directories</h2>
<p>List include directories( each directory on the new line ):</p>
- <textarea name="COMPILER_INCLUDE_DIRECTORIES" rows="5" cols="80" style="margin-left: 5mm" ></textarea>
+ <textarea name="COMPILER_INCLUDE_DIRECTORIES" rows="5" cols="80"></textarea>
</div>
<div class="tabbertab">
<h2>Preprocessor definitions</h2>
<p>Configure preprocessor ( define -D"HAS_XYZ=1" or undefine -U"_DEBUG" ):</p>
- <textarea name="COMPILER_PREPROCESSOR_DEFINITIONS" rows="5" cols="80" style="margin-left: 5mm" ></textarea>
+ <textarea name="COMPILER_PREPROCESSOR_DEFINITIONS" rows="5" cols="80"></textarea>
</div>
<div class="tabbertab">
<h2>Advance</h2>
<p>Define GCC-XML command line arguments:</p>
- <textarea name="COMPILER_CMD_ARGS" rows="5" cols="80" style="margin-left: 5mm"></textarea>
+ <textarea name="COMPILER_CMD_ARGS" rows="5" cols="80" ></textarea>
</div>
</div>
<p>Add some text that describes purpose of the "Text" and "File"</p>
@@ -36,9 +36,9 @@
<h2>pygccxml demonstration</h2>
<p></p>
<input type="radio" name="GCCXML_TAKE_CODE_FROM" value="file" checked="checked" />Header file:<br/>
- <input type="text" name="GCCXML_FILE_NAME" size="80" style="margin-left: 5mm" /><br />
+ <input type="text" name="GCCXML_FILE_NAME" style="min-width:93%;" /><br />
<input type="radio" name="GCCXML_TAKE_CODE_FROM" value="text"/>Code:<br/>
- <textarea name="GCCXML_SOURCE_CODE" rows="15" cols="80" style="margin-left: 5mm"></textarea>
+ <textarea name="GCCXML_SOURCE_CODE" rows="15" cols="80" ></textarea>
<br/>
<hr />
<input type="submit" name="VIEW_XML" value="View XML" />
@@ -48,10 +48,10 @@
<div class="tabbertab">
<h2>Boost.Python code generator</h2>
<p></p>
- <input type="radio" name="BP_TAKE_CODE_FROM" value="file" checked="checked" />Header file:<br/>
- <input type="text" name="BP_FILE_NAME" size="80" style="margin-left: 5mm"
- <input type="radio" name="BP_TAKE_CODE_FROM" value="text"/>Code:<br/>
- <textarea name="BP_SOURCE_CODE" rows="15" cols="80" style="margin-left: 5mm"></textarea>
+ <input type="radio" name="BPL_TAKE_CODE_FROM" value="file" checked="checked" />Header file:<br/>
+ <input type="text" name="BPL_FILE_NAME" style="min-width:93%;"/><br/>
+ <input type="radio" name="BPL_TAKE_CODE_FROM" value="text"/>Code:<br/>
+ <textarea name="BPL_SOURCE_CODE" rows="15" cols="80" ></textarea>
<br/>
<hr />
<input type="submit" name="GENERATE_BP_CODE" value="Generate code" />
@@ -62,13 +62,14 @@
<h2>ctypes code generator</h2>
<p></p>
<a>Dynamic/shared library path:</a>
- <input type="text" name="CTYPES_SHLIB_FILE_NAME" size="80" style="margin-left: 5mm" /><br/>
- <input type="radio" name="CTYPES_TAKE_CODE_FROM" value="file" checked="checked" />Header file:<br/>
- <input type="text" name="CTYPES_FILE_NAME" size="80" style="margin-left: 5mm" /><br/>
- <input type="radio" name="CTYPES_TAKE_CODE_FROM" value="text"/>Code:<br/>
- <textarea name="CTYPES_SOURCE_CODE" rows="15" cols="80" style="margin-left: 5mm"></textarea>
- <br/>
- <hr />
+ <input type="text" name="CTYPES_SHLIB_FILE_NAME" style="min-width:93%;" /><br/>
+ <!--input type="radio" name="CTYPES_TAKE_CODE_FROM" value="file" checked="checked" />Header file:<br/-->
+ <a>Header file:</a>
+ <input type="text" name="CTYPES_FILE_NAME" style="min-width:93%;" /><br/>
+ <!--input type="radio" name="CTYPES_TAKE_CODE_FROM" value="text"/>Code:<br/-->
+ <!--textarea name="CTYPES_SOURCE_CODE" rows="15" cols="80" ></textarea-->
+ <!--br/-->
+ <hr/>
<input type="submit" name="GENERATE_CTYPES_CODE" value="Generate code" />
<a></a>
<input type="submit" name="GENERATE_CTYPES_PYPP_CODE" value="Generate Py++ code" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|