Public API Reference

csplugincommon/shader/shaderprogram.h File Reference

Base class for iShaderProgram plugins. More...

#include "csextern.h"
#include "csgfx/shadervararrayhelper.h"
#include "csutil/array.h"
#include "csutil/dirtyaccessarray.h"
#include "csutil/leakguard.h"
#include "csutil/ref.h"
#include "csutil/scf_implementation.h"
#include "csutil/strhash.h"
#include "imap/services.h"
#include "iutil/document.h"
#include "iutil/strset.h"
#include "iutil/vfs.h"
#include "csplugincommon/shader/shaderplugin.h"
#include "csplugincommon/shader/shaderprogram.tok"
#include "cstool/tokenlist.h"

Go to the source code of this file.


class  csShaderProgram
 Base class for iShaderProgram plugins. More...
struct  csShaderProgram::ProgramParam
 Program parameter, either a SV reference or a const value. More...
struct  csShaderProgram::VariableMapEntry
 Holder of variable mapping. More...


Token list helper macros

The macros here provide an easy way to automatically build a token list useful for e.g.

parsers. The list of tokens have to be declared in an external file, with each token the argument to a 'CS_TOKEN_LIST_TOKEN()' invocation. The name of the file (full path!) has to be put in a macro named CS_TOKEN_ITEM_FILE. Optionally, the name of the function to initialize the token table can be set via CS_INIT_TOKEN_TABLE_NAME; the default is 'InitTokenTable'. In addition to invoking the initialization function to populate the string hash, an enumeration is also created. Elements of the enumeration are named XMLTOKEN_FOO (where 'FOO' represents the argument to CS_TOKEN_LIST_TOKEN()). If you prefer a prefix other than 'XMLTOKEN_', define CS_TOKEN_LIST_TOKEN_PREFIX with the prefix of your choice. As a convenience, in addition to entries for each CS_TOKEN_LIST_TOKEN invocation, a final item is added to the enumeration with the name provided by CS_TOKEN_LIST_TOKEN_LAST. If you do not #define this macro, then the name XMLTOKEN_TOKEN_COUNT is given to the last item in the enumeration. This value will equate to the count of items in the enumeration (not including this automatically added item).

Note that the client defines CS_TOKEN_ITEM_FILE, CS_INIT_TOKEN_TABLE_NAME, CS_TOKEN_LIST_TOKEN_PREFIX, and CS_TOKEN_LIST_TOKEN_LAST, and they will not be undefined by this file; hence, if you want to build multiple token lists, you may redefine those macros and include <cstool/tokenlist.h> again.

The code generated by the macros has a dependency on csString, thus the <csutil/csstring.h> header must be included in files that use the token list helpers.

Example (from a real-world use): fire.tok:



 #include <csutil/csstring.h>

 class csFireLoader
   csStringHash tokens;
 #define CS_TOKEN_ITEM_FILE "plugins/proctex/standard/fire.tok"
 #include "cstool/tokenlist.h"


 csFireLoader::csFireLoader(iBase *p)
   InitTokenTable (tokens);
 // ...

 csPtr<iBase> csFireLoader::Parse (iDocumentNode* node, 
                                     iLoaderContext* ldr_context,
                                     iBase* context)
 // ...
   csStringID id = tokens.Request (child->GetValue ());
   switch (id)
       // ...
 // ...

 A token list entry.

Detailed Description

Base class for iShaderProgram plugins.

Token list helper macros.

Definition in file shaderprogram.h.

Generated for Crystal Space 2.0 by doxygen 1.6.1