summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1993-02-16 09:25:15 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1993-02-16 09:25:15 (GMT)
commit5fc677363ff99410df72905ced82848cff06a548 (patch)
treeac1298695107fffcac3eee6b2f6474d21166fdac
parent852cc22bd3864a3beed45b97fc9a9fd439010e90 (diff)
downloadcpython-5fc677363ff99410df72905ced82848cff06a548.zip
cpython-5fc677363ff99410df72905ced82848cff06a548.tar.gz
cpython-5fc677363ff99410df72905ced82848cff06a548.tar.bz2
Added readdisplay() routine
-rw-r--r--Modules/cstubs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Modules/cstubs b/Modules/cstubs
index 6ff8f54..04f4578 100644
--- a/Modules/cstubs
+++ b/Modules/cstubs
@@ -657,6 +657,35 @@ gl_lrectread(self, args)
return parray;
}
+% readdisplay
+
+static object *
+gl_readdisplay(self, args)
+ object *self;
+ object *args;
+{
+ short x1, y1, x2, y2;
+ unsigned long *parray, hints;
+ long size, size_ret;
+ object *rv;
+
+ if ( !getargs(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) )
+ return 0;
+ size = (long)(x2+1-x1) * (long)(y2+1-y1);
+ rv = newsizedstringobject((char *)NULL, size*sizeof(long));
+ if ( rv == NULL )
+ return NULL;
+ parray = (unsigned long *)getstringvalue(rv);
+ size_ret = readdisplay(x1, y1, x2, y2, parray, hints);
+ if ( size_ret != size ) {
+ printf("gl_readdisplay: got %d pixels, expected %d\n",
+ size_ret, size);
+ err_setstr(RuntimeError, "readdisplay returned unexpected length");
+ return NULL;
+ }
+ return rv;
+}
+
/* Desperately needed, here are tools to compress and decompress
the data manipulated by lrectread/lrectwrite.