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