Free Pascal Directories

classic Classic list List threaded Threaded
46 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Free Pascal Directories

Brian
Having ported a large real-time graphical application from Virtual Pascal (DPMI) to Free Pascal Linux , there is one aspect I haven't managed to overcome.

For a number of reasons Lazarus was not used , and Geany is used as the IDE , which works well.

Unlike Virtual Pascal which allowed me to put different code in separate directories , Free Pascal seems to want ALL unit files in one huge directory which makes it difficult to keep proper revision control.

For example if I decide to use fpGUI , I would like to put all the fpGUI source code into one directory and the actual application (my code) in a separate directory.

Any suggestions ?

Thanks in advance
Brian
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Michael Van Canneyt


On Tue, 30 Sep 2014, Brian wrote:

> Having ported a large real-time graphical application from Virtual Pascal
> (DPMI) to Free Pascal Linux , there is one aspect I haven't managed to
> overcome.
>
> For a number of reasons Lazarus was not used , and Geany is used as the IDE
> , which works well.
>
> Unlike Virtual Pascal which allowed me to put different code in separate
> directories , Free Pascal seems to want ALL unit files in one huge directory
> which makes it difficult to keep proper revision control.

Where did you get this idea from ?

>
> For example if I decide to use fpGUI , I would like to put all the fpGUI
> source code into one directory and the actual application (my code) in a
> separate directory.
>
> Any suggestions ?

You can perfectly do this, all my code is scattered over multiple directories.
All you need to do is add -Fu options.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

philippe sylvain levi

some days before we had same type of thread ...

the "problem" is

-Fu is not recursive!

 

 

Em 30.09.2014 11:07, Michael Van Canneyt escreveu:

On Tue, 30 Sep 2014, Brian wrote:
Having ported a large real-time graphical application from Virtual Pascal (DPMI) to Free Pascal Linux , there is one aspect I haven't managed to overcome. For a number of reasons Lazarus was not used , and Geany is used as the IDE , which works well. Unlike Virtual Pascal which allowed me to put different code in separate directories , Free Pascal seems to want ALL unit files in one huge directory which makes it difficult to keep proper revision control.
Where did you get this idea from ?
For example if I decide to use fpGUI , I would like to put all the fpGUI source code into one directory and the actual application (my code) in a separate directory. Any suggestions ?
You can perfectly do this, all my code is scattered over multiple directories.
All you need to do is add -Fu options.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

 


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Michael Van Canneyt


On Tue, 30 Sep 2014, Philippe wrote:

>
> some days before we had same type of thread ...
>
> the "problem" is
>
> -Fu is not recursive!

And luckily not. The result would be a disaster !

