home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / m / msh21.zip / MSHFILES.ZIP / MSHART.DOC < prev    next >
Text File  |  1992-08-18  |  17KB  |  288 lines

  1. It's Not Just Another DOS Shell
  2.  
  3. Michael Durant, NEI-PC
  4.  
  5. Since I have been looking for "The Perfect DOS Shell", I investigate every new 
  6. shell program I can find.  They all seemed to have one (or more) severe short 
  7. commings to me.  Now I have found the answer, Mi-Shell.  This really is the 
  8. one shell for everyone!  "How can that be", you may well ask?  Well, the 
  9. reason is that Mi-Shell (MSH) is completely configurable (programmable) by the 
  10. user.  You can get anything you want from Mi-Shell (sung to the tune of 
  11. "Alice's Restaurant", sort of).  I am going to start off by describing the 
  12. system as it "comes from the box" and then discuss the "programmability" of 
  13. Mi-Shell. 
  14.  
  15. Mi-Shell comes from OPENetwork for only $49.00, less than the cost of any of 
  16. the other comparable shell programs (such as Norton Commander, my previous 
  17. favorite).  The installation is simple and is done without all of the hidden, 
  18. inaccessible system bashing that is so common today.  Three simple DOS 
  19. commands install the package: make a directory for the package, change to that 
  20. directory, run the self-extracting pk-unzip on the distribution diskette.  The 
  21. package is installed and ready to run!  If you want to start the shell on you 
  22. own, type 'MSH' from the DOS prompt, or you can edit your AUTOEXEC.BAT to 
  23. start it every time you boot your system.  It is also advisable to add the MSH
  24. directory to your path, especially if you want to start MSH from some other 
  25. directory, and/or use the "magic" function.  "magic" is the name given by 
  26. OPENetwork (ON) to the function that permits all but an 8k "kernel" of MS to 
  27. be swapped out of RAM, freeing it for use by applications it "launches".   
  28.  
  29. MSH comes all set up to run in a default configuration that is a good starting 
  30. point for many needs.  Much of the default configuration reflects the Norton 
  31. Commander's (NC) contribution to the field of shells.  There are two 
  32. independent windows.  Each is controlled independently.  There are two file 
  33. display modes, like NC, 3 columns of file names or 1 column with size, date & 
  34. time information included. Unlike NC, however, the length of each window can 
  35. be adjusted from one line to the screen size. Movement within the windows is
  36. similar (but not identical).  There is a "menu bar" on the top of the screen
  37. that can be one or two lines, and the DOS prompt is always on the 25th line
  38. (like NC).  
  39.  
  40. All of the capabilities of NC are available (with some minor differences) for 
  41. "tagging" files, copying the currently highlighted file's name to the command 
  42. line, copying, deleting, moving, etc.  But there are many more functions 
  43. available with MSH in this mode.  In the NC, things typed that are not commands 
  44. to NC are placed on the line at the DOS prompt, and "ENTER" will pass that 
  45. string to COMMAND.COM normally. MSH has this capability as well as many of the 
  46. features of the best "command line editors" for recalling and editing past 
  47. commands.  This has always been one of my biggest complaints about NC. 
  48.  
  49. Things typed on the command line can also be used by MSH for purposes other 
  50. than command execution.  For instance, if I type '*.obj', it will appear on 
  51. the command line.  If I then hit 'ALT-P' the display for the current window 
  52. will contain only the files in that directory that match that string as if I 
  53. had typed "DIR *.OBJ".  Another key would have "tagged" all files with the 
  54. "obj" extension for use in "looped" commands (to be discussed later on).  In 
  55. the default configuration there are 70+ commands like these defined.  NC has 
  56. only a dozen or so.  
  57.  
  58. So far MSH looks like a nice shell program at a nice price, but so what?  Well, 
  59. now we come to my favorite part.  If you don't like a command, you can change 
  60. it, delete it or replace it.  You can also add new commands that you define, 
  61. and lastly, you can link in whole new functions that you write and compile 
  62. (examples for C programmers are included, but the information can be extended 
  63. to assembly language at least, and perhaps to other languages by OPENetwork in 
  64. the future?). 
  65.  
  66. Now lets begin to look at how MSH works, and how we, the users, can change it 
  67. for our needs.  The entire system, as it comes "out of the box", is built from 
  68. control files that use a simple, but powerful, set of "primitives" to create 
  69. the commands that you actually execute.  The system is built upon a "stack 
  70. oriented" processor that is at the core of Mi Shell.  It is very similar to the 
  71. "Forth" programming language, and in fact, several of the basic commands like 
  72. 'dup' (which duplicates the top item of "the stack") and 'swap' (which 
  73. exchanges the top two items on "the stack") are identical.  A more familiar 
  74. example would be the RPN calculators, like the H.P. series, that use a stack.  
  75. You enter numbers onto the stack, and "operation keys" like '*' (multiply) 
  76. operate on one or more items on the stack.  Lets take the multiply example.  
  77. First you have to get the two numbers to be multiplied onto the stack.  To do 
  78. that you type the number (say '123.5').  That is the top of the stack.  Now 
  79. touch the "enter" key, which is similar to the 'dup' function, and that number 
  80. is duplicated in the to two items on the stack. Now enter the next number (say 
  81. '20') which will become the top stack item.  At this point the stack has two 
  82. items, your numbers '123.5' and '20'.  If you now press the '*' key, those 
  83. two numbers are removed from the stack, multiplied and the result ('2470') is 
  84. pushed onto the stack.  Now instead of the two original numbers, the stack has 
  85. only the single result.  If all of this sounds very complicated, don't panic!  
  86. It is harder to describe than it is to use.  
  87.  
  88. Another reason to relax is that most of the more common changes are very 
  89. straight forward (mostly because OPENetwork did a great job of designing their 
  90. default configuration files).  Lets look at the first few changes that you will 
  91. want to make (these are fully described in the manual).  We will modify a file 
  92. called CONFIG.MSH.  This is the master configuration file. 
  93.  
  94. First, lets change the editor to be called by MSH when you have selected a 
  95. file and press the F4 key to edit it.  Mi-Shell is initially configured to use 
  96. an editor that is included with the package.  This is a small, fast editor that 
  97. is very usable for small editing jobs (similar to the editor that NC supplies 
  98. with their package. There is a line in CONFIG.MSH: 
  99.  
  100.          "mwe "editor!          | define your editor
  101.  
  102. The text between the quotes is the name of the editor that MSH supplies, mwe.  
  103. Everything after the '|' is a comment.  There are lots of comments in the 
  104. files that OPENetwork included to help make your job easier. 
  105.  
  106. Lets take a moment to look at this line and what it is doing.  The line is 
  107. scanned from left to right (just like you read, I hope).  The first thing that 
  108. MSH finds is a string (everything between the quotes).  That is called a token.  
  109. Tokens are always pushed onto the stack.  So now we have one thing on the 
  110. stack, a string token ("mwe ").  Now MSH comes to 'editor'.  It is not in 
  111. quotes, so it is not a string, it is an object.  Ending the line is the 
  112. exclamation mark, '!'.  That is one of the built in 'primitive' commands.  It 
  113. takes the second token on the stack (the string "mwe ") and stores it in the 
  114. object named by the top of the stack (editor).  Now 'editor' contains the 
  115. string "mwe ", and the stack is empty. 
  116.  
  117. So, to make MSH use the PC-Write Lite editor (from Quicksoft), for example, 
  118. change that line to read: 
  119.  
  120.          "lite "editor!         | define your editor
  121.  
  122. It is as simple as that.  Now 'editor' contains "lite ", and when you press 
  123. 'F4' to edit files, MSH will use PC-LITE as the editor.  Next in line are the 
  124. controls for the disk drives that are available for MSH to use.  The following 
  125. lines in the file show that section of the file as shipped: 
  126.  
  127.         |"CD" fixed_drives!    | define your fixed drives
  128.          "CD" fixed_drives!
  129.         |"AB"floppy_drives!    | define your floppy drives
  130.          "AB"floppy_drives!
  131.  
  132. You can adjust it for extra drives that you want to be able to use, or you can 
  133. lock MSH out of particular drives as you desire.  For example, My 'D' drive is 
  134. being used by a non-DOS operating system at the moment, so I changed the 
  135. fixed_drives line as follows:
  136.  
  137.          "C"fixed_drives!
  138.  
  139. and so MSH does not know about the D drive and does not get confused by 
  140. requests to search all drives for a file, for example.  Lastly, lets tell MSH 
  141. about some utility programs that I have available.  These are lines in the 
  142. same file: 
  143.  
  144.          false berk!
  145.          false delta!
  146.          false berk_cpmvrm!
  147.  
  148. Again we push two items onto the stack and store the second one in the top 
  149. one.  However, this time we do not have a string as the second item.  The 
  150. 'false' is a primitive that pushes a value that equates to false in tests 
  151. (zero for number items and empty string for string items).  Now when the store 
  152. command (the !) executes, it stores "false" in the indicated locations.  There 
  153. is also a 'true' primitive for the obvious alternate boolean tests. 
  154.  
  155. Again the MSH manual explains how and why to change these, but it should be 
  156. apparent.  I have the Berkeley Utilities and delta, so the first two changes 
  157. should be obvious.  The third line controls the set of functions that MSH uses 
  158. for copy, move and delete functions.  When it is set to true, MSH uses  
  159. versions based on the Berkeley Utilities functions 'cp' 'mv' and 'rm', 
  160. otherwise it uses built-in  'copy', 'unlink' and 'rename' functions.  I like
  161. BU, so I set this one to true also and end up with: 
  162.  
  163.          true berk!
  164.          true delta!
  165.          true berk_cpmvrm!
  166.  
  167. That is all that is required for many of the changes you are likely to need to 
  168. make, especially in the beginning.  As you become used to MSH and its initial 
  169. configuration, you will think of things to adjust, change, add or delete.  
  170. Lets look at a couple of these more complicated changes.  
  171.  
  172. First, I hate to wait for computers (they are supposed to be instantaneous, 
  173. after all), and one of the things that PC-LITE does when starting up is to ask 
  174. if a backup file should be created or not.  There is a command line switch 
  175. that bypasses that prompt and automatically creates the backup and goes 
  176. directly to editing (another option does not create the backup before the 
  177. editing starts).  However, the switch has to come after the name of the file 
  178. to be edited, and so I cannot make a change to the editor definition we looked 
  179. at above.  The change has to be made in a different section of Mi-Shell's 
  180. configuration, a different file altogether, as a matter of fact.
  181.  
  182. Here is the most difficult part of changing the MSH system, finding the correct 
  183. file to change,  There are 17 '.msh' files supplied with the system.  Luckily, 
  184. 4 have almost all of the code for configuring the system.  In all fairness, 
  185. after a about thirty minutes "poking around" in these files I had a good idea 
  186. where to look for the appropriate code to change.  
  187.  
  188. The four main files are CONFIG.MSH, the master config file already mentioned;
  189. KEYBIND.MSH, which describes the functions assigned to keys; MENU.MSH is for 
  190. the menu and its functions; and STDDEFS.MSH, which defines most of the high 
  191. level functions used by the other three files.  There is also a file, 
  192. BERK.MSH, that defines functions using the Berkeley Utilities; DEMO.MSH and 
  193. DEMO2.MSH are tutorial/sample files that help to describe the MSH environment 
  194. and operation (they can be started from the MSH main menu); HELP.MSH which has 
  195. most of the help "stuff"; and EXT.MSH is where the 'extension' based 
  196. operations are defined (i.e. if the file extension is '.wks' start '123').  
  197. The other are 6 '.MSH' files are for various display/video card combinations, 
  198. only one of which will be used in any particular installation, and lastly 
  199. there is MANDEL.MSH, which shows off a fractal drawing program that is 
  200. distributed (along with a version of the game 'life' that is very nice) with 
  201. Mi-Shell. 
  202.  
  203. At any rate, I found the appropriate file (KEYBIND.MSH, which has most of the 
  204. key assignment data) and the appropriate line of code: 
  205.  
  206.         (editor current.name&exec)F4!
  207.  
  208. Lets dissect this line.  There are three "things" on the line.  Everything 
  209. between the parentheses is the first "thing".  Just as in most languages, 
  210. parentheses are used to group items.  The next "thing" on the line is 'F4' and 
  211. finally the '!'.  The first two "things" (or objects) are "pushed" onto the 
  212. stack.  The exclamation point is the same 'store' command we have already 
  213. seen.  It saves the 'editor current.name&exec' object (we will talk about what 
  214. that is in a bit) in the 'F4' object (i.e. what is "executed" every time the 
  215. F4 key is pressed). 
  216.  
  217. So far so good, but what did we store at F4?  We stored an object with four 
  218. parts: 'editor', 'current.name', '&' and 'exec'.  Starting on the left, we 
  219. have 'editor'.  That is the object that we changed earlier to use the name of 
  220. our editor.  When it is encountered, the string that we assigned to the object 
  221. 'editor' ("lite ") is placed on the stack.  Next is 'current.name'.  This is 
  222. one of the MSH defined 'primitives'.  It "pushes" the currently highlighted 
  223. file name on the current directory panel onto the stack.  We next come to the 
  224. '&'.  This is another MSH command called 'and', 'append' or 'concatenate'.  It 
  225. takes the top two items from the stack, "sticks them together" and then puts 
  226. the result back onto the stack.  For example, if we assume that current.name 
  227. pushed 'sample.txt', after the '&' the top item on the stack will be 'lite 
  228. sample.txt'.  Finally we come to 'exec', another MSH primitive. 'exec' sends 
  229. the top stack item to DOS to be executed ('lite sample.txt' in this example).
  230.  
  231. Now that we know what the OPENetwork version of the command does, we can 
  232. modify it for our needs.  What we want is to add " /e" to the string that is 
  233. sent to DOS.  All we have to do is include that string and append it to the 
  234. string already built using the '&' command just discussed.  Our modified 
  235. command definition looks like this: 
  236.  
  237.         (editor current.name " /e"&&exec)F4!
  238.  
  239. It could also look like this:
  240.  
  241.         (editor current.name& " /e"&exec)F4!
  242.  
  243. Both definitions will create the string 'lite sample.txt /e' for 'exec'.
  244.  
  245. Using the tutorials and these simple changes as examples, it is easy to create 
  246. your own definitions.  You can assign definitions to all four states of the 
  247. function keys, Normal, Shifted, Alt and Ctrl.  Also, all four versions of the 
  248. PgUp, PgDn, Home, End, arrows, Grey +, -, *.  Then there are the Ctrl and Alt 
  249. versions of all of the letter and number keys.  That is a total of 160 keys 
  250. that can have definitions.  Less than half of them have been defined in the 
  251. default configuration, which leaves a lot of room for your custom definitions!  
  252. There are also half a dozen mouse clicks that can be defined, including 
  253. support for three button rodents.
  254.  
  255. Besides the ample documentation and comments supplied with MSH, there is 
  256. another tool that they had the good sense to supply.  That is an interactive 
  257. debugger that you can turn on and off as desired.  When it is enabled, each 
  258. piece of a command can be stepped through one action at a time.  The contents 
  259. of the stack are displayed as well as the current object being process, 
  260. including a pointer to the next "thing" to be processed.  It is shown off well 
  261. in the tutorial, and I was able to make use of it in debugging a fairly 
  262. complicated command that I was trying to create.  A couple of minutes with the 
  263. debugger showed me the error the first time through (I had spent about half an 
  264. hour before that using trial and error to solve the problem without success).
  265.  
  266. In relation to the above debugging session, I should also mention another 
  267. great feature.  Once you have made some changes to one of the configuration 
  268. files, you can "re-load" the system to use the new commands without having to 
  269. "back-out" of Mi-Shell and then restart it.  This is a real time saver when 
  270. you are trying to create a new command.  The last point to bring up here is 
  271. that I have to say that the system is VERY robust.  I made some REAL stupid 
  272. syntax mistakes while I was trying my hand at writing commands, and I never 
  273. once was able to "lock-up" Mi-Shell (I have crashed Norton Commander more than 
  274. once, and it is not programmable). 
  275.  
  276. If all of the inherent programmability is not enough for you, there is also 
  277. the ability to link in your own function written in C using the sample files 
  278. that are supplied as a basis.  There is a complete set of example files that 
  279. create an example set of additional commands for MSH, including a batch file 
  280. that will compile, link, etc, the new system.  The sample batch file assumes 
  281. the Borland Turbo C compiler, but it took only a few minutes to convert for my 
  282. Microsoft C compiler.
  283.  
  284. I hope that this short introduction has given you a good idea of the power 
  285. inherent in this package.  If, like me, you have never been satisfied with the 
  286. current crop of DOS shell programs, Mi-Shell from OPENetwork may be the one 
  287. that you have been waiting for too.  
  288.