#PB_Compiler_File

Everything else that doesn't fall into one of the other PB categories.
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

#PB_Compiler_File

Post by RichardL »

I do not know if there is a problem with jaPBe (build 3.7.9.666), PB4.00, a combination or them; or its my stupidity...

<#PB_Compiler_File> now appears to return the following for several different projects:

c:\programfiles\purebasicrev4\compilers\pb_editoroutput2.pb

instead of:

n:\projects\networkstuff\simulator2\my_projectRevx.pb

Can anyone point me to a solution?

Thanks



NOTE: I use #PB_Compiler_File to put the source file into Help\About on all my projects so each one carries the source file identity, I have found this very useful in major jobs.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

#PB_Compiler_File returns the compiled file, and "pb_editoroutput2.pb" is the file compiled by jaPBe.
I don't know if I can change this, since #PB_Compiler_File is defined by the compiler.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

The bugs forum is not for jaPBe bugs. Only for the PB Package.

Using the PB IDE, it will display the real filename since one of the 4.10 betas.
In 4.0x it was the same as you describe.

@gnozal:
Look at the 'SOURCEALIAS' command in the Library SDK\CompilerInterface.txt
There you can modify the value of #PB_Compiler_File for the main file.

I think i wrote that in a jaPBe related discussion when i made this change.
quidquid Latine dictum sit altum videtur
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

@ freak:

Is it possible, to implement a #PB_Compiler_FilePath constant parallel to #PB_Compiler_File?

