home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Rice_CMS / gopher24 / gopclist.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-01-22  |  3.4 KB  |  92 lines

  1. /*
  2.  *        Name: GOPCLIST REXX
  3.  *              VM TCP/IP Network GOPHER Client transaction status
  4.  *      Author: Rick Troth, Rice University, Information Systems
  5.  *        Date: 1993-Jan-12
  6.  *
  7.  *       Input: zero or more connection status messages
  8.  *      Output: -none-
  9.  */
  10.  
  11. /*
  12.  *      Copyright 1992 Richard M. Troth.   This software was developed
  13.  *      with resources provided by Rice University and is intended
  14.  *      to serve Rice's user community.   Rice has benefitted greatly
  15.  *      from the free distribution of software,  therefore distribution
  16.  *      of unmodified copies of this material is not restricted.
  17.  *      You may change your own copy as needed.   Neither Rice
  18.  *      University nor any of its employees or students shall be held
  19.  *      liable for damages resulting from the use of this software.
  20.  */
  21.  
  22. Trace "OFF"
  23.  
  24. /*  sync with input  */
  25. 'PEEKTO'
  26. If rc ^= 0 Then Exit rc * (rc ^= 12)
  27.  
  28. /*  abort if we're not in a 370 mode machine  */
  29. Parse Value Diag(08,'QUERY SET') With . "MACHINE" mach . ',' . '15'x .
  30. If mach ^= "370" & mach ^= "" Then Do
  31.     'CALLPIPE *: | HOLE'
  32.     Exit rc
  33.     End  /*  If  ..  Do  */
  34.  
  35. /*  fetch fs. stem variable from GlobalVs  */
  36. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,
  37.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'
  38. If ^Datatype(fs.tube,'X') Then fs.tube = ""
  39.  
  40. /*  prepare for dynamic connection statistics  */
  41. _wid = fs.scrcols - 2
  42. _sba = c2x(sba(1,-1) || '1D60'x)
  43.  
  44. 'CALLPIPE *: | CHOP ' _wid '| PAD' _wid ,
  45.        '| SPEC /00C3' || _sba || '/ X2C 1 1-* NEXT' ,
  46.        '| FULLSCR' fs.tube 'NOREAD | HOLE'
  47.  
  48. Exit rc
  49.  
  50.  
  51.  
  52. /* ----------------------------------------------------------------- SBA
  53.  *  (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)
  54.  *  Construct Set Buffer Address order from row and column.
  55.  */
  56.  
  57. SBA:      Procedure Expose fs.
  58.  
  59. arg row , col, .
  60. row = Trunc(row)
  61. col = Trunc(col)
  62.  
  63. /*-----------------------------------------------------------------*/
  64. /* Calculate binary address.                                       */
  65. /*-----------------------------------------------------------------*/
  66.  
  67. offset = row * fs.scrcols + col
  68. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End
  69.  
  70. if fs.14bit then return '11'x || d2c(offset,2)
  71.  
  72. /*-----------------------------------------------------------------*/
  73. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/
  74. /*-----------------------------------------------------------------*/
  75.  
  76. 'CALLPIPE var offset'               ,   /* Start with char number.    */
  77.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */
  78.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */
  79.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */
  80.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */
  81.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */
  82.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */
  83.                 '01-09 C1-C9'       ,   /*   buffer address.          */
  84.                 '11-19 D1-D9'       ,   /*                            */
  85.                 '22-29 E2-E9'       ,   /*                            */
  86.                 '30-39 F0-F9'       ,   /*                            */
  87.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */
  88.     '| var offset'                      /* Put back in variable.      */
  89.  
  90. Return offset
  91.  
  92.