Am 22.03.2010 um 16:05 schrieb Douglas E. Engert:

>> Initial Comment:
>> In my effort to slim down JXplorer for usage in web browsers, I  
>> implemented source code preprocessing. A very simple one, of course.
>>
>> How it works:
>>
>> - Before compilation, all source files are backed up.
>>
>> - Before compilation, all source files are run through a  
>> preprocessor script, which comments out part of the source  
>> (leading //'s)and replaces files in place.
>>
>> - After compilation, original source files are restored back into  
>> into place.
>
> Why not make a separate copy with the changes, then build both the  
> program
> and the applet?
> Overwriting the source and replacing just sounds like trouble.

This was my my first idea, too, and I had it working this way.  
However, compiler warnings and runtime exceptions point pretty  
precisely to the location of trouble. If you compile copies in a  
separate directory, these locators point to that separate diretory as  
well. Clickable links provided by IDEs open the wrong file instead of  
the original source.

That said, it might perform faster to set original sources aside  
instead of tar'ing them up.

>> - Put pairs of //#if SOME_FLAG and //#endif on single lines into  
>> your code.
>
> Why not just use standard preprocessor directives?

Are there any established ones for Java? If yes, I couldn't find them.

A plain #if would work as well, but then the original source is no  
longer compileable and you have to process inactive flags as well  
(prefix only the directives with a // ).


Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/





------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jxplorer-devel mailing list
Jxplorer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jxplorer-devel

Reply via email to