home *** CD-ROM | disk | FTP | other *** search
/ AMIGA PD 1 / AMIGA-PD-1.iso / Programme_zum_Heft / Anwendungen / Kurztests / DFA / Rexx / ArexxScripts.lha / insert_adr.ced < prev    next >
Text File  |  1994-09-16  |  3KB  |  142 lines

  1. /* $Revision Header built automatically *************** (do not edit) ************
  2. **
  3. ** © Copyright by Dirk Federlein
  4. **
  5. ** File             : insert_adr.ced
  6. ** Created on       : Monday, 04.04.94 17:34:06
  7. ** Created by       : Dirk Federlein
  8. ** Current revision : V2.0
  9. **
  10. **
  11. ** Purpose
  12. ** -------
  13. ** Inserts the address of the "person" under the cursor. You must have
  14. ** DFA running to use this script successfully.
  15. **
  16. ** ---------------------------------------------------------------------------
  17. ** Lookup part taken from:
  18. **
  19. ** LookUp.ced                        Copyright (c) 1989, Peter Cherna
  20. **
  21. ** ARexx program for CygnusEd Professional that looks up the word under
  22. ** the cursor.
  23. **
  24. ** Version 1.30:  August 20, 1989    Release 1.2:  August 29, 1989
  25. ** ---------------------------------------------------------------------------
  26. **
  27. ** Revision V2.0
  28. ** --------------
  29. ** created on Monday, 04.04.94 17:34:06  by  Dirk Federlein.   LogMessage :
  30. **     --- Initial release ---
  31. **
  32. *********************************************************************************/
  33.  
  34. options results
  35.  
  36. address 'rexx_ced'
  37.  
  38. tabchar = '09'X
  39. cr    = '0A'X
  40. quote    = '22'X
  41.  
  42.  
  43. /*    Get contents of current line: */
  44. status 55
  45. line = result
  46.  
  47. /*    Get tab size: */
  48. status 8
  49. tabadjust = result - 1
  50.  
  51. /*    Get cursor x position (relative to beginning of line = 1): */
  52. status 46
  53. cur = result + 1
  54.  
  55. i = index(line,tabchar)
  56. DO while i > 0 & i <= cur - tabadjust
  57.     cur = cur - tabadjust
  58.     i = index(line,tabchar,i+1)
  59. END
  60.  
  61. /*    If the current character is non-alphabetic, then start one character
  62.     over to the left.  This allows the cursor to be immediately after
  63.     the key word (say on a space or bracket.) */
  64.  
  65. char = substr(line,cur,1)
  66. if (~(datatype(char,'A') | char = '_') & cur > 1) then
  67.     cur = cur - 1
  68.  
  69. /*    Find leftmost and rightmost alphabetic character adjacent to current: */
  70.  
  71. right = cur - 1
  72. left = cur + 1
  73. char = 'A'
  74. DO while (datatype(char,'A') | char = '_') & (left > 0)
  75.      left = left - 1
  76.     if left > 0 then
  77.         char = substr(line,left,1)
  78. END
  79. char = 'A'
  80. DO while (datatype(char,'A') | (char = '_'))
  81.     right = right + 1
  82.     char = substr(line,right,1)
  83. END
  84.  
  85. if right-left <= 1 then
  86. DO
  87.     getstring
  88.     target = result
  89.     if (target = 'RESULT') then
  90.         exit
  91. END
  92. else
  93. DO
  94.     target = substr(line,left+1,right-left-1)
  95.     newtarget = '#?'target'#?'
  96. END
  97.  
  98. DO
  99.     say 'Searching for address' newtarget '...'
  100.  
  101.     if ~show(ports, DFA) then
  102.     do
  103.         'okay1' 'You should have DFA running, if you' cr 'want to get an address from it!'
  104.         exit 0
  105.     end
  106.  
  107.     address 'DFA' 'SEARCH' quote||newtarget||quote IGNORECASE ALL STEM ADR.
  108.  
  109. SAY rc2
  110.  
  111.     if rc=0 then
  112.     do
  113.         "Prev WORD"
  114.         "Mark BLOCK"
  115.         "NEXT WORD"
  116.         "CUT BLOCK"
  117.  
  118.         text ADR.ADDRESS.0
  119.         text cr
  120.         text ADR.ADDRESS.1
  121.         text " "
  122.         text ADR.ADDRESS.2
  123.         text cr
  124.         text ADR.ADDRESS.3
  125.         text cr
  126.         text ADR.ADDRESS.4
  127.         text cr
  128.         text ADR.ADDRESS.5
  129.         text " "
  130.         text ADR.ADDRESS.6
  131.         text ", "
  132.         text ADR.ADDRESS.7
  133.         text cr
  134.         text ADR.ADDRESS.8
  135.         text cr
  136.     end
  137.     else
  138.         'okay1' 'Could not find address of' newtarget '! '
  139. END
  140.  
  141. exit
  142.