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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/library/line-break.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/library/line-break.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : leunga 646 signature LINE_BREAK =
2 :     sig
3 :     val lineBreak : int -> string -> string
4 :     end
5 :    
6 :     structure LineBreak : LINE_BREAK =
7 :     struct
8 :     fun lineBreak maxChars text =
9 :     let fun loop([],_,text) = String.concat(rev text)
10 :     | loop(s::ss,n,text) =
11 :     let val m = String.size s + 1
12 :     val n' = m+n
13 :     in if n' > maxChars
14 :     then loop(ss, m, s::" "::"\n"::text)
15 :     else loop(ss, n', s::" "::text)
16 :     end
17 :     val toks = String.fields (fn c => c = #" ") text
18 :     in loop(toks, 0, []) end
19 :     end

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