# ***********************************************************************
#
# Project: sml/Tk: an Tk Toolkit for sml
# Author: Stefan Westmeier, University of Bremen
# $Date: 2001/03/30 13:39:14 $
# $Revision: 3.0 $
# Purpose of this file: Mark Module
#
# ***********************************************************************
# Compiled by:
#
src/lib/tk/src/tk.sublib### "Make not small plans, they hold no magic to
### stir men's souls, and they always fail."
###
### -- Edward F. Maeder
package mark
: (weak) Mark # Mark is from
src/lib/tk/src/mark.api{
stipulate
include package basic_tk_types;
include package basic_utilities;
herein
exception MARK_ERROR String;
fun show (MARK (n, m)) => (int::to_string n) $ "." $ (int::to_string m);
show (MARK_TO_END n) => (int::to_string n) $ ".end";
show MARK_END => "end";
end;
fun show_l ml
=
string::join
" "
(map
(\\ (m1, m2)
=
(show m1) $ " " $ (show m2)
)
ml
);
fun read m
=
{
my (x, y) = string_util::break_at_dot m;
if (size y == 0 and x== "end")
MARK_END;
elif ((not (size x == 0)) and y == "end")
MARK_TO_END (string_util::to_int x);
else
MARK (string_util::to_int x, string_util::to_int y);
fi;
};
fun read_l ml
=
dezip (map read mls)
where
mls = string_util::words ml;
fun dezip [] => [];
dezip (x . y . l) => (x, y) . (dezip l);
dezip _ => raise exception MARK_ERROR "MARK::readL: odd number of marks";
end;
end;
end;
};