Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file window0.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118(* [window0.ml] is split out from [window.ml] so we can refer to [Window0] in
[Buffer]. *)open!Core_kernelopen!Import0moduleT=structincludeValue.Make_subtype(structletname="window"lethere=[%here]letis_in_subtype=Value.is_windowend)letequal=eqendincludeTmoduleEdges=structtypet={bottom:int;left:int;right:int;top:int}[@@derivingsexp_of]lettype_=Value.Type.(map(tupleint(tupleint(tupleint(tupleintunit))))~name:[%sexp"Window.Tree.Position_and_size.t"])~of_:(fun(left,(top,(right,(bottom,()))))->{bottom;left;right;top})~to_:(fun{bottom;left;right;top}->left,(top,(right,(bottom,()))));;letof_value_exn=Value.Type.of_value_exntype_letto_value=Value.Type.to_valuetype_lett=type_endmoduleTree=structtypewindow=t[@@derivingsexp_of]moduleDirection=structmoduleT=structtypet=|Left_to_right|Top_to_bottom[@@derivingenumerate,sexp_of]endincludeTletis_top_to_bottom=function|Left_to_right->false|Top_to_bottom->true;;lettype_=Value.Type.enum[%sexp"Window.Tree.Direction.t"](moduleT)(is_top_to_bottom>>Value.of_bool);;letof_value_exn=Value.Type.of_value_exntype_letto_value=Value.Type.to_valuetype_lett=type_endtypet=|Combinationof{children:tlist;direction:Direction.t;edges:Edges.t}|Windowofwindow[@@derivingsexp_of]lettuple_type=Value.Type.(tupleDirection.t(tupleEdges.t(listvalue)))letrecof_value_exnvalue=matchT.is_in_subtypevaluewith|true->Window(T.of_value_exnvalue)|false->letdirection,(edges,children)=Value.Type.of_value_exntuple_typevalueinletchildren=List.mapchildren~f:of_value_exninCombination{children;direction;edges};;letrecto_value=function|Windowwindow->T.to_valuewindow|Combination{children;direction;edges}->Value.Type.to_valuetuple_type(direction,(edges,List.mapchildren~f:to_value));;lettype_=Value.Type.create[%message"Window.Tree.t"][%sexp_of:t]of_value_exnto_value;;lett=type_letparent_exntwindow=letrecauxt~parent=matchtwith|Windowwindow'->(matchT.equalwindowwindow'with|true->Someparent|false->None)|Combination{children;direction=_;edges=_}->List.find_mapchildren~f:(aux~parent:t)inmatchauxt~parent:twith|Somet->t|None->raise_s[%message"Window not in this tree."(window:window)~_:(t:t)];;end