home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / text / textra / scripts / jforth_scripts / deferstub.textra next >
Text File  |  1995-02-27  |  2KB  |  76 lines

  1.     /*******************************************************************
  2.      *   TEXTRA AREXX script -- Mike Haas, 1991, All Rights Reserved.  *
  3.      * Freely distributable ONLY as a component of the TEXTRA package. *
  4.      * This banner may not be removed or altered (improvements to the  *
  5.      *    actual program welcome).  Please document and send to me.    *
  6.      *        !!! PLACE THIS FILE IN YOUR REXX: DIRECTORY !!!          *
  7.      *******************************************************************/
  8.  
  9.  
  10. /* DeferStub.textra 
  11.    by Nick Didkovsky
  12.  
  13. This simple AREXX script is useful for assigning stub words to deferred words
  14. in JForth source code.  Assumes you follow a convention where deferred words
  15. look like:
  16.  
  17. defer ..theword
  18.  
  19. and that the temporary stub word for it would be called theword.stub
  20.  
  21. Pretend this file is an excerpt of your JForth source code.  Click one 
  22. or two lines higher than the deferred word declaration above (try line 16) and 
  23. execute this script.  Be careful where you click, or you'll be writing JForth 
  24. source code where you don't want it!!!
  25.  
  26. */
  27.  
  28.  
  29. options results
  30.  
  31. FIND "defer"
  32. if (result == "NOT FOUND") then   /* no luck finding the defer */
  33.  
  34.     do
  35.         notify "Can't find any deferred words"
  36.         exit
  37.     end
  38. HOPTO next word
  39. HOPSELECT next word
  40.  
  41. if (rc == 10) then
  42. do
  43.     notify "HOPSELECT couldn't do the job" 
  44.     exit
  45. end
  46.  
  47.     if (result == "NOT FOUND") then   
  48.     /* no luck finding the word's name */
  49.     /* Could happen if 'defer' is the last word in the file, for instance */
  50.     do
  51.         notify "Can't find a name for the word being deferred"
  52.         exit
  53.     end
  54.     
  55. GET select text
  56. parse var result numlines ' ' theword
  57.  
  58. UNSELECT
  59. DOWN
  60. NEWLINE
  61. NEWLINE
  62. text ": "
  63. text substr(theword,3,length(theword)-2)
  64. textn ".stub ( -- )"
  65. text '." '
  66. text theword
  67. text '" executing"'
  68. text '!" '
  69. textn '" cr"'
  70. textn ";"
  71. NEWLINE
  72. text "'c "
  73. text substr(theword,3,length(theword)-2)
  74. text '.stub is '
  75. textn theword
  76.