Пример #1
0
def generateEmuSource(apis, args):

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

    emuLocalInclude = '''

#include "RegalBin.h"
#include "RegalEmu.h"
#include "RegalPpa.h"
#include "RegalIff.h"
#include "RegalMarker.h"
#include "RegalObj.h"
#include "RegalDsa.h"
#include "RegalVao.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['IFDEF'] = '#if REGAL_EMULATION\n\n'
    substitute['ENDIF'] = '#endif\n'

    outputCode('%s/RegalDispatchEmu.cpp' % args.outdir,
               dispatchSourceTemplate.substitute(substitute))
Пример #2
0
def generateEnumHeader(apis, args):

    regalEnumSet = set()
    regalEnum = []

    for i in apis:
        if i.name == 'gl':
            for enum in i.enums:
                if enum.name == 'defines':
                    for enumerant in enum.enumerantsByName:
                        if not enumerant.name in regalEnumSet:
                            regalEnumSet.add(enumerant.name)
                            regalEnum.append(enumerant.name)

    # GL_TIMEOUT_IGNORED 0xffffffffffffffff can't be represented as an enum

    regalEnum = [
        '   R%s = %s,' % (i, i) for i in regalEnum
        if i not in ['GL_TIMEOUT_IGNORED', 'GL_TIMEOUT_IGNORED_APPLE']
    ]

    substitute = {}
    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['REGAL_ENUM'] = '\n'.join(regalEnum)
    substitute['HEADER_NAME'] = "REGAL_ENUM"

    outputCode('%s/RegalEnum.h' % args.srcdir,
               enumHeaderTemplate.substitute(substitute))
Пример #3
0
def generateEnumHeader(apis, args):

  regalEnumSet = set()
  regalEnum = []

  for i in apis:
    if i.name == 'gl':
      for enum in i.enums:
        if enum.name == 'defines':
          for enumerant in enum.enumerantsByName:
            if not enumerant.name in regalEnumSet:
              regalEnumSet.add(enumerant.name)
              regalEnum.append(enumerant.name)

  # GL_TIMEOUT_IGNORED 0xffffffffffffffff can't be represented as an enum

  regalEnum = [ '   R%s = %s,'%(i,i) for i in regalEnum if i not in [ 'GL_TIMEOUT_IGNORED', 'GL_TIMEOUT_IGNORED_APPLE' ] ]

  substitute = {}
  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['COPYRIGHT']     = args.copyright
  substitute['REGAL_ENUM']    = '\n'.join(regalEnum)
  substitute['HEADER_NAME']   = "REGAL_ENUM"

  outputCode( '%s/RegalEnum.h' % args.srcdir, enumHeaderTemplate.substitute(substitute))
Пример #4
0
def generateEmuSource(apis, args):

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

  emuLocalInclude = '''

