home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / SYSTEM.$$$ / VRDISKI.VRM < prev    next >
Text File  |  1993-09-01  |  5KB  |  208 lines

  1. /* Custom mainline for macro */
  2.  
  3.     call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
  4.     call VRLoadFuncs
  5.  
  6.     _VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
  7.     if( _VREVersion < 1.01 )then do
  8.         call VRMessage "", "This program requires VX-REXX version 1.01 to run", "Error!"
  9.         _VREReturnValue = 32000
  10.         signal _VRELeaveMain
  11.     end
  12.  
  13.     signal on SYNTAX name _VRESyntax
  14.     signal _VREMain
  15.  
  16. _VRESyntax:
  17.     parse source . . _VRESourceSpec
  18.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
  19.     _VREReturnValue = 32000
  20.     signal _VRELeaveMain
  21.  
  22. _VREMain:
  23. /*:VRX         Main
  24. */
  25. /*  Main
  26. */
  27. Main:
  28. /*  Process the arguments.
  29.     Get the parent window.
  30. */
  31.     parse source . calledAs .
  32.     parent = ""
  33.     argCount = arg()
  34.     argOff = 0
  35.     if( calledAs \= "COMMAND" )then do
  36.         if argCount >= 1 then do
  37.             parent = arg(1)
  38.             argCount = argCount - 1
  39.             argOff = 1
  40.         end
  41.     end
  42.     InitArgs.0 = argCount
  43.     if( argCount > 0 )then do i = 1 to argCount
  44.         InitArgs.i = arg( i + argOff )
  45.     end
  46.     drop calledAs argCount argOff
  47.  
  48. /*  Load the windows
  49. */
  50.     call VRInit
  51.     parse source . . spec
  52.     _VREPrimaryWindowPath = ,
  53.         VRParseFileName( spec, "dpn" ) || ".VRW"
  54.     _VREPrimaryWindow = ,
  55.         VRLoad( parent, _VREPrimaryWindowPath )
  56.     drop parent spec
  57.     if( _VREPrimaryWindow == "" )then do
  58.         call VRMessage "", "Cannot load window:" VRError(), ,
  59.             "Error!"
  60.         _VREReturnValue = 32000
  61.         signal _VRELeaveMain
  62.     end
  63.  
  64. /*  Process events
  65. */
  66.     call Init
  67.     signal on halt
  68.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  69.         _VREEvent = VREvent()
  70.         interpret _VREEvent
  71.     end
  72. _VREHalt:
  73.     _VREReturnValue = Fini()
  74.     call VRDestroy _VREPrimaryWindow
  75. _VRELeaveMain:
  76.     call VRFini
  77. exit _VREReturnValue
  78.  
  79. VRLoadSecondary: procedure
  80.     name = arg( 1 )
  81.  
  82.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  83.     call VRMethod window, "CenterWindow"
  84.     call VRSet window, "Visible", 1
  85.     call VRMethod window, "Activate"
  86. return window
  87.  
  88. /*:VRX         Comments
  89. */
  90. Comments:
  91. /*  
  92.     DrivFunc: Generate a prototype for drive functions
  93.  
  94.     Usage:  call DrivFunc <Parent>, <Object>, <Function>
  95.  
  96.     Where:  Parent is the parent window for the dialog
  97.         
  98.             Object is the name or id of the object ("").
  99.  
  100.             Function is the function that is using this macro.
  101. */
  102. return
  103.  
  104. /*:VRX         Error
  105. */
  106. Error: procedure
  107.     field = arg( 1 )
  108.     error = arg( 2 )
  109.     call VRMessage VRWindow(), error, "Error"
  110.     call VRMethod field, "SetFocus"
  111. return
  112.  
  113. /*:VRX         Fini
  114. */
  115. Fini:
  116.     window = VRWindow()
  117.     call VRSet window, "Visible", 0
  118.     drop window
  119. return Prototype
  120.  
  121. /*:VRX         Halt
  122. */
  123. Halt:
  124.     signal _VREHalt
  125. return
  126.  
  127. /*:VRX         Init
  128. */
  129. Init:
  130.  
  131.     Prototype = ""
  132.  
  133.     infotype.1 = "Available clusters"
  134.     infotype.2 = "Bytes per sector"
  135.     infotype.3 = "Clusters on whole disk"
  136.     infotype.4 = "Free bytes"
  137.     infotype.5 = "Sectors per cluster"
  138.     infotype.6 = "Total bytes"
  139.     infotype.7 = "Used bytes"
  140.     infotype.0 = 7
  141.  
  142.     call VRMethod "Info", "AddStringList", "infotype."
  143.     call VRSet "Info", "Value", infotype.1
  144.  
  145.     window = VRWindow()
  146.     call VRMethod window, "CenterWindow"
  147.     call VRSet window, "Visible", 1
  148.     call VRMethod window, "Activate"
  149.     drop window
  150.  
  151. return
  152.  
  153. /*:VRX         PB_1_Click
  154. */
  155. PB_1_Click:
  156.  
  157.     info = VRGet( "Info", "Value" )
  158.     info = '"' || Left( info, 1 ) || '"'
  159.  
  160.     value = VRGet( "Drive", "Value" )
  161.  
  162.     quotes = VRGet( "Quotes", "Set" )
  163.     if quotes = 1 then do
  164.         if Lastpos( ":", value ) \= 2 | Length( value ) \= 2 then do
  165.             call Error "Drive", "Drive must be a drive letter followed by a colon."
  166.             return
  167.         end
  168.         value = '"' || value || '"'
  169.     end
  170.  
  171.     Prototype = 'info = VRDiskInfo( ' ||,
  172.                               info ||,
  173.                               ', ' || value ||,
  174.                               ' )'
  175.  
  176.     call Quit
  177.  
  178. return
  179.  
  180. /*:VRX         PB_2_Click
  181. */
  182. PB_2_Click:
  183.     rc = ""
  184.     call Quit
  185. return
  186.  
  187. /*:VRX         PB_3_Click
  188. */
  189. PB_3_Click:
  190.     "view a2z.inf VRDiskInfo function"
  191. return
  192.  
  193. /*:VRX         Quit
  194. */
  195. Quit:
  196.     window = VRWindow()
  197.     call VRSet window, "Shutdown", 1
  198.     drop window
  199. return
  200.  
  201. /*:VRX         Window1_Close
  202. */
  203. Window1_Close:
  204.     rc = ""
  205.     call Quit
  206. return
  207.  
  208.