Page 1 of 1
Permanent include a source file with common functions etc.
Posted: Thu Aug 16, 2012 8:12 pm
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
Re: Permanent include a source file with common functions et
Posted: Thu Aug 16, 2012 9:36 pm
by IdeasVacuum
Well, that's only one line, Xinclude "my file.pbi" and you can store that one-liner as a template.
Re: Permanent include a source file with common functions et
Posted: Fri Aug 17, 2012 6:42 am
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.
Re: Permanent include a source file with common functions et
Posted: Fri Aug 17, 2012 6:54 am
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.
Re: Permanent include a source file with common functions et
Posted: Fri Aug 17, 2012 7:41 am
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

Re: Permanent include a source file with common functions et
Posted: Fri Aug 17, 2012 12:09 pm
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.
Re: Permanent include a source file with common functions et
Posted: Mon Aug 20, 2012 10:14 am
by VoSs2o0o
Here, a similar request with a workaround - at least for me.
http://www.purebasic.fr/english/viewtop ... =3&t=50824
Re: Permanent include a source file with common functions et
Posted: Mon Aug 20, 2012 10:39 am
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.
Re: Permanent include a source file with common functions et
Posted: Mon Aug 20, 2012 10:44 am
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 ?

Re: Permanent include a source file with common functions et
Posted: Mon Aug 20, 2012 11:22 am
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
Re: Permanent include a source file with common functions et
Posted: Mon Aug 20, 2012 11:45 am
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
Re: Permanent include a source file with common functions et
Posted: Mon Aug 20, 2012 12:23 pm
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 ?

Thats what I have in mind

Re: Permanent include a source file with common functions et
Posted: Wed Aug 22, 2012 1:13 am
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.