However, you can use wildcards:
-Fu/home/some/dir/*

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Michael Thompson
In reply to this post by philippe sylvain levi
On 30 September 2014 16:27, Philippe <[hidden email]> wrote:

some days before we had same type of thread ...

the "problem" is

-Fu is not recursive!


We're programmers.  Creating our own tools for mundane work is not a "problem" :-)
 
A few year back at my old company, for Delphi work we developed a small helper app.  We gave it a root folder, it gave us back a string containing all sub-folders in a format suitable for pasting into required Library Paths (going via a intermediate listbox so we could exclude any subfolders we didn't want - we had folders for docs for instance).  Only needed this app when configuring a new install of Delphi.  

Shouldn't take you long to generate a similar app for automating a string for -Fu.  :-)

Mike (one of the other ones)


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Sven Barth-2
In reply to this post by philippe sylvain levi
On 30.09.2014 16:27, Philippe wrote:
> some days before we had same type of thread ...
>
> the "problem" is
>
> -Fu is not recursive!

That's not what Brian asked for. He asked whether he can use multiple
directories, not whether he can use them recursively. And the former is
definitely the case.

Regards,
Sven

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Graeme Geldenhuys-6
In reply to this post by Michael Thompson
On 2014-09-30 16:47, Michael Thompson wrote:
> Shouldn't take you long to generate a similar app for automating a string
> for -Fu.  :-)

+1

:-D



Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Graeme Geldenhuys-6
In reply to this post by Brian
On 2014-09-30 14:58, Brian wrote:
> For example if I decide to use fpGUI , I would like to put all the fpGUI
> source code into one directory

fpGUI is scattered over multiple directories too, so no idea why you
thought all units must be in a single directory.

In the <fpgui>/src/ directory is a "extrafpc.cfg" file that defines
multiple source directory locations. Those include "unit" directory and
"include" directory locations.  All the demos include with fpGUI does a
similar thing.


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

leledumbo
Administrator
In reply to this post by Sven Barth-2
> That's not what Brian asked for. He asked whether he can use multiple
> directories, not whether he can use them recursively. And the former is
> definitely the case.

And indeed it's a disaster, because you might to restructure your units directory if it works recursively depending on how you layout it. Example: If under the same directory you have units for all targets you want to support, it's a hell after -Fu works recursively.
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

philippe sylvain levi

as for other points (for example "with" use/misuse) ... for me -Fu recursive, "with" statement and others may be usefull tools ... not for you!

there no absolute answer!

may be other people don't do the same kind of job I do, or you do. may they they don't work the same way I do, or you do!

abraço!

Philippe

 

Em 01.10.2014 02:30, leledumbo escreveu:

That's not what Brian asked for. He asked whether he can use multiple directories, not whether he can use them recursively. And the former is definitely the case.
And indeed it's a disaster, because you might to restructure your units
directory if it works recursively depending on how you layout it. Example:
If under the same directory you have units for all targets you want to
support, it's a hell after -Fu works recursively.



--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Free-Pascal-Directories-tp5720212p5720226.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

 


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Brian
Sorry , I wasn't specific about my problem. Using the example in the fpGUI distribution (but the following comments are not specific to fpGUI).

I want to use Geany as the IDE without using .CFG files and compiling from the commandline.

If UNITPATH is set in the main program (the fpGUI is a good example) , it will fail to find  fpg_base
helloworld.pas(27,3) Fatal: Can't find unit fpg_base used by HelloWorld

program HelloWorld;

{$mode objfpc}{$H+}

{$UNITPATH .../fpgui/fpgui-1.2/src/units/i386-linux}

if the absolute directory location is specified in the UNITPATH directive , the complier will find fpg_base but then fail to find the next unit called by fpg_base ...

Fatal: Can't find unit fpg_impl used by fpg_base

What am I missing?

Thanks in Advance
Brian
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Mattias Gaertner
On Wed, 1 Oct 2014 13:39:39 -0700 (PDT)
Brian <[hidden email]> wrote:

> Sorry , I wasn't specific about my problem. Using the example in the fpGUI
> distribution (but the following comments are not specific to fpGUI).
>
> I want to use Geany as the IDE without using .CFG files and compiling from
> the commandline.
>
> If UNITPATH is set in the main program (the fpGUI is a good example) , it
> will fail to find  fpg_base
> helloworld.pas(27,3) Fatal: Can't find unit fpg_base used by HelloWorld
>
> program HelloWorld;
>
> {$mode objfpc}{$H+}
>
> {$UNITPATH .../fpgui/fpgui-1.2/src/units/i386-linux}

You can give this directive multiple times to add all needed paths.
Or you can pass the unit paths via -Fu in Geany.

Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Brian
Mattias Gaertner wrote
On Wed, 1 Oct 2014 13:39:39 -0700 (PDT)
Brian <[hidden email]> wrote:

> Sorry , I wasn't specific about my problem. Using the example in the fpGUI
> distribution (but the following comments are not specific to fpGUI).
>
> I want to use Geany as the IDE without using .CFG files and compiling from
> the commandline.
>
> If UNITPATH is set in the main program (the fpGUI is a good example) , it
> will fail to find  fpg_base
> helloworld.pas(27,3) Fatal: Can't find unit fpg_base used by HelloWorld
>
> program HelloWorld;
>
> {$mode objfpc}{$H+}
>
> {$UNITPATH .../fpgui/fpgui-1.2/src/units/i386-linux}

You can give this directive multiple times to add all needed paths.
Or you can pass the unit paths via -Fu in Geany.

Mattias

Thanks Mattias , I understand how to add the directive multiple times .

Do you have an example of how you can pass the unit paths via -Fu in Geany ?

Thanks in advance
Brian
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Mattias Gaertner
On Wed, 1 Oct 2014 15:16:13 -0700 (PDT)
Brian <[hidden email]> wrote:

>[...]
> > Do you have an example of how you can pass the unit paths via -Fu in Geany
> > ?

If you don't know how to do this in Geany, maybe it is not a good
editor choice for you.

You use the command line from the terminal:
fpc -Fufpgui/fpgui-1.2/src/units/i386-linux -Fu... yourprogram.pas
And put it into the build commands.

Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Graeme Geldenhuys-6
On 2014-10-01 23:46, Mattias Gaertner wrote:
> fpc -Fufpgui/fpgui-1.2/src/units/i386-linux -Fu... yourprogram.pas
> And put it into the build commands.

And just to clarify for Brian.... the *.cfg file is simply a text file
containing one FPC command line parameter per line. You then only need
to reference two command line parameters when compiling your program,
instead of a complex loooong command.

Example usage:
   fpc @extrafpc.cfg yourprogram.pas


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Brian
Thanks for all the commandline suggestions , but my question is about using Geany as the IDE , not running the compiler from the commandline. BTW : I only use fpGUI as an example to illustrate the issue.

Using Geany as the IDE :
The FPC documentation is not correct :
1.3.38 $UNITPATH : Specify unit path.
http://www.freepascal.org/docs-html/prog/progsu121.html#x129-1300001.3.38

If the directive is added (below) to the main program FPC will fail to find the unit directory i386-linux.
{$UNITPATH .../fpgui/fpgui-1.2/src/units/i386-linux}

To make it work you must include the absolute directory path such as :
{$UNITPATH /home/mydir/fpgui/fpgui-1.2/src/units/i386-linux}  and then it only finds the first unit in the uses list and cannot find the rest of the units in i386-linux.

Why doesn't FPC continue to look for units in the directory specified by $UNITPATH ?

Regards
Brian

Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Jonas Maebe-2

On 02 Oct 2014, at 15:30, Brian wrote:

> Thanks for all the commandline suggestions , but my question is  
> about using
> Geany as the IDE , not running the compiler from the commandline.

Geany itself will call the compiler via the command line, so it  
presumably has ways to specify additional command line options.

> If the directive is added (below) to the main program FPC will fail  
> to find
> the unit directory i386-linux.
> {$UNITPATH .../fpgui/fpgui-1.2/src/units/i386-linux}

Note that "..." is not a valid directory specifier. Also note that if  
you use a relative path, it should be relative to the location of the  
source file (and not relative to e.g. the top level directory of your  
project).

> To make it work you must include the absolute directory path such as :
> {$UNITPATH /home/mydir/fpgui/fpgui-1.2/src/units/i386-linux}  and  
> then it
> only finds the first unit in the uses list and cannot find the rest  
> of the
> units in i386-linux.
>
> Why doesn't FPC continue to look for units in the directory  
> specified by
> $UNITPATH ?

Tell Geany to pass the command line option -vtu to the compiler. The  
compiler will then print out which directories it searches for which  
unit files.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Brian
Jonas , thanks very much as I now see what is happening.

FPC only searches the specific directory and not any lower level directories. In this case the unit called is in a lower level directory.

Is there any way using Geany to add $UNITPATH directives in the main program or path info in Geany so FPC is able to find the required units?

Thanks
Brian

Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Michael Van Canneyt


On Thu, 2 Oct 2014, Brian wrote:

> Jonas , thanks very much as I now see what is happening.
>
> FPC only searches the specific directory and not any lower level
> directories. In this case the unit called is in a lower level directory.
>
> Is there any way using Geany to add $UNITPATH directives in the main program
> or path info in Geany so FPC is able to find the required units?

your best bet it to use a wildcard:

-Fu/path/to/my/dir/*

or, presumably:

{$UNITPATH /path/to/my/dir/* }

this will only search 1 level below 'dir', but maybe this is enough for your situation ?

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Free Pascal Directories

Brian
Thanks Michael.

Jonas tip allows me to see what is happening when using Geany. In the case of fpGUI , the fpmake creates all the .ppu and .o files and places them in directory ../i386-linux.

Using either the wildcard * or absolute name of the directory is ok . The compiler finds (in this example)  fpg_base but then wants to get the next unit (fpg_impl) called in fpg_base , but seems to expect the .pas file rather than just using the .ppu and .o files that have already been compiled.

It is as if the compiler is trying to build rather than just linking the existing compiled .ppu and .o  files.

Searching file /usr/lib/fpc/2.6.4/fpg_impl.pas... not found
Fatal: Can't find unit fpg_impl used by fpg_base

Is there any way to tell the compiler to just link existing .ppu and .o files ?

Thanks
Brian
123