From 12442c9a8a5e1a72653d4b2b18591da7e1c80ffe Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Thu, 16 Nov 2000 01:00:52 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/ffi/FFISpecs.py | 34 +++++++++++++++------------- direct/src/ffi/FFITypes.py | 6 ++--- direct/src/showbase/ppython | 25 ++++++++++++++++++++ direct/src/showbase/sitecustomize.py | 1 + 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/direct/src/ffi/FFISpecs.py b/direct/src/ffi/FFISpecs.py index e1d10c3dda..06444a8df9 100644 --- a/direct/src/ffi/FFISpecs.py +++ b/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') diff --git a/direct/src/ffi/FFITypes.py b/direct/src/ffi/FFITypes.py index b82c6ec167..8f076c6da8 100644 --- a/direct/src/ffi/FFITypes.py +++ b/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) diff --git a/direct/src/showbase/ppython b/direct/src/showbase/ppython index 769e124ba0..569f6ba9db 100755 --- a/direct/src/showbase/ppython +++ b/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. diff --git a/direct/src/showbase/sitecustomize.py b/direct/src/showbase/sitecustomize.py index 9891781495..1be1354ca7 100644 --- a/direct/src/showbase/sitecustomize.py +++ b/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: