Thursday, July 21, 2005

XLib D port, Jython BlackBerry apps

Progress on porting XLib to D, took a minor step forward yesternite.

I've completed X.h -> X.d conversion, and dmd reports no errors. That's a little victory. Now, X.h actually includes Xmd.h, which has some *wicked* preprocessor defs, like:

#if defined (_LP64) || defined(__alpha) || defined(__alpha__) || defined(__ia64__) || defined(ia64) || defined(__sparc64__) || defined(__s390x__) || (defined(__hppa__) && defined(__LP64__)) || defined(__amd64__) || defined(amd64) || defined(__powerpc64__) || (defined(sgi) && (_MIPS_SZLONG == 64))
#define LONG64 /* 32/64-bit architecture */
#endif

My translation to D, looks so far like this:

version( _LP64 || __alpha || __alpha__ || __ia64__ || ia64 __sparc64__ || __s390x__ || __hppa__ || __LP64__ __amd64__ || amd64 || __powerpc64__ ) {

version = LONG64;
}

Ofcourse, you'll note that i don't have any representation for the compound && that is or'd into that expression..:

|| (defined(sgi) && (_MIPS_SZLONG == 64)

I'm not sure how to add that to the version() construct. What is really stomping me, is how to cater for the _MIPS_SZLONG == 64, since i can't specify expressions in a version() conditional. Hmmm....

Anyone with any ideas? I'm still thinking about this. I'll continue tonite, and i'll move on to other parts... everything doesn't have to be picture perfect for a first release, which will happen when i'm able to run the tutorial at:

http://tronche.com/gui/x/xlib-tutorial

I won't need those defs to get it work on my box, which is a humble AMD Anthlon64 :), but we'll need them eventually if we're really serious about portability.


Btw, yesterday, i was also trying to get a Jython BlackBerry sample to build, and suprisingly, i got quite far, only to be stomped by a preverification error. java.lang.NoClassDefFoundError. I used jythonc to build a .java file out of my .py program, and proceeded to use rapc.exe (RIM's custom tool for creating .cod files, needed by the BlackBerry).

rapx.exe actually calls another program preverify.exe, and then calls a java compiler, then does some funky stuff. My problem, happened at the preverification stage. it was preverifying the jython.jar archive and borked. The good news is, i think its just a path thing i have to sort out, as when i also tried to preverify net_rim_api.jar, without using the IDE, it also borked on the same error.

I'll give this another shot sometime tonite. If this woiks, this WILL be SOOOOOOO cool... my next step will be generic MIDP and CLDC apps in jython! WHOOOOO!!!

Ok... Essien... out.

2 Comments:

At Wednesday, October 10, 2007 6:00:00 PM, Blogger Jerry said...

I have recently run across this blog post. I was wondering if you ever managed to get this to work. I did manage to resolve the preverification problem, but ran into another problem. The CDLC specification doesn't have java.io.Serializable which jython relies on to represent a PyObject and most of the other Python objects.

 
At Monday, June 02, 2008 2:14:00 AM, Blogger Stu said...

Hi... basically wondering the same thing.. jython for cldc could be a new era of coding if possible :)

If serializable is not available then perhaps javolution could help.

TBH I don't care if the apps are 1mb, just want to see it working!

 

Post a Comment

<< Home