123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657(** A [Screen] is two-dimensional grid of text elements onto which we draw imperatively. *)open!Coreopen!ImportmoduleTexel=struct(** A [tex]t [el]ement *)typet=|Line|Blank|CharofAttr.tlist*Uchar.t[@@derivingcompare,sexp_of]endmoduletypeScreen=sigtypet[@@derivingsexp_of]valto_string:t->bars:[`Ascii|`Unicode]->string_with_attr:(Attr.tlist->string->string)->stringvalrender:t->bars:[`Ascii|`Unicode]->output:(Attr.tlist->Buffer.t->unit)->close:(Buffer.t->'a)->'amoduleTexel=Texel(** [string t align attr s ~row ~col ~width] writes a region one high and [width]
across, whose left corner is at [row, col]. Within that region, it places [s] as
directed by [align]. *)valstring:t->Column.Align.t->Attr.tlist->String.Utf8.t->row:int->col:int->width:int->unit(** [char t attr c ~row ~col] writes [c] at [row, col]. *)valchar:t->Attr.tlist->Uchar.t->row:int->col:int->unitvalcreate:rows:int->cols:int->t(** [hline t texel ~row] sets the entire width of [row] to [texel] *)valhline:t->Texel.t->row:int->unit(** [vline t texel ~col] sets the entire height of [col] to [texel] *)valvline:t->Texel.t->col:int->unitend