072f0b86f23a38efb7454da3144cbce76805be76vboxsync# $Id$
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncimport sys, cPickle, re, os
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncsys.path.append( "../glapi_parser" )
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncimport apiutil
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync# mode is "header" or "defs"
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncmode = sys.argv[1]
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync# Any new function implemented in the DLM has to have an entry added here.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync# Each function has its return type, function name, and parameters provided.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync# We'll use these to generate both a header file, and a definition file.
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncadditionalFunctions = [
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('CRDLM DLM_APIENTRY *', 'crDLMNewDLM', 'unsigned int configSize, const CRDLMConfig *config'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('CRDLMContextState DLM_APIENTRY *', 'crDLMNewContext', 'CRDLM *dlm'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMFreeContext', 'CRDLMContextState *state'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMUseDLM', 'CRDLM *dlm'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY','crDLMFreeDLM', 'CRDLM *dlm'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMSetCurrentState', 'CRDLMContextState *state'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('CRDLMContextState DLM_APIENTRY *', 'crDLMGetCurrentState', 'void'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('CRDLMReplayState DLM_APIENTRY', 'crDLMGetReplayState', 'void'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMSetupClientState', 'SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMRestoreClientState', 'CRClientState *clientState, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMSendAllDLMLists', 'CRDLM *dlm, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMSendAllLists', 'SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMSendDLMList', 'CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMSendList', 'unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMReplayDLMList', 'CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMReplayList', 'unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMReplayDLMListState', 'CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMReplayListState', 'unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMReplayDLMLists', 'CRDLM *dlm, GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMReplayLists', 'GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMReplayDLMListsState', 'CRDLM *dlm, GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMReplayListsState', 'GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('CRDLMError DLM_APIENTRY', 'crDLMDeleteListContent', 'CRDLM *dlm, unsigned long listIdentifier'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('int DLM_APIENTRY', 'crDLMGetReferences', 'CRDLM *dlm, unsigned long listIdentifier, int firstIndex, int sizeofBuffer, unsigned int *buffer'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('CRDLMError DLM_APIENTRY', 'crDLMGetDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier, CRDLMBounds *bounds'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('CRDLMError DLM_APIENTRY', 'crDLMGetBounds', 'unsigned long listIdentifier, CRDLMBounds *bounds'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMSetDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMSetBounds', 'unsigned long listIdentifier, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMComputeBoundingBox', 'unsigned long listId'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('GLboolean DLM_APIENTRY', 'crDLMListHasDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('GLboolean DLM_APIENTRY', 'crDLMListHasBounds', 'unsigned long listIdentifier'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('GLuint DLM_APIENTRY', 'crDLMGetCurrentList', 'void'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('GLenum DLM_APIENTRY', 'crDLMGetCurrentMode', 'void'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMErrorFunction', 'CRDLMErrorCallback callback'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMNewList', 'GLuint listIdentifier, GLenum mode'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMEndList', 'void'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMDeleteLists', 'GLuint firstListIdentifier, GLsizei range'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('GLboolean DLM_APIENTRY', 'crDLMIsList', 'GLuint list'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('GLuint DLM_APIENTRY', 'crDLMGenLists', 'GLsizei range'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ('void DLM_APIENTRY', 'crDLMListBase', 'GLuint base'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync #('void DLM_APIENTRY', 'crDLMListSent', 'CRDLM *dlm, unsigned long listIdentifier'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync #('GLboolean DLM_APIENTRY', 'crDLMIsListSent', 'CRDLM *dlm, unsigned long listIdentifier'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync #('GLint DLM_APIENTRY', 'crDLMListSize', 'CRDLM *dlm, unsigned long listIdentifier'),
072f0b86f23a38efb7454da3144cbce76805be76vboxsync]
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncif mode == 'header':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print """#ifndef CR_DLM_H
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* DO NOT EDIT. This file is auto-generated by %s. */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#define CR_DLM_H
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#if defined(WINDOWS)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#define DLM_APIENTRY
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#else
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#define DLM_APIENTRY
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#endif
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "chromium.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "state/cr_client.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "cr_spu.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "cr_hash.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "cr_threads.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "cr_pack.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#ifdef CHROMIUM_THREADSAFE
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "cr_threads.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#endif
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* 3D bounding box */
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef struct {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync double xmin, xmax, ymin, ymax, zmin, zmax;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync} CRDLMBounds;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* Indicates whether we're currently involved in playback or not */
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef enum {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLM_IMMEDIATE = 0,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLM_REPLAY_STATE_FUNCTIONS = 1,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLM_REPLAY_ALL_FUNCTIONS = 2
072f0b86f23a38efb7454da3144cbce76805be76vboxsync} CRDLMReplayState;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* This is enough information to hold an instance of a single function call. */
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef struct DLMInstanceList {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync struct DLMInstanceList *next;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync struct DLMInstanceList *stateNext;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync void (*execute)(struct DLMInstanceList *instance, SPUDispatchTable *dispatchTable);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync} DLMInstanceList;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef struct {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLMInstanceList *first, *last;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync int numInstances;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLMInstanceList *stateFirst, *stateLast;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRHashTable *references; /* display lists that this display list calls */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLMBounds bbox;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync GLboolean listSent;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync} DLMListInfo;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef struct {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* This holds all the display list information, hashed by list identifier. */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRHashTable *displayLists;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* This is a count of the number of contexts/users that are using
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * this DLM.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync unsigned int userCount;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#ifdef CHROMIUM_THREADSAFE
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* This mutex protects the displayLists hash table from simultaneous
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * updates by multiple contexts.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRmutex dlMutex;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRtsd tsdKey;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#endif
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* Configuration information - see the CRDLMConfig structure below
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * for details.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync unsigned int bufferSize;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync} CRDLM;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* This structure holds thread-specific state. Each thread can be
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * associated with one (and only one) context; and each context can
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * be associated with one (and only one) DLM. Making things interesting,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * though, is that each DLM can be associated with multiple contexts.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync *
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * So the thread-specific data key is associated with each context, not
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * with each DLM. Two different threads can, through two different
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * contexts that share a single DLM, each have independent state and
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * conditions.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef struct {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLM *dlm; /* the DLM associated with this state */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync unsigned long currentListIdentifier; /* open display list */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLMListInfo *currentListInfo; /* open display list data */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync GLenum currentListMode; /* GL_COMPILE or GL_COMPILE_AND_EXECUTE */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync GLuint listBase;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLMReplayState replayState; /* CRDLM_IMMEDIATE, CRDLM_REPLAY_STATE_FUNCTIONS, or CRDLM_REPLAY_ALL_FUNCTIONS */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync} CRDLMContextState;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* These additional structures are for passing information to and from the
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * CRDLM interface routines.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef struct {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* The size, in bytes, that the packer will initially allocate for
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * each new buffer.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#define CRDLM_DEFAULT_BUFFERSIZE (1024*1024)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync unsigned int bufferSize; /* this will be allocated for each buffer */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync} CRDLMConfig;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* Positive values match GL error values.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * 0 (GL_NO_ERROR) is returned for success
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * Negative values are internal errors.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * Possible positive values (from GL/gl.h) are:
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * GL_NO_ERROR (0x0)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * GL_INVALID_ENUM (0x0500)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * GL_INVALID_VALUE (0x0501)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * GL_INVALID_OPERATION (0x0502)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * GL_STACK_OVERFLOW (0x0503)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * GL_STACK_UNDERFLOW (0x0504)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * GL_OUT_OF_MEMORY (0x0505)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef int CRDLMError;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* This error reported if there's no current state. The caller is responsible
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * for appropriately allocating context state with crDLMNewContext(), and
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * for making it current with crDLMMakeCurrent().
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#define CRDLM_ERROR_STATE (-1)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsynctypedef void (*CRDLMErrorCallback)(int line, const char *file, GLenum error, const char *info);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#ifdef __cplusplus
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncextern "C" {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#endif
072f0b86f23a38efb7454da3144cbce76805be76vboxsync""" % os.path.basename(sys.argv[0])
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncelif mode == 'defs':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync apiutil.CopyrightDef()
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print '''\t; DO NOT EDIT. This code is generated by %s.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncEXPORTS''' % os.path.basename(sys.argv[0])
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncelse:
072f0b86f23a38efb7454da3144cbce76805be76vboxsync raise "unknown generation mode '%s'" % mode
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync# Generate the list of functions, starting with those coded into
072f0b86f23a38efb7454da3144cbce76805be76vboxsync# the module
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncfor (returnValue, name, parameters) in additionalFunctions:
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if mode == 'header':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print "extern %s %s(%s);" % (returnValue, name, parameters)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync elif mode == 'defs':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print "%s" % name
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync# Continue with functions that are auto-generated.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncif mode == 'header':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print "/* auto-generated compilation functions begin here */"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsynckeys = apiutil.GetDispatchedFunctions(sys.argv[2]+"/APIspec.txt")
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncfor func_name in keys:
072f0b86f23a38efb7454da3144cbce76805be76vboxsync props = apiutil.Properties(func_name)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync # We're interested in intercepting all calls that:
072f0b86f23a38efb7454da3144cbce76805be76vboxsync # - can be put into a display list (i.e. "not ("nolist" in props)")
072f0b86f23a38efb7454da3144cbce76805be76vboxsync # - change client-side state that affects saving DL elements (i.e. "setclient" in props)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if apiutil.CanCompile(func_name):
072f0b86f23a38efb7454da3144cbce76805be76vboxsync params = apiutil.Parameters(func_name)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync argstring = apiutil.MakeDeclarationString(params)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if "useclient" in props or "pixelstore" in props:
072f0b86f23a38efb7454da3144cbce76805be76vboxsync argstring = argstring + ", CRClientState *c"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if mode == 'header':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print 'extern void DLM_APIENTRY crDLMCompile%s( %s );' % (func_name, argstring)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync elif mode == 'defs':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print "crDLMCompile%s" % func_name
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync# Next make declarations for all the checklist functions.
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncif mode == 'header':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print """
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* auto-generated CheckList functions begin here. There is one for each
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * function that has a dual nature: even when there's an active glNewList,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * sometimes they are compiled into the display list, and sometimes they
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * are treated like a control function. The CheckList function will
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * return TRUE if the function should really be compiled into a display
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * list. The calling SPU is responsible for checking this; but the
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * DLM will also print an error if it detects an invalid use.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync"""
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncelif mode == 'defs':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync pass
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncfor func_name in keys:
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if "checklist" in apiutil.ChromiumProps(func_name):
072f0b86f23a38efb7454da3144cbce76805be76vboxsync params = apiutil.Parameters(func_name)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync argstring = apiutil.MakeDeclarationString(params)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if mode == 'header':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print 'int DLM_APIENTRY crDLMCheckList%s( %s );' % (func_name, argstring)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync elif mode == 'defs':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print "crDLMCheckList%s" % func_name
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncif mode == 'header':
072f0b86f23a38efb7454da3144cbce76805be76vboxsync print """
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#ifdef __cplusplus
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#endif
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#endif /* CR_DLM_H */"""