From: <baz...@us...> - 2008-02-23 17:55:17
|
Revision: 8085 http://armagetronad.svn.sourceforge.net/armagetronad/?rev=8085&view=rev Author: bazaarmagetron Date: 2008-02-23 09:55:22 -0800 (Sat, 23 Feb 2008) Log Message: ----------- Manuel Moos: Added DoFile and DoString commands to State. Modified Paths: -------------- clio/trunk/clio/clio/helptest.hpp clio/trunk/clio/clio/state.cpp clio/trunk/clio/clio/state.hpp Property Changed: ---------------- clio/trunk/clio/ Property changes on: clio/trunk/clio ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-02-23 16:29:16.891000032 +0100 committer: Manuel Moos <z-...@us...> properties: branch-nick: clio + timestamp: 2008-02-23 18:45:24.611999989 +0100 committer: Manuel Moos <z-...@us...> properties: branch-nick: clio Name: bzr:file-ids - doc/design.t2t.in design.t2t.in-20080223152902-xoogd1lx2zt8p32k-3 doc/proto.t2t.in proto.t2t.in-20080223152902-xoogd1lx2zt8p32k-5 doc/about.t2t.in about.t2t.in-20080223152902-xoogd1lx2zt8p32k-1 doc/build.t2t.in build.t2t.in-20080223152902-xoogd1lx2zt8p32k-2 + Name: bzr:revision-id:v3-list-QlpoOTFBWSZTWZvbKhsAAAdRgAAQABK6798QIABURMgAAaeoNT1TxT1DQbKaeobXKiyAmlWT7Y5MkdJOtXDtB7w7DOGFBHiOBxaUIu7HQyyQSvxdyRThQkJvbKhs - 4 z-...@us...-20080222202821-mkuiwckx41jof2gj 5 z-...@us...-20080222202957-htiysaaxkiroqd7e 6 z-...@us...-20080222211806-jc50b77qlgn2dp8j 7 z-...@us...-20080222215601-p8y78c77ncvq5eb1 8 z-...@us...-20080222223809-mmh9wh6yzrdm7oa1 9 z-...@us...-20080222232123-uhnuqd9db0p27rkf 10 z-...@us...-20080222232154-k64q4ee9zuq5r2jp 11 z-...@us...-20080222234236-ny0hc8lwybz73rv6 12 z-...@us...-20080223000039-566psft2c96236kw 13 z-...@us...-20080223000530-4mtket15l6oeo1ju 14 z-...@us...-20080223001030-5t86d3u3bidpoq6r 15 z-...@us...-20080223002857-qvx8z72tmsoguku0 16 z-...@us...-20080223004917-abqn3vdfqb1euyzc 17 z-...@us...-20080223010025-h0nul9yntjvutdbq 18 z-...@us...-20080223013357-1nzhrjwjr4g0h7g9 19 z-...@us...-20080223015240-btmt95d1vvlip4gl 20 z-...@us...-20080223124731-dlwuagon76gq2o3g 21 z-...@us...-20080223133015-0hjqyrki59ydwdcv 22 z-...@us...-20080223135113-icwd4g99yev9n0u2 23 z-...@us...-20080223152916-8rm942q1rmjlueca + 4 z-...@us...-20080222202821-mkuiwckx41jof2gj 5 z-...@us...-20080222202957-htiysaaxkiroqd7e 6 z-...@us...-20080222211806-jc50b77qlgn2dp8j 7 z-...@us...-20080222215601-p8y78c77ncvq5eb1 8 z-...@us...-20080222223809-mmh9wh6yzrdm7oa1 9 z-...@us...-20080222232123-uhnuqd9db0p27rkf 10 z-...@us...-20080222232154-k64q4ee9zuq5r2jp 11 z-...@us...-20080222234236-ny0hc8lwybz73rv6 12 z-...@us...-20080223000039-566psft2c96236kw 13 z-...@us...-20080223000530-4mtket15l6oeo1ju 14 z-...@us...-20080223001030-5t86d3u3bidpoq6r 15 z-...@us...-20080223002857-qvx8z72tmsoguku0 16 z-...@us...-20080223004917-abqn3vdfqb1euyzc 17 z-...@us...-20080223010025-h0nul9yntjvutdbq 18 z-...@us...-20080223013357-1nzhrjwjr4g0h7g9 19 z-...@us...-20080223015240-btmt95d1vvlip4gl 20 z-...@us...-20080223124731-dlwuagon76gq2o3g 21 z-...@us...-20080223133015-0hjqyrki59ydwdcv 22 z-...@us...-20080223135113-icwd4g99yev9n0u2 23 z-...@us...-20080223152916-8rm942q1rmjlueca 24 z-...@us...-20080223174524-3lb2wm6tt5nytd4b Modified: clio/trunk/clio/clio/helptest.hpp =================================================================== --- clio/trunk/clio/clio/helptest.hpp 2008-02-23 17:54:53 UTC (rev 8084) +++ clio/trunk/clio/clio/helptest.hpp 2008-02-23 17:55:22 UTC (rev 8085) @@ -5,13 +5,13 @@ #include "state.hpp" #include "gcpointer.hpp" -inline void TestString( IoState * state, char const * testString ) +inline void TestString( clio::State & state, char const * testString ) { std::cout << "<<<< " << testString << "\n"; - IoState_doCString_( state, testString ); + state.DoString( testString ); } -inline void TestFile( IoState * state, char const * file ) +inline void TestFile( clio::State & state, char const * file ) { std::ifstream s( file ); while ( s.good() && !s.eof() ) Modified: clio/trunk/clio/clio/state.cpp =================================================================== --- clio/trunk/clio/clio/state.cpp 2008-02-23 17:54:53 UTC (rev 8084) +++ clio/trunk/clio/clio/state.cpp 2008-02-23 17:55:22 UTC (rev 8085) @@ -2,10 +2,12 @@ #include "ifunctioninfo.hpp" #include "stateregistrator.hpp" +#include "gcpointer.hpp" #include <IoState.h> -#include <CollectorMarker.h> +// #include <CollectorMarker.h> + namespace clio { @@ -14,7 +16,7 @@ // constructor, auto-creating IoState State::State() { - originalCollector_ = 0; + // originalCollector_ = 0; self_ = IoState_new(); IoState_init( self_ ); owned_ = true; @@ -26,7 +28,7 @@ // constructor, taking IoState managed by someone else State::State( IoState * self ) { - originalCollector_ = 0; + // originalCollector_ = 0; self_ = self; owned_ = false; @@ -37,11 +39,13 @@ // destructor State::~State() { + /* if ( originalCollector_ ) { // Collector_freeAllValues( self_->collector ); self_->collector = originalCollector_; } + */ // delete state if it belongs to this if ( owned_ ) @@ -62,6 +66,27 @@ IStateRegistrator::RegisterAll( *this, info ); } +IoObject * State::DoString( char const * command ) +{ + return IoState_doCString_( self_, command ); +} + +IoObject * State::DoString( std::string const & command ) +{ + return IoState_doCString_( self_, command.c_str() ); +} + +IoObject * State::DoFile( char const * filename ) +{ + return IoState_doFile_( self_, filename ); +} + +IoObject * State::DoFile( std::string const & filename ) +{ + return IoState_doFile_( self_, filename.c_str() ); +} + +/* void TransferMarkers( CollectorMarker * source, CollectorMarker * target ) { if ( source ) @@ -91,6 +116,7 @@ self_->collector = collector; } +*/ // makes sure state points to a valid and meaningful state void State::GetDefaultState( IoState * & state ) Modified: clio/trunk/clio/clio/state.hpp =================================================================== --- clio/trunk/clio/clio/state.hpp 2008-02-23 17:54:53 UTC (rev 8084) +++ clio/trunk/clio/clio/state.hpp 2008-02-23 17:55:22 UTC (rev 8085) @@ -3,10 +3,11 @@ #include "nocopy.hpp" +#include <IoObject.h> +#include <string> + class IoState; - #include <Collector.h> - namespace clio { @@ -38,6 +39,14 @@ // register our wrappers void Register( int securityLevel = 0 ); + // executes a string in Io + IoObject * DoString( char const * command ); + IoObject * DoString( std::string const & command ); + + // executes a script file in Io + IoObject * DoFile( char const * filename ); + IoObject * DoFile( std::string const & filename ); + // makes sure state points to a valid and meaningful state static void GetDefaultState( IoState * & state ); @@ -45,11 +54,11 @@ static IoState * GetDefault(); private: // installs a different garbage collector(hacky and does not seem to work any more) - void SetCollector( Collector * collector ); + // void SetCollector( Collector * collector ); IoState * self_; // the state bool owned_; // flag telling us whether the state is owned by this object - Collector * originalCollector_; // the garbage collector that came with the state + // Collector * originalCollector_; // the garbage collector that came with the state }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |