[Gambas-user] Updated Scripter to allow Lib to be included

Brian G brian at westwoodsvcs.com
Sun Feb 23 21:34:51 CET 2020


OK I have attached and updated copy of Scripter for review

Added --warnings
Added ignore all lines except the last returned by compiler, so warning do not stop script from running

Added Library support as outlined
 - looks for a : in the name to identify libraries
 - allows / at beginning to identify full paths
 - searched ~/.local/share/gambasV/lib/vendor/library:x.x          - first
 - searches /usr/lib/gambasV/vendor/library:x.x                    - second

note V = version number

Added support for default minor versions
 -    vendor.library:major.minor
 -    vendor.library:major     - this will pick up the latest minor version of the library

Added always includes full path name in the Library= in the .project file

Note:
    The make installation package keeps the file name upper/lower case, this should probably be changed so that
    user does not have to remember what case the library name contained. I think components already do this.

    Maybe it would be possible to store the fast/compiled version in the library as well?

    An install package also deletes any older version.This may be an issue if older apps are depending on an interface in production.
    Perhaps not deleting older lib version would be a good idea?

Hope this is a little better

If this is ok, I will try to do a merge correctly! LOL

Brian G

----- Original Message -----
From: "Benoît Minisini" <g4mba5 at gmail.com>
To: "Gambas mailing list" <user at lists.gambas-basic.org>
Sent: Saturday, February 22, 2020 1:15:06 PM
Subject: Re: [Gambas-user] Updated Scripter to allow Lib to be included

Le 22/02/2020 à 20:07, Brian G a écrit :
> 2 the lib keyword is only used by the scripter, it passes the library 
> key in the project file, does not require any changes to the compiler at 
> all. The library uses a different path than the components. So I used 
> that as a way of denoting the difference. I can change to use the full 
> word library... Would that be acceptable.

The problem is that it is one more keyword, and I think we can get rid 
of it. See below.

> 3 this version was not final and the exec sometimes during testing did 
> not stop and wait in the debugger, I was trying to figure that out. Exec 
> works correctly at runtime without the debugger. I think I just 
> commented it out for testing.

Strange...

> 4 I will change that to use /&
> 5 I can change that to warnings.
> The version I sent out was a first pass, I have a lot to learn about 
> this process. Sorry
> I did decide to add the lib support after doing the support for warnings.
> I will make the changes and send it out again.
> I appreciate the feedback, I hope to do a little better next time
> My biggest concern in this version was library dependencies and how they 
> are resolved.
> 
> thank you
> brian
> 

About the "USE" keyword and libraries:

For the interpreter, there is no real difference between a component or 
a library. For it, everything is a component that can have a part in a 
binary shared library and another part in a Gambas executable.

It's the syntax of the string given in the project file that makes the 
difference.

If that string begins with a '/' or a ':', then we have a library, 
otherwise whe have a component.

For a component, the string is the component name ('gb.xxxx'), and the 
component files are searched in the Gambas system component directory 
(usually '/usr/lib/gambas3/').

If the string begins with ':', then it must have the form 
':<vendor>/<name>:<version>'. '<name>' gives you the name of the 
library, and the library path is 
'~/.local/share/gambas3/lib/<vendor>/<name>:<version>.gambas'.

If the string begins with '/', then it is the absolute path of the 
library file, and the name of the library is the name of the file 
without the extension.

The IDE does not allow to specify a library with an absolute path 
(hopefully). It's something implemented to load a library at runtime 
with the Component.Load() method.

As the syntax ':<vendor>/<name>:<version>" is hidden, and was done that 
way to be fast to parse for the interpreter, I think we can choose 
another syntax, that still can be used with the "USE" keyword.

For example:

USE "gb.xxxx" -> component
USE "<vendor>.<name>:<version>" -> library

'gbs3' can check the provided names when compiling the script.

-- 
Benoît Minisini

----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gbs3-3.14.90.tar.gz
Type: application/x-compressed-tar
Size: 28475 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200223/688b4e15/attachment-0001.bin>


More information about the User mailing list