#include "RegalBin.h"
#include "RegalEmu.h"
#include "RegalPpa.h"
#include "RegalIff.h"
#include "RegalMarker.h"
#include "RegalObj.h"
#include "RegalDsa.h"
#include "RegalVao.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['IFDEF'] = '#if REGAL_EMULATION\n\n'
  substitute['ENDIF'] = '#endif\n'

  outputCode( '%s/RegalDispatchEmu.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
Пример #5
0
def generateLookupHeader(apis, args):

    code = []

    for i in apis:

        if i.name in cond:
            code.append('#if %s' % cond[i.name])

        names = []
        for j in i.functions:
            names.append(j.name)

        lName = '%s_Name' % i.name
        lValue = '%s_Value' % i.name
        lOffset = '%s_Offset' % i.name
        lSize = len(names) + 1

        code.append('')
        code.append('extern const char * const %s[%d];' % (lName, lSize))
        code.append('extern const void *%s[%d];' % (lValue, lSize))
        code.append('extern const size_t %s[%d];' % (lOffset, lSize))

        code.append('''

template<typename T>
T
%s(const char *name, T def = NULL)
{
  const char **res = (const char **) std::bsearch(&name, %s, %d, sizeof(const char *), NameCmp);
  return res ? reinterpret_cast<T>(const_cast<void *>(%s[(size_t) (res - %s)])) : def;
}

''' % ('%s_Lookup' % i.name, lName, lSize - 1, lValue, lName))

        code.append('''

inline size_t %s(const char *name)
{
  const char **res = (const char **) std::bsearch(&name, %s, %d, sizeof(const char *), NameCmp);
  return res ? %s[(size_t) (res - %s)] : 0;
}

''' % ('%s_LookupOffset' % i.name, lName, lSize - 1, lOffset, lName))

        if i.name in cond:
            code.append('#endif')
        code.append('')

    substitute = {}

    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['HEADER_NAME'] = "REGAL_LOOKUP"
    substitute['CODE'] = '\n'.join(code)

    outputCode('%s/RegalLookup.h' % args.outdir,
               lookupHeaderTemplate.substitute(substitute))
Пример #6
0
def generateTokenHeader(apis, args):

  substitute = {}
  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['COPYRIGHT']     = args.copyright
  substitute['HEADER_NAME']   = "REGAL_TOKEN"
  outputCode( '%s/RegalToken.h' % args.srcdir, tokenHeaderTemplate.substitute(substitute))
Пример #7
0
def generateStatisticsSource(apis, args):

    substitute = {}
    substitute['LICENSE']        = args.license
    substitute['AUTOGENERATED']  = args.generated
    substitute['COPYRIGHT']      = args.copyright
    substitute['LOG']   = versionLogCode(apis,args)
    outputCode( '%s/RegalStatistics.cpp' % args.srcdir, statisticsSourceTemplate.substitute(substitute))
Пример #8
0
def generateTokenHeader(apis, args):

    substitute = {}
    substitute["LICENSE"] = args.license
    substitute["AUTOGENERATED"] = args.generated
    substitute["COPYRIGHT"] = args.copyright
    substitute["HEADER_NAME"] = "REGAL_TOKEN"
    outputCode("%s/RegalToken.h" % args.srcdir, tokenHeaderTemplate.substitute(substitute))
Пример #9
0
def generateTokenHeader(apis, args):

  substitute = {}
  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['COPYRIGHT']     = args.copyright
  substitute['HEADER_NAME']   = "REGAL_TOKEN"
  outputCode( '%s/RegalToken.h' % args.srcdir, tokenHeaderTemplate.substitute(substitute))
Пример #10
0
def generateStatisticsSource(apis, args):

    substitute = {}
    substitute["LICENSE"] = args.license
    substitute["AUTOGENERATED"] = args.generated
    substitute["COPYRIGHT"] = args.copyright
    substitute["LOG"] = versionLogCode(apis, args)
    outputCode("%s/RegalStatistics.cpp" % args.srcdir, statisticsSourceTemplate.substitute(substitute))
Пример #11
0
def generateLookupHeader(apis, args):

  code = []

  for i in apis:

    if i.name in cond:
      code.append( '#if %s'%cond[i.name] )

    names = []
    for j in i.functions:
      names.append( j.name )

    lName  = '%s_Name'%i.name
    lValue = '%s_Value'%i.name
    lOffset = '%s_Offset'%i.name
    lSize   = len(names)+1

    code.append( '' )
    code.append( 'extern const char * const %s[%d];'%(lName,lSize) )
    code.append( 'extern const void *%s[%d];'%(lValue,lSize) )
    code.append( 'extern const size_t %s[%d];'%(lOffset,lSize) )

    code.append('''

template<typename T>
T
%s(const char *name, T def = NULL)
{
  const char **res = (const char **) std::bsearch(&name, %s, %d, sizeof(const char *), NameCmp);
  return res ? reinterpret_cast<T>(const_cast<void *>(%s[(size_t) (res - %s)])) : def;
}

'''%('%s_Lookup'%i.name,lName,lSize-1,lValue,lName))

    code.append('''

inline size_t %s(const char *name)
{
  const char **res = (const char **) std::bsearch(&name, %s, %d, sizeof(const char *), NameCmp);
  return res ? %s[(size_t) (res - %s)] : 0;
}

'''%('%s_LookupOffset'%i.name,lName,lSize-1,lOffset,lName))

    if i.name in cond:
      code.append( '#endif' )
    code.append( '' )

  substitute = {}

  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['COPYRIGHT']     = args.copyright
  substitute['HEADER_NAME']   = "REGAL_LOOKUP"
  substitute['CODE']          = '\n'.join(code)

  outputCode( '%s/RegalLookup.h' % args.srcdir, lookupHeaderTemplate.substitute(substitute))
Пример #12
0
def generateEmuInfoHeader(apis, args):

    substitute = {}
    substitute['LICENSE']         = args.license
    substitute['AUTOGENERATED']   = args.generated
    substitute['COPYRIGHT']       = args.copyright
    substitute['HEADER_NAME']     = "REGAL_EMU_INFO"
    substitute['IMPL_DECLARE']    = emuInfoDeclareCode(apis,args)
    outputCode( '%s/RegalEmuInfo.h' % args.srcdir, emuInfoHeaderTemplate.substitute(substitute))
Пример #13
0
def generateContextInfoHeader(apis, args):

    substitute = {}
    substitute['LICENSE']         = args.license
    substitute['AUTOGENERATED']   = args.generated
    substitute['COPYRIGHT']       = args.copyright
    substitute['HEADER_NAME']     = "REGAL_CONTEXT_INFO"
    substitute['VERSION_DECLARE'] = versionDeclareCode(apis,args)
    outputCode( '%s/RegalContextInfo.h' % args.srcdir, contextInfoHeaderTemplate.substitute(substitute))
Пример #14
0
def generateStatisticsSource(apis, args):

    substitute = {}
    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['LOG'] = versionLogCode(apis, args)
    outputCode('%s/RegalStatistics.cpp' % args.srcdir,
               statisticsSourceTemplate.substitute(substitute))
Пример #15
0
def generateLookupSource(apis, args):

    code = []

    for i in apis:
        names = []
        for j in i.functions:
            names.append(j.name)

        regalOnly = set()
        for j in i.functions:
            if getattr(j, 'regalOnly', False) == True:
                regalOnly.add(j.name)

        if i.name in cond:
            code.append('#if %s' % cond[i.name])

        code.extend(
            pointerLookupByNameCode([(j, j) for j in names],
                                    ("%s_Name" % i.name, "%s_Value" % i.name),
                                    valueCast='(void *)(%s)'))

        #

        code.append('const size_t %s_Offset[%d] = {' %
                    (i.name, len(names) + 1))  # terminating NULL

        names.sort()

        # offset table
        table = "Dispatch::Global"
        if (i.name == "gl"):
            table = "Dispatch::GL"

        for j in names:
            if j in regalOnly:
                code.append("  0,")
            else:
                code.append("  offsetof(%s,%s)/sizeof(void *)," % (table, j))

        code.append('  0')
        code.append('};')
        code.append('')

        if i.name in cond:
            code.append('#endif')
        code.append('')

    substitute = {}

    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['CODE'] = '\n'.join(code)

    outputCode('%s/RegalLookup.cpp' % args.srcdir,
               lookupSourceTemplate.substitute(substitute))
Пример #16
0
def generateStatisticsHeader(apis, args):

    substitute = {}
    substitute['LICENSE']       = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT']     = args.copyright
    substitute['HEADER_NAME']   = "REGAL_STATISTICS"
    substitute['DECLARATIONS']  = versionDeclareCode(apis,args)
    outputCode( '%s/RegalStatistics.h' % args.srcdir, statisticsHeaderTemplate.substitute(substitute))
Пример #17
0
def generateStatisticsHeader(apis, args):

    substitute = {}
    substitute["LICENSE"] = args.license
    substitute["AUTOGENERATED"] = args.generated
    substitute["COPYRIGHT"] = args.copyright
    substitute["HEADER_NAME"] = "REGAL_STATISTICS"
    substitute["DECLARATIONS"] = versionDeclareCode(apis, args)
    outputCode("%s/RegalStatistics.h" % args.srcdir, statisticsHeaderTemplate.substitute(substitute))
Пример #18
0
def generateSystemHeader(apis, args):

    substitute = {}

    substitute["LICENSE"] = args.license
    substitute["AUTOGENERATED"] = args.generated
    substitute["REGAL_SYS"] = regalSys
    substitute["HEADER_NAME"] = "REGAL_SYSTEM"

    outputCode("%s/RegalSystem.h" % args.srcdir, systemTemplate.substitute(substitute))
Пример #19
0
def generateEmuInfoHeader(apis, args):

    substitute = {}
    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['HEADER_NAME'] = "REGAL_EMU_INFO"
    substitute['IMPL_DECLARE'] = emuInfoDeclareCode(apis, args)
    outputCode('%s/RegalEmuInfo.h' % args.srcdir,
               emuInfoHeaderTemplate.substitute(substitute))
Пример #20
0
def generateContextInfoHeader(apis, args):

    substitute = {}
    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['HEADER_NAME'] = "REGAL_CONTEXT_INFO"
    substitute['VERSION_DECLARE'] = versionDeclareCode(apis, args)
    outputCode('%s/RegalContextInfo.h' % args.outdir,
               contextInfoHeaderTemplate.substitute(substitute))
Пример #21
0
def generateSystemHeader(apis, args):

  substitute = {}

  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['REGAL_SYS']     = regalSys
  substitute['HEADER_NAME']   = "REGAL_SYSTEM"

  outputCode( '%s/RegalSystem.h' % args.srcdir, systemTemplate.substitute(substitute))
Пример #22
0
def generateSystemHeader(apis, args):

  substitute = {}

  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['REGAL_SYS']     = regalSys
  substitute['HEADER_NAME']   = "REGAL_SYSTEM"

  outputCode( '%s/RegalSystem.h' % args.srcdir, systemTemplate.substitute(substitute))
Пример #23
0
def generateStatisticsHeader(apis, args):

    substitute = {}
    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['HEADER_NAME'] = "REGAL_STATISTICS"
    substitute['DECLARATIONS'] = versionDeclareCode(apis, args)
    outputCode('%s/RegalStatistics.h' % args.srcdir,
               statisticsHeaderTemplate.substitute(substitute))
Пример #24
0
def generateEmuInfoSource(apis, args):

    substitute = {}
    substitute['LICENSE']        = args.license
    substitute['AUTOGENERATED']  = args.generated
    substitute['COPYRIGHT']      = args.copyright
    substitute['IMPL_INIT']      = emuInfoInitCode(apis,args)
    substitute['IMPL_GET']       = emuInfoGetCode(apis,args)
    substitute['GET_EXT']        = emuInfoGetExtensionCode(apis,args)
    outputCode( '%s/RegalEmuInfo.cpp' % args.srcdir, emuInfoSourceTemplate.substitute(substitute))
Пример #25
0
def generateLookupSource(apis, args):

  code = []

  for i in apis:
    names = []
    for j in i.functions:
      names.append(j.name)

    regalOnly = set()
    for j in i.functions:
      if getattr(j,'regalOnly',False)==True:
        regalOnly.add(j.name);

    if i.name in cond:
      code.append( '#if %s'%cond[i.name] )

    code.extend(pointerLookupByNameCode([ (j,j) for j in names ],("%s_Name"%i.name,"%s_Value"%i.name),valueCast = '(void *)(%s)'))

    #

    code.append( 'const size_t %s_Offset[%d] = {'       % (i.name, len(names)+1) ) # terminating NULL

    names.sort()

    # offset table
    table = "DispatchTableGlobal"
    if( i.name == "gl" ):
        table = "DispatchTable"

    for j in names:
      if j in regalOnly:
        code.append("  0,")
      else:
        if i.name == "gl":
          code.append("  offsetof(%s,%s)/sizeof(void *),"%(table,j))
        else:
          code.append("  ((char *)(&dispatchTableGlobal.%s)-(char *)(&dispatchTableGlobal))/sizeof(void *),"%(j))

    code.append( '  0')
    code.append('};')
    code.append('')

    if i.name in cond:
      code.append( '#endif' )
    code.append( '' )

  substitute = {}

  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['COPYRIGHT']     = args.copyright
  substitute['CODE']          = '\n'.join(code)

  outputCode( '%s/RegalLookup.cpp' % args.srcdir, lookupSourceTemplate.substitute(substitute))
Пример #26
0
def generateEmuInfoSource(apis, args):

    substitute = {}
    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['IMPL_INIT'] = emuInfoInitCode(apis, args)
    substitute['IMPL_GET'] = emuInfoGetCode(apis, args)
    substitute['GET_EXT'] = emuInfoGetExtensionCode(apis, args)
    outputCode('%s/RegalEmuInfo.cpp' % args.srcdir,
               emuInfoSourceTemplate.substitute(substitute))
Пример #27
0
def generateContextInfoSource(apis, args):

    substitute = {}
    substitute['LICENSE']        = args.license
    substitute['AUTOGENERATED']  = args.generated
    substitute['COPYRIGHT']      = args.copyright
    substitute['VERSION_INIT']   = versionInitCode(apis,args)
    substitute['VERSION_DETECT'] = versionDetectCode(apis,args)
    substitute['EXT_INIT']       = extensionStringCode(apis,args)
    substitute['EXT_CODE']       = getExtensionCode(apis,args)
    outputCode( '%s/RegalContextInfo.cpp' % args.srcdir, contextInfoSourceTemplate.substitute(substitute))
Пример #28
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))
Пример #29
0
def generateContextInfoSource(apis, args):

    substitute = {}
    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright
    substitute['VERSION_INIT'] = versionInitCode(apis, args)
    substitute['VERSION_DETECT'] = versionDetectCode(apis, args)
    substitute['EXT_INIT'] = extensionStringCode(apis, args)
    substitute['EXT_CODE'] = getExtensionCode(apis, args)
    outputCode('%s/RegalContextInfo.cpp' % args.outdir,
               contextInfoSourceTemplate.substitute(substitute))
