blob: bd2af589e04682d497619c9b19615e4bc028fa82 [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 Rossum5c069fd1998-04-28 16:09:16 +0000889/* void clear - Manual because of clash with termcap */
890%clear
891static PyObject *
892gl_clear(self, args)
893 PyObject *self;
894 PyObject *args;
895{
896 __GLclear( );
897 Py_INCREF(Py_None);
898 return Py_None;
899}
900
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000901/* End of manually written stubs */
902
903%%
904
905long getshade
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000906if !solaris void devport short s long s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000907void rdr2i long s long s
908void rectfs short s short s short s short s
909void rects short s short s short s short s
910void rmv2i long s long s
911void noport
912void popviewport
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000913void clearhitcode
914void closeobj
915void cursoff
916void curson
917void doublebuffer
918void finish
919void gconfig
920void ginit
921void greset
922void multimap
923void onemap
924void popattributes
925void popmatrix
926void pushattributes
927void pushmatrix
928void pushviewport
929void qreset
930void RGBmode
931void singlebuffer
932void swapbuffers
933void gsync
Guido van Rossum06a67021992-02-26 15:19:45 +0000934void gflush
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000935void tpon
936void tpoff
937void clkon
938void clkoff
939void ringbell
940#void callfunc
941void gbegin
942void textinit
943void initnames
944void pclos
945void popname
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000946if !solaris void spclos
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000947void zclear
948void screenspace
949void reshapeviewport
950void winpush
951void winpop
952void foreground
953void endfullscrn
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000954if !solaris void endpupmode
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000955void fullscrn
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000956if !solaris void pupmode
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000957void winconstraints
958void pagecolor short s
959void textcolor short s
960void color short s
961void curveit short s
962void font short s
963void linewidth short s
964void setlinestyle short s
965void setmap short s
966void swapinterval short s
967void writemask short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000968if !solaris void textwritemask short s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000969void qdevice short s
970void unqdevice short s
971void curvebasis short s
972void curveprecision short s
973void loadname short s
974void passthrough short s
975void pushname short s
976void setmonitor short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000977if !solaris void setshade short s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000978void setpattern short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +0000979if !solaris void pagewritemask short s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000980#
981void callobj long s
982void delobj long s
983void editobj long s
984void makeobj long s
985void maketag long s
986void chunksize long s
987void compactify long s
988void deltag long s
989void lsrepeat long s
990void objinsert long s
991void objreplace long s
992void winclose long s
993void blanktime long s
994void freepup long s
995# This is not in the library!?
996###void pupcolor long s
997#
998void backbuffer long s
999void frontbuffer long s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001000if !solaris void lsbackup long s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001001void resetls long s
1002void lampon long s
1003void lampoff long s
1004void setbell long s
1005void blankscreen long s
1006void depthcue long s
1007void zbuffer long s
1008void backface long s
1009#
1010void cmov2i long s long s
1011void draw2i long s long s
1012void move2i long s long s
1013void pnt2i long s long s
1014void patchbasis long s long s
1015void patchprecision long s long s
1016void pdr2i long s long s
1017void pmv2i long s long s
1018void rpdr2i long s long s
1019void rpmv2i long s long s
1020void xfpt2i long s long s
1021void objdelete long s long s
1022void patchcurves long s long s
1023void minsize long s long s
1024void maxsize long s long s
1025void keepaspect long s long s
1026void prefsize long s long s
1027void stepunit long s long s
1028void fudge long s long s
1029void winmove long s long s
1030#
1031void attachcursor short s short s
1032void deflinestyle short s short s
1033void noise short s short s
1034void picksize short s short s
1035void qenter short s short s
1036void setdepth short s short s
1037void cmov2s short s short s
1038void draw2s short s short s
1039void move2s short s short s
1040void pdr2s short s short s
1041void pmv2s short s short s
1042void pnt2s short s short s
1043void rdr2s short s short s
1044void rmv2s short s short s
1045void rpdr2s short s short s
1046void rpmv2s short s short s
1047void xfpt2s short s short s
1048#
1049void cmov2 float s float s
1050void draw2 float s float s
1051void move2 float s float s
1052void pnt2 float s float s
1053void pdr2 float s float s
1054void pmv2 float s float s
1055void rdr2 float s float s
1056void rmv2 float s float s
1057void rpdr2 float s float s
1058void rpmv2 float s float s
1059void xfpt2 float s float s
1060#
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001061void loadmatrix float s[4*4]
Guido van Rossumb3165151991-08-16 08:59:21 +00001062# Really [4][4]
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001063void multmatrix float s[4*4]
Guido van Rossumb3165151991-08-16 08:59:21 +00001064# Really [4][4]
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001065void crv float s[3*4]
Guido van Rossumb3165151991-08-16 08:59:21 +00001066# Really [4][3]
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001067void rcrv float s[4*4]
Guido van Rossumb3165151991-08-16 08:59:21 +00001068# Really [4][4]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001069#
1070# Methods that have strings.
1071#
1072void addtopup long s char *s long s
1073void charstr char *s
1074void getport char *s
1075long strwidth char *s
1076long winopen char *s
1077void wintitle char *s
1078#
1079# Methods that have 1 long (# of elements) and an array
1080#
1081void polf long s float s[3*arg1]
1082void polf2 long s float s[2*arg1]
1083void poly long s float s[3*arg1]
1084void poly2 long s float s[2*arg1]
1085void crvn long s float s[3*arg1]
1086void rcrvn long s float s[4*arg1]
1087#
1088void polf2i long s long s[2*arg1]
1089void polfi long s long s[3*arg1]
1090void poly2i long s long s[2*arg1]
1091void polyi long s long s[3*arg1]
1092#
1093void polf2s long s short s[2*arg1]
1094void polfs long s short s[3*arg1]
1095void polys long s short s[3*arg1]
1096void poly2s long s short s[2*arg1]
1097#
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001098void defcursor short s u_short s[128]
Guido van Rossumb3165151991-08-16 08:59:21 +00001099# Is this useful?
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001100void writepixels short s u_short s[arg1]
Guido van Rossumb3165151991-08-16 08:59:21 +00001101# Should be unsigned short...
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001102void defbasis long s float s[4*4]
1103if !solaris void gewrite short s short s[arg1]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001104#
1105void rotate short s char s
1106# This is not in the library!?
1107###void setbutton short s char s
1108void rot float s char s
1109#
1110void circfi long s long s long s
1111void circi long s long s long s
1112void cmovi long s long s long s
1113void drawi long s long s long s
1114void movei long s long s long s
1115void pnti long s long s long s
1116void newtag long s long s long s
1117void pdri long s long s long s
1118void pmvi long s long s long s
1119void rdri long s long s long s
1120void rmvi long s long s long s
1121void rpdri long s long s long s
1122void rpmvi long s long s long s
1123void xfpti long s long s long s
1124#
1125void circ float s float s float s
1126void circf float s float s float s
1127void cmov float s float s float s
1128void draw float s float s float s
1129void move float s float s float s
1130void pnt float s float s float s
1131void scale float s float s float s
1132void translate float s float s float s
1133void pdr float s float s float s
1134void pmv float s float s float s
1135void rdr float s float s float s
1136void rmv float s float s float s
1137void rpdr float s float s float s
1138void rpmv float s float s float s
1139void xfpt float s float s float s
1140#
1141void RGBcolor short s short s short s
1142void RGBwritemask short s short s short s
1143void setcursor short s short s short s
1144void tie short s short s short s
1145void circfs short s short s short s
1146void circs short s short s short s
1147void cmovs short s short s short s
1148void draws short s short s short s
1149void moves short s short s short s
1150void pdrs short s short s short s
1151void pmvs short s short s short s
1152void pnts short s short s short s
1153void rdrs short s short s short s
1154void rmvs short s short s short s
1155void rpdrs short s short s short s
1156void rpmvs short s short s short s
1157void xfpts short s short s short s
1158void curorigin short s short s short s
1159void cyclemap short s short s short s
1160#
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001161void patch float s[4*4] float s[4*4] float s[4*4]
1162void splf long s float s[3*arg1] u_short s[arg1]
1163void splf2 long s float s[2*arg1] u_short s[arg1]
1164void splfi long s long s[3*arg1] u_short s[arg1]
1165void splf2i long s long s[2*arg1] u_short s[arg1]
1166void splfs long s short s[3*arg1] u_short s[arg1]
1167void splf2s long s short s[2*arg1] u_short s[arg1]
1168###void defpattern short s short s u_short s[arg2*arg2/16]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001169#
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001170void 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 +00001171#
1172# routines that send 4 floats
1173#
1174void ortho2 float s float s float s float s
1175void rect float s float s float s float s
1176void rectf float s float s float s float s
1177void xfpt4 float s float s float s float s
1178#
1179void textport short s short s short s short s
1180void mapcolor short s short s short s short s
1181void scrmask short s short s short s short s
1182void setvaluator short s short s short s short s
1183void viewport short s short s short s short s
1184void shaderange short s short s short s short s
1185void xfpt4s short s short s short s short s
1186void rectfi long s long s long s long s
1187void recti long s long s long s long s
1188void xfpt4i long s long s long s long s
1189void prefposition long s long s long s long s
1190#
1191void arc float s float s float s short s short s
1192void arcf float s float s float s short s short s
1193void arcfi long s long s long s short s short s
1194void arci long s long s long s short s short s
1195#
1196void bbox2 short s short s float s float s float s float s
1197void bbox2i short s short s long s long s long s long s
1198void bbox2s short s short s short s short s short s short s
1199void blink short s short s short s short s short s
1200void ortho float s float s float s float s float s float s
1201void window float s float s float s float s float s float s
1202void lookat float s float s float s float s float s float s short s
1203#
1204void perspective short s float s float s float s
1205void polarview float s short s short s short s
1206# XXX getichararray not supported
1207#void writeRGB short s char s[arg1] char s[arg1] char s[arg1]
1208#
1209void arcfs short s short s short s short s short s
1210void arcs short s short s short s short s short s
1211void rectcopy short s short s short s short s short s short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001212if !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 +00001213#
1214long getbutton short s
1215long getcmmode
1216long getlsbackup
1217long getresetls
1218long getdcm
1219long getzbuffer
1220long ismex
1221long isobj long s
1222long isqueued short s
1223long istag long s
1224#
1225long genobj
1226long gentag
1227long getbuffer
1228long getcolor
1229long getdisplaymode
1230long getfont
1231long getheight
1232long gethitcode
1233long getlstyle
1234long getlwidth
1235long getmap
1236long getplanes
1237long getwritemask
1238long qtest
1239long getlsrepeat
1240long getmonitor
1241long getopenobj
1242long getpattern
1243long winget
1244long winattach
1245long getothermonitor
1246long newpup
1247#
1248long getvaluator short s
1249void winset long s
1250long dopup long s
1251void getdepth short r short r
1252void getcpos short r short r
1253void getsize long r long r
1254void getorigin long r long r
1255void getviewport short r short r short r short r
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001256if !solaris void gettp short r short r short r short r
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001257void getgpos float r float r float r float r
1258void winposition long s long s long s long s
1259void gRGBcolor short r short r short r
1260void gRGBmask short r short r short r
1261void getscrmask short r short r short r short r
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001262###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 +00001263void getmcolor short s short r short r short r
1264void mapw long s short s short s float r float r float r float r float r float r
1265void mapw2 long s short s short s float r float r
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001266###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 +00001267###long qread short r
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001268void getcursor short r u_short r u_short r long r
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001269#
1270# For these we receive arrays of stuff
1271#
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001272###void getdev long s short s[arg1] short r[arg1]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001273#XXX not generated correctly yet
1274#void getmatrix float r[16]
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001275###long readpixels short s short r[retval]
1276###long readRGB short s char r[retval] char r[retval] char r[retval]
1277###long blkqread short s short r[arg1]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001278#
1279# New 4D routines
1280#
1281void cmode
1282void concave long s
1283void curstype long s
1284void drawmode long s
1285void gammaramp short s[256] short s[256] short s[256]
1286long getbackface
1287long getdescender
1288long getdrawmode
1289long getmmode
1290long getsm
1291long getvideo long s
1292void imakebackground
1293void lmbind short s short s
1294void lmdef long s long s long s float s[arg3]
1295void mmode long s
1296void normal float s[3]
1297void overlay long s
1298void RGBrange short s short s short s short s short s short s short s short s
Sjoerd Mullenderc4f169c1993-12-21 17:06:12 +00001299if !solaris void setvideo long s long s
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001300void shademodel long s
1301void underlay long s
1302#
1303# New Personal Iris/GT Routines
1304#
1305void bgnclosedline
1306void bgnline
1307void bgnpoint
1308void bgnpolygon
1309void bgnsurface
1310void bgntmesh
1311void bgntrim
1312void endclosedline
1313void endline
1314void endpoint
1315void endpolygon
1316void endsurface
1317void endtmesh
1318void endtrim
1319void blendfunction long s long s
1320void c3f float s[3]
1321void c3i long s[3]
1322void c3s short s[3]
1323void c4f float s[4]
1324void c4i long s[4]
1325void c4s short s[4]
1326void colorf float s
1327void cpack long s
1328void czclear long s long s
1329void dglclose long s
1330long dglopen char *s long s
1331long getgdesc long s
1332void getnurbsproperty long s float r
1333void glcompat long s long s
1334void iconsize long s long s
1335void icontitle char *s
1336void lRGBrange short s short s short s short s short s short s long s long s
1337void linesmooth long s
1338void lmcolor long s
1339void logicop long s
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001340###long lrectread short s short s short s short s long r[retval]
1341###void lrectwrite short s short s short s short s long s[(arg2-arg1+1)*(arg4-arg3+1)]
1342### Now manual, with string last arg
1343###long rectread short s short s short s short s short r[retval]
1344###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 +00001345void lsetdepth long s long s
1346void lshaderange short s short s long s long s
1347void n3f float s[3]
1348void noborder
1349void pntsmooth long s
1350void readsource long s
1351void rectzoom float s float s
1352void sbox float s float s float s float s
1353void sboxi long s long s long s long s
1354void sboxs short s short s short s short s
1355void sboxf float s float s float s float s
1356void sboxfi long s long s long s long s
1357void sboxfs short s short s short s short s
1358void setnurbsproperty long s float s
1359void setpup long s long s long s
1360void smoothline long s
1361void subpixel long s
1362void swaptmesh
1363long swinopen long s
1364void v2f float s[2]
1365void v2i long s[2]
1366void v2s short s[2]
1367void v3f float s[3]
1368void v3i long s[3]
1369void v3s short s[3]
1370void v4f float s[4]
1371void v4i long s[4]
1372void v4s short s[4]
1373void videocmd long s
1374long windepth long s
1375void wmpack long s
1376void zdraw long s
1377void zfunction long s
1378void zsource long s
1379void zwritemask long s
1380#
1381# uses doubles
1382#
1383void v2d double s[2]
1384void v3d double s[3]
1385void v4d double s[4]
Guido van Rossumd26d9ed1991-10-20 20:13:40 +00001386#
1387# Why isn't this here?
1388#
1389void pixmode long s long s
Guido van Rossumdd9ed831992-06-29 17:10:40 +00001390#
1391# New in IRIX 4.0
1392#
1393long qgetfd
Jack Jansenfa1b9f61993-02-19 12:53:12 +00001394void dither long s