Event Handler when Functions are Modified

General discussions on potential enhancements to the APL+Win system.

Event Handler when Functions are Modified

Postby karenkazun » December 13th, 2012, 4:55 pm

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!
karenkazun
 

Re: Event Handler when Functions are Modified

Postby Tech Support » December 17th, 2012, 12:29 pm

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.
Tech Support
 
Posts: 1230
Joined: February 10th, 2007, 7:33 am
Location: Rockville, MD

Re: Problem with APL 12.1.02 Support

Postby karenkazun » December 19th, 2012, 3:50 pm

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!
karenkazun
 

Re: Event Handler when Functions are Modified

Postby Tech Support » December 20th, 2012, 11:46 am

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.
Tech Support
 
Posts: 1230
Joined: February 10th, 2007, 7:33 am
Location: Rockville, MD

Re: Event Handler when Functions are Modified

Postby karenkazun » December 20th, 2012, 12:23 pm

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.
karenkazun
 

Re: Event Handler when Functions are Modified

Postby Tech Support » December 20th, 2012, 12:46 pm

Try WNetGetUser in place of WNetGetUserA.
Tech Support
 
Posts: 1230
Joined: February 10th, 2007, 7:33 am
Location: Rockville, MD

Re: Event Handler when Functions are Modified

Postby brent hildebrand » December 20th, 2012, 1:49 pm

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
    ∇
brent hildebrand
 
Posts: 538
Joined: February 12th, 2007, 5:53 pm
Location: Loma Linda, CA

Re: Event Handler when Functions are Modified

Postby karenkazun » December 20th, 2012, 3:05 pm

Thanks!
karenkazun
 


Return to APL+Win Wish-List

Who is online

Users browsing this forum: No registered users and 15 guests

cron