Page 1 of 1

External Tools - Compilefile

Posted: Sat Jul 06, 2013 12:42 am
by Josh
Before Compile/Run
The tool will be executed right before the compiler is called to compile a source code. Using the %COMPILEFILE token, you can get the code to be compiled and modify it. This makes it possible to write a small pre-processor for the source code.
Some years ago, I tested a long time with this function. This run well, if you use only a single file. Using include files, this function is definitely useless.

Is it possible, that the Pb compiler is using codefiles with a specific subfix, if the file with this subfix is available. For example, I have a project with tree files:
  • MainFile.pb
  • IncFile1.pb
  • IncFile2.pb
Now I'm starting the compiler and with my preprocessor I'm scanning the codefiles and see, that I want to make changes in Mainfile and IncFile2. So I'm creating the following files with my changes in the same directory where the original files are stored:
  • MainFile.pb.Compilefile
  • IncFile2.pb.Compilefile
When my preprocessor has finished and gives back the control to the compiler, the compiler is running like following:
  • The compiler finds MainFile.pb.Compilefile and use the code from this file.
  • If the compiler runs to XIncludeFile "IncFile1.pb" and there is no IncFile1.pb.Compilefile, the compiler is using IncFile1.pb
  • If the compiler runs to XIncludeFile "IncFile2.pb" and there is an IncFile2.pb.Compilefile, the compiler is using IncFile2.pb.Compilefile
And now, the major argument, where the current system completely fails. If the compiler is running to an error, the IDE has to show the error in the original code. So, when I make my changes in a way, that the line numbers are not changed, I have the perfect system.

Re: External Tools - Compilefile

Posted: Sat Jul 06, 2013 5:50 am
by Little John
Josh wrote:Using include files, this function is definitely useless.
I disagree. The preprocessor just hast to be written properly. My preprocessor LPP can handle include files.
Josh wrote:If the compiler is running to an error, the IDE has to show the error in the original code.
Yes, that would be really useful. I currently also don't know how to achieve that.

For a more detailed feature request in this regard see here.

Re: External Tools - Compilefile

Posted: Sat Jul 06, 2013 6:54 am
by Josh
Little John wrote:Yes, that would be really useful. I currently also don't know how to achieve that.
That's the reason, why it's definitely useless. If you are working with a system where compiler errors are shown in a wrong file, you must be a masochist :mrgreen:

Re: External Tools - Compilefile

Posted: Sat Jul 06, 2013 7:32 am
by Little John
Josh wrote:
Little John wrote:Yes, that would be really useful. I currently also don't know how to achieve that.
That's the reason, why it's definitely useless.
"Useless" is a great exaggeration and not applicable. People are making use of this feature, and although it is not perfect, I for one am happy that it exists. So "useless" is definitely wrong.