Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/integration' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
akissinger committed May 2, 2014
2 parents 327778a + e9039b3 commit 2bb3ea0
Show file tree
Hide file tree
Showing 15 changed files with 927 additions and 715 deletions.
34 changes: 34 additions & 0 deletions README.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

Preparing a release for QuantoDerive
====================================

Releases should be prepared on the target OS. First, ensure the heap is built
for the version of poly that is going to be shipped with the bundle. This can be
done by running the following in core:

make clean
make heap-(osx|linux|windows)-dist

In Windows, this can be run inside of "git-bash", which ships with the Windows
Git distribution. Next, from the scala directory, run the appropriate command
to build the bundle.

dist/mk-osx.sh
dist/mk-linux.sh
dist/mk-windows.bat

Note the 'bat' file should be run from a DOS prompt, *NOT* git-bash. For
Linux/OS X, you are done. For Windows, there is one more step. Open the AI
file in dist/windows-dist in Advanced Installer, update the paths as necessary
and build an MSI.


If dependencies change
======================

If the dependencies change, certain pieces of the bundling code need to be
updated. "dist/osx-dist/Info.plist" needs to be updated in include any new
JARs, as well as "dist/mk-linux-generic.sh". Also, the launcher executable
"QuantoDerive.exe" will need to be regenerated using launch4j.


13 changes: 10 additions & 3 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ ISAPLIB_SOURCES=../../isaplib
################################

# polyml executable
POLYML_HOME=$(shell ../tools/findpoly.sh)
POLYML=$(POLYML_HOME)/bin/poly
POLYML=$(shell ../tools/findpoly.sh)/bin/poly
POLYFLAGS=-H 200 $(if $(FAST),--disable-tests) $(if $(V),--test-log-level=$(V))


################################
# dynamic variables checked on call to make.
################################
Expand All @@ -40,6 +38,15 @@ $(QUANTO_HEAP): $(ML_SRC_FILES) $(ISAP_ML_SRC_FILES) $(COSY_ML_SRC_FILES)
@mkdir -p heaps
POLYFLAGS="$(POLYFLAGS)" ../tools/poly-build-heap -p -o $@ ROOT.ML

heap-osx-dist:
echo 'use "build_heap.ML"' | ../scala/dist/osx-dist/poly

heap-linux-dist:
echo 'use "build_heap.ML"' | ../scala/dist/linux-dist/poly

heap-windows-dist:
echo 'use "build_heap.ML"' | ../scala/dist/windows-dist/poly.exe

heap: $(QUANTO_HEAP)

bin/%: toplevel/%.ML $(QUANTO_HEAP) $(shell find "toplevel/$%" | grep ".ML$$")
Expand Down
8 changes: 7 additions & 1 deletion core/json_interface/controller_registry.ML
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ structure RG_Controller = JsonController(
structure GraphComponentDataIO = RG_ComponentDataIO
)

structure GHZW_Controller = JsonController(
structure Theory = GHZW_Theory
structure GraphComponentDataIO = GHZW_ComponentDataIO
)

val ctab = Symtab.make [
(RG_Controller.Theory.theory_name, RG_Controller.mtab)
(RG_Controller.Theory.theory_name, RG_Controller.mtab),
(GHZW_Controller.Theory.theory_name, GHZW_Controller.mtab)
]

fun dispatch ((controller, module, function), json_input) =
Expand Down
4 changes: 3 additions & 1 deletion core/theories/ghz_w/data.ML
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct
type psubst = unit
type subst = psubst

datatype nvdata = GHZ | W | TICK | ZERO
datatype nvdata = GHZ | W | TICK | ZERO | GHZ2
val default_nvdata = GHZ
fun nvdata_eq (a,b) = a = b

Expand All @@ -14,11 +14,13 @@ struct

fun pretty_nvdata GHZ = Pretty.str "GHZ"
| pretty_nvdata W = Pretty.str "W"
| pretty_nvdata GHZ2 = Pretty.str "GHZ2"
| pretty_nvdata TICK = Pretty.str "TICK"
| pretty_nvdata ZERO = Pretty.str "ZERO"

