Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/IR/mlrisc-format-insn.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/IR/mlrisc-format-insn.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 228 - (download) (annotate)
Sat Apr 17 17:15:03 1999 UTC (20 years, 11 months ago) by monnier
File size: 940 byte(s)
This commit was generated by cvs2svn to compensate for changes in r227,
which included commits to RCS files with non-trunk default branches.
signature FORMAT_INSTRUCTION =
sig
   structure I  : INSTRUCTIONS

   val toString : I.C.regmap -> I.instruction -> string

end

functor FormatInstructionFn(Emitter : EMITTER_NEW) : FORMAT_INSTRUCTION =
struct
   structure I = Emitter.I

   fun toString regmap insn =
   let val buffer = StringStream.mkStreamBuf()
       val S      = StringStream.openStringOut buffer
       val _      = AsmStream.withStream S Emitter.emitInstr (insn,regmap) 
       val text   = StringStream.getString buffer
       fun isSpace #" "  = true
         | isSpace #"\t" = true
         | isSpace _     = false
       val text = foldr (fn (x,"") => x | (x,y) => x^" "^y) ""
          (String.tokens isSpace text)
       fun stripNL s =
       let fun f(0) = ""
             | f(i) = if String.sub(s,i) = #"\n" then f(i-1)
                      else String.extract(s,0,SOME(i+1))
       in  f(size s - 1) end  
   in  stripNL text
   end

end

(*
 * $Log$
 *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0