コード例 #1
0
print """
/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY expando.py SCRIPT */
#include <stdio.h>
#include "cr_error.h"
#include "cr_spu.h"
#include "cr_dlm.h"
#include "expandospu.h"
"""

allFunctions = []
generatedFunctions = []

for func_name in apiutil.GetDispatchedFunctions(sys.argv[1] + "/APIspec.txt"):
    if apiutil.FindSpecial("expando", func_name):
        allFunctions.append(func_name)
    elif apiutil.CanCompile(func_name) or apiutil.SetsClientState(func_name):
        generatedFunctions.append(func_name)
        allFunctions.append(func_name)

for func_name in generatedFunctions:
    params = apiutil.Parameters(func_name)
    return_type = apiutil.ReturnType(func_name)
    basicCallString = apiutil.MakeCallString(params)
    declarationString = apiutil.MakeDeclarationString(params)
    dlmCallString = basicCallString
    chromiumProps = apiutil.ChromiumProps(func_name)

    needClientState = 0
    if apiutil.UsesClientState(func_name):
        dlmCallString = basicCallString + ", clientState"
        needClientState = 1
コード例 #2
0
        if functionPacks:
            functionUsesClientState = 1
            packerParamsString = functionParamsString + ", &(clientState->unpack)"
        if functionCouldDL:
            functionUsesClientState = 1
            dlmParamsString = functionParamsString + ", clientState"

    # glMaterial* calls annoying
    if func_name[0:8] == "Material":
        functionTracksState = 1

    # If you set tracked state we'll (obviously) call the state tracker.
    # Client side state changes stay here
    if apiutil.SetsTrackedState(func_name):
        functionTracksState = 1
        if apiutil.SetsClientState(func_name):
            functionPacks = 0

    # At this point we now the needs of this call in terms of state
    # setting, DLM, packing, flushingm and return values. If you don't
    # need anything, bye bye.
    # Otherwise skip this function.
    if not functionCouldDL and not functionUsesClientState and not functionFlushes and not functionTracksState and not functionReadsBack and functionPacks:
        continue

    # Function header
    print '%s PACKSPU_APIENTRY packspu_%s( %s )' % (
        return_type, func_name, apiutil.MakeDeclarationString(params))
    print '{'
    # Silence compiler warnings
    if not ((func_name == "DeleteFencesNV") or