Page 1 of 1

Event Handler when Functions are Modified

PostPosted: December 13th, 2012, 4:55 pm
by karenkazun
I'm sorry if this already exists, but I couldn't find anything relating to it:

Is there some sort of state indicator/event handler that can be used to trigger when functions are changed? The only thing I was able to find was quad at, which could be used to tell when a function is last saved.

Background:
At the company I'm with, we're trying to implement unified code management practices. We would like to add a process which will prompt the user for documentation every time a function is changed (the user wouldn't need to input anything, and would be able to turn off these prompts). The vision that I have of the prompt would probably be in an APL interface form, and would have spots designated for structured documentation, which would then get added to the function itself using quad cr and quad def.

For this to work the way I'm envisioning, I would need an event handler that would trigger when a function changes, and there would be a way to identify which function changed. This may be an odd-ball request, but any feedback would be greatly appreciated.

Thanks!

Re: Event Handler when Functions are Modified

PostPosted: December 17th, 2012, 12:29 pm
by Tech Support
The APL+Win session includes events on the system object ('#') that respond to
dynamic loading and saving of functions and variables in the session manager
editor window. One or more of these events may assist you in your project. For the
details on these events, please refer to the event handlers: onEditEnd, onEditLoad,
onEditSaved and onEditStart in Chapter 3 of the v12 Windows Reference Manual.

There is also the sessions property on the system object to detect under program
control changes in the session manager editor window and the GetSession method,
also on the system object, that returns a function vector representation (⎕VR),
character array, character vector, or numeric array for an editor session. They
may also be useful in project. Both, the sessions property and the GetSessions method,
are described in the v12 Windows Reference Manual, on pages 226 and 351, respectively.

Re: Problem with APL 12.1.02 Support

PostPosted: December 19th, 2012, 3:50 pm
by karenkazun
Yes, it has! Thanks a lot. I didn't know about the '#' system object, so that quickly improved things.

We are also interested in being able to identify who is modifying functions and variables. Looking in the Systems Function Manual, I see there is a quad userid, with the result depending on the operating system and network software. For me, it returns 15 spaces. Is there some other documentation that I can look at to see how to set this up?

Or, alternatively, is there other documentation available on how I can use quad wcall to get computer information such as computer ID, or operating system information? I know how to use quad wcall 'GetSystemInfo' to get the number of processors on the machine, but I do not know what the other numbers mean. I also don't know how to access the ADF file to see what other functions are available to quad wcall.

Thanks!

Re: Event Handler when Functions are Modified

PostPosted: December 20th, 2012, 11:46 am
by Tech Support
Karen,

The command will return the name of the user currently signed in the computer:
Code: Select all
(2⊃⎕wcall 'WNetGetUserA' 0 (32⍴⎕tcnul) (,32))~⎕TCNUL

And for the version information on the operating system, see the function, WinVersion, in the
\aplwin12\tools\windows.w3 workspace.

Re: Event Handler when Functions are Modified

PostPosted: December 20th, 2012, 12:23 pm
by karenkazun
I tried this and got this error:

(2⊃⎕wcall 'WNetGetUserA' 0 (32⍴⎕tcnul) (,32))~⎕TCNUL
⎕WCALL COMMAND ERROR: Undefined function: WNetGetUserA
(2⊃⎕wcall 'WNetGetUserA' 0 (32⍴⎕tcnul) (,32))~⎕TCNUL

Where is WNetGetUserA and how do I make it a function recognizable to quad wcall?

Thanks.

Re: Event Handler when Functions are Modified

PostPosted: December 20th, 2012, 12:46 pm
by Tech Support
Try WNetGetUser in place of WNetGetUserA.

Re: Event Handler when Functions are Modified

PostPosted: December 20th, 2012, 1:49 pm
by brent hildebrand
You can also try these.
Code: Select all
    ∇ ret←GetUserName
[1]   ret←⎕wcall 'GetUserName' (256⍴' ') (,256)
[2]   :if 1=↑ret
[3]       ret←⊃↑/⌽1↓ret
[4]   :else
[5]       ret←⍬
[6]   :end
    ∇

Code: Select all
    ∇ ret←GetComputerName
[1]   ret←⎕wcall 'GetComputerName' (256⍴' ') (,256)
[2]   :if 1=↑ret
[3]       ret←⊃↑/⌽1↓ret
[4]   :else
[5]       ret←⍬
[6]   :end
    ∇

Code: Select all
    ∇ ret←WNetGetUser
[1]   ret←⎕wcall 'WNetGetUser' 0 (256/⎕tcnul) (,256)
[2]   :if 0=↑ret
[3]       ret←(⊃↑/⌽1↓ret)~⎕tcnul
[4]   :else
[5]       ret←⍬
[6]   :end
    ∇

Re: Event Handler when Functions are Modified

PostPosted: December 20th, 2012, 3:05 pm
by karenkazun
Thanks!