Browse Source

*** empty log message ***

Joe Shochet 25 năm trước cách đây
mục cha
commit
12442c9a8a

+ 18 - 16
direct/src/ffi/FFISpecs.py

@@ -137,10 +137,10 @@ class GlobalFunctionSpecification(FunctionSpecification):
         self.outputMethodHeader(methodClass, file, nesting)
         self.outputMethodBody(methodClass, file, nesting)
         self.outputMethodFooter(methodClass, file, nesting)
-    def generateInheritedUpcastMethodCode(self, methodClass, parentClass, file, nesting):
-        self.outputInheritedUpcastMethodHeader(methodClass, parentClass, file, nesting)
-        self.outputInheritedUpcastMethodBody(methodClass, parentClass, file, nesting)
-        self.outputInheritedUpcastMethodFooter(methodClass, parentClass, file, nesting)
+    def generateInheritedMethodCode(self, methodClass, parentClass, file, nesting, needsDowncast):
+        self.outputInheritedMethodHeader(methodClass, parentClass, file, nesting, needsDowncast)
+        self.outputInheritedMethodBody(methodClass, parentClass, file, nesting, needsDowncast)
+        self.outputInheritedMethodFooter(methodClass, parentClass, file, nesting, needsDowncast)
         
     ##################################################
     ## Global Function Code Generation
@@ -220,7 +220,7 @@ class GlobalFunctionSpecification(FunctionSpecification):
     ##################################################
     ## Upcast Class Method Code Generation
     ##################################################
-    def outputInheritedUpcastMethodHeader(self, methodClass, parentClass, file, nesting):
+    def outputInheritedMethodHeader(self, methodClass, parentClass, file, nesting, needsDowncast):
         argTypes = self.typeDescriptor.argumentTypes
         thislessArgTypes = self.typeDescriptor.thislessArgTypes()
         indent(file, nesting+1, 'def ' + self.getFinalName() + '(self')
@@ -232,7 +232,7 @@ class GlobalFunctionSpecification(FunctionSpecification):
                     file.write(', ')
         file.write('):\n')
 
-    def outputInheritedUpcastMethodBody(self, methodClass, parentClass, file, nesting):
+    def outputInheritedMethodBody(self, methodClass, parentClass, file, nesting, needsDowncast):
         # The method body will look something like
         #     upcastSelf = self.upcastToParentClass()
         #     returnValue = ParentClass.method(upcastSelf, arg)
@@ -257,9 +257,10 @@ class GlobalFunctionSpecification(FunctionSpecification):
         file.write(')\n')
         returnType = self.typeDescriptor.returnType.recursiveTypeDescriptor()
         # Generate the return value code with no downcast instructions
-        returnType.generateReturnValueWrapper(file, self.typeDescriptor.userManagesMemory, 1, nesting+2)
+        returnType.generateReturnValueWrapper(file, self.typeDescriptor.userManagesMemory,
+                                              needsDowncast, nesting+2)
 
-    def outputInheritedUpcastMethodFooter(self, methodClass, parentClass, file, nesting):
+    def outputInheritedMethodFooter(self, methodClass, parentClass, file, nesting, needsDowncast):
         pass
 
 
@@ -287,10 +288,10 @@ class MethodSpecification(FunctionSpecification):
         self.outputStaticBody(methodClass, file, nesting)
         self.outputStaticFooter(methodClass, file, nesting)
 
-    def generateInheritedUpcastMethodCode(self, methodClass, parentClass, file, nesting):
-        self.outputInheritedUpcastMethodHeader(methodClass, parentClass, file, nesting)
-        self.outputInheritedUpcastMethodBody(methodClass, parentClass, file, nesting)
-        self.outputInheritedUpcastMethodFooter(methodClass, parentClass, file, nesting)
+    def generateInheritedMethodCode(self, methodClass, parentClass, file, nesting, needsDowncast):
+        self.outputInheritedMethodHeader(methodClass, parentClass, file, nesting, needsDowncast)
+        self.outputInheritedMethodBody(methodClass, parentClass, file, nesting, needsDowncast)
+        self.outputInheritedMethodFooter(methodClass, parentClass, file, nesting, needsDowncast)
         
     def generateDowncastMethodCode(self, methodClass, file, nesting):
         # The downcast method code is just like regular code, but the
@@ -455,7 +456,7 @@ class MethodSpecification(FunctionSpecification):
     ##################################################
     ## Upcast Method Code Generation
     ##################################################
