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