home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDGE1_704.DMS / in.adf / Edge_Rexx.lha / AutoDocHelp.edge < prev    next >
Encoding:
Text File  |  1993-10-27  |  1.9 KB  |  84 lines

  1.  
  2. /*
  3. ** $VER: AutoDocHelp.edge 1.3 (Sunday 08-Aug-93 02:28:27)
  4. **
  5. ** Get autodoc help on the function currently under the cursor.
  6. **
  7. ** NOTE: this script assumes that you have autodocs in amigaguide format and
  8. **         that the amigaguide PATH environment variable is correctly set so
  9. **            the autodocs can be found.
  10. **
  11. ** Written by Thomas liljetoft, based on GetXRef by David N. Junod
  12. */
  13.  
  14.  
  15. options results
  16.  
  17. /* get name of the screen we're on */
  18. 'getenvvar' _ge_screenname
  19. screenname = result
  20.  
  21. /* load amigaguide.library if not loaded */
  22. if ~show('l','amigaguide.library') then
  23.     call addlib('amigaguide.library',0,-30,33)
  24.  
  25. /* get word under the cursor */
  26. 'position' eow
  27. 'cursor' right 1
  28. 'copy' word back rb
  29. func = result
  30.  
  31. if func = '0a'X | func = '09'X then                /* no word under cursor */
  32.     do
  33.     requeststring title '"Help on what?"'
  34.     if RC ~= 0 then exit(rc)
  35.     func = result
  36.     end
  37.  
  38. /* load the Autodoc cross-reference if not loaded */
  39. retval = getxref("insert()")
  40. if retval = 10 then
  41.     do
  42.     'windowtitle' '"Loading Autodoc cross-reference table..."'
  43.     call loadxref(autodoc.xref)
  44.     end
  45.  
  46. /* try to find the function in the cross-reference table */
  47. retval = getxref(func"()")
  48. if retval = 10 then
  49.     do
  50.     retval = getxref(func)        /* may be it's not a function */
  51.     if retval = 10 then
  52.         do
  53.         'beepscreen'
  54.         'windowtitle'    '"'"Sorry, no help available on '"func"'."'"'
  55.         exit(10)
  56.         end
  57.     end
  58. else func = func||"()"
  59.  
  60. 'windowtitle' '"'"Loading "func"..."'"'
  61.  
  62. /* find out what version of amigaguide we're using */
  63. address command 'version >nil: amigaguide.library version 39'
  64.  
  65. parse var retval '"'node'" "'base'" 'type' 'line
  66.  
  67. if RC = 0 then
  68.     do
  69.     call shownode(screenname,base,node,line,0)
  70.     end
  71. else
  72.     do
  73.     /* if we're allready running, don't start a new amigaguide */
  74.     if ~show('p','AUTODOCS') then
  75.         address command "run >nil: amigaguide document "func" line "line" portname AUTODOCS pubscreen "screenname
  76.     else
  77.         do
  78.         address autodocs "link "func" line "line
  79.         address autodocs "windowtofront"
  80.         end
  81.     end
  82.  
  83. exit(0)
  84.