fun default_nvdata_of_typestring "GHZ" = GHZ
| default_nvdata_of_typestring "W" = W
| default_nvdata_of_typestring "GHZ2" = GHZ2
| default_nvdata_of_typestring "TICK" = TICK
| default_nvdata_of_typestring "ZERO" = ZERO
| default_nvdata_of_typestring s = raise unknown_typestring_exp s
Expand Down
4 changes: 4 additions & 0 deletions core/theories/ghz_w/io.ML
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ structure GHZW_ComponentDataIO : GRAPH_COMPONENT_DATA_IO
(case to_lower t
of "ghz" => GHZW_Data.GHZ
| "w" => GHZW_Data.W
| "ghz2" => GHZW_Data.GHZ2
| "tick" => GHZW_Data.TICK
| "zero" => GHZW_Data.ZERO
| _ => raise bad_input_exp ("Unknown vertex type "^t,""))
Expand All @@ -29,6 +30,7 @@ structure GHZW_ComponentDataIO : GRAPH_COMPONENT_DATA_IO
type data = nvdata
fun typestr GHZW_Data.GHZ = "GHZ"
| typestr GHZW_Data.W = "W"
| typestr GHZW_Data.GHZ2 = "GHZ2"
| typestr GHZW_Data.TICK = "TICK"
| typestr GHZW_Data.ZERO = "ZERO"
fun output d = Json.mk_record [("type",typestr d)]
Expand All @@ -43,6 +45,8 @@ structure GHZW_ComponentDataIO : GRAPH_COMPONENT_DATA_IO
"[style=filled,fillcolor=white,fontcolor=black,shape=circle]"
| style_for_ivertex_data GHZW_Data.W =
"[style=filled,fillcolor=black,fontcolor=white,shape=circle]"
| style_for_ivertex_data GHZW_Data.GHZ2 =
"[style=filled,fillcolor=red,fontcolor=white,shape=circle]"
| style_for_ivertex_data GHZW_Data.TICK =
"[style=filled,fillcolor=red,fontcolor=white,shape=diamond]"
| style_for_ivertex_data GHZW_Data.ZERO =
Expand Down
1,452 changes: 746 additions & 706 deletions docs/graphics/derive_icon_small.ai

Large diffs are not rendered by default.