Пример #30
0
def generateDispatchHeader(apis, args):

  substitute = {}

  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright

  substitute['HEADER_NAME'] = 'REGAL_DISPATCH'
  substitute['API_GLOBAL_DISPATCH_TABLE_DEFINE'] = apiDispatchTableDefineCode(apis,args,['wgl','glx','cgl','egl'],'Global')
  substitute['API_DISPATCH_TABLE_DEFINE']        = apiDispatchTableDefineCode(apis,args,['gl'],'GL')

  outputCode( '%s/RegalDispatch.h' % args.srcdir, dispatchHeaderTemplate.substitute(substitute))
Пример #31
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))
Пример #32
0
def generateDispatchHeader(apis, args):

    substitute = {}

    substitute["LICENSE"] = args.license
    substitute["AUTOGENERATED"] = args.generated
    substitute["COPYRIGHT"] = args.copyright

    substitute["HEADER_NAME"] = "REGAL_DISPATCH"
    substitute["API_GLOBAL_DISPATCH_TABLE_DEFINE"] = apiDispatchTableDefineCode(
        apis, args, ["wgl", "glx", "cgl", "egl"], "Global"
    )
    substitute["API_DISPATCH_TABLE_DEFINE"] = apiDispatchTableDefineCode(apis, args, ["gl"], "GL")

    outputCode("%s/RegalDispatch.h" % args.srcdir, dispatchHeaderTemplate.substitute(substitute))
