home *** CD-ROM | disk | FTP | other *** search
- /* WINDOW TEST -- A arexx script that opens a window via AmigaLibHost */
-
- /* USAGE: rx win <debug> */
-
- args mode
-
- /* Trace if debugging requested. */
-
- if mode ~== 'MODE' then trace ?r
-
-
- /* Access arexx host. */
-
- call ADDLIB 'AmigaLibHost',-20
-
-
- /* Ask host to open a library. */
-
- INTUITIONBASE = FINDLIB('intuition.library',0)
-
-
- /* Create a NewWindow structure in hex (!!) -- still better than BASIC. */
-
- title = 'Window Opened Via AmigaLibHost'
- titlemem = getspace(length(title)+1)
- call export(titlemem,title)
-
- /* This set of hex values corresponds to a window with close, sizing, */
- /* front/back and drag gadgets. See the Rom Kernel Manual to know what */
- /* all the bits mean. */
-
- nw = '0000 0000 0200 0080 FF FF 00000200 0002000F 00000000 00000000'X ,
- || titlemem || '00000000 00000000 0040 0020 FFFF FFFF 0001'X
-
-
- /* Prepare for OpenWindow call (use "fd2rx.rexx" to create these). */
-
- OPENWINDOW.BASE = INTUITIONBASE
- OPENWINDOW.LVO = -204
- OPENWINDOW.CALL = '(OWARGS)(A0)'
-
- /* AmigaLibHost expects numerical values, but variable nw is a string. */
- /* Need to tell AmigaLibHost that parameter OWARGS will be a string. */
-
- OPENWINDOW.OWARGS = 'STRING'
-
- /* Open the window. */
-
- win = SENDLIB('OPENWINDOW',nw)
-
- /* If didn't get a zero result, our window opened. */
-
- if win ~= 0 then do
-
-
- /* Open exec libray so we can Wait for the closebow to be clicked in. */
-
- SYSBASE = FINDLIB('exec.library',0)
-
- WAIT.BASE = SYSBASE
- WAIT.LVO = -318
- WAIT.CALL = '(SIGNALSET)(D0)'
-
-
- /* Create a signal mask for Wait() from the signal bit in the window's */
- /* UserPort message port. */
-
- userport = PEEK(win + 86,4)
- sigbit = PEEK(userport + 15,1)
- sigmask = bitset('00000000'X,sigbit)
-
- /* SIGNALSET is a 'packed' 4-byte number. */
-
- WAIT.SIGNALSET = 'LONG'
- call SENDLIB('WAIT',sigmask)
-
-
- /* Release exec base. */
-
- call DONELIB(SYSBASE)
-
-
- /* Close the window. */
-
- CLOSEWINDOW.BASE = INTUITIONBASE
- CLOSEWINDOW.LVO = -72
- CLOSEWINDOW.CALL = '(WINDOW)(A0)'
-
- call SENDLIB('CLOSEWINDOW',win)
- end
-
-
- /* Close intuition library. */
-
- call DONELIB(INTUITIONBASE)
-
- exit /* don't let 'internal functions' get executed */
-
-
- /* Peek function -- sort of like BASIC. */
-
- PEEK:
- arg location,size
- return c2d( import( d2c(location,4),size ),size )
-
-
- /* Poke function -- sort of like BASIC. */
-
- POKE:
- arg location,value,size
- call export( d2c(location,4),d2c(value,size),size )
- return
-