def generateStaticES2Source(apis, args): code = '\n' code += '#ifndef REGAL_NAMESPACE\n' code += '#error REGAL_STATIC_ES2 requires REGAL_NAMESPACE\n' code += '#endif\n\n' for api in apis: if api.name == 'gl': for function in api.functions: if not function.needsContext: continue if getattr(function, 'esVersions', None) == None or 2.0 not in function.esVersions: continue name = function.name code += '#undef %s\n' % (name) code += '\n' code += 'extern "C"\n' code += '{\n' for function in api.functions: if not function.needsContext: continue if getattr(function, 'esVersions', None) == None or 2.0 not in function.esVersions: continue params = paramsDefaultCode(function.parameters, True) rType = typeCode(function.ret.type) code += ' extern %s REGAL_CALL %s(%s);\n' % ( rType, function.name, params) code += '}\n' substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'StaticES2' substitute['LOCAL_INCLUDE'] = code substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = '' substitute['API_DISPATCH_FUNC_INIT'] = apiStaticES2FuncInitCode(apis, args) substitute['IFDEF'] = '#if REGAL_DRIVER && REGAL_STATIC_ES2\n\n' substitute['ENDIF'] = '#endif\n' outputCode('%s/RegalDispatchStaticES2.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generateStaticES2Source(apis, args): code = '\n' code += '#ifndef REGAL_NAMESPACE\n' code += '#error REGAL_STATIC_ES2 requires REGAL_NAMESPACE\n' code += '#endif\n\n' for api in apis: if api.name=='gl': for function in api.functions: if not function.needsContext: continue if getattr(function,'esVersions',None)==None or 2.0 not in function.esVersions: continue name = function.name code += '#undef %s\n' % ( name ) code += '\n' code += 'extern "C"\n' code += '{\n' for function in api.functions: if not function.needsContext: continue if getattr(function,'esVersions',None)==None or 2.0 not in function.esVersions: continue params = paramsDefaultCode(function.parameters, True) rType = typeCode(function.ret.type) code += ' extern %s REGAL_CALL %s(%s);\n' % (rType, function.name, params) code += '}\n' substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'StaticES2' substitute['LOCAL_INCLUDE'] = code substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = '' substitute['API_DISPATCH_FUNC_INIT'] = apiStaticES2FuncInitCode( apis, args ) substitute['IFDEF'] = '#if REGAL_DRIVER && REGAL_STATIC_ES2\n\n' substitute['ENDIF'] = '#endif\n' outputCode( '%s/RegalDispatchStaticES2.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
def generateErrorSource(apis, args): funcDefine = apiErrorFuncDefineCode( apis, args ) funcInit = apiDispatchFuncInitCode( apis, args, 'error' ) substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Error' substitute['LOCAL_INCLUDE'] = '' substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['IFDEF'] = '#if REGAL_ERROR\n\n' substitute['ENDIF'] = '#endif\n' outputCode( '%s/RegalDispatchError.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generateMissingSource(apis, args): # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Missing' substitute['LOCAL_INCLUDE'] = '' substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = apiMissingFuncDefineCode( apis, args ) substitute['API_DISPATCH_FUNC_INIT'] = apiDispatchFuncInitCode( apis, args, 'missing' ) substitute['IFDEF'] = '' substitute['ENDIF'] = '' outputCode( '%s/RegalDispatchMissing.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
def generateDebugSource(apis, args): funcDefine = apiDebugFuncDefineCode( apis, args ) funcInit = apiDispatchFuncInitCode( apis, args, 'debug' ) # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Debug' substitute['LOCAL_INCLUDE'] = debugGlobalCode substitute['LOCAL_CODE'] = debugLocalCode substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['IFDEF'] = '#if REGAL_DEBUG\n\n' substitute['ENDIF'] = '#endif\n' outputCode( '%s/RegalDispatchDebug.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generateMissingSource(apis, args): # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Missing' substitute['LOCAL_INCLUDE'] = '' substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = apiMissingFuncDefineCode( apis, args) substitute['API_DISPATCH_FUNC_INIT'] = apiDispatchFuncInitCode( apis, args, 'missing') substitute['IFDEF'] = '' substitute['ENDIF'] = '' outputCode('%s/RegalDispatchMissing.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generateLoaderSource(apis, args): funcDefine = apiLoaderFuncDefineCode( apis, args ) funcInit = apiDispatchFuncInitCode( apis, args, 'loader' ) # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Loader' substitute['LOCAL_CODE'] = loaderLocalCode substitute['LOCAL_INCLUDE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['IFDEF'] = '#if REGAL_DRIVER && !defined(__native_client__)\n\n' substitute['ENDIF'] = '#endif\n' outputCode( '%s/RegalDispatchLoader.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generatePpapiSource(apis, args): funcDefine = apiPpapiFuncDefineCode( apis, args ) funcInit = apiPpapiFuncInitCode ( apis, args ) # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Ppapi' substitute['LOCAL_INCLUDE'] = '#include <ppapi/c/ppb_opengles2.h>' substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['IFDEF'] = '#if REGAL_DRIVER && REGAL_SYS_PPAPI\n' substitute['ENDIF'] = '#endif\n' outputCode( '%s/RegalDispatchPpapi.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
def generateNaclSource(apis, args): funcDefine = apiNaclFuncDefineCode( apis, args ) funcInit = apiNaclFuncInitCode ( apis, args ) # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Nacl' substitute['LOCAL_INCLUDE'] = '#include <ppapi/c/ppb_opengles2.h>' substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['IFDEF'] = '#if REGAL_DRIVER && defined(__native_client__)\n' substitute['ENDIF'] = '#endif\n' outputCode( '%s/RegalDispatchNacl.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generateDispatchStatistics(apis, args): funcDefine = apiStatisticsFuncDefineCode( apis, args ) funcInit = apiDispatchFuncInitCode( apis, args, 'statistics' ) # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Statistics' substitute['LOCAL_INCLUDE'] = '#include "RegalStatistics.h"' substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['API_DISPATCH_GLOBAL_FUNC_INIT'] = '' substitute['IFDEF'] = '#if REGAL_STATISTICS\n\n' substitute['ENDIF'] = '#endif\n' outputCode( '%s/RegalDispatchStatistics.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
def generateNaclSource(apis, args): funcDefine = apiNaclFuncDefineCode(apis, args) funcInit = apiNaclFuncInitCode(apis, args) # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Nacl' substitute['LOCAL_INCLUDE'] = '#include <ppapi/c/ppb_opengles2.h>' substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['IFDEF'] = '#if REGAL_DRIVER && defined(__native_client__)\n' substitute['ENDIF'] = '#endif\n' outputCode('%s/RegalDispatchNacl.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generateDebugSource(apis, args): funcDefine = apiDebugFuncDefineCode(apis, args) funcInit = apiDispatchFuncInitCode(apis, args, 'debug') # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Debug' substitute['LOCAL_INCLUDE'] = debugGlobalCode substitute['LOCAL_CODE'] = debugLocalCode substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['IFDEF'] = '#if REGAL_DEBUG\n\n' substitute['ENDIF'] = '#endif\n' outputCode('%s/RegalDispatchDebug.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generateLoaderSource(apis, args): funcDefine = apiLoaderFuncDefineCode(apis, args) funcInit = apiDispatchFuncInitCode(apis, args, 'loader') # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Loader' substitute['LOCAL_CODE'] = loaderLocalCode substitute['LOCAL_INCLUDE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['IFDEF'] = '#if REGAL_DRIVER && !defined(__native_client__)\n\n' substitute['ENDIF'] = '#endif\n' outputCode('%s/RegalDispatchLoader.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
def generateDispatchStatistics(apis, args): funcDefine = apiStatisticsFuncDefineCode(apis, args) funcInit = apiDispatchFuncInitCode(apis, args, 'statistics') # Output substitute = {} substitute['LICENSE'] = args.license substitute['AUTOGENERATED'] = args.generated substitute['COPYRIGHT'] = args.copyright substitute['DISPATCH_NAME'] = 'Statistics' substitute['LOCAL_INCLUDE'] = '#include "RegalStatistics.h"' substitute['LOCAL_CODE'] = '' substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine substitute['API_DISPATCH_FUNC_INIT'] = funcInit substitute['API_DISPATCH_GLOBAL_FUNC_INIT'] = '' substitute['IFDEF'] = '#if REGAL_STATISTICS\n\n' substitute['ENDIF'] = '#endif\n' outputCode('%s/RegalDispatchStatistics.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))