Пример #33
0
def generateGMockHeader(apis, args):
  defineAllMocks = '\n'.join(
      dispatchGMockDefineMockFragment(args)
      for args in generateGMockFunctionApi(apis))

  substitute = defaultdict(
      str,
      AUTOGENERATED=args.generated,
      LICENSE=args.license,
      COPYRIGHT=args.copyright,
      DISPATCH_NAME='GMock',
      API_DISPATCH_MOCK_DEFINE=defineAllMocks)

  outputCode(
      '%s/RegalDispatchGMock.h' % args.testdir,
      dispatchGMockHeaderTemplate.substitute(substitute))
Пример #34
0
def generateContextHeader(apis, args):

    emuForwardDeclare = ''
    emuMemberDeclare  = ''

    for i in emuRegal:
      if i.get('member')!=None:
        emuForwardDeclare += 'struct %s;\n' % i['type']
        emuMemberDeclare  += '  %-18s *%s;\n' % ( i['type'], i['member'] )

    emuForwardDeclare += '#if REGAL_EMULATION\n'
    emuMemberDeclare  += '#if REGAL_EMULATION\n'

    emuMemberDeclare += '  // Fixed function emulation\n'
    emuMemberDeclare += '  int emuLevel;\n'

    for i in emu:
      if i.get('member')!=None:
        if i['type']=='Emu::Iff':
          emuForwardDeclare += 'namespace Emu { struct Iff; };\n'
        elif i['type']=='Emu::So':
          emuForwardDeclare += 'namespace Emu { struct So; };\n'
        elif i['type']=='Emu::TexC':
          emuForwardDeclare += 'namespace Emu { struct TexC; };\n'
        elif i['type']=='Emu::Ppa':
          emuForwardDeclare += 'namespace Emu { struct Ppa; };\n'
        else:
          emuForwardDeclare += 'struct %s;\n' % i['type']
        emuMemberDeclare  += '  %-18s *%s;\n' % ( i['type'], i['member'] )

    emuForwardDeclare += '#endif\n'
    emuMemberDeclare  += '#endif\n'

    # Output

    substitute = {}

    substitute['LICENSE']       = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT']     = args.copyright

    substitute['HEADER_NAME'] = "REGAL_CONTEXT"

    substitute['EMU_FORWARD_DECLARE'] = emuForwardDeclare
    substitute['EMU_MEMBER_DECLARE'] = emuMemberDeclare

    outputCode( '%s/RegalContext.h' % args.srcdir, contextHeaderTemplate.substitute(substitute))
