Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 3c70d8d9296f244cd6b5e2009903171f > files > 58

cooledit-3.17.17-2mdv2008.1.i586.rpm

	From root@obsidian.co.za Fri Feb 11 11:53 GMT 2000
	Status: RO
	Date: Fri, 11 Feb 2000 13:53:28 +0200 (SAST)
	From: Paul Sheer <psheer@icon.co.za>
	Reply-To: Paul Sheer <psheer@icon.co.za>
	Subject: Rxvt componentized into an object and imbedded into cooledit
	To: Geoff Wing <gcw@pobox.com>, cooledit@mail.obsidian.co.za
	MIME-Version: 1.0
	Content-Type: TEXT/plain; charset=us-ascii
	
	
	I have imbedded rxvt-2.6.1 into cooledit. This is probably useless and stupid,
	so please feel free to flame. However it is technically quite
	interesting:
	
	Rxvt is a grosely non-object-orientated program - lots of global and
	static variables. I wanted to turn it into an object, where multiple
	instances could be instantiated from within the same thread.
	
	I have written a Python script to convert any (?) flat C code into
	object orientated style C code. It takes all global functions and
	replaces
		do_something (int x, char *y);
	with
		rxvtlib_do_something (rxvtlib *o, int x, char *y);
	
	It also replaces all global variables
	with o->global_variable ... well you get the idea.
	
	The result is librxvt.a which can be used to imbed a terminal inside
	any application. You just give it the necessary callbacks.
	
	The port is not trivial, even after running the script (which tries to
	cope with as many general situations as possible - like seperating
	out typedefs and structs, and initialising variables) there is still
	a days work in cleaning everything up.
	
	The result is an rxvt which looks like this:
	
	#include "rxvtlib.h"
	
	int main (int argc, const char *const *argv)
	{
	    rxvtlib o;
	    rxvtlib_init (&o);
	    rxvtlib_main (&o, argc, argv);
	    return 0;
	}
	
	...and not a single global variable.
	
	Imbedding into cooledit is a little more work. You have to isolate
	rxvt's inner loop and give it cooledit's display connection. This
	now all works - press F1 for a terminal and watch it pop up at
	lightning speed. The next beta (beta9) will be uploaded this weekend.
	
	rxvtlib adds 70k to the final cooledit binary.
	
	Note that rxvt is not quite yet a coolwidget - that may come later. its
	still a toplevel window.
	
	(Geoff, if you are interested in `objectizing' rxvt in this way, I can port
	the latest devel version in a day or so.)
	
	One extension of this is to have a future rxvt version that has mutiple terminals
	in notebook style - i think this would be really cool.
	
	best wishes
	
	-paul