Announcement: micro-libgcj
Mike Emmel
mike.emmel@gmail.com
Fri Jan 6 22:48:00 GMT 2006
http://antenna.sourceforge.net/
Is another preprocessor thats used extensively by many j2me java developers.
Mike
On 1/6/06, Per Bothner <per@bothner.com> wrote:
> Andrew Haley wrote:
> > That would suit me well, but there may be some quasi-religious
> > objections to preprocessing. As in "How can you do this? Java
> > doesn't have a preprocessor!" :-)
> >
> > In all seriousness, we only have two routes: either preprocess or keep
> > micro-libgcj on a separate branch and repeatedly merge. I don't like
> > either objection, but it seems to me the second is worse.
>
> Kawa takes an approach to pre-proprocessing that may be suitable.
> Both the input and output to the pre-processor is a regular Java
> file, but with differenent sections commented out.
>
> The default CVS-checked in Java file assume JDK 1.4 functionality.
> For example:
>
> /* #ifdef use:java.net.URI */
> static URI URLtoURI (URL url)
> throws java.net.URISyntaxException
> {
> /* #ifdef JAVA5 */
> // return url.toURI();
> /* #else */
> return new URI(url.toString());
> /* #endif */
> }
> /* #else */
> // static String URLtoURI (URL url)
> // {
> // return url.toString();
> // }
> /* #endif */
>
> If you run gnu.kawa.util.PreProcess +JAVA5 +use:java.net.URI you get:
>
> /* #ifdef use:java.net.URI */
> static URI URLtoURI (URL url)
> throws java.net.URISyntaxException
> {
> /* #ifdef JAVA5 */
> return url.toURI();
> /* #else */
> // return new URI(url.toString());
> /* #endif */
> }
> /* #else */
> // static String URLtoURI (URL url)
> // {
> // return url.toString();
> // }
> /* #endif */
>
> If you run gnu.kawa.util.PreProcess -JAVA5 -use:java.net.URI you get:
>
> /* #ifdef use:java.net.URI */
> // static URI URLtoURI (URL url)
> // throws java.net.URISyntaxException
> // {
> // /* #ifdef JAVA5 */
> // return url.toURI();
> // /* #else */
> // return new URI(url.toString());
> // /* #endif */
> // }
> /* #else */
> static String URLtoURI (URL url)
> {
> return url.toString();
> }
> /* #endif */
>
> The PreProcess class modifies each source file in place, but it can
> easily be modified to write the output to a new file.
>
> So how does this solve the current problem? Basically, you can use
> various directives to control which features should be skipped for
> (various configurations of) micro-libgcj. The default checked-in
> code has all the standard features. To generate a micro-libgcj
> configuration, you preprocess the relavant files, creating a
> separate tree of modified files. You can use apropriate CLASSPATH
> options to make sure the modified versions are found before the
> standard versions.
>
> http://sources.redhat.com/cgi-bin/cvsweb.cgi/kawa/gnu/kawa/util/PreProcess.java?rev=1.5&content-type=text/x-cvsweb-markup&cvsroot=kawa
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
>
>
More information about the Java
mailing list