-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live Projectors #1420
base: dev
Are you sure you want to change the base?
Live Projectors #1420
Changes from all commits
881a086
1d07174
08c21d1
535ec65
dfbd034
376f411
09d08e9
4ce84f1
323338f
34b27e4
48ee429
ce355ab
4415b81
5e93bc6
18c4751
2f94e7a
0ee836b
0af9929
8dd2f78
fffd013
dc8ebfe
d64e739
18ceb80
1ea2ac4
31c8e72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
open Util; | ||
open Js_of_ocaml; | ||
|
||
[@deriving (show({with_path: false}), sexp, yojson)] | ||
type t = { | ||
row_height: float, | ||
col_width: float, | ||
}; | ||
|
||
let init = {row_height: 10., col_width: 10.}; | ||
|
||
let get_goal = | ||
( | ||
~font_metrics: t, | ||
text_box: Js.t(Dom_html.element), | ||
e: Js.t(Dom_html.mouseEvent), | ||
) | ||
: Point.t => { | ||
open Float; | ||
let x_rel = of_int(e##.clientX) -. text_box##getBoundingClientRect##.left; | ||
let y_rel = of_int(e##.clientY) -. text_box##getBoundingClientRect##.top; | ||
let row = to_int(y_rel /. font_metrics.row_height); | ||
let col = to_int(round(x_rel /. font_metrics.col_width)); | ||
{row, col}; | ||
}; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,9 @@ module EvaluatorEVMode: { | |
let update_test = (state, id, v) => | ||
state := EvaluatorState.add_test(state^, id, v); | ||
|
||
let update_probe = (state, id, v) => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels like the right way to do it. |
||
state := EvaluatorState.add_closure(state^, id, v); | ||
|
||
let req_value = (f, _, x) => | ||
switch (f(x)) { | ||
| (BoxedValue, x) => (BoxedReady, x) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
open Util; | ||
|
||
/* A syntax probe is inserted into syntax to capture | ||
* information during evaluation. The tag type below, | ||
* for the probe case, is used to collect binding ids | ||
* which are used to faciltate capturing the values | ||
* of certain variables in the environment. This captured | ||
* information is, for a given closure, encoded in | ||
* the `frame` type. */ | ||
|
||
[@deriving (show({with_path: false}), sexp, yojson)] | ||
type t = { | ||
refs: Binding.s, | ||
stem: Binding.stem, | ||
}; | ||
|
||
[@deriving (show({with_path: false}), sexp, yojson)] | ||
type tag = | ||
| Paren | ||
| Probe(t); | ||
|
||
/* Information about the evaluation of an ap */ | ||
[@deriving (show({with_path: false}), sexp, yojson)] | ||
type frame = { | ||
ap_id: Id.t, /* Syntax ID of the ap */ | ||
env_id: Id.t /* ID of ClosureEnv created by ap */ | ||
}; | ||
|
||
/* List of applications prior to some evaluation */ | ||
[@deriving (show({with_path: false}), sexp, yojson)] | ||
type stack = list(frame); | ||
|
||
let empty: t = {refs: [], stem: []}; | ||
|
||
let env_stack: list(frame) => list(Id.t) = | ||
List.map((en: frame) => en.env_id); | ||
|
||
let mk_frame = (~env_id: Id.t, ~ap_id: Id.t): frame => {env_id, ap_id}; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kinda surprises me that you've had to change Fun but not Fix, Let, or Case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment seems to have dissociated from line number? is this about the code at (new) line 343? if so, that's not the fun case, it's the fun case within app. If not then I'm not sure what this is regarding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FontMetrics!?? in core!!????
I'm sure it hurts you as much as it hurts me to see more and more files being slowly dragged into core. Maybe in the new year we can have a conversation about whether we can recover some semblance of modules (along with maybe renaming the 3 out of em).
Part of me wonders whether Editor.re/Perform.re/etc really belong in web, and if we do that whether we can get the core distinction back.