{VERSION 4 0 "IBM INTEL NT" "4.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 2 0 1 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 1 }{CSTYLE "Help Head ing" -1 26 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "Time s" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 } {PSTYLE "Maple Output" -1 11 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 3 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {SECT 0 {PARA 0 "" 0 "" {TEXT 26 8 "Advice: " }{TEXT -1 33 "Wo rksheets and Command-line Maple" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 163 "Worksheets (.mws files) are intended for use in Maple's worksheet (graphical) interface, not in the command-li ne (text) version of Maple. However, in Maple 6 the " }{MPLTEXT 0 21 8 "makehelp" }{TEXT -1 297 " command allows .mws files to be displayed in command-line Maple. Using this and a bit of system-level programm ing, we can take a .mws file and extract its input regions (commands) \+ into a text file, or run those commands directly in command-line Maple . Once it is set up, the DOS or Unix command" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {MPLTEXT 0 21 18 "execmws myfile.mws" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 134 "will r un command-line Maple on the commands in the worksheet file \"myfile.m ws\" and show the commands and their outputs. If you use\n\n " } {MPLTEXT 0 21 22 "execmws myfile.mws -q\n" }{TEXT -1 96 "\nyou will se e only the outputs, omitting the commands, Maple's startup\nmessage, e tc. If you use" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {MPLTEXT 0 21 30 "execmws myfile.mws outfile.txt" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 79 "the commands will be plac ed into the file \"outfile.txt\" rather than being run.\n" }}{PARA 0 " " 0 "" {TEXT -1 164 "There is no way (as far as I know) to create a wo rksheet file with command-line Maple. However, that should not be nec essary: you can work with text files instead." }}}{SECT 0 {PARA 3 "" 0 "" {TEXT 26 10 "Unix setup" }}{PARA 0 "" 0 "" {TEXT -1 30 "In Unix, \+ put the script file \"" }{HYPERLNK 17 "execmws" 1 "execmws" "" }{TEXT -1 242 "\" into a directory on your command path, with \"execute\" per mission set. This script uses the \"awk\" programming language, whic h is included in most Unix installations. It assumes that the command you use for command-line Maple is \"maple\". " }}{PARA 0 "" 0 "" {TEXT -1 71 "If the command name is different, you can edit the script to change it." }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 317 "For convenience, the following Maple code will produce t he script file, and set its execute permission. It will be written in to the current directory: if that is not where you want it, you can in sert the directory name before execmws in the next command. Of course , you must have write permission in this directory." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "fname:= \"execmws\";" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&fnameGQ(execmws6\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1176 "fprintf(fname,\"#!/bin/sh\\n# Save this file as tex t, using the name execmws,\\n# in a directory on your command path. S et the \\n# file's permissions so you can execute it.\\n#\\n# This fi nds the path to command-line Maple. \\n# If the path below is not rig ht, edit it\\nMaple=/usr/local/maple/bin/maple\\n#\\nif [ -x $Maple ] \\nthen \\n# found it successfully\\n :\\nelif [ `type -type maple` \+ ]\\n# this will work if it's on the path \\nthen\\n Maple=`type -pat h maple`\\nelif [ -x /usr/bin/maple ]\\n# try some other possibilities \\nthen\\n Maple=/usr/bin/maple\\nelif [ -x /usr/local/bin/maple ]\\n then\\n Maple=/usr/local/bin/maple\\nelif [ -x ~/bin/maple ]\\nthen\\n Maple=~/bin/maple\\nelse\\n echo Where is maple? Edit the file execm ws to supply the path.\\n exit\\nfi\\n\\ncase \\\"z$2\\\" in\\n z-q) \\n echo 'readlib(makehelp)(foo,`'$1'`);' | $Maple -q | \\n awk '/^ >/ \{print substr($0,2)\}' | $Maple $2\\n ;;\\n z)\\n echo 'readlib (makehelp)(foo,`'$1'`);' | $Maple -q | \\n awk '/^>/ \{print substr( $0,2)\}' | $Maple $2\\n ;;\\n * )\\n echo 'readlib(makehelp)(foo,`' $1'`);' | $Maple -q | \\n awk '/^>/ \{print substr($0,2)\}' > $2\\n \+ ;;\\nesac\\n\\n\"); \nfclose(fname);\nsystem(\"chmod 755 \"||fname); " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"%k5" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"!" }}}{PARA 0 "" 0 "" {TEXT -1 1 " " }}}{SECT 0 {PARA 3 "" 0 "" {TEXT 26 13 "Windows setup" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 26 "In Windows, use the file \"" } {HYPERLNK 17 "execmws.bat" 1 "execmws.bat" "" }{TEXT -1 136 "\", and r un it in a DOS window. You will\027 also need the \"awk\" programming language. Shareware versions of awk for DOS are available at " } {URLLINK 17 "http://www.simtel.net" 4 "http://www.simtel.net/simcgi-bi n/dosfind.cgi?queryinput=awk320" "" }{TEXT -1 300 ". Execmws.bat assu mes that the command you use for command-line Maple is \"cmaple\", and for awk is \"awk\". If these are not right, or if the files cmaple.e xe and awk.exe are not on the command path, you'll need to edit the fi le execmws.bat and insert the appropriate path before each cmaple and \+ awk.\n" }}{PARA 0 "" 0 "" {TEXT -1 88 "If you are not sure what your c ommand path is, the following Maple code will display it." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "S:= ssystem(\"path\")[2]:\nprintf(S );" }}}{PARA 0 "" 0 "" {TEXT -1 321 "For convenience, the following Ma ple code will produce the script file, and set its execute permission. It will be written into the current directory: if that is not where \+ you want it, you can insert the directory name before execmws in the n ext command. Be sure to use \"/\" or \"\\\\\" rather than \"\\\" in d irectory names. " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "fname:= \"execmws.bat\";" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&fnameGQ,execmw s.bat6\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 305 "fprintf(fname, \"%s\",\"@echo off\\nif \\\"%2\\\"==\\\"-q\\\" goto one\\nif \\\"%2\\ \"==\\\"\\\" goto one\\necho readlib(makehelp)(foo,`%1`); |cmaple -q | awk \\\"/^>/ \{print substr($0,2)\}\\\" > %2\\ngoto end\\n:one \\nech o readlib(makehelp)(foo,`%1`); |cmaple -q | awk \\\"/^>/ \{print subst r($0,2)\}\\\" | cmaple %2\\n:end\");\nfclose(fname);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"$[#" }}}}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 10 "See \+ also: " }{HYPERLNK 17 "makehelp" 2 "makehelp" "" }{TEXT -1 2 ", " } {HYPERLNK 17 "Maple" 2 "Maple" "" }}}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 25 "Maple Advisor Database, " }{TEXT -1 14 "R. Israel 1999" }}}} {MARK "2 1 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }