123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- class SystemFunction(object):
- name = None
- @classmethod
- def getFunctionName(cls):
- return cls.name
- @classmethod
- def getMakeName(cls):
- return cls.name.upper()
- @classmethod
- def iterHeaders(cls, targetPlatform):
- raise NotImplementedError
- class FTruncateFunction(SystemFunction):
- name = 'ftruncate'
- @classmethod
- def iterHeaders(cls, targetPlatform):
- yield '<unistd.h>'
- class MMapFunction(SystemFunction):
- name = 'mmap'
- @classmethod
- def iterHeaders(cls, targetPlatform):
- if targetPlatform in ('darwin', 'openbsd'):
- yield '<sys/types.h>'
- yield '<sys/mman.h>'
- class PosixMemAlignFunction(SystemFunction):
- name = 'posix_memalign'
- @classmethod
- def iterHeaders(cls, targetPlatform):
- yield '<stdlib.h>'
- class NftwFunction(SystemFunction):
- name = 'nftw'
- @classmethod
- def iterHeaders(cls, targetPlatform):
- yield '<ftw.h>'
- # Build a list of system functions using introspection.
- systemFunctions = [
- obj
- for obj in locals().values()
- if isinstance(obj, type)
- and issubclass(obj, SystemFunction)
- and obj is not SystemFunction
- ]
|