ofxConsole

This is a first alpha version of ofxConsole, a quakestyle text console to bind functions and variables mainly for debugging. This tutorial was really helpful:
flipcode.com/archives/Creating_a_Scalable_Console_System_with_STL-Part_1.shtml

Most of the time went into the event/callback system which is based on boost::function boost::bind and also makes use of boost preprocessor to generate the functor templates. Generally this was my first time seriously working with strings and especially templates so this was a good exercise. In the future I plan to overwork the eventsystem with a scripting language (propably LUA lua.org), since that seems to be a better solution.

Right now when using boost you can register any void function/memberfunction with up to 9 arguments. if you don’t have boost you can still run the example with a simple callback system similar to the one that comes with OF (doesn’t use poco though).

video:
http://vimeo.com/5872370

get it here:
code.google.com/p/mokacode/downloads/list

PS: I actually wanted to post it at addons.openframeworks.cc but I could not find the link where to propose a new addon :frowning:

Very nice! I know that there is already an effort to bind OF with Lua, and I am working on another one of my own, based off the Luabind library (which is grounded in Boost, so that might work nicely). I am almost done with my ofxLuabind alpha, and I will try to get the code up as soon as possible!

EDIT: What the heck is this post doing here? I remember posting this under a different topic way back when… :oops:

ok kool, I allready got it to work on my mac but I am experiencing some weird behaviour as described here:
http://forum.openframeworks.cc/t/luabind-xcode-universal-static-library/2392/0

Hey Moka thanks a lot for the console! I can see this being very useful at some point

Hi moka,

Thank you for great addon! This is what I looking for!
I tryied ofxConsole with my windows, vc, but have 2 trouble, so post report.

My environment is Windows7, visual studio Express Edition 2008, openFrameworks v0.06.

First trouble is with Boost. (It works without Boost nicely :slight_smile: )
ofxConsole includes <cxxabi.h> in ofxConsoleFunctor.h, I guess it’s a member of libstdc++ (STL implementation in gcc?).
But Visual Studio doesn’t have cxxabi.h.

So, I reduce <cxxabi.h> and relevant following 4 line . from ofxConsoleFunctor.h and ofxConsoleFunctorGenerator.h.

Then I could compile and run. But when I make a typing error like setBackgrounBoostWay 1 1 1 1 1 1, then it clash and throw error of vector “vector subscript out of range”. (Usually it makes (Wrong number of arguments for ! ) massage in console and no clash.) (this is not a fundamental solution. we have to demangle with VC++.)

Any suggestion?

Second problem is solved. Scope in swich() syntax.
With Visual Studio I need to add a set of {}. If not, we have compile error (it’s like " fProps is not initialized in default" )

  
  
void ofxConsoleBase::parseCommandLine(){  
	// ~~~~~~  
  
	case CTYPE_FUNCTION:  
		{  /// this !! and...  
			ofxConsoleFProps * fProps = (*iter).function->callBack(arguments);  
				  
			if(fProps->err.size()){  
				std::string args;  
				for(int i=0; i<fProps->numArgs; i++){  
					// ~~~~  
				}  
				for(int i=0; i<fProps->err.size(); i++){  
					// ~~~  
				}  
  
				fProps->err.clear();  
			}  
  
		} // this !!!  
  
		break;  
  
}  
  

Anyway thank you for your work!

hiroshi

Hi,

Sorry I have never worked on windows, so I dont really know how to solve your problem. Anyways I plan to rework the addon soon and instead of making use of function pointers I will propably integrate a scripting language such as Lua for the command line :slight_smile: