AMT Datasouth Fastmark PALTM Print and Program Language Reference Guide P/N 108744 Rev.
Copyright 2003 by AMT Datasouth Corporation. All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means without the written permission of the publisher. PUBLISHED BY AMT Datasouth 4216 Stuart Andrew Boulevard Charlotte, North Carolina 28217 Phone: 704.523-8500 Service 800.476.2450 Sales: 800.476.2120 Internet: www.amtdatasouth.
Revised 4 December, 2003. PAL is a trademark of AMT Datasouth Corporation. All other brand and product names are trademarks or registered trademarks of their respective companies.
Contents 1. Introduction ................................................................. 1 2. PAL Fundamentals...................................................... 3 2.1. The PAL Interpreter .........................................................................................3 2.2. Sending Data to PAL Printers..........................................................................3 2.3. PAL Objects.....................................................................................................
vi PAL Print and Program Language Reference 3.3. Internal Objects ..............................................................................................18 3.3.1. Intrinsic Operator Objects ......................................................................................18 3.3.2. File Objects ............................................................................................................19 3.3.3. Font Objects .........................................................................
1. Introduction Welcome to the world of the PAL™ Print and Program Language. Since PAL™ is both a powerful printing language and programming language, many print applications not previously possible are now within reach. Now you don’t have to get a different software-specific printer for every application in your facility. AMT Datasouth PAL™ enabled printers such as the Fastmark™ line can translate, filter, interpret and understand almost any data stream.
2. PAL Fundamentals 2.1. The PAL Interpreter Every PAL printer contains a copy of the PAL interpreter. The PAL interpreter is the software inside the PAL printer which the printer's internal computer executes. Although the PAL interpreter serves a different purpose, it is essentially an application program just like any word processing or spreadsheet application program run on a general purpose computer. 2.2.
4 PAL Language Reference PAL requires the user to separate each object with at least one of the preceeding whitespace characters, or one of the following special characters.
PAL Fundamentals 5 2.6. Post-Fix Notation PAL receives data objects and operation objects in an order known as post-fix notation. This means that the data upon which an operator will operate occurs before the operator itself. This differs from the algebraic notation which everyone learned in school. In school, algebraic equations looked like the following. (1+2)×(4+5) In post-fix notation, this same equation has the following format.
6 PAL Language Reference second "add" and the "3" from the first add and multiplies them together. It then pushes the result, "27," onto the operand stack. The following diagram shows the contents of the operand stack when PAL finishes processing each object in the above sequence. 1 2 1 2 1 add 4 5 add mul 3 4 3 5 4 3 9 3 29 Stack 2.7. systemdict, globaldict, userdict PAL supports a data structure called a dictionary.
PAL Fundamentals 7 When PAL encounters an executable name, PAL goes to the dictionary stack to find out what to do. PAL starts by trying to locate the name in the top-most dictionary on the dictionary stack. If it cannot find the name, it then tries the next dictionary down on the stack. PAL continues down the stack until it locates the name. Once PAL locates the name, it stops searching.
8 PAL Language Reference The programmer still has references to a given object so long as the programmer still has some means of acessing the object. For example, object A may contain the only reference anywhere in memory to the object B. In turn, the object B may contain the only reference anywhere in memory to the object C. And the operand stack may contain the only reference to object A.
PAL Fundamentals 9 transformation matrix also includes three additional constant values. However, since the extra values do not change, PAL does not need to keep the values as part of the matrix. The following diagram shows the mathematical representation of a transformation matrix. A C E B D F 0 0 1 Special mathematical rules exist for changing the values A through F in response to scaling, rotating, and relocating the origin (translating) of a coordinate system.
3. Objects PAL allows programmers to store various different types of data into the printer's memory. PAL uses the term object to refer to each different piece of data stored within the printer's memory. Each object has a type. An object's type indicates how PAL will interact with that particular object. The PAL language groups the various object types into two classifications — simple and composite. In addition, PAL includes a classification of object types internally used by PAL.
12 PAL Language Reference significant digits for their floating-point values. However, these six digits can represent the value 1 trillion (1,000,000,000,000) or 1 trillionth (0.000,000,000,001). Floating-point values work very well in scientific applications. For example, specifying the distance to a star or the size of an atom. However, they do not work very well in business applications. Business applications tend to require a smaller range of values, but many more significant digits.
Objects 13 In many cases, the programmer will not wish PAL to duplicate the value portion. Duplicating only the object portion of the string does not consume very much of the printer's memory. On the other hand, duplicating the value portion of a large string will consume a large amount of the printer's memory. PAL accepts strings as text enclosed in parenthesis. For example, "(hello)" specifies a string consisting of the characters "h," "e," "l," "l," and "o.
14 PAL Language Reference an object or an operation associated with the name. If PAL encounters the name while creating a procedure, PAL does not execute the name at that time. PAL simply stores the name as part of the procedure. PAL will execute the name later when the programmer instructs PAL to execute the procedure. If the programmer places a single forward slash in front of the name, PAL treats the name as literal. For example, PAL will treat the character sequence "/MyName" as a literal name.
Objects 15 that names cannot include the special characters which PAL uses for other purposes. Specifically, names cannot include any of the following object separator characters. ()<>[]{}/% Also, a name cannot satisfy the rules for an integer or fixed-point object. Otherwise, PAL will treat the name as an integer or fixed-point object. Therefore, PAL accepts "1+" as a name, but "+1" as an integer object. Likewise, PAL accepts ".1" and "1." as names, but "0.1" and "1.0" as fixedpoint objects. 3.1.6.
16 PAL Language Reference Unlike most other programming languages, PAL does not treat the "[" and "]" operators as special language syntax symbols. PAL does not treat the operators and data it encounters between the "[" and "]" operator any different than if it had not encountered the "[" operator. In fact, once PAL places the mark object onto the stack in response to the "[" operator, PAL totally forgets that it ever saw the "[" operator.
Objects 17 3.2.2. Dictionary Objects The programmer creates dictionary objects in the exact same manner as arrays. Except, dictionary objects use the "<<" and ">>" operators. The "<<" operator serves the exact same purpose as the "[" operator and mark predefined name. When PAL encounters the "<<" operator, PAL simply pushes a mark object onto the stack. Later, when PAL encounters the ">>" operator, PAL builds a dictionary object from all the objects on the stack above the top-most mark object.
18 PAL Language Reference PAL also allows nested procedure definitions. This means that one procedure definition, enclosed in the "{" and "}" operators, can contain another procedure, enclosed in its own set of "{" and "}" operators. While PAL records the operators and objects contained within the "{" and "}" operators, PAL does not perform any of the operations for the operators it encounters. One exception to this rule exists.
Objects 19 Therefore, systemdict establishes the association between a particular name and an intrinsic operation. PAL allows the programmer to supercede the associations in this dictionary. As a result, unlike other programming languages, PAL does not really treat the default names associated with each operation as reserved words. However, changing the definition of PAL's standard names only serves to make the programmer's PAL code harder to understand. 3.3.2.
4. Operators This section uses a consistent set of notation rules to summarize the operation of the numerous operators available under the PAL language. The operator usage summary lines show the operator written in a monospaced bold font. For easier reading, this manual also uses a sans-serif upright font for operators listed within the main text. The list of objects which the operator expects to find on the operand stack appear to the left of the operator.
22 PAL Language Reference 4.1. Alphabetical Summary Any AnyNum Any1Num Any2Num Any1Bool Any2Bool Any1Int Any2I|nt ElementsInt DataAny [CtrlDict] FormatName AnyDict AnyProc AnyInt ShiftInt AnyNum NAny..1Any LeadStr TrailStr NAny..1Any NInt 1Array 2Array 1Dict 2Dict 1Str 2Str NAny..1Any Mark NAny..
Operators AnyStr IndexInt LengthInt Any1Num Any2Num Any1Text Any2Text DividendInt DivisorInt AnyBool TrueProc AnyBool TrueProc FalseProc WNum HNum PolBool TmArray SrcProc Any1Bool Any2Bool Any1Int Any2Int NAny..
24 PAL Language Reference WidthNum TimeArray ControlDict ShowStr PagesNum CharsInt AnyStr Any1Num Any2Num XTransNum YTransNum AnyNum AnyDict KeyAny OpenFile AnyStr Any1Bool Any2Bool Any1Int Any2Int setlinewidth _setlocaltime setpagedevice show showpage _showpages string stringwidth stroke sub translate _trap_ truncate undef userdict vmstatus writestring xor xor NullStr XDeltaNum YDeltaNum DifNum TruncatedNum userdict BytesInt XorBool XorInt
== 25 == Description Writes the PAL language format of any object to %stdout. Usage Any == Any Any object type. Object which interpreter will write to %stdout. Comments If the stack contains a composite object, the interpreter will also write all objects which comprise the composite object. Writing of composite objects will continue through all nesting levels. Some objects which can reside in memory do not have corresponding PAL language representations.
<<...>> 26 <<...>> Description Operator pair used to define a dictionary data object. Usage <<...>> Dict Dict Dictionary. Object defined by operator pair. Comments In other programming languages, the language would treat symbols like these as syntactical in nature as opposed to executable. However, under PAL, the PAL interpreter executes these symbols in the same manner as add or any other PAL operator.
27 <<...>> Once the interpreter has created the dictionary, it pushes the dictionary object onto the top of the operand stack. Hints PAL dictionaries function in the same manner as key indexed data files. Using a dictionary, a programmer can create a file of key accessed data records directly within the PAL printer's memory. By associating an array with each key entry within the dictionary, the programmer can recall an entire record of data simply by supplying the key associated with the array.
[...] 28 [...] Description Operator pair used to define an array object. Usage [...] Array Array Array. Object defined by operator pair. Comments In other programming languages, the language would treat symbols like these as syntactical in nature as opposed to executable. However, under PAL, the PAL interpreter executes these symbols in the same manner as add or any other PAL operator. The PAL interpreter executes the opening ("[") and closing ("]") symbols as completely independent operators.
abs 29 abs Description Returns the absolute value of any number. Usage AnyNum abs AbsNum AnyNum Integer or fixed-point. Number from which to return absolute value. AbsNum Integer or fixed-point. Absolute value of AnyNum. Same object type as AnyNum. Comments The abs operator pops the top object from operand stack, calculates the object's absolute value, and pushes the result onto the operand stack. The result's type will match the original value's type.
add 30 add Description Adds two numbers and returns the sum. Usage Any1Num Any2Num add SumNum Any1Num Integer or fixed-point. First number to add. Any2Num Integer or fixed-point. Second number to add. SumNum Integer or fixed-point. Integer if Any1Num and Any2Num are both integer, otherwise fixed-point. Sum of Any1Num and Any2Num. Comments The add operator pops the top two objects from operand stack, adds them together, and pushes the result back onto the operand stack.
and 31 and Description Performs a logical or bit-wise and operation on two boolean or integer values. Usage Any1Bool Any2Bool Any1Int Any2Int and and AndBool AndInt Any1Bool Boolean. First operand for the logical and operation. Any2Bool Boolean. Second operator for the logical and operation. AndBool Boolean. Result of the logical and operation. Any1Int Integer. First operand for the bit-wise and operation. Any2Int Integer. Second operand for the bit-wise and operation. AndInt Integer.
array 32 array Description Creates an array entirely consisting of null objects. Usage ElementsInt array NullArray ElementsInt Integer. Number of elements to include within array. NullArray Array. Array containing ElementsInt null objects. Comments The array and [...] operators perform similar functions. However, the [...] operators require the programmer to supply initialization data for a new array. The array operator does not require initialization data.
_barcode 33 _barcode Description Draws a bar code in a specified format. Usage DataStr [CtrlDict] FormatName _barcode DataStr String. This is the data to be encoded in the bar code. See bar code specific discussions below for data requirements for each bar code format. See appendix A., Bar Code Considerations for a description of the capabilities, limitations, and special rules for PAL bar codes. CtrlDict Optional dictionary.
_barcode: Code 128 34 _barcode: Code 128 DataStr [CtrlDict] /Code128 _barcode This symbology conforms to the USS-128 specification. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /CheckDigit /CD Boolean. true instructs PAL to calculate the check digit and insert it into the data string. false will instruct PAL to use the data string without modification. Default value = true.
35 _barcode: Code 128 string beginning with a tilde (~). To get the character tilde, two tildes (~~) are used. These characters are shown in the following table. Three characters, \ ( and ), require special handling in PAL. The backslash character, \, is an escape character for encoding special characters in PAL strings. To get the backslash character itself, you must use a double backslash (\\). The parenthesis characters are used in PAL to indicate the beginning and ending of a string.
_barcode: Code 128 36 Value Code A A String Code B B String Code C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 SP ! " # $ % & ' ( ) * + , . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U () (!) (") (#) ($) (%) (&) (') (\() (\)) (*) (+) (,) (-) (.
37 _barcode: Code 128 The generated image includes leading and trailing quiet zones (white space). The size of the quiet zone is 10 times NarrowWidth. If this results in a quiet zone of less than 0.10 inch (2.54 mm), the user should leave additional white space before and after the bar code. The following example generates 0.5 inch tall Code 128 bar code with 0.01 inch narrow bars and no human readable.
_barcode: Code 39 38 _barcode: Code 39 DataStr [CtrlDict] /Code39 _barcode This symbology conforms to the USS-39 specification. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /CheckDigit /CD Boolean. true instructs PAL to automatically calculate the check digit and insert it at the end of the data string just before the stop character. false instructs PAL to use the data string without modification.
_barcode: Code 39 39 Character Set Valid characters for Code 39 bar codes are the digits 0 through 9, the capital letters A through Z, a space, and the characters - . $ / + % and *. Any other characters will cause the string to be rejected with a rangecheck error. Extended Character Set Code 39 supports a scheme for encoding the full ASCII character set. By combining the characters $ + % and / with valid Code 39 characters as shown in the following table, all ASCII characters may be encoded.
_barcode: Code 39 (BAR CODE 39) <
_barcode: Code 93 41 _barcode: Code 93 DataStr [CtrlDict] /Code93 _barcode This symbology conforms to the USS-93 specification. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /Height /H Integer or fixed-point. Specifies the height, in current user coordinates, of the bar code. This value should be at least 0.25 inches (6.35 mm) or 15% of the bar code symbol length, whichever is greater.
_barcode: Code 93 42 ASCII PAL String ASCII PAL String ASCII PAL String ASCII PAL String NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US (~%U) (~$A) (~$B) (~$C) (~$D) (~$E) (~$F) (~$G) (~$H) (~$I) (~$J) (~$K) (~$L) (~$M) (~$N) (~$O) (~$P) (~$Q) (~$R) (~$S) (~$T) (~$U) (~$V) (~$W) (~$X) (~$Y) (~$Z) (~%A) (~%B) (~%C) (~%D) (~%E) SP ! " # $ % & ' ( ) * + , .
_barcode: Code 93 43 Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /CheckDigit /CD Boolean. No check digit is required for this symbology. If this entry is set to true, a check digit will be calculated using the algorithm suggested in the USS-Codabar specification. Default value = false. /Height /H Integer or fixed-point. Specifies the height, in current user coordinates, of the bar code.
_barcode: EAN-8 44 _barcode: EAN-8 DataStr [CtrlDict] /EAN8 _barcode This symbology conforms to the General EAN specification. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /CheckDigit /CD Boolean. true instructs PAL to automatically calculate the check digit and insert it at the end of the data string, just before the stop character. The check digit will also be part of the human readable text.
_barcode: EAN-13 45 _barcode: EAN-13 DataStr [CtrlDict] /EAN13 _barcode This symbology conforms to the General EAN specifications. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /AddOn2 /AO2 Boolean. true instructs PAL to add a 2-digit add-on bar code to the base bar code. false instructs PAL not to add the add-on bar code. Default value = false. /AddOn5 /AO5 Boolean.
_barcode: EAN-13 46 the 13th digit to receive the check digit. Specifying short strings causes the string to be padded with zeros and the last character to be replaced by the check digit. If the RandWt4 or the RandWt5 flags are true, the last 4 or 5 digits before the check digit contain a random weight or a price. This allows in-store marking of such items as meat or cheese. A check digit for the random weight is calculated and replaces the character immediately preceding the 4- or 5-digit field.
_barcode: Interleave 2 of 5 47 _barcode: Interleave 2 of 5 DataStr [CtrlDict] /I2of5 _barcode This symbology conforms to the USS-I 2/5 specification. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /CheckDigit /CD Boolean. true instructs PAL to automatically calculate a check digit based on the algorithm suggested in the USS-I2/5 specification. false instructs PAL to not calculate the check digit.
_barcode: Interleave 2 of 5 48 The generated bit map includes leading and trailing quiet zones (white space). The size of the quiet zone is 10 times NarrowWidth. If this results in a quiet zone of less than 0.10 inch (2.54 mm), the user should leave additional white space before and after the bar code. The following example generates 0.5 inch tall Interleaved 2-of-5 bar code with 0.01 inch narrow bars and a ratio of 2.5:1. (12345678) <
_barcode: PDF-417 49 _barcode: PDF-417 DataStr [CtrlDict] /PDF417 _barcode This symbology conforms to the UPC Symbol Specification Manual. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /AddresseeId /AI String. Range 1..200 characters. Specifies the data for the PDF417 “Addressee ID” macro field.
_barcode: PDF-417 50 /FileId /FI String. Range 1..50 characters. Specifies the data for the PDF417 “File ID” macro field. The bar code will not include the File ID macro field if this parameter is not specified or an empty string is specified. Default = Empty string (field not included in bar code). /FileName /FN String. Range 1..200 characters. Specifies the data for the PDF417 “File Name” macro field.
_barcode: PDF-417 51 /Truncate /TR Boolean. true instructs PAL to not draw the right side indicators and right stop pattern for the bar code. false instructs PAL to draw these patterns. Default = false. Usage Notes Error correction coding (ECC) consists of additional data added to the user’s data in order to facilitate recovery of the user’s data even when the bar code has been damaged and cannot be fully scanned.
_barcode: PDF-417 52 Users already famility with the details of PDF-417 bar codes will also already be familiar with the various configuration parameters provided by PAL.
_barcode: UPC-A 53 _barcode: UPC-A DataStr [CtrlDict] /UPCA _barcode This symbology conforms to the UPC Symbol Specification Manual. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /AddOn2 /AO2 Boolean. true instructs PAL to add a two-digit add-on bar code to the base bar code. false instructs PAL not to add the add-on bar code. Default value = false. /AddOn5 /AO5 Boolean.
_barcode: UPC-A 54 places the 12th digit with the new check digit. The data string should contain a dummy character in the 12th digit to receive the check digit. Do not assume that only 11 digits are needed. Specifying short strings causes the string to be padded with zeros and the last character being replaced by the check digit. If the RandWt4 or the RandWt5 flags are true, the last 4 or 5 digits before the check digit contain a random weight or a price.
_barcode: UPC-E 55 _barcode: UPC-E DataStr [CtrlDict] /UPCE _barcode This symbology conforms to the UPC Symbol Specification Manual. Applicable Control Dictionary Entries See appendix A., Bar Code Considerations for a discussion of the relationship between the CTM and default values. /Height /H Integer or fixed-point. Specifies the height, in current user units, of the overall bar code. For this bar code symbology, the height includes the human readable text. Default value = 36.0 (0.5" / 12.
_barcode: UPC-E 56 (12300000640) <> /UPCE _barcode (078349) <
begin 57 begin Description Pushes a dictionary onto the dictionary stack. Usage AnyDict begin AnyDict Dictionary. Dictionary to push onto the dictionary stack. Comments The PAL interpreter searches the dictionary stack in order to locate values associated with names the interpreter encounters during PAL code execution. The interpreter always searches for names starting with the top-most dictionary on the dictionary stack. The interpreter continues searching down the stack until it locates the name.
begin 58 Line 2 places the procedure's empty dictionary onto the top of the dictionary stack. Lines 3 and 4 save the second and first parameters to the procedure under the variable names Second and First within the procedure's dictionary. Line 5 recalls the two values using the variable names and then performs the averaging equation. Line 6 discards the procedure's dictionary from the dictionary stack.
bind 59 bind Description Optimizes the specified procedure for faster execution. Usage AnyProc bind BoundProc AnyProc Procedure. The procedure to optimize. BoundProc Procedure. The same procedure after optimization. Comments When initially sent to a PAL printer by a programmer, a procedure contains executable name objects which reference intrinsic operator objects in the dictionary stack.
bitshift 60 bitshift Description Shifts the bits of an integer left for positive shift counts, and right for negative shift counts. Usage AnyInt ShiftInt bitshift ShiftedInt AnyInt Integer. Integer value consisting of bits to shift. ShiftInt Integer. Distance, in bits, over which to shift the bits of AnyInt. Positive values for ShiftInt result in left-shifts. Negative values result in right-shifts.
ceiling 61 ceiling Description Returns the next higher integer value. Usage AnyNum ceiling CeilingNum AnyNum Integer or fixed-point. Value to raise to the next higher integer. CeilingNum Integer or fixed-point. Next higher integer above AnyNum. The type of the returned value matches the type of the supplied parameter. Comments Although this operator will accept integer values, this operator has no affect upon integers.
clear 62 clear Description Discards all objects from the operand stack. Usage NAny..1Any clear NAny..1Any Any. All objects on the operand stack. Comments The clear operator discards all objects from the operand stack. The programmer will find this operator useful for ensuring a clean stack at the start of a job.
cleartomark 63 cleartomark Description Discards all objects from the operand stack down to, and including, the top-most mark object. Usage Mark NAny..1Any cleartomark Mark Mark. Top-most mark object on the stack. NAny..1Any Any. All objects on the operand stack above the top-most mark object. Comments The cleartomark operator discards all objects from the operand stack above the top-most mark object. The operator also discards the mark object itself.
closepath 64 closepath Description Closes the current drawing sub-path by drawing a line from the current point to the initial point of the sub-path. Usage closepath Comments Paths consist of a series of line segments. As the programmer adds additional line segments onto the end of a path, PAL joins the lines in memory. By joining the lines, PAL can smooth the transition between two line segments during drawing.
65 closepath Hints The programmer should always use the closepath operator instead of the final lineto operator to close the path. The closepath operator implies a lineto operation. Therefore, drawing a square involves a moveto operation, three lineto operations, and a final closepath operation. At a minimum, specifying four lineto operations followed by a closepath operation wastes time and a little memory. However, under certain circumstances, it may also produce undesired results.
concat 66 concat Description Appends one string to the end of another string. Usage LeadStr TrailStr concat ConcatStr LeadStr String. The string containing the characters which PAL will place at the start of the new ConcatStr string. TrailStr String. The string containing the characters which PAL will place at the end of the new ConcatStr string. ConcatStr String. The new string created by the interpreter which begins with the characters from LeadStr and ends with the characters from TrailStr.
copy 67 copy Description Duplicates multiple stack objects or copies one array, dictionary, or string to anther array, dictionary, or string. Usage NAny..1Any NInt 1Array 2Array 1Dict 2Dict 1Str 2Str copy copy copy copy NAny..1Any NAny..1Any 2Array 2Dict 2Str NAny..1Any Any. Stack objects to duplicate. NInt Integer. Number of stack objects to duplicate. 1Array Array. Source array to copy to 2Array. 2Array Array. Target array to receive copy of 1Array. 1Dict Dictionary.
copy 68 Hints The following examples demonstrate the subtle difference between using the dup and copy operators. The first example shows the use of the dup operator to place a second reference to an array onto the stack. The second example shows the use of the copy operator to make a copy of an array into a new array. The second and third lines of each example shows the interpreter's output in response to the == operators.
count 69 count Description Returns a count of the number of objects currently on the operand stack. Usage NAny..1Any count NAny..1Any NInt NAny..1Any Any. All objects on the operand stack. NInt Integer. Number of objects on the operand stack.. Comments The count operator pushes onto the operand stack a count of the number of objects resident on the operand stack prior to execution of the count operator.
counttomark 70 counttomark Description Returns a count of the number of objects currently on the operand stack above the top-most mark object. Usage Mark NAny..1Any count Mark NAny..1Any NInt Mark Mark. Top-most mark object on the operand stack. NAny..1Any Any. All objects on the operand stack above the top-most mark object. NInt Integer. Number of objects on the operand stack above the top-most mark object.
currentdict 71 currentdict Description Returns the dictionary object currently on the top of the dictionary stack. Usage currentdict CurDict CurDict Dictionary. Dictionary object current on top of the dictionary stack. Comments currentdict pushes a dictionary object for the dictionary currently on top of the dictionary stack. The operator does not alter the dictionary stack. The dictionary remains on top of the dictionary stack.
currentgray 72 currentgray Description Returns the current color setting mapped to the DeviceGray color space. Usage currentgray LevelFxpt LevelFxp Fixed-Point. Current color setting mapped to the DeviceGray color space. The value ranges from 0.0 (black) to 1.0 (white). Comments PAL currently only supports the DeviceGray color space. This operator will return the last gray level established using the setgray operator.
currentpoint 73 currentpoint Description Returns the coordinates of the current point. Usage currentpoint XNum YNum XNum Integer or fixed-point. Current X coordinate in user coordinates. YNum Integer or fixed-point. Current Y coordinate in user coordinates. Comments The operator returns the position of the current point. PAL returns the coordinates in the user coordinate system. Some PAL drawing applications move the current point.
cvs 74 cvs Description Converts a numeric value to a string containing the value's human readable decimal representation. Usage ValNum DummyStr cvs DecStr ValNum Integer or fixed-point. Numeric value to convert into a string. DummyStr String. Required for historical compatibility. The interpreter does not use this parameter. DecStr String. String created by the interpreter which contains the human readable decimal representation of ValNum.
cvx 75 cvx Description Converts a literal name or file object into a executable object. Usage LiteralFile LiteralName cvx cvx ExecFile ExecName LiteralFile File. Literal file object to convert to executable. ExecFile File. Literal file object converted to executable. LiteralName Name. Literal name object to convert to executable. ExecName Name. Literal name object converted to executable. Comments When PAL encounters an object for execution, it checks the object's literal/executable attribute.
cvx 76 must specify the file object associated with the file. By specifying the file object, the programmer informs PAL which file to read or write. Normally, the PAL interpreter reads the standard file %stdin to receive operations to perform. However, the programmer can use the exec operator to specify an different file for the interpreter to read. However, the exec operator requires that the programmer specify an executable file object and not a literal file object.
def 77 def Description Stores a data value under a specified key in the top-most dictionary on the dictionary stack. Usage KeyAny DataAny def KeyAny Any type. Key under which to store the specified object. DataAny Any type. Object to store under the specified key. Comments Both KeyAny and DataAny may be of any type. However, the interpreter provides special optimized handling of name objects when used as dictionary entry keys.
_devicefile 78 _devicefile Description Opens a device for reading and/or writing at a low access level. Usage FileStr AccessStr _devicefile OpenFile FileStr String. Specifies the name of the device to open. AccessStr String. Specifies the type of access to the device which the programmer desires. See the file operator discussion for information on AccessStr. Comments Only a very small percentage of PAL applications require the use of the _devicefile and file operators.
_deviceformat 79 _deviceformat Description Clears a low level device such as flash memory. Usage FileStr AccessStr _deviceformat FileStr String. Specifies the name of the device to open. AccessStr String. The access string for this operator must be an empty string, i.e. (). Comments This operator causes the storage device being accessed to be completely cleared. CAUTION must be used with this operator since any pre-loaded PAL applications in the specified device file will be lost.
dict 80 dict Description Creates an empty dictionary. Usage PairsInt dict EmptyArray PairsInt Integer. Number of key + value entry pairs anticipated for the dictionary. EmptyDict Dictionary. An empty dictionary. Comments This operator performs the exact same function as the PAL sequence "<<>>". The operator requires the PairsInt parameter strictly for historical compatibility.
div 81 div Description Divides the next-to-top stack value by the top stack value and returns the quotient. Usage DividendNum DivisorNum div QuotientFxp DividendNum Integer or fixed-point. Value to divide by DivisorNum. DivisorNum Integer or fixed-point. Value to divide into DividendNum. QuotientFxp Fixed-point. Result of division. The interpreter always returns a fixed-point result regardless of the operands.
_dspclear 82 _dspclear Description Clear an area of the printer's front panel character display. Usage BBoxArray _dspclear BBoxArray Array. Bounding box for area to clear. [Left Top Right Bottom] Left Integer or fixed-point. Left-most character column of display area to clear. The interpreter includes this column as part of the area cleared. Top Integer or fixed-point. Top-most character line of display area to clear. The interpreter includes this line as part of the area cleared.
_dspmovecursor 83 _dspmovecursor Description Reposition visible cursor on front panel character display. Usage ColumnNum LineNum _dspmovecursor ColumnNum Integer or fixed-point. Character column at which to locate visible cursor. LineNum Integer or fixed-point. Character line at which to locate visible cursor. Comments Most PAL printers with front panel displays have the ability to display a cursor on the display.
_dspmoveto 84 _dspmoveto Description Reposition invisible next character pointer on front panel character display. Usage ColumnNum LineNum _dspmoveto ColumnNum Character column at which to locate invisible next character pointer. LineNum Character line at which to locate invisible next character position. Comments On printers with front panel character displays, _dspmoveto allows the programmer to position the invisible next character pointer on the display.
_dspsetcursor 85 _dspsetcursor Description Select front panel character display visible cursor style. Usage ControlDict _dspsetcursor ControlDict Dictionary. Controls for establishing new visible cursor style. /Block Boolean. true enables the displaying of a block style cursor. false disables the block style cursor. Enabling the block style cursor does not necessarily disable any other cursor style. Some displays have the ability to display multiple cursor styles at one time. /DspEnable Boolean.
_dspstring 86 _dspstring Description Displays text at the invisible next character position on the front panel character display. Usage AnyStr _dspstring AnyStr String. Text to display. Comments This operator provides the primary means for programmers to display messages on the printer's front panel character display. Programmers should expect to find this operator only on printers with front panel displays.
dup 87 dup Description Pushes a second copy of the top-most object on the operand stack. Usage Any dup Any Any Any Any. Stack object to duplicate. Comments This operator performs the same function as the PAL sequence "1 copy". It simply duplicates the top-most object on the operand stack. For composite objects, the source and duplicate objects will share the same composite data.
end 88 end Description Pops the top-most dictionary from the dictionary stack. Usage end Comments The end operator removes dictionaries from the dictionary stack placed there by the begin operator. The begin operator discussion also covers the end operator.
eq 89 eq Description Compare two objects for equality. Usage 1Any 2Any eq Bool 1Any Any. First object to compare. With the exception of integer, fixed-point, string, and name objects, 1Any must have the same object type as 2Any. The operator will compare integer and fixed-point objects in any combination. The operator will also compare any combination of string and name objects. 2Any Any. Second object to compare. Bool Boolean. A value of true indicates equality.
erasepage 90 erasepage Description Discard all drawing previously performed on the current page. Usage erasepage Comments Under most circumstances, programmers will have no use for this operator. The operator has the affect of canceling all previous drawing performed on the current page.
exch 91 exch Description Exchange the top-most object on the operand stack with the next lower object. Usage 1Any 2Any exch 2Any 1Any 1Any Any. Second-to-top object on the operand stack. 2Any Any. Top-most object on the operand stack. Comments exch simply exchanges the positions of the two top objects on the operand stack.
exec 92 exec Description Execute the object on the top of the operand stack. Usage Any exec Any Any. Object to execute. Comments As PAL encounters objects received from the host computer or contained in procedures, PAL executes each object. In most cases, when PAL encounters an object, it marks the object as literal. This means that PAL will treat the object as data. When PAL executes a literal object, it does nothing more than push the object onto the top of the operand stack.
_execexit 93 _execexit Description Terminates executive mode and returns the printer to normal host communications mode. Usage _execexit Comments Although well suited for experimenting with PAL operators, PAL's executive mode generates prompts and other extraneous output which generally prove undesirable when communicating directly with a host computer.
execform 94 execform Description Captures the results of a drawing sequence for faster reuse on the same or subsequent pages. Usage FormDict execform FormDict Dictionary. Contains parameters for capturing the desired drawing sequence as well as the procedure which performs the drawing sequence. This dictionary contains the following entries. /BBox [LeftNum BottomNum RightNum TopNum] Array. Specifies the area on the page in which PAL will capture any drawing operations.
95 execform After PAL captures the drawing sequences and has created the form, PAL saves the form image inside FormDict. Whenever PAL executes the execform operator, it checks the specified FormDict to see if the dictionary already contains a previously created form. If the dictionary already contains a form, PAL does not bother to execute the drawing sequences. Instead, PAL simply renders the already created form onto the page.
execform 96 /FormNameProc { ...form drawing instructions... } bind def /FormNameDict << /FormType 1 /BBox [Left Bottom Right Top] /Matrix [1 0 0 1 0 0] /PaintProc {FormNameProc} >> def FormNameDict execform First, the user should select some name for the form. This name should replace FormName in the above template. This will result in the definition of a procedure under the selected form name with Proc appended to the end of the form name.
executive 97 executive Descriptions Places the printer into a prompted line input mode to facilitate experimentation with PAL operators using a terminal or terminal emulation program. Usage executive Comments executive mode makes it easier for a programmer to directly interface with the PAL interpreter using a terminal or terminal emulation program. Under executive mode, the interpreter will prompt the programmer when the interpreter requires additional input.
exit 98 exit Descriptions Terminate the inner-most active loop. Usage exit Comments The exit operator allows the programmer to prematurely terminate a loop. The operator terminates only the inner-most active loop. Since the loop operator includes no termination condition for the loop it creates, the programmer must use the exit operator to terminate a loop created by the loop operator. The exit operator will also terminate loops created by the for and repeat operators.
file 99 file Description Opens a data file for reading and/or writing. Usage FileStr AccessStr file OpenFile FileStr String. Specifies the name of the file to open. AccessStr String. Specifies the type of access to the file which the programmer desires. PAL currently supports the value AccessStr values. (a) Write-only access. If the file exists, the file's write pointer will be automatically set to the end of the file (append). If the file does not exist, the file will be created.
file 100 All PAL printers recognize the following standard file names. %stdin Standard input file. Normally the communications port connected to the host computer. Read-only access. %stdout Standard output file. Normally the communications port connected to the host computer. Write-only access. %stderr Standard error output file. Normally the same as %stdout. Write-only access.
fileposition 101 fileposition Description Pushes the offset of a file's read/write pointer onto the operand stack. Usage OpenFile fileposition PositionInt OpenFile File. File object for open file from which to return file's read/write offset. PositionInt Integer. Offset of file's read/write pointer from start of file. A value of zero indicates the pointer points to the first byte of the file.
findfont 102 findfont Description Locates a font in the font resource directory. Usage FontName findfont FontDict FontName Literal name. Name assigned to font in the font directory. FontDict Dictionary. Copy of font's dictionary from the font directory. PAL creates a new dictionary containing the same information as the font's dictionary in the font directory. However, the programmer and PAL can add or delete entries in this new dictionary without affecting the original font dictionary.
floor 103 floor Description Returns the next lower integer value. Usage AnyNum floor FloorNum AnyNum Integer or fixed-point. Value to reduce to the next lower integer. FloorNum Integer or fixed-point. Next integer value at or below AnyNum. The type of the returned value matches the type of the supplied parameter. Comments Although this operator will accept integer values, this operator has no affect upon integers.
for 104 for Description Performs a procedure for a specified number of iterations. Usage StartNum IncNum StopNum AnyProc for StartNum Integer or fixed-point. Specifies the starting value for a counter maintained by the interpreter for the loop. IncNum Integer or fixed-point. Specifies the incrementing value for a counter maintained by the interpreter for the loop. StopNum Integer or fixed-point. Specifies the stopping value for a counter maintained by the interpreter for the loop.
for 105 [14 2 114 {} for]
ge 106 ge Description Determine whether the first object is greater than or equal to the second object. Usage Any1Num Any2Num Any1Text Any2Text ge ge Bool Bool Any1Num Integer or fixed-point. First numeric object to compare. Any2Num Integer or fixed-point. Second numeric object to compare. Any1Text String or name. First text object to compare. Any2Text String or name. Second text object to compare. Bool Boolean. A value of true indicates the first object meets or exceeds the second object.
get 107 get Description Recover data from a composite or string object. Usage AnyArray IndexInt AnyDict KeyAny AnyStr IndexInt get get get ElementAny ValueAny CharInt AnyArray Array. Array object containing desired object to recover. AnyDict Dictionary. Dictionary object containing desired object to recover. AnyStr String. String object containing desired character to recover. IndexInt Integer. When used with AnyArray, index of data object within array. Arrays begin with index zero.
getinterval 108 getinterval Description Recover a range of data from an array or string object. Usage AnyArray IndexInt LengthInt AnyStr IndexInt LengthInt getinterval getinterval SubArray SubStr AnyArray Array. Array object containing desired array sub-range to recover. AnyStr String. String object containing desired string sub-range to recover. IndexInt Integer. When used with AnyArray, index of first data object in sub-range within array. Arrays begin with index zero.
getinterval 109 example, the following sequences will return all objects or characters starting at index three through the end of MyArray or MyString. MyArray dup 3 exch length getinterval MyString dup 3 exch length getinterval PAL provides support for negative LengthInt values to allow the programmer to easily access the end of an array or string. The following examples return the last five objects in MyArray or the last five characters of MyString.
globaldict 110 globaldict Description Pushes the global dictionary, globaldict, onto the top of the operand stack. Usage globaldict GlobalDict GlobalDict Dictionary. Global dictionary, globaldict, from dictionary stack. Comments This operator was introduced for use in future PAL versions. The operator serves no functional purpose at this time. The userdict discussion includes information regarding globaldict.
gt 111 gt Description Determine whether the first object is greater than the second object. Usage Any1Num Any2Num Any1Text Any2Text gt gt Bool Bool Any1Num Integer or fixed-point. First numeric object to compare. Any2Num Integer or fixed-point. Second numeric object to compare. Any1Text String or name. First text object to compare. Any2Text String or name. Second text object to compare. Bool Boolean. A value of true indicates the first object exceeds the second object.
idiv 112 idiv Description Performs integer division of two numbers, placing the quotient back on the stack. Usage DividendInt DivisorInt idiv QuotientInt DividendInt Integer. Number which the interpreter will divide by DivisorInt. DivisorInt Integer. Number by which the interpreter will divide DividendInt. QuotientInt Integer. Result of integer division operation. Comments On most printers, PAL can perform integer division significantly faster than fixed-point division.
if 113 if Description Conditionally executes a procedure based upon a boolean value. Usage AnyBool TrueProc if AnyBool Boolean. Value which determines whether or not PAL executes TrueProc. A value of true instructs the interpreter to execute TrueProc. A value of false instructs PAL to not execute TrueProc. TrueProc Procedure. The procedure for PAL to execute given a value of true for AnyBool. Comments This operator provides the PAL programmer with the ability to optionally execute a given procedure.
ifelse 114 ifelse Description Conditionally executes one of two procedures based upon a boolean value. Usage AnyBool TrueProc FalseProc ifelse AnyBool Boolean. Value which determines whether or not PAL executes TrueProc or FalseProc. A value of true instructs the interpreter to execute TrueProc. A value of false instructs PAL to execute FalseProc. TrueProc Procedure. The procedure for PAL to execute given a value of true for AnyBool. FalseProc Procedure.
imagemask 115 imagemask Description Draws a rasterized image. Usage WNum HNum PolBool TmArray SrcProc imagemask WNum Integer. Width of source raster image in pixels. HNum Integer. Height of source raster image in pixels. PolBool Boolean. true indicates positive image polarity. false indicates negative image polarity. For positive image polarity, image bits with a value of one indicate black pixels. Image bits with a value of zero indicate white pixels.
imagemask 116 specifies the color of each successive pixel to the right. This process continues for WNum bits and pixels. Bit number WNum specifies the color of the right-most pixel on the top-most line. Bit number WNum+1 specifies the color of the left-most pixel on the second line from the top. Unlike most raster image formats, the PAL raster image format does not include any unused bits between the last bit of one line and the first bit of the next line.
imagemask 117 The PAL raster format requires the programmer to group the bits for the above image into bytes, as follows.
imagemask 118 For example, the following code will draw the above "smiling face" with the lower left corner at 0.5",0.75". The code will scale the image to 2" wide by 1" tall.
_imp 119 _imp Description Performs a logical or bit-wise implication operation on two boolean or integer values. Usage Any1Bool Any2Bool Any1Int Any2Int _imp _imp ImpBool ImpInt Any1Bool Boolean. First operand for the logical implication operation. Any2Bool Boolean. Second operator for the logical implication operation. ImpBool Boolean. Result of the logical implication operation. Any1Int Integer. First operand for the bit-wise implication operation. Any2Int Integer.
index 120 index Description Recovers an object from a lower level of the operand stack. Usage NAny..0Any IndexInt index NAny..0Any IndexedAny NAny..0Any Any. All objects on the operand stack. IndexInt Integer. Index of desired object on operand stack. The top-most object, prior to pushing IndexInt, has an index of zero. The next lower object has an index of one. IndexedAny Any. Requested object from operand stack. Comments This operator functions in a manner similar to the dup operator.
initgraphics 121 initgraphics Description Restores default values to various settings within the current graphics state. Usage initgraphics Comments PAL restores the following graphics state settings to the indicated defaults.
initmatrix 122 initmatrix Description Reset user coordinate system to PAL default coordinate system. Usage initmatrix Comments The PAL default coordinate system locates the origin at the bottom left corner of the page, a scaling factor of 1/72", and no rotation.
known 123 known Description Determines whether or not a given key exists within a given dictionary. Usage AnyDict KeyAny known Bool AnyDict Dictionary. Dictionary object to search for KeyAny. KeyAny Any. Key object for which to search in AnyDict. Bool Boolean. A value of true indicates that PAL found KeyAny within AnyDict. A value of false indicates that PAL did not find KeyAny within AnyDict.
le 124 le Description Determine whether the first object is less than or equal to the second object. Usage Any1Num Any2Num Any1Text Any2Text le le Bool Bool Any1Num Integer or fixed-point. First numeric object to compare. Any2Num Integer or fixed-point. Second numeric object to compare. Any1Text String or name. First text object to compare. Any2Text String or name. Second text object to compare. Bool Boolean. A value of true indicates the first object does not exceed the second object.
length 125 length Description Returns the size of the supplied parameter. Usage AnyArray AnyDict AnyStr length length length ElementsInt PairsInt CharsInt AnyArray Array. Array object of which to return its length. ElementsInt Integer. Number of objects in array. AnyDict Dictionary. Dictionary object of which to return its length. PairsInt Integer. Number of key + value pairs in dictionary. AnyStr String. String object of which to return its length. CharsInt Integer.
lineto 126 lineto Description Appends a line to the current path which extends from the current point to the specified point. Usage XNum YNum lineto XNum Integer or fixed-point. Specifies the X component of the user coordinate to which to extend the line. YNum Integer or fixed-point. Specifies the Y component of the user coordinate to which to extend the line. Comments The lineto operator does not actually draw a line on the current page.
_localtime 127 _localtime Description Returns the current time of day and date if available. Usage _localtime TimeArray TimeArray Array. [AvailBool TotalInt YearInt MonthInt DayInt HourInt MinInt SecInt Sec100Int DOYInt DOWInt ZoneFxp SaveInt] AvailBool Boolean. true if printer knows the time. false if printer does not know the time. TotalInt Integer. Total number of seconds elapsed since 00:00:00 on January 1, 1970. YearInt Integer. Current year. 1990, 1991, etc. MonthInt Integer.
_localtime 128 while powered-off. The programmer should check the printer's documentation for information concerning date and time maintenance. At some point, all PAL printers require an operator to set the current date and time. Printers which can maintain the correct date and time while powered-off only require the operator to set the time once, or once following any time changes. Printers which cannot maintain the correct time when powered-off need the operator to set the time following power-on.
loop 129 loop Description Repetitively executes the specified procedure until the interpreter encounters an exit operator. Usage AnyProc loop AnyProc Procedure. The procedure which the interpreter will repetitively execute. Comments PAL first removes the supplied procedure from the stack. The interpreter then continuously executes the procedure until the interpreter encounters an exit operator. The loop operator does not place any objects on the operand stack.
lt 130 lt Description Determine whether the first object is less than the second object. Usage Any1Num Any2Num Any1Text Any2Text lt lt Bool Bool Any1Num Integer or fixed-point. First numeric object to compare. Any2Num Integer or fixed-point. Second numeric object to compare. Any1Text String or name. First text object to compare. Any2Text String or name. Second text object to compare. Bool Boolean. A value of true indicates the first object does not meet or exceed the second object.
_ltrim 131 _ltrim Description Eliminate undesired characters from left (leading) edge of a string. Usage AnyStr SetStr _ltrim TrimmedStr AnyStr String. String possibly containing character to eliminate. SetStr String. Set of undesired characters. An empty string "()" instructs the interpreter to trim whitespace characters. Comments PAL creates the new string TrimmedStr by copying the contents of AnyStr.
makefont 132 makefont Description Modifies a font dictionary to scale the characters with optional independent X and Y factors and optional mirroring. Usage AnyFontDict TmArray makefont TmFontDict AnyFontDict Dictionary. Font dictionary returned by the findfont operator. TmArray Array. Transformation matrix to apply to scale the font's characters to the desired X and Y dimensions. PAL modifies AnyFontDict. It does not create a new dictionary.
makefont 133 Character's Rotation 0 0 0 0 90 90 90 90 180 180 180 180 270 270 270 270 Mirror Character's X No Yes No Yes No Yes No Yes No Yes No Yes No Yes No Yes Mirror Character's Y No No Yes Yes No No Yes Yes No No Yes Yes No No Yes Yes TmArray [X 0 0 Y 0 0] [-X 0 0 Y 0 0] Same as 180, Yes, No. Same as 180, No, No. [0 -X Y 0 0 0] [0 X Y 0 0 0] Same as 270, Yes, No. Same as 270, No, No. [-X 0 0 -Y 0 0] [X 0 0 -Y 0 0] Same as 0, Yes, No. Same as 0, No, No.
mark 134 mark Description Pushes a special mark object onto the operand stack. Usage mark Mark Mark Mark. Stack position marking object. Comments PAL provides a special data object type knows as a mark object. Numerous PAL operators rely upon the use of a mark object to mark a position on the operand stack.
_measurepage 135 _measurepage Description Instructs PAL to measure the size of the current media if possible. Usage LimitsArray PagesInt _measurepage SizeArray LimitsArray Array. Specifies the maximum dimensions of the media. [WidthMaxNum HeightMaxNum InterPageMaxNum] WidthMaxNum Integer or fixed-point. Specifies the maximum width of the media in points (1/72"). This value does not use the user coordinate system. HeightMaxNum Integer or fixed-point.
_measurepage 136 Comments Not all PAL printers can automatically measure the media, and those which can may not perform all the measurements indicated. In printers that do not measure the media, the _measurepage operator will simply return the current page settings. Many printers must consume a certain amount of the media in order to measure it. In addition, other PAL settings can influence the printer's ability to correctly measure the media.
mod 137 mod Description Perform integer division and return the modulo (remainder). Usage DividendInt DivisorInt mod RemainderInt DividendInt Integer. Value which PAL will divide by DivisorInt. DivisorInt Integer. Value which PAL will divide into DividendInt. RemainderInt Integer. Remainder following the division. Comments This operator calculates the remainder following an integer division. For example, "5 2 mod" produces the result "1".
moveto 138 moveto Description Establishes the new current point. Usage XNum YNum moveto XNum Integer or fixed-point. New current X coordinate. Specified in user coordinates. YNum Integer or fixed-point. New current Y coordinate. Specified in user coordinates. Comments Most PAL drawing operators use the current point as the location at which to draw. In most cases, the current point establishes the bottom left corner of any new object drawn.
mul 139 mul Description Multiplies two numbers and returns the product. Usage Any1Num Any2Num mul ProductNum Any1Num Integer or fixed-point. First number to multiply. Any2Num Integer or fixed-point. Second number to multiply. SumNum Integer or fixed-point. Integer if Any1Num and Any2Num are both integer, otherwise fixed-point. Product of Any1Num and Any2Num.
ne 140 ne Description Compare two objects for inequality. Usage 1Any 2Any ne Bool 1Any Any. First object to compare. With the exception of integer, fixed-point, string, and name objects, 1Any must have the same object type as 2Any. The operator will compare integer and fixed-point objects in any combination. The operator will also compare any combination of string and name objects. 2Any Any. Second object to compare. Bool Boolean. A value of true indicates inequality.
neg 141 neg Description Returns the twos-complement of any number. Usage AnyNum neg NegNum AnyNum Integer or fixed-point. Number from which to return twos-complement of its value. NegNum Integer or fixed-point. Negative value of AnyNum. Same object type as AnyNum. Comments The neg operator pops the top object from operand stack, subtracts the value from zero, and pushes the result onto the operand stack. The result's type will match the original value's type.
newpath 142 newpath Description Discards any path information in the current graphics state. Usage newpath Comments PAL operators which perform drawing operations using the current path also automatically perform a newpath operation. However, PAL provides this operator to allow PAL procedures to explicitly discard the current drawing path.
not 143 not Description Performs a logical complement or bit-wise ones-complement operation on a boolean or integer value. Usage AnyBool AnyInt NotBool NotInt not not AnyBool Boolean. Operand for the logical complement operation. NotBool Boolean. Result of the logical complement operation. AnyInt Integer. Operand for the bit-wise ones-complement operation. NotInt Integer. Result of the bit-wise ones-complement operation.
null 144 null Description Pushes a null object onto the operand stack. Usage null Null Null Null. Null object. Comments PAL provides the null object type to use as "filler" objects in various situations. For example, when the array operator creates a new array object, it fills the array with null objects.
or 145 or Description Performs a logical or bit-wise or operation on two boolean or integer values. Usage Any1Bool Any2Bool Any1Int Any2Int or or OrBool OrInt Any1Bool Boolean. First operand for the logical or operation. Any2Bool Boolean. Second operator for the logical or operation. OrBool Boolean. Result of the logical or operation. Any1Int Integer. First operand for the bit-wise or operation. Any2Int Integer. Second operand for the bit-wise or operation. OrInt Integer.
_ostimeget 146 _ostimeget Description Returns value of operating system clock Usage _ostimeget SytemTimeInt SystemTimeInt Integer. Value of the operating system clock in increments of 5ms. Comments This operator retrieves the value of the operating system clock. The operating system clock is reset to 0 at power up and counts in 5ms increments.
_play 147 _play Description Plays a musical sequence. Usage ScoreStr _play ScoreStr String. Instructions for PAL's Solo Wave Audio (SWA) generator. Comments This operator provides the simplest means of controlling the speaker or other audio source available on many PAL printers. With this operator, the programmer can generate musical sequences to create audio-feedback for a printer operator. PAL refers to this level of audio control as Solo Wave Audio support.
_play 148 PAL supports seven octaves of notes. Each octave contains 12 total notes. This makes a total of 84 notes available for playing. Octaves begin with the note "C" at the low end and range up to note "B" at the high end. The following diagram shows one octave on a piano keyboard. A# C# D# F# G# A# C# B C D E F G A B C One Octave The ScoreStr parameter to the _play operator contains a human readable sequence of simple one and two character instructions.
_play 149 Nn Plays note n out of the 84 possible notes. n may range from one to 84, or zero. N36 specifies middle C. N37 specifies middle C-sharp. N38 specifies middle D. N0 specifies a rest note. on Selects octave n out of the seven possible octaves for all subsequent notes. n may range from zero to six. o0 selects the lowest octave. o3 selects the middle octave, which contains middle C. o6 selects the highest octave. The user must specify the "o" in lower case.
pop 150 pop Description Discards the object on the top of the operand stack. Usage Any pop Any Any. Object to discard. Comments This operator provides the primary means for discarding unwanted objects from the top of the operand stack.
print 151 print Description Writes the contents of a string to %stdout. Usage AnyStr print AnyStr String. Data to write to %stdout. Comments PAL writes the string contents to %stdout without any changes or surrounding data.
put 152 put Description Store data into a composite object. Usage AnyArray IndexInt ElementAny AnyDict KeyAny ValueAny AnyStr IndexInt CharInt put put put AnyArray Array. Array object into which to store ElementAny. IndexInt Integer. When used with AnyArray, index within array at which to store ElementAny. Arrays begin with index zero. When used with AnyStr, index within string at which to store CharInt. Strings begin with index zero. ElementAny Any.
putinterval 153 putinterval Description Store a range of data into an array or string object. Usage AnyArray IndexInt SubArray AnyStr IndexInt SubStr putinterval putinterval AnyArray Array. Array object to receive sub-array objects. AnyStr String. String object to receive sub-string characters. IndexInt Integer. When used with AnyArray, index of first data object to replace within array. Arrays begin with index zero. When used with AnyStr, index of first character to replace within string.
quit 154 quit Description Terminate the PAL interpreter. Usage quit Comments This operator generally serves no purpose when used with a PAL printer. Different PAL printers respond to this operator in different ways. Some printers simply restart the PAL interpreter after discarding all PAL data stored within the printers memory. Other printers will simply halt execution. In general, programmers should not use this operator.
readstring 155 readstring Description Read data from an open file. Usage OpenFile AnyStr readstring ReadStr GoodBool OpenFile File. A file object returned by the file operator. The programmer must have opened the file for reading. AnyStr String. A string which establishes the number of bytes to read from the specified file. The data contained within the string does not matter. PAL only uses the length of the string to determine the number of bytes to read. ReadStr String. Data read from file.
repeat 156 repeat Description Executes the specified procedure for the specified number of iterations. Usage CountInt AnyProc repeat CountInt Integer. Specifies the number of times the interpreter should execute AnyProc. AnyProc Procedure. The procedure which the interpreter will repetitively execute. Comments PAL first removes the supplied iteration count and procedure from the stack. The interpreter then executes the procedure for the specified number of iterations.
rlineto 157 rlineto Description Appends a line to the current path which extends from the current point to a point a given distance away from the current point. Usage XDeltaNum YDeltaNum rlineto XDeltaNum Integer or fixed-point. Specifies the X distance over which to extend the line. YDeltaNum Integer or fixed-point. Specifies the Y distance over which to extend the line. Comments The rlineto operator does not actually draw a line on the current page.
rmoveto 158 rmoveto Description Establishes the new current point at a relative distance from the current point. Usage XDeltaNum YDeltaNum rmoveto XDeltaNum Integer or fixed-point. Relative distance along the X axis to the new current coordinate. Specified in user coordinates. YDeltaNum Integer or fixed-point. Relative distance along the Y axis to the new current coordinate. Specified in user coordinates. Comments Most PAL drawing operators use the current point as the location at which to draw.
rotate 159 rotate Description Rotates the user coordinate system about the user coordinate system origin. Usage AngleNum rotate AngleNum Integer or fixed-point. Number of degrees to rotate the user coordinate system. A positive angle indicates a counter-clockwise rotation. A negative angle indicates a clockwise rotation. The programmer should restrict the value to 90 degree increments in order to ensure proper operation. Comments PAL applies the rotation to the current user coordinate system.
rotate 160 90 rotate +X +Y 0,0 270 rotate -X -Y -Y -X 0,0 +Y +X As the reader can see from the diagrams, with the origin at its default position, only zero rotation places the +X, +Y quadrant over the page. Although PAL fully supports drawing using negative coordinates, most programmers find it easier to use only positive coordinates. As a result, most programmers will prefer to relocate the coordinate system origin to position the +X, +Y quadrant over the page.
161 90 rotate +X +Y 0,0 270 rotate -X -Y -X -Y 0,0 +Y +X Hints The following two examples produce the exact same label image. They both draw the word "Sideways" starting at 72,72 and running from the bottom of the page toward the top. 72 72 moveto 90 rotate (Sideways) show -90 rotate 90 rotate 72 -72 moveto (Sideways) show -90 rotate The relationship between the first rotate and the moveto demonstrates the two approaches to using the rotate operator.
round 162 round Description Rounds the specified value to the nearest integer. Usage AnyNum round RoundedNum AnyNum Integer or fixed-point. Value to round to the nearest integer. RoundedNum Integer or fixed-point. Nearest integer to AnyNum. The type of the returned value matches the type of the supplied parameter. Comments Although this operator will accept integer values, this operator has no affect upon integers.
_rtrim 163 _rtrim Description Eliminate undesired characters from right (trailing) edge of a string. Usage AnyStr SetStr _rtrim TrimmedStr AnyStr String. String possibly containing character to eliminate. SetStr String. Set of undesired characters. An empty string "()" instructs the interpreter to trim whitespace characters. Comments PAL creates the new string TrimmedStr by copying the contents of AnyStr.
scale 164 scale Description Independently alter the scale factors for the user coordinate system along the X and Y axis. Usage XScaleNum YScaleNum scale XScaleNum Integer or fixed-point. Factor by which to adjust scaling along the X axis. YScaleNum Integer or fixed-point. Factor by which to adjust scaling along the Y axis. Comments PAL applies the new scale factors to the current user coordinate system. Therefore, scale factors accumulate.
scalefont 165 scalefont Description Modifies a font dictionary to scale the characters to a desired height. Usage AnyFontDict ScaleNum scalefont ScaledFontDict AnyFontDict Dictionary. Font dictionary returned by the findfont operator. ScaleNum Integer or fixed-point. Factor by which to scale characters of the font. ScaledFontDict Dictionary. AnyFontDict modified to scale the font's characters to the desired height. PAL modifies AnyFontDict. It does not create a new dictionary.
scalefont 166 The setfont operator creates a reference within the graphics state to the specified ScaledFontDict. Therefore, so long as the graphics state continues to reference a given ScaledFontDict, PAL will retain the character images associated with the font. However, selecting a new font using the setfont operator causes PAL to replace the graphics state's current font dictionary reference with a reference to the new font dictionary.
search 167 search Description Searches for the first occurance of one string within another string. Usage AnyStr SearchStr AnyStr SearchStr search search PostStr MatchStr PreStr true AnyStr false AnyStr String. Search to search. SearchStr String. String to locate within AnyStr. PostStr String. Characters from AnyStr which follow SearchStr. PreStr String. Character from AnyStr which precede SearchStr. MatchStr String. Characters from AnyStr which match the characters from SearchStr.
setfileposition 168 setfileposition Description Relocates a file's read/write pointer. Usage OpenFile PositionInt setfileposition OpenFile File. File object for open file to relocate read/write pointer. PositionInt Integer. New offset for file's read/write pointer from start of file. A value of zero indicates the first byte of the file. Comments This operator allows the programmer to randomly read and write various locations of a direct access file. This operator has no affect on sequential files.
setfont 169 setfont Description Establishes the specified font as the current font to use for drawing characters. Usage ScaledFontDict setfont ScaledFontDict Dictionary. A font dictionary previously scaled by the scalefont operator. Comments In order to draw characters of a given font, the programmer must first use the findfont operator to recover the desired font. Next, the programmer uses the scalefont operator to establish the desired height for the characters.
setgray 170 setgray Description Establishes a gray scale printing level within the DeviceGray color space to use for subsequent image rendering operations. Usage LevelNum setgray LevelNum Integer or fixed-point. Specifies the gray level (amount of white) to apply to subsequent image rendering operations. LevelNum can range from 0.0 (black) to 1.0 (white). Comments PAL currently only supports the DeviceGray color space.
setlinecap 171 setlinecap Description Controls the drawing of line end caps during a stroke operation. Usage CapStyleInt setlinecap CapStyleInt Integer. Selects the desired line cap style. A value of 0 selects butt end caps. A value of 2 selects square end caps. Comments The graphics state contains various parameters which influence the manner in which the stroke operator renders a path onto the page. setlinecap allows the programmer to change the line end cap style specified in the graphics state.
setlinewidth 172 setlinewidth Description Controls the width, or thickness, of lines drawn using the stroke operator. Usage WidthNum setlinewidth WidthNum Integer or fixed-point. Specifies the desired line width, or thickness, in user coordinate system units. Comments The graphics state contains various parameters which influence the manner in which the stroke operator renders a path onto the page.
_setlocaltime 173 _setlocaltime Description Allows the user to set the printer’s internal real-time clock via PAL commands. Usage TimeArray _setlocaltime TimeArray Array. Contains the new time information in a format compatible with the time information returned by the _localtime operator. [AvailBool TotalInt YearInt MonthInt DayInt HourInt MinInt SecInt Sec100Int DOYInt DOWInt ZoneNum SaveInt] AvailBool Boolean.
_setlocaltime 174 DOWInt Integer. 1..7 or 0. Not used to set clock electronics. Required for compatibility with _localtime. ZoneNum Integer or fixed-point. 0..23 or -1. If a fixed-point value is used, the fractional portion of the value must be zero at this time. SaveInt Integer. 0, 1. The use of this value is subtly, but very significantly different from its _localtime counterpart. See comments below.
175 _setlocaltime For the _setlocaltime operator, a SaveInt value of zero instructs the printer to disable support for daylight savings time. A value of one instructs the printer to enable support for daylight savings time.
setpagedevice 176 setpagedevice Description Provides very low-level control over page printing mechanism. Usage ControlDict setpagedevice ControlDict Dictionary. Specifies various new settings to control page printing. /CutMedia Integer. Only supported on continuous media printers which have media cutting capability. A value of zero (0) instructs the printer not to cut the media. A value of four (4) instructs the printer to cut the media between every page. /_FeedRate Integer or fixed-point.
setpagedevice 177 Height Integer or fixed-point. Establishes the height of the logical printable area in points (1/72"). /_ImprintLevel Integer or fixed-point. In general, this parameter specifies the amount of energy used to apply the print image to the page. The entry specifies the imprinting level as a percentage of the maximum imprinting level supported by the mechanism. A value of 100 implies the maximum imprinting level supported. A value of 0 implies no imprinting.
setpagedevice 178 No sensitivity will normally prevent the printer from ever detecting the presence of media within the machine. The proper setting will normally fall somewhere closer to the middle of the range, depending upon the operating conditions. Not all printers support this parameter. This parameter is ignored on the Fastmark series of printers. /MediaType String. Selects or specifies the desired input media.
setpagedevice 179 /_PigmentSenseLevel Integer or fixed-point. Controls the sensitivity of the sensor used on some printers to detect the presence of the printing pigment. The actual pigment used varies by printer technology. Pigment can include inked ribbons, toner, thermal transfer ribbons, or other technologies. The value specifies a percentage of the maximum sensitivity provided by the sensor. A value of 100 implies absolute sensitivity. A value of 0 implies no sensitivity.
show 180 show Description Draw text on the page at the current coordinate using the current font. Usage ShowStr show ShowStr String. Text for PAL to draw at the current coordinate. Comments The programmer can use the moveto or rmoveto operator to place the current coordinate at the desired position for drawing the text. PAL provides the findfont, scalefont, and setfont operators for establishing the desired font to use for drawing text.
showpage 181 showpage Description Print physical page. Usage showpage Comments PAL does not actually print any images onto the physical page until it receives the showpage operator. The programmer sends the showpage operator to inform PAL that the interpreter has received all drawing orders for the current page. Since no more drawing will occur on the current page, PAL may now print the various images previously received. By default, the showpage operator prints only a single page.
_showpages 182 _showpages Description Print multiple copies of a single page image. Usage PagesNum _showpages PagesNum Integer or fixed-point. Specifies the number of identical copies of the page image to produce. Comments This operator provides the most convenient mechanism for printing multiple copies of the same page image. With the exception of printing multiple copies of the page image, _showpages operates in exactly the same manner as showpage.
string 183 string Description Creates a string entirely consisting of ASCII NUL characters. Usage CharsInt string NullStr CharsInt Integer. Number of characters to include in new string. NullStr String. String containing CharsInt ASCII NUL characters. Comments The string operator automatically initializes the new string with ASCII NUL characters.
stringwidth 184 stringwidth Description Returns the current point relative movement which would occur if the user were to draw a given string using the show operator. Usage AnyStr stringwidth XDeltaNum YDeltaNum AnyStr String. The string for which PAL will calculate the current point relative movement. XDeltaNum Integer or fixed-point. Relative movement along the X axis. YDeltaNum Integer or fixed-point. Relative movement along the Y axis.
stringwidth 185 The following PAL procedure will perform the same operation as the PAL show operator, however the procedure will automatically reverse-justify the text against the current point. For Roman text, reverse-justification indicates right-justification. /RShow { dup stringwidth exch neg exch neg rmoveto show } bind def The RShow procedure has the same usage as the show operator and CShow procedure.
stroke 186 stroke Description Renders the current path onto the page. Usage stroke Comments Drawing lines onto a page involves a two step process. First, the programmer must specify a path consisting of the lines for PAL to draw. Second, the programmer uses the stroke operator to instruct PAL to draw the lines. Operators like lineto and moveto add information to a path contained within the current graphics state.
187 stroke % First build sub-path for loop which passes through box 36 51 moveto 47 51 lineto 47 41 lineto 43 41 lineto 43 47 lineto 54 47 lineto % Next build sub-path for box which surrounds loop 39 55 moveto 51 55 lineto 51 37 lineto 39 37 lineto closepath % Specify line width & end cap style, then stroke sub-paths 2 setlinewidth 0 setlinecap stroke
sub 188 sub Description Subtracts the second number from the first number and returns the difference. Usage Any1Num Any2Num sub DifNum Any1Num Integer or fixed-point. First number from which to subtract the second number. Any2Num Integer or fixed-point. Second number to subtract from the first number. DifNum Integer or fixed-point. Integer if Any1Num and Any2Num are both integer, otherwise fixed-point. Result of Any2Num subtracted from Any1Num.
translate 189 translate Description Relocate the origin of the user coordinate system. Usage XTransNum YTransNum translate XTransNum Integer or fixed-point. Distance by which to relocate the X axis in current user coordinates. YTransNum Integer or fixed-point. Distance by which to relocate the Y axis in current user coordinates. Comments PAL applies the new translation to the current user coordinate system. Therefore, translations accumulate.
_trap_ _trap_ Description Reserved operator for Applied Thermal Technologies internal use only.
truncate 191 truncate Description Eliminates the fractional portion of a given value. Usage AnyNum truncate TruncatedNum AnyNum Integer or fixed-point. Value to truncate. TruncatedNum Integer or fixed-point. Integer portion of AnyNum. The type of the returned value matches the type of the supplied parameter. Comments Although this operator will accept integer values, this operator has no affect upon integers.
undef 192 undef Description Removes an entry from a dictionary. Usage DictAny KeyAny undef DictAny Dictionary. Specifies the dictionary from which PAL should remove the entry. KeyAny Any. Specifies the key within the dictionary of the entry which PAL should remove. Comments PAL permits the selective deletion of entries within dictionaries. Given the dictionary and the key for an entry within the dictionary, the undef operator will delete the specified entry.
userdict 193 userdict Description Pushes the standard user dictionary, userdict, onto the top of the operand stack. Usage userdict UserDict UserDict Dictionary. Standard user dictionary, userdict, from dictionary stack. Comments During initialization, PAL automatically creates three dictionaries -- systemdict, globaldict, and userdict. It then pushes these three dictionaries onto the dictionary stack in the listed order.
userdict 194 Examples To remove an entry from userdict, the programmer need only use the operator userdict when specifying the dictionary upon which undef should operate. The following example defines the procedure DoNothing and then promptly undefines the procedure.
vmstatus 195 vmstatus Description Returns the number of bytes still available for allocation within the interpreter's virtual memory as well as the total size of the virtual memory. Usage vmstatus ReservedInt UsedInt MaxInt ReservedInt Integer. Reserved for historical compatibility. Current release PAL interpreters always return zero for this value. UsedInt Integer. Number of virtual memory bytes currently in use. MaxInt Integer. Total virtual memory bytes within printer.
vmstatus 196 vmstatus operator to determine the amount of space necessary to store a given amount of data within a given printer. To determine the amount of memory necessary to store a given amount of data, the programmer should use vmstatus to determine a starting memory usage level. The programmer should then download a representative sample of the data to the printer, and check the new memory status using the vmstatus operator. The PAL operator includes numerous data management optimizations.
writestring 197 writestring Description Write data to an open file. Usage OpenFile AnyStr writestring OpenFile File. A file object returned by the file operator. The programmer must have opened the file for writing. AnyStr String. A string containing the data to write to the file. Comments PAL will write the data contained in the string to the indicated file without any modification.
xor 198 xor Description Performs a logical or bit-wise exclusive-or operation on two boolean or integer values. Usage Any1Bool Any2Bool Any1Int Any2Int xor xor XorBool XorInt Any1Bool Boolean. First operand for the logical exclusive-or operation. Any2Bool Boolean. Second operator for the logical exclusive-or operation. XorBool Boolean. Result of the logical exclusive-or operation. Any1Int Integer. First operand for the bit-wise exclusive-or operation. Any2Int Integer.
A. Bar Code Considerations Precision Bar Code Control PAL's philosophy allows you to run the same PAL program on different printers and produce labels that look the same, regardless of the printing method and printer resolution. PAL performs this function very well for letters, lines, and boxes. There are, however, physical constraints that prevent PAL from exactly reproducing bar codes on printers with different resolutions.
200 PAL Language Reference To take control of the bar code dimensions, you must work in dots instead of points, inches, or millimeters. Doing this will, however, reduce the portability of your PAL programs. The following PAL program will produce narrow bars exactly 2 dots wide with a ratio of 2.5:1 on an 8 dots/mm printer. Narrow bars will be 0.0099" (0.250 mm) wide and the wide bars will be 0.0246" (0.6256 mm) wide. /dots {203 div 72 mul} bind def /bar { << /NarrowWidth 2 /WideRatio 2.
A. Bar Code Considerations 201 The formulas use the following variables: L The width of the bar code bit map. X Width of narrow elements in the symbol. The units of this variable determine the units of the answer (i.e., if X is in dots, L will be in dots). N The number of characters including function and shift codes, if applicable, and excluding characters covered by D, P, and W. D Number of numerical digits in Code 128 mode C.