[Nxtcommand-developers] reply for Peter Joosten
Status: Beta
Brought to you by:
bbagnall
|
From: Kirkey, K. M. <kur...@un...> - 2006-12-04 17:06:04
|
Dear Peter,
=20
Reply below:
=20
Message: 3
Date: Mon, 4 Dec 2006 04:42:28 +0100
From: "Peter Joosten" <ptg...@ch...>
Subject: Re: [Nxtcommand-developers] iCommand 0.5 CLDC pre2
To: "iCommand Developers"
<nxt...@li...>
Message-ID: <IOE...@ch...>
Content-Type: text/plain; charset=3D"us-ascii"
=20
My opinion (this should be our goal, if it is practically feasible
...?):
=20
1. One source tree for the icommand library using preprocessor macros
to differentiate between the execution environments.
2. Applications using the icommand library should be in seperate
projects
These projects may have NXTComm implementations, because in my
opinion
NXTComm implementations do not belong to the (core) icommand library.
(For convenience we will keep the "i386" NXTComm implementations
where
they are.)
These projects however will have a dependency on the icommand
project, and should not contain a (modified) copy of the icommand
sources.
Platform specific bytecode can be preprocessed/compiled from the
icommand
source tree.
=20
Have look at the Simple Java PreProcessor (SJPP) :
http://www.vortoj.com/sjpp/readme.html
=20
1. I have a file pp.charset.properties in my home directory:
charset =3D PRJ-J2SE \
PRJ-J2ME
=20
PRJ-J2SE.defines =3D J2SE
PRJ-J2ME.defines =3D J2ME
-----------------------
2. I have a java source that looks like this, when I open it with a text
editor (notepad)
=20
public class Sample {
=20
public static void main(String[] args) {
#ifdef J2ME
System.out.println("J2ME");
#endif
#ifdef J2SE
System.out.println("J2SE");
#endif
}
}
=20
3. But when I open the java source and I set the encoding of the project
to
PRJ-J2ME
in the IDE it looks like (all non-J2ME code commented out):
=20
public class Sample {
=20
public static void main(String[] args) {
//~#ifdef J2ME
System.out.println("J2ME");
//~#endif
//~#ifdef J2SE
//~ System.out.println("J2SE");
//~#endif
}
}
=20
So with this preprocessor You do not first have to gerenerate platform
specific
source code, in order to run your program within the ide. I have tested
SJPP
with Eclipse and NetBeans. Eclipse: OK. NetBeans: Nearly OK. It gives an
error
at the last statement of the code. I you delete the invisible character
after
the statement and then add a space, the error disappears. I think this
is an
error in the sjpp generating some strange invisible character at the end
(EOF ?).
I will have to look into this. Maybe there are some better
preprocessors,
but this is the best I have found so far. With the other pre-processors
I
have
found, you first have to generate the platform specific source code,
before
you can
run your application. I do not like that. Whether it's a good idea to
use a
preprocessor ? It will depend on the preprocessors functionality.
I have used sjpp pre-processor on a past project and it works fine:
although, I'm not a big fan of pre-processor's in Java/C#)
=20
Peter Joosten.
=20
|