1.1 --- a/rsvplib.py Mon Sep 06 01:08:58 2010 +0200
1.2 +++ b/rsvplib.py Tue Sep 07 01:07:23 2010 +0200
1.3 @@ -453,6 +453,19 @@
1.4 def builtins_object_init(self):
1.5 pass
1.6
1.7 + def builtins_isinstance(self):
1.8 + frame = self.local_sp_stack[-1]
1.9 +
1.10 + # Get the operand addresses.
1.11 +
1.12 + obj_value = self.frame_stack[frame]
1.13 + cls_value = self.frame_stack[frame + 1]
1.14 +
1.15 + if self.machine._CheckInstance(obj_value.ref, cls_value.ref):
1.16 + self.machine.result = DataValue(self.constants[True], self.constants[True])
1.17 + else:
1.18 + self.machine.result = DataValue(self.constants[False], self.constants[False])
1.19 +
1.20 native_functions = {
1.21
1.22 # Native method implementations:
1.23 @@ -495,6 +508,10 @@
1.24 # Native instantiator helpers:
1.25
1.26 "__builtins__.list.__new__" : builtins_list_new,
1.27 +
1.28 + # Native helper functions:
1.29 +
1.30 + "__builtins__._isinstance" : builtins_isinstance,
1.31 }
1.32
1.33 # vim: tabstop=4 expandtab shiftwidth=4