[SESI logo]

Prisms Development Toolkit Documentation

Side Effects Software Inc. 1997

Custom SOP Reference

The SopRef structure

We have already seen this structure: it exists to tell action where to find what it needs to execute your SOP. Assuming that you use the same routine names that have been used throughout this documentation, then there are only 3 things to change to make this work in your SOP:

SOP_FUNC  CircleSopRef = {	/* 1st: SOP name as in usersop.c */
	"circle",		/* 2nd: name as it appears in menu */
	"c:::O:p:r:",		/* 3rd: SOP params and how to parse */
	sopScan, 		
	sopPrint, 	
	sopCook, 
	sopDefaults,
	sopClean, 
	sopGPMake,
	sopGetParms,	
	SOPUSAGE,
};
1. In usersop.c you will define the access point for this sop. The name you use here (in this case, CircleSopRef) and the name you use there must be the same. In general, SOP function entries are named YourNameSopRef, where YourName is the name you are using for the SOP.

2. The string that will appear in the SOP menu and at the top of the SOP in the SOP list goes here. This does not need to be the same as anything else you have used, but it is a good idea not to confuse people.

3. SOP parameters are defined here, in sopScan() and sopPrint(), and also in the SOPUSAGE macro. The syntax is simple: choose a letter for each argument or set of arguments your sop will accept. Letters which may NOT be used because they are reserved by action are

a,f,s,o,H,I,J,K,L,M,N,Y,Z
Which means that the letters which can be used are
b c d e g h i j k l m n p q r t u v w x y z
A B C D E F G O P Q R S T U V W X
Each letter in the string is followed by 0 or more colons ( : ), one colon for each argument the letter takes.

For example, the -c flag takes 3 arguments (center x, y and z), so it is entered as "c:::". A toggle, which took no values, would have no : after it. For example, the command line for the Elipsoid SOP is


#define SOPUSAGE        \
"sellipsoid [-c x y z] [-r x y z] [-O axis]\n\
\t\t[-t type] [-p lat long] [-P]\n\
\t-c    The center of the ellipsoid\n\
\t-r    The radii of the dominant axes (x, y, z)\n\
\t-O    The polar axis (x, y or z)\n\
\t-t    How to connect the ellipsoid(tri, quad, row, col, rc)\n\
\t-p    The number of divisions for lat and long\n\
\t-P    Fuse the points at the poles"

so the corresponding SOP_FUNC is

SOP_FUNC        EllipsoidSopRef = {
        "ellipsoid",
        "c:::r:::O:p::Pt:",
        sopScan, sopPrint, sopCook, 
	sopDefaults, sopClean, sopGPMake,
        sopGetParms,
        SOPUSAGE,
};

Since -P (fuse the points at the poles) is a toggle, it is followed immediately by 't', which takes a single argument.
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