Permanent include a source file with common functions etc.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Permanent include a source file with common functions etc.

Post by uwekel »

Hi,

i would like to have the possibility to permanent include a Purebasic source file. The source contains common procedures, macros and other stuff which should be available for all other projects and source files. I think it could be setup in the settings and everytime you compile or run a file or project, the source will be loaded at first. That's also good for temporary testing. Of course, code completion should work as well.

Best regards
Uwe
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Permanent include a source file with common functions et

Post by IdeasVacuum »

Well, that's only one line, Xinclude "my file.pbi" and you can store that one-liner as a template.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: Permanent include a source file with common functions et

Post by uwekel »

I often use a new file for testing. I would have to write this line everytime. And code completion wouldn't work as well.
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
User avatar
bembulak
Enthusiast
Enthusiast
Posts: 575
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Re: Permanent include a source file with common functions et

Post by bembulak »

And code completion wouldn't work as well.
I'm not 100% sure about this, as I think auto completion for imported files can be enabled in the IDE settings.

But it would be nice to have a certain directory in PBs home where one file, e.g. include.pbi is placed. You can edit this file and add as much other includes as you need/want.
It would act much like a classpath in Java, which wouldn't be bad IMHO.
cheers,

bembulak
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: Permanent include a source file with common functions et

Post by Bisonte »

@bembulak : IDE-Settings only for projects or opened files...

You can store macros, structures and constants in a .res (resident) file.

so your "standard-include" will be smaller and can always be open in a tab, so the autocomplete is functionally ...

But I agree with this request ;)
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Permanent include a source file with common functions et

Post by luis »

Bisonte wrote: You can store macros, structures and constants in a .res (resident) file.
With some big limitations. Well no, it isn't right. I would say for the moment it's simply broken since structures cannot contains dynamic arrays or similar dynamic objects.
"Have you tried turning it off and on again ?"
A little PureBasic review
VoSs2o0o
User
User
Posts: 24
Joined: Fri Aug 06, 2010 11:46 pm

Re: Permanent include a source file with common functions et

Post by VoSs2o0o »

Here, a similar request with a workaround - at least for me.
http://www.purebasic.fr/english/viewtop ... =3&t=50824
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: Permanent include a source file with common functions et

Post by Bisonte »

Here, a similar request with a workaround - at least for me.
viewtopic.php?f=3&t=50824
?? This trigger is not implemented yet ... (Windows) or I am blind and cannot find this trigger.
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Permanent include a source file with common functions et

Post by ts-soft »

Bisonte wrote:?? This trigger is not implemented yet ... (Windows) or I am blind and cannot find this trigger.
Do you have the next beta ? :mrgreen:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Re: Permanent include a source file with common functions et

Post by Guimauve »

Hello everyone,

A feature I would like to see in PureBasic it's Toolbox system similar to the one we have in MatLAB. In MatLAB, it's possible to set a Toolbox folder containing user defined function. At the compilation time the compiler search inside this folder for missing function before annoying the user about missing function.

In PureBasic, a similar system can handle any user defined constants, structures, macros, procedures, imports, etc. by it's self just by scanning the user defined Toolbox folder (or loading it after all standard libs).

Personally, I don't like to create residents and libs with TailBite or Moebius because each time Fred Update PureBasic, all of this stuff as to be recompiled over and over again. I have much more important things to do than recompiling these libs and res. Furthermore, on Linux with complete setup doing :

Code: Select all

sudo mv /home/guimauve/the_path/the_lib /usr/share/purebasic/purelibraries/userlibraries/the_lib
for each files it's a real pain in the ass.

So for the moment, I have created a ToolBoxManager but I still need to indicate the needed files. So it's not transparent for the user as it is in MatLAB but allow me to store all my 190 different sources files containing Imports, Structures, Procedures, etc. Personally, I can't work without this tool even if it's not perfect.

Best regards.
Guimauve
Last edited by Guimauve on Wed Aug 22, 2012 3:08 am, edited 1 time in total.
User avatar
KJ67
Enthusiast
Enthusiast
Posts: 218
Joined: Fri Jun 26, 2009 3:51 pm
Location: Westernmost tip of Norway

Re: Permanent include a source file with common functions et

Post by KJ67 »

Guimauve wrote:A feature I would like to see in PureBasic it's Toolbox system similar to the one we have in MatLAB.
+1
The best preparation for tomorrow is doing your best today.
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: Permanent include a source file with common functions et

Post by Bisonte »

ts-soft wrote:
Bisonte wrote:?? This trigger is not implemented yet ... (Windows) or I am blind and cannot find this trigger.
Do you have the next beta ? :mrgreen:
Thats what I have in mind ;)
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Permanent include a source file with common functions et

Post by Zach »

I don't see why having a template for "Xinclude filename.pbi" would not work.

I use Xinclude all the time in my project, and I use it for one file that has code to auto-kill the debugger window when I exit a test run.
The file with that code is NEVER open in my IDE.

No, you probably won't get code completion hints, but if these commands are standard enough that you use them all the time and are sick of typing them; shouldn't you know them anyway?

Although I agree having a more complete feature where we can get code-hints for include files, etc would be nice as well.

Having an option like this, could enable us to have a Standard Public Library like other languages that have code templates, and useful tools packaged by default. The community could come together and organize it as well, similar to some of the past projects people have started for "open source" code repositories. Define the coding style, how it should be commented, etc. The community could maintain an up-to-date and with new PB releases, the most recent one can be included.

It could even have an "update Library" function, where the most up-to-date file is stored on the PB web site server, and can be downloaded by IDE clients.
Post Reply