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