📄 program.me
字号:
.bp.sh 1 "Creating \*(IP masters from C Programs".lpA series of C macros and subroutines have been incorporated into a flexiblesoftware interface for use in the creation of Interpress masters. Thisinterface provides a facility for higher level software to create Interpressmasters and eliminates the need for knowledge of the actual encoding ofthe file. The set of routines resembles the proposal for an Interpressprocedural interface outlined in the.iIntroduction to Interpress,.r\s8XSIG\s0 038404 Section 7 "Creating masters: procedural interfaces"..lpSince this document makes references to the actual Interpressencoding form, it is assumed that the reader has knowledge ofthe encoding of Interpress within a file as described in the.iInterpress Electronic Printing Standard,.r\s8XSIS\s0 048404, Section 2.5..sh 2 Basics.lpThe Interpress procedure interface described is organized as that describedin Section 7 of the.iIntroduction to Interpress,.r\s8XSIG\s0 038404..lpThere are two levels of interfaces:.RS.ip \(buThe.i Literalinterface which provides procedures for creating the various Interpress tokens(i.e., operators, numbers, identifiers, etc.).ip \(buThe.i Operatorinterface which provides procedures for the creation of specific operatorswith an associated value or values..RE.lpThe following conventions are used in the descriptions of these interfaces:.RS.RS.ip n:floating point numbers represented by the C type double (32 bits).ip i:integers represented by the C type long (32 bits).ip s:character strings which are null terminated.ip p:pointer to pixels (unsigned char *).RE.RE.sh 2 "Literal Interface".lpThe literal interface is a series of routines which appendthe various Interpress types to the output file. These routinesperform the actual encoding dependent upon the literal type. .lpThe routines which comprise the literal interface are:.RS.ip \fIip_select\fR(i:\ fd) 35select the output file represented by the file descriptor fd and append anInterpress header.ip \fIres_select\fR(i:\ fd) 35select the output file represented by the file descriptor fd and append aR.E.S. header.ip \fIip_raw_select\fR(i:\ fd) 35select the output file represented by the file descriptor fd (does not appendan Interpress header).ip \fIip_close\fR() 35close an output file.ip \fIip_flush\fR() 35flush current output buffer to the file.pp.pp.ip \fIAppendOp\fR(i:\ operator) 35append operator in its proper form (either a Short Op or a Long Op).ip \fIAppendNumber\fR(n:\ number) 35append the number in its proper form (either as a Short Number, a sequence oftype sequenceInteger or a sequence of type sequenceRational).ip \fIAppendInteger\fR(i:\ integer) 35append the integer in its proper form (either as a Short Number or a sequenceof type sequenceInteger).ip \fIAppendRational\fR(n:\ num,\ n:\ denom) 35append value and divisor as a sequence of type sequenceRational.ip \fIAppendIdentifier\fR(s:\ string) 35append string as a sequence of type sequenceIdentifier.ip \fIAppendComment\fR(s:\ string) 35append string as a sequence of type sequenceComment.ip \fIAppendString\fR(s:\ string) 35append string as a sequence of type sequenceString.ip \fIAppendStringX\fR(s:\ string) 35append string with possible escapes as a sequence of type sequenceString.ip \fIAppendInsertFile\fR(s:\ string) 35append string as a sequence of type sequenceInsertFile.RE.sh 2 "Operator Interface".lpMany of the common Interpress primitive operators have a corresponding routinein the operator interface which appends the operator and a series of value(s) to the output file..lpInterpress operators vary in their use in that several options are available:.RS.ip \(buthe operators may not require any values to be associated with it.ip \(buvalues may be provided explicitly and a resulting value left on the stack.ip \(buany or all values may be taken from the stack (left by a previous operation)and the result of the operator may then be left on the stack in place of the values.ip \(buthe values provided may in fact be a larger body of values composed of manynumbers or integers.RE.lp.iOperators with no values:.rOperators which require no values may be output with the literal interface routines \fIAppendOp\fR or \fIOp\fR..lp.iOperators with explicit values:.rThe following routines append the named operator along with the valuesspecified:.RS.lp.bArithmetic Operators.RS.ip \fIAbs\|(n:\ value)\fR.ip \fIAdd\|(n:\ value1,\ n:\ value2)\fR.ip \fICeiling\|(n:\ value)\fR.ip \fIDiv\|(n:\ dividend,\ n:\ divisor)\fR.ip \fIFloor\|(n:\ value)\fR.ip \fIMod\|(n:\ value,\ n:\ divisor)\fR.ip \fIMul\|(n:\ value1,\ n:\ value2)\fR.ip \fINeg\|(n:\ value)\fR.ip \fIRem\|(n:\ value,\ n:\ divisor)\fR.ip \fIRound\|(n:\ value)\fR.ip \fISub\|(n:\ minuend,\ n:\ subtrahend)\fR.ip \fITrunc\|(n:\ value)\fR.RE.lp.bColor Operators.RS.ip \fIMakeGray\|(n:\ colorshade)\fR.ip \fIMakeSampledBlack\|(i:\ clear)\fR.ip \fISetGray\|(n:\ colorshade)\fR.RE.lp.bCorrection Operators.RS.ip \fICorrectSpace\|(n:\ x,\ n:\ y)\fR.ip \fISetcorrectMeasure\|(n:\ x,\ n:\ y)\fR.ip \fISetCorrectTolerance\|(n:\ x,\ n:\ y)\fR.ip \fISpace\|(n:\ x)\fR.RE.lp.bFont Operators.RS.ip \fISetFont(i:\ font)\fR.RE.lp.bFrame Operators.RS.ip \fIFGet\|(i:\ framevariable)\fR.RE.lp.bImager Operators.RS.ip \fIIGet\|(i:\ imagerVariable)\fR.ip \fISetAmplifySpace\|(n:\ value)\fR.ip \fISetCorrectPass\|(i:\ value)\fR.ip \fISetCorreectShrink\|(n:\ number)\fR.ip \fISetNoImage\|(i:\ integer)\fR.ip \fISetPriorityImportant\|(i:\ integer)\fR.ip \fISetStrokeEnd\|(i:\ integer)\fR.ip \fISetStrokeWidth\|(n:\ number)\fR.ip \fISetUnderlineStart\|(n:\ number)\fR.RE.lp.bMask Operators.r.RS.ip \fIMaskRectangle\|(n:\ x,\ n:\ y,\ n:\ width,\ n:\ height)\fR.ip \fIMaskTrapezoidx\|(n:\ x1,\ n:\ y1,\ n:\ x2,\ n:\ x3,\ n:\ y3,\ n:\ x4)\fR.ip \fIMaskTrapezoidy\|(n:\ x1,\ n:\ y1,\ n:\ y2,\ n:\ x3,\ n:\ y3,\ n:\ y4)\fR.ip \fIMaskUnderline\|(n:\ dy,\ n:\ h)\fR.ip \fIMaskVector\|(n:\ x1,\ n:\ y1,\ n:\ x2,\ n:\ y2)\fR.RE.lp.bPosition Operators.RS.ip \fISetXY\|(n:\ x,\ n:\ y)\fR.ip \fISetXYRel\|(n:\ dx,\ n:\ dy)\fR.ip \fISetXRel\|(n:\ dx)\fR.ip \fISetYRel\|(n:\ dy)\fR.RE.lp.bTest Operators.RS.ip \fIAnd\|(i:\ value1,\ i:\ value2)\fR.ip \fIGe\|(n:\ value1,\ n:\ value2)\fR.ip \fIGt\|(n:\ value2,\ n:\ value2)\fR.ip \fINot\|(i:\ value)\fR.ip \fIOr\|(i:\ value1,\ i:\ value2)\fR.RE.lp.bTransform Operators.RS.ip \fIRotate\|(n:\ angle)\fR.ip \fIScale\|(n:\ s)\fR.ip \fIScale2\|(n:\ sx,\ n:\ sy)\fR.ip \fITranslate\|(n:\ x,\ n:\ y)\fR.RE.RE.lp.iOperators with implicit values:.rThe following routines append the named operator along with the valuesspecified, with the assumption that other values have been appended throughprevious calls to the literal interface:.RS.lp.bMask Operators.RS.ip \fILineTo\|(n:\ x,\ n:\ y)\fR.ip \fILineToX\|(n:\ x)\fR.ip \fILineToY\|(n:\ y)\fR.ip \fIMakeOutline\|(i:\ count)\fR.RE.lp.bStack Operators.RS.ip \fICopy\|(i:\ count)\fR.ip \fIRoll\|(i:\ depth,\ i:\ movefirst)\fR.ip \fIMark\|(i:\ count)\fR.ip \fIUnmark\|(i:\ count)\fR.RE.lp.bVector Operators.RS.ip \fIGet\|(n:\ index)\fR.ip \fIMakeVec\|(I:\ upper)\fR.ip \fIMakeVecLU\|(i:\ lower,\ i:\ upper)\fR.RE.RE.lp.iTemplates:.rSeveral procedures are provided for common Interpress operations which maylogically combine groups of operators and values. Those procedures are:.RS.ip \fISetupFont\|(s:\ name,\ i:\ size,\ i:\ fontnumber)\fR.ip \fIShowString\|(s:\ string)\fR.RE.lp.rThe following procedures append encoded pixel vectors..RS.ip \fIAppendPPVector\|(i:\ length,\ i:\ bitsPerPixel,\ i:\ pixelsPerScanLine,\ p:\ data)\fR.ip \fIAppendCPVector\|(i:\ length,\ i:\ breakTable,\ i:\ nRange,\ i:\ pixelsPerScanLine,\ p:\ data)\fR.RE.sh 2 "Using the Program Interface".lpThe software which uses these Interpress interfaces can find thethe desired subroutines in the Interpress library.i libip.awhich exists in the directory.i ${SRC}/libas distributed..lpThere are also several include files in the directory.i ${SRC}/includewhich contain the following utilities:.RS.ip iptokens.hdefinitions for the Interpress encoding of tokens, sequence types and operators.ip literal.hmacro definitions for portions of the literal interface .ip operator.hmacro definitions for most of the operator interface.RE.lpNote that ${SRC} above denotes the path in which the Interpress software wasloaded on the host system..sh 3 "An example using the program interfaces".lpThe following short C program demonstrates an Interpressgeneration facility. This will produce an Interpress master on the filedescriptor stdout which will print the line "This is an Interpress test"across the top of the page..in +5n.lp\f(TR#include "iptokens.h".br#include "literal.h".br#include "operator.h".brmain().br{.in +5nip_select(1); /* open stdout */.brAppendOp(OP_beginBlock);.brAppendOp(OP_beginBody);.br/* establish default font */.brSetupFont("Xerox/XC1-1-1/Classic",100.,1);.brAppendRational(353,10000000); /* scale of 1/10 point */.brAppendOp(OP_scale);.brAppendInteger(2);.brAppendOp(OP_fset); /* save in frame variable 2 */.brAppendOp(OP_endBody); /* end preamble */.brAppendOp(OP_beginBody); /* start page 1 */.brFGet(2); /* retrieve scale */.brSetFont(1); /* retrieve default font */.brSetXY((double)1440,(double)7200);.brShowString("This is an Interpress test");.brAppendOp(OP_endBody);.brAppendOp(OP_endBlock);.brip_close(); /* close file */.in -5n}.in -5n.lpThe text representation of the Interpress master produced by the aboveprogram is shown below:.(l I\f(TRHeader: "Interpress/Xerox/2.1 "BEGIN (block){> Identifier: Xerox> Identifier: XC1-1-1> Identifier: Classic3makevecfindfont100scalemodifyfont1fset> Rational: 353/10000000 (0.000035)scale2fset}{2fget1setfont14407200setxy> String: "This is an Interpress test"show}END (block).)l
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -