Add Option to Suppress PB Settings in Configure Tools Window

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Add Option to Suppress PB Settings in Configure Tools Window

Post 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.
Last edited by akj on Sun Aug 23, 2009 1:14 pm, edited 1 time in total.
Anthony Jordan
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

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

Post by UserOfPure »

It's the "Save Settings As" option in the Preferences. It already does what you want.
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post 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 .
Anthony Jordan
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Post 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.
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post 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.
Anthony Jordan
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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 ?
quidquid Latine dictum sit altum videtur
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post 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.
Anthony Jordan
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post 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 :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post 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.
Anthony Jordan
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post 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?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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?
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post 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?
Anthony Jordan
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Post 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.
%101010 = $2A = 42
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

akj, you can completely delete the comments if you want to. They're only read by the IDE not the compiler.
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post 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.
Anthony Jordan
Post Reply