C Binding

C Binding

In this document, the RenderMan Interface is described in the ANSI C language.


C Binding

All types, procedures, tokens, predefined variables and utility procedures mentioned in this document are required to be present in all C implementations that conform to this specification. The C header file that declares all of these required names, ri.h, is presented below.

The RenderMan Interface requires the following types:

typedef short       RtBoolean;
typedef int         RtInt;
typedef float       RtFloat;
typedef char        *RtToken;
typedef RtFloat     RtColor[3];
typedef RtFloat     RtPoint[3];
typedef RtFloat     RtVector[3];
typedef RtFloat     RtNormal[3];
typedef RtFloat     RtHpoint[4];
typedef RtFloat     RtMatrix[4][4];
typedef RtFloat     RtBasis[4][4];
typedef RtFloat     RtBound[6];
typedef char        *RtString;
typedef void        *RtPointer;
typedef void        RtVoid;
typedef RtFloat     (RtFilterFunc)(RtFloat, RtFloat, RtFloat, RtFloat);
typedef RtFloat     (RtErrorHandler)(RtInt, RtInt, char *);
typedef RtFloat     (RtProcSubdivFunc)(RtPointer, RtFloat);
typedef RtFloat     (RtProcFreeFunc)(RtPointer);
typedef RtFloat     (RtArchiveCallback)(RtToken, char *, ...);
typedef RtPointer   RtObjectHandle;
typedef RtPointer   RtLightHandle;
typedef RtPointer   RtContextHandle;

All procedures and values defined in the interface are prefixed with Ri (for RenderMan Interface). All types are prefixed with Rt (for RenderMan type). Boolean values are either RI_FALSE or RI_TRUE. Special floating point values RI_INFINITY and RI_EPSILON are defined. The expression -RI_INFINITY has the obvious meaning. The number of components in a color is initially three, but can be changed (See Additional options). A bound is a bounding box and is specified by 6 floating point values in the order xmin, xmax, ymin, ymax, zmin, zmax. A matrix is an array of 16 numbers describing a 4 by 4 transformation matrix. All multidimensional arrays are specified in row-major order. For example, a 4 by 4 translation matrix to the location (2,3,4) is specified with:

{{ 1.0, 0.0, 0.0, 0.0},
 { 0.0, 1.0, 0.0, 0.0},
 { 0.0, 0.0, 1.0, 0.0},
 { 2.0, 3.0, 4.0, 1.0} }

Tokens are strings that have a special meaning to procedures implementing the interface. These meanings are described with each procedure. The capabilities of the RenderMan Interface can be extended by defining new tokens and passing them to various procedures. The most important of these are the tokens identifying variables defined by procedures called shaders, written in the Shading Language. Variables passed through the RenderMan Interface are bound by name to shader variables. To make the standard pre-declared tokens and user-defined tokens similar, RenderMan Interface tokens are represented by strings. Associated with each of the standard predefined tokens, however, is a predefined string constant that the RenderMan Interface procedures can use for efficient parsing. The names of these string constants are derived from the token names used in this document by pre-pending an RI_ to a capitalized version of the string. For example, the predefined constant token for "rgb" is RI_RGB. The special predefined token RI_NULL is used to specify a null token.

In the C binding presented in this document, parameters are passed by value or by reference. C implementations of the RenderMan Interface are expected to make copies of any parameters whose values are to be retained across procedure invocations.

Many procedures in the RenderMan Interface have variable length parameter lists. These are indicated by the syntactical construct parameterlist in the procedure's argument list. In the C binding described, a parameterlist is a sequence of pairs of arguments, the first being an RtToken and the second being an RtPointer, an untyped pointer to an array of either RtFloat, RtString or other values. The list is terminated by the special token RI_NULL.

In addition, each such procedure has an alternate vector interface, which passes the parameterlist as three arguments: an RtInt indicating the length of the parameter list; an array of that length that contains the RtTokens; and another array of the same length that contains the RtPointers. This alternate procedure is denoted by appending an uppercase V to the procedure name.

For example the procedure RiFoo declared as

RiFoo ( ...parameterlist... )

could be called in the following ways:

RtColor colors;
RtPoint points;
RtFloat one_float;
RtToken tokens[3];
RtPointer values[3];
RiFoo ( RI_NULL );
RiFoo ((RtToken)"P", (RtPointer)points, (RtToken)"Cs", (RtPointer)colors,
       (RtToken)"Kd", (RtPointer)&one_float,; RI_NULL );
RiFoo (RI_P, (RtPointer)points, RI_CS, (RtPointer)colors,
       RI_KD, (RtPointer)&one_float, RI_NULL );
tokens[0] = RI_P; values[0] = (RtPointer)points;
tokens[1] = RI_CS; values[1] = (RtPointer)colors;
tokens[2] = RI_KD; values[2] = (RtPointer)&one_float;
RiFooV ( 3, tokens, values);

It is not the intent of this document to propose that other language bindings use an identical mechanism for passing parameter lists. For example, a Fortran or Pascal binding might pass parameters using four arguments: an integer indicating the length of the parameter list, an array of that length that contains the tokens, an array of the same length containing integer indices into the final array containing the real values. A Common Lisp binding would be particularly simple because it has intrinsic support for variable length argument lists.

The ANSI Standard C binding of RenderMan Interface is different from the K&R C binding presented in the document only in the normally expected ways. The semantics of the types, procedures and predefined variables are identical, and the necessary function prototype modifications are presented in a version of ri.h, below.

There may be more than one rendering context. This would allow a program to, for example, output to multiple RIB files. RenderMan Interface procedure calls apply to the currently active context. At any one time, there is at most one globally active rendering context. The RenderMan Interface is not intended to be reentrant. In other words, the active context is truly global to a program process, and there cannot be multiple simultaneous threads in one process, each with a different active context. Following is an example of writing to multiple contexts, in which a sphere is written to one RIB file and a cylinder is written to a different RIB file (the semantics of the context switching routines are presented in the Graphics State documentation).

RtContextHandle ctx1, ctx2;
RiBegin ("file1.rib");
ctx1 = RiGetContext ( );
RiBegin ("file2.rib");
ctx2 = RiGetContext ( );
...
RiContext (ctx1);
RiSphere (1, -1, 1, 360, RI NULL);
RiContext (ctx2);
RiCylinder (1, -1, 1, 360, RI NULL);
RiEnd ( ); /* Ends context 2 */
RiContext (ctx1);
...

There is no RIB equivalent for context switching. Additionally, other language bindings may have no need for these routines, or may provide an obvious mechanism in the language for this facility (such as class instances and methods in C++).


ri.h

The following is the version of ri.h required for the ANSI-standard C binding of the RenderMan Interface. It differs from the previous version only in the expected ways.

/*
 *     RenderMan Interface Standard Include File
 *          (for ANSI Standard C)
 */


           /* Definitions of Abstract Types used in RI */

typedef int     RtInt;
typedef float   RtFloat;
typedef char    *RtToken;
typedef RtFloat RtColor[3];
typedef RtFloat RtPoint[3];
typedef RtFloat RtVector[3];
typedef RtFloat RtNormal[3];
typedef RtFloat Hpoint[4];
typedef RtFloat RtMatrix[4][4];
typedef RtFloat RtBasis[4][4];
typedef RtFloat RtBound[6];
typedef char    *RtString;
typedef void    *RtPointer;
#define RtVoid  void;
typedef RtFloat (*RtFilterFunc)(RtFloat, RtFloat, RtFloat, RtFloat);
typedef RtVoid  (*RtErrorHandler)(RtInt, RtInt, char *);
typedef RtVoid  (*RtProcSubdivFunc)(RtPointer, RtFloat);
typedef RtVoid  (*RtProcFreeFunc)(RtPointer);
typedef RtVoid  (*RtArchiveCallback)(RtToken, char *, ...);
typedef RtPointer RtObjectHandle;
typedef RtPointer RtLightHandle;
typedef RtPointer RtContextHandle;
typedef RtPointer RtArchiveHandle;

     /* Extern Declarations for Predefined RI Data Structures */

#define RI_FALSE     0
#define RI_TRUE      (! RI_FALSE)
#define RI_INFINITY  1.0e38
#define RI_EPSILON   1.0e-10
#define RI_NULL      ((RtToken)0)

extern RtToken  RI_FRAMEBUFFER, RI_FILE;
extern RtToken  RI_RGB, RI_RGBA, RI_RGBZ, RI_RGBAZ, RI_A, RI_Z, RI_AZ;
extern RtToken  RI_PERSPECTIVE, RI_ORTHOGRAPHIC;
extern RtToken  RI_HIDDEN, RI_PAINT;
extern RtToken  RI_CONSTANT, RI_SMOOTH;
extern RtToken  RI_FLATNESS, RI_FOV;

extern RtToken  RI_AMBIENTLIGHT, RI_POINTLIGHT, RI_DISTANTLIGHT,
                RI_SPOTLIGHT;

extern RtToken  RI_INTENSITY, RI_LIGHTCOLOR, RI_FROM, RI_TO, RI_CONEANGLE,
                RI_CONEDELTAANGLE, RI_BEAMDISTRIBUTION;

extern RtToken  RI_MATTE, RI_METAL, RI_SHINYMETAL,
                RI_PLASTIC, RI_PAINTEDPLASTIC;

extern RtToken  RI_KA, RI_KD, RI_KS, RI_ROUGHNESS, RI_KR,
                RI_TEXTURENAME, RI_SPECULARCOLOR;
extern RtToken  RI_DEPTHCUE, RI_FOG, RI_BUMPY;

extern RtToken  RI_MINDISTANCE, RI_MAXDISTANCE, RI_BACKGROUND,
                RI_DISTANCE, RI_AMPLITUDE;

extern RtToken  RI_RASTER, RI_SCREEN, RI_CAMERA, RI_WORLD, RI_OBJECT;
extern RtToken  RI_INSIDE, RI_OUTSIDE, RI_LH, RI_RH;
extern RtToken  RI_P, RI_PZ, RI_PW, RI_N, RI_NP, RI_CS, RI_OS, RI_S, RI_T, RI_ST;
extern RtToken  RI_BILINEAR, RI_BICUBIC;
extern RtToken  RI_PRIMITIVE, RI_INTERSECTION, RI_UNION, RI_DIFFERENCE;
extern RtToken  RI_PERIODIC, RI_NONPERIODIC, RI_CLAMP, RI_BLACK;
extern RtToken  RI_IGNORE, RI_PRINT, RI_ABORT, RI_HANDLER;

extern RtBasis  RiBezierBasis, RiBSplineBasis, RiCatmullRomBasis,
                RiHermiteBasis, RiPowerBasis;

#define RI_BEZIERSTEP         ((RtInt)3)
#define RI_BSPLINESTEP        ((RtInt)1)
#define RI_CATMULLROMSTEP     ((RtInt)1)
#define RI_HERMITESTEP        ((RtInt)2)
#define RI_POWERSTEP          ((RtInt)4)

extern RtInt     RiLastError;


     /* Declarations of All the RenderMan Interface Subroutines */

extern RtFloat  RiGaussianFilter(RtFloat x, RtFloat y,
                  RtFloat xwidth, RtFloat ywidth);
extern RtFloat  RiBoxFilter(RtFloat x, RtFloat y,
                  RtFloat xwidth, RtFloat ywidth);
extern RtFloat  RiTriangleFilter(RtFloat x, RtFloat y,
                  RtFloat xwidth, RtFloat ywidth);
extern RtFloat  RiCatmullRomFilter(RtFloat x, RtFloat y,
                  RtFloat xwidth, RtFloat ywidth);
extern RtFloat  RiSincFilter(RtFloat x, RtFloat y,
                  RtFloat xwidth, RtFloat ywidth);
extern RtVoid   RiErrorIgnore(RtInt code, RtInt severity, char *msg);
extern RtVoid   RiErrorPrint(RtInt code, RtInt severity, char *msg);
extern RtVoid   RiErrorAbort(RtInt code, RtInt severity, char *msg);

extern RtToken
     RiDeclare(char *name, char *declaration);

extern RtVoid
     RiBegin(RtToken name),
     RiEnd(),
     RiFrameBegin(RtInt frame),
     RiFrameEnd(),
     RiWorldBegin(),
     RiWorldEnd();

