summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-07-26 16:03:16 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-07-26 16:03:16 (GMT)
commit6451cff2c3339dfc579c0e5833174e6109490c7b (patch)
treea8a0eca4746d51cb83cb6f7496c70b5358eebcdb /Mac/Modules
parentded835c7f560991b022586c879cbb141dd175b6f (diff)
downloadcpython-6451cff2c3339dfc579c0e5833174e6109490c7b.zip
cpython-6451cff2c3339dfc579c0e5833174e6109490c7b.tar.gz
cpython-6451cff2c3339dfc579c0e5833174e6109490c7b.tar.bz2
Added access to selFlags and listFlags members (both read and write)
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/list/Listmodule.c34
-rw-r--r--Mac/Modules/list/listsupport.py38
2 files changed, 68 insertions, 4 deletions
diff --git a/Mac/Modules/list/Listmodule.c b/Mac/Modules/list/Listmodule.c
index a276ea3..b0ce515 100644
--- a/Mac/Modules/list/Listmodule.c
+++ b/Mac/Modules/list/Listmodule.c
@@ -40,9 +40,6 @@ extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
-extern PyObject *PMObj_New(PixMapHandle);
-extern int PMObj_Convert(PyObject *, PixMapHandle *);
-
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <Lists.h>
@@ -563,10 +560,39 @@ static PyObject *ListObj_getattr(self, name)
ListObject *self;
char *name;
{
+ {
+ /* XXXX Should we HLock() here?? */
+ if ( strcmp(name, "listFlags") == 0 )
+ return Py_BuildValue("l", (long)(*self->ob_itself)->listFlags & 0xff);
+ if ( strcmp(name, "selFlags") == 0 )
+ return Py_BuildValue("l", (long)(*self->ob_itself)->selFlags & 0xff);
+ }
return Py_FindMethodInChain(&ListObj_chain, (PyObject *)self, name);
}
-#define ListObj_setattr NULL
+static int
+ListObj_setattr(self, name, value)
+ ListObject *self;
+ char *name;
+ PyObject *value;
+{
+ long intval;
+
+ if ( value == NULL || !PyInt_Check(value) )
+ return -1;
+ intval = PyInt_AsLong(value);
+ if (strcmp(name, "listFlags") == 0 ) {
+ /* XXXX Should we HLock the handle here?? */
+ (*self->ob_itself)->listFlags = intval;
+ return 0;
+ }
+ if (strcmp(name, "selFlags") == 0 ) {
+ (*self->ob_itself)->selFlags = intval;
+ return 0;
+ }
+ return -1;
+}
+
PyTypeObject List_Type = {
PyObject_HEAD_INIT(&PyType_Type)
diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py
index 5d0c950..026953c 100644
--- a/Mac/Modules/list/listsupport.py
+++ b/Mac/Modules/list/listsupport.py
@@ -45,6 +45,38 @@ class ListMethodGenerator(MethodGenerator):
FunctionGenerator.parseArgumentList(self, args)
self.argumentList.append(self.itself)
+getattrHookCode = """{
+ /* XXXX Should we HLock() here?? */
+ if ( strcmp(name, "listFlags") == 0 )
+ return Py_BuildValue("l", (long)(*self->ob_itself)->listFlags & 0xff);
+ if ( strcmp(name, "selFlags") == 0 )
+ return Py_BuildValue("l", (long)(*self->ob_itself)->selFlags & 0xff);
+}"""
+
+setattrCode = """
+static int
+ListObj_setattr(self, name, value)
+ ListObject *self;
+ char *name;
+ PyObject *value;
+{
+ long intval;
+
+ if ( value == NULL || !PyInt_Check(value) )
+ return -1;
+ intval = PyInt_AsLong(value);
+ if (strcmp(name, "listFlags") == 0 ) {
+ /* XXXX Should we HLock the handle here?? */
+ (*self->ob_itself)->listFlags = intval;
+ return 0;
+ }
+ if (strcmp(name, "selFlags") == 0 ) {
+ (*self->ob_itself)->selFlags = intval;
+ return 0;
+ }
+ return -1;
+}
+"""
class MyObjectDefinition(GlobalObjectDefinition):
@@ -55,6 +87,12 @@ class MyObjectDefinition(GlobalObjectDefinition):
}""")
def outputFreeIt(self, itselfname):
Output("LDispose(%s);", itselfname)
+
+ def outputGetattrHook(self):
+ Output(getattrHookCode)
+
+ def outputSetattr(self):
+ Output(setattrCode)
# From here on it's basically all boiler plate...