On Sat, 05 May 2012, Benoît Minisini wrote: > Le 05/05/2012 08:51, tobi a écrit : > > > > Concerning the preprocessor... What about utilising the cpp just as a > > command that runs over each > > class and module file before seen by the compiler code? It's already > > powerful enough or is that > > too much for gambas? (It would break existing code due to character case in > > the gambas preprocessor > > directives...) > > > > Yes, it will slow down the compiler and break everything (because the > code becomes impossible to analyze) > > Regards, > > -- > Benoît Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user
OK. But just for interest, what do you mean by "impossible to analyze"? Excuse me, but I haven't read anything from the compiler yet. (When you say "analyze", I think of line numbers and stuff (optimisation can be done later, too, right?), but line numbers would be possible, I'm almost a bit certain, to report to the IDE, if that is what you mean) I just tested it and found that cpp warns at ['] the gambas comment character which, of course, may not ahve any closing ['] one and thus confuses the program but it fearlessly ignores that and continues as expected. As an example, consider these actions: $ ls -AR .: .gambas .project .src .startup ./.gambas: ./.src: MMain.module myfunc.function $ cp .src/MMain.module .src/MMain.module.old $ cat .src/MMain.module ' Gambas module file #ifndef NOPREPROC #define PREPROC #endif #include "myfunc.function" Public Sub Main() #ifdef PREPROC /* * I can use these comments when c-preprocessed, of course! */ Print "This is cool" myfunc() #endif Print "This is normal" End $ cpp .src/MMain.module.old | sed 's/^#.*$//' > .src/MMain.module .src/MMain.module:1:1: warning: missing terminating ' character [enabled by default] $ gbc3 -ga OK $ cp .src/MMain.module.old .src/MMain.module $ gbx3 This is cool preprocessing This is normal $ cpp -DNOPREPROC .src/MMain.module.old | sed 's/^#.*$//' > .src/MMain.module $ gbc3 -ga OK $ gbx3 This is normal It works! Used by people at least a bit familiar with the basics of the cpp won't have any problems, the only thing is the translation of the cpp line control which I have discarded gracefully using sed because I don't make any mistakes ;) It's clear that it would slow down the compiler and that most people won't need those fancy tricks as gambas is basic and has advanced enough compiling mechanisms, I'm convinced, but: a simple line on the top of a file to enable the cpp for the rest of people that may utilise it wouldn't hurt?: ' Gambas class file ' :use cpp Please, explain your worries. A more intrusive "feature" would be the ability of using that c-/c++-style comments /**/, // within gambas when cpp'ed... I have no reason to write this post (never needed to used conditional compilation or something from within gambas) except to save you work. Reagards, Tobi ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user