Annotation of 43BSDTahoe/new/dipress/doc/program.me, revision 1.1

1.1     ! root        1: .bp
        !             2: .sh 1 "Creating \*(IP masters from C Programs"
        !             3: .lp
        !             4: A series of C macros and subroutines have been incorporated into a flexible
        !             5: software interface for use in the creation of Interpress masters.  This
        !             6: interface provides a facility for higher level software to create Interpress
        !             7: masters and eliminates the need for knowledge of the actual encoding of
        !             8: the file.  The set of routines resembles the proposal for an Interpress
        !             9: procedural interface outlined in the
        !            10: .i
        !            11: Introduction to Interpress,
        !            12: .r
        !            13: \s8XSIG\s0 038404 Section 7 "Creating masters: procedural interfaces".
        !            14: .lp
        !            15: Since this document makes references to the actual Interpress
        !            16: encoding form, it is assumed that the reader has knowledge of
        !            17: the encoding of Interpress within a file as described in the
        !            18: .i
        !            19: Interpress Electronic Printing Standard,
        !            20: .r
        !            21: \s8XSIS\s0 048404, Section 2.5.
        !            22: .sh 2 Basics
        !            23: .lp
        !            24: The Interpress procedure interface described is organized as that described
        !            25: in Section 7 of the
        !            26: .i
        !            27: Introduction to Interpress,
        !            28: .r
        !            29: \s8XSIG\s0 038404.
        !            30: .lp
        !            31: There are two levels of interfaces:
        !            32: .RS
        !            33: .ip \(bu
        !            34: The
        !            35: .i Literal
        !            36: interface which provides procedures for creating the various Interpress tokens
        !            37: (i.e., operators, numbers, identifiers, etc.)
        !            38: .ip \(bu
        !            39: The
        !            40: .i Operator
        !            41: interface which provides procedures for the creation of specific operators
        !            42: with an associated value or values.
        !            43: .RE
        !            44: .lp
        !            45: The following conventions are used in the descriptions of these interfaces:
        !            46: .RS
        !            47: .RS
        !            48: .ip n:
        !            49: floating point numbers represented by the C type double (32 bits)
        !            50: .ip i:
        !            51: integers represented by the C type long (32 bits)
        !            52: .ip s:
        !            53: character strings which are null terminated
        !            54: .ip p:
        !            55: pointer to pixels (unsigned char *)
        !            56: .RE
        !            57: .RE
        !            58: .sh 2 "Literal Interface"
        !            59: .lp
        !            60: The literal interface is a series of routines which append
        !            61: the various Interpress types to the output file.  These routines
        !            62: perform the actual encoding dependent upon the literal type. 
        !            63: .lp
        !            64: The routines which comprise the literal interface are:
        !            65: .RS
        !            66: .ip \fIip_select\fR(i:\ fd) 35
        !            67: select the output file represented by the file descriptor fd and append an
        !            68: Interpress header
        !            69: .ip \fIres_select\fR(i:\ fd) 35
        !            70: select the output file represented by the file descriptor fd and append a
        !            71: R.E.S. header
        !            72: .ip \fIip_raw_select\fR(i:\ fd) 35
        !            73: select the output file represented by the file descriptor fd (does not append
        !            74: an Interpress header)
        !            75: .ip \fIip_close\fR() 35
        !            76: close an output file
        !            77: .ip \fIip_flush\fR() 35
        !            78: flush current output buffer to the file
        !            79: .pp
        !            80: .pp
        !            81: .ip \fIAppendOp\fR(i:\ operator) 35
        !            82: append operator in its proper form (either a Short Op or a Long Op)
        !            83: .ip \fIAppendNumber\fR(n:\ number) 35
        !            84: append the number in its proper form (either as a Short Number, a sequence of
        !            85: type sequenceInteger or a sequence of type sequenceRational)
        !            86: .ip \fIAppendInteger\fR(i:\ integer) 35
        !            87: append the integer in its proper form (either as a Short Number or a sequence
        !            88: of type sequenceInteger)
        !            89: .ip \fIAppendRational\fR(n:\ num,\ n:\ denom) 35
        !            90: append value and divisor as a sequence of type sequenceRational
        !            91: .ip \fIAppendIdentifier\fR(s:\ string) 35
        !            92: append string as a sequence of type sequenceIdentifier
        !            93: .ip \fIAppendComment\fR(s:\ string) 35
        !            94: append string as a sequence of type sequenceComment
        !            95: .ip \fIAppendString\fR(s:\ string) 35
        !            96: append string as a sequence of type sequenceString
        !            97: .ip \fIAppendStringX\fR(s:\ string) 35
        !            98: append string with possible escapes as a sequence of type sequenceString
        !            99: .ip \fIAppendInsertFile\fR(s:\ string) 35
        !           100: append string as a sequence of type sequenceInsertFile
        !           101: .RE
        !           102: .sh 2 "Operator Interface"
        !           103: .lp
        !           104: Many of the common Interpress primitive operators have a corresponding routine
        !           105: in the operator interface which appends the operator and a series of value(s) 
        !           106: to the output file.
        !           107: .lp
        !           108: Interpress operators vary in their use in that several options are available:
        !           109: .RS
        !           110: .ip \(bu
        !           111: the operators may not require any values to be associated with it
        !           112: .ip \(bu
        !           113: values may be provided explicitly and a resulting value left on the stack
        !           114: .ip \(bu
        !           115: any or all values may be taken from the stack (left by a previous operation)
        !           116: and the result of the operator may then be left on the stack in place of 
        !           117: the values
        !           118: .ip \(bu
        !           119: the values provided may in fact be a larger body of values composed of many
        !           120: numbers or integers
        !           121: .RE
        !           122: .lp
        !           123: .i
        !           124: Operators with no values:
        !           125: .r
        !           126: Operators which require no values may be output with the literal interface 
        !           127: routines \fIAppendOp\fR or \fIOp\fR.
        !           128: .lp
        !           129: .i
        !           130: Operators with explicit values:
        !           131: .r
        !           132: The following routines append the named operator along with the values
        !           133: specified:
        !           134: .RS
        !           135: .lp
        !           136: .b
        !           137: Arithmetic Operators
        !           138: .RS
        !           139: .ip \fIAbs\|(n:\ value)\fR
        !           140: .ip \fIAdd\|(n:\ value1,\ n:\ value2)\fR
        !           141: .ip \fICeiling\|(n:\ value)\fR
        !           142: .ip \fIDiv\|(n:\ dividend,\ n:\ divisor)\fR
        !           143: .ip \fIFloor\|(n:\ value)\fR
        !           144: .ip \fIMod\|(n:\ value,\ n:\ divisor)\fR
        !           145: .ip \fIMul\|(n:\ value1,\ n:\ value2)\fR
        !           146: .ip \fINeg\|(n:\ value)\fR
        !           147: .ip \fIRem\|(n:\ value,\ n:\ divisor)\fR
        !           148: .ip \fIRound\|(n:\ value)\fR
        !           149: .ip \fISub\|(n:\ minuend,\ n:\ subtrahend)\fR
        !           150: .ip \fITrunc\|(n:\ value)\fR
        !           151: .RE
        !           152: .lp
        !           153: .b
        !           154: Color Operators
        !           155: .RS
        !           156: .ip \fIMakeGray\|(n:\ colorshade)\fR
        !           157: .ip \fIMakeSampledBlack\|(i:\ clear)\fR
        !           158: .ip \fISetGray\|(n:\ colorshade)\fR
        !           159: .RE
        !           160: .lp
        !           161: .b
        !           162: Correction Operators
        !           163: .RS
        !           164: .ip \fICorrectSpace\|(n:\ x,\ n:\ y)\fR
        !           165: .ip \fISetcorrectMeasure\|(n:\ x,\ n:\ y)\fR
        !           166: .ip \fISetCorrectTolerance\|(n:\ x,\ n:\ y)\fR
        !           167: .ip \fISpace\|(n:\ x)\fR
        !           168: .RE
        !           169: .lp
        !           170: .b
        !           171: Font Operators
        !           172: .RS
        !           173: .ip \fISetFont(i:\ font)\fR
        !           174: .RE
        !           175: .lp
        !           176: .b
        !           177: Frame Operators
        !           178: .RS
        !           179: .ip \fIFGet\|(i:\ framevariable)\fR
        !           180: .RE
        !           181: .lp
        !           182: .b
        !           183: Imager Operators
        !           184: .RS
        !           185: .ip \fIIGet\|(i:\ imagerVariable)\fR
        !           186: .ip \fISetAmplifySpace\|(n:\ value)\fR
        !           187: .ip \fISetCorrectPass\|(i:\ value)\fR
        !           188: .ip \fISetCorreectShrink\|(n:\ number)\fR
        !           189: .ip \fISetNoImage\|(i:\ integer)\fR
        !           190: .ip \fISetPriorityImportant\|(i:\ integer)\fR
        !           191: .ip \fISetStrokeEnd\|(i:\ integer)\fR
        !           192: .ip \fISetStrokeWidth\|(n:\ number)\fR
        !           193: .ip \fISetUnderlineStart\|(n:\ number)\fR
        !           194: .RE
        !           195: .lp
        !           196: .b
        !           197: Mask Operators
        !           198: .r
        !           199: .RS
        !           200: .ip \fIMaskRectangle\|(n:\ x,\ n:\ y,\ n:\ width,\ n:\ height)\fR
        !           201: .ip \fIMaskTrapezoidx\|(n:\ x1,\ n:\ y1,\ n:\ x2,\ n:\ x3,\ n:\ y3,\ n:\ x4)\fR
        !           202: .ip \fIMaskTrapezoidy\|(n:\ x1,\ n:\ y1,\ n:\ y2,\ n:\ x3,\ n:\ y3,\ n:\ y4)\fR
        !           203: .ip \fIMaskUnderline\|(n:\ dy,\ n:\ h)\fR
        !           204: .ip \fIMaskVector\|(n:\ x1,\ n:\ y1,\ n:\ x2,\ n:\ y2)\fR
        !           205: .RE
        !           206: .lp
        !           207: .b
        !           208: Position Operators
        !           209: .RS
        !           210: .ip \fISetXY\|(n:\ x,\ n:\ y)\fR
        !           211: .ip \fISetXYRel\|(n:\ dx,\ n:\ dy)\fR
        !           212: .ip \fISetXRel\|(n:\ dx)\fR
        !           213: .ip \fISetYRel\|(n:\ dy)\fR
        !           214: .RE
        !           215: .lp
        !           216: .b
        !           217: Test Operators
        !           218: .RS
        !           219: .ip \fIAnd\|(i:\ value1,\ i:\ value2)\fR
        !           220: .ip \fIGe\|(n:\ value1,\ n:\ value2)\fR
        !           221: .ip \fIGt\|(n:\ value2,\ n:\ value2)\fR
        !           222: .ip \fINot\|(i:\ value)\fR
        !           223: .ip \fIOr\|(i:\ value1,\ i:\ value2)\fR
        !           224: .RE
        !           225: .lp
        !           226: .b
        !           227: Transform Operators
        !           228: .RS
        !           229: .ip \fIRotate\|(n:\ angle)\fR
        !           230: .ip \fIScale\|(n:\ s)\fR
        !           231: .ip \fIScale2\|(n:\ sx,\ n:\ sy)\fR
        !           232: .ip \fITranslate\|(n:\ x,\ n:\ y)\fR
        !           233: .RE
        !           234: .RE
        !           235: .lp
        !           236: .i
        !           237: Operators with implicit values:
        !           238: .r
        !           239: The following routines append the named operator along with the values
        !           240: specified, with the assumption that other values have been appended through
        !           241: previous calls to the literal interface:
        !           242: .RS
        !           243: .lp
        !           244: .b
        !           245: Mask Operators
        !           246: .RS
        !           247: .ip \fILineTo\|(n:\ x,\ n:\ y)\fR
        !           248: .ip \fILineToX\|(n:\ x)\fR
        !           249: .ip \fILineToY\|(n:\ y)\fR
        !           250: .ip \fIMakeOutline\|(i:\ count)\fR
        !           251: .RE
        !           252: .lp
        !           253: .b
        !           254: Stack Operators
        !           255: .RS
        !           256: .ip \fICopy\|(i:\ count)\fR
        !           257: .ip \fIRoll\|(i:\ depth,\ i:\ movefirst)\fR
        !           258: .ip \fIMark\|(i:\ count)\fR
        !           259: .ip \fIUnmark\|(i:\ count)\fR
        !           260: .RE
        !           261: .lp
        !           262: .b
        !           263: Vector Operators
        !           264: .RS
        !           265: .ip \fIGet\|(n:\ index)\fR
        !           266: .ip \fIMakeVec\|(I:\ upper)\fR
        !           267: .ip \fIMakeVecLU\|(i:\ lower,\ i:\ upper)\fR
        !           268: .RE
        !           269: .RE
        !           270: .lp
        !           271: .i
        !           272: Templates:
        !           273: .r
        !           274: Several procedures are provided for common Interpress operations which may
        !           275: logically combine groups of operators and values.  Those procedures are:
        !           276: .RS
        !           277: .ip \fISetupFont\|(s:\ name,\ i:\ size,\ i:\ fontnumber)\fR
        !           278: .ip \fIShowString\|(s:\ string)\fR
        !           279: .RE
        !           280: .lp
        !           281: .r
        !           282: The following procedures append encoded pixel vectors.
        !           283: .RS
        !           284: .ip \fIAppendPPVector\|(i:\ length,\ i:\ bitsPerPixel,\ i:\ pixelsPerScanLine,\ p:\ data)\fR
        !           285: .ip \fIAppendCPVector\|(i:\ length,\ i:\ breakTable,\ i:\ nRange,\ i:\ pixelsPerScanLine,\ p:\ data)\fR
        !           286: .RE
        !           287: .sh 2 "Using the Program Interface"
        !           288: .lp
        !           289: The software which uses these Interpress interfaces can find the
        !           290: the desired subroutines in the Interpress library
        !           291: .i libip.a
        !           292: which exists in the directory
        !           293: .i ${SRC}/lib
        !           294: as distributed.
        !           295: .lp
        !           296: There are also several include files in the directory
        !           297: .i ${SRC}/include
        !           298: which contain the following utilities:
        !           299: .RS
        !           300: .ip iptokens.h
        !           301: definitions for the Interpress encoding of tokens, sequence types and operators
        !           302: .ip literal.h
        !           303: macro definitions for portions of the literal interface 
        !           304: .ip operator.h
        !           305: macro definitions for most of the operator interface
        !           306: .RE
        !           307: .lp
        !           308: Note that ${SRC} above denotes the path in which the Interpress software was
        !           309: loaded on the host system.
        !           310: .sh 3 "An example using the program interfaces"
        !           311: .lp
        !           312: The following short C program demonstrates an Interpress
        !           313: generation facility. This will produce an Interpress master on the file
        !           314: descriptor stdout which will print the line "This is an Interpress test"
        !           315: across the top of the page.
        !           316: .in +5n
        !           317: .lp
        !           318: \f(TR#include "iptokens.h"
        !           319: .br
        !           320: #include "literal.h"
        !           321: .br
        !           322: #include "operator.h"
        !           323: .br
        !           324: main()
        !           325: .br
        !           326: {
        !           327: .in +5n
        !           328: ip_select(1);  /* open stdout */
        !           329: .br
        !           330: AppendOp(OP_beginBlock);
        !           331: .br
        !           332: AppendOp(OP_beginBody);
        !           333: .br
        !           334: /* establish default font */
        !           335: .br
        !           336: SetupFont("Xerox/XC1-1-1/Classic",100.,1);
        !           337: .br
        !           338: AppendRational(353,10000000);  /* scale of 1/10 point */
        !           339: .br
        !           340: AppendOp(OP_scale);
        !           341: .br
        !           342: AppendInteger(2);
        !           343: .br
        !           344: AppendOp(OP_fset);     /* save in frame variable 2 */
        !           345: .br
        !           346: AppendOp(OP_endBody);  /* end preamble */
        !           347: .br
        !           348: AppendOp(OP_beginBody);        /* start page 1 */
        !           349: .br
        !           350: FGet(2);       /* retrieve scale */
        !           351: .br
        !           352: SetFont(1);    /* retrieve default font */
        !           353: .br
        !           354: SetXY((double)1440,(double)7200);
        !           355: .br
        !           356: ShowString("This is an Interpress test");
        !           357: .br
        !           358: AppendOp(OP_endBody);
        !           359: .br
        !           360: AppendOp(OP_endBlock);
        !           361: .br
        !           362: ip_close();    /* close file */
        !           363: .in -5n
        !           364: }
        !           365: .in -5n
        !           366: .lp
        !           367: The text representation of the Interpress master produced by the above
        !           368: program is shown below:
        !           369: .(l I
        !           370: \f(TRHeader: "Interpress/Xerox/2.1 "
        !           371: BEGIN (block)
        !           372: {
        !           373: > Identifier: Xerox
        !           374: > Identifier: XC1-1-1
        !           375: > Identifier: Classic
        !           376: 3
        !           377: makevec
        !           378: findfont
        !           379: 100
        !           380: scale
        !           381: modifyfont
        !           382: 1
        !           383: fset
        !           384: > Rational: 353/10000000 (0.000035)
        !           385: scale
        !           386: 2
        !           387: fset
        !           388: }
        !           389: {
        !           390: 2
        !           391: fget
        !           392: 1
        !           393: setfont
        !           394: 1440
        !           395: 7200
        !           396: setxy
        !           397: > String: "This is an Interpress test"
        !           398: show
        !           399: }
        !           400: END (block)
        !           401: .)l

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.