Binary file modified docs/graphics/quantoderive.icns
Binary file not shown.
Binary file removed docs/graphics/quantoderive.iconset/icon_32x32@2x.png
Binary file not shown.
94 changes: 94 additions & 0 deletions scala/src/main/resources/quanto/data/ghz_w.qtheory
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"name" : "GHZ/W theory",
"core_name" : "ghz_w",
"vertex_types" : {
"GHZ" : {
"value" : {
"path" : "$.value",
"validate_with_core" : false,
"latex_constants" : false,
"type" : "string"
},
"style" : {
"label" : {
"position" : "inside",
"fg_color" : [ 0.0, 0.0, 0.0 ]
},
"stroke_color" : [ 0.0, 0.0, 0.0 ],
"fill_color" : [ 1.0, 1.0, 1.0 ],
"shape" : "circle"
},
"default_data" : {
"type" : "GHZ",
"value" : ""
}
},
"W" : {
"value" : {
"path" : "$.value",
"validate_with_core" : false,
"latex_constants" : false,
"type" : "string"
},
"style" : {
"label" : {
"position" : "inside",
"fg_color" : [ 1.0, 1.0, 1.0 ]
},
"stroke_color" : [ 0.0, 0.0, 0.0 ],
"fill_color" : [ 0.0, 0.0, 0.0 ],
"shape" : "circle"
},
"default_data" : {
"type" : "W",
"value" : ""
}
},
"GHZ2" : {
"value" : {
"path" : "$.value",
"validate_with_core" : false,
"latex_constants" : false,
"type" : "string"
},
"style" : {
"label" : {
"position" : "inside",
"fg_color" : [ 1.0, 1.0, 1.0 ]
},
"stroke_color" : [ 0.0, 0.0, 0.0 ],
"fill_color" : [ 1.0, 0.0, 0.0 ],
"shape" : "circle"
},
"default_data" : {
"type" : "GHZ2",
"value" : ""
}
}
},
"edge_types" : {
"string" : {
"value" : {
"path" : "$.value",
"validate_with_core" : false,
"latex_constants" : false,
"type" : "string"
},
"style" : {
"stroke_color" : [ 0.0, 0.0, 0.0 ],
"stroke_width" : 1,
"label" : {
"position" : "center",
"fg_color" : [ 0.0, 0.0, 1.0 ],
"bg_color" : [ 0.8, 0.8, 1.0, 0.7 ]
}
},
"default_data" : {
"type" : "string",
"value" : ""
}
}
},
"default_vertex_type" : "GHZ",
"default_edge_type" : "string"
}
2 changes: 1 addition & 1 deletion scala/src/main/scala/quanto/gui/GraphEditPanel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GraphEditControls(theory: Theory) extends Publisher {
val VertexTypeSelect = new ComboBox(theory.vertexTypes.keys.toSeq :+ "<wire>") { enabled = false }
val EdgeTypeLabel = new Label("Edge Type: ") { xAlignment = Alignment.Right; enabled = false }
val EdgeTypeSelect = new ComboBox(theory.edgeTypes.keys.toSeq) { enabled = false }
val EdgeDirected = new CheckBox("directed") { selected = true; enabled = false }
val EdgeDirected = new CheckBox("directed") { selected = false; enabled = false }

// Bottom panel
object BottomPanel extends GridPanel(1,5) {
Expand Down
4 changes: 2 additions & 2 deletions scala/src/main/scala/quanto/gui/NewProjectDialog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class NewProjectDialog extends Dialog {
val LocationField = new TextField(System.getProperty("user.home"))
val BrowseButton = new Button("...")
// TODO: make these not hard-coded
val theoryNames = Vector("Red/Green", "Proof Strategy Graph", "String Vertex/Edge")
val theoryFiles = Vector("red_green", "strategy_graph", "string_ve")
val theoryNames = Vector("Red/Green", "GHZ/W")//, "Proof Strategy Graph", "String Vertex/Edge")
val theoryFiles = Vector("red_green", "ghz_w")//, "strategy_graph", "string_ve")

val TheoryField = new ComboBox(theoryNames)
val CreateButton = new Button("Create")
Expand Down
2 changes: 1 addition & 1 deletion scala/src/main/scala/quanto/gui/SimplifyController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SimplifyController(panel: DerivationPanel) extends Publisher {
res.map {
case Success(JsonArray(procs)) =>
Swing.onEDT { panel.SimplifyPane.Simprocs.listData = procs.map(_.stringValue) }
case _ => println("ERROR: Unexpected result from core: " + res) // TODO: errror dialogs
case r => println("ERROR: Unexpected result from core: " + r) // TODO: errror dialogs
}
}

Expand Down
25 changes: 25 additions & 0 deletions scala/src/main/scala/quanto/gui/graphview/GraphView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,31 @@ class GraphView(val theory: Theory, gRef: HasGraph) extends Panel
g.setStroke(new BasicStroke(1))
var a = g.getColor
for ((v, VDisplay(shape,color,label)) <- vertexDisplay) {

/* draw red line if vertex coordinates are within !-box rectangle
* but the vertex is not a member of the !-box and also write
* an explanatory text on the middle of the line
*/
for ((b, bbd) <- bboxDisplay) {
if (!graph.contents(b).contains(v) && shape.intersects(bbd.rect)) {
val bbd_corner = bbd.corner
val shape_rec = shape.getBounds2D

val corner_x = bbd_corner.getMaxX
val corner_y = bbd_corner.getMaxY
val node_x = shape_rec.getCenterX
val node_y = shape_rec.getCenterY
g.setColor(Color.RED)
g.draw(new Line2D.Double(corner_x, corner_y, node_x, node_y))
val text_layout = new TextLayout("not in !-box",
VertexLabelFont,
g.getFontRenderContext)
val text_x = corner_x + (node_x - corner_x) / 2.0
val text_y = corner_y + (node_y - corner_y) / 2.0
text_layout.draw(g, text_x.toFloat, text_y.toFloat)
}
}

if (graph.vdata(v).isBoundary) g.setColor(Color.BLACK)
else g.setColor(color)

Expand Down

0 comments on commit 2bb3ea0

Please sign in to comment.