On Fri, 25 Jun 2021, at 02:37, David Crayford wrote:
> On 24/06/2021 9:44 pm, Jeremy Nicoll wrote:
> > On Thu, 24 Jun 2021, at 01:57, David Crayford wrote:
> >
> >> For example, to create and ISPF in Lua you instantiate and ISPF object
> >> and then communicate with it by calling methods
> >> https://lua4z.github.io/Lua4z/modules/ispf.html.
> > That shows eg that you can invoke ispf edit via lua. But can you use lua
> > to tell ispf edit to run a macro (written in lua) and can that macro issue
> > ispf editor commands, and also display ispf panels (eg to find out what
> > the macro should do or display its results) and issue tso commands?
>
> Yes to all. Here's an example. The 'ispf.bind' function uses VDEFINE to
> map ISPF variables to the vars table.
Thanks for the example.
> local ispexec = ispf.ispexec
Is the righthand part of that specifying the ispexec 'method' of an 'ispf'
class (or however lua names such concepts)?
> local isredit = function (cmd) return ispexec("ISREDIT " .. cmd) end
... and that says that in the code below that: isredit <string> returns
whatever ispexec "ISREDIT" || <string> would yield ... which is
presumably (perhaps) an action, and a return code?
> isredit "(LRECL) = LRECL"
> local lrecl = ispf.vcopy("LRECL")
Would that place the current file's lrecl in the ispf variable named
LRECL then copy that value to the lua program's same-named
variable?
If so, this is a lot more like writing an ispf application in assembler
than rexx - it may work, but it's a lot more cumbersome having to
move stuff between one's own local storage and the ispf variable
pools. REXX may well (must?) be doing that under the covers in its
address ispexec (etc) envronments but freeing the programmer
from having to do it makes things easy in REXX.
It also means that the lua code presumably has to do some initial
allocation of memory to hold variables whose maximum length
a REXX programmer needn't worry about -- like your ispf.bind
vdefine-ing "line", as "charbuf" of length lrecl ... which also
shows that you need to specify "charbuf" or "char" or whatever
else makes sense in lua - something else the REXX programmer
needn't think about.
> > How about replacing REXX in eg Netview?
>
> Does Netview support C/C++?
I don't know.
--
Jeremy Nicoll - my opinions are my own.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN