Apart from being able to rejuvenate older code-lines, it might be nice to learn where the JVM and the Java Language Spec (JLS) falls short in respect of being able to host C code.

Axiomatic Multi Platform C

ANSI C, recompiled to bytecode...

Malaysian company Axiomatic solutions produces a commercial technology for Java that will turn ANSI C course into something useable from Java that's pure Java.  After some discussion with them at the start of the year they produced a demo to show the technology working against public C projects.  While their customers (banks etc with private codebases) no doubt keep them solvent, its a community that will make the technology hugely popular.  One step towards a vibrant community, is the downloadable bytecode conversion public project.  To that end, libjpeg was a simple starting point.  See their brief announcement and the resulting download.

There are some downsides.  It wants to use stdin for the input image, and stream to sysout for the resulting jpeg:

     java -cp cjpeg.jar;acc_std.jar cjpeg <anUncompressed.bmp >resulting.jpg

I used this uncompressed bitmap as a sample image : http://hsc.csu.edu.au/info_tech/electives/multimedia/2722/images/recycle.bmp . You'll have to get acc_std.jar from one of the demo installables.

In the first class Java world, you would really want to do something like:

     new Libjpeg().cjpeg(inputStream, outputStream);

'cjpeg' would not be too hard to wrap in a convenience class of course.

It would be nice to see Axiomatic launch a portal (of their own, or sit within SourceForge, GoogleCode, Java.net) for the maintenance of pre-converted pieces from the C world and the generation of some buzz.

Like the above, but not as evolved.

JCPP - A Java C Preprocessor

"The C Preprocessor is an interesting standard. It appears to be derived from the de-facto behavior of the first preprocessors, and has evolved over the years. Implementation is therefore difficult. JCPP is a complete, compliant, standalone, pure Java implementation of the C preprocessor. It is intended to be of use to people writing C-style compilers in Java using tools like sablecc, antlr, JLex, CUP and so forth. This project has has been used to successfully preprocess much of the source code of the GNU C library"


April 8th, 2007