On Tue, 13 Oct 2009, Szak�ts Viktor wrote:

Hi,

> I can't solve the PP parser part, but if such
> function gets added to core, I'm ready to add support
> for it in hbmk2.
> Przemek, do you think that such function would be possible
> to implement?
> __PP_INCLUDELIST( <cPRGFileName>, <cOptions> ) -> <aINCLUDEFileName>
> (or something with similar effect)

It has to be fully integrated with compiler because included files
may depend on conditional compilation so you have to activate compiler
with all compiler switches which are used for normal compilation (plus
switch(es) which enable autodependent checking) to preproces .prg files
otherwise it will not work for situations like:

   #xcommand INCLUDEFILE <file> => #include <file>
   #xcommand INCLUDEAGAIN => #ifndef _AGAIN; #define _AGAIN;;
                                             INCLUDEFILE __FILE__ ; #endif
   #define SHOW_DATA #pragma __streaminclude "data.inc"|? %s
   #ifdef _AGAIN
      ? "SECOND PASS"
      SHOW_DATA
      ? "===="
   #else
      proc main()
         ? "main()"
         #if __HARBOUR__ + 0 >= 0x20000 .and. !defined( MYDEF )
            INCLUDEAGAIN
         #endif
      return
   #endif

when you compile this code with and without -DMYDEF parameter.
I think that you can easy imagine much more complicated situations.
In poractice you have to activate the compiler with all it's setting
and macros to fully replicate conditional compilation.
Please also remember that Harbour supports also #pragma __[c]streaminclude
which should also be detected and in the future may support some other
extensions like using compiler switches in #if expressions, i.e.:

   #if enabled( -kh )
      #include "hbext_rules.ch"
   #endif

in summary it means that the only one method to generate correct
dependencies list which will always work is compiler (or code
which fully replicates compiler and PP behavior).
I'll add to compiler support for such functionality.
It will work like -M in GCC.
For hbmk2 which uses embedded Harbour compiler I also add support
for function which will return list of dependencies instead of
sending them to stdout.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to