コード例 #1
0
ファイル: RegalDispatchStaticES2.py プロジェクト: vvuk/regal
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['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
    substitute['IFDEF'] = '#if REGAL_DRIVER && REGAL_STATIC_ES2\n\n'
    substitute['ENDIF'] = '#endif\n'

    outputCode('%s/RegalDispatchStaticES2.cpp' % args.srcdir,
               dispatchSourceTemplate.substitute(substitute))
コード例 #2
0
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['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
  substitute['IFDEF'] = '#if REGAL_DRIVER && REGAL_STATIC_ES2\n\n'
  substitute['ENDIF'] = '#endif\n'

  outputCode( '%s/RegalDispatchStaticES2.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #3
0
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['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
  substitute['IFDEF'] = '#if REGAL_ERROR\n\n'
  substitute['ENDIF'] = '#endif\n'
  outputCode( '%s/RegalDispatchError.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #4
0
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['API_DISPATCH_GLOBAL_FUNC_INIT']   = apiDispatchGlobalFuncInitCode( apis, args, 'missing' )
  substitute['IFDEF'] = ''
  substitute['ENDIF'] = ''

  outputCode( '%s/RegalDispatchMissing.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #5
0
ファイル: RegalDispatchEmu.py プロジェクト: quaxquax/regal
def generateEmuSource(apis, args):

    funcDefine = apiEmuFuncDefineCode(apis, args)
    funcInit = apiEmuDispatchFuncInitCode(apis, args)

    emuLocalInclude = '''

#include "RegalBreak.h"
#include "RegalBin.h"
#include "RegalTexSto.h"
#include "RegalXfer.h"
#include "RegalEmu.h"
#include "RegalPpa.h"
#include "RegalPpca.h"
#include "RegalRect.h"
#include "RegalHint.h"
#include "RegalIff.h"
#include "RegalQuads.h"
#include "RegalMarker.h"
#include "RegalObj.h"
#include "RegalDsa.h"
#include "RegalSo.h"
#include "RegalTexC.h"
#include "RegalVao.h"
#include "RegalBaseVertex.h"
#include "RegalFilt.h"'''

    # Output

    substitute = {}
    substitute["LICENSE"] = args.license
    substitute["AUTOGENERATED"] = args.generated
    substitute["COPYRIGHT"] = args.copyright
    substitute["DISPATCH_NAME"] = "Emu"
    substitute["LOCAL_CODE"] = emuLocalCode
    substitute["LOCAL_INCLUDE"] = emuLocalInclude
    substitute["API_DISPATCH_FUNC_DEFINE"] = funcDefine
    substitute["API_DISPATCH_FUNC_INIT"] = funcInit
    substitute["API_DISPATCH_GLOBAL_FUNC_INIT"] = ""
    substitute["IFDEF"] = "#if REGAL_EMULATION\n\n"
    substitute["ENDIF"] = "#endif\n"

    outputCode("%s/RegalDispatchEmu.cpp" % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #6
0
ファイル: RegalDispatchTrace.py プロジェクト: Shalmezad/regal
def generateTraceSource(apis, args):

  funcDefine     = apiTraceFuncDefineCode( apis, args )
  funcInit       = apiDispatchFuncInitCode( apis, args, 'trace', exclude, lambda x : True, traceCond )
  globalFuncInit = apiDispatchGlobalFuncInitCode( apis, args, 'trace', exclude, lambda x : True, traceCond )

  substitute = {}
  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright
  substitute['DISPATCH_NAME'] = 'Trace'
  substitute['LOCAL_INCLUDE'] = '#include "RegalDispatcherGlobal.h"\n'
  substitute['LOCAL_CODE']    = ''
  substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
  substitute['API_DISPATCH_FUNC_INIT'] = funcInit
  substitute['API_DISPATCH_GLOBAL_FUNC_INIT'] = globalFuncInit
  substitute['IFDEF'] = '#if REGAL_TRACE\n\n#ifdef REGAL_NAMESPACE\n#undef REGAL_NAMESPACE\n#endif\n\n'
  substitute['ENDIF'] = '#endif\n'
  outputCode( '%s/RegalDispatchTrace.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #7
0
def generateEmuSource(apis, args):

  funcDefine = apiEmuFuncDefineCode( apis, args )
  funcInit   = apiEmuDispatchFuncInitCode( apis, args )

  emuLocalInclude = '''

#include "RegalBreak.h"
#include "RegalBin.h"
#include "RegalTexSto.h"
#include "RegalXfer.h"
#include "RegalEmu.h"
#include "RegalPpa.h"
#include "RegalPpca.h"
#include "RegalRect.h"
#include "RegalHint.h"
#include "RegalIff.h"
#include "RegalQuads.h"
#include "RegalMarker.h"
#include "RegalObj.h"
#include "RegalDsa.h"
#include "RegalSo.h"
#include "RegalTexC.h"
#include "RegalVao.h"
#include "RegalBaseVertex.h"
#include "RegalFilt.h"'''

  # Output

  substitute = {}
  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright
  substitute['DISPATCH_NAME']   = 'Emu'
  substitute['LOCAL_CODE']      = emuLocalCode
  substitute['LOCAL_INCLUDE']   = emuLocalInclude
  substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
  substitute['API_DISPATCH_FUNC_INIT'] = funcInit
  substitute['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
  substitute['IFDEF'] = '#if REGAL_EMULATION\n\n'
  substitute['ENDIF'] = '#endif\n'

  outputCode( '%s/RegalDispatchEmu.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #8
0
def generateTraceSource(apis, args):

  funcDefine     = apiTraceFuncDefineCode( apis, args )
  funcInit       = apiDispatchFuncInitCode( apis, args, 'trace', exclude )
  globalFuncInit = apiDispatchGlobalFuncInitCode( apis, args, 'trace', exclude )

  substitute = {}
  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright
  substitute['DISPATCH_NAME'] = 'Trace'
  substitute['LOCAL_INCLUDE'] = '#include "RegalDispatcherGlobal.h"\n'
  substitute['LOCAL_CODE']    = ''
  substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
  substitute['API_DISPATCH_FUNC_INIT'] = funcInit
  substitute['API_DISPATCH_GLOBAL_FUNC_INIT'] = globalFuncInit
  substitute['IFDEF'] = '#if REGAL_TRACE\n\n#ifdef REGAL_NAMESPACE\n#undef REGAL_NAMESPACE\n#endif\n\n'
  substitute['ENDIF'] = '#endif\n'
  outputCode( '%s/RegalDispatchTrace.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #9
0
ファイル: RegalDispatchEmu.py プロジェクト: LosingLin/regal
def generateEmuSource(apis, args):

  funcDefine = apiEmuFuncDefineCode( apis, args )
  funcInit   = apiEmuDispatchFuncInitCode( apis, args )

  emuLocalInclude = '''

#include "RegalBreak.h"
#include "RegalBin.h"
#include "RegalTexSto.h"
#include "RegalXfer.h"
#include "RegalEmu.h"
#include "RegalPpa.h"
#include "RegalPpca.h"
#include "RegalRect.h"
#include "RegalHint.h"
#include "RegalIff.h"
#include "RegalMarker.h"
#include "RegalObj.h"
#include "RegalDsa.h"
#include "RegalSo.h"
#include "RegalTexC.h"
#include "RegalVao.h"
#include "RegalBaseVertex.h"
#include "RegalFilt.h"'''

  # Output

  substitute = {}
  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright
  substitute['DISPATCH_NAME']   = 'Emu'
  substitute['LOCAL_CODE']      = emuLocalCode
  substitute['LOCAL_INCLUDE']   = emuLocalInclude
  substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
  substitute['API_DISPATCH_FUNC_INIT'] = funcInit
  substitute['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
  substitute['IFDEF'] = '#if REGAL_EMULATION\n\n'
  substitute['ENDIF'] = '#endif\n'

  outputCode( '%s/RegalDispatchEmu.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #10
0
ファイル: RegalDispatchPpapi.py プロジェクト: LosingLin/regal
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['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
  substitute['IFDEF'] = '#if REGAL_DRIVER && REGAL_SYS_PPAPI\n'
  substitute['ENDIF'] = '#endif\n'

  outputCode( '%s/RegalDispatchPpapi.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #11
0
ファイル: RegalDispatchDebug.py プロジェクト: LosingLin/regal
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['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
  substitute['IFDEF'] = '#if REGAL_DEBUG\n\n'
  substitute['ENDIF'] = '#endif\n'

  outputCode( '%s/RegalDispatchDebug.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #12
0
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['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
    substitute['IFDEF'] = '#if REGAL_DRIVER && REGAL_SYS_PPAPI\n'
    substitute['ENDIF'] = '#endif\n'

    outputCode('%s/RegalDispatchPpapi.cpp' % args.srcdir,
               dispatchSourceTemplate.substitute(substitute))
コード例 #13
0
def generateLoaderSource(apis, args):

  funcDefine = apiLoaderFuncDefineCode( apis, args )
  funcInit   = apiDispatchFuncInitCode( apis, args, 'loader' )
  globalFuncInit   = apiDispatchGlobalFuncInitCode( apis, args, 'loader' )

  # Output

  substitute = {}

  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright
  substitute['DISPATCH_NAME']   = 'Loader'
  substitute['LOCAL_CODE']      = ''
  substitute['LOCAL_INCLUDE']   = '#include "RegalDispatcherGlobal.h"\n'
  substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
  substitute['API_DISPATCH_FUNC_INIT'] = funcInit
  substitute['API_DISPATCH_GLOBAL_FUNC_INIT'] = globalFuncInit
  substitute['IFDEF'] = '#if REGAL_DRIVER\n\n'
  substitute['ENDIF'] = '#endif\n'

  outputCode( '%s/RegalDispatchLoader.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
コード例 #14
0
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['API_DISPATCH_GLOBAL_FUNC_INIT'] = ''
    substitute['IFDEF'] = '#if REGAL_DEBUG\n\n'
    substitute['ENDIF'] = '#endif\n'

    outputCode('%s/RegalDispatchDebug.cpp' % args.srcdir,
               dispatchSourceTemplate.substitute(substitute))
コード例 #15
0
def generateLoaderSource(apis, args):

    funcDefine = apiLoaderFuncDefineCode(apis, args)
    funcInit = apiDispatchFuncInitCode(apis, args, 'loader')
    globalFuncInit = apiDispatchGlobalFuncInitCode(apis, args, 'loader')

    # Output

    substitute = {}

    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['DISPATCH_NAME'] = 'Loader'
    substitute['LOCAL_CODE'] = ''
    substitute['LOCAL_INCLUDE'] = '#include "RegalDispatcherGlobal.h"\n'
    substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
    substitute['API_DISPATCH_FUNC_INIT'] = funcInit
    substitute['API_DISPATCH_GLOBAL_FUNC_INIT'] = globalFuncInit
    substitute['IFDEF'] = '#if REGAL_DRIVER\n\n'
    substitute['ENDIF'] = '#endif\n'

    outputCode('%s/RegalDispatchLoader.cpp' % args.srcdir,
               dispatchSourceTemplate.substitute(substitute))
コード例 #16
0
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[
        'API_DISPATCH_GLOBAL_FUNC_INIT'] = apiDispatchGlobalFuncInitCode(
            apis, args, 'missing')
    substitute['IFDEF'] = ''
    substitute['ENDIF'] = ''

    outputCode('%s/RegalDispatchMissing.cpp' % args.srcdir,
               dispatchSourceTemplate.substitute(substitute))