Пример #35
0
def generateDispatchHeader(apis, args):

    substitute = {}

    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright

    substitute['HEADER_NAME'] = 'REGAL_DISPATCH'
    substitute[
        'API_GLOBAL_DISPATCH_TABLE_DEFINE'] = apiDispatchTableDefineCode(
            apis, args, ['wgl', 'glx', 'cgl', 'egl'], 'Global')
    substitute['API_DISPATCH_TABLE_DEFINE'] = apiDispatchTableDefineCode(
        apis, args, ['gl'], 'GL')

    outputCode('%s/RegalDispatch.h' % args.srcdir,
               dispatchHeaderTemplate.substitute(substitute))
Пример #36
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['IFDEF'] = '#if REGAL_ERROR\n\n'
  substitute['ENDIF'] = '#endif\n'
  outputCode( '%s/RegalDispatchError.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
Пример #37
0
def generateContextHeader(apis, args):

    emuForwardDeclare = ''
    emuMemberDeclare = ''

    for i in emuRegal:
        if i.get('member') != None:
            emuForwardDeclare += 'struct %s;\n' % i['type']
            emuMemberDeclare += wrapIf(
                i['ifdef'],
                '  scoped_ptr<%-18s> %s;\n' % (i['type'], i['member']))

    emuForwardDeclare += '#if REGAL_EMULATION\n'
    emuMemberDeclare += '#if REGAL_EMULATION\n'

    emuMemberDeclare += '  // Fixed function emulation\n'
    emuMemberDeclare += '  int emuLevel;\n'

    for i in emu:
        if i.get('member') != None:
            if i['type'].startswith('Emu::'):
                emuForwardDeclare += 'namespace Emu { struct %s; };\n' % i[
                    'type'][5:]
            else:
                emuForwardDeclare += 'struct %s;\n' % i['type']
            emuMemberDeclare += '  scoped_ptr<%-18s> %s;\n' % (i['type'],
                                                               i['member'])

    emuForwardDeclare += '#endif\n'
    emuMemberDeclare += '#endif\n'

    # Output

    substitute = {}

    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright

    substitute['HEADER_NAME'] = "REGAL_CONTEXT"

    substitute['EMU_FORWARD_DECLARE'] = emuForwardDeclare
    substitute['EMU_MEMBER_DECLARE'] = emuMemberDeclare

    outputCode('%s/RegalContext.h' % args.srcdir,
               contextHeaderTemplate.substitute(substitute))
Пример #38
0
def generateLookupSource(apis, args):

  ret = []

  for i in apis:

    if len(i.functions)==0:
      continue

    code = []

    regalOnly = set( [ j.name for j in i.functions if getattr(j,'regalOnly',False)==True ] )

    # Special handling for Regal-only function lookup
    if i.name=='gl':
      names = [ j.name for j in i.functions if getattr(j,'regalOnly',False)==True or j.category=='GL_REGAL_ES1_0_compatibility']
#      code.extend(pointerLookupSource('regal',names))
#      code.extend(offsetLookupSource('regal',names,"Dispatch::GL",regalOnly))

    names = [ j.name for j in i.functions ]
    conditional = None
    if i.name in cond:
      conditional = cond[i.name]
    code.extend(pointerLookupSource(i.name,names))

    # offset table
    table = "Dispatch::Global"
    if i.name == "gl":
      table = "Dispatch::GL"

    code.extend(offsetLookupSource(i.name,names,table,regalOnly))

    if i.name in cond:
      conditional = cond[i.name]
      code = wrapIf(conditional,code)

    ret.extend(code)

  substitute = {}

  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['COPYRIGHT']     = args.copyright
  substitute['CODE']          = '\n'.join(ret)

  outputCode( '%s/RegalLookup.cpp' % args.srcdir, lookupSourceTemplate.substitute(substitute))
Пример #39
0
def generateSource(apis, args):

  # CodeGen for API functions.

  apiFuncDefine = apiFuncDefineCode( apis, args )
  globalDispatch = apiGlobalDispatchFuncInitCode( apis, args )

  # Output

  substitute = {}
  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright
  substitute['API_FUNC_DEFINE'] = apiFuncDefine
  substitute['API_GLOBAL_DISPATCH_INIT'] = globalDispatch

  outputCode( '%s/Regal.cpp' % args.srcdir, sourceTemplate.substitute(substitute))
Пример #40
0
def generateSource(apis, args):

  # CodeGen for API functions.

  apiFuncDefine = apiFuncDefineCode( apis, args )
  globalDispatch = apiGlobalDispatchFuncInitCode( apis, args )

  # Output

  substitute = {}
  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright
  substitute['API_FUNC_DEFINE'] = apiFuncDefine
  substitute['API_GLOBAL_DISPATCH_INIT'] = globalDispatch

  outputCode( '%s/Regal.cpp' % args.srcdir, sourceTemplate.substitute(substitute))
Пример #41
0
def generateDispatchHeader(apis, args):

  globalDispatchTableDefine = apiGlobalDispatchTableDefineCode( apis, args )
  dispatchTableDefine = apiDispatchTableDefineCode(apis, args)

  # Output

  substitute = {}

  substitute['LICENSE']         = args.license
  substitute['AUTOGENERATED']   = args.generated
  substitute['COPYRIGHT']       = args.copyright

  substitute['HEADER_NAME'] = 'REGAL_DISPATCH'
  substitute['API_GLOBAL_DISPATCH_TABLE_DEFINE'] = globalDispatchTableDefine
  substitute['API_DISPATCH_TABLE_DEFINE'] = dispatchTableDefine

  outputCode( '%s/RegalDispatch.h' % args.outdir, dispatchHeaderTemplate.substitute(substitute))
Пример #42
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['IFDEF'] = ''
  substitute['ENDIF'] = ''

  outputCode( '%s/RegalDispatchMissing.cpp' % args.srcdir, dispatchSourceTemplate.substitute(substitute))
Пример #43
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))
Пример #44
0
def generateStaticEGLSource(apis, args):

    code = '\n'

    code += '#ifndef REGAL_NAMESPACE\n'
    code += '#error REGAL_STATIC_EGL requires REGAL_NAMESPACE\n'
    code += '#endif\n\n'

    for api in apis:
        if api.name == 'egl':

            for function in api.functions:
                name = function.name
                code += '#undef %s\n' % (name)

            code += '\n'
            code += 'extern "C"\n'
            code += '{\n'

            for function in api.functions:
                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'] = 'StaticEGL'
    substitute['LOCAL_INCLUDE'] = code
    substitute['LOCAL_CODE'] = ''
    substitute['API_DISPATCH_FUNC_DEFINE'] = ''
    substitute['API_DISPATCH_FUNC_INIT'] = apiStaticEGLFuncInitCode(apis, args)
    substitute[
        'IFDEF'] = '#if REGAL_SYS_EGL && REGAL_DRIVER && REGAL_STATIC_EGL\n\n'
    substitute['ENDIF'] = '#endif\n'

    outputCode('%s/RegalDispatchStaticEGL.cpp' % args.outdir,
               dispatchGlobalSourceTemplate.substitute(substitute))
