Notes on the Mac port of 0.93

==============================================================================
Where to put the file AERegistry.h: "Mac #includes:Apple #includes:AERegistry.h".


===============================================================================
04Feb93 e

Filenames in SMLeNJ

SML needs to be able to use UNIX style pathnames which do not normally 
work on the Mac. SMLeNJ translates certain pathnames to work on the Mac 
when these pathnames are passed to open() or chdir().

The pathname translation rules are as follows:

1) Pathnames containing colons are passed through unmodified.

2) Pathnames beginning with '/' have the initial '/' removed 
   and all subsequent '/' are replaced by ':'.

3) Pathnames not beginning with '/' are prepended with ':' 
   and all subsequent '/' are replaced by ':'.

The effect is that pathnames beginning with '/' are global (from the 
system root) and pathnames not beginning with '/' are relative to the 
default directory. The default directory starts out as the one which 
contains the SML/NJ application, but can be changed with chdir() - for 
example through System.Directory.cd

open() also treats some files specially by setting the mode to TEXT; 
this makes the Mac ANSI library translate <return>s to <newline>s and 
visa versa. Files are opened in TEXT mode
a) if the file's Mac file type is 'TEXT'
    AND the file's name does not end in ".mo"
b) or if the filename ends in one of the following extensions:
  .s
  .sml
  .sig
  .txt
  .lex
  .grm

open() also treats filenames which begin with 'o' (0xA5) specially by 
making relative pathnames start in the application's directory rather 
than in the default directory as usual. the 'o' is also stripped. The 
pathname translation rules are then applied. This is useful for making
standalone applications. For example,
I use a line like...
if exportML("oSMLeNJ92.5") then print("Whoopee!\n") else print("\n");
to create a new application from the current world, where the current 
application is SMLeNJ92.5  In this case, the file type also defaults 
to APPL.

For SMLeNJ bootstrappers:

The usual_prefix string is now initialized to ":" -- prefix defaults to 
usual_prefix and is used as before to prefix pathnames not beginning with 
'/'. You probably shouldn't change usual_prefix or use the -d command line 
option to change prefix. In other words, the application or ThinkC project 
file must be in the src directory when bootstrapping ML.
===============================================================================
SMLeNJ User Interface Documentation
12Feb93  e

When launching SMLeNJ, holding the option key down prevents loading 
of the built in SML image, and presents a command line dialog. In 
addition to the usual SML/NJ command line options (-r, -m, -g, etc.) 
SMLeNJ supports:
  -i <filename>       load the image specified by <filename>
  -d <string>         use <string> as the filename prefix
See also the file: "<date-number> SMLeNJ filenames"

Preferences

The Styles... dialog may be used to establish certain preferences.
By default, these preferences are applied to the current window.
When the New Windows checkbox is checked, and OK is clicked, the 
preferences will be saved to a file in your Preferences folder in
your System Folder, and will be applied to all newly opened windows 
in this and subsequent sessions. The checkbox settings in the Find 
dialog are also saved by the Styles dialog. The Tabs setting effects
both how tab keystrokes are treated (see below) and how tab characters 
are translated to spaces upon opening a file.

Editing

It is assumed that you are familiar with standard Macintosh editing 
techniques. If not, you should consult your Getting Started disks and 
Macintosh users' manuals.

Special Keys

If you have an extended keyboard, the following special keys are supported:
      F1 - F4 - Undo, Cut, Copy, Paste
     F5 - F15 - function keys (not used)
         del> - delete forward, erase character after the insert point
         home - scrolls text to the top of the edit buffer
          end - scrolls text to the bottom of the edit buffer
      page up - scrolls text up a page
    page down - scrolls text down a page
Note that these last four do not move the insert point, just scroll.
The option key may be used with del> to delete to the end of the line.

On all keyboards:
       delete - erase character before cursor position
       return - insert new line and move to left margin
          tab - see below
        enter - evaluate the text to the left of the insert point, or
                evaluate the selected/text (non-Interaction Window buffer)
                the results are written to the Interaction Window
Printable characters are inserted into the buffer.  These are characters 
in the range of #x20 through #x7E.  Other characters are simply discarded.

Tab key

<tab> characters are never inserted into the text, rather <tab> inserts or
removes space from the front of the current line as follows:
 * C1 is the position of the first graphic character on the current line
 * P1 is the position of the first graphic character on the previous line
 * <option-tab>
 *   inserts or removes space on the current line to align C1 with P1
 * <tab>
 *   if C1 < P1 then same as <option-tab>
 *              else insert sufficient space on the current line
 *                   to move C1 right to next tab stop
 * <shift-tab>
 *   if C1 > P1 then same as <option-tab>
 *              else remove sufficient space on the current line
 *                   to move C1 left to previous tab stop
 * Notes: 
 *  <tab> does not move the insert point or selection relative to the text
 *  <tab> characters are never inserted into the text


Arrow Keys

On all keyboards with arrow keys,
            < - move cursor to the left one character
            > - move cursor to the right one character
            ^ - move cursor up one line
            v - move cursor down one line

Arrow keys can be modified with shift, option, and command.

The shift key may be used to extend the text selection per Apple standards.  
Each selection has an anchor end and an active end.  Generally, the active 
end is the last end you moved, the anchor end doesn't move.  When the shift 
key is help down, the selection's active end is moved by the arrow keys.

The option key may be used with the arrow keys to move the insert point 
left or right by word, or up or down by page.  Shift and option together 
may be used to move the active end of the selection left or right by words, 
or up or down by pages.

The command key may be used with the arrow keys to move the insert point 
left or right to the beginning or end of the line, or up or down to the 
beginning or end of the text.  Shift and command together may be used to 
move the active end of the selection to start or end of the line or text.

When shift, option, and command are held down together, the up or left 
arrow will make the beginning of the selection the active end, and the 
down or right arrow will make the end of the selection the active end.

Mouse

Mouse clicks
    single - position insert point
    double - select word
    triple - select line
Dragging after one of these clicks extends the selection by character, 
word, or line repectively; the anchor point is original click, the active 
end is the other end of the selection.  After a click-drag, the active end 
can be moved with shift clicks or shift arrow keys.  The anchor and active 
ends of the selection can be swapped with option+shift+click, or 
option+shift+command up/down or left/right arrow keys.

Scrolling

Holding down command, shift, option, and control keys speeds up scrolling 
when mousing in the arrows of the scroll bar. The more keys you hold down 
the faster (logarithmically) it scrolls.

Editor Limitations

Edit text size is limited by memory space.  There may be a maximum of 32K 
lines (not characters) of text.  The editor has been tested with files 
several hundred Kbytes in size.
===============================================================================

						Doug Currie


