mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-27 13:42:28 -06:00
33 lines
1,013 B
Python
33 lines
1,013 B
Python
|
import FFIConstants
|
||
|
|
||
|
class FFIEnvironment:
|
||
|
def __init__(self):
|
||
|
self.reset()
|
||
|
|
||
|
def reset(self):
|
||
|
self.types = {}
|
||
|
self.globalFunctions = []
|
||
|
self.downcastFunctions = []
|
||
|
self.globalValues = []
|
||
|
self.manifests = []
|
||
|
|
||
|
def addType(self, typeDescriptor, name):
|
||
|
if name in self.types:
|
||
|
FFIConstants.notify.info('Redefining type named: ' + name)
|
||
|
self.types[name] = typeDescriptor
|
||
|
|
||
|
def getTypeNamed(self, name):
|
||
|
try:
|
||
|
self.types[name]
|
||
|
except KeyError:
|
||
|
raise 'Type not found in FFIEnvironment'
|
||
|
|
||
|
def addGlobalFunction(self, typeDescriptors):
|
||
|
self.globalFunctions.extend(typeDescriptors)
|
||
|
def addDowncastFunction(self, typeDescriptor):
|
||
|
self.downcastFunctions.append(typeDescriptor)
|
||
|
def addGlobalValue(self, typeDescriptor):
|
||
|
self.globalValues.append(typeDescriptor)
|
||
|
def addManifest(self, typeDescriptor):
|
||
|
self.manifests.append(typeDescriptor)
|