Пример #45
0
def generateDispatchHeader(apis, args):

    globalDispatchTableDefine = apiGlobalDispatchTableDefineCode(apis, args)
    dispatchTableDefine = apiDispatchTableDefineCode(apis, args)

    # Output

    substitute = {}

    substitute['LICENSE'] = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT'] = args.copyright

    substitute['HEADER_NAME'] = 'REGAL_DISPATCH'
    substitute['API_GLOBAL_DISPATCH_TABLE_DEFINE'] = globalDispatchTableDefine
    substitute['API_DISPATCH_TABLE_DEFINE'] = dispatchTableDefine

    outputCode('%s/RegalDispatch.h' % args.outdir,
               dispatchHeaderTemplate.substitute(substitute))
Пример #46
0
def generateLookupSource(apis, args):

  ret = []

  for i in apis:

    code = []

    regalOnly = set( [ j.name for j in i.functions if getattr(j,'regalOnly',False)==True ] )

    # Special handling for Regal-only function lookup
    if i.name=='gl':
      names = [ j.name for j in i.functions if getattr(j,'regalOnly',False)==True or j.category=='GL_REGAL_ES1_0_compatibility']
#      code.extend(pointerLookupSource('regal',names))
#      code.extend(offsetLookupSource('regal',names,"Dispatch::GL",regalOnly))

    names = [ j.name for j in i.functions ]
    conditional = None
    if i.name in cond:
      conditional = cond[i.name]
    code.extend(pointerLookupSource(i.name,names))

    # offset table
    table = "Dispatch::Global"
    if i.name == "gl":
      table = "Dispatch::GL"

    code.extend(offsetLookupSource(i.name,names,table,regalOnly))

    if i.name in cond:
      conditional = cond[i.name]
      code = wrapIf(conditional,code)

    ret.extend(code)

  substitute = {}

  substitute['LICENSE']       = args.license
  substitute['AUTOGENERATED'] = args.generated
  substitute['COPYRIGHT']     = args.copyright
  substitute['CODE']          = '\n'.join(ret)

  outputCode( '%s/RegalLookup.cpp' % args.srcdir, lookupSourceTemplate.substitute(substitute))
