blob: 1a237c1b36c15b3cb1f193dc31ec377c0fcb0af9 [file] [log] [blame]
Guido van Rossumb6775db1994-08-01 11:34:53 +00001/***********************************************************
Guido van Rossum524b5881995-01-04 19:10:35 +00002Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3The Netherlands.
Guido van Rossumb6775db1994-08-01 11:34:53 +00004
5 All Rights Reserved
6
Guido van Rossumd266eb41996-10-25 14:44:06 +00007Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
Guido van Rossumb6775db1994-08-01 11:34:53 +00009provided that the above copyright notice appear in all copies and that
Guido van Rossumd266eb41996-10-25 14:44:06 +000010both that copyright notice and this permission notice appear in
Guido van Rossumb6775db1994-08-01 11:34:53 +000011supporting documentation, and that the names of Stichting Mathematisch
Guido van Rossumd266eb41996-10-25 14:44:06 +000012Centrum or CWI or Corporation for National Research Initiatives or
13CNRI not be used in advertising or publicity pertaining to
14distribution of the software without specific, written prior
15permission.
Guido van Rossumb6775db1994-08-01 11:34:53 +000016
Guido van Rossumd266eb41996-10-25 14:44:06 +000017While CWI is the initial source for this software, a modified version
18is made available by the Corporation for National Research Initiatives
19(CNRI) at the Internet address ftp://ftp.python.org.
20
21STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
22REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
23MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
24CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
25DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
26PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
27TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28PERFORMANCE OF THIS SOFTWARE.
Guido van Rossumb6775db1994-08-01 11:34:53 +000029
30******************************************************************/
31
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000032/*
33Input used to generate the Python module "glmodule.c".
Guido van Rossumb3165151991-08-16 08:59:21 +000034The stub generator is a Python script called "cgen.py".
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000035
36Each definition must be contained on one line:
37
38<returntype> <name> <type> <arg> <type> <arg>
39
40<returntype> can be: void, short, long (XXX maybe others?)
41
42<type> can be: char, string, short, float, long, or double
43 string indicates a null terminated string;
44 if <type> is char and <arg> begins with a *, the * is stripped
45 and <type> is changed into string
46
47<arg> has the form <mode> or <mode>[<subscript>]
48 where <mode> can be
49 s: arg is sent
50 r: arg is received (arg is a pointer)
51 and <subscript> can be (N and I are numbers):
52 N
53 argI
54 retval
55 N*argI
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +000056 N*I
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000057 N*retval
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +000058 In the case where the subscript consists of two parts
59 separated by *, the first part is the width of the matrix, and
60 the second part is the length of the matrix. This order is
61 opposite from the order used in C to declare a two-dimensional
62 matrix.
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000063*/
64
Jack Jansen743db361992-08-13 14:13:11 +000065/*
66 * An attempt has been made to make this module switch threads on qread
67 * calls. It is far from safe, though.
68 */
69
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000070#include <gl.h>
71#include <device.h>
Guido van Rossum3f5da241990-12-20 15:06:42 +000072
Guido van Rossumece35bc1996-12-09 18:52:11 +000073#ifdef __sgi
74extern int devport();
75extern int textwritemask();
76extern int pagewritemask();
77extern int gewrite();
78extern int gettp();
79#endif
80
Guido van Rossum0a3eaf01997-04-29 15:39:28 +000081#include "Python.h"
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000082#include "cgensupport.h"
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000083
84/*
85Some stubs are too complicated for the stub generator.
86We can include manually written versions of them here.
87A line starting with '%' gives the name of the function so the stub
88generator can include it in the table of functions.
89*/
90
Jack Jansen743db361992-08-13 14:13:11 +000091% qread
92
Guido van Rossum0a3eaf01997-04-29 15:39:28 +000093static PyObject *
Jack Jansen743db361992-08-13 14:13:11 +000094gl_qread(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +000095 PyObject *self;
96 PyObject *args;
Jack Jansen743db361992-08-13 14:13:11 +000097{
98 long retval;
99 short arg1 ;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000100 Py_BEGIN_ALLOW_THREADS
Jack Jansen743db361992-08-13 14:13:11 +0000101 retval = qread( & arg1 );
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000102 Py_END_ALLOW_THREADS
103 { PyObject *v = PyTuple_New( 2 );
Jack Jansen743db361992-08-13 14:13:11 +0000104 if (v == NULL) return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000105 PyTuple_SetItem(v, 0, mknewlongobject(retval));
106 PyTuple_SetItem(v, 1, mknewshortobject(arg1));
Jack Jansen743db361992-08-13 14:13:11 +0000107 return v;
108 }
109}
110
111
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000112/*
113varray -- an array of v.. calls.
114The argument is an array (maybe list or tuple) of points.
115Each point must be a tuple or list of coordinates (x, y, z).
116The points may be 2- or 3-dimensional but must all have the
117same dimension. Float and int values may be mixed however.
118The points are always converted to 3D double precision points
119by assuming z=0.0 if necessary (as indicated in the man page),
120and for each point v3d() is called.
121*/
122
123% varray
124
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000125static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000126gl_varray(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000127 PyObject *self;
128 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000129{
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000130 PyObject *v, *w=NULL;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000131 int i, n, width;
132 double vec[3];
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000133 PyObject * (*getitem) Py_FPROTO((PyObject *, int));
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000134
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000135 if (!PyArg_GetObject(args, 1, 0, &v))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000136 return NULL;
137
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000138 if (PyList_Check(v)) {
139 n = PyList_Size(v);
140 getitem = PyList_GetItem;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000141 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000142 else if (PyTuple_Check(v)) {
143 n = PyTuple_Size(v);
144 getitem = PyTuple_GetItem;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000145 }
146 else {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000147 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000148 return NULL;
149 }
150
151 if (n == 0) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000152 Py_INCREF(Py_None);
153 return Py_None;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000154 }
155 if (n > 0)
156 w = (*getitem)(v, 0);
157
158 width = 0;
159 if (w == NULL) {
160 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000161 else if (PyList_Check(w)) {
162 width = PyList_Size(w);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000163 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000164 else if (PyTuple_Check(w)) {
165 width = PyTuple_Size(w);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000166 }
167
168 switch (width) {
169 case 2:
170 vec[2] = 0.0;
171 /* Fall through */
172 case 3:
173 break;
174 default:
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000175 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000176 return NULL;
177 }
178
179 for (i = 0; i < n; i++) {
180 w = (*getitem)(v, i);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000181 if (!PyArg_GetDoubleArray(w, 1, 0, width, vec))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000182 return NULL;
183 v3d(vec);
184 }
185
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000186 Py_INCREF(Py_None);
187 return Py_None;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000188}
189
190/*
191vnarray, nvarray -- an array of n3f and v3f calls.
192The argument is an array (list or tuple) of pairs of points and normals.
193Each pair is a tuple (NOT a list) of a point and a normal for that point.
194Each point or normal must be a tuple (NOT a list) of coordinates (x, y, z).
195Three coordinates must be given. Float and int values may be mixed.
196For each pair, n3f() is called for the normal, and then v3f() is called
197for the vector.
198
199vnarray and nvarray differ only in the order of the vector and normal in
200the pair: vnarray expects (v, n) while nvarray expects (n, v).
201*/
202
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000203static PyObject *gen_nvarray(); /* Forward */
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000204
205% nvarray
206
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000207static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000208gl_nvarray(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000209 PyObject *self;
210 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000211{
212 return gen_nvarray(args, 0);
213}
214
215% vnarray
216
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000217static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000218gl_vnarray(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000219 PyObject *self;
220 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000221{
222 return gen_nvarray(args, 1);
223}
224
225/* Generic, internal version of {nv,nv}array: inorm indicates the
226 argument order, 0: normal first, 1: vector first. */
227
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000228static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000229gen_nvarray(args, inorm)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000230 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000231 int inorm;
232{
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000233 PyObject *v, *w, *wnorm, *wvec;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000234 int i, n;
235 float norm[3], vec[3];
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000236 PyObject * (*getitem) Py_FPROTO((PyObject *, int));
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000237
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000238 if (!PyArg_GetObject(args, 1, 0, &v))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000239 return NULL;
240
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000241 if (PyList_Check(v)) {
242 n = PyList_Size(v);
243 getitem = PyList_GetItem;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000244 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000245 else if (PyTuple_Check(v)) {
246 n = PyTuple_Size(v);
247 getitem = PyTuple_GetItem;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000248 }
249 else {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000250 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000251 return NULL;
252 }
253
254 for (i = 0; i < n; i++) {
255 w = (*getitem)(v, i);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000256 if (!PyTuple_Check(w) || PyTuple_Size(w) != 2) {
257 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000258 return NULL;
259 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000260 wnorm = PyTuple_GetItem(w, inorm);
261 wvec = PyTuple_GetItem(w, 1 - inorm);
262 if (!PyArg_GetFloatArray(wnorm, 1, 0, 3, norm) ||
263 !PyArg_GetFloatArray(wvec, 1, 0, 3, vec))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000264 return NULL;
265 n3f(norm);
266 v3f(vec);
267 }
268
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000269 Py_INCREF(Py_None);
270 return Py_None;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000271}
272
273/* nurbssurface(s_knots[], t_knots[], ctl[][], s_order, t_order, type).
274 The dimensions of ctl[] are computed as follows:
275 [len(s_knots) - s_order], [len(t_knots) - t_order]
276*/
277
278% nurbssurface
279
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000280static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000281gl_nurbssurface(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000282 PyObject *self;
283 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000284{
285 long arg1 ;
286 double * arg2 ;
287 long arg3 ;
288 double * arg4 ;
289 double *arg5 ;
290 long arg6 ;
291 long arg7 ;
292 long arg8 ;
293 long ncoords;
294 long s_byte_stride, t_byte_stride;
295 long s_nctl, t_nctl;
296 long s, t;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000297 PyObject *v, *w, *pt;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000298 double *pnext;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000299 if (!PyArg_GetLongArraySize(args, 6, 0, &arg1))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000300 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000301 if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) {
302 return PyErr_NoMemory();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000303 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000304 if (!PyArg_GetDoubleArray(args, 6, 0, arg1 , arg2))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000305 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000306 if (!PyArg_GetLongArraySize(args, 6, 1, &arg3))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000307 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000308 if ((arg4 = PyMem_NEW(double, arg3 )) == NULL) {
309 return PyErr_NoMemory();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000310 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000311 if (!PyArg_GetDoubleArray(args, 6, 1, arg3 , arg4))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000312 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000313 if (!PyArg_GetLong(args, 6, 3, &arg6))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000314 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000315 if (!PyArg_GetLong(args, 6, 4, &arg7))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000316 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000317 if (!PyArg_GetLong(args, 6, 5, &arg8))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000318 return NULL;
319 if (arg8 == N_XYZ)
320 ncoords = 3;
321 else if (arg8 == N_XYZW)
322 ncoords = 4;
323 else {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000324 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000325 return NULL;
326 }
327 s_nctl = arg1 - arg6;
328 t_nctl = arg3 - arg7;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000329 if (!PyArg_GetObject(args, 6, 2, &v))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000330 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000331 if (!PyList_Check(v) || PyList_Size(v) != s_nctl) {
332 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000333 return NULL;
334 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000335 if ((arg5 = PyMem_NEW(double, s_nctl*t_nctl*ncoords )) == NULL) {
336 return PyErr_NoMemory();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000337 }
338 pnext = arg5;
339 for (s = 0; s < s_nctl; s++) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000340 w = PyList_GetItem(v, s);
341 if (w == NULL || !PyList_Check(w) ||
342 PyList_Size(w) != t_nctl) {
343 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000344 return NULL;
345 }
346 for (t = 0; t < t_nctl; t++) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000347 pt = PyList_GetItem(w, t);
348 if (!PyArg_GetDoubleArray(pt, 1, 0, ncoords, pnext))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000349 return NULL;
350 pnext += ncoords;
351 }
352 }
353 s_byte_stride = sizeof(double) * ncoords;
354 t_byte_stride = s_byte_stride * s_nctl;
355 nurbssurface( arg1 , arg2 , arg3 , arg4 ,
356 s_byte_stride , t_byte_stride , arg5 , arg6 , arg7 , arg8 );
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000357 PyMem_DEL(arg2);
358 PyMem_DEL(arg4);
359 PyMem_DEL(arg5);
360 Py_INCREF(Py_None);
361 return Py_None;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000362}
363
364/* nurbscurve(knots, ctlpoints, order, type).
365 The length of ctlpoints is len(knots)-order. */
366
367%nurbscurve
368
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000369static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000370gl_nurbscurve(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000371 PyObject *self;
372 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000373{
374 long arg1 ;
375 double * arg2 ;
376 long arg3 ;
377 double * arg4 ;
378 long arg5 ;
379 long arg6 ;
380 int ncoords, npoints;
381 int i;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000382 PyObject *v;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000383 double *pnext;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000384 if (!PyArg_GetLongArraySize(args, 4, 0, &arg1))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000385 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000386 if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) {
387 return PyErr_NoMemory();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000388 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000389 if (!PyArg_GetDoubleArray(args, 4, 0, arg1 , arg2))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000390 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000391 if (!PyArg_GetLong(args, 4, 2, &arg5))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000392 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000393 if (!PyArg_GetLong(args, 4, 3, &arg6))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000394 return NULL;
395 if (arg6 == N_ST)
396 ncoords = 2;
397 else if (arg6 == N_STW)
398 ncoords = 3;
399 else {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000400 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000401 return NULL;
402 }
403 npoints = arg1 - arg5;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000404 if (!PyArg_GetObject(args, 4, 1, &v))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000405 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000406 if (!PyList_Check(v) || PyList_Size(v) != npoints) {
407 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000408 return NULL;
409 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000410 if ((arg4 = PyMem_NEW(double, npoints*ncoords )) == NULL) {
411 return PyErr_NoMemory();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000412 }
413 pnext = arg4;
414 for (i = 0; i < npoints; i++) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000415 if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000416 return NULL;
417 pnext += ncoords;
418 }
419 arg3 = (sizeof(double)) * ncoords;
420 nurbscurve( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 );
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000421 PyMem_DEL(arg2);
422 PyMem_DEL(arg4);
423 Py_INCREF(Py_None);
424 return Py_None;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000425}
426
427/* pwlcurve(points, type).
428 Points is a list of points. Type must be N_ST. */
429
430%pwlcurve
431
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000432static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000433gl_pwlcurve(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000434 PyObject *self;
435 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000436{
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000437 PyObject *v;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000438 long type;
439 double *data, *pnext;
440 long npoints, ncoords;
441 int i;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000442 if (!PyArg_GetObject(args, 2, 0, &v))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000443 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000444 if (!PyArg_GetLong(args, 2, 1, &type))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000445 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000446 if (!PyList_Check(v)) {
447 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000448 return NULL;
449 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000450 npoints = PyList_Size(v);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000451 if (type == N_ST)
452 ncoords = 2;
453 else {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000454 PyErr_BadArgument();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000455 return NULL;
456 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000457 if ((data = PyMem_NEW(double, npoints*ncoords)) == NULL) {
458 return PyErr_NoMemory();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000459 }
460 pnext = data;
461 for (i = 0; i < npoints; i++) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000462 if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000463 return NULL;
464 pnext += ncoords;
465 }
466 pwlcurve(npoints, data, sizeof(double)*ncoords, type);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000467 PyMem_DEL(data);
468 Py_INCREF(Py_None);
469 return Py_None;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000470}
471
472
473/* Picking and Selecting */
474
475static short *pickbuffer = NULL;
476static long pickbuffersize;
477
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000478static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000479pick_select(args, func)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000480 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000481 void (*func)();
482{
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000483 if (!PyArg_GetLong(args, 1, 0, &pickbuffersize))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000484 return NULL;
485 if (pickbuffer != NULL) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000486 PyErr_SetString(PyExc_RuntimeError,
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000487 "pick/gselect: already picking/selecting");
488 return NULL;
489 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000490 if ((pickbuffer = PyMem_NEW(short, pickbuffersize)) == NULL) {
491 return PyErr_NoMemory();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000492 }
493 (*func)(pickbuffer, pickbuffersize);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000494 Py_INCREF(Py_None);
495 return Py_None;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000496}
497
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000498static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000499endpick_select(args, func)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000500 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000501 long (*func)();
502{
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000503 PyObject *v, *w;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000504 int i, nhits, n;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000505 if (!PyArg_NoArgs(args))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000506 return NULL;
507 if (pickbuffer == NULL) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000508 PyErr_SetString(PyExc_RuntimeError,
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000509 "endpick/endselect: not in pick/select mode");
510 return NULL;
511 }
512 nhits = (*func)(pickbuffer);
513 if (nhits < 0) {
514 nhits = -nhits; /* How to report buffer overflow otherwise? */
515 }
516 /* Scan the buffer to see how many integers */
517 n = 0;
518 for (; nhits > 0; nhits--) {
519 n += 1 + pickbuffer[n];
520 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000521 v = PyList_New(n);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000522 if (v == NULL)
523 return NULL;
524 /* XXX Could do it nicer and interpret the data structure here,
525 returning a list of lists. But this can be done in Python... */
526 for (i = 0; i < n; i++) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000527 w = PyInt_FromLong((long)pickbuffer[i]);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000528 if (w == NULL) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000529 Py_DECREF(v);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000530 return NULL;
531 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000532 PyList_SetItem(v, i, w);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000533 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000534 PyMem_DEL(pickbuffer);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000535 pickbuffer = NULL;
536 return v;
537}
538
539extern void pick(), gselect();
540extern long endpick(), endselect();
541
542%pick
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000543static PyObject *gl_pick(self, args) PyObject *self, *args; {
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000544 return pick_select(args, pick);
545}
546
547%endpick
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000548static PyObject *gl_endpick(self, args) PyObject *self, *args; {
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000549 return endpick_select(args, endpick);
550}
551
552%gselect
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000553static PyObject *gl_gselect(self, args) PyObject *self, *args; {
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000554 return pick_select(args, gselect);
555}
556
557%endselect
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000558static PyObject *gl_endselect(self, args) PyObject *self, *args; {
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000559 return endpick_select(args, endselect);
560}
561
562
563/* XXX The generator botches this one. Here's a quick hack to fix it. */
564
Guido van Rossumb3165151991-08-16 08:59:21 +0000565/* XXX The generator botches this one. Here's a quick hack to fix it. */
566
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000567% getmatrix float r[16]
568
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000569static PyObject *
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000570gl_getmatrix(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000571 PyObject *self;
572 PyObject *args;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000573{
Sjoerd Mullender3bb8a051993-10-22 12:04:32 +0000574 Matrix arg1;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000575 PyObject *v, *w;
Sjoerd Mullender3bb8a051993-10-22 12:04:32 +0000576 int i, j;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000577 getmatrix( arg1 );
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000578 v = PyList_New(16);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000579 if (v == NULL) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000580 return PyErr_NoMemory();
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000581 }
Sjoerd Mullender3bb8a051993-10-22 12:04:32 +0000582 for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) {
583 w = mknewfloatobject(arg1[i][j]);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000584 if (w == NULL) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000585 Py_DECREF(v);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000586 return NULL;
587 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000588 PyList_SetItem(v, i*4+j, w);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000589 }
590 return v;
591}
592
Guido van Rossumb3165151991-08-16 08:59:21 +0000593/* Here's an alternate version that returns a 4x4 matrix instead of
594 a vector. Unfortunately it is incompatible with loadmatrix and
595 multmatrix... */
596
597% altgetmatrix float r[4][4]
598
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000599static PyObject *
Guido van Rossumb3165151991-08-16 08:59:21 +0000600gl_altgetmatrix(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000601 PyObject *self;
602 PyObject *args;
Guido van Rossumb3165151991-08-16 08:59:21 +0000603{
Sjoerd Mullender3bb8a051993-10-22 12:04:32 +0000604 Matrix arg1;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000605 PyObject *v, *w;
Guido van Rossumb3165151991-08-16 08:59:21 +0000606 int i, j;
607 getmatrix( arg1 );
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000608 v = PyList_New(4);
Guido van Rossumb3165151991-08-16 08:59:21 +0000609 if (v == NULL) {
610 return NULL;
611 }
612 for (i = 0; i < 4; i++) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000613 w = PyList_New(4);
Guido van Rossumb3165151991-08-16 08:59:21 +0000614 if (w == NULL) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000615 Py_DECREF(v);
Guido van Rossumb3165151991-08-16 08:59:21 +0000616 return NULL;
617 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000618 PyList_SetItem(v, i, w);
Guido van Rossumb3165151991-08-16 08:59:21 +0000619 }
620 for (i = 0; i < 4; i++) {
621 for (j = 0; j < 4; j++) {
622 w = mknewfloatobject(arg1[i][j]);
623 if (w == NULL) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000624 Py_DECREF(v);
Guido van Rossumb3165151991-08-16 08:59:21 +0000625 return NULL;
626 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000627 PyList_SetItem(PyList_GetItem(v, i), j, w);
Guido van Rossumb3165151991-08-16 08:59:21 +0000628 }
629 }
630 return v;
631}
632
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000633% lrectwrite
634
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000635static PyObject *
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000636gl_lrectwrite(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000637 PyObject *self;
638 PyObject *args;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000639{
640 short x1 ;
641 short y1 ;
642 short x2 ;
643 short y2 ;
644 string parray ;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000645 PyObject *s;
Guido van Rossumece35bc1996-12-09 18:52:11 +0000646#if 0
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000647 int pixcount;
Guido van Rossumece35bc1996-12-09 18:52:11 +0000648#endif
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000649 if (!PyArg_GetShort(args, 5, 0, &x1))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000650 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000651 if (!PyArg_GetShort(args, 5, 1, &y1))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000652 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000653 if (!PyArg_GetShort(args, 5, 2, &x2))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000654 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000655 if (!PyArg_GetShort(args, 5, 3, &y2))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000656 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000657 if (!PyArg_GetString(args, 5, 4, &parray))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000658 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000659 if (!PyArg_GetObject(args, 5, 4, &s))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000660 return NULL;
Guido van Rossum6d0b5a71991-11-12 15:41:00 +0000661#if 0
662/* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000663 pixcount = (long)(x2+1-x1) * (long)(y2+1-y1);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000664 if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) {
665 PyErr_SetString(PyExc_RuntimeError,
Guido van Rossum6d0b5a71991-11-12 15:41:00 +0000666 "string arg to lrectwrite has wrong size");
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000667 return NULL;
668 }
Guido van Rossum6d0b5a71991-11-12 15:41:00 +0000669#endif
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000670 lrectwrite( x1 , y1 , x2 , y2 , (unsigned long *) parray );
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000671 Py_INCREF(Py_None);
672 return Py_None;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000673}
674
675% lrectread
676
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000677static PyObject *
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000678gl_lrectread(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000679 PyObject *self;
680 PyObject *args;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000681{
682 short x1 ;
683 short y1 ;
684 short x2 ;
685 short y2 ;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000686 PyObject *parray;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000687 int pixcount;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000688 if (!PyArg_GetShort(args, 4, 0, &x1))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000689 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000690 if (!PyArg_GetShort(args, 4, 1, &y1))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000691 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000692 if (!PyArg_GetShort(args, 4, 2, &x2))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000693 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000694 if (!PyArg_GetShort(args, 4, 3, &y2))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000695 return NULL;
696 pixcount = (long)(x2+1-x1) * (long)(y2+1-y1);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000697 parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long));
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000698 if (parray == NULL)
699 return NULL; /* No memory */
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000700 lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray));
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000701 return parray;
702}
703
Jack Jansen5fc67731993-02-16 09:25:15 +0000704% readdisplay
705
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000706static PyObject *
Jack Jansen5fc67731993-02-16 09:25:15 +0000707gl_readdisplay(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000708 PyObject *self;
709 PyObject *args;
Jack Jansen5fc67731993-02-16 09:25:15 +0000710{
711 short x1, y1, x2, y2;
712 unsigned long *parray, hints;
713 long size, size_ret;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000714 PyObject *rv;
Jack Jansen5fc67731993-02-16 09:25:15 +0000715
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000716 if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) )
Jack Jansen5fc67731993-02-16 09:25:15 +0000717 return 0;
718 size = (long)(x2+1-x1) * (long)(y2+1-y1);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000719 rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long));
Jack Jansen5fc67731993-02-16 09:25:15 +0000720 if ( rv == NULL )
721 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000722 parray = (unsigned long *)PyString_AsString(rv);
Jack Jansen5fc67731993-02-16 09:25:15 +0000723 size_ret = readdisplay(x1, y1, x2, y2, parray, hints);
724 if ( size_ret != size ) {
Guido van Rossumece35bc1996-12-09 18:52:11 +0000725 printf("gl_readdisplay: got %ld pixels, expected %ld\n",
Jack Jansen5fc67731993-02-16 09:25:15 +0000726 size_ret, size);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000727 PyErr_SetString(PyExc_RuntimeError, "readdisplay returned unexpected length");
Jack Jansen5fc67731993-02-16 09:25:15 +0000728 return NULL;
729 }
730 return rv;
731}
732
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000733/* Desperately needed, here are tools to compress and decompress
734 the data manipulated by lrectread/lrectwrite.
735
736 gl.packrect(width, height, packfactor, bigdata) --> smalldata
737 makes 'bigdata' 4*(packfactor**2) times smaller by:
738 - turning it into B/W (a factor 4)
739 - replacing squares of size pacfactor by one
740 representative
741
742 gl.unpackrect(width, height, packfactor, smalldata) --> bigdata
743 is the inverse; the numeric arguments must be *the same*.
744
745 Both work best if width and height are multiples of packfactor
746 (in fact unpackrect will leave garbage bytes).
747*/
748
749% packrect
750
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000751static PyObject *
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000752gl_packrect(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000753 PyObject *self;
754 PyObject *args;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000755{
756 long width, height, packfactor;
757 char *s;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000758 PyObject *unpacked, *packed;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000759 int pixcount, packedcount, x, y, r, g, b;
760 unsigned long pixel;
761 unsigned char *p;
762 unsigned long *parray;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000763 if (!PyArg_GetLong(args, 4, 0, &width))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000764 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000765 if (!PyArg_GetLong(args, 4, 1, &height))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000766 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000767 if (!PyArg_GetLong(args, 4, 2, &packfactor))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000768 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000769 if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000770 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000771 if (!PyArg_GetObject(args, 4, 3, &unpacked))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000772 return NULL;
773 if (width <= 0 || height <= 0 || packfactor <= 0) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000774 PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0");
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000775 return NULL;
776 }
777 pixcount = width*height;
778 packedcount = ((width+packfactor-1)/packfactor) *
779 ((height+packfactor-1)/packfactor);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000780 if (PyString_Size(unpacked) != pixcount*sizeof(long)) {
781 PyErr_SetString(PyExc_RuntimeError,
Guido van Rossum6d0b5a71991-11-12 15:41:00 +0000782 "string arg to packrect has wrong size");
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000783 return NULL;
784 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000785 packed = PyString_FromStringAndSize((char *)NULL, packedcount);
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000786 if (packed == NULL)
787 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000788 parray = (unsigned long *) PyString_AsString(unpacked);
789 p = (unsigned char *) PyString_AsString(packed);
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000790 for (y = 0; y < height; y += packfactor, parray += packfactor*width) {
791 for (x = 0; x < width; x += packfactor) {
792 pixel = parray[x];
793 r = pixel & 0xff;
794 g = (pixel >> 8) & 0xff;
795 b = (pixel >> 16) & 0xff;
Guido van Rossum6d0b5a71991-11-12 15:41:00 +0000796 *p++ = (30*r+59*g+11*b) / 100;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000797 }
798 }
799 return packed;
800}
801
802% unpackrect
803
804static unsigned long unpacktab[256];
805static int unpacktab_inited = 0;
806
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000807static PyObject *
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000808gl_unpackrect(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000809 PyObject *self;
810 PyObject *args;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000811{
812 long width, height, packfactor;
813 char *s;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000814 PyObject *unpacked, *packed;
Guido van Rossumece35bc1996-12-09 18:52:11 +0000815 int pixcount, packedcount;
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000816 register unsigned char *p;
817 register unsigned long *parray;
818 if (!unpacktab_inited) {
819 register int white;
820 for (white = 256; --white >= 0; )
821 unpacktab[white] = white * 0x010101L;
822 unpacktab_inited++;
823 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000824 if (!PyArg_GetLong(args, 4, 0, &width))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000825 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000826 if (!PyArg_GetLong(args, 4, 1, &height))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000827 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000828 if (!PyArg_GetLong(args, 4, 2, &packfactor))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000829 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000830 if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000831 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000832 if (!PyArg_GetObject(args, 4, 3, &packed))
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000833 return NULL;
834 if (width <= 0 || height <= 0 || packfactor <= 0) {
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000835 PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0");
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000836 return NULL;
837 }
838 pixcount = width*height;
839 packedcount = ((width+packfactor-1)/packfactor) *
840 ((height+packfactor-1)/packfactor);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000841 if (PyString_Size(packed) != packedcount) {
842 PyErr_SetString(PyExc_RuntimeError,
Guido van Rossum6d0b5a71991-11-12 15:41:00 +0000843 "string arg to unpackrect has wrong size");
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000844 return NULL;
845 }
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000846 unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long));
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000847 if (unpacked == NULL)
848 return NULL;
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000849 parray = (unsigned long *) PyString_AsString(unpacked);
850 p = (unsigned char *) PyString_AsString(packed);
Guido van Rossumd26d9ed1991-10-20 20:13:40 +0000851 if (packfactor == 1 && width*height > 0) {
852 /* Just expand bytes to longs */
853 register int x = width * height;
854 do {
855 *parray++ = unpacktab[*p++];
856 } while (--x >= 0);
857 }
858 else {
859 register int y;
860 for (y = 0; y < height-packfactor+1;
861 y += packfactor, parray += packfactor*width) {
862 register int x;
863 for (x = 0; x < width-packfactor+1; x += packfactor) {
864 register unsigned long pixel = unpacktab[*p++];
865 register int i;
866 for (i = packfactor*width; (i-=width) >= 0;) {
867 register int j;
868 for (j = packfactor; --j >= 0; )
869 parray[i+x+j] = pixel;
870 }
871 }
872 }
873 }
874 return unpacked;
875}
876
Guido van Rossumaee08791992-09-08 09:05:33 +0000877% gversion
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000878static PyObject *
Guido van Rossumaee08791992-09-08 09:05:33 +0000879gl_gversion(self, args)
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000880 PyObject *self;
881 PyObject *args;
Guido van Rossumaee08791992-09-08 09:05:33 +0000882{
883 char buf[20];
884 gversion(buf);
Guido van Rossum0a3eaf01997-04-29 15:39:28 +0000885 return PyString_FromString(buf);
Guido van Rossumaee08791992-09-08 09:05:33 +0000886}
887
888
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000889/* End of manually written stubs */
890
891%%
892
893long getshade
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000894if !solaris void devport short s long s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000895void rdr2i long s long s
896void rectfs short s short s short s short s
897void rects short s short s short s short s
898void rmv2i long s long s
899void noport
900void popviewport
901void clear
902void clearhitcode
903void closeobj
904void cursoff
905void curson
906void doublebuffer
907void finish
908void gconfig
909void ginit
910void greset
911void multimap
912void onemap
913void popattributes
914void popmatrix
915void pushattributes
916void pushmatrix
917void pushviewport
918void qreset
919void RGBmode
920void singlebuffer
921void swapbuffers
922void gsync
Guido van Rossum06a67021992-02-26 15:19:45 +0000923void gflush
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000924void tpon
925void tpoff
926void clkon
927void clkoff
928void ringbell
929#void callfunc
930void gbegin
931void textinit
932void initnames
933void pclos
934void popname
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000935if !solaris void spclos
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000936void zclear
937void screenspace
938void reshapeviewport
939void winpush
940void winpop
941void foreground
942void endfullscrn
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000943if !solaris void endpupmode
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000944void fullscrn
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000945if !solaris void pupmode
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000946void winconstraints
947void pagecolor short s
948void textcolor short s
949void color short s
950void curveit short s
951void font short s
952void linewidth short s
953void setlinestyle short s
954void setmap short s
955void swapinterval short s
956void writemask short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000957if !solaris void textwritemask short s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000958void qdevice short s
959void unqdevice short s
960void curvebasis short s
961void curveprecision short s
962void loadname short s
963void passthrough short s
964void pushname short s
965void setmonitor short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000966if !solaris void setshade short s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000967void setpattern short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000968if !solaris void pagewritemask short s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000969#
970void callobj long s
971void delobj long s
972void editobj long s
973void makeobj long s
974void maketag long s
975void chunksize long s
976void compactify long s
977void deltag long s
978void lsrepeat long s
979void objinsert long s
980void objreplace long s
981void winclose long s
982void blanktime long s
983void freepup long s
984# This is not in the library!?
985###void pupcolor long s
986#
987void backbuffer long s
988void frontbuffer long s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000989if !solaris void lsbackup long s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000990void resetls long s
991void lampon long s
992void lampoff long s
993void setbell long s
994void blankscreen long s
995void depthcue long s
996void zbuffer long s
997void backface long s
998#
999void cmov2i long s long s
1000void draw2i long s long s
1001void move2i long s long s
1002void pnt2i long s long s
1003void patchbasis long s long s
1004void patchprecision long s long s
1005void pdr2i long s long s
1006void pmv2i long s long s
1007void rpdr2i long s long s
1008void rpmv2i long s long s
1009void xfpt2i long s long s
1010void objdelete long s long s
1011void patchcurves long s long s
1012void minsize long s long s
1013void maxsize long s long s
1014void keepaspect long s long s
1015void prefsize long s long s
1016void stepunit long s long s
1017void fudge long s long s
1018void winmove long s long s
1019#
1020void attachcursor short s short s
1021void deflinestyle short s short s
1022void noise short s short s
1023void picksize short s short s
1024void qenter short s short s
1025void setdepth short s short s
1026void cmov2s short s short s
1027void draw2s short s short s
1028void move2s short s short s
1029void pdr2s short s short s
1030void pmv2s short s short s
1031void pnt2s short s short s
1032void rdr2s short s short s
1033void rmv2s short s short s
1034void rpdr2s short s short s
1035void rpmv2s short s short s
1036void xfpt2s short s short s
1037#
1038void cmov2 float s float s
1039void draw2 float s float s
1040void move2 float s float s
1041void pnt2 float s float s
1042void pdr2 float s float s
1043void pmv2 float s float s
1044void rdr2 float s float s
1045void rmv2 float s float s
1046void rpdr2 float s float s
1047void rpmv2 float s float s
1048void xfpt2 float s float s
1049#
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001050void loadmatrix float s[4*4]
Guido van Rossumb3165151991-08-16 08:59:21 +00001051# Really [4][4]
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001052void multmatrix float s[4*4]
Guido van Rossumb3165151991-08-16 08:59:21 +00001053# Really [4][4]
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001054void crv float s[3*4]
Guido van Rossumb3165151991-08-16 08:59:21 +00001055# Really [4][3]
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001056void rcrv float s[4*4]
Guido van Rossumb3165151991-08-16 08:59:21 +00001057# Really [4][4]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001058#
1059# Methods that have strings.
1060#
1061void addtopup long s char *s long s
1062void charstr char *s
1063void getport char *s
1064long strwidth char *s
1065long winopen char *s
1066void wintitle char *s
1067#
1068# Methods that have 1 long (# of elements) and an array
1069#
1070void polf long s float s[3*arg1]
1071void polf2 long s float s[2*arg1]
1072void poly long s float s[3*arg1]
1073void poly2 long s float s[2*arg1]
1074void crvn long s float s[3*arg1]
1075void rcrvn long s float s[4*arg1]
1076#
1077void polf2i long s long s[2*arg1]
1078void polfi long s long s[3*arg1]
1079void poly2i long s long s[2*arg1]
1080void polyi long s long s[3*arg1]
1081#
1082void polf2s long s short s[2*arg1]
1083void polfs long s short s[3*arg1]
1084void polys long s short s[3*arg1]
1085void poly2s long s short s[2*arg1]
1086#
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001087void defcursor short s u_short s[128]
Guido van Rossumb3165151991-08-16 08:59:21 +00001088# Is this useful?
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001089void writepixels short s u_short s[arg1]
Guido van Rossumb3165151991-08-16 08:59:21 +00001090# Should be unsigned short...
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001091void defbasis long s float s[4*4]
1092if !solaris void gewrite short s short s[arg1]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001093#
1094void rotate short s char s
1095# This is not in the library!?
1096###void setbutton short s char s
1097void rot float s char s
1098#
1099void circfi long s long s long s
1100void circi long s long s long s
1101void cmovi long s long s long s
1102void drawi long s long s long s
1103void movei long s long s long s
1104void pnti long s long s long s
1105void newtag long s long s long s
1106void pdri long s long s long s
1107void pmvi long s long s long s
1108void rdri long s long s long s
1109void rmvi long s long s long s
1110void rpdri long s long s long s
1111void rpmvi long s long s long s
1112void xfpti long s long s long s
1113#
1114void circ float s float s float s
1115void circf float s float s float s
1116void cmov float s float s float s
1117void draw float s float s float s
1118void move float s float s float s
1119void pnt float s float s float s
1120void scale float s float s float s
1121void translate float s float s float s
1122void pdr float s float s float s
1123void pmv float s float s float s
1124void rdr float s float s float s
1125void rmv float s float s float s
1126void rpdr float s float s float s
1127void rpmv float s float s float s
1128void xfpt float s float s float s
1129#
1130void RGBcolor short s short s short s
1131void RGBwritemask short s short s short s
1132void setcursor short s short s short s
1133void tie short s short s short s
1134void circfs short s short s short s
1135void circs short s short s short s
1136void cmovs short s short s short s
1137void draws short s short s short s
1138void moves short s short s short s
1139void pdrs short s short s short s
1140void pmvs short s short s short s
1141void pnts short s short s short s
1142void rdrs short s short s short s
1143void rmvs short s short s short s
1144void rpdrs short s short s short s
1145void rpmvs short s short s short s
1146void xfpts short s short s short s
1147void curorigin short s short s short s
1148void cyclemap short s short s short s
1149#
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001150void patch float s[4*4] float s[4*4] float s[4*4]
1151void splf long s float s[3*arg1] u_short s[arg1]
1152void splf2 long s float s[2*arg1] u_short s[arg1]
1153void splfi long s long s[3*arg1] u_short s[arg1]
1154void splf2i long s long s[2*arg1] u_short s[arg1]
1155void splfs long s short s[3*arg1] u_short s[arg1]
1156void splf2s long s short s[2*arg1] u_short s[arg1]
1157###void defpattern short s short s u_short s[arg2*arg2/16]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001158#
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001159void rpatch float s[4*4] float s[4*4] float s[4*4] float s[4*4]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001160#
1161# routines that send 4 floats
1162#
1163void ortho2 float s float s float s float s
1164void rect float s float s float s float s
1165void rectf float s float s float s float s
1166void xfpt4 float s float s float s float s
1167#
1168void textport short s short s short s short s
1169void mapcolor short s short s short s short s
1170void scrmask short s short s short s short s
1171void setvaluator short s short s short s short s
1172void viewport short s short s short s short s
1173void shaderange short s short s short s short s
1174void xfpt4s short s short s short s short s
1175void rectfi long s long s long s long s
1176void recti long s long s long s long s
1177void xfpt4i long s long s long s long s
1178void prefposition long s long s long s long s
1179#
1180void arc float s float s float s short s short s
1181void arcf float s float s float s short s short s
1182void arcfi long s long s long s short s short s
1183void arci long s long s long s short s short s
1184#
1185void bbox2 short s short s float s float s float s float s
1186void bbox2i short s short s long s long s long s long s
1187void bbox2s short s short s short s short s short s short s
1188void blink short s short s short s short s short s
1189void ortho float s float s float s float s float s float s
1190void window float s float s float s float s float s float s
1191void lookat float s float s float s float s float s float s short s
1192#
1193void perspective short s float s float s float s
1194void polarview float s short s short s short s
1195# XXX getichararray not supported
1196#void writeRGB short s char s[arg1] char s[arg1] char s[arg1]
1197#
1198void arcfs short s short s short s short s short s
1199void arcs short s short s short s short s short s
1200void rectcopy short s short s short s short s short s short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001201if !solaris void RGBcursor short s short s short s short s short s short s short s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001202#
1203long getbutton short s
1204long getcmmode
1205long getlsbackup
1206long getresetls
1207long getdcm
1208long getzbuffer
1209long ismex
1210long isobj long s
1211long isqueued short s
1212long istag long s
1213#
1214long genobj
1215long gentag
1216long getbuffer
1217long getcolor
1218long getdisplaymode
1219long getfont
1220long getheight
1221long gethitcode
1222long getlstyle
1223long getlwidth
1224long getmap
1225long getplanes
1226long getwritemask
1227long qtest
1228long getlsrepeat
1229long getmonitor
1230long getopenobj
1231long getpattern
1232long winget
1233long winattach
1234long getothermonitor
1235long newpup
1236#
1237long getvaluator short s
1238void winset long s
1239long dopup long s
1240void getdepth short r short r
1241void getcpos short r short r
1242void getsize long r long r
1243void getorigin long r long r
1244void getviewport short r short r short r short r
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001245if !solaris void gettp short r short r short r short r
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001246void getgpos float r float r float r float r
1247void winposition long s long s long s long s
1248void gRGBcolor short r short r short r
1249void gRGBmask short r short r short r
1250void getscrmask short r short r short r short r
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001251###void gRGBcursor short r short r short r short r short r short r short r short r
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001252void getmcolor short s short r short r short r
1253void mapw long s short s short s float r float r float r float r float r float r
1254void mapw2 long s short s short s float r float r
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001255###void defrasterfont short s short s short s Fontchar s[arg3] short s short s[4*arg5]
Guido van Rossum39789031992-08-13 14:23:56 +00001256###long qread short r
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001257void getcursor short r u_short r u_short r long r
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001258#
1259# For these we receive arrays of stuff
1260#
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001261###void getdev long s short s[arg1] short r[arg1]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001262#XXX not generated correctly yet
1263#void getmatrix float r[16]
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001264###long readpixels short s short r[retval]
1265###long readRGB short s char r[retval] char r[retval] char r[retval]
1266###long blkqread short s short r[arg1]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001267#
1268# New 4D routines
1269#
1270void cmode
1271void concave long s
1272void curstype long s
1273void drawmode long s
1274void gammaramp short s[256] short s[256] short s[256]
1275long getbackface
1276long getdescender
1277long getdrawmode
1278long getmmode
1279long getsm
1280long getvideo long s
1281void imakebackground
1282void lmbind short s short s
1283void lmdef long s long s long s float s[arg3]
1284void mmode long s
1285void normal float s[3]
1286void overlay long s
1287void RGBrange short s short s short s short s short s short s short s short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001288if !solaris void setvideo long s long s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001289void shademodel long s
1290void underlay long s
1291#
1292# New Personal Iris/GT Routines
1293#
1294void bgnclosedline
1295void bgnline
1296void bgnpoint
1297void bgnpolygon
1298void bgnsurface
1299void bgntmesh
1300void bgntrim
1301void endclosedline
1302void endline
1303void endpoint
1304void endpolygon
1305void endsurface
1306void endtmesh
1307void endtrim
1308void blendfunction long s long s
1309void c3f float s[3]
1310void c3i long s[3]
1311void c3s short s[3]
1312void c4f float s[4]
1313void c4i long s[4]
1314void c4s short s[4]
1315void colorf float s
1316void cpack long s
1317void czclear long s long s
1318void dglclose long s
1319long dglopen char *s long s
1320long getgdesc long s
1321void getnurbsproperty long s float r
1322void glcompat long s long s
1323void iconsize long s long s
1324void icontitle char *s
1325void lRGBrange short s short s short s short s short s short s long s long s
1326void linesmooth long s
1327void lmcolor long s
1328void logicop long s
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001329###long lrectread short s short s short s short s long r[retval]
1330###void lrectwrite short s short s short s short s long s[(arg2-arg1+1)*(arg4-arg3+1)]
1331### Now manual, with string last arg
1332###long rectread short s short s short s short s short r[retval]
1333###void rectwrite short s short s short s short s short s[(arg2-arg1+1)*(arg4-arg3+1)]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001334void lsetdepth long s long s
1335void lshaderange short s short s long s long s
1336void n3f float s[3]
1337void noborder
1338void pntsmooth long s
1339void readsource long s
1340void rectzoom float s float s
1341void sbox float s float s float s float s
1342void sboxi long s long s long s long s
1343void sboxs short s short s short s short s
1344void sboxf float s float s float s float s
1345void sboxfi long s long s long s long s
1346void sboxfs short s short s short s short s
1347void setnurbsproperty long s float s
1348void setpup long s long s long s
1349void smoothline long s
1350void subpixel long s
1351void swaptmesh
1352long swinopen long s
1353void v2f float s[2]
1354void v2i long s[2]
1355void v2s short s[2]
1356void v3f float s[3]
1357void v3i long s[3]
1358void v3s short s[3]
1359void v4f float s[4]
1360void v4i long s[4]
1361void v4s short s[4]
1362void videocmd long s
1363long windepth long s
1364void wmpack long s
1365void zdraw long s
1366void zfunction long s
1367void zsource long s
1368void zwritemask long s
1369#
1370# uses doubles
1371#
1372void v2d double s[2]
1373void v3d double s[3]
1374void v4d double s[4]
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001375#
1376# Why isn't this here?
1377#
1378void pixmode long s long s
Guido van Rossumdd9ed831992-06-29 17:10:40 +00001379#
1380# New in IRIX 4.0
1381#
1382long qgetfd
Jack Jansenfa1b9f61993-02-19 12:53:12 +00001383void dither long s