extern RtVoid
     RiFormat(RtInt xres, RtInt yres, RtFloat aspect),
     RiFrameAspectRatio(RtFloat aspect),
     RiScreenWindow(RtFloat left, RtFloat right, RtFloat bot, RtFloat top),
     RiCropWindow(RtFloat xmin, RtFloat xmax, RtFloat ymin, RtFloat ymax),
     RiProjection(RtToken name, ...),
     RiProjectionV(RtToken name, RtInt n,RtToken tokens[], RtPointer parms[]),
     RiClipping(RtFloat hither, RtFloat yon),
     RiClippingPlane(RtFloat Nx, RtFloat Ny, RtFloat Nz, RtFloat Px,
                     RtFloat Py, RtFloat Pz),
     RiShutter(RtFloat min, RtFloat max);

extern RtVoid
     RiPixelVariance(RtFloat variation),
     RiPixelSamples(RtFloat xsamples, RtFloat ysamples),
     RiPixelSampleImager(RtToken name, ...),
     RiPixelSampleImagerV(RtToken name, RtInt n, RtToken tokens[], RtPointer parms[]),
     RiPixelFilter(RtFilterFunc filterfunc, RtFloat xwidth, RtFloat ywidth),
     RiExposure(RtFloat gain, RtFloat gamma),
     RiImager(RtToken name, ...),
     RiImagerV(RtToken name, RtInt n, RtToken tokens[], RtPointer parms[]),
     RiQuantize(RtToken type, RtInt one, RtInt min, RtInt max, RtFloat ampl),
     RiDisplay(char *name, RtToken type, RtToken mode, ...),
     RiDisplayV(char *name, RtToken type, RtToken mode,
             RtInt n, RtToken tokens[], RtPointer parms[]);

extern RtVoid
     RiHider(RtToken type, ...),
     RiHiderV(RtToken type, RtInt n, RtToken tokens[], RtPointer parms[]),
     RiColorSamples(RtInt n, RtFloat nRGB[], RtFloat RGBn[]),
     RiRelativeDetail(RtFloat relativedetail),
     RiOption(RtToken name, ...),
     RiOptionV(RtToken name, RtInt n, RtToken tokens[], RtPointer parms[]);

extern RtVoid
     RiAttributeBegin(),
     RiAttributeEnd(),
     RiColor(RtColor color),
     RiOpacity(RtColor color),
     RiTextureCoordinates(RtFloat s1, RtFloat t1, RtFloat s2, RtFloat t2,
             RtFloat s3, RtFloat t3, RtFloat s4, RtFloat t4);

extern RtLightHandle
     RiLightSource(RtToken name, ...),
     RiLightSourceV(RtToken name,RtInt n,RtToken tokens[],RtPointer parms[]),
     RiAreaLightSource(RtToken name, ...),
     RiAreaLightSourceV(RtToken name,
             RtInt n, RtToken tokens[], RtPointer parms[]);
extern RtVoid
     RiIlluminate(RtLightHandle light, RtBoolean onoff),
     RiSurface(RtToken name, ...),
     RiSurfaceV(RtToken name, RtInt n, RtToken tokens[], RtPointer parms[]),
     RiAtmosphere(RtToken name, ...),
     RiAtmosphereV(RtToken name,RtInt n,RtToken tokens[],RtPointer parms[]),
     RiInterior(RtToken name, ...),
     RiInteriorV(RtToken name,RtInt n,RtToken tokens[],RtPointer parms[]),
     RiExterior(RtToken name, ...),
     RiExteriorV(RtToken name,RtInt n,RtToken tokens[],RtPointer parms[]),
     RiShadingRate(RtFloat size),
     RiShadingInterpolation(RtToken type),
     RiMatte(RtBoolean onoff);

extern RtVoid
     RiBound(RtBound bound),
     RiDetail(RtBound bound),
     RiDetailRange(RtFloat minvis, RtFloat lowtran, RtFloat uptran, RtFloat
             maxvis),
     RiGeometricApproximation(RtToken type, RtFloat value),
     RiOrientation(RtToken orientation),
     RiReverseOrientation(void),
     RiSides(RtInt sides);