Пример #47
0
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))
Пример #48
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))
Пример #49
0
def generatePublicHeader(apis, args):

  apiTypedef     = apiTypedefCode( apis, args )
  apiEnum        = apiEnumCode(apis, args)                 # CodeGen for API enums
  apiFuncDeclare = apiFuncDeclareCode( apis, args )        # CodeGen for API functions

  # Output

  substitute = {}
  substitute['LICENSE']          = args.license
  substitute['AUTOGENERATED']    = args.generated
  substitute['COPYRIGHT']        = args.copyright
  substitute['HEADER_NAME']      = "REGAL"
  substitute['REGAL_SYS']        = regalSys
  substitute['API_TYPEDEF']      = apiTypedef
  substitute['API_ENUM']         = apiEnum
  substitute['API_FUNC_DECLARE'] = apiFuncDeclare

  outputCode( '%s/Regal.h' % args.incdir, publicHeaderTemplate.substitute(substitute))
Пример #50
0
def generatePublicHeader(apis, args):

  apiTypedef     = apiTypedefCode( apis, args )
  apiEnum        = apiEnumCode(apis, args)                 # CodeGen for API enums
  apiFuncDeclare = apiFuncDeclareCode( apis, args )        # CodeGen for API functions

  # Output

  substitute = {}
  substitute['LICENSE']          = args.license
  substitute['AUTOGENERATED']    = args.generated
  substitute['COPYRIGHT']        = args.copyright
  substitute['HEADER_NAME']      = "REGAL"
  substitute['REGAL_SYS']        = regalSys
  substitute['API_TYPEDEF']      = apiTypedef
  substitute['API_ENUM']         = apiEnum
  substitute['API_FUNC_DECLARE'] = apiFuncDeclare

  outputCode( '%s/Regal.h' % args.incdir, publicHeaderTemplate.substitute(substitute))
