a new include command

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
minirop
User
User
Posts: 24
Joined: Tue Nov 28, 2006 12:21 am

a new include command

Post by minirop »

hi !
It would be great if including a file was made from the "includer" and not from the root file like in C.
example :
my files are :
main.pb
include\one.pb
include\two.pb

if one.pb include two.pb like this :
IncludeFile "two.pb"
and if in main.pb I do :
IncludeFile "one.pb"
PB will look for :
%DIR%\two.pb and not for %DIR%\include\two.pb
++

edit :
or create "include paths" and includeFile will look in each paths referenced for the file
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

There's the command

Code: Select all

IncludePath
:!:
I may look like a mule, but I'm not a complete ass.
minirop
User
User
Posts: 24
Joined: Tue Nov 28, 2006 12:21 am

Post by minirop »

srod wrote:There's the command

Code: Select all

IncludePath
:!:
I know it, i'ts not what I looking for, but I managed to solve the problem by putting the "include path" in "one.pb"
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Create a directory in the PB-Folder like "Includes" for standard-includes

Code: Select all

XIncludeFile #PB_Compiler_Home + "Includes\one.pb"
So no problems with the path.
See: http://www.purebasic.fr/english/viewtop ... ncludepack
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
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

A way to set default include path in IDE prefs would be nice.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

Rescator wrote:A way to set default include path in IDE prefs would be nice.
second!
oh... and have a nice day.
minirop
User
User
Posts: 24
Joined: Tue Nov 28, 2006 12:21 am

Post by minirop »

and add a "include" directory and a command to fetch the file in it like in C or C++ :D
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Kaeru Gaman wrote:
Rescator wrote:A way to set default include path in IDE prefs would be nice.
second!
Third!
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Re: a new include command

Post by Dummy »

minirop wrote:hi !
It would be great if including a file was made from the "includer" and not from the root file like in C.
example :
my files are :
main.pb
include\one.pb
include\two.pb

if one.pb include two.pb like this :
IncludeFile "two.pb"
and if in main.pb I do :
IncludeFile "one.pb"
PB will look for :
%DIR%\two.pb and not for %DIR%\include\two.pb
++

edit :
or create "include paths" and includeFile will look in each paths referenced for the file
It's really annoying how it works right now but changing this now will break all my codes xD
Tipperton
Addict
Addict
Posts: 1286
Joined: Thu Jun 19, 2003 7:55 pm

Post by Tipperton »

Kaeru Gaman wrote:
Rescator wrote:A way to set default include path in IDE prefs would be nice.
second!
third!

Further:

Being able to set multiple include paths like this:

Code: Select all

c:\includes1;c:\includes2
would be nice.

To avoid breaking current set ups, the compiler could first look in the source file's directory for the file, and only search the paths if the include file doesn't exist there. Or users could just set up the include paths as:

Code: Select all

.;c:\includes1;c:\includes2
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Hey Fred! And all others!

I know, if you double click on a (X)IncludeFile, the include file will be opened in a new tab.

What about a include command, that advises the IDE automatically to open the include, when the main maodule is being loaded? This can be useful, when your source has got several thousand lines and you've got include commands all over the code.

What do you think? This possibility makes you able to load all dependant files, belonging to the project when just opening the main file.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

AND51 wrote:Hey Fred! And all others!

I know, if you double click on a (X)IncludeFile, the include file will be opened in a new tab.

What about a include command, that advises the IDE automatically to open the include, when the main maodule is being loaded? This can be useful, when your source has got several thousand lines and you've got include commands all over the code.

What do you think? This possibility makes you able to load all dependant files, belonging to the project when just opening the main file.
use JaPBe it has this feature in another way. Search for *.pbfl files ;)
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

The IDE will get proper project management someday as well. This makes more sense than a special command for this.
quidquid Latine dictum sit altum videtur
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

freak wrote:The IDE will get proper project management someday as well. This makes more sense than a special command for this.
Hi Timo,

that's very good news indeed! In that case, please also include some sort of version control. I don't need a complete VCS. Something along the lines of what LCCWin32's WEdit offers would do quite nicely.
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

AND51 wrote: What do you think? This possibility makes you able to load all dependant files, belonging to the project when just opening the main file.
See here: http://www.purebasic.fr/german/viewtopi ... 379#146379
The Selfmade-Man :wink:
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
Post Reply