home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / sml / sml.inf (.txt) < prev    next >
OS/2 Help File  |  1993-08-09  |  15KB  |  358 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. What is SML for PM? ΓòÉΓòÉΓòÉ
  3.  
  4.  This package contains two programs for using the functional language Standard 
  5. ML. 
  6.  
  7.  
  8. ΓòÉΓòÉΓòÉ 1.1. Programs, copyright and other stuff ΓòÉΓòÉΓòÉ
  9.  
  10. All programs are based on the Edinburgh Implementation of Standard ML 
  11. (v4.1.02). sml.exe is therefore (c) by Edinburgh University. 
  12.  
  13. The OS/2 2.0 port of sml.exe and all other programs are written by Felix von 
  14. Normann The programs may be copied und used for free (for personal usage). 
  15. Since the programs are free, there are no warranties for any damages caused 
  16. directly or indirectly by them. All software is supplied AS IS. 
  17.  
  18. This is a very early program version, so there are probably a lot of bugs. If 
  19. there is somebody interested in a 2nd version, please let me know bugs and 
  20. errors. I will try to fix them in the next release. 
  21.  
  22. All comments are very welcome. The author can be reached at: 
  23. normann@peschl.fmi.uni-passau.de; Felix von Normann, Innstrasse 82, D-94036 
  24. Passau 
  25.  
  26.  
  27. ΓòÉΓòÉΓòÉ 1.2. programs contained in this package ΓòÉΓòÉΓòÉ
  28.  
  29.  1. readme - You should already have read this 
  30.  
  31.  2. sml.exe - the OS/2 2.0 port of Edinburgh SML version 4.1.02 
  32.  
  33.  3. smlpm.exe - A PM-Shell for SML. (needs sml.exe) 
  34.  
  35.  4. sml.exp - An import file necessary for sml.exe (all versions) 
  36.  
  37.  5. smlref.inf - A small SML reference in german (use view.exe) 
  38.  
  39.  6. sml.inf - This document 
  40.  
  41.  7. qref.txt - Used for online help 
  42.  
  43.  8. *.ml - some samples 
  44.  
  45.  9. (The DOS-port is not discussed in this manual) 
  46.  
  47.  
  48. ΓòÉΓòÉΓòÉ 1.3. SML - 2 versions ΓòÉΓòÉΓòÉ
  49.  
  50.  1. sml.exe - the OS/2 2.0 port of Edinburgh SML version 4.1.02 
  51.  
  52.     This program is almost left in it's original version (except changing the 
  53.     float div 0.0 and garbage collection). This Program can be used either via 
  54.     stdin/stdout or by piping a file into it. It is intended to be used for 
  55.     large projects and small experiments. sml.exe is necessary for smlpm.exe 
  56.  
  57.  2. smlpm.exe - A PM-Shell for SML. 
  58.  
  59.     This program provides a real PM-Interface for SML including an editor. This 
  60.     program is intended to be used for small and medium programs, experiments 
  61.     and testing. Since it uses the graphics mode it is slower than than sml.exe 
  62.     but I hope it is easier to use. 
  63.  
  64.  
  65. ΓòÉΓòÉΓòÉ 2. Quick Start ΓòÉΓòÉΓòÉ
  66.  
  67. You can simply start the programs by: 
  68.  
  69. sml.exe: sml (This starts sml.exe with a minimal heap and a default import file 
  70. "sml.exp"). 
  71.  
  72. smlpm: smlpm (This starts the PM-program which works interactive). You can type 
  73. in the functions on the last line only. 
  74.  
  75.  
  76. ΓòÉΓòÉΓòÉ 3. User's Guide ΓòÉΓòÉΓòÉ
  77.  
  78.  
  79. ΓòÉΓòÉΓòÉ 3.1. sml.exe ΓòÉΓòÉΓòÉ
  80.  
  81. This section describes the usages of sml.exe 
  82.  
  83.  
  84. ΓòÉΓòÉΓòÉ 3.1.1. Getting started ΓòÉΓòÉΓòÉ
  85.  
  86. The syntax is: sml [-a] [-h size] [-q] [impFile] 
  87.  
  88. -a means to use ANSI-sequences. SML output and user input are displayed in 
  89. different colors. 
  90.  
  91. -h specifies the size of heap used for Standard ML. 
  92.  
  93. -q starts ML in quiet mode 
  94.  
  95. An import file can be given != sml.exp. 
  96.  
  97. Example: sml -a -h 4000 smlexp.exp starts sml in ANSI-mode, with a heap of 
  98. almost 4MB. SML uses smlexp.exp as the import file. 
  99.  
  100.  
  101. ΓòÉΓòÉΓòÉ 3.1.2. Small expressions ΓòÉΓòÉΓòÉ
  102.  
  103. It is easy to type in small expressions. The last one can be recalled by 
  104. pressing F3. 
  105.  
  106.  
  107. ΓòÉΓòÉΓòÉ 3.1.3. Editing ΓòÉΓòÉΓòÉ
  108.  
  109. For larger functions the ML-commandline is not comfortable enough. There are 
  110. three possibilities to make the work easier: 
  111.  
  112.  1. For OS/2 windowed shells you can use the OS/2's cut and paste features. 
  113.  
  114.  2. You can use your favorite text editor. Save the file and type use file.ml. 
  115.     use (string->unit) is a standard function of ML. SML loads the file and 
  116.     evaluates the expressions. 
  117.  
  118.  3. Put a small editor (must be VIO) (e.g. t.exe, supplied by IBM) into the 
  119.     PATH. Load edit.ml by typing use edit.ml This file defines 2 functions: 
  120.     edit (string->unit) invokes the texteditor, run (string->(unit*unit)) 
  121.     invokes first the editor and then loads the program. If your editor is not 
  122.     t.exe you simply have to change edit.ml 
  123.  
  124.  
  125. ΓòÉΓòÉΓòÉ 3.2. smlpm.exe ΓòÉΓòÉΓòÉ
  126.  
  127. This section describes the features of smlpm 
  128.  
  129.  
  130. ΓòÉΓòÉΓòÉ 3.2.1. Getting started ΓòÉΓòÉΓòÉ
  131.  
  132. smlpm does not need any parameter. All settings are changed interactive. 
  133.  
  134.  
  135. ΓòÉΓòÉΓòÉ 3.2.2. If you need help ΓòÉΓòÉΓòÉ
  136.  
  137. There are 3 help textes available: 
  138.  
  139.  1. Help/Infos... or view sml.inf displays this text about how to use smlpm. 
  140.  
  141.  2. Help/Reference... or view smlref.inf shows a small reference af the 
  142.     languages. 
  143.  
  144.  3. Help/Quick reference opens a window with a small help text (qref.txt). 
  145.  
  146. In Addition there is a context help. Press F2 near or on a keyword (e.g. 
  147. abstype). Immediately a help screen will pop up. 
  148.  
  149.  
  150. ΓòÉΓòÉΓòÉ 3.2.3. Typing small expressions ΓòÉΓòÉΓòÉ
  151.  
  152. If you just want to type in a small expression, it is the best to type it in 
  153. directly in the main window. To avoid problems it is allowed to type in only in 
  154. the last line. Move the cursor to the bottom and type in: val x=5; As soon as 
  155. you press Enter, ML answeres your input. 
  156.  
  157. You can recall the last line by typing F3. 
  158.  
  159.  
  160. ΓòÉΓòÉΓòÉ 3.2.4. Using the main window. ΓòÉΓòÉΓòÉ
  161.  
  162. The main window is intended to be used for small functions and experiments. See 
  163. the chapter about small functions. 
  164.  
  165. To avoid problems all lines except the last one are read-only. To type text 
  166. always move to the last line 
  167.  
  168. You can import a file by choosing File/Import. This simulates typing use ... 
  169.  
  170. The Edit menu works exactly like e.exe. You can cut and paste text from the 
  171. window. 
  172.  
  173. If you want to change the font select Options/Change font 
  174.  
  175. Since smlpm actually loads sml.exe to eval your expressions you can give the 
  176. path and name of sml.exe and the import file in the options menu. You can also 
  177. change the heap size whichs defaults to 4000 KB. 
  178.  
  179. It is possible to save the ML dialog by selecting File/save transcript. 
  180.  
  181. You can restart sml.exe (the child process of smlpm.exe) by choosing 
  182. File/ReStart. This is important if you change options or if sml.exe stopped its 
  183. job. 
  184.  
  185. All options are saved. So they are available the next time the program is 
  186. started. Be careful to leave the program via File/Quit. 
  187.  
  188.  
  189. ΓòÉΓòÉΓòÉ 3.2.5. Using the editor ΓòÉΓòÉΓòÉ
  190.  
  191. For larger functions you can start as many editors as you want by selecting 
  192. Tools/Editor. 
  193.  
  194. Type in the whole funtion(s). That can be several lines. By pressing Alt-V (or 
  195. selecting eval) all text is copied into the main window and sent to sml.exe. By 
  196. pressing Alt-U (or selecting use) all text is saved in a temporary file and 
  197. loaded by the use-funtion 
  198.  
  199. You can make full use of all edit capabilities include undo, cut, paste, ... 
  200.  
  201. When all functions are working save the file by selecting file/save(as). The 
  202. default name is noname.ml. The actual name is displayed on the title bar. 
  203.  
  204. Be careful with menu option clear. The text is cleared without explicitly 
  205. asking for permission. 
  206.  
  207. By closing the main window ALL editor windows are closed without saving. 
  208.  
  209.  
  210. ΓòÉΓòÉΓòÉ 3.2.6. Keyboard shortcuts and syntax expansion ΓòÉΓòÉΓòÉ
  211.  
  212. Keyboard shortcuts:
  213. Alt-V: Evaluate expression (edit window)
  214. Alt-U: Evaluate expression using temporary file
  215. Alt-B: abstype
  216. Alt-D: datatype
  217. Alt-A: andalso
  218. Alt-C: case
  219. Alt-X: exception
  220. Alt-H: handle
  221. Alt-I: if
  222. Alt-L: local
  223. Alt-N: nonfix
  224. Alt-O: orelse
  225. Alt-R: raise
  226. Alt-T: then
  227. Alt-V: val (main window)
  228. Alt-w: while
  229. Alt--: =>
  230.  
  231. Syntax expansion:
  232. Ctrl-a: abstype
  233. Ctrl-d: datatype
  234. Ctrl-c: case of
  235. Ctrl-i: if then else
  236. Ctrl-l: local
  237. Ctrl-v: let
  238.  
  239. This is specific to the german keyboard layout! These keyboard macros are
  240. available in both, main and aditor windows.
  241.  
  242.  
  243. ΓòÉΓòÉΓòÉ 4. Technical information ΓòÉΓòÉΓòÉ
  244.  
  245. This chapter describes some technical information 
  246.  
  247.  
  248. ΓòÉΓòÉΓòÉ 4.1. Why OS/2 2.0? ΓòÉΓòÉΓòÉ
  249.  
  250. OS/2 2.0 is a modern operation system. It allows SML to use 32 Bit and Flat 
  251. memory. Because I did not want change the SML sources more than necessary 
  252. sml.exe is started as a child process. stdin and stdout are piped into 
  253. smlpm.exe. The operating system must offer a lot of functions for IPC. I 
  254. believe this is an impossible task with Windows. SML needs a lot of processor 
  255. time. This makes it necessary to divide the work into several tasks. With 
  256. smlpm.exe there are at least 4 threads running. Because of the usage of 
  257. multithreading sml does not slow down the system dramatically. 
  258.  
  259. Another reason for using OS/2 2.0 was its clear and easy to use API. In fact, 
  260. programming OS/2-PM is easier than programming windows. 
  261.  
  262.  
  263. ΓòÉΓòÉΓòÉ 4.2. Why not Windows? ΓòÉΓòÉΓòÉ
  264.  
  265. Porting SML to 16-Bit Windows is almost impossible. There must be made a lot of 
  266. changes in the original source files which I tried to avoid. 
  267.  
  268. Of course it allmost impossible but not really impossible to port SML for 
  269. windows. It's a question af tools and I already had a windows 3.1 version (but 
  270. I did not like it because I cannot use my german keyboard). But because Win16 
  271. is sometimes annoying and all other time frustrating I do not want to spend any 
  272. more time on it. 
  273.  
  274. Windows lacks the features of multithreading, interprocess communication, it 
  275. has a bad API and even worst memory management. 
  276.  
  277.  
  278. ΓòÉΓòÉΓòÉ 4.3. Why not NT? ΓòÉΓòÉΓòÉ
  279.  
  280. When this program was written NT was still beta. It has inherited some problems 
  281. from Windows (e.g. API). It does use a lot of resources (I do not want to give 
  282. away 10 MB of my RAM for the OS). 
  283.  
  284.  
  285. ΓòÉΓòÉΓòÉ 4.4. Implementation ΓòÉΓòÉΓòÉ
  286.  
  287. sml.exe was written in C (about 6000 LOC), pmsml.exe was written in C++ (about 
  288. 1500 LOC short), but it is not programmed truely object-oriented. I did not use 
  289. any class-library, so it is written in low-level OS/2. 
  290.  
  291. In this release smlpm starts sml.exe as a child process. It redirects the 
  292. stdout into its own window an sends all keystrokes to sml.exe. Of course this 
  293. way is unusual and can cause problems. The reason why I decided to work like 
  294. this is that I did not want to change the Edinburgh source code. That has has a 
  295. number of advantages: no additional bugs to sml.exe, easy to upgrade fam.exe, 
  296. easy to port to a different language, separate GUI-code and language code, and 
  297. some other. Since OS/2 is a true multitasking operating system, this solution 
  298. should work stable. 
  299.  
  300. The main window uses an special kind of MLE (multi-line-entry field) that is 
  301. "inherited" from a normal MLE. MLE are not intended to be used interactive so 
  302. some problems my arise because of this. Why use a MLE? Because they are a 
  303. ready-to-use editor. The alternative would be to write the own epm. This would 
  304. take months. In addition, writing an editor for a complex GUI like PM (or even 
  305. Windows) is not an easy task. I bet the first release of an editor would be 
  306. very buggy. So why not reuse well-tested code? I hope this solution will not 
  307. cause many problems. 
  308.  
  309. A MLE should be use with less then 16K, but I tried it with large files - 
  310. without difficulties. 
  311.  
  312.  
  313. ΓòÉΓòÉΓòÉ 5. trouble shooting ΓòÉΓòÉΓòÉ
  314.  
  315. This section describes some common problems 
  316.  
  317.  
  318. ΓòÉΓòÉΓòÉ 5.1. There is nothing happen! ΓòÉΓòÉΓòÉ
  319.  
  320. Ensure that sml.exe is in the path, or change the option-settings 
  321.  
  322.  
  323. ΓòÉΓòÉΓòÉ 5.2. SML is starting, but nothing happens! ΓòÉΓòÉΓòÉ
  324.  
  325. Ensure that sml.exp is in the path, or change the option-settings 
  326.  
  327.  
  328. ΓòÉΓòÉΓòÉ 5.3. I cannot type in anything ΓòÉΓòÉΓòÉ
  329.  
  330. The main window accepts input only if the cursor is in the last line. Scroll 
  331. down to the last line. 
  332.  
  333.  
  334. ΓòÉΓòÉΓòÉ 5.4. The window is blinking (flickering)! ΓòÉΓòÉΓòÉ
  335.  
  336. Thats not my fault. e.exe behaves the same way. Try to make the window as small 
  337. as possible. 
  338.  
  339.  
  340. ΓòÉΓòÉΓòÉ 5.5. The editor is slow. ΓòÉΓòÉΓòÉ
  341.  
  342. There is much overhead when doing graphics. Try to minimize the overhead by 
  343. making the window as small as possible. 
  344.  
  345.  
  346. ΓòÉΓòÉΓòÉ 5.6. SML quits work. ΓòÉΓòÉΓòÉ
  347.  
  348. Simply choose menu "File/ReStart". All definitions must be typed in from the 
  349. beginning. 
  350.  
  351.  
  352. ΓòÉΓòÉΓòÉ 5.7. General problems. Wrong output. ΓòÉΓòÉΓòÉ
  353.  
  354. The sml-interpreter is started as a child process. It is very difficult to 
  355. decides for smlpm.exe that sml.exe has done all work and is ready to accept 
  356. more input. I used semaphores to do this but I know there are still a lot of 
  357. problems left. If eval is not functioning the correct way try to select the use 
  358. option. I know there are a lot of bugs left and I work on them.