home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / MRFiles / GSEXECP.SFX / execp.doc (.txt) next >
Encoding:
GEOS ConVerT  |  1990-02-12  |  9.6 KB  |  61 lines

  1. +"execp.doc
  2. PRG formatted GEOS file V1.0
  3. CONVERTED WITH GEOSHELL V2.2
  4. Write Image V2.1
  5. geoWrite    V2.1
  6.      @geoSHELL Command Documentation
  7. Copyright 1994 by Maurice Randall
  8. (requires geoSHELL V2.2 or greater)
  9.      @execp    (external transient)
  10. This command is called 'execp', which stands for 'execute with parameters'. What this does is it allows you to pass parameters to your exec files. Previously, an exec file (also known as a script or batch file) could only function as it was written. Now, by using the execp command to invoke your exec files, you can pass from one to six parameters to them, which can make the same exec file perform actions in different ways.
  11. The exec command itself is a resident command in geoSHELL. It does not have to be loaded from a disk when used. Normally, when you use the exec command, it will load in your exec file and execute the commands contained within it. If you use the execp command, execp will take care of loading in the file, but it will also plug in any parameters that you have supplied on the command line. Once this is done, it will invoke the exec command to finish the job.
  12. You can use the command exactly like you would the exec command and it will perform exactly the same. However, you can also supply up to six optional parameters. These parameters will be copied into the exec file in place of specific variables that you define when creating the exec file. Here's a simple example that uses one parameter:
  13. execp copyram^ b
  14. In this example, 'copyram' is the name of the exec file and 'b' is the parameter that is supplied to it. The exec file might look something like this:
  15. fcopy parm1 getshell^
  16. fcopy parm1 geoSHELL^
  17. fcopy parm1 GEOPAINT^
  18. fcopy parm1 MyFile^
  19. What would happen here is that since one parameter was supplied, execp will load in the exec file called copyram and replace all occurences of the string 'parm1' with the letter 'b'. When the exec command executes the file, it will call fcopy to copy four different files to the ramdisk which is drive B in this example.
  20. Let's look at another example that requires two parameters:
  21. execp paint^ a^ 8
  22. By now, you may have noticed that the filename for the exec file must be terminated by the usual up-arrow. Then each parameter is also terminated by an up-arrow. The last parameter on the line need not have an up-arrow since there are no more commands following it. One thing to keep in mind though is that you cannot have any multiple commands on the line with the execp command, since they would look like parameters to it. You must also place exactly one space between each up-arrow and the next parameter. If more than one space is used, the additional spaces will be considered part of the parameter, so this is perfectly legal.
  23. Anyway, let's take a look at an exec file that could use this example:
  24. parm1:
  25. @cpparm2^
  26. run GEOPAINT^
  27. The first parameter, which is an 'a' would be put in place of 'parm1'. Since parm1 is followed by a colon, this would select drive A as the active drive. Then an '8' would get put in place of 'parm2' and the command to select partition 8 on a CMD device would be formed.
  28.      @SOME LIMITS
  29. You can use as many as six different parameters named parm1 through parm6, and you can repeat any one of them as often as you wish within an exec file. Of course, depending on the size of your parameters, you may not be able to fit six parameters on one command line, especially in 40 column mode. If you find you need more room, you can define a function key from within an exec file and then use the function key. You can define the maximum allowed 80 characters for a function key if it is done from an exec file. The maximum size that each individual parameter may be is 16 characters. If you find that you need more than this for one parameter, then you would have to combine two parameters together.
  30. If the user supplies more parameters on the command line than exist in the exec file, the extra parameters will simply be ignored. Likewise, if not enough parameters are supplied, then no substitutions will be made for the missing ones. The drawback to this is that when the exec command comes to a location containing the text 'parm2', or 'parm3', or whatever, it will naturally not be a valid command and execution of the file will cease.
  31.      @USING DEFAULTS
  32. There might be some exec files that you will create and use that can be used exactly the s
  33.      @USING DEFAULTS
  34. There might be some exec files that you will create and use that can be used exactly the same way most of the time. In that case, the execp command is not needed. You would just do things the way you have always done them. However, there might be those times when you need to make a change here or there, in which case it is handy to be able to send a parameter. The command execp allows you to define some default parameters right within the exec file. You simply put the execp command in the exec file and follow it with the default parameters enclosed within curly braces. A previous example might be written as follows:
  35. execp {a^ 8^ GEOPAINT^ }
  36. parm1:
  37. @cpparm2^
  38. run parm3^
  39. If this file is named 'paint', you would just enter:
  40. execp paint
  41. Since you did not supply any parameters on the command line, the file will be loaded and executed as-is. Within the file, however, the execp command will be invoked and will recognize that you wish to use the default parameters. It will proceed to copy the defaults into the desired locations within the file and then exec will continue to execute the remainder of the file. If you had supplied any or all of the required parameters on the command line, then execp would only have used the defaults that you did not supply parameters for.
  42. To use execp from within the exec file like this, you must be sure to place the left curly brace after execp with exactly one space in between. Then put the first default beginning just after the curly brace without any space, unless the space is needed as part of the parameter. Put an up-arrow at the end of each parameter with a space separating each one. You must end the default definitions with a right curly brace. And this must be placed after the last defined default with exactly one space separating it from the last up-arrow. In other words, it would be where the next parameter would be placed if there was one. Up to six default parameters may be used here also.
  43. With execp contained in the file, the exec command itself could be used to execute the file since the execp command would set up the file correctly with the defaults anyway. The above example would then load and run GEOPAINT from partition #8 of drive A. 
  44. You can place execp with the default definitions anywhere within the exec file as long as they appear before the parameters that are to be changed. Normally, you would put it first in the file, since it is likely that the command is already loaded in memory if it was used to invoke the file.
  45.      @CALLING ANY PAGE
  46. Execp has another handy feature in that it allows you to execute any page within an exec file. The resident exec command wil
  47.      @CALLING ANY PAGE
  48. Execp has another handy feature in that it allows you to execute any page within an exec file. The resident exec command will only read page one. Just put the desired page number between the command name and the filename as in this example:
  49. execp 15 menufile^ key1^ key2
  50. This would load in page 15 of an exec file called 'menufile' and supply two parameters called 'key1' and key2'. Just like with the exec command, you can use the execp command to call up an exec file from within an exec file. You could conceivably have a 61 page exec file running some sort of presentation demo continuously. You can even put an exec file in a header or footer of your file. In this case, use page 62 or 63.
  51. If no page number is supplied, then execp defaults to page one.
  52. Here's one more example of a way to switch between 1581 partitions and native partitions on a CMD hard drive. To invoke the file, a command line would look like one of the following two forms:
  53. execp hd^ a^ NT
  54. - or -
  55. execp hd^ c^ 81
  56. The first example would make the hard drive  as drive A begin working with native partitions, while the second example would make it use 1581 partitions if it is located as drive C. Here's what the exec file would look like:
  57. remove parm1
  58. installHDparm2.128 parm1
  59. If you imagine the parameters copied in place of parm1 and parm2, you can figure out quite easily how the commands will work. Remember that the command such as installHD81.128 is created by the 'learn' command.
  60. The execp command should open up many possibilities for anything from a simple exec file to a very elaborate one. Just use your imagination and put this command to work for you.
  61.