diff --git a/dotscape b/dotscape index 953f346..846eb78 100755 Binary files a/dotscape and b/dotscape differ diff --git a/fcore/quad-tree.sml b/fcore/quad-tree.sml index 1e58256..7aafc78 100644 --- a/fcore/quad-tree.sml +++ b/fcore/quad-tree.sml @@ -525,7 +525,7 @@ struct val b = colToRealString b val x = String.concat ["(((x + ", x, ") - halfWidth) / halfWidth)"] - val y = String.concat ["(~(y + ", y, ") - halfHeight) / halfHeight)"] + val y = String.concat ["((~(y + ", y, ") - halfHeight) / halfHeight)"] val ex = String.concat [ "(((((" @@ -570,7 +570,7 @@ struct val bintree = merge (qtree, squares) val coords = BinTree.foldr (toExportStringFolder, bintree, []) - val coords = String.concatWith "," coords + val coords = String.concatWith ",\n" coords val header = String.concat [ "structure AAA = \nstruct\n" @@ -582,7 +582,7 @@ struct , " #[\n" ] - val footer = String.concat [" ]\n", " end\n", "end\n"] + val footer = String.concat ["\n ]\n", " end\n", "end\n"] in String.concat [header, coords, footer] end diff --git a/imperative-shell/file-thread.sml b/imperative-shell/file-thread.sml index 1523030..c36a0eb 100644 --- a/imperative-shell/file-thread.sml +++ b/imperative-shell/file-thread.sml @@ -12,41 +12,6 @@ struct val filename = "green.dsc" val exportFilename = "green.sml" - fun ndcToLerpX num = - let - val num = (num + 1.0) / 2.0 - val num = Real32.toString num - val num = - (* Problem: It seems that Real32.toString may sometimes return a string - * that is recognised as an integer, like "1" instead of "1.0". - * If that happens, we just add a ".0" to the end - * so it's recognised as a real. *) - if String.isSubstring "." num then num - else num ^ ".0" - in - " (((startX * (1.0 - " ^ num ^ ")) + (endX * " ^ num - ^ ")) / windowWidth) - 1.0" - end - - fun ndcToLerpY num = - let - val num = (num + 1.0) / 2.0 - val num = Real32.toString num - val num = if String.isSubstring "." num then num else num ^ ".0" - in - " (((startY * (1.0 - " ^ num ^ ")) + (endY * " ^ num - ^ ")) / windowHeight) - 1.0" - end - - fun colToString col = - let val col = Real32.toString col - in if String.isSubstring "." col then col else col ^ ".0" - end - - fun exportSquares squares = () - - fun parse (io, acc) = () - fun loadIO (io, str) = case TextIO.inputLine io of SOME line => loadIO (io, str ^ line) @@ -76,6 +41,14 @@ struct TextIO.closeOut io end + fun exportSquares squaresString = + let + val io = TextIO.openOut exportFilename + val () = TextIO.output (io, squaresString) + in + TextIO.closeOut io + end + fun getDirList (dir, acc, rootPath) = case OS.FileSys.readDir dir of SOME path => @@ -112,7 +85,7 @@ struct case Mailbox.recv fileMailbox of SAVE_SQUARES str => saveSquares str | LOAD_SQUARES => loadSquares (filename, inputMailbox) - | EXPORT_SQUARES triangles => exportSquares triangles + | EXPORT_SQUARES str => exportSquares str | LOAD_FILES path => loadFiles (path, inputMailbox) | SELECT_PATH path => selectPath (path, inputMailbox) in