Mercurial > cpython-lru_cache-weakref
annotate Modules/cstubs @ 58925:eecf1bef052d 2.6
Merged revisions 78207 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line
#7930: fix stripid
........
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Tue, 16 Feb 2010 23:29:44 +0000 |
| parents | 6f6f965c5e2d |
| children | c2c12814f854 |
| rev | line source |
|---|---|
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1443
diff
changeset
|
1 |
| 6 | 2 /* |
| 3 Input used to generate the Python module "glmodule.c". | |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
4 The stub generator is a Python script called "cgen.py". |
| 6 | 5 |
| 6 Each definition must be contained on one line: | |
| 7 | |
| 8 <returntype> <name> <type> <arg> <type> <arg> | |
| 9 | |
| 10 <returntype> can be: void, short, long (XXX maybe others?) | |
| 11 | |
| 12 <type> can be: char, string, short, float, long, or double | |
| 13 string indicates a null terminated string; | |
| 14 if <type> is char and <arg> begins with a *, the * is stripped | |
| 15 and <type> is changed into string | |
| 16 | |
| 17 <arg> has the form <mode> or <mode>[<subscript>] | |
| 18 where <mode> can be | |
| 19 s: arg is sent | |
| 20 r: arg is received (arg is a pointer) | |
| 21 and <subscript> can be (N and I are numbers): | |
| 22 N | |
| 23 argI | |
| 24 retval | |
| 25 N*argI | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
26 N*I |
| 6 | 27 N*retval |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
28 In the case where the subscript consists of two parts |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
29 separated by *, the first part is the width of the matrix, and |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
30 the second part is the length of the matrix. This order is |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
31 opposite from the order used in C to declare a two-dimensional |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
32 matrix. |
| 6 | 33 */ |
| 34 | |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
35 /* |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
36 * An attempt has been made to make this module switch threads on qread |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
37 * calls. It is far from safe, though. |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
38 */ |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
39 |
| 6 | 40 #include <gl.h> |
| 41 #include <device.h> | |
| 86 | 42 |
|
4626
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
43 #ifdef __sgi |
|
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
44 extern int devport(); |
|
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
45 extern int textwritemask(); |
|
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
46 extern int pagewritemask(); |
|
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
47 extern int gewrite(); |
|
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
48 extern int gettp(); |
|
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
49 #endif |
|
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
50 |
| 5353 | 51 #include "Python.h" |
| 6 | 52 #include "cgensupport.h" |
| 53 | |
| 54 /* | |
| 55 Some stubs are too complicated for the stub generator. | |
| 56 We can include manually written versions of them here. | |
| 57 A line starting with '%' gives the name of the function so the stub | |
| 58 generator can include it in the table of functions. | |
| 59 */ | |
| 60 | |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
61 % qread |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
62 |
| 5353 | 63 static PyObject * |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
64 gl_qread(self, args) |
| 5353 | 65 PyObject *self; |
| 66 PyObject *args; | |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
67 { |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
68 long retval; |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
69 short arg1 ; |
| 5353 | 70 Py_BEGIN_ALLOW_THREADS |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
71 retval = qread( & arg1 ); |
| 5353 | 72 Py_END_ALLOW_THREADS |
| 73 { PyObject *v = PyTuple_New( 2 ); | |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
74 if (v == NULL) return NULL; |
| 5353 | 75 PyTuple_SetItem(v, 0, mknewlongobject(retval)); |
| 76 PyTuple_SetItem(v, 1, mknewshortobject(arg1)); | |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
77 return v; |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
78 } |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
79 } |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
80 |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
906
diff
changeset
|
81 |
| 6 | 82 /* |
| 83 varray -- an array of v.. calls. | |
| 84 The argument is an array (maybe list or tuple) of points. | |
| 85 Each point must be a tuple or list of coordinates (x, y, z). | |
| 86 The points may be 2- or 3-dimensional but must all have the | |
| 87 same dimension. Float and int values may be mixed however. | |
| 88 The points are always converted to 3D double precision points | |
| 89 by assuming z=0.0 if necessary (as indicated in the man page), | |
| 90 and for each point v3d() is called. | |
| 91 */ | |
| 92 | |
| 93 % varray | |
| 94 | |
| 5353 | 95 static PyObject * |
| 6 | 96 gl_varray(self, args) |
| 5353 | 97 PyObject *self; |
| 98 PyObject *args; | |
| 6 | 99 { |
| 5353 | 100 PyObject *v, *w=NULL; |
| 6 | 101 int i, n, width; |
| 102 double vec[3]; | |
|
14060
dc2dedca93f7
Removed references to Py_FPROTO.
Sjoerd Mullender <sjoerd@acm.org>
parents:
13256
diff
changeset
|
103 PyObject * (*getitem)(PyObject *, int); |
| 6 | 104 |
| 5353 | 105 if (!PyArg_GetObject(args, 1, 0, &v)) |
| 6 | 106 return NULL; |
| 107 | |
| 5353 | 108 if (PyList_Check(v)) { |
| 109 n = PyList_Size(v); | |
| 110 getitem = PyList_GetItem; | |
| 6 | 111 } |
| 5353 | 112 else if (PyTuple_Check(v)) { |
| 113 n = PyTuple_Size(v); | |
| 114 getitem = PyTuple_GetItem; | |
| 6 | 115 } |
| 116 else { | |
| 5353 | 117 PyErr_BadArgument(); |
| 6 | 118 return NULL; |
| 119 } | |
| 120 | |
| 121 if (n == 0) { | |
| 5353 | 122 Py_INCREF(Py_None); |
| 123 return Py_None; | |
| 6 | 124 } |
| 125 if (n > 0) | |
| 126 w = (*getitem)(v, 0); | |
| 127 | |
| 128 width = 0; | |
| 129 if (w == NULL) { | |
| 130 } | |
| 5353 | 131 else if (PyList_Check(w)) { |
| 132 width = PyList_Size(w); | |
| 6 | 133 } |
| 5353 | 134 else if (PyTuple_Check(w)) { |
| 135 width = PyTuple_Size(w); | |
| 6 | 136 } |
| 137 | |
| 138 switch (width) { | |
| 139 case 2: | |
| 140 vec[2] = 0.0; | |
| 141 /* Fall through */ | |
| 142 case 3: | |
| 143 break; | |
| 144 default: | |
| 5353 | 145 PyErr_BadArgument(); |
| 6 | 146 return NULL; |
| 147 } | |
| 148 | |
| 149 for (i = 0; i < n; i++) { | |
| 150 w = (*getitem)(v, i); | |
| 5353 | 151 if (!PyArg_GetDoubleArray(w, 1, 0, width, vec)) |
| 6 | 152 return NULL; |
| 153 v3d(vec); | |
| 154 } | |
| 155 | |
| 5353 | 156 Py_INCREF(Py_None); |
| 157 return Py_None; | |
| 6 | 158 } |
| 159 | |
| 160 /* | |
| 161 vnarray, nvarray -- an array of n3f and v3f calls. | |
| 162 The argument is an array (list or tuple) of pairs of points and normals. | |
| 163 Each pair is a tuple (NOT a list) of a point and a normal for that point. | |
| 164 Each point or normal must be a tuple (NOT a list) of coordinates (x, y, z). | |
| 165 Three coordinates must be given. Float and int values may be mixed. | |
| 166 For each pair, n3f() is called for the normal, and then v3f() is called | |
| 167 for the vector. | |
| 168 | |
| 169 vnarray and nvarray differ only in the order of the vector and normal in | |
| 170 the pair: vnarray expects (v, n) while nvarray expects (n, v). | |
| 171 */ | |
| 172 | |
| 5353 | 173 static PyObject *gen_nvarray(); /* Forward */ |
| 6 | 174 |
| 175 % nvarray | |
| 176 | |
| 5353 | 177 static PyObject * |
| 6 | 178 gl_nvarray(self, args) |
| 5353 | 179 PyObject *self; |
| 180 PyObject *args; | |
| 6 | 181 { |
| 182 return gen_nvarray(args, 0); | |
| 183 } | |
| 184 | |
| 185 % vnarray | |
| 186 | |
| 5353 | 187 static PyObject * |
| 6 | 188 gl_vnarray(self, args) |
| 5353 | 189 PyObject *self; |
| 190 PyObject *args; | |
| 6 | 191 { |
| 192 return gen_nvarray(args, 1); | |
| 193 } | |
| 194 | |
| 195 /* Generic, internal version of {nv,nv}array: inorm indicates the | |
| 196 argument order, 0: normal first, 1: vector first. */ | |
| 197 | |
| 5353 | 198 static PyObject * |
| 6 | 199 gen_nvarray(args, inorm) |
| 5353 | 200 PyObject *args; |
| 6 | 201 int inorm; |
| 202 { | |
| 5353 | 203 PyObject *v, *w, *wnorm, *wvec; |
| 6 | 204 int i, n; |
| 205 float norm[3], vec[3]; | |
|
14060
dc2dedca93f7
Removed references to Py_FPROTO.
Sjoerd Mullender <sjoerd@acm.org>
parents:
13256
diff
changeset
|
206 PyObject * (*getitem)(PyObject *, int); |
| 6 | 207 |
| 5353 | 208 if (!PyArg_GetObject(args, 1, 0, &v)) |
| 6 | 209 return NULL; |
| 210 | |
| 5353 | 211 if (PyList_Check(v)) { |
| 212 n = PyList_Size(v); | |
| 213 getitem = PyList_GetItem; | |
| 6 | 214 } |
| 5353 | 215 else if (PyTuple_Check(v)) { |
| 216 n = PyTuple_Size(v); | |
| 217 getitem = PyTuple_GetItem; | |
| 6 | 218 } |
| 219 else { | |
| 5353 | 220 PyErr_BadArgument(); |
| 6 | 221 return NULL; |
| 222 } | |
| 223 | |
| 224 for (i = 0; i < n; i++) { | |
| 225 w = (*getitem)(v, i); | |
| 5353 | 226 if (!PyTuple_Check(w) || PyTuple_Size(w) != 2) { |
| 227 PyErr_BadArgument(); | |
| 6 | 228 return NULL; |
| 229 } | |
| 5353 | 230 wnorm = PyTuple_GetItem(w, inorm); |
| 231 wvec = PyTuple_GetItem(w, 1 - inorm); | |
| 232 if (!PyArg_GetFloatArray(wnorm, 1, 0, 3, norm) || | |
| 233 !PyArg_GetFloatArray(wvec, 1, 0, 3, vec)) | |
| 6 | 234 return NULL; |
| 235 n3f(norm); | |
| 236 v3f(vec); | |
| 237 } | |
| 238 | |
| 5353 | 239 Py_INCREF(Py_None); |
| 240 return Py_None; | |
| 6 | 241 } |
| 242 | |
| 243 /* nurbssurface(s_knots[], t_knots[], ctl[][], s_order, t_order, type). | |
| 244 The dimensions of ctl[] are computed as follows: | |
| 245 [len(s_knots) - s_order], [len(t_knots) - t_order] | |
| 246 */ | |
| 247 | |
| 248 % nurbssurface | |
| 249 | |
| 5353 | 250 static PyObject * |
| 6 | 251 gl_nurbssurface(self, args) |
| 5353 | 252 PyObject *self; |
| 253 PyObject *args; | |
| 6 | 254 { |
| 255 long arg1 ; | |
| 256 double * arg2 ; | |
| 257 long arg3 ; | |
| 258 double * arg4 ; | |
| 259 double *arg5 ; | |
| 260 long arg6 ; | |
| 261 long arg7 ; | |
| 262 long arg8 ; | |
| 263 long ncoords; | |
| 264 long s_byte_stride, t_byte_stride; | |
| 265 long s_nctl, t_nctl; | |
| 266 long s, t; | |
| 5353 | 267 PyObject *v, *w, *pt; |
| 6 | 268 double *pnext; |
| 5353 | 269 if (!PyArg_GetLongArraySize(args, 6, 0, &arg1)) |
| 6 | 270 return NULL; |
| 5353 | 271 if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) { |
| 272 return PyErr_NoMemory(); | |
| 6 | 273 } |
| 5353 | 274 if (!PyArg_GetDoubleArray(args, 6, 0, arg1 , arg2)) |
| 6 | 275 return NULL; |
| 5353 | 276 if (!PyArg_GetLongArraySize(args, 6, 1, &arg3)) |
| 6 | 277 return NULL; |
| 5353 | 278 if ((arg4 = PyMem_NEW(double, arg3 )) == NULL) { |
| 279 return PyErr_NoMemory(); | |
| 6 | 280 } |
| 5353 | 281 if (!PyArg_GetDoubleArray(args, 6, 1, arg3 , arg4)) |
| 6 | 282 return NULL; |
| 5353 | 283 if (!PyArg_GetLong(args, 6, 3, &arg6)) |
| 6 | 284 return NULL; |
| 5353 | 285 if (!PyArg_GetLong(args, 6, 4, &arg7)) |
| 6 | 286 return NULL; |
| 5353 | 287 if (!PyArg_GetLong(args, 6, 5, &arg8)) |
| 6 | 288 return NULL; |
| 289 if (arg8 == N_XYZ) | |
| 290 ncoords = 3; | |
| 291 else if (arg8 == N_XYZW) | |
| 292 ncoords = 4; | |
| 293 else { | |
| 5353 | 294 PyErr_BadArgument(); |
| 6 | 295 return NULL; |
| 296 } | |
| 297 s_nctl = arg1 - arg6; | |
| 298 t_nctl = arg3 - arg7; | |
| 5353 | 299 if (!PyArg_GetObject(args, 6, 2, &v)) |
| 6 | 300 return NULL; |
| 5353 | 301 if (!PyList_Check(v) || PyList_Size(v) != s_nctl) { |
| 302 PyErr_BadArgument(); | |
| 6 | 303 return NULL; |
| 304 } | |
| 5353 | 305 if ((arg5 = PyMem_NEW(double, s_nctl*t_nctl*ncoords )) == NULL) { |
| 306 return PyErr_NoMemory(); | |
| 6 | 307 } |
| 308 pnext = arg5; | |
| 309 for (s = 0; s < s_nctl; s++) { | |
| 5353 | 310 w = PyList_GetItem(v, s); |
| 311 if (w == NULL || !PyList_Check(w) || | |
| 312 PyList_Size(w) != t_nctl) { | |
| 313 PyErr_BadArgument(); | |
| 6 | 314 return NULL; |
| 315 } | |
| 316 for (t = 0; t < t_nctl; t++) { | |
| 5353 | 317 pt = PyList_GetItem(w, t); |
| 318 if (!PyArg_GetDoubleArray(pt, 1, 0, ncoords, pnext)) | |
| 6 | 319 return NULL; |
| 320 pnext += ncoords; | |
| 321 } | |
| 322 } | |
| 323 s_byte_stride = sizeof(double) * ncoords; | |
| 324 t_byte_stride = s_byte_stride * s_nctl; | |
| 325 nurbssurface( arg1 , arg2 , arg3 , arg4 , | |
| 326 s_byte_stride , t_byte_stride , arg5 , arg6 , arg7 , arg8 ); | |
| 5353 | 327 PyMem_DEL(arg2); |
| 328 PyMem_DEL(arg4); | |
| 329 PyMem_DEL(arg5); | |
| 330 Py_INCREF(Py_None); | |
| 331 return Py_None; | |
| 6 | 332 } |
| 333 | |
| 334 /* nurbscurve(knots, ctlpoints, order, type). | |
| 335 The length of ctlpoints is len(knots)-order. */ | |
| 336 | |
| 337 %nurbscurve | |
| 338 | |
| 5353 | 339 static PyObject * |
| 6 | 340 gl_nurbscurve(self, args) |
| 5353 | 341 PyObject *self; |
| 342 PyObject *args; | |
| 6 | 343 { |
| 344 long arg1 ; | |
| 345 double * arg2 ; | |
| 346 long arg3 ; | |
| 347 double * arg4 ; | |
| 348 long arg5 ; | |
| 349 long arg6 ; | |
| 350 int ncoords, npoints; | |
| 351 int i; | |
| 5353 | 352 PyObject *v; |
| 6 | 353 double *pnext; |
| 5353 | 354 if (!PyArg_GetLongArraySize(args, 4, 0, &arg1)) |
| 6 | 355 return NULL; |
| 5353 | 356 if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) { |
| 357 return PyErr_NoMemory(); | |
| 6 | 358 } |
| 5353 | 359 if (!PyArg_GetDoubleArray(args, 4, 0, arg1 , arg2)) |
| 6 | 360 return NULL; |
| 5353 | 361 if (!PyArg_GetLong(args, 4, 2, &arg5)) |
| 6 | 362 return NULL; |
| 5353 | 363 if (!PyArg_GetLong(args, 4, 3, &arg6)) |
| 6 | 364 return NULL; |
| 365 if (arg6 == N_ST) | |
| 366 ncoords = 2; | |
| 367 else if (arg6 == N_STW) | |
| 368 ncoords = 3; | |
| 369 else { | |
| 5353 | 370 PyErr_BadArgument(); |
| 6 | 371 return NULL; |
| 372 } | |
| 373 npoints = arg1 - arg5; | |
| 5353 | 374 if (!PyArg_GetObject(args, 4, 1, &v)) |
| 6 | 375 return NULL; |
| 5353 | 376 if (!PyList_Check(v) || PyList_Size(v) != npoints) { |
| 377 PyErr_BadArgument(); | |
| 6 | 378 return NULL; |
| 379 } | |
| 5353 | 380 if ((arg4 = PyMem_NEW(double, npoints*ncoords )) == NULL) { |
| 381 return PyErr_NoMemory(); | |
| 6 | 382 } |
| 383 pnext = arg4; | |
| 384 for (i = 0; i < npoints; i++) { | |
| 5353 | 385 if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext)) |
| 6 | 386 return NULL; |
| 387 pnext += ncoords; | |
| 388 } | |
| 389 arg3 = (sizeof(double)) * ncoords; | |
| 390 nurbscurve( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); | |
| 5353 | 391 PyMem_DEL(arg2); |
| 392 PyMem_DEL(arg4); | |
| 393 Py_INCREF(Py_None); | |
| 394 return Py_None; | |
| 6 | 395 } |
| 396 | |
| 397 /* pwlcurve(points, type). | |
| 398 Points is a list of points. Type must be N_ST. */ | |
| 399 | |
| 400 %pwlcurve | |
| 401 | |
| 5353 | 402 static PyObject * |
| 6 | 403 gl_pwlcurve(self, args) |
| 5353 | 404 PyObject *self; |
| 405 PyObject *args; | |
| 6 | 406 { |
| 5353 | 407 PyObject *v; |
| 6 | 408 long type; |
| 409 double *data, *pnext; | |
| 410 long npoints, ncoords; | |
| 411 int i; | |
| 5353 | 412 if (!PyArg_GetObject(args, 2, 0, &v)) |
| 6 | 413 return NULL; |
| 5353 | 414 if (!PyArg_GetLong(args, 2, 1, &type)) |
| 6 | 415 return NULL; |
| 5353 | 416 if (!PyList_Check(v)) { |
| 417 PyErr_BadArgument(); | |
| 6 | 418 return NULL; |
| 419 } | |
| 5353 | 420 npoints = PyList_Size(v); |
| 6 | 421 if (type == N_ST) |
| 422 ncoords = 2; | |
| 423 else { | |
| 5353 | 424 PyErr_BadArgument(); |
| 6 | 425 return NULL; |
| 426 } | |
| 5353 | 427 if ((data = PyMem_NEW(double, npoints*ncoords)) == NULL) { |
| 428 return PyErr_NoMemory(); | |
| 6 | 429 } |
| 430 pnext = data; | |
| 431 for (i = 0; i < npoints; i++) { | |
| 5353 | 432 if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext)) |
| 6 | 433 return NULL; |
| 434 pnext += ncoords; | |
| 435 } | |
| 436 pwlcurve(npoints, data, sizeof(double)*ncoords, type); | |
| 5353 | 437 PyMem_DEL(data); |
| 438 Py_INCREF(Py_None); | |
| 439 return Py_None; | |
| 6 | 440 } |
| 441 | |
| 442 | |
| 443 /* Picking and Selecting */ | |
| 444 | |
| 445 static short *pickbuffer = NULL; | |
| 446 static long pickbuffersize; | |
| 447 | |
| 5353 | 448 static PyObject * |
| 6 | 449 pick_select(args, func) |
| 5353 | 450 PyObject *args; |
| 6 | 451 void (*func)(); |
| 452 { | |
| 5353 | 453 if (!PyArg_GetLong(args, 1, 0, &pickbuffersize)) |
| 6 | 454 return NULL; |
| 455 if (pickbuffer != NULL) { | |
| 5353 | 456 PyErr_SetString(PyExc_RuntimeError, |
| 6 | 457 "pick/gselect: already picking/selecting"); |
| 458 return NULL; | |
| 459 } | |
| 5353 | 460 if ((pickbuffer = PyMem_NEW(short, pickbuffersize)) == NULL) { |
| 461 return PyErr_NoMemory(); | |
| 6 | 462 } |
| 463 (*func)(pickbuffer, pickbuffersize); | |
| 5353 | 464 Py_INCREF(Py_None); |
| 465 return Py_None; | |
| 6 | 466 } |
| 467 | |
| 5353 | 468 static PyObject * |
| 6 | 469 endpick_select(args, func) |
| 5353 | 470 PyObject *args; |
| 6 | 471 long (*func)(); |
| 472 { | |
| 5353 | 473 PyObject *v, *w; |
| 6 | 474 int i, nhits, n; |
| 5353 | 475 if (!PyArg_NoArgs(args)) |
| 6 | 476 return NULL; |
| 477 if (pickbuffer == NULL) { | |
| 5353 | 478 PyErr_SetString(PyExc_RuntimeError, |
| 6 | 479 "endpick/endselect: not in pick/select mode"); |
| 480 return NULL; | |
| 481 } | |
| 482 nhits = (*func)(pickbuffer); | |
| 483 if (nhits < 0) { | |
| 484 nhits = -nhits; /* How to report buffer overflow otherwise? */ | |
| 485 } | |
| 486 /* Scan the buffer to see how many integers */ | |
| 487 n = 0; | |
| 488 for (; nhits > 0; nhits--) { | |
| 489 n += 1 + pickbuffer[n]; | |
| 490 } | |
| 5353 | 491 v = PyList_New(n); |
| 6 | 492 if (v == NULL) |
| 493 return NULL; | |
| 494 /* XXX Could do it nicer and interpret the data structure here, | |
| 495 returning a list of lists. But this can be done in Python... */ | |
| 496 for (i = 0; i < n; i++) { | |
| 5353 | 497 w = PyInt_FromLong((long)pickbuffer[i]); |
| 6 | 498 if (w == NULL) { |
| 5353 | 499 Py_DECREF(v); |
| 6 | 500 return NULL; |
| 501 } | |
| 5353 | 502 PyList_SetItem(v, i, w); |
| 6 | 503 } |
| 5353 | 504 PyMem_DEL(pickbuffer); |
| 6 | 505 pickbuffer = NULL; |
| 506 return v; | |
| 507 } | |
| 508 | |
| 509 extern void pick(), gselect(); | |
| 510 extern long endpick(), endselect(); | |
| 511 | |
| 512 %pick | |
| 5353 | 513 static PyObject *gl_pick(self, args) PyObject *self, *args; { |
| 6 | 514 return pick_select(args, pick); |
| 515 } | |
| 516 | |
| 517 %endpick | |
| 5353 | 518 static PyObject *gl_endpick(self, args) PyObject *self, *args; { |
| 6 | 519 return endpick_select(args, endpick); |
| 520 } | |
| 521 | |
| 522 %gselect | |
| 5353 | 523 static PyObject *gl_gselect(self, args) PyObject *self, *args; { |
| 6 | 524 return pick_select(args, gselect); |
| 525 } | |
| 526 | |
| 527 %endselect | |
| 5353 | 528 static PyObject *gl_endselect(self, args) PyObject *self, *args; { |
| 6 | 529 return endpick_select(args, endselect); |
| 530 } | |
| 531 | |
| 532 | |
| 533 /* XXX The generator botches this one. Here's a quick hack to fix it. */ | |
| 534 | |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
535 /* XXX The generator botches this one. Here's a quick hack to fix it. */ |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
536 |
| 6 | 537 % getmatrix float r[16] |
| 538 | |
| 5353 | 539 static PyObject * |
| 6 | 540 gl_getmatrix(self, args) |
| 5353 | 541 PyObject *self; |
| 542 PyObject *args; | |
| 6 | 543 { |
|
1356
043da19302ef
Several optimizations and speed improvements.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1232
diff
changeset
|
544 Matrix arg1; |
| 5353 | 545 PyObject *v, *w; |
|
1356
043da19302ef
Several optimizations and speed improvements.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1232
diff
changeset
|
546 int i, j; |
| 6 | 547 getmatrix( arg1 ); |
| 5353 | 548 v = PyList_New(16); |
| 6 | 549 if (v == NULL) { |
| 5353 | 550 return PyErr_NoMemory(); |
| 6 | 551 } |
|
1356
043da19302ef
Several optimizations and speed improvements.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1232
diff
changeset
|
552 for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) { |
|
043da19302ef
Several optimizations and speed improvements.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1232
diff
changeset
|
553 w = mknewfloatobject(arg1[i][j]); |
| 6 | 554 if (w == NULL) { |
| 5353 | 555 Py_DECREF(v); |
| 6 | 556 return NULL; |
| 557 } | |
| 5353 | 558 PyList_SetItem(v, i*4+j, w); |
| 6 | 559 } |
| 560 return v; | |
| 561 } | |
| 562 | |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
563 /* Here's an alternate version that returns a 4x4 matrix instead of |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
564 a vector. Unfortunately it is incompatible with loadmatrix and |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
565 multmatrix... */ |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
566 |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
567 % altgetmatrix float r[4][4] |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
568 |
| 5353 | 569 static PyObject * |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
570 gl_altgetmatrix(self, args) |
| 5353 | 571 PyObject *self; |
| 572 PyObject *args; | |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
573 { |
|
1356
043da19302ef
Several optimizations and speed improvements.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1232
diff
changeset
|
574 Matrix arg1; |
| 5353 | 575 PyObject *v, *w; |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
576 int i, j; |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
577 getmatrix( arg1 ); |
| 5353 | 578 v = PyList_New(4); |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
579 if (v == NULL) { |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
580 return NULL; |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
581 } |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
582 for (i = 0; i < 4; i++) { |
| 5353 | 583 w = PyList_New(4); |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
584 if (w == NULL) { |
| 5353 | 585 Py_DECREF(v); |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
586 return NULL; |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
587 } |
| 5353 | 588 PyList_SetItem(v, i, w); |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
589 } |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
590 for (i = 0; i < 4; i++) { |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
591 for (j = 0; j < 4; j++) { |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
592 w = mknewfloatobject(arg1[i][j]); |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
593 if (w == NULL) { |
| 5353 | 594 Py_DECREF(v); |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
595 return NULL; |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
596 } |
| 5353 | 597 PyList_SetItem(PyList_GetItem(v, i), j, w); |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
598 } |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
599 } |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
600 return v; |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
601 } |
|
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
602 |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
603 % lrectwrite |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
604 |
| 5353 | 605 static PyObject * |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
606 gl_lrectwrite(self, args) |
| 5353 | 607 PyObject *self; |
| 608 PyObject *args; | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
609 { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
610 short x1 ; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
611 short y1 ; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
612 short x2 ; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
613 short y2 ; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
614 string parray ; |
| 5353 | 615 PyObject *s; |
|
4626
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
616 #if 0 |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
617 int pixcount; |
|
4626
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
618 #endif |
| 5353 | 619 if (!PyArg_GetShort(args, 5, 0, &x1)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
620 return NULL; |
| 5353 | 621 if (!PyArg_GetShort(args, 5, 1, &y1)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
622 return NULL; |
| 5353 | 623 if (!PyArg_GetShort(args, 5, 2, &x2)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
624 return NULL; |
| 5353 | 625 if (!PyArg_GetShort(args, 5, 3, &y2)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
626 return NULL; |
| 5353 | 627 if (!PyArg_GetString(args, 5, 4, &parray)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
628 return NULL; |
| 5353 | 629 if (!PyArg_GetObject(args, 5, 4, &s)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
630 return NULL; |
|
434
487b7c62ae77
Improved RGB --> grayscale conversion.
Guido van Rossum <guido@python.org>
parents:
389
diff
changeset
|
631 #if 0 |
|
487b7c62ae77
Improved RGB --> grayscale conversion.
Guido van Rossum <guido@python.org>
parents:
389
diff
changeset
|
632 /* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */ |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
633 pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); |
| 5353 | 634 if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) { |
| 635 PyErr_SetString(PyExc_RuntimeError, | |
|
434
487b7c62ae77
Improved RGB --> grayscale conversion.
Guido van Rossum <guido@python.org>
parents:
389
diff
changeset
|
636 "string arg to lrectwrite has wrong size"); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
637 return NULL; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
638 } |
|
434
487b7c62ae77
Improved RGB --> grayscale conversion.
Guido van Rossum <guido@python.org>
parents:
389
diff
changeset
|
639 #endif |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
640 lrectwrite( x1 , y1 , x2 , y2 , (unsigned long *) parray ); |
| 5353 | 641 Py_INCREF(Py_None); |
| 642 return Py_None; | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
643 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
644 |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
645 % lrectread |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
646 |
| 5353 | 647 static PyObject * |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
648 gl_lrectread(self, args) |
| 5353 | 649 PyObject *self; |
| 650 PyObject *args; | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
651 { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
652 short x1 ; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
653 short y1 ; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
654 short x2 ; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
655 short y2 ; |
| 5353 | 656 PyObject *parray; |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
657 int pixcount; |
| 5353 | 658 if (!PyArg_GetShort(args, 4, 0, &x1)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
659 return NULL; |
| 5353 | 660 if (!PyArg_GetShort(args, 4, 1, &y1)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
661 return NULL; |
| 5353 | 662 if (!PyArg_GetShort(args, 4, 2, &x2)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
663 return NULL; |
| 5353 | 664 if (!PyArg_GetShort(args, 4, 3, &y2)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
665 return NULL; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
666 pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); |
| 5353 | 667 parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
668 if (parray == NULL) |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
669 return NULL; /* No memory */ |
| 5353 | 670 lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray)); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
671 return parray; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
672 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
673 |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
674 % readdisplay |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
675 |
| 5353 | 676 static PyObject * |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
677 gl_readdisplay(self, args) |
| 5353 | 678 PyObject *self; |
| 679 PyObject *args; | |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
680 { |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
681 short x1, y1, x2, y2; |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
682 unsigned long *parray, hints; |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
683 long size, size_ret; |
| 5353 | 684 PyObject *rv; |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
685 |
| 5353 | 686 if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) ) |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
687 return 0; |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
688 size = (long)(x2+1-x1) * (long)(y2+1-y1); |
| 5353 | 689 rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long)); |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
690 if ( rv == NULL ) |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
691 return NULL; |
| 5353 | 692 parray = (unsigned long *)PyString_AsString(rv); |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
693 size_ret = readdisplay(x1, y1, x2, y2, parray, hints); |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
694 if ( size_ret != size ) { |
|
4626
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
695 printf("gl_readdisplay: got %ld pixels, expected %ld\n", |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
696 size_ret, size); |
| 5353 | 697 PyErr_SetString(PyExc_RuntimeError, "readdisplay returned unexpected length"); |
|
1218
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
698 return NULL; |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
699 } |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
700 return rv; |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
701 } |
|
51223ce95a61
Added readdisplay() routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
1039
diff
changeset
|
702 |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
703 /* Desperately needed, here are tools to compress and decompress |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
704 the data manipulated by lrectread/lrectwrite. |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
705 |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
706 gl.packrect(width, height, packfactor, bigdata) --> smalldata |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
707 makes 'bigdata' 4*(packfactor**2) times smaller by: |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
708 - turning it into B/W (a factor 4) |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
709 - replacing squares of size pacfactor by one |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
710 representative |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
711 |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
712 gl.unpackrect(width, height, packfactor, smalldata) --> bigdata |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
713 is the inverse; the numeric arguments must be *the same*. |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
714 |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
715 Both work best if width and height are multiples of packfactor |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
716 (in fact unpackrect will leave garbage bytes). |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
717 */ |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
718 |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
719 % packrect |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
720 |
| 5353 | 721 static PyObject * |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
722 gl_packrect(self, args) |
| 5353 | 723 PyObject *self; |
| 724 PyObject *args; | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
725 { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
726 long width, height, packfactor; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
727 char *s; |
| 5353 | 728 PyObject *unpacked, *packed; |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
729 int pixcount, packedcount, x, y, r, g, b; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
730 unsigned long pixel; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
731 unsigned char *p; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
732 unsigned long *parray; |
| 5353 | 733 if (!PyArg_GetLong(args, 4, 0, &width)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
734 return NULL; |
| 5353 | 735 if (!PyArg_GetLong(args, 4, 1, &height)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
736 return NULL; |
| 5353 | 737 if (!PyArg_GetLong(args, 4, 2, &packfactor)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
738 return NULL; |
| 5353 | 739 if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */ |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
740 return NULL; |
| 5353 | 741 if (!PyArg_GetObject(args, 4, 3, &unpacked)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
742 return NULL; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
743 if (width <= 0 || height <= 0 || packfactor <= 0) { |
| 5353 | 744 PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0"); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
745 return NULL; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
746 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
747 pixcount = width*height; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
748 packedcount = ((width+packfactor-1)/packfactor) * |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
749 ((height+packfactor-1)/packfactor); |
| 5353 | 750 if (PyString_Size(unpacked) != pixcount*sizeof(long)) { |
| 751 PyErr_SetString(PyExc_RuntimeError, | |
|
434
487b7c62ae77
Improved RGB --> grayscale conversion.
Guido van Rossum <guido@python.org>
parents:
389
diff
changeset
|
752 "string arg to packrect has wrong size"); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
753 return NULL; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
754 } |
| 5353 | 755 packed = PyString_FromStringAndSize((char *)NULL, packedcount); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
756 if (packed == NULL) |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
757 return NULL; |
| 5353 | 758 parray = (unsigned long *) PyString_AsString(unpacked); |
| 759 p = (unsigned char *) PyString_AsString(packed); | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
760 for (y = 0; y < height; y += packfactor, parray += packfactor*width) { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
761 for (x = 0; x < width; x += packfactor) { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
762 pixel = parray[x]; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
763 r = pixel & 0xff; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
764 g = (pixel >> 8) & 0xff; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
765 b = (pixel >> 16) & 0xff; |
|
434
487b7c62ae77
Improved RGB --> grayscale conversion.
Guido van Rossum <guido@python.org>
parents:
389
diff
changeset
|
766 *p++ = (30*r+59*g+11*b) / 100; |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
767 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
768 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
769 return packed; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
770 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
771 |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
772 % unpackrect |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
773 |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
774 static unsigned long unpacktab[256]; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
775 static int unpacktab_inited = 0; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
776 |
| 5353 | 777 static PyObject * |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
778 gl_unpackrect(self, args) |
| 5353 | 779 PyObject *self; |
| 780 PyObject *args; | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
781 { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
782 long width, height, packfactor; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
783 char *s; |
| 5353 | 784 PyObject *unpacked, *packed; |
|
4626
94ce3e01c30c
Changes to keep gcc -Wall happy.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
785 int pixcount, packedcount; |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
786 register unsigned char *p; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
787 register unsigned long *parray; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
788 if (!unpacktab_inited) { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
789 register int white; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
790 for (white = 256; --white >= 0; ) |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
791 unpacktab[white] = white * 0x010101L; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
792 unpacktab_inited++; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
793 } |
| 5353 | 794 if (!PyArg_GetLong(args, 4, 0, &width)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
795 return NULL; |
| 5353 | 796 if (!PyArg_GetLong(args, 4, 1, &height)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
797 return NULL; |
| 5353 | 798 if (!PyArg_GetLong(args, 4, 2, &packfactor)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
799 return NULL; |
| 5353 | 800 if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */ |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
801 return NULL; |
| 5353 | 802 if (!PyArg_GetObject(args, 4, 3, &packed)) |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
803 return NULL; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
804 if (width <= 0 || height <= 0 || packfactor <= 0) { |
| 5353 | 805 PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0"); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
806 return NULL; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
807 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
808 pixcount = width*height; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
809 packedcount = ((width+packfactor-1)/packfactor) * |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
810 ((height+packfactor-1)/packfactor); |
| 5353 | 811 if (PyString_Size(packed) != packedcount) { |
| 812 PyErr_SetString(PyExc_RuntimeError, | |
|
434
487b7c62ae77
Improved RGB --> grayscale conversion.
Guido van Rossum <guido@python.org>
parents:
389
diff
changeset
|
813 "string arg to unpackrect has wrong size"); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
814 return NULL; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
815 } |
| 5353 | 816 unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
817 if (unpacked == NULL) |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
818 return NULL; |
| 5353 | 819 parray = (unsigned long *) PyString_AsString(unpacked); |
| 820 p = (unsigned char *) PyString_AsString(packed); | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
821 if (packfactor == 1 && width*height > 0) { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
822 /* Just expand bytes to longs */ |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
823 register int x = width * height; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
824 do { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
825 *parray++ = unpacktab[*p++]; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
826 } while (--x >= 0); |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
827 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
828 else { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
829 register int y; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
830 for (y = 0; y < height-packfactor+1; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
831 y += packfactor, parray += packfactor*width) { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
832 register int x; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
833 for (x = 0; x < width-packfactor+1; x += packfactor) { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
834 register unsigned long pixel = unpacktab[*p++]; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
835 register int i; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
836 for (i = packfactor*width; (i-=width) >= 0;) { |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
837 register int j; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
838 for (j = packfactor; --j >= 0; ) |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
839 parray[i+x+j] = pixel; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
840 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
841 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
842 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
843 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
844 return unpacked; |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
845 } |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
846 |
|
1039
6aa0ee14ac2e
Made struct a standard built-in module; added string args to {set,get}sockopt;
Guido van Rossum <guido@python.org>
parents:
948
diff
changeset
|
847 % gversion |
| 5353 | 848 static PyObject * |
|
1039
6aa0ee14ac2e
Made struct a standard built-in module; added string args to {set,get}sockopt;
Guido van Rossum <guido@python.org>
parents:
948
diff
changeset
|
849 gl_gversion(self, args) |
| 5353 | 850 PyObject *self; |
| 851 PyObject *args; | |
|
1039
6aa0ee14ac2e
Made struct a standard built-in module; added string args to {set,get}sockopt;
Guido van Rossum <guido@python.org>
parents:
948
diff
changeset
|
852 { |
|
6aa0ee14ac2e
Made struct a standard built-in module; added string args to {set,get}sockopt;
Guido van Rossum <guido@python.org>
parents:
948
diff
changeset
|
853 char buf[20]; |
|
6aa0ee14ac2e
Made struct a standard built-in module; added string args to {set,get}sockopt;
Guido van Rossum <guido@python.org>
parents:
948
diff
changeset
|
854 gversion(buf); |
| 5353 | 855 return PyString_FromString(buf); |
|
1039
6aa0ee14ac2e
Made struct a standard built-in module; added string args to {set,get}sockopt;
Guido van Rossum <guido@python.org>
parents:
948
diff
changeset
|
856 } |
|
6aa0ee14ac2e
Made struct a standard built-in module; added string args to {set,get}sockopt;
Guido van Rossum <guido@python.org>
parents:
948
diff
changeset
|
857 |
|
6aa0ee14ac2e
Made struct a standard built-in module; added string args to {set,get}sockopt;
Guido van Rossum <guido@python.org>
parents:
948
diff
changeset
|
858 |
|
8183
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
859 /* void clear - Manual because of clash with termcap */ |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
860 %clear |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
861 static PyObject * |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
862 gl_clear(self, args) |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
863 PyObject *self; |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
864 PyObject *args; |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
865 { |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
866 __GLclear( ); |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
867 Py_INCREF(Py_None); |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
868 return Py_None; |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
869 } |
|
6f1db534dfae
Generate the clear() method manually (calling __GLclear(), another
Guido van Rossum <guido@python.org>
parents:
5353
diff
changeset
|
870 |
| 6 | 871 /* End of manually written stubs */ |
| 872 | |
| 873 %% | |
| 874 | |
| 875 long getshade | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
876 if !solaris void devport short s long s |
| 6 | 877 void rdr2i long s long s |
| 878 void rectfs short s short s short s short s | |
| 879 void rects short s short s short s short s | |
| 880 void rmv2i long s long s | |
| 881 void noport | |
| 882 void popviewport | |
| 883 void clearhitcode | |
| 884 void closeobj | |
| 885 void cursoff | |
| 886 void curson | |
| 887 void doublebuffer | |
| 888 void finish | |
| 889 void gconfig | |
| 890 void ginit | |
| 891 void greset | |
| 892 void multimap | |
| 893 void onemap | |
| 894 void popattributes | |
| 895 void popmatrix | |
| 896 void pushattributes | |
| 897 void pushmatrix | |
| 898 void pushviewport | |
| 899 void qreset | |
| 900 void RGBmode | |
| 901 void singlebuffer | |
| 902 void swapbuffers | |
| 903 void gsync | |
| 677 | 904 void gflush |
| 6 | 905 void tpon |
| 906 void tpoff | |
| 907 void clkon | |
| 908 void clkoff | |
| 909 void ringbell | |
| 910 #void callfunc | |
| 911 void gbegin | |
| 912 void textinit | |
| 913 void initnames | |
| 914 void pclos | |
| 915 void popname | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
916 if !solaris void spclos |
| 6 | 917 void zclear |
| 918 void screenspace | |
| 919 void reshapeviewport | |
| 920 void winpush | |
| 921 void winpop | |
| 922 void foreground | |
| 923 void endfullscrn | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
924 if !solaris void endpupmode |
| 6 | 925 void fullscrn |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
926 if !solaris void pupmode |
| 6 | 927 void winconstraints |
| 928 void pagecolor short s | |
| 929 void textcolor short s | |
| 930 void color short s | |
| 931 void curveit short s | |
| 932 void font short s | |
| 933 void linewidth short s | |
| 934 void setlinestyle short s | |
| 935 void setmap short s | |
| 936 void swapinterval short s | |
| 937 void writemask short s | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
938 if !solaris void textwritemask short s |
| 6 | 939 void qdevice short s |
| 940 void unqdevice short s | |
| 941 void curvebasis short s | |
| 942 void curveprecision short s | |
| 943 void loadname short s | |
| 944 void passthrough short s | |
| 945 void pushname short s | |
| 946 void setmonitor short s | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
947 if !solaris void setshade short s |
| 6 | 948 void setpattern short s |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
949 if !solaris void pagewritemask short s |
| 6 | 950 # |
| 951 void callobj long s | |
| 952 void delobj long s | |
| 953 void editobj long s | |
| 954 void makeobj long s | |
| 955 void maketag long s | |
| 956 void chunksize long s | |
| 957 void compactify long s | |
| 958 void deltag long s | |
| 959 void lsrepeat long s | |
| 960 void objinsert long s | |
| 961 void objreplace long s | |
| 962 void winclose long s | |
| 963 void blanktime long s | |
| 964 void freepup long s | |
| 965 # This is not in the library!? | |
| 966 ###void pupcolor long s | |
| 967 # | |
| 968 void backbuffer long s | |
| 969 void frontbuffer long s | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
970 if !solaris void lsbackup long s |
| 6 | 971 void resetls long s |
| 972 void lampon long s | |
| 973 void lampoff long s | |
| 974 void setbell long s | |
| 975 void blankscreen long s | |
| 976 void depthcue long s | |
| 977 void zbuffer long s | |
| 978 void backface long s | |
| 979 # | |
| 980 void cmov2i long s long s | |
| 981 void draw2i long s long s | |
| 982 void move2i long s long s | |
| 983 void pnt2i long s long s | |
| 984 void patchbasis long s long s | |
| 985 void patchprecision long s long s | |
| 986 void pdr2i long s long s | |
| 987 void pmv2i long s long s | |
| 988 void rpdr2i long s long s | |
| 989 void rpmv2i long s long s | |
| 990 void xfpt2i long s long s | |
| 991 void objdelete long s long s | |
| 992 void patchcurves long s long s | |
| 993 void minsize long s long s | |
| 994 void maxsize long s long s | |
| 995 void keepaspect long s long s | |
| 996 void prefsize long s long s | |
| 997 void stepunit long s long s | |
| 998 void fudge long s long s | |
| 999 void winmove long s long s | |
| 1000 # | |
| 1001 void attachcursor short s short s | |
| 1002 void deflinestyle short s short s | |
| 1003 void noise short s short s | |
| 1004 void picksize short s short s | |
| 1005 void qenter short s short s | |
| 1006 void setdepth short s short s | |
| 1007 void cmov2s short s short s | |
| 1008 void draw2s short s short s | |
| 1009 void move2s short s short s | |
| 1010 void pdr2s short s short s | |
| 1011 void pmv2s short s short s | |
| 1012 void pnt2s short s short s | |
| 1013 void rdr2s short s short s | |
| 1014 void rmv2s short s short s | |
| 1015 void rpdr2s short s short s | |
| 1016 void rpmv2s short s short s | |
| 1017 void xfpt2s short s short s | |
| 1018 # | |
| 1019 void cmov2 float s float s | |
| 1020 void draw2 float s float s | |
| 1021 void move2 float s float s | |
| 1022 void pnt2 float s float s | |
| 1023 void pdr2 float s float s | |
| 1024 void pmv2 float s float s | |
| 1025 void rdr2 float s float s | |
| 1026 void rmv2 float s float s | |
| 1027 void rpdr2 float s float s | |
| 1028 void rpmv2 float s float s | |
| 1029 void xfpt2 float s float s | |
| 1030 # | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1031 void loadmatrix float s[4*4] |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
1032 # Really [4][4] |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1033 void multmatrix float s[4*4] |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
1034 # Really [4][4] |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1035 void crv float s[3*4] |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
1036 # Really [4][3] |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1037 void rcrv float s[4*4] |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
1038 # Really [4][4] |
| 6 | 1039 # |
| 1040 # Methods that have strings. | |
| 1041 # | |
| 1042 void addtopup long s char *s long s | |
| 1043 void charstr char *s | |
| 1044 void getport char *s | |
| 1045 long strwidth char *s | |
| 1046 long winopen char *s | |
| 1047 void wintitle char *s | |
| 1048 # | |
| 1049 # Methods that have 1 long (# of elements) and an array | |
| 1050 # | |
| 1051 void polf long s float s[3*arg1] | |
| 1052 void polf2 long s float s[2*arg1] | |
| 1053 void poly long s float s[3*arg1] | |
| 1054 void poly2 long s float s[2*arg1] | |
| 1055 void crvn long s float s[3*arg1] | |
| 1056 void rcrvn long s float s[4*arg1] | |
| 1057 # | |
| 1058 void polf2i long s long s[2*arg1] | |
| 1059 void polfi long s long s[3*arg1] | |
| 1060 void poly2i long s long s[2*arg1] | |
| 1061 void polyi long s long s[3*arg1] | |
| 1062 # | |
| 1063 void polf2s long s short s[2*arg1] | |
| 1064 void polfs long s short s[3*arg1] | |
| 1065 void polys long s short s[3*arg1] | |
| 1066 void poly2s long s short s[2*arg1] | |
| 1067 # | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1068 void defcursor short s u_short s[128] |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
1069 # Is this useful? |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1070 void writepixels short s u_short s[arg1] |
|
338
794cfd455dc6
Changed some interfaces after error reports from Liberte.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
1071 # Should be unsigned short... |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1072 void defbasis long s float s[4*4] |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1073 if !solaris void gewrite short s short s[arg1] |
| 6 | 1074 # |
| 1075 void rotate short s char s | |
| 1076 # This is not in the library!? | |
| 1077 ###void setbutton short s char s | |
| 1078 void rot float s char s | |
| 1079 # | |
| 1080 void circfi long s long s long s | |
| 1081 void circi long s long s long s | |
| 1082 void cmovi long s long s long s | |
| 1083 void drawi long s long s long s | |
| 1084 void movei long s long s long s | |
| 1085 void pnti long s long s long s | |
| 1086 void newtag long s long s long s | |
| 1087 void pdri long s long s long s | |
| 1088 void pmvi long s long s long s | |
| 1089 void rdri long s long s long s | |
| 1090 void rmvi long s long s long s | |
| 1091 void rpdri long s long s long s | |
| 1092 void rpmvi long s long s long s | |
| 1093 void xfpti long s long s long s | |
| 1094 # | |
| 1095 void circ float s float s float s | |
| 1096 void circf float s float s float s | |
| 1097 void cmov float s float s float s | |
| 1098 void draw float s float s float s | |
| 1099 void move float s float s float s | |
| 1100 void pnt float s float s float s | |
| 1101 void scale float s float s float s | |
| 1102 void translate float s float s float s | |
| 1103 void pdr float s float s float s | |
| 1104 void pmv float s float s float s | |
| 1105 void rdr float s float s float s | |
| 1106 void rmv float s float s float s | |
| 1107 void rpdr float s float s float s | |
| 1108 void rpmv float s float s float s | |
| 1109 void xfpt float s float s float s | |
| 1110 # | |
| 1111 void RGBcolor short s short s short s | |
| 1112 void RGBwritemask short s short s short s | |
| 1113 void setcursor short s short s short s | |
| 1114 void tie short s short s short s | |
| 1115 void circfs short s short s short s | |
| 1116 void circs short s short s short s | |
| 1117 void cmovs short s short s short s | |
| 1118 void draws short s short s short s | |
| 1119 void moves short s short s short s | |
| 1120 void pdrs short s short s short s | |
| 1121 void pmvs short s short s short s | |
| 1122 void pnts short s short s short s | |
| 1123 void rdrs short s short s short s | |
| 1124 void rmvs short s short s short s | |
| 1125 void rpdrs short s short s short s | |
| 1126 void rpmvs short s short s short s | |
| 1127 void xfpts short s short s short s | |
| 1128 void curorigin short s short s short s | |
| 1129 void cyclemap short s short s short s | |
| 1130 # | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1131 void patch float s[4*4] float s[4*4] float s[4*4] |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1132 void splf long s float s[3*arg1] u_short s[arg1] |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1133 void splf2 long s float s[2*arg1] u_short s[arg1] |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1134 void splfi long s long s[3*arg1] u_short s[arg1] |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1135 void splf2i long s long s[2*arg1] u_short s[arg1] |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1136 void splfs long s short s[3*arg1] u_short s[arg1] |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1137 void splf2s long s short s[2*arg1] u_short s[arg1] |
|
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1138 ###void defpattern short s short s u_short s[arg2*arg2/16] |
| 6 | 1139 # |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1140 void rpatch float s[4*4] float s[4*4] float s[4*4] float s[4*4] |
| 6 | 1141 # |
| 1142 # routines that send 4 floats | |
| 1143 # | |
| 1144 void ortho2 float s float s float s float s | |
| 1145 void rect float s float s float s float s | |
| 1146 void rectf float s float s float s float s | |
| 1147 void xfpt4 float s float s float s float s | |
| 1148 # | |
| 1149 void textport short s short s short s short s | |
| 1150 void mapcolor short s short s short s short s | |
| 1151 void scrmask short s short s short s short s | |
| 1152 void setvaluator short s short s short s short s | |
| 1153 void viewport short s short s short s short s | |
| 1154 void shaderange short s short s short s short s | |
| 1155 void xfpt4s short s short s short s short s | |
| 1156 void rectfi long s long s long s long s | |
| 1157 void recti long s long s long s long s | |
| 1158 void xfpt4i long s long s long s long s | |
| 1159 void prefposition long s long s long s long s | |
| 1160 # | |
| 1161 void arc float s float s float s short s short s | |
| 1162 void arcf float s float s float s short s short s | |
| 1163 void arcfi long s long s long s short s short s | |
| 1164 void arci long s long s long s short s short s | |
| 1165 # | |
| 1166 void bbox2 short s short s float s float s float s float s | |
| 1167 void bbox2i short s short s long s long s long s long s | |
| 1168 void bbox2s short s short s short s short s short s short s | |
| 1169 void blink short s short s short s short s short s | |
| 1170 void ortho float s float s float s float s float s float s | |
| 1171 void window float s float s float s float s float s float s | |
| 1172 void lookat float s float s float s float s float s float s short s | |
| 1173 # | |
| 1174 void perspective short s float s float s float s | |
| 1175 void polarview float s short s short s short s | |
| 1176 # XXX getichararray not supported | |
| 1177 #void writeRGB short s char s[arg1] char s[arg1] char s[arg1] | |
| 1178 # | |
| 1179 void arcfs short s short s short s short s short s | |
| 1180 void arcs short s short s short s short s short s | |
| 1181 void rectcopy short s short s short s short s short s short s | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1182 if !solaris void RGBcursor short s short s short s short s short s short s short s |
| 6 | 1183 # |
| 1184 long getbutton short s | |
| 1185 long getcmmode | |
| 1186 long getlsbackup | |
| 1187 long getresetls | |
| 1188 long getdcm | |
| 1189 long getzbuffer | |
| 1190 long ismex | |
| 1191 long isobj long s | |
| 1192 long isqueued short s | |
| 1193 long istag long s | |
| 1194 # | |
| 1195 long genobj | |
| 1196 long gentag | |
| 1197 long getbuffer | |
| 1198 long getcolor | |
| 1199 long getdisplaymode | |
| 1200 long getfont | |
| 1201 long getheight | |
| 1202 long gethitcode | |
| 1203 long getlstyle | |
| 1204 long getlwidth | |
| 1205 long getmap | |
| 1206 long getplanes | |
| 1207 long getwritemask | |
| 1208 long qtest | |
| 1209 long getlsrepeat | |
| 1210 long getmonitor | |
| 1211 long getopenobj | |
| 1212 long getpattern | |
| 1213 long winget | |
| 1214 long winattach | |
| 1215 long getothermonitor | |
| 1216 long newpup | |
| 1217 # | |
| 1218 long getvaluator short s | |
| 1219 void winset long s | |
| 1220 long dopup long s | |
| 1221 void getdepth short r short r | |
| 1222 void getcpos short r short r | |
| 1223 void getsize long r long r | |
| 1224 void getorigin long r long r | |
| 1225 void getviewport short r short r short r short r | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1226 if !solaris void gettp short r short r short r short r |
| 6 | 1227 void getgpos float r float r float r float r |
| 1228 void winposition long s long s long s long s | |
| 1229 void gRGBcolor short r short r short r | |
| 1230 void gRGBmask short r short r short r | |
| 1231 void getscrmask short r short r short r short r | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1232 ###void gRGBcursor short r short r short r short r short r short r short r short r |
| 6 | 1233 void getmcolor short s short r short r short r |
| 1234 void mapw long s short s short s float r float r float r float r float r float r | |
| 1235 void mapw2 long s short s short s float r float r | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1236 ###void defrasterfont short s short s short s Fontchar s[arg3] short s short s[4*arg5] |
|
948
e5ae42ffd9a0
Fix bug introduced by Jack (duplicate def of qread)
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1237 ###long qread short r |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1238 void getcursor short r u_short r u_short r long r |
| 6 | 1239 # |
| 1240 # For these we receive arrays of stuff | |
| 1241 # | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1242 ###void getdev long s short s[arg1] short r[arg1] |
| 6 | 1243 #XXX not generated correctly yet |
| 1244 #void getmatrix float r[16] | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1245 ###long readpixels short s short r[retval] |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1246 ###long readRGB short s char r[retval] char r[retval] char r[retval] |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1247 ###long blkqread short s short r[arg1] |
| 6 | 1248 # |
| 1249 # New 4D routines | |
| 1250 # | |
| 1251 void cmode | |
| 1252 void concave long s | |
| 1253 void curstype long s | |
| 1254 void drawmode long s | |
| 1255 void gammaramp short s[256] short s[256] short s[256] | |
| 1256 long getbackface | |
| 1257 long getdescender | |
| 1258 long getdrawmode | |
| 1259 long getmmode | |
| 1260 long getsm | |
| 1261 long getvideo long s | |
| 1262 void imakebackground | |
| 1263 void lmbind short s short s | |
| 1264 void lmdef long s long s long s float s[arg3] | |
| 1265 void mmode long s | |
| 1266 void normal float s[3] | |
| 1267 void overlay long s | |
| 1268 void RGBrange short s short s short s short s short s short s short s short s | |
|
1443
2ec08a9d0325
rgbimgmodule.c, Makefile, config.c: new module to read RGB image files.
Sjoerd Mullender <sjoerd@acm.org>
parents:
1356
diff
changeset
|
1269 if !solaris void setvideo long s long s |
| 6 | 1270 void shademodel long s |
| 1271 void underlay long s | |
| 1272 # | |
| 1273 # New Personal Iris/GT Routines | |
| 1274 # | |
| 1275 void bgnclosedline | |
| 1276 void bgnline | |
| 1277 void bgnpoint | |
| 1278 void bgnpolygon | |
| 1279 void bgnsurface | |
| 1280 void bgntmesh | |
| 1281 void bgntrim | |
| 1282 void endclosedline | |
| 1283 void endline | |
| 1284 void endpoint | |
| 1285 void endpolygon | |
| 1286 void endsurface | |
| 1287 void endtmesh | |
| 1288 void endtrim | |
| 1289 void blendfunction long s long s | |
| 1290 void c3f float s[3] | |
| 1291 void c3i long s[3] | |
| 1292 void c3s short s[3] | |
| 1293 void c4f float s[4] | |
| 1294 void c4i long s[4] | |
| 1295 void c4s short s[4] | |
| 1296 void colorf float s | |
| 1297 void cpack long s | |
| 1298 void czclear long s long s | |
| 1299 void dglclose long s | |
| 1300 long dglopen char *s long s | |
| 1301 long getgdesc long s | |
| 1302 void getnurbsproperty long s float r | |
| 1303 void glcompat long s long s | |
| 1304 void iconsize long s long s | |
| 1305 void icontitle char *s | |
| 1306 void lRGBrange short s short s short s short s short s short s long s long s | |
| 1307 void linesmooth long s | |
| 1308 void lmcolor long s | |
| 1309 void logicop long s | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1310 ###long lrectread short s short s short s short s long r[retval] |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1311 ###void lrectwrite short s short s short s short s long s[(arg2-arg1+1)*(arg4-arg3+1)] |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1312 ### Now manual, with string last arg |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1313 ###long rectread short s short s short s short s short r[retval] |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1314 ###void rectwrite short s short s short s short s short s[(arg2-arg1+1)*(arg4-arg3+1)] |
| 6 | 1315 void lsetdepth long s long s |
| 1316 void lshaderange short s short s long s long s | |
| 1317 void n3f float s[3] | |
| 1318 void noborder | |
| 1319 void pntsmooth long s | |
| 1320 void readsource long s | |
| 1321 void rectzoom float s float s | |
| 1322 void sbox float s float s float s float s | |
| 1323 void sboxi long s long s long s long s | |
| 1324 void sboxs short s short s short s short s | |
| 1325 void sboxf float s float s float s float s | |
| 1326 void sboxfi long s long s long s long s | |
| 1327 void sboxfs short s short s short s short s | |
| 1328 void setnurbsproperty long s float s | |
| 1329 void setpup long s long s long s | |
| 1330 void smoothline long s | |
| 1331 void subpixel long s | |
| 1332 void swaptmesh | |
| 1333 long swinopen long s | |
| 1334 void v2f float s[2] | |
| 1335 void v2i long s[2] | |
| 1336 void v2s short s[2] | |
| 1337 void v3f float s[3] | |
| 1338 void v3i long s[3] | |
| 1339 void v3s short s[3] | |
| 1340 void v4f float s[4] | |
| 1341 void v4i long s[4] | |
| 1342 void v4s short s[4] | |
| 1343 void videocmd long s | |
| 1344 long windepth long s | |
| 1345 void wmpack long s | |
| 1346 void zdraw long s | |
| 1347 void zfunction long s | |
| 1348 void zsource long s | |
| 1349 void zwritemask long s | |
| 1350 # | |
| 1351 # uses doubles | |
| 1352 # | |
| 1353 void v2d double s[2] | |
| 1354 void v3d double s[3] | |
| 1355 void v4d double s[4] | |
|
389
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1356 # |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1357 # Why isn't this here? |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1358 # |
|
55bf66445c85
Added lrect{read,write} and pixmode().
Guido van Rossum <guido@python.org>
parents:
338
diff
changeset
|
1359 void pixmode long s long s |
|
906
63798cde582c
Added qgetfd() to cstubs for GL.
Guido van Rossum <guido@python.org>
parents:
677
diff
changeset
|
1360 # |
|
63798cde582c
Added qgetfd() to cstubs for GL.
Guido van Rossum <guido@python.org>
parents:
677
diff
changeset
|
1361 # New in IRIX 4.0 |
|
63798cde582c
Added qgetfd() to cstubs for GL.
Guido van Rossum <guido@python.org>
parents:
677
diff
changeset
|
1362 # |
|
63798cde582c
Added qgetfd() to cstubs for GL.
Guido van Rossum <guido@python.org>
parents:
677
diff
changeset
|
1363 long qgetfd |
| 1232 | 1364 void dither long s |
