diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-12-19 21:34:55 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-12-19 21:34:55 (GMT) |
commit | 87a30924d07d0665519c75db93d3addd8a9b1dbf (patch) | |
tree | e7229270fed85bd0478d602bf6a409da27424378 /Mac/Modules/win/winsupport.py | |
parent | 620e9142668d04e3fd7def86a98c92ef6944044d (diff) | |
download | cpython-87a30924d07d0665519c75db93d3addd8a9b1dbf.zip cpython-87a30924d07d0665519c75db93d3addd8a9b1dbf.tar.gz cpython-87a30924d07d0665519c75db93d3addd8a9b1dbf.tar.bz2 |
Added hash() and compare() functions. Needed because multiple WinObj's can now refer to the same underlying WindowRef.
Diffstat (limited to 'Mac/Modules/win/winsupport.py')
-rw-r--r-- | Mac/Modules/win/winsupport.py | 23 |
1 files changed, 23 insertions, 0 deletions
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... |