Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b316515

Browse files
committed
Changed some interfaces after error reports from Liberte.
Added altgetmatrix (better but incompatible).
1 parent 3fecef7 commit b316515

1 file changed

Lines changed: 51 additions & 3 deletions

File tree

Modules/cstubs

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Input used to generate the Python module "glmodule.c".
3-
The stub generator is a Python script called "cgen".
3+
The stub generator is a Python script called "cgen.py".
44

55
Each definition must be contained on one line:
66

@@ -491,6 +491,8 @@ static object *gl_endselect(self, args) object *self, *args; {
491491
}
492492

493493

494+
/* XXX The generator botches this one. Here's a quick hack to fix it. */
495+
494496
/* XXX The generator botches this one. Here's a quick hack to fix it. */
495497

496498
% getmatrix float r[16]
@@ -519,6 +521,46 @@ gl_getmatrix(self, args)
519521
return v;
520522
}
521523

524+
/* Here's an alternate version that returns a 4x4 matrix instead of
525+
a vector. Unfortunately it is incompatible with loadmatrix and
526+
multmatrix... */
527+
528+
% altgetmatrix float r[4][4]
529+
530+
static object *
531+
gl_altgetmatrix(self, args)
532+
object *self;
533+
object *args;
534+
{
535+
float arg1 [ 4 ] [ 4 ] ;
536+
object *v, *w;
537+
int i, j;
538+
getmatrix( arg1 );
539+
v = newlistobject(4);
540+
if (v == NULL) {
541+
return NULL;
542+
}
543+
for (i = 0; i < 4; i++) {
544+
w = newlistobject(4);
545+
if (w == NULL) {
546+
DECREF(v);
547+
return NULL;
548+
}
549+
setlistitem(v, i, w);
550+
}
551+
for (i = 0; i < 4; i++) {
552+
for (j = 0; j < 4; j++) {
553+
w = mknewfloatobject(arg1[i][j]);
554+
if (w == NULL) {
555+
DECREF(v);
556+
return NULL;
557+
}
558+
setlistitem(getlistitem(v, i), j, w);
559+
}
560+
}
561+
return v;
562+
}
563+
522564
/* End of manually written stubs */
523565

524566
%%
@@ -680,9 +722,13 @@ void rpmv2 float s float s
680722
void xfpt2 float s float s
681723
#
682724
void loadmatrix float s[16]
725+
# Really [4][4]
683726
void multmatrix float s[16]
684-
void crv float s[16]
727+
# Really [4][4]
728+
void crv float s[12]
729+
# Really [4][3]
685730
void rcrv float s[16]
731+
# Really [4][4]
686732
#
687733
# Methods that have strings.
688734
#
@@ -712,8 +758,10 @@ void polfs long s short s[3*arg1]
712758
void polys long s short s[3*arg1]
713759
void poly2s long s short s[2*arg1]
714760
#
715-
void defcursor short s short s[16]
761+
void defcursor short s short s[128]
762+
# Is this useful?
716763
void writepixels short s short s[arg1]
764+
# Should be unsigned short...
717765
void defbasis long s float s[16]
718766
void gewrite short s short s[arg1]
719767
#

0 commit comments

Comments
 (0)