[SESI logo]

Prisms Development Toolkit Documentation

Side Effects Software Inc. 1997

Custom SOP Reference

sopPrint

There are two places where the definition of a SOP is wrtten out. The first is in response to the user's keyboard command, sopdump. The second is when a .bmot file is saved.

This function defines what kind of arguments are to be written; it is analagous to the sopScan function. The Circle example looks like:


static void
sopPrint(FILE *fp, SOP *sop)
{
    SOP_DATA	*sb;
    char	 buffer[20];

    sb = (SOP_DATA *)sop->special;

    SopPrintTriple(fp, sb->center, "0", "0", "0", "-c");
    SopPrintExpr(fp, &sb->radius, "1", "-r");
    SopPrintMenu(fp, &sb->orient, planeOpts, "xy", "-O");
    SopPrintExpr(fp, &sb->ndivs, "10", "-p");
}
The first line of the routine, sb = sop->special, should remain as is. The user will add and modify the SopPrint... commands. These calls depend on the kind of arguments the SOP takes, but each follows the following format:
File pointer
Data pointer
Default value(s)
The argument flag
The data values are only printed if they are different from the default values. Be aware that multi-valued data (ie, double and triple) are stored in arrays, so passing the address of that data means just naming the array. A complete reference follows:
SopPrintToggle  (fp, &sb->Toggle,   "-T");
SopPrintExpr    (fp, &sb->Single,   "", "-e");
SopPrintDouble  (fp,  sb->Double,   "", "", "-d");
SopPrintTriple  (fp,  sb->Triple,   "", "", "", "-t");
SopPrintString  (fp, &sb->String,   "", "-S");
SopPrintFile    (fp, &sb->File,     "", "-F");
SopPrintObject  (fp, &sb->Object,   "", "-o");
SopPrintMenu    (fp, &sb->Menu,     menuTexts, "", "-m");
SopPrintUserMenu(fp, &sb->UserMenu, "", "-u");

Tookit Overview
Expression Functions | User Functions | Custom SOPs
Prisms Internal Format | Programmer's Reference
Compiling SOPs | Using sopbuild | SOP Routine Reference
Dynamic SOPs | Prisms Types | Macros
Math Routines | Data Routines | Polygon Routines | Winged-edge Routines

Copyright © 1997 Side Effects Software Inc.
477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7