home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / xclasinf.zip / xclasses.INF (.txt) < prev   
OS/2 Help File  |  1998-07-16  |  27KB  |  1,211 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. The Author ΓòÉΓòÉΓòÉ
  3.  
  4.  
  5.   XCLASSES PACKAGE DOCUMENTATION 
  6.   Author: (c) P.A.Marchesini, 1998 
  7.   http://wwwinfo.cern.ch/news/netrexx/xclasses 
  8.  
  9.   Xclasses for NetRexx are Copyright 1998 by Pierantonio Marchesini of the ETH 
  10.   / Zurich 
  11.   You can copy and use this software uder the GNU GPL terms 
  12.  
  13.  
  14. ΓòÉΓòÉΓòÉ 2. The Book ΓòÉΓòÉΓòÉ
  15.  
  16.  
  17. This book is totally unauthorized, unofficial, unapproved and basically just 
  18. un. 
  19.  
  20. It is based entirely on the work by P.A.Marchesini (xclasses Author) and is 
  21. merely an INF representation of the text files provided with his xclasses. 
  22.  
  23. Comments on content, layout, syntax etc. should be sent to J. Pedone 
  24. (jpedone@flash.net).  Comments concerning the xclasses should be directed 
  25. towards Mr. P.A.Marchesini. 
  26.  
  27.  
  28. ΓòÉΓòÉΓòÉ 3. Installation/Usage ΓòÉΓòÉΓòÉ
  29.  
  30.  
  31. To install the xclasses you need to: 
  32.  
  33.      fetch "xclasses.jar" from the CERN URL (See Author) 
  34.  
  35.      copy the "xclasses.jar" in your preferred location 
  36.       (I have them in "/java/lib/xclasses.jar") 
  37.  
  38.      add this location to your CLASSPATH 
  39.       (I have a statement that says: Set 
  40.       CLASSPATH=%CLASSPATH%;/java/lib/xclasses.jar If you installed NetRexx you 
  41.       should know how to do it on your platform) 
  42.  
  43.      add the statement import xclasses. to your program, as the first sentence 
  44.  
  45.      you can find some code examples at 
  46.       http://wwwinfo.cern.ch/news/netrexx/xclasses/demo 
  47.  
  48.  
  49. ΓòÉΓòÉΓòÉ 4. The Classes ΓòÉΓòÉΓòÉ
  50.  
  51.  
  52. Related: 
  53. xarray 
  54. xcmdline 
  55. xdir 
  56. xexec 
  57. xfile 
  58. xftp 
  59. xmath 
  60. xsock 
  61. xsys 
  62. xtimer 
  63. xurl 
  64.  
  65.  
  66. ΓòÉΓòÉΓòÉ 4.1. xarray ΓòÉΓòÉΓòÉ
  67.  
  68.  
  69. Handles array operations, and, mainly byte array conversions. It's a collection 
  70. of static methods. 
  71.  
  72. NOTE: ARRAY needs to be defined as: 
  73.  
  74. an_array= rexx[NNN] 
  75. another_array = rexx[NNN] 
  76. bytearray = byte[MMM] 
  77.  
  78. Related: 
  79. init 
  80. copy 
  81. dump 
  82. ba2x 
  83. ba2c 
  84. ba2d 
  85. bagrepx 
  86. bahexdump 
  87.  
  88. Next chapter: 
  89. xcmdline 
  90.  
  91.  
  92. ΓòÉΓòÉΓòÉ 4.1.1. init ΓòÉΓòÉΓòÉ
  93.  
  94.  
  95. xarray.init(ARRAY,VALUE) 
  96.  
  97. Initializes a Rexx array ARRAY with value VALUE. 
  98.  
  99. Related: 
  100. Example 
  101.  
  102. Next chapter: 
  103. copy 
  104.  
  105.  
  106. ΓòÉΓòÉΓòÉ 4.1.1.1. Example ΓòÉΓòÉΓòÉ
  107.  
  108.  
  109. xarray.init(an_array,'test test') 
  110.  
  111.  
  112. ΓòÉΓòÉΓòÉ 4.1.2. copy ΓòÉΓòÉΓòÉ
  113.  
  114.  
  115. xarray.copy(ARRAY1,ARRAY2) 
  116.  
  117. copyes a Rexx array ARRAY1 into array ARRAY2. 
  118.  
  119. Related: 
  120. Example 
  121.  
  122. Next chapter: 
  123. dump 
  124.  
  125.  
  126. ΓòÉΓòÉΓòÉ 4.1.2.1. Example ΓòÉΓòÉΓòÉ
  127.  
  128.  
  129. xarray.copy(an_array,another_array) 
  130.  
  131.  
  132. ΓòÉΓòÉΓòÉ 4.1.3. dump ΓòÉΓòÉΓòÉ
  133.  
  134.  
  135. xarray.dump(ARRAY,ARRAYNAME) 
  136.  
  137. Dumps the entries of ARRAY on the screen; duplicate lines are skipped. 
  138.  
  139. Related: 
  140. Example 
  141.  
  142. Next chapter: 
  143. ba2x 
  144.  
  145.  
  146. ΓòÉΓòÉΓòÉ 4.1.3.1. Example ΓòÉΓòÉΓòÉ
  147.  
  148.  
  149. xarray.dump(an_array,'an_array') 
  150.  
  151.  
  152. ΓòÉΓòÉΓòÉ 4.1.4. ba2x ΓòÉΓòÉΓòÉ
  153.  
  154.  
  155. xarray.ba2x(BYTEARRAY,START,LENGTH) 
  156.  
  157. Convert byte array BYTEARRAY from byte to HEX string starting at byte START for 
  158. LENGTH bytes. 
  159.  
  160.  
  161. ΓòÉΓòÉΓòÉ 4.1.5. ba2c ΓòÉΓòÉΓòÉ
  162.  
  163.  
  164. xarray.ba2c(BYTEARRAY,START,LENGTH) 
  165.  
  166. Convert byte array BYTEARRAY from byte to CHAR string starting at byte START 
  167. for LENGTH bytes. 
  168.  
  169.  
  170. ΓòÉΓòÉΓòÉ 4.1.6. ba2d ΓòÉΓòÉΓòÉ
  171.  
  172.  
  173. xarray.ba2d(BYTEARRAY,START,LENGTH) 
  174.  
  175. Convert byte array BYTEARRAY from byte to DECIMAL string starting at byte START 
  176. for LENGTH bytes. 
  177.  
  178.  
  179. ΓòÉΓòÉΓòÉ 4.1.7. bagrepx ΓòÉΓòÉΓòÉ
  180.  
  181.  
  182. loc = xarray.bagrepx(BYTEARRAY,SEARCH,START) 
  183.  
  184. Will search in byte array BYTEARRAY the HEX string SEARCH, starting from START. 
  185.  
  186. Related: 
  187. Example 
  188.  
  189. Next chapter: 
  190. bahexdump 
  191.  
  192.  
  193. ΓòÉΓòÉΓòÉ 4.1.7.1. Example ΓòÉΓòÉΓòÉ
  194.  
  195.  
  196. ptr = xarray.bagrepx(buf,'0D0F',0) 
  197.  
  198.  
  199. ΓòÉΓòÉΓòÉ 4.1.8. bahexdump ΓòÉΓòÉΓòÉ
  200.  
  201.  
  202. xarray.bahexdump(BYTEARRAY,START,END) 
  203.  
  204. Will dump HEX the contents of bytearray BYTEARRAY 
  205.  
  206. Related: 
  207. Example 
  208.  
  209. Next chapter: 
  210. xcmdline 
  211.  
  212.  
  213. ΓòÉΓòÉΓòÉ 4.1.8.1. Example ΓòÉΓòÉΓòÉ
  214.  
  215.  
  216. fid = xfile('xarray.class') 
  217. rc = fid.readbuf() 
  218. xarray.bahexdump(fid.buffer,0,100) 
  219.  
  220.  
  221. ΓòÉΓòÉΓòÉ 4.2. xcmdline ΓòÉΓòÉΓòÉ
  222.  
  223.  
  224. use this class to parse the command line options (which, in the 
  225. UNIX convention, are entered with a '-' sign). 
  226.  
  227. Related: 
  228. xcmdline() 
  229.  
  230. Next chapter: 
  231. xdir 
  232.  
  233.  
  234. ΓòÉΓòÉΓòÉ 4.2.1. xcmdline() ΓòÉΓòÉΓòÉ
  235.  
  236.  
  237. cl = xcmdline(LINE,CONTROL) 
  238.  
  239. Where: 
  240. LINE: line entered by the user 
  241. CONTROL : defines the control sequence to parse the options the format is: 
  242. FLAG/[FLA|VAR]/VARIABLE_NAME/DEFAULT_VALUE 
  243.  
  244. Related: 
  245. Example 
  246. Notes 
  247.  
  248. Next chapter: 
  249. xdir 
  250.  
  251.  
  252. ΓòÉΓòÉΓòÉ 4.2.1.1. Example ΓòÉΓòÉΓòÉ
  253.  
  254.  
  255. cl = xcmdline(rexx(args),'t/FLA/TRACE/0' - 
  256. 'r/FLA/REPLACE/0' - 
  257. 'o/VAR/OUTFID/test.out') 
  258.  
  259. If the user types: 
  260. mytest test -ro pippo.txt 
  261.  
  262. Then: 
  263. say cl.arguments() = test 
  264. say cl.option('TRACE') = 1 
  265. say cl.option('REPLACE') = 0 
  266. say cl.option('OUTFID')= pippo.txt 
  267.  
  268.  
  269. ΓòÉΓòÉΓòÉ 4.2.1.2. Notes ΓòÉΓòÉΓòÉ
  270.  
  271.      The next release will have a syntax like PERL getopt() available too 
  272.  
  273.  
  274. ΓòÉΓòÉΓòÉ 4.3. xdir ΓòÉΓòÉΓòÉ
  275.  
  276.  
  277. Handles all operations on a directory, listing, comparing etc. 
  278.  
  279. Related: 
  280. xdir() 
  281. str_ls() 
  282.  
  283. Next chapter: 
  284. xexec 
  285.  
  286.  
  287. ΓòÉΓòÉΓòÉ 4.3.1. xdir() ΓòÉΓòÉΓòÉ
  288.  
  289.  
  290. xdir(DIRECTORY) 
  291. xdir() 
  292.  
  293. constructors. Default directory is the 
  294. current directory (".") 
  295.  
  296.  
  297. ΓòÉΓòÉΓòÉ 4.3.2. str_ls() ΓòÉΓòÉΓòÉ
  298.  
  299.  
  300. str_ls(DIRECTORY) - 
  301.  
  302. issue a "ls" command. Output returned in a REXX string. 
  303.  
  304. Related: 
  305. Example 
  306. Notes 
  307.  
  308. Next chapter: 
  309. xexec 
  310.  
  311.  
  312. ΓòÉΓòÉΓòÉ 4.3.2.1. Example ΓòÉΓòÉΓòÉ
  313.  
  314.  
  315. say xdir.str_ls("/java") 
  316.  
  317.  
  318. ΓòÉΓòÉΓòÉ 4.3.2.2. Notes ΓòÉΓòÉΓòÉ
  319.  
  320.      rc- return code of last valid operation options 
  321.  
  322.  
  323. ΓòÉΓòÉΓòÉ 4.4. xexec ΓòÉΓòÉΓòÉ
  324.  
  325.  
  326. Use this class to run a system command. 
  327.  
  328. Related: 
  329. xexec 
  330.  
  331. Next chapter: 
  332. xfile 
  333.  
  334.  
  335. ΓòÉΓòÉΓòÉ 4.4.1. xexec ΓòÉΓòÉΓòÉ
  336.  
  337.  
  338. cmd = xexec(COMMAND,OUTPUT,ONERROR) 
  339.  
  340. Where: 
  341. COMMAND: is a valid command on the system you are running on (e.g. 
  342. "ls","cp","copy", etc.) 
  343. OUTPUT : can be any combination of: 
  344.  
  345.      SCREEN : the output will go on STDOUT 
  346.      VAR: the output will go on a variable 
  347.      ARRAY: the output will go on an array or 
  348.      NULL : forget about output 
  349.      ONERROR : is one of: 
  350.      IGNORE: a return code <> 0 is ignored 
  351.      WARNING : print a warning message if rc <> 0 
  352.      ABORT : abandon ship if rc <> 0 
  353.  
  354.  Related: 
  355.  Example 
  356.  Notes 
  357.  
  358.  Next chapter: 
  359.  xfile 
  360.  
  361.  
  362. ΓòÉΓòÉΓòÉ 4.4.1.1. Example ΓòÉΓòÉΓòÉ
  363.  
  364.  
  365. test = xexec('cp test toast','NULL','ABORT') 
  366.  
  367. test = xexec('pwd','VAR','ABORT') 
  368. say 'The path is "'test.out'".' 
  369.  
  370. test = xexec('ls -l','ARRAY','WARNING') 
  371. loop i = 1 to test.line[0] 
  372. say '>>>' test.line[i] 
  373. end 
  374.  
  375. cmd = xexec('jar -cvf test.jar *.class') 
  376. if cmd.rc <> 0 
  377. then xsys.die(300,'error from jar command.') 
  378.  
  379.  
  380. ΓòÉΓòÉΓòÉ 4.4.1.2. Notes ΓòÉΓòÉΓòÉ
  381.  
  382.      The examples are valid on a UNIX platform 
  383.      The examples are provided just as EXAMPLES there are infact better ways 
  384.       to do 'ls','pwd' in NetRexx itself 
  385.      lines : lines of output 
  386.      line: array of output lines; line[0]=no.of out lines 
  387.      out : string of output (when VAR is active) 
  388.      rc: return code 
  389.  
  390.  
  391. ΓòÉΓòÉΓòÉ 4.5. xfile ΓòÉΓòÉΓòÉ
  392.  
  393.  
  394. Handles all operations on files. 
  395.  
  396. Related: 
  397. xfile() 
  398. read 
  399. write 
  400. options 
  401.  
  402. Next chapter: 
  403. xftp 
  404.  
  405.  
  406. ΓòÉΓòÉΓòÉ 4.5.1. xfile() ΓòÉΓòÉΓòÉ
  407.  
  408.  
  409. xfile(FNAME) 
  410.  
  411. constructor 
  412.  
  413.  
  414. ΓòÉΓòÉΓòÉ 4.5.2. read ΓòÉΓòÉΓòÉ
  415.  
  416.  
  417. xfile.read() 
  418.  
  419. Read the ENTIRE file into an array OBJECT.line[i] 
  420. The number of lines is available in the variable OBJECT.line[0] or OBJECT.lines 
  421.  
  422. Related: 
  423. Example 
  424.  
  425. Next chapter: 
  426. write 
  427.  
  428.  
  429. ΓòÉΓòÉΓòÉ 4.5.2.1. Example ΓòÉΓòÉΓòÉ
  430.  
  431.  
  432. read record 123 of a recfm=F lrecl=80 file: 
  433.  
  434. fid = xfile('test.test') 
  435. fid.options('recfm=F,lrecl=80') 
  436. say fid.recread(123) 
  437.  
  438.  
  439. ΓòÉΓòÉΓòÉ 4.5.3. write ΓòÉΓòÉΓòÉ
  440.  
  441.  
  442. xfile.write() 
  443.  
  444. Write an ENTIRE file on disk from a buffer area OBJECT.line[i], where again 
  445. OBJECT.line[0] or OBJECT.lines contains the number of lines 
  446.  
  447. Related: 
  448. Example 
  449.  
  450. Next chapter: 
  451. options 
  452.  
  453.  
  454. ΓòÉΓòÉΓòÉ 4.5.3.1. Example ΓòÉΓòÉΓòÉ
  455.  
  456.  
  457. ofid = xfile('test.txt') 
  458. ofid.options('replace=y') 
  459. loop i = 1 to 10 
  460.     ofid.addline('test' i) 
  461.   end 
  462.   ofid.write() 
  463.  
  464.  
  465. ΓòÉΓòÉΓòÉ 4.5.4. options ΓòÉΓòÉΓòÉ
  466.  
  467.  
  468. xfile.options(OPTIONSTRING) 
  469.  
  470. Specifies the options for the file 
  471. The OPTIONSTRING is a sequence of keywords separated by a "," or by a " ". 
  472. valid keywords are: 
  473.  
  474.      RECFM=V | F 
  475.      LRECL=nnn 
  476.      REPLACE=Y | N 
  477.  
  478.  Related: 
  479.  Example 
  480.  
  481.  Next chapter: 
  482.  xftp 
  483.  
  484.  
  485. ΓòÉΓòÉΓòÉ 4.5.4.1. Example ΓòÉΓòÉΓòÉ
  486.  
  487.  
  488. afid = xfile('test.txt') 
  489. afid.options('RECFM=F,LRECL=80,REPLACE=Y') 
  490.  
  491. Demo: 
  492.  
  493. You can look at tio.nrx.This will write and read back a filein "line mode" 
  494.  
  495.  
  496. ΓòÉΓòÉΓòÉ 4.6. xftp ΓòÉΓòÉΓòÉ
  497.  
  498.  
  499. INSTANCE = xftp(HOST,[PORT]) 
  500.  
  501. Initiliazes an FTP session where INSTANCE will become the name of the session 
  502. used during subsequent commands. 
  503.  
  504. Further commands directed toward HOST are referenced to INSTANCE rather than 
  505. xftp.  i.e: 
  506.  
  507.      INSTANCE.xcd(DIR) 
  508.      INSTANCE.xget(FID) 
  509.      INSTANCE.xlogin(USERID PASSWORD) Note: No comma ! 
  510.      INSTANCE.xls(t) 
  511.      INSTANCE.xmode(BINARY|ASCII) 
  512.      INSTANCE.xmore(FID) 
  513.      INSTANCE.xput(FID) 
  514.      INSTANCE.xquery() 
  515.      INSTANCE.xreplace(Y|N) 
  516.       Note:  For simplification, all of the above commands may be called as: 
  517.  
  518.       INSTANCE.xexec(CMD OPTIONS) 
  519.  
  520.       Where: 
  521.  
  522.       OPTIONS is used as needed and CMD is one of the following: 
  523.  
  524.      cd       -- calls xcd(OPTIONS) 
  525.      get       -- calls xget(OPTIONS) 
  526.      user      -- calls xlogin(OPTIONS) 
  527.      ls        -- calls xls(OPTIONS) 
  528.      binary    -- calls xmode('BINARY') 
  529.      ascii      -- calls xmode('ASCII') 
  530.      more     -- calls xmore(OPTIONS) 
  531.      put       -- calls xput(OPTIONS) 
  532.      query     -- calls xquery() 
  533.      replace   -- calls xreplace(OPTIONS) 
  534.  
  535.  Related: 
  536.  xcd 
  537.  xget 
  538.  xlogin 
  539.  xls 
  540.  xmode 
  541.  xmore 
  542.  xput 
  543.  xquery 
  544.  xreplace 
  545.  Example 
  546.  
  547.  Next chapter: 
  548.  xmath 
  549.  
  550.  
  551. ΓòÉΓòÉΓòÉ 4.6.1. xcd ΓòÉΓòÉΓòÉ
  552.  
  553.  
  554. INSTANCE.xcd(DIR) 
  555.  
  556. DIR is the directory to change to on the remote machine 
  557.  
  558.  
  559. ΓòÉΓòÉΓòÉ 4.6.2. xget ΓòÉΓòÉΓòÉ
  560.  
  561.  
  562. INSTANCE.xget(FID) 
  563.  
  564. Gets file FID from the remote machine. 
  565.  
  566.  
  567. ΓòÉΓòÉΓòÉ 4.6.3. xlogin ΓòÉΓòÉΓòÉ
  568.  
  569.  
  570. INSTANCE.xlogin(USERID PASSWORD) 
  571.  
  572. Logs in to the remote machine with the specified USERID and PASSWORD 
  573.  
  574.  
  575. ΓòÉΓòÉΓòÉ 4.6.4. xls ΓòÉΓòÉΓòÉ
  576.  
  577.  
  578. INSTANCE.xls(T) 
  579.  
  580. Displays the remote direcotory.  T is undocumented at this time but may be a 
  581. timeout factor. 
  582.  
  583.  
  584. ΓòÉΓòÉΓòÉ 4.6.5. xmode ΓòÉΓòÉΓòÉ
  585.  
  586.  
  587. INSTANCE.xmode(BINARY|ASCII) 
  588.  
  589. Sets the file transfer mode. 
  590.  
  591.  
  592. ΓòÉΓòÉΓòÉ 4.6.6. xmore ΓòÉΓòÉΓòÉ
  593.  
  594.  
  595. INSTANCE.xmore(FID) 
  596.  
  597. Displays file FID on the screen 
  598.  
  599.  
  600. ΓòÉΓòÉΓòÉ 4.6.7. xput ΓòÉΓòÉΓòÉ
  601.  
  602.  
  603. INSTANCE.xput(FID) 
  604.  
  605. Puts local file FID onto the remote machine. 
  606.  
  607.  
  608. ΓòÉΓòÉΓòÉ 4.6.8. xquery ΓòÉΓòÉΓòÉ
  609.  
  610.  
  611. INSTANCE.xquery() 
  612.  
  613. Returns the present value of MODE (Binary or ASCII) and REPLACE (Yes or No) 
  614.  
  615.  
  616. ΓòÉΓòÉΓòÉ 4.6.9. xreplace ΓòÉΓòÉΓòÉ
  617.  
  618.  
  619. INSTANCE.xreplace(Y|N) 
  620.  
  621. Sets the file replace mode for XPUT and XGET operations to Yes or No. 
  622.  
  623.  
  624. ΓòÉΓòÉΓòÉ 4.6.10. Example ΓòÉΓòÉΓòÉ
  625.  
  626.  
  627. A simple FTP session: 
  628.  
  629. say 'This is just a small test connecting to "asisftp.cern.ch".' 
  630. ftpc = xftp('asisftp.cern.ch') 
  631. ftpc.cmd('user anonymous test@cern.ch') 
  632. ftpc.cmd('ascii') 
  633. ftpc.cmd('replace Y') 
  634. ftpc.cmd('get wylbur.help') 
  635.  
  636.  
  637. ΓòÉΓòÉΓòÉ 4.7. xmath ΓòÉΓòÉΓòÉ
  638.  
  639.  
  640. Mainly provide conversion tools 
  641.  
  642. Related: 
  643. n2cu 
  644. s2h 
  645. dotify 
  646. hexop 
  647. binop 
  648. random 
  649. gcd 
  650. gauss 
  651.  
  652. Next chapter: 
  653. xsock 
  654.  
  655.  
  656. ΓòÉΓòÉΓòÉ 4.7.1. n2cu ΓòÉΓòÉΓòÉ
  657.  
  658.  
  659. str = xmath.n2cu(NNN) 
  660.  
  661. Converts numeric quantity NNN to computer units 
  662.  
  663. Related: 
  664. Example 
  665.  
  666. Next chapter: 
  667. s2h 
  668.  
  669.  
  670. ΓòÉΓòÉΓòÉ 4.7.1.1. Example ΓòÉΓòÉΓòÉ
  671.  
  672.  
  673. say xmath.n2cu(2048)-> 2K 
  674.  
  675.  
  676. ΓòÉΓòÉΓòÉ 4.7.2. s2h ΓòÉΓòÉΓòÉ
  677.  
  678.  
  679. str = xmath.s2h(SEC) 
  680.  
  681. Converts SEC to HH:MM:SS 
  682.  
  683. Related: 
  684. Example 
  685.  
  686. Next chapter: 
  687. dotify 
  688.  
  689.  
  690. ΓòÉΓòÉΓòÉ 4.7.2.1. Example ΓòÉΓòÉΓòÉ
  691.  
  692.  
  693. say xmath.s2h(3661)-> 1:01:01 
  694.  
  695.  
  696. ΓòÉΓòÉΓòÉ 4.7.3. dotify ΓòÉΓòÉΓòÉ
  697.  
  698.  
  699. str = xmath.dotify(NNN) 
  700.  
  701. Puts the "," in a big number, for easy reading 
  702.  
  703. Related: 
  704. Example 
  705.  
  706. Next chapter: 
  707. hexop 
  708.  
  709.  
  710. ΓòÉΓòÉΓòÉ 4.7.3.1. Example ΓòÉΓòÉΓòÉ
  711.  
  712.  
  713. say xmath.dotify(100203) -> 100,203 
  714.  
  715.  
  716. ΓòÉΓòÉΓòÉ 4.7.4. hexop ΓòÉΓòÉΓòÉ
  717.  
  718.  
  719. str = xmath.hexop(HEXOP) 
  720.  
  721. Will execute a simple hex operation 
  722.  
  723. Related: 
  724. Example 
  725.  
  726. Next chapter: 
  727. binop 
  728.  
  729.  
  730. ΓòÉΓòÉΓòÉ 4.7.4.1. Example ΓòÉΓòÉΓòÉ
  731.  
  732.  
  733. say xmath.hexop('1A + 10')-> 2A 
  734.  
  735.  
  736. ΓòÉΓòÉΓòÉ 4.7.5. binop ΓòÉΓòÉΓòÉ
  737.  
  738.  
  739. str = xmath.binop(HEXOP) 
  740.  
  741. Executes a simple bin operation. 
  742.  
  743. Related: 
  744. Example 
  745.  
  746. Next chapter: 
  747. random 
  748.  
  749.  
  750. ΓòÉΓòÉΓòÉ 4.7.5.1. Example ΓòÉΓòÉΓòÉ
  751.  
  752.  
  753. say xmath.binop('10 + 11')-> 101 
  754.  
  755.  
  756. ΓòÉΓòÉΓòÉ 4.7.6. random ΓòÉΓòÉΓòÉ
  757.  
  758.  
  759. n = xmath.random(MAX) 
  760.  
  761. Returns an random integer with maximum value not greater than MAX. 
  762.  
  763. Related: 
  764. Example 
  765.  
  766. Next chapter: 
  767. gcd 
  768.  
  769.  
  770. ΓòÉΓòÉΓòÉ 4.7.6.1. Example ΓòÉΓòÉΓòÉ
  771.  
  772.  
  773. say xmath.random(25) -> 12 (MAYBE) 
  774.  
  775.  
  776. ΓòÉΓòÉΓòÉ 4.7.7. gcd ΓòÉΓòÉΓòÉ
  777.  
  778.  
  779. n = xmath.gcd(m,n) 
  780.  
  781. Returns the Greatest Common Divisor of M and N. 
  782.  
  783.  
  784. ΓòÉΓòÉΓòÉ 4.7.8. gauss ΓòÉΓòÉΓòÉ
  785.  
  786.  
  787. rc = xmath.gauss(N,A[,],Y[],C[]) 
  788.  
  789. Upon return code RC=0 it will find using the Gauss Method the solution C[] for 
  790. the array A[,] and vector Y[] 
  791.  
  792.  
  793. ΓòÉΓòÉΓòÉ 4.8. xsock ΓòÉΓòÉΓòÉ
  794.  
  795.  
  796. INSTANCE = xsock(HOST,PORT) 
  797.  
  798. Where PORT may be the actual port number or one of the following: 
  799.  
  800.      DAYTIME   -- Default port 13 
  801.      FTP         -- Default port 21 
  802.      TELNET     -- Default port 23 
  803.      FINGER     -- Default port 79 
  804.      NNTP       -- Default port 119 
  805.      IMAP       -- Default port 143 
  806.      HTTP       -- Default port 80 
  807.       Opens a socket connection to the specified HOST and PORT.  INSTANCE is 
  808.       used to reference future actions on this socket connection. 
  809.  
  810.      INSTANCE.send(WHAT) 
  811.      INSTANCE.receive([SCREEN|ARRAY],[LENGTH]) 
  812.      INSTANCE.close() 
  813.  
  814.  Related: 
  815.  send 
  816.  receive 
  817.  close 
  818.  version 
  819.  hostname 
  820.  Example 
  821.  
  822.  Next chapter: 
  823.  xsys 
  824.  
  825.  
  826. ΓòÉΓòÉΓòÉ 4.8.1. send ΓòÉΓòÉΓòÉ
  827.  
  828.  
  829. INSTANCE.send(WHAT) 
  830.  
  831. Sends string WHAT to the remote host. 
  832.  
  833.  
  834. ΓòÉΓòÉΓòÉ 4.8.2. receive ΓòÉΓòÉΓòÉ
  835.  
  836.  
  837. INSTANCE.receive([SCREEN|ARRAY],[LENGTH]) 
  838.  
  839. Receives a stream of max. length LENGTH and either displays it to SCREEN or 
  840. stores it in the array named by ARRAY. 
  841.  
  842. Default is SCREEN and max. length of 10000 
  843.  
  844.  
  845. ΓòÉΓòÉΓòÉ 4.8.3. close ΓòÉΓòÉΓòÉ
  846.  
  847.  
  848. INSTANCE.close() 
  849.  
  850. Closes the current socket connection 
  851.  
  852.  
  853. ΓòÉΓòÉΓòÉ 4.8.4. version ΓòÉΓòÉΓòÉ
  854.  
  855.  
  856. xsock.version() 
  857.  
  858. Displays the version information. 
  859.  
  860.  
  861. ΓòÉΓòÉΓòÉ 4.8.5. hostname ΓòÉΓòÉΓòÉ
  862.  
  863.  
  864. NAME = xsock.hostname() 
  865.  
  866. Gets the name of the currently connected host. 
  867.  
  868.  
  869. ΓòÉΓòÉΓòÉ 4.8.6. Example ΓòÉΓòÉΓòÉ
  870.  
  871.  
  872.     args = args 
  873.     rc = rc 
  874.     xsock.version() 
  875.  
  876.     say 'Testing hostname()' 
  877.     say xsock.hostname() 
  878.     say 
  879.  
  880.     say 'Testing daytime service' 
  881.     so = xsock('shift3.cern.ch','DAYTIME') 
  882.     so.receive('') 
  883.     so.close() 
  884.     say 
  885.  
  886.     say 'Testing finger service' 
  887.     so = xsock('shift3.cern.ch','FINGER') 
  888.     so.send('pippo') 
  889.     so.receive('') 
  890.     so.close() 
  891.     say 
  892.  
  893.     exit 0 
  894.  
  895.  
  896. ΓòÉΓòÉΓòÉ 4.9. xsys ΓòÉΓòÉΓòÉ
  897.  
  898.  
  899.   This is just a collection of methods for "system" relatedinformation. 
  900.  
  901.   Related: 
  902.   userid 
  903.   nodeid 
  904.   time 
  905.   date 
  906.   xdate 
  907.   die 
  908.   sleep 
  909.  
  910.   Next chapter: 
  911.   xtimer 
  912.  
  913.  
  914. ΓòÉΓòÉΓòÉ 4.9.1. userid ΓòÉΓòÉΓòÉ
  915.  
  916.  
  917. str = xsys.userid() 
  918.  
  919. Will return your current userid. 
  920.  
  921. Related: 
  922. Example 
  923.  
  924. Next chapter: 
  925. nodeid 
  926.  
  927.  
  928. ΓòÉΓòÉΓòÉ 4.9.1.1. Example ΓòÉΓòÉΓòÉ
  929.  
  930.  
  931. say 'I am running on user "'xsys.userid()'".' 
  932.  
  933.  
  934. ΓòÉΓòÉΓòÉ 4.9.2. nodeid ΓòÉΓòÉΓòÉ
  935.  
  936.  
  937. str = xsys.nodeid() 
  938.  
  939. Will return the name of the node you are running on. 
  940.  
  941. Related: 
  942. Example 
  943.  
  944. Next chapter: 
  945. time 
  946.  
  947.  
  948. ΓòÉΓòÉΓòÉ 4.9.2.1. Example ΓòÉΓòÉΓòÉ
  949.  
  950.  
  951. say 'I am running on system "'xsys.nodeid()'".' 
  952.  
  953.  
  954. ΓòÉΓòÉΓòÉ 4.9.3. time ΓòÉΓòÉΓòÉ
  955.  
  956.  
  957. str = xsys.time() 
  958. str = xsys.time(FMT) 
  959.  
  960. Will return the current time. 
  961. FMT is the same as on Classical REXX 
  962.  
  963. Related: 
  964. Example 
  965.  
  966. Next chapter: 
  967. date 
  968.  
  969.  
  970. ΓòÉΓòÉΓòÉ 4.9.3.1. Example ΓòÉΓòÉΓòÉ
  971.  
  972.  
  973. say 'Now is:' xsys.time()'.' 
  974.  
  975.  
  976. ΓòÉΓòÉΓòÉ 4.9.4. date ΓòÉΓòÉΓòÉ
  977.  
  978.  
  979. str = xsys.date() 
  980. str = xsys.date(FMT) 
  981.  
  982. Will return the current date. 
  983. FMT is the same as on Classical REXX 
  984.  
  985. Related: 
  986. Example 
  987.  
  988. Next chapter: 
  989. xdate 
  990.  
  991.  
  992. ΓòÉΓòÉΓòÉ 4.9.4.1. Example ΓòÉΓòÉΓòÉ
  993.  
  994.  
  995. say 'Today is' xsys.date()'.' 
  996.  
  997.  
  998. ΓòÉΓòÉΓòÉ 4.9.5. xdate ΓòÉΓòÉΓòÉ
  999.  
  1000.  
  1001. str = xsys.xdate(IFMT,DATE,OFMT) 
  1002.  
  1003. Will perform date conversion. 
  1004.  
  1005. Related: 
  1006. Example 
  1007.  
  1008. Next chapter: 
  1009. die 
  1010.  
  1011.  
  1012. ΓòÉΓòÉΓòÉ 4.9.5.1. Example ΓòÉΓòÉΓòÉ
  1013.  
  1014.  
  1015. say xsys.xdate('E','12/01/97'.'J') 
  1016.  
  1017. Prints 31 Dec 1998 from European format to Julian: 
  1018. say xsys.xdate('E','31/12/98','J') 
  1019.  
  1020. Prints next Monday in Julian format: 
  1021. say xsys.xdate('NEXT','MONDAY','J')  -- 
  1022.  
  1023.  
  1024. ΓòÉΓòÉΓòÉ 4.9.6. die ΓòÉΓòÉΓòÉ
  1025.  
  1026.  
  1027. xsys.die(RC,MESSAGE) 
  1028.  
  1029. Program will abort with RC return code, displaying MESSAGE on STDOUT; 
  1030.  
  1031. Related: 
  1032. Example 
  1033.  
  1034. Next chapter: 
  1035. sleep 
  1036.  
  1037.  
  1038. ΓòÉΓòÉΓòÉ 4.9.6.1. Example ΓòÉΓòÉΓòÉ
  1039.  
  1040.  
  1041. xsys.die(320,'Program aborted.') 
  1042.  
  1043. cmd = xexec('jar -cvf test.jar *.class') 
  1044. if cmd.rc <> 0 
  1045. then xsys.die(300,'error from jar command.') 
  1046.  
  1047.  
  1048. ΓòÉΓòÉΓòÉ 4.9.7. sleep ΓòÉΓòÉΓòÉ
  1049.  
  1050.  
  1051. xsys.sleep(SEC) 
  1052.  
  1053. Program will sleep for SEC seconds 
  1054.  
  1055.  
  1056. ΓòÉΓòÉΓòÉ 4.10. xtimer ΓòÉΓòÉΓòÉ
  1057.  
  1058.  
  1059. Use xtimer class to build timers inside your programs. 
  1060.  
  1061. Related: 
  1062. xtimer() 
  1063. reset 
  1064. elapsed 
  1065.  
  1066. Next chapter: 
  1067. xurl 
  1068.  
  1069.  
  1070. ΓòÉΓòÉΓòÉ 4.10.1. xtimer() ΓòÉΓòÉΓòÉ
  1071.  
  1072.  
  1073. xtimer() 
  1074.  
  1075. Constructor 
  1076.  
  1077. The starting time is set to 0.000 sec 
  1078.  
  1079.  
  1080. ΓòÉΓòÉΓòÉ 4.10.2. reset ΓòÉΓòÉΓòÉ
  1081.  
  1082.  
  1083. xtimer.reset() 
  1084.  
  1085.   The timer is reset to 0.000 sec 
  1086.  
  1087.  
  1088. ΓòÉΓòÉΓòÉ 4.10.3. elapsed ΓòÉΓòÉΓòÉ
  1089.  
  1090.  
  1091. xtimer.elapsed() 
  1092. Returns the elapsed time since the last reset() (or object creation) 
  1093.  
  1094. Format is SSSSS.MMM (seconds.milliseconds) 
  1095.  
  1096. Related: 
  1097. Example 
  1098.  
  1099. Next chapter: 
  1100. xurl 
  1101.  
  1102.  
  1103. ΓòÉΓòÉΓòÉ 4.10.3.1. Example ΓòÉΓòÉΓòÉ
  1104.  
  1105.  
  1106. atimer = xtimer() 
  1107.    -- some job here 
  1108.    -- 
  1109.   say 'Took.....:' atimer.elapsed'(sec).' 
  1110.   atimer.reset() 
  1111.    -- some other job here 
  1112.    -- 
  1113.   say 'Took.....:' atimer.elapsed'(sec).' 
  1114.  
  1115.  
  1116. ΓòÉΓòÉΓòÉ 4.11. xurl ΓòÉΓòÉΓòÉ
  1117.  
  1118.  
  1119. INSTANCE = xurl(ADDRESS) 
  1120.  
  1121. Defines an instance of xurl for reference when performing future actions i.e: 
  1122.  
  1123.         INSTANCE.options([TRACE|NOTRACE],[INFO|NOINFO],[REPLACE|NOREPLACE],[STATUS|NOSTATUS) 
  1124.      INSTANCE.readlines() 
  1125.      INSTANCE.fetch(RFID,[LFID]) 
  1126.      INSTANCE.fetchall(MASK) 
  1127.      INSTANCE.getreferences() 
  1128.  
  1129.  Related: 
  1130.  options 
  1131.  readlines 
  1132.  fetch 
  1133.  fetchall 
  1134.  getreferences 
  1135.  version 
  1136.  Example 
  1137.  
  1138.  
  1139. ΓòÉΓòÉΓòÉ 4.11.1. options ΓòÉΓòÉΓòÉ
  1140.  
  1141.  
  1142. INSTANCE.options([TRACE|NOTRACE],[INFO|NOINFO],[REPLACE|NOREPLACE],[STATUS|NOSTATUS) 
  1143.  
  1144. Where: 
  1145.  
  1146.      TRACE = Echoes the connection address 
  1147.      NOTRACE = Does not echo the connection address 
  1148.      INFO = Echos processing info to the screen 
  1149.      NOINFO = Does not echo processing info to the screen 
  1150.      REPLACE = Overwrite local file on fetch operations 
  1151.      NOREPLACE = Do not overwrite local file on fetch operations 
  1152.      STATUS = Echoes the amount of data read 
  1153.      NOSTATUS = Does not echo the amount of data read 
  1154.  
  1155.  
  1156. ΓòÉΓòÉΓòÉ 4.11.2. readlines ΓòÉΓòÉΓòÉ
  1157.  
  1158.  
  1159. INSTANCE.readlines() 
  1160.  
  1161. Reads the reference URL into an array 
  1162.  
  1163.  
  1164. ΓòÉΓòÉΓòÉ 4.11.3. fetch ΓòÉΓòÉΓòÉ
  1165.  
  1166.  
  1167. INSTANCE.fetch(RFID,[LFID]) 
  1168.  
  1169. Fetches the remote file RFID and stores it into the local file LFID 
  1170.  
  1171.  
  1172. ΓòÉΓòÉΓòÉ 4.11.4. fetchall ΓòÉΓòÉΓòÉ
  1173.  
  1174.  
  1175. INSTANCE.fetchall(MASK) 
  1176.  
  1177. Fetches all referenced documents with extensions matching MASK. 
  1178.  
  1179.  
  1180. ΓòÉΓòÉΓòÉ 4.11.5. getreferences ΓòÉΓòÉΓòÉ
  1181.  
  1182.  
  1183. INSTANCE.getreferences() 
  1184.  
  1185. Gets all referenced documents and stores them in string INSTANCE.referencelist 
  1186.  
  1187.  
  1188. ΓòÉΓòÉΓòÉ 4.11.6. version ΓòÉΓòÉΓòÉ
  1189.  
  1190.  
  1191. xurl.version() 
  1192.  
  1193. Displays the version information 
  1194.  
  1195.  
  1196. ΓòÉΓòÉΓòÉ 4.11.7. Example ΓòÉΓòÉΓòÉ
  1197.  
  1198.  
  1199. Will fetch ALL the html files contained in the Netrexx Tutorial 
  1200.  
  1201. page = xurl('http://wwwinfo.cern.ch/news/netrexx/html/nr_toc.html') 
  1202. page.readlines() 
  1203. page.getreferences() 
  1204. list = page.referencelist 
  1205. say list 
  1206. loop while list <> '' 
  1207.     parse list item list 
  1208.     xurl.fetch(page.base||item) 
  1209.   end 
  1210.  
  1211.