[My apologies if the answer to this is obvious, but I've spend most of the day searching with no luck]
I'm currently using Processing to develop a tool for schools to do some astronomy (long story). Because of the varied and frequently bizarre restrictions imposed by school IT systems, I need to produce HTML5, Applet and Application versions - so a mixture of different "modes" and also using both v1.5.1 and v2.
Most of the code is fine, but there are some aspects (e.g. dealing with file I/O) which are going to be different for the different modes. I can, of course, just manage multiple versions of the project within my Sketchbook and copy bits of files around, but that is clearly a nightmare when it comes to keeping the code up-to-date as revisions are made.
My ideal would be to be able to do the equivalent of the C "#ifdef" to isolate bits of code so that only particular modes and/or versions of Processing "see" them.
For example, it would be nice to be able to do:
ifdef(VERSION_1_5_1) {
// Do stuff that only v1.5.1 understands. v2 ignores this bit completely
} elif(VERSION_2) {
// Do the equivalent for version 2. v1.5 ignores this completely
}
Or
ifdef(MODE_JAVASCRIPT) {
// Do something clever to get the data I need from the JS variables on the rest of the page
} elif(MODE_APPLET) {
// Do something clever to get a URL from the wrapper page and get the data from it
} elif(MODE_APPLICATION) {
// Use selectInput() to get a filename from the user and get the data from that file
}
and so on. Obviously I know this particular code is gibbereish, but is there anything within Processing that might make this sort of thing possible?