#define CL_XMIN -1
#define CL_XMAX 1
#define CL_YMIN -1
#define CL_YMAX 1
#define GRA_DRV_NULL 0
#define GRA_DRV_PS 4
typedef double GMATRIX[4][4];
typedef struct
{
double xlow, xhigh, ylow, yhigh;
} matc_Rectangle;
typedef struct
{
double x, y, z;
} Point;
typedef struct
{
FILE *out_fp;
int driver;
struct
{
double xlow, xhigh, ylow, yhigh, zlow, zhigh;
} window;
matc_Rectangle viewport;
GMATRIX modelm;
GMATRIX viewm;
GMATRIX projm;
GMATRIX transfm;
double pratio;
Point cur_point;
int cur_color;
int cur_marker;
} G_STATE;
#ifdef MODULE_MATC
G_STATE gra_state =
{
NULL, GRA_DRV_NULL,
-1.0, 1.0, -1.0, 1.0, -1.0, 1.0,
0.0, 1.0, 0.0, 1.0,
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
0.0,
0.0,0.0,
1, 1
};
#else
EXT G_STATE gra_state;
#endif
#define GRA_FUNCS 27
#define G_OPEN 0
#define G_CLOSE 1
#define G_CLEAR 2
#define G_VIEWPORT 3
#define G_WINDOW 4
#define G_DEFCOLOR 5
#define G_COLOR 6
#define G_POLYLINE 7
#define G_DRAW 8
#define G_MOVE 9
#define G_POLYMARKER 10
#define G_MARKER 11
#define G_AREAFILL 12
#define G_IMAGE 13
#define G_TEXT 14
#define G_FLUSH 15
#define G_RESET 16
#define G_TRANSLATE 17
#define G_ROTATE 18
#define G_SCALE 19
#define G_VIEWPOINT 20
#define G_GETMATRIX 21
#define G_SETMATRIX 22
#define G_PERSPECTIVE 23
#define G_DBUFFER 24
#define G_SBUFFER 25
#define G_SWAPBUF 26
#ifdef MODULE_MATC
void (*gra_funcs[GRA_FUNCS])() =
{
gra_error, gra_error, gra_error, gra_error, gra_error,
gra_error, gra_error, gra_error, gra_error, gra_error,
gra_error, gra_error, gra_error, gra_error, gra_error,
gra_error, gra_error, gra_error, gra_error, gra_error,
gra_error, gra_error, gra_error, gra_error, gra_error,
gra_error, gra_error
};
#else
EXT void(*gra_funcs[GRA_FUNCS])();
#endif
#define GRA_OPEN(d) ((void (*)(int)) (*gra_funcs[G_OPEN]))(d)
#define GRA_CLOSE() ((void (*)(void)) (*gra_funcs[G_CLOSE]))()
#define GRA_CLEAR() ((void (*)(void)) (*gra_funcs[G_CLEAR]))()
#define GRA_FLUSH() ((void (*)(void)) (*gra_funcs[G_FLUSH]))()
#define GRA_RESET() ((void (*)(void)) (*gra_funcs[G_RESET]))()
#define GRA_DEFCOLOR(i, r, g, b) ((void (*)(int, double, double, double)) (*gra_funcs[G_DEFCOLOR]))(i, r, g, b)
#define GRA_COLOR(i) ((void (*)(int)) (*gra_funcs[G_COLOR]))(i)
#define GRA_POLYLINE(n, p) ((void (*)(int, void *)) (*gra_funcs[G_POLYLINE]))(n, p);
#define GRA_DRAW(p) ((void (*)(void *)) (*gra_funcs[G_DRAW]))(p)
#define GRA_MOVE(p) ((void (*)(void *)) (*gra_funcs[G_MOVE]))(p)
#define GRA_POLYMARKER(i, n, p) ((void (*)(int, int, void *)) (*gra_funcs[G_POLYMARKER]))(i, n, p)
#define GRA_MARKER(i, p) ((void (*)(int, void *)) (*gra_funcs[G_MARKER]))(i, p)
#define GRA_AREAFILL(n, p) ((void (*)(int, void *)) (*gra_funcs[G_AREAFILL]))(n, p)
#define GRA_IMAGE(w,h,d,r) ((void (*)(int, int, int, void *)) (*gra_funcs[G_IMAGE]))(w,h,d,r)
#define GRA_TEXT(h,r,s) ((void (*)(double, double, char *)) (*gra_funcs[G_TEXT]))(h,r,s)
#define GRA_TRANSLATE(x,y,z) ((void (*)(double, double, double)) (*gra_funcs[G_TRANSLATE]))(x,y,z)
#define GRA_ROTATE(x,y,z) ((void (*)(double, double, double)) (*gra_funcs[G_ROTATE]))(x,y,z)
#define GRA_SCALE(x,y,z) ((void (*)(double, double, double)) (*gra_funcs[G_SCALE]))(x,y,z)
#define GRA_VIEWPOINT(xf,yf,zf,xt,yt,zt) ((void (*)(double, double, double, double, double, double)) (*gra_funcs[G_VIEWPOINT]))(xf,yf,zf,xt,yt,zt)
#define GRA_GETMATRIX(gm) ((void (*)(void *)) (*gra_funcs[G_GETMATRIX]))(gm)
#define GRA_SETMATRIX(gm) ((void (*)(void *)) (*gra_funcs[G_SETMATRIX]))(gm)
#define GRA_DBUFFER(gm) ((void (*)(void *)) (*gra_funcs[G_DBUFFER]))(gm)
#define GRA_SBUFFER(gm) ((void (*)(void *)) (*gra_funcs[G_SBUFFER]))(gm)
#define GRA_SWAPBUF(gm) ((void (*)(void *)) (*gra_funcs[G_SWAPBUF]))(gm)
#define GRA_WINDOW(x1,x2,y1,y2,z1,z2) ((void (*)(double, double, double, double, double, double)) (*gra_funcs[G_WINDOW]))(x1,x2,y1,y2,z1,z2)
#define GRA_VIEWPORT(x1,x2,y1,y2) ((void (*)(double, double, double, double)) (*gra_funcs[G_VIEWPORT]))(x1,x2,y1,y2)
#define GRA_PERSPECTIVE(r) ((void (*)(double)) (*gra_funcs[G_PERSPECTIVE]))(r)