From 2e66cc3501a23492b61cc99d330f2f9e765e5090 Mon Sep 17 00:00:00 2001 From: Manuel Krucker Date: Thu, 27 Mar 2008 18:54:30 +0000 Subject: [PATCH] git-svn-id: https://projects.brucker.ch/su4sml/svn/su4sml/trunk@7538 3260e6d1-4efc-4170-b0a7-36055960796d --- su4sml/src/compiler/smlnj.sml | 2 +- su4sml/src/rep_logger.sml | 25 ++++++++----------------- su4sml/src/rep_ocl.sml | 7 ++----- su4sml/src/secure_uml.sml | 3 ++- su4sml/src/xmi_parser.sml | 3 ++- su4sml/src/xmltree.sml | 2 +- su4sml/src/xmltree_parser.sml | 2 +- 7 files changed, 17 insertions(+), 27 deletions(-) diff --git a/su4sml/src/compiler/smlnj.sml b/su4sml/src/compiler/smlnj.sml index b382000..90cfdab 100644 --- a/su4sml/src/compiler/smlnj.sml +++ b/su4sml/src/compiler/smlnj.sml @@ -64,7 +64,7 @@ fun eval verbose txt = if verbose then print (output ()) else () end in - eval_fh (fn s => print (s^"\n"), fn s => library.error s) verbose txt + eval_fh (fn s => print (s^"\n"), fn s => Rep_Logger.error s) verbose txt end fun exnHistory e = SMLofNJ.exnHistory e diff --git a/su4sml/src/rep_logger.sml b/su4sml/src/rep_logger.sml index b2ec855..da4368d 100644 --- a/su4sml/src/rep_logger.sml +++ b/su4sml/src/rep_logger.sml @@ -44,8 +44,10 @@ sig val init_offset : unit -> unit val error : string -> 'a - - + val error_msg : string -> unit + val print_stderr : TextIO.vector -> unit + val warn : string -> unit + val info : string -> unit val log_level : int ref val line_offset : int ref @@ -67,11 +69,13 @@ sig val low : int val development : int + val su4sml_home : unit -> string + end structure Rep_Logger:REP_LOGGER = struct -infix |> -fun (x |> f) = f x; + + (* minimal tracing support (modifed version of ocl_parser tracing *) @@ -206,10 +210,6 @@ fun ap_some f (SOME x) = SOME(f x) fun separate s (x :: (xs as _ :: _)) = x :: s :: separate s xs | separate _ xs = xs; (* fun suffix sfx s = s ^ sfx;*) - -fun take (n, []) = [] - | take (n, x :: xs) = - if n > 0 then x :: take (n - 1, xs) else []; fun space_implode a bs = implode (separate a bs); @@ -230,15 +230,6 @@ fun error_msg s = print (s^"\n") (** output an error message and Fail *) fun error s = (print (s^"\n"); raise Fail s) - -fun fst (x, y) = x - -fun snd (x, y) = y - -fun join s nil = "" - | join s (h::nil) = h - | join s (h::t) = h^s^(join s t) - fun uncurry f (x,y) = f x y fun curry f x y = f (x,y) diff --git a/su4sml/src/rep_ocl.sml b/su4sml/src/rep_ocl.sml index 251e518..3a3647f 100644 --- a/su4sml/src/rep_ocl.sml +++ b/su4sml/src/rep_ocl.sml @@ -119,7 +119,9 @@ end structure Rep_OclType : REP_OCL_TYPE = struct +open Rep_Help_Functions open Rep_Logger + type Path = string list @@ -130,11 +132,6 @@ datatype OclType = Integer | Real | String | Boolean | OclAny | Classifier of Path | TemplateParameter of string -fun foldr1 f l = - let fun itr [x] = x - | itr (x::l) = f(x, itr l) - in itr l end; - (** Convert Path to a string using given separator *) fun path_to_string (path:Path) separator = case path of diff --git a/su4sml/src/secure_uml.sml b/su4sml/src/secure_uml.sml index f509179..20105e7 100644 --- a/su4sml/src/secure_uml.sml +++ b/su4sml/src/secure_uml.sml @@ -67,7 +67,8 @@ end *) functor SecureUML(structure Design: DESIGN_LANGUAGE):SECUREUML = struct -open library +open Rep_Help_Functions +open Rep_Logger structure Design : DESIGN_LANGUAGE = Design type User = string diff --git a/su4sml/src/xmi_parser.sml b/su4sml/src/xmi_parser.sml index 9b6b8f7..b014474 100644 --- a/su4sml/src/xmi_parser.sml +++ b/su4sml/src/xmi_parser.sml @@ -43,7 +43,8 @@ structure XmiParser : sig val readFile: string -> XMI.XmiContent end = struct -open library +open Rep_Help_Functions +open Rep_Logger open XmlTree open XmlTreeHelper diff --git a/su4sml/src/xmltree.sml b/su4sml/src/xmltree.sml index 35a5a75..2d36f8f 100644 --- a/su4sml/src/xmltree.sml +++ b/su4sml/src/xmltree.sml @@ -57,7 +57,7 @@ structure XmlTree : sig val value_of : string -> Attribute list -> string val has_attribute : string -> Tree -> bool end = struct -open library +open Rep_Logger infix 1 |> (** A name-value pair. *) diff --git a/su4sml/src/xmltree_parser.sml b/su4sml/src/xmltree_parser.sml index 84e1a06..5903244 100644 --- a/su4sml/src/xmltree_parser.sml +++ b/su4sml/src/xmltree_parser.sml @@ -43,8 +43,8 @@ structure XmlTreeParser : sig val readFile : string -> XmlTree.Tree end = struct +open Rep_Logger open XmlTree -open library exception FileNotFound of string structure Parser = Parse (structure Dtd = Dtd