Пример #51
0
def generateContextHeader(apis, args):

    emuForwardDeclare = ''
    emuMemberDeclare  = ''

    for i in emuRegal:
      if i.get('member')!=None:
        emuForwardDeclare += 'struct %s;\n' % i['type']
        emuMemberDeclare  += wrapIf(i['ifdef'],'  scoped_ptr<%-18s> %s;\n' % ( i['type'], i['member'] ))


    emuForwardDeclare += '#if REGAL_EMULATION\n'
    emuMemberDeclare  += '#if REGAL_EMULATION\n'

    emuMemberDeclare += '  // Fixed function emulation\n'
    emuMemberDeclare += '  int emuLevel;\n'

    for i in emu:
      if i.get('member')!=None:
        if i['type'].startswith('Emu::'):
          emuForwardDeclare += 'namespace Emu { struct %s; };\n' % i['type'][5:]
        else:
          emuForwardDeclare += 'struct %s;\n' % i['type']
        emuMemberDeclare  += '  scoped_ptr<%-18s> %s;\n' % ( i['type'], i['member'] )

    emuForwardDeclare += '#endif\n'
    emuMemberDeclare  += '#endif\n'

    # Output

    substitute = {}

    substitute['LICENSE']       = args.license
    substitute['AUTOGENERATED'] = args.generated
    substitute['COPYRIGHT']     = args.copyright

    substitute['HEADER_NAME'] = "REGAL_CONTEXT"

    substitute['EMU_FORWARD_DECLARE'] = emuForwardDeclare
    substitute['EMU_MEMBER_DECLARE'] = emuMemberDeclare

    outputCode( '%s/RegalContext.h' % args.srcdir, contextHeaderTemplate.substitute(substitute))
Пример #52
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['IFDEF'] = ''
    substitute['ENDIF'] = ''

    outputCode('%s/RegalDispatchMissing.cpp' % args.outdir,
               dispatchSourceTemplate.substitute(substitute))
Пример #53
0
def generateDefFile(apis, args, additional_exports):

    code1 = []
    code2 = []
    code3 = []

    for i in apis:
        if i.name == 'wgl' or i.name == 'gl':
            for j in i.functions:
                code1.append('  %s' % j.name)
                code2.append('  r%s' % j.name)
        if i.name == 'cgl' or i.name == 'gl':
            for j in i.functions:
                code3.append('_%s' % j.name)
    code1.sort()
    code2.sort()
    code3.sort()

    code1.insert(0, '  SetPixelFormat')
    code2.insert(0, '  SetPixelFormat')

    # RegalMakeCurrent, RegalSetErrorCallback, etc

    code1 += ['  %s' % export for export in additional_exports]
    code2 += ['  %s' % export for export in additional_exports]
    code3 += ['_%s' % export for export in additional_exports]

    outputCode('%s/Regal.def' % args.srcdir, 'EXPORTS\n' + '\n'.join(code1))
    outputCode('%s/Regalm.def' % args.srcdir, 'EXPORTS\n' + '\n'.join(code2))
    outputCode('%s/export_list_mac.txt' % args.srcdir,
               '# File: export_list\n' + '\n'.join(code3))
Пример #54
0
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))
Пример #55
0
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))
Пример #56
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['IFDEF'] = '#if REGAL_DEBUG\n\n'
    substitute['ENDIF'] = '#endif\n'

    outputCode('%s/RegalDispatchDebug.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['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))
Пример #58
0
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))
Пример #59
0
def generateLoaderSource(apis, args):

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

  # Output

  substitute = {}

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

  outputCode( '%s/RegalDispatchLoader.cpp' % args.srcdir, loaderSourceTemplate.substitute(substitute))