Re: [fpc-pascal] uses in '' relative paths

2020-10-08 Thread Ryan Joseph via fpc-pascal


> On Oct 7, 2020, at 11:15 AM, Ryan Joseph  wrote:
> 
> Some interesting stuff here, thanks. Almost there but for some reason 
> Scanner.pas is not found even though it's in the same directory as 
> TOMLParser.pas. The compiler did find TOMLParser despite /sources not being 
> explicitly included as -Fu option.
> 
> 
> unit TOMLParser;
> interface
> uses
>  Classes, 
>  Scanner,// error: Can't find unit Scanner used by TOMLParser
>  TOMLTypes;

what does {$unitpath sources} do exactly in the file below? I assumed it added 
/sources to the directory the current file is in and then added that to the 
unit path like -Fu. If I omit the "in" part it still finds the units in 
/sources BUT then units in /sources can't find out units in /sources. For 
example TOMLParser can't find TOMLTypes even though they're in the same 
directory.

{$mode objfpc}
{$unitpath sources}

unit TOML;
interface
uses
  TOMLParser,
  TOMLTypes;


Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] uses in '' relative paths

2020-10-08 Thread Mattias Gaertner via fpc-pascal
On Thu, 8 Oct 2020 09:37:06 -0300
"Marcos Douglas B. Santos via fpc-pascal"
 wrote:

>[...]
> > > unit TOML;
> > > interface
> > > uses
> > >   TOMLParser in '/sources',
> > >   TOMLTypes in '/sources';  
> >
> > uses
> >   TOMLParser in 'sources/TOMLParser.pas',
> >   TOMLTypes in 'sources/TOMLTypes.pas';
> >
> > Not Delphi compatible.  
> 
> I think this works even on Delphi 7...

Delphi allows it only in program, not in unit.

Mattis

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] uses in '' relative paths

2020-10-08 Thread Marcos Douglas B. Santos via fpc-pascal
On Wed, Oct 7, 2020 at 2:02 PM Mattias Gaertner via fpc-pascal
 wrote:
>
> On Wed, 7 Oct 2020 10:53:16 -0600
> Ryan Joseph via fpc-pascal  wrote:
>
> > I'm trying "uses in" which I never knew existed before.
> >
> > The idea is that I provide a path to TOML.pas using -Fu then use the
> > "in" syntax to reference the units which are in a subdirectory. This
> > makes it safe from the project importing the unit so any private
> > units in the subdirectory don't override units from the importing
> > project.
> >
> > unit TOML;
> > interface
> > uses
> >   TOMLParser in '/sources',
> >   TOMLTypes in '/sources';
>
> uses
>   TOMLParser in 'sources/TOMLParser.pas',
>   TOMLTypes in 'sources/TOMLTypes.pas';
>
> Not Delphi compatible.

I think this works even on Delphi 7...

best regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] uses in '' relative paths

2020-10-07 Thread Ryan Joseph via fpc-pascal


> On Oct 7, 2020, at 11:02 AM, Mattias Gaertner via fpc-pascal 
>  wrote:
> 
> Only in FPC:
> 
> {$unitpath sources}
> interface
> uses
>  TOMLParser, TOMLTypes;

Some interesting stuff here, thanks. Almost there but for some reason 
Scanner.pas is not found even though it's in the same directory as 
TOMLParser.pas. The compiler did find TOMLParser despite /sources not being 
explicitly included as -Fu option.


unit TOMLParser;
interface
uses
  Classes, 
  Scanner,// error: Can't find unit Scanner used by TOMLParser
  TOMLTypes;

We get to TOMLParser like this:


unit TOML;
interface
uses
  TOMLParser in 'sources/TOMLParser.pas',


Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] uses in '' relative paths

2020-10-07 Thread Mattias Gaertner via fpc-pascal
On Wed, 7 Oct 2020 10:53:16 -0600
Ryan Joseph via fpc-pascal  wrote:

> I'm trying "uses in" which I never knew existed before.
> 
> The idea is that I provide a path to TOML.pas using -Fu then use the
> "in" syntax to reference the units which are in a subdirectory. This
> makes it safe from the project importing the unit so any private
> units in the subdirectory don't override units from the importing
> project.
> 
> unit TOML;
> interface
> uses
>   TOMLParser in '/sources',
>   TOMLTypes in '/sources';

uses
  TOMLParser in 'sources/TOMLParser.pas',
  TOMLTypes in 'sources/TOMLTypes.pas';

Not Delphi compatible.
 
> This doesn't seem to be working however. I was hoping that I could
> then omit an extra -Fu flag to the subdirectory "/sources" thus
> making it easier to include the main unit but maybe that's not how
> the "uses in" syntax works. 

Only in FPC:

{$unitpath sources}
interface
uses
  TOMLParser, TOMLTypes;

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal