home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gnat-2.06-src.tgz / tar.out / fsf / gnat / ada / gnatchop.cmd < prev    next >
OS/2 REXX Batch file  |  1996-09-28  |  2KB  |  42 lines

  1. @echo off
  2. if %1.==. goto usage
  3. setlocal
  4. set parms=
  5. set k8option=
  6. :GET_OPTS
  7. REM Scan through the options, checking for validity and especially looking for
  8. REM the 'k' option since this will be used for the call to gcc to get the offset
  9. REM information.
  10. if %1.==-k. set k8option=-k8 & shift & goto get_opts
  11. if %1.==-s. set parms=%parms% %1 & shift & goto get_opts
  12. if %1.==-w. set parms=%parms% %1 & shift & goto get_opts
  13. if %1.==-r. set parms=%parms% %1 & shift & goto get_opts
  14. if %1.==/k. set k8option=-k8 & shift & goto get_opts
  15. if %1.==/s. set parms=%parms% -s & shift & goto get_opts
  16. if %1.==/w. set parms=%parms% -w & shift & goto get_opts
  17. if %1.==/r. set parms=%parms% -r & shift & goto get_opts
  18. REM Check that there is a filename argument after the option list, and that the
  19. REM file actually exists.
  20. if %1.==. echo missing filename & goto usage
  21. if not exist %1 echo %1 not found & goto end
  22. REM Call gnatf on the source filename argument with special options to generate
  23. REM offset information. If this special compilation completes succesfully call
  24. REM the gnatchp program to actuall split the source file in one file per
  25. REM compilation unit in the optional directory if given otherwise in the current
  26. REM directory.
  27. gnatf -s -u %k8option% %1 >tmpfile
  28. if errorlevel 1 echo Warning: parse errors detected, chop may not be successful
  29. gnatchp %parms% %1 %2 <tmpfile
  30. erase tmpfile
  31. goto end
  32. :USAGE
  33. echo Usage : gnatchop [-k] [-r] [-s] [-w] filename [directory]
  34. echo.
  35. echo   k         limit filenames to 8 characters
  36. echo   r         generate Source_Reference pragmas
  37. echo   s         generate a compilation script
  38. echo   w         overwrite existing filenames
  39. echo   filename  source file
  40. echo   directory directory to place split files (default is current directory)
  41. :END
  42.