summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/win/Winmodule.c14
-rw-r--r--Mac/Modules/win/winsupport.py23
2 files changed, 35 insertions, 2 deletions
diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c
index 800bad0..4dce0e8 100644
--- a/Mac/Modules/win/Winmodule.c
+++ b/Mac/Modules/win/Winmodule.c
@@ -2165,11 +2165,21 @@ static PyObject *WinObj_getattr(self, name)
#define WinObj_setattr NULL
-#define WinObj_compare NULL
+static int WinObj_compare(self, other)
+ WindowObject *self, *other;
+{
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
#define WinObj_repr NULL
-#define WinObj_hash NULL
+static int WinObj_hash(self)
+ WindowObject *self;
+{
+ return (int)self->ob_itself;
+}
PyTypeObject Window_Type = {
PyObject_HEAD_INIT(&PyType_Type)
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index cbc5246..74b3bfd 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -126,6 +126,29 @@ class MyObjectDefinition(GlobalObjectDefinition):
OutRbrace()
Output("self->ob_itself = NULL;")
Output("self->ob_freeit = NULL;")
+
+ def outputCompare(self):
+ Output()
+ Output("static int %s_compare(self, other)", self.prefix)
+ IndentLevel()
+ Output("%s *self, *other;", self.objecttype)
+ DedentLevel()
+ OutLbrace()
+ Output("if ( self->ob_itself > other->ob_itself ) return 1;")
+ Output("if ( self->ob_itself < other->ob_itself ) return -1;")
+ Output("return 0;")
+ OutRbrace()
+
+ def outputHash(self):
+ Output()
+ Output("static int %s_hash(self)", self.prefix)
+ IndentLevel()
+ Output("%s *self;", self.objecttype)
+ DedentLevel()
+ OutLbrace()
+ Output("return (int)self->ob_itself;")
+ OutRbrace()
+
## def outputFreeIt(self, itselfname):
## Output("DisposeWindow(%s);", itselfname)
# From here on it's basically all boiler plate...