xref: /inferno-os/module/gr.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1GR: module{
2	PATH:	con "/dis/math/gr.dis";
3
4	OP: adt{
5		code, n: int;
6		x, y: array of real;
7		t: string;
8	};
9
10	open:	fn(ctxt: ref Draw->Context, title: string): ref Plot;
11
12	Plot: adt{
13		bye:	fn(p: self ref Plot);
14		equalxy:fn(p: self ref Plot);
15		graph:	fn(p: self ref Plot, x, y: array of real);
16		paint: 	fn(p: self ref Plot, xlabel, xunit, ylabel, yunit: string);
17		pen:	fn(p: self ref Plot, nib: int);
18		text:	fn(p: self ref Plot, justify: int, s: string, x, y: real);
19
20		op: list of OP;
21		xmin, xmax, ymin, ymax: real;
22		textsize: real;
23		t: ref Tk->Toplevel;		# window containing .fc.c canvas
24		titlechan: chan of string;	# Wm titlebar
25		canvaschan: chan of string;	# button clicks for measurements
26	};
27
28	# op code
29	GRAPH:		con 1;
30	TEXT:		con 2;
31	PEN:		con 3;
32
33	# pen
34	CIRCLE:		con 101;
35	CROSS:		con 102;
36	SOLID:		con 103;
37	DASHED:		con 104;
38	INVIS:		con 105;
39	REFERENCE:	con 106;
40	DOTTED:		con 107;
41
42	# text justify
43	LJUST:		con 8r00;
44	CENTER:		con 8r01;
45	RJUST:		con 8r02;
46	HIGH:		con 8r00;
47	MED:		con 8r10;
48	BASE:		con 8r20;
49	LOW:		con 8r30;
50	UP:		con 8r100;
51};
52