home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxlepsom.zip / MacroLst.cmd < prev    next >
OS/2 REXX Batch file  |  1995-09-18  |  3KB  |  106 lines

  1. /* rexx */
  2.  
  3. tst.log='MacroLst.log'
  4. signal on syntax name ErrExit
  5.  
  6. call RxFuncAdd 'LepSomLoadFuncs', 'rxlepsom', 'LepSomLoadFuncs'
  7. call LepSomLoadFuncs
  8.  
  9. parse arg args
  10. n=words(args)
  11.  
  12. call lineout tst.log,'Arguments are ='args
  13.  
  14. do i=1 to n 
  15.     argv.i=word(args,i)
  16. end 
  17.  
  18. lepAA=LepAAnew(argv.1)
  19. if LepGetClassName(lepAA)\='LEPArgumentsArray' then do
  20.     cr=x2c('0D');
  21.     msg='Internal error in 123REXX.DLL RexxAddMacro function.'
  22.     msg=msg||cr||'Please contact us to inform about the conditions of this error.'
  23.     LepDisplayError(msg);
  24.     return
  25. end
  26.  
  27. argNum=LepAAGetByNo(lepAA)
  28. lepArg.0=argNum
  29. do i=1 to argNum
  30.     lepArg.i=LepAAGetByNo(lepAA, i-1) /* Lep arguments are 
  31.                     enumerated starting from 0 */
  32.     call lineout tst.log, 'lepArg.'i' is a 'LepGetClassName(lepArg.i)
  33. end
  34.  
  35. /******************************************************************************/
  36. /*                Insert your code here                                       */
  37. /******************************************************************************/
  38.  
  39. if argNum<1 then do
  40.     rcod=LepDisplayError('The one argument should be specified')
  41.     return 1
  42. end
  43.  
  44.  
  45. rng=lepArg.1
  46. cls=LepGetClassName(rng)
  47.  
  48. call lineout tst.log, 'Range is a 'cls
  49.  
  50. if cls\='LEPRange' then do
  51.     rcod=LepDisplayError('The range for the macro list should be the 1st argument')
  52.     return 1
  53. end
  54.  
  55. call lineout tst.log, 'lepArg.1->somGetClass='||cls
  56.  
  57. rcod=LepSetCellString(rng,1,1,1,'Macro name');
  58. rcod=LepSetCellString(rng,1,2,1,'Command File');
  59. rcod=LepSetCellString(rng,1,3,1,"Arguments' types");
  60.  
  61.  
  62. n=LepMacroNum()
  63. call lineout tst.log, 'There are 'n' macros registered'
  64. call lineout tst.log, 'Macro[0].name='LepMacroGetName(0)
  65. do i=1 to n /* macros are enumerated starting from 0 */
  66.     rcod=LepSetCellString(rng, 1,1,i+1, '{'||LepMacroGetName(i-1)||'}')
  67.     rcod=LepSetCellString(rng, 1,2,i+1, '{'||LepMacroGetFile(i-1)||'}')
  68.     types="("
  69.     argNum=LepMacroGetArgs(i-1)
  70.     do j=1 to argNum
  71.         tt=LepMacroGetProt(i-1,j-1)
  72.         select 
  73.         when tt=0 then do 
  74.             types=types||'@TYPESTRING()'
  75.         end
  76.         when tt=1 then do
  77.             types=types||'@TYPENUMBER()'
  78.         end
  79.         when tt=2 then do
  80.             types=types||'@TYPECOND()'
  81.         end
  82.         when tt=3 then do
  83.             types=types||'@TYPEVALUE()'
  84.         end
  85.         when tt=4 then do
  86.             types=types||'@TYPERANGE()'
  87.         end
  88.         otherwise 
  89.             types=types||'Illegal type '||tt
  90.         end
  91.         if j\=argNum then do
  92.             types=types||', '
  93.         end
  94.     end
  95.     types=types||')'
  96.     rcod=LepSetCellString(rng, 1,3,i+1, types)
  97. end
  98. return 
  99.  
  100.  
  101. ErrExit:
  102.  msg='Error '||rc||' occured at line '||sigl||': '||errortext(rc)
  103.  call lineout tst.log, msg
  104.  rcod=LepDisplayError(msg)
  105. return
  106.