-    def outputInheritedUpcastMethodHeader(self, methodClass, parentClass, file, nesting):
+    def outputInheritedMethodHeader(self, methodClass, parentClass, file, nesting, needsDowncast):
         argTypes = self.typeDescriptor.argumentTypes
         thislessArgTypes = self.typeDescriptor.thislessArgTypes()
         indent(file, nesting+1, 'def ' + self.getFinalName() + '(self')
@@ -467,7 +468,7 @@ class MethodSpecification(FunctionSpecification):
                     file.write(', ')
         file.write('):\n')
 
-    def outputInheritedUpcastMethodBody(self, methodClass, parentClass, file, nesting):
+    def outputInheritedMethodBody(self, methodClass, parentClass, file, nesting, needsDowncast):
         # The method body will look something like
         #     upcastSelf = self.upcastToParentClass()
         #     returnValue = libpanda.method(upcastSelf.this, arg)
@@ -490,9 +491,10 @@ class MethodSpecification(FunctionSpecification):
         file.write(')\n')
         returnType = self.typeDescriptor.returnType.recursiveTypeDescriptor()
         # Generate the return value code with no downcast instructions
-        returnType.generateReturnValueWrapper(file, self.typeDescriptor.userManagesMemory, 1, nesting+2)
+        returnType.generateReturnValueWrapper(file, self.typeDescriptor.userManagesMemory,
+                                              needsDowncast, nesting+2)
 
-    def outputInheritedUpcastMethodFooter(self, methodClass, parentClass, file, nesting):
+    def outputInheritedMethodFooter(self, methodClass, parentClass, file, nesting, needsDowncast):
         indent(file, nesting+1, '\n')        
 
 

+ 3 - 3
direct/src/ffi/FFITypes.py

@@ -502,10 +502,10 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
             for parentType in self.parentTypes:
                 # Copy all the parents instance methods
                 for method in parentType.instanceMethods:
-                    method.generateInheritedUpcastMethodCode(self, parentType, file, nesting)
+                    method.generateInheritedMethodCode(self, parentType, file, nesting, 1) # with downcast
                 # Copy all the parents upcast methods so we transitively pick them up
                 for method in parentType.upcastMethods:
-                    method.generateInheritedUpcastMethodCode(self, parentType, file, nesting)
+                    method.generateInheritedMethodCode(self, parentType, file, nesting, 0) # no downcast
                 # Do not copy the downcast methods
 
         # At multiple inheritance nodes, copy all the parent methods into
@@ -518,7 +518,7 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
             indent(file, nesting+1, '\n')
             for parentType in self.parentTypes:
                 for method in parentType.globalMethods:
-                    method.generateInheritedUpcastMethodCode(self, parentType, file, nesting)
+                    method.generateInheritedMethodCode(self, parentType, file, nesting, 1) # with downcast
 
         self.generateOverloadedMethods(file, nesting)
 

+ 25 - 0
direct/src/showbase/ppython

@@ -23,6 +23,31 @@ done
 PYTHONPATH=$NEWPYTHONPATH
 export PYTHONPATH
 
+
+# Lets also de-cygwinify the Project variables (so you can use file name 
+# completion)  This is hardcoded for the most popular trees
+if [ "$DTOOL" ]; then
+    DTOOL=`cygpath -w $DTOOL`
+    export DTOOL
+fi
+if [ "$PANDA" ]; then
+    PANDA=`cygpath -w $PANDA`
+    export PANDA
+fi
+if [ "$DIRECT" ]; then
+    DIRECT=`cygpath -w $DIRECT`
+    export DIRECT
+fi
+if [ "$TOONTOWN" ]; then
+    TOONTOWN=`cygpath -w $TOONTOWN`
+    export TOONTOWN
+fi
+
+# Export the proper home environment variable
+HOME=`cygpath -w $HOME`
+export HOME
+
+
 # We can't run with -u under windows for some reason.  But we do need to
 # make a distinction between python_d and python.  We'll accept the user
 # parameter -d to indicate we should run python_d.

+ 1 - 0
direct/src/showbase/sitecustomize.py

@@ -28,6 +28,7 @@ def addpackage(package):
     comments and empty lines are ok
     """
     tree = os.getenv(package)
+    
     lowerPackage = package.lower()
     fullname = os.path.join(tree, 'etc' + os.sep + (lowerPackage + '.pth'))
     try: