home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / comal3-2.dms / in.adf / RexxScripts / SaveModule3.Comal < prev    next >
Encoding:
Text File  |  1993-04-10  |  1.7 KB  |  60 lines

  1. /****************************************************************/
  2. /*                                                              */
  3. /* Cut off local module and save as external module             */
  4. /*                                                              */
  5. /*    Place the cursor somewhere inside the internal module     */
  6. /*    you want to save as an external module. The module will   */
  7. /*    be saved in the file Modules/modulename.mod and if        */
  8. /*    success it will be cut off the program text.              */
  9. /*                                                              */
  10. /*    The operation is done by marking the module as a block    */
  11. /*    which is saved by using the script file SaveBlock.iplc    */
  12. /*                                                              */
  13. /****************************************************************/
  14.  
  15. OPTIONS RESULTS
  16. 'COMALPATH'
  17. ComalDir = RESULT
  18.  
  19. DO FOREVER
  20.   OPTIONS RESULTS
  21.   'GETTEXT'
  22.   Line = RESULT
  23.   IF ( SUBSTR(Line,1,6)=='MODULE' ) THEN BREAK
  24.   OPTIONS
  25.   'CURSOR UP'
  26.   IF RC>0 THEN BREAK
  27. END
  28.  
  29. IF ( SUBSTR(Line,1,6)=='MODULE' )
  30.   THEN DO
  31.     File = ComalDir || 'Modules/' || SUBSTR(Line,8,LENGTH(Line)-7) || '.mod'
  32.     num = 1
  33.     'BLOCK'
  34.     DO FOREVER
  35.       num = num + 1
  36.       IF ( SUBSTR(Line,1,9)=='ENDMODULE' ) THEN BREAK
  37.       'CURSOR DOWN'
  38.       IF RC>0 THEN BREAK
  39.       OPTIONS RESULTS
  40.       'GETTEXT'
  41.       Line = RESULT
  42.     END
  43.     IF ( SUBSTR(Line,1,9)=='ENDMODULE' )
  44.       THEN DO
  45.         'SAVEBLOCK' File
  46.         DO num
  47.           'DELLINE'
  48.           'CURSOR UP'
  49.         END
  50.       END
  51.       ELSE DO
  52.         'BLOCK'
  53.         WRITESTATUS 'ENDMODULE missing'
  54.       END
  55.   END
  56.   ELSE DO
  57.     OPTIONS
  58.     WRITESTATUS 'Not inside MODULE'
  59.   END
  60.