home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / rxgen_459.lzh / Rxgen / rexx / port.rexx < prev    next >
OS/2 REXX Batch file  |  1991-02-18  |  2KB  |  52 lines

  1. /* AREXX Program */
  2. /* I let you find out how to get out of this program
  3.    easily.
  4.    Answer at the end of the file (may not be really clean...)
  5. */
  6. LIBRARIES.exec = '00 00 00 00'x
  7. LIBRARIES.exec.OPENCOUNT = 0
  8. LIBS.exec.FindPort='FE7A'x||S||'200A'x
  9. LIBS.exec.AddPort='FE9E'x||A||'200A'x
  10. LIBS.exec.RemPort='FE98'x||A||'200A'x
  11. LIBS.exec.PutMsg='FE92'x||AA||'20090A'x
  12. LIBS.exec.GetMsg='FE8C'x||A||'2009'x
  13. LIBS.exec.ReplyMsg='FE86'x||A||'200A'x
  14. LIBS.exec.WaitPort='FE80'x||A||'2009'x
  15. LIBS.exec.AllocMem='FF3A'x||IA||'200102'x
  16. LIBS.exec.FreeMem='FF2E'x||AI||'200A01'x
  17. LIBS.exec.Wait='FEC2'x||A||'2001'x
  18.  
  19. /* Note that we are going to mix AREXX support functions
  20.    and rxgen functions
  21. */
  22. PORTNAME = 'TESTPORT'
  23. call GenOpenLib("exec",0)
  24. myport = GenACall("exec","FindPort",PORTNAME)
  25. if myport = NULL() then do
  26.     theport = OPENPORT(PORTNAME)
  27.     myport = GenACall("exec","FindPort",PORTNAME)
  28.     sigbitraw = import(OFFSET(myport,15),1)
  29.     sigbit = c2d(sigbitraw)
  30.     say "Signal Bit:" sigbit
  31.     if myport = NULL() then do
  32.                                 say "Can't create port"
  33.                                 exit 1
  34.                             end
  35.     else do 10
  36.             msg = GenACall("exec","Wait",bitset(NULL(),sigbit))
  37.             say "Wait returned"
  38.             do msgloop=0
  39.                 msg = GenACall("exec","GetMsg",myport)
  40.                 if msg = null() then leave msgloop
  41.                 call GenACall("exec","ReplyMsg",msg)
  42.             end
  43.          end
  44.     end
  45. call GenCloseLib("exec")
  46. call CLOSEPORT(PORTNAME)
  47.  
  48. /* did you find out ? */
  49. /* here you are:
  50.    rx "do forever; address TESTPORT; end"
  51. */
  52.