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