I'm using the onError-Lib, that should generate error messages like "error in 'main module.pb' line 20".
Of course, I use GetFilePart(#PB_Compiler_File), but I don't want to have the path to the file in the final exe. Nobody should see my pathes.

(Before prosting this, I verified my request by opening my EXE with notepad)


Edit: Woooow! have a look at this: Everybody executing my EXEs can see my temporary path!
My EXE wrote:Division by zero forbidden. Modulo zero is forbidden (result in a zero divide). Pointer is null. Array index out of bounds. The linked list doesn't have a current element. Structure array index out of bounds. Array size can't be negative. Only the last dimension of an array can be changed with ReDim. Read data error: no more data. C:\Dokumente und Einstellungen\Andre\Lokale Einstellungen\Temp\PB_EditorOutput.pb D:\PureBasic\Projekte\TO-Multi Tool\ D:\Programme\PureBasic\ RG QRG €RG ´RG èRG SG JSG D:\PureBasic\Projekte\TO-Multi Tool\Enumerations.pbi
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

freak wrote:@gnozal:
Look at the 'SOURCEALIAS' command in the Library SDK\CompilerInterface.txt
There you can modify the value of #PB_Compiler_File for the main file.

I think i wrote that in a jaPBe related discussion when i made this change.
Yes, you are right ... :oops:
I forgot this new command !
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

I tried to use the SOURCEALIAS command, but it doesn't seem to work ?

jaPBe debug output

Code: Select all

PBPath : C:\PureBasic410\
STARTING	4.10	PureBasic 4.10 Beta 4 (Windows - x86)
READY
REQUEST : FUNCTIONLIST
COMPLETE
BUFFERLEN = 108203
REQUEST : STRUCTURELIST
COMPLETE
BUFFERLEN = 9457
REQUEST : INTERFACELIST
COMPLETE
BUFFERLEN = 38524
COMMAND : SOURCE	C:\TEMP\PB_EditorOutput.pb
COMMAND : Ok
COMMAND : TARGET	C:\TEMP\Purebasic0.exe
COMMAND : Ok
COMMAND : SOURCEALIAS	C:\PureBasic410\Program\debug_test.pb
COMMAND : Ok
COMMAND : RESOURCE	C:\TEMP\_jaPBe_.rc
COMMAND : Ok
COMMAND : INCLUDEPATH	C:\PureBasic410\Program\
COMMAND : Ok
test code

Code: Select all

Debug #PB_Compiler_File
test code debug output

Code: Select all

C:\TEMP\PB_EditorOutput2.pb
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Works fine here in the IDE, and also in a quick test in the console:

Code: Select all

SOURCE  C:\x.pb
TARGET  C:\x.exe
SOURCEALIAS     Y:\whatever.pb
COMPILE
Correctly reports the alias path in the executable.

I noticed in your debug output that the reported filename is neither your
SOURCE nor your SOURCEALIAS filename (PB_EditorOutput2.pb).
Is the file containing the Debug statement maybe not really the main file, but included into another one ?

AND51:
I do not see a problem really. Just cut the path before displaying. And if somebody
looks at your exe and sees this path, whats the big deal ? It reveals no useful information.
On the other hand, if the path information is missing, larger projects could have
a problem when they have files with equal names in different directories.
quidquid Latine dictum sit altum videtur
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

freak wrote:I noticed in your debug output that the reported filename is neither your SOURCE nor your SOURCEALIAS filename (PB_EditorOutput2.pb).
Is the file containing the Debug statement maybe not really the main file, but included into another one ?
Yes

Compiled file = PB_EditorOutput.pb
Source copy = PB_EditorOutput2.pb
Like this :

Code: Select all

; File PB_EditorOutput.pb
...
IncludeFile PB_EditorOutput2.pb
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: #PB_Compiler_File

Post by gnozal »

RichardL wrote:Can anyone point me to a solution?

NOTE: I use #PB_Compiler_File to put the source file into Help\About on all my projects so each one carries the source file identity, I have found this very useful in major jobs.
I almost forgot ...
In jaPBe, you can use #jaPBe_SourcePath and #jaPBe_SourceFile.

Code (Test2.pb)

Code: Select all

Debug #PB_Compiler_File
Debug #jaPBe_SourcePath
Debug #jaPBe_SourceFile
Debug output

Code: Select all

C:\TEMP\PB_EditorOutput2.pb
C:\PureBasic410\Program\
TEST2.pb
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Well, the SOURCEALIAS is only for the main file.

Why not include the files the other way around (ie include the PB_EditorOutput.pb into the PB_EditorOutput2.pb, then you do not have the problem.)
If you put the IncludeFile on the beginning of the first line with a ":", you will not mess up any linenumbers.
quidquid Latine dictum sit altum videtur
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

freak wrote:Well, the SOURCEALIAS is only for the main file.
I don't understand why ?
I thought the SOURCEALIAS command just sets a value for #PB_Compiler_File (so why not accept any value passed to the compiler ?). Or is it used for something else ?
freak wrote:Why not include the files the other way around (ie include the PB_EditorOutput.pb into the PB_EditorOutput2.pb, then you do not have the problem.)
If you put the IncludeFile on the beginning of the first line with a ":", you will not mess up any linenumbers.
Yes, that an idea. Thanks.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

#PB_Compiler_File always retuns the filename where the constant was used.
So if you use it in an includefile, it returns the includefile name. Thats the purpose of it.
It is different from the #jaPBE_SourceFile, which always returns the mainfile name i think.

The SOURCEALIAS only modifies the mainfile name (to allow a temporary file there).
If it would modify all filenames, the #PB_Compiler_File could no longer fullfill the above mentioned purpose.
quidquid Latine dictum sit altum videtur
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

@freak
@gnozal
First, I apologise if this is out of topic, as I said in the initial post I could not be sure where the source of the problem was... but as it works out I now have a solution, using #jaPBe_SourcePath and jaPBe_SourceFile. Thank you gentlemen.

Now I will be really cheeky and ask a really out-of-topic question, because one of you probably knows the answer... and if the moderator boots me out well that fair enough. Question:
How can I make the debug window use a fixed pitch font... looking at debug data in tabular format using a proportional font drives me up the wall!

Richard
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

no problem.

Open the PureBasic IDE, go to Preferences->Debugger->Individual Settings
and there you can change the font used in the Debug output window.
Since the standalone debugger also uses this setting, this change should affect jaPBe as well.

If jaPBe has a setting in its prefs to affect this value for the debugger, i don't know. It is a quite new option.
quidquid Latine dictum sit altum videtur
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

freak wrote:#PB_Compiler_File always retuns the filename where the constant was used.
So if you use it in an includefile, it returns the includefile name. Thats the purpose of it.
It is different from the #jaPBE_SourceFile, which always returns the mainfile name i think.
Thank you very much for the explanation.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply