mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
*** empty log message ***
This commit is contained in:
parent
1f509d563a
commit
b1bf5ff657
@ -47,6 +47,7 @@ def constructImportFile(codeDir, CModuleName):
|
||||
def outputGlobalFileImports(file, methodList, CModuleName):
|
||||
# Print the standard header
|
||||
file.write(FFIConstants.generatedHeader)
|
||||
file.write('# CMODULE [' + CModuleName + ']\n')
|
||||
|
||||
# Import Python's builtin types
|
||||
file.write('import types\n')
|
||||
@ -95,7 +96,7 @@ def outputImportFileImports(file, typeList, CModuleName):
|
||||
|
||||
# Print the standard header
|
||||
file.write(FFIConstants.generatedHeader)
|
||||
|
||||
file.write('# CMODULE [' + CModuleName + ']\n')
|
||||
file.write('# Import the interrogate module\n')
|
||||
file.write('import ' + FFIConstants.InterrogateModuleName + '\n')
|
||||
file.write('\n')
|
||||
@ -261,6 +262,8 @@ class FFIInterrogateDatabase:
|
||||
descriptor = FFITypes.PrimitiveTypeDescriptor()
|
||||
#descriptor.environment = self.environment
|
||||
descriptor.atomicType = interrogate_type_atomic_token(typeIndex)
|
||||
if interrogate_type_has_module_name(typeIndex):
|
||||
descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex)
|
||||
descriptor.foreignTypeName = \
|
||||
FFIRename.nonClassNameFromCppName(getTypeName(typeIndex))
|
||||
descriptor.typeIndex = typeIndex
|
||||
@ -277,6 +280,9 @@ class FFIInterrogateDatabase:
|
||||
if descriptor.isNested:
|
||||
outerTypeIndex = interrogate_type_outer_class(typeIndex)
|
||||
descriptor.outerType = self.constructDescriptor(outerTypeIndex)
|
||||
if interrogate_type_has_module_name(typeIndex):
|
||||
descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex)
|
||||
|
||||
# Enums are ints in C++ but we do not want to redefine the int type
|
||||
# So we will just call them enums
|
||||
descriptor.enumName = FFIRename.classNameFromCppName(getTypeName(typeIndex))
|
||||
@ -305,6 +311,8 @@ class FFIInterrogateDatabase:
|
||||
if descriptor.isNested:
|
||||
outerTypeIndex = interrogate_type_outer_class(typeIndex)
|
||||
descriptor.outerType = self.constructDescriptor(outerTypeIndex)
|
||||
if interrogate_type_has_module_name(typeIndex):
|
||||
descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex)
|
||||
descriptor.foreignTypeName = \
|
||||
FFIRename.nonClassNameFromCppName(getTypeName(typeIndex))
|
||||
descriptor.typeIndex = typeIndex
|
||||
@ -323,6 +331,8 @@ class FFIInterrogateDatabase:
|
||||
if descriptor.isNested:
|
||||
outerTypeIndex = interrogate_type_outer_class(typeIndex)
|
||||
descriptor.outerType = self.constructDescriptor(outerTypeIndex)
|
||||
if interrogate_type_has_module_name(typeIndex):
|
||||
descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex)
|
||||
descriptor.foreignTypeName = \
|
||||
FFIRename.nonClassNameFromCppName(getTypeName(typeIndex))
|
||||
descriptor.typeIndex = typeIndex
|
||||
@ -363,6 +373,8 @@ class FFIInterrogateDatabase:
|
||||
if descriptor.isNested:
|
||||
outerTypeIndex = interrogate_type_outer_class(typeIndex)
|
||||
descriptor.outerType = self.constructDescriptor(outerTypeIndex)
|
||||
if interrogate_type_has_module_name(typeIndex):
|
||||
descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex)
|
||||
descriptor.foreignTypeName = FFIRename.classNameFromCppName(getTypeName(typeIndex))
|
||||
if FFIConstants.wantComments:
|
||||
if interrogate_type_has_comment(typeIndex):
|
||||
|
@ -56,6 +56,9 @@ class BaseTypeDescriptor:
|
||||
# By default this type is not atomic
|
||||
self.atomicType = 0
|
||||
|
||||
# What C module did this type come from?
|
||||
self.moduleName = ''
|
||||
|
||||
def isAtomic(self):
|
||||
return (self.atomicType != 0)
|
||||
|
||||
@ -131,6 +134,7 @@ class EnumTypeDescriptor(PrimitiveTypeDescriptor):
|
||||
self.generateCode(file, 0)
|
||||
|
||||
def generateCode(self, file, nesting):
|
||||
indent(file, nesting, '# CMODULE [' + self.moduleName + ']\n')
|
||||
self.outputComment(file, nesting)
|
||||
self.outputValues(file, nesting)
|
||||
|
||||
@ -232,6 +236,8 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
|
||||
# Now look at all the methods that we might inherit if we are at
|
||||
# a multiple inheritance node and get their C modules
|
||||
for parentType in parent.parentTypes:
|
||||
if (not (parentType.moduleName in self.CModules)):
|
||||
self.CModules.append(parentType.moduleName)
|
||||
for method in parentType.instanceMethods:
|
||||
if (not (method.typeDescriptor.moduleName in self.CModules)):
|
||||
self.CModules.append(method.typeDescriptor.moduleName)
|
||||
@ -250,7 +256,8 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
|
||||
return self.CModules
|
||||
except:
|
||||
# Otherwise, it must be our first time through, do the real work
|
||||
self.CModules = []
|
||||
# Start with our own moduleName
|
||||
self.CModules = [self.moduleName]
|
||||
for method in (self.constructors + [self.destructor] + self.instanceMethods
|
||||
+ self.upcastMethods + self.downcastMethods + self.staticMethods):
|
||||
if method:
|
||||
@ -474,6 +481,7 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
|
||||
|
||||
|
||||
def generateCode(self, file, nesting):
|
||||
|
||||
self.recordOverloadedMethods()
|
||||
self.cullOverloadedMethods()
|
||||
self.outputImports(file, nesting)
|
||||
@ -583,6 +591,7 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
|
||||
|
||||
|
||||
def outputBaseImports(self, file):
|
||||
indent(file, 0, '# CMODULE [' + self.moduleName + ']\n')
|
||||
indent(file, 0, 'import ' + FFIConstants.staticModuleName + '\n')
|
||||
# Everybody imports types for type checking
|
||||
indent(file, 0, 'import types\n')
|
||||
|
@ -31,7 +31,7 @@ Options:
|
||||
-i lib interrogate library
|
||||
-O no C++ comments or assertion statements
|
||||
"""
|
||||
|
||||
|
||||
# Initialize variables
|
||||
outputDir = ''
|
||||
extensionsDir = ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user