Page 1 of 1

Add Option to Suppress PB Settings in Configure Tools Window

Posted: Sun Aug 23, 2009 12:36 pm
by akj
In the 'Edit Tool Settings' dialogue window reached from the IDE menupath Tools -> Configure Tools, please add a checkbox to omit the 'PB settings lines' from the temporary source file. This will make it much easier to append additional lines to source files or to merge source files.

The 'PB settings lines, are those hidden lines that optionally can be at the end of a source file. The first such line commences: "; IDE Options = PureBasic".

Alternatively, introduce a new variable called [say] %SOURCESIZE that returns the number of bytes in the temporary source file just before the start of any hidden lines.

Re: Add Option to Suppress PB Settings in Configure Tools Wi

Posted: Sun Aug 23, 2009 1:04 pm
by UserOfPure
It's the "Save Settings As" option in the Preferences. It already does what you want.

Posted: Sun Aug 23, 2009 1:21 pm
by akj
@UserOfPure:

[As a result of your post, I have slightly edited my original post.]

You have misunderstood my wishes.
I want to retain the ability to have the PB settings at the end of my true source file, but I want an option for them to be supressed (or a variable to determine their start position) in the temporary file that is accessible via %TEMPFILE .

Posted: Sun Aug 23, 2009 1:48 pm
by UserOfPure
AKJ wrote:omit the 'PB settings lines' from the temporary source file. This will make it much easier to append additional lines to source files or to merge source files.
If you select "The file <filename>.pb.cfg" then you will be able to merge several source codes without worrying about the config settings, which is what you said above, yes? They will be omitted with the above preference, and just called instead from a separate ".cfg" file.

Posted: Sun Aug 23, 2009 2:01 pm
by akj
@UserOfPure:

I do not want the PB settings to be in a separate .cfg file.
I want them to be at the end of each source file.

I merely wish to be able to easily ignore them in the %TEMPFILE copy.

Posted: Sun Aug 23, 2009 6:41 pm
by freak
Tempfiles always have the settings appended so tools can read them regardless of where the IDE stores these settings for normal sources.

I don't see the problem really. Why can't you just look for the line that starts the settings and cut the rest when you merge files ?

Posted: Sun Aug 23, 2009 6:52 pm
by akj
@freak:

You ask
Why can't you just look for the line that starts the settings and cut the rest when you merge files ?
I certainly can do what you suggest, BUT I regard lines like

Code: Select all

"; IDE Options = PureBasic ..."
as being part of PB internals and so subject to arbitrary change over time, thus invalidating any dependent programs in the long-term.

And you frequently say we should not rely on PB internals information.

Posted: Sun Aug 23, 2009 9:10 pm
by blueznl
Euh, I may be stupid, but aren't these for the IDE only? The temp file is passed on to the compiler, so why care about the comments? I'm a bit lost here :-)

Posted: Sun Aug 23, 2009 9:30 pm
by akj
@blueznl:

In the context of my original post, the temp file is not being passed to the compiler. The compiler is totally irrelevant.

I am intercepting and modifying the temp file in an external tool I have written [one that uses the %TEMPFILE variable]. This tool is accessed from the IDE menupath Tools.

Posted: Mon Aug 24, 2009 8:29 am
by blueznl
I'm doing a similar thing in CodeCaddy, but I don't understand why you're worried about those comment lines at the end. Are you going to manipulate the source in such a way they are no longer applicable?

Posted: Mon Aug 24, 2009 9:12 am
by Mistrel
I think what akj is getting at is that the commented IDE options appended at the end of the file are evaluated first before the temporary source file is passed to the tool. This prevents tools from overriding these options.

There are creative workarounds for this. What are you trying to do?

Posted: Mon Aug 24, 2009 9:47 am
by akj
@Mistrel & blueznl:

I have managed to work-around the PB settings problem by hard-coding the string "; IDE Options = PureBasic" within my program. But this seems kludgy as it effectively uses information which is in the realm of undocumented internals information and I felt there should be a more robust way of doing it, especially one that does not require reading the entire source code, purely to find the start of the PB settings. Hence my original post.

Blueznl asks
Are you going to manipulate the source in such a way they are no longer applicable?
and the answer is Yes.

My program is a simple tool that appends to the end of the current PB source program a non-PB text file, usually code written in another language such as C or VB. However every non-empty line of the incoming text file is commented out preventing PB from case-correcting the text [and awkward characters such as tabs are removed or replaced]. This facilitates translating the foreign code to PB, which is usually my goal.

If I ignore the PB settings lines and simply append after them, they act as a barrier, hiding the appended text, thus I must move or remove them.

Mistrel, you mention creative work-arounds. Do you have any in mind that are unusual or particularly interesting?

Posted: Mon Aug 24, 2009 9:58 am
by Perkin
How about an IDE 'edit->paste as comment' option, that way any text on clipboard would get pasted but with the ';' before each line.

Posted: Mon Aug 24, 2009 10:51 am
by Mistrel
akj, you can completely delete the comments if you want to. They're only read by the IDE not the compiler.

Posted: Mon Aug 24, 2009 12:56 pm
by akj
@Mistrel:

I understand your reply but there are two advantages in having foreign text imported as comments:

1. Automatic case changing does not occur.

2. It's easier to distinguish between the imported text, and my own PB code.
This is especially true as the each line of imported text is prepended with two semi-colons, so distinguishing it from normal PB comments.