Am 30.07.19 um 10:03 schrieb Riccardo (Jack) Lucchetti:
On Tue, 30 Jul 2019, Artur Tarassow wrote:
>> <hansl>
>> pkg info armax
>> bundle b = $result
>> </hansl>
>>
>
> Looks good to me ;-) Let's see what others have to say on this.
Or we could simply use a function with an optional argument for
non-standard locations:
This is an extended version which also works for packages in a separate
folder:
<hansl>
function bundle pkginfo(string name, string location[null])
string dir = exists(location) ? location : "@dotdir/functions/"
strings pkgfiles = array(2)
pkgfiles[1] = dir ~ name ~ ".gfn"
pkgfiles[2] = dir ~ name ~ "/" ~ name ~ ".gfn"
bundle ret = null
loop i=1..nelem(pkgfiles) --quiet
catch xmldata = readfile(pkgfiles[i])
if $error
printf "Warning: Package file %s not found or
unreadable\n", pkgfiles[i]
if i==nelem(pkgfiles)
return ret
endif
else
string pkgfile = pkgfiles[i]
break
endif
endloop
loop foreach i version tags date --quiet
ret.$i = xmlget(xmldata,
"/gretl-functions/gretl-function-package/$i")
endloop
return ret
end function
eval pkginfo("FEP")
</hansl>
Maybe we should put this function into extra.gfn...
Artur