* sml-mode.el (sml-find-matching-starter): Use a list of syms instead of a
regexp.
(sml-indent-default): Use symbol membership rather than a regexp.
Also, use `sym-indent' instead of (current-column). This fixes a problem
with a hanging `structure Foo = (struct|let)' (due to `structure' having
a sml-indent-rule, as opposed to `fun'). Hopefully it won't introduce
other problems.
(sml-font-lock-keywords): Match vars `val x : int' also.
(sml-electric-pipe): Update to the new `sml-find-matching-starter' and
return a sensible default instead of raising an error in case of
unexpected situations.
(sml-indent-line): Ignore errors and keep the cursor where it is.
(sml-calculate-indentation, sml-indent-pipe): Use syms instead of regexps.
* sml-defs.el (sml-starters-re, sml-pipehead-re): Remove.
* testcases.sml: New file.
* makefile.pkg (test): new target to run the test suite.

* sml-util.el (make-temp-dir, make-temp-file, temp-file-dir,
delete-temp-dirs): Replaced by the make-temp-file from Emacs-21.
(custom-create-map): add :group arg and allow key to be a list.
(define-major-mode): Removed (use define-derived-mode instead).
(sml-builtin-nested-comments-flag): New var.
* sml-proc.el (sml-host-name): New var.
(sml-make-file-name): Replaced by `sml-compile-commands'.
(sml-config-file): New var.
(sml-compile-commands-alist): New var.
(inferior-sml-load-hook): Removed.
(sml-buffer): Query if the current buffer is not a *sml*.
(inferior-sml-mode): Use minor-mode-overriding-map-alist to disable
compilation-minor-mode's keybindings.
(run-sml): Turn into an alias for sml-run.
(sml-run): Query the user for the command. If prefix is set (or if
default value is not null) query for args and host. Use `split-string'
rather than our own function. Run cmd on another host if requested and
pass it an init file if it exists. Pop to the buffer at the end.
(sml-args-to-list): Remove.
(sml-compile): Look for special files (sml-compile-command-alist) in
the current dir (and its parents) to choose a default command. Remember
the command for next time in the same buffer. Make the `cd' explicit in
the command so the user can change it.
(sml-make-error): Fix for when `endline' is absent.
* sml-mode.el: Pass it rhough checkdoc.
(sml-mode-version): Remove.
(sml-load-hook): Remove.
(sml-mode-info): Use `info' rather than `Info-goto-node'.
(sml-keywords-regexp): Add "o".
(sml-syntax-prop-table): Use `defsyntax'.
(sml-font-lock-syntactic-keywords): Only use nested comments if supported.
(sml-mode): Use `define-derived-mode'.
(sml-electric-pipe): `sml-indent-line' -> `indent-according-to-mode'.
(sml-indent-line): Use `indent-line-to'.
(sml-cm-mode): New mode for CM files.
* Makefile: Update.
* sml-mode-startup.el: Remove since it's now autogenerated.
* sml-defs.el (sml-bindings): Remove left over C-c` binding.
(sml-mode-map): Add binding for sml-drag-region (was in sml-proc.el).
(sml-mode-syntax-table): Only use nested comments if supported.
(sml-mode-menu): Use next-error rather than the old sml-next-error.
(sml-pipehead-re): Remove "of".
* sml-compat.el (set-keymap-=parents): Make sure it also works when called
with a single keymap rather than a list.
(temporary-file-directory): Add a default definition for XEmacs.
(make-temp-file): New function.

* sml-move.el (sml-(for|back)ward-sym): now also return the string if any
and take care of the "op" special keyword.
(sml-op-prec): setup an alist for the infix operators.
* version 3.9.1: sent to Roland McGrath.

* opt/split.sml: seriously reworked. Now splits TFNs as well.
* kernel/primop.sml (effect): removed DEREF and MAKEREF from the pure
primops.
* flint/flintutil.sml (copy): sort the type-map since {lt,tc}_subst
actually expects it to be sorted.
* kernel/ltyextern.{sml,sig} (lt_nvpoly): new function (digged from
recover.sml to build a LT_POLY in the case of named tvars.
* opt/recover.sml: removed unused depth arguments left behind from before
we switched to named tvars.
(addLty): added for the benefit of opt/split.sml
(lt_nvpoly): moved to ltyextern.sml

* opt/fcontract.sml: (fcexp): straightforward split into functions
(fcLet): do the BRANCH thing after contraction (plus force an additional
contraction, so the total is 3 passes for a fairly good handling of
wrap's equality-primop compilation)
(fcLet): drop TAPP if the output is unused.

* opt/fcontract.sml: generalized the BRANCH thing.
It should now be faster to detect and avoid potential code blowups while
applying to more cases. But it requires one more pass to generate the
same code quality :-(

Merged in Bratin's typelifting and Chris' named tvars.
FLINT is now using tvars from the first lcontract all the way to cps.
* reps/rttype.sml: changes from Bratin.
(rtLexp): define the NVAR case (return the tvar as an lvar).
* opt/[fl]contract.sml: removed the restriction on inlining at the same
deBruijn depth.
* opt/lift.sml: new file for typelifting.
* flint/flintutil.sml (copy): added tvar renaming.
* flint/tvarcvt.sml: new file for named tvar <-> deBruijn conversions.

* opt/optutils.sml (id): removed. That was stupid.
* opt/collect.sml: drop support for actuals (was only used for cstargs).
* opt/lcontract.sml (lpfd): reset the inline bit to a safe value.
* opt/fcontract.sml (cstargs): eliminated. Might reappear in a
specialization phase some day.
(inline): turned off unrolling because it's buggy.
(APP): use the new ifs, damit!

* opt/fcontract.sml: take advantage of single-arm SWITCH (aka decon)
(SWITCH(CON)): just compare the conreps because types may differ (?)
(inlineWitness): ugly hack used to figure out if inlining happened,
in order to decide whether to keep the inline bit or not (in cfun).

* added basic unrolling support
* changed fkind to have most annotations valid on
functors as well. It also adds a loopkind annotation as well as extends
the inline boolean into a three-way alternative.
* switched to a continuation passing style to implement the
let-associativity rule in a better way.

made changes to kind-checking so that enc_tvar need not be exported
by ltykernel. one awkwardness is that the tkLookupFreeVars function
in ltykernel manipulates a tkindenv, which is technically not defined
until ltyextern.