extern RtVoid
     RiIdentity(void),
     RiTransform(RtMatrix transform),
     RiConcatTransform(RtMatrix transform),
     RiPerspective(RtFloat fov),
     RiTranslate(RtFloat dx, RtFloat dy, RtFloat dz),
     RiRotate(RtFloat angle, RtFloat dx, RtFloat dy, RtFloat dz),
     RiScale(RtFloat sx, RtFloat sy, RtFloat sz),
     RiSkew(RtFloat angle, RtFloat dx1, RtFloat dy1, RtFloat dz1,
            RtFloat dx2, RtFloat dy2, RtFloat dz2),
     RiDisplacement(RtToken name, ...),
     RiDisplacementV(RtToken name,RtInt n,RtToken tokens[],RtPointer
             parms[]),
     RiCoordinateSystem(RtToken space),
     RiCoordSysTransform(RtToken space);

extern RtPoint *
     RiTransformPoints(RtToken fromspace, RtToken tospace, RtInt n,
             RtPoint points[]);

extern RtVoid
     RiTransformBegin(),
     RiTransformEnd();

extern RtVoid
     RiAttribute(RtToken name, ...),
     RiAttributeV(RtToken name, RtInt n, RtToken tokens[], RtPointer parms[]);

extern RtVoid
     RiPolygon(RtInt nverts, ...),
     RiPolygonV(RtInt nverts, RtInt n, RtToken tokens[], RtPointer parms[]),
     RiGeneralPolygon(RtInt nloops, RtInt nverts[], ...),
     RiGeneralPolygonV(RtInt nloops, RtInt nverts[],
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiPointsPolygons(RtInt npolys, RtInt nverts[], RtInt verts[], ...),
     RiPointsPolygonsV(RtInt npolys, RtInt nverts[], RtInt verts[],
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiPointsGeneralPolygons(RtInt npolys, RtInt nloops[], RtInt nverts[],
             RtInt verts[], ...),
     RiPointsGeneralPolygonsV(RtInt npolys, RtInt nloops[], RtInt nverts[],
             RtInt verts[], RtInt n, RtToken tokens[], RtPointer parms[]),
     RiBasis(RtBasis ubasis, RtInt ustep, RtBasis vbasis, RtInt vstep),
     RiPatch(RtToken type, ...),
     RiPatchV(RtToken type, RtInt n, RtToken tokens[], RtPointer parms[]),
     RiPatchMesh(RtToken type, RtInt nu, RtToken uwrap,
             RtInt nv, RtToken vwrap, ...),
     RiPatchMeshV(RtToken type, RtInt nu, RtToken uwrap,
             RtInt nv, RtToken vwrap,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiNuPatch(RtInt nu, RtInt uorder, RtFloat uknot[], RtFloat umin,
             RtFloat umax, RtInt nv, RtInt vorder, RtFloat vknot[],
             RtFloat vmin, RtFloat vmax, ...),
     RiNuPatchV(RtInt nu, RtInt uorder, RtFloat uknot[], RtFloat umin,
             RtFloat umax, RtInt nv, RtInt vorder, RtFloat vknot[],
             RtFloat vmin, RtFloat vmax,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiTrimCurve(RtInt nloops, RtInt ncurves[], RtInt order[],
             RtFloat knot[], RtFloat min[], RtFloat max[], RtInt n[],
             RtFloat u[], RtFloat v[], RtFloat w[]);

extern RtVoid
     RiSphere(RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat tmax, ...),
     RiSphereV(RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat tmax,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiCone(RtFloat height, RtFloat radius, RtFloat tmax, ...),
     RiConeV(RtFloat height, RtFloat radius, RtFloat tmax,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiCylinder(RtFloat radius,RtFloat zmin,RtFloat zmax,RtFloat tmax, ...),
     RiCylinderV(RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat tmax,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiHyperboloid(RtPoint point1, RtPoint point2, RtFloat tmax, ...),
     RiHyperboloidV(RtPoint point1, RtPoint point2, RtFloat tmax,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiParaboloid(RtFloat rmax,RtFloat zmin,RtFloat zmax,RtFloat tmax, ...),
     RiParaboloidV(RtFloat rmax, RtFloat zmin, RtFloat zmax, RtFloat tmax,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiDisk(RtFloat height, RtFloat radius, RtFloat tmax, ...),
     RiDiskV(RtFloat height, RtFloat radius, RtFloat tmax,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiTorus(RtFloat majrad, RtFloat minrad, RtFloat phimin, RtFloat phimax,
             RtFloat tmax, ...),
     RiTorusV(RtFloat majrad,RtFloat minrad,RtFloat phimin,RtFloat phimax,
             RtFloat tmax, RtInt n, RtToken tokens[], RtPointer parms[]),
     RiProcedural(RtPointer data, RtBound bound,
             RtVoid (*subdivfunc)(RtPointer, RtFloat),
             RtVoid (*freefunc)(RtPointer)
     RiGeometry(RtToken type, ...),
     RiGeometryV(RtToken type, RtInt n, RtToken tokens[], RtPointer parms[]);

extern RtVoid
     RiBlobby(RtInt nleaf, RtInt ncode, RtInt code[],
             RtInt nflt, RtFloat flt[],
             RtInt nstr, RtToken str[], ...),
     RiBlobbyV(RtInt nleaf, RtInt ncode, RtInt code[],
             RtInt nflt, RtFloat flt[],
             RtInt nstr, RtToken str[],
             RtInt n, RtToken tokens[], RtPointer parms[] ),
     RiCurves(RtToken type, RtInt ncurves,
             RtInt nvertices[], RtToken wrap, ...);
     RiCurvesV(RtToken type, RtInt ncurves,
             RtInt nvertices[], RtToken wrap,
             RtInt n, RtToken tokens[], RtPointer parms[] ),
     RiPoints(RtInt nverts, ...),
     RiPointsV(RtInt nverts,
             RtInt n, RtToken tokens[], RtPointer parms[] ),
     RiSubdivisionMesh(RtToken mask, RtInt nf, RtInt nverts[],
             RtInt verts[],
             RtInt ntags, RtToken tags[], RtInt numargs[],
             RtInt intargs[], RtFloat floatargs[], ...),
     RiSubdivisionMeshV(RtToken mask, RtInt nf, RtInt nverts[],
             RtInt verts[],
             RtInt ntags, RtToken tags[], RtInt numargs[],
             RtInt intargs[], RtFloat floatargs[],
             RtInt n, RtToken tokens[], RtPointer parms[] );

extern RtVoid
     RiProcedural(RtPointer data, RtBound bound,
             RtVoid (*subdivfunc)(RtPointer, RtFloat),
             RtVoid (*freefunc)(RtPointer),
     RiGeometry(RtToken type, ...),
     RiGeometryV(RtToken type,
             RtInt n, RtToken tokens[], RtPointer parms[] );

extern RtVoid
     RiSolidBegin(RtToken operation),
     RiSolidEnd() ;

extern RtObjectHandle
     RiObjectBegin();

extern RtVoid
     RiObjectEnd(),
     RiObjectInstance(RtObjectHandle handle),
     RiMotionBegin(RtInt n, ...),
     RiMotionBeginV(RtInt n, RtFloat times[]),
     RiMotionEnd(void) ;

extern RtVoid
     RiMakeTexture(char *pic, char *tex, RtToken swrap, RtToken twrap,
             RtFilterFunc filterfunc, RtFloat swidth, RtFloat twidth, ...),
     RiMakeTextureV(char *pic, char *tex, RtToken swrap, RtToken twrap,
             RtFilterFunc filterfunc, RtFloat swidth, RtFloat twidth,
             RtInt n, RtToken tokens[], RtPointer parms[]),
     RiMakeLatLongEnvironment(char *pic, char *tex, RtFilterFunc filterfunc,
            RtFloat swidth, RtFloat twidth, ...),
     RiMakeLatLongEnvironmentV(char *pic, char *tex, RtFilterFunc filterfunc,
            RtFloat swidth, RtFloat twidth,
            RtInt n, RtToken tokens[], RtPointer parms[]),
     RiMakeCubeFaceEnvironment(char *px, char *nx, char *py, char *ny,
            char *pz, char *nz, char *tex, RtFloat fov,
            RtFilterFunc filterfunc, RtFloat swidth, RtFloat ywidth, ...),
     RiMakeCubeFaceEnvironmentV(char *px, char *nx, char *py, char *ny,
            char *pz, char *nz, char *tex, RtFloat fov,
            RtFilterFunc filterfunc, RtFloat swidth, RtFloat ywidth,
            RtInt n, RtToken tokens[], RtPointer parms[]),
     RiMakeShadow(char *pic, char *tex, ...),
     RiMakeShadowV(char *pic, char *tex,
            RtInt n, RtToken tokens[], RtPointer parms[]);

extern RtVoid
     RiArchiveRecord(RtToken type, char *format, ...),
     RiReadArchive(RtToken name, RtArchiveCallback callback, ...),
     RiReadArchiveV(RtToken name, RtArchiveCallback callback,
             RtInt n, RtToken tokens[], RtPointer parms[]);

extern RtArchiveHandle
     RiArchiveBegin(RtToken name, ....);
extern RtVoid
     RiArchiveEnd();

extern RtVoid
     RiIfBegin(RtToken), RiIfEnd(), RiElseIf(RtToken ), RiElse();

extern RtVoid
     RiErrorHandler(RtErrorHandle handler);

extern RtVoid
     RiDisplayChannel(RtToken channel, ...),
     RiDisplayChannelV(RtToken channel, RtInt n, RtToken tokens[], RtPointer parms[]);

/*
     Error Codes
      1 - 10          System and File Errors
     11 - 20          Program Limitations
     21 - 40          State Errors
     41 - 60          Parameter and Protocol Errors
     61 - 80          Execution Errors
*/
#define RIE_NOERROR     ((RtInt)0)
#define RIE_NOMEM       ((RtInt)1)     /* Out of memory */
#define RIE_SYSTEM      ((RtInt)2)     /* Miscellaneous system error */
#define RIE_NOFILE      ((RtInt)3)     /* File nonexistent */
#define RIE_BADFILE     ((RtInt)4)     /* Bad file format */
#define RIE_VERSION     ((RtInt)5)     /* File version mismatch */
#define RIE_DISKFULL    ((RtInt)6)     /* Target disk is full */
#define RIE_INCAPABLE   ((RtInt)11)    /* Optional RI feature */
#define RIE_UNIMPLEMENT ((RtInt)12)    /* Unimplemented feature */
#define RIE_LIMIT       ((RtInt)13)    /* Arbitrary program limit */
#define RIE_BUG         ((RtInt)14)    /* Probably a bug in renderer */
#define RIE_NOTSTARTED  ((RtInt)23)    /* RiBegin not called */
#define RIE_NESTING     ((RtInt)24)    /* Bad begin-end nesting */
#define RIE_NOTOPTIONS  ((RtInt)25)    /* Invalid state for options */
#define RIE_NOTATTRIBS  ((RtInt)26)    /* Invalid state for attribs */
#define RIE_NOTPRIMS    ((RtInt)27)    /* Invalid state for primitives */
#define RIE_ILLSTATE    ((RtInt)28)    /* Other invalid state */
#define RIE_BADMOTION   ((RtInt)29)    /* Badly formed motion block */
#define RIE_BADSOLID    ((RtInt)30)    /* Badly formed solid block */
#define RIE_BADTOKEN    ((RtInt)41)    /* Invalid token for request */
#define RIE_RANGE       ((RtInt)42)    /* Parameter out of range */
#define RIE_CONSISTENCY ((RtInt)43)    /* Parameters inconsistent */
#define RIE_BADHANDLE   ((RtInt)44)    /* Bad object/light handle */
#define RIE_NOSHADER    ((RtInt)45)    /* Can't load requested shader */
#define RIE_MISSINGDATA ((RtInt)46)    /* Required parameters not provided */
#define RIE_SYNTAX      ((RtInt)47)    /* Declare type syntax error */
#define RIE_MATH        ((RtInt)61)    /* Zerodivide, noninvert matrix, etc. */

     /* Error severity levels */
#define RIE_INFO        ((RtInt)0)     /* Rendering stats and other info */
#define RIE_WARNING     ((RtInt)1)     /* Something seems wrong, maybe okay */
#define RIE_ERROR       ((RtInt)2)     /* Problem. Results may be wrong */
#define RIE_SEVERE      ((RtInt)3)     /* So bad you should probably abort */