| Programming |
| General Comments |
| |
|
Unlimited sizes of most anything in PSL
Most constructs are recursive; lists of lists, tables of tables, etc, functions call functions, etc.
Declarations not required.
Program length not limited.
Libraries and functions supported.
Unlimited number of variables
Any number of tables, files, lists, open at once
Note that PSL is Unicode (UTF 8) based and thus most any language, including Japanese, including Kanji, can be supported.
|
|
| Statements |
| |
Assignment Statements
Compound Statements
If Statement
Select Statement (case statement)
Return Statement
Function Value Assignment
Stop Statement
Loop Statements
While Statement
Repeat Statement
For Statement
Exit Statement
Continue Statement
Function Call Expressions
Operators – rational operators
Type Dependencies
Numeric Operators
Logical Operators
String Concatenate
Comparison Operators
The "using" operator |
| |
|
|
| Misc. Features |
| |
Include Files (could be programs or definitions)
Macro Definitions
Libraries
Copyright Notice (embedded)
Initialization Code
Function Definitions
Lists, Stacks |
| |
|
|
| User Exception Functions (Call Backs) |
| |
These are functions users can write which PSL “calls” depending on certain events, such as;
Start of Page, End of Page
End of Space in Box or Page
End of an Output file
Errors, Warnings |
| |
|
|
| Runtime Options and the Job File |
| |
Names and values supplied at run time
|
Program (obviously)
Output File Name
Merge Data File Name
Numeric Precision
Numeric Format
Search Paths
Batch Size
Input Data (at run time)
ODBC Data Merge Sources
|
Switches – these can be set at run time
|
Output Compression
Log File Generation
Bad Record Extension
Ignoring Bad Records
Field Space Trimming
Merge Data Splitting
Partial Merge Processing
Postscript File Generation
PDF file(s) generation (separate from print file)
|
| |
|
|
| Printer Control Options |
| |
Printed Output using Windows Print System
Selecting Printers from list to share printing load
Set mode – portrait, landscape or paper size
Printing to Files rather than printers
Select Number of Copies
Select Media Type (such as paper thickness)
Print Quality Selection
Color Printing (on or off)
Duplex Printing
Paper Tray Selection
Form ID
Page Size
Output Collation
Shrink to Fit
Create a PostScript file to be printed |
| |
|
|
| Type Conversion Functions |
| |
PSL will return a string for any data type (stringFor value)
Of more interest this can be a list of, for example, all the elements in a table
Convert a text string containing numeric values to a number (numberFor value) |
(So you can do math with it)
|
Return the Unicode number for a character (codeForChar value)
Turn a Unicode number to a character (charForCode value)
Find out what data type a value is (typeOf value) |
a few examples follow:
|
Data Type
Number
String
File
List
Table
|
Result
Minimal floating point
The contents of the String
Path name of the file delimited by < and >
Eg. <c:\customers\billsHardware.dat>
Comma separated list of elements
Comma separated list of associations delimited.
|
| |
|
|
| Console Output Functions |
| |
Show value --- prints a value to the console
Errors and warnings reported to the console or to a calling program
Assert condition, message |
| |
|
|
| Arithmetic Functions |
| |
|
Any precision level can be set
BCD or floating point binary (much faster)
Multiplicative “*”
Divide “/”
Additive “+”
Subtract “-“
Numeric Power “^”- eg 2 ^ 3 is 8
Exponents (exp x) eg e^x
Logarithms – Natural, (ln x), and base 10 (log x)
Basic trig functions (sin theta, cos theta, tan theta, arcsin x, arccos x, arctan x) Modulus (mod x,y)
Rounding to specified precision (roundOffTo places, x)
Fractional and integer parts of numbers (fractionalPartOf x, integerPartOf x)
Absolute values of a number (abs x)
Random number generation (Random)
Both BCD and binary floating point math supported and selectable
|
| |
|
|
| User Interaction Functions |
| |
Display message to user with an icon (userMessage message, type)
Display message to user asking for yes/no answer (userQueryYesNo message,type)
Display message to user yes/no/cancel (userQueryYesNoCancel message, type)
Display message to user asking for data (userQuery message)
Display message asking for file pathnames (userQueryPathName message) |
This normally brings up Windows Explorer and users can select a single file name or a list of them.
|
| As well, users may edit the job file, either interactively in the “utilities” dropdown box or in an editor. In this way one can specify, at run time, which files are to be used or to supply variables to be used in this particular execution of the program – such as “date” to be printed on the piece for example. |
| |
|
|
| Misc. Functions (This is geek talk) |
| |
Find out if text has yet been printed on current page (isPageEmpty)
Control action in event of text overflows (setTextLossWarnings mod) |
Values are:
|
0 no warnings
1 warn on horizontal text loss
2 warn on vertical text loss
3 warn on any text loss
The default value is 3.
|
Of course these can be “trapped” and dealt with programmatically – see User Exception Functions.
|
|
Several functions exist dealing with running PSL from the command line or, in the converse, when PSL calls another program.
Similarly the usual sets of functions exist regarding “units” – points, inches, mm, etc.
A grid can be set in pslDev to make it easier to place things.
Perhaps the most important function in PSL is:
|
callLibrary funcName, libName, Parms
|
|
This allows a user to program a set of functions (PSL programs) which can be called based on fields in the merge file (or any other variable). Functions called can call other functions. Consequently, the merge file can be quite of the “mix and match” variety. Uniformity is NOT required.
PostScript text can be inserted into the PDF print stream (postscript text)
Here is a file, print it (printContentsOf pathname)
|
| |
|
|
| User Stack Functions (more geek talk) |
| |
|
|
| Useful Functions |
| Status Save and Restore (more geek talk) |
| |
When implementing functions one must be mindful that functions can change state variables. Consequently programmers need functions such as:
Save and restore position of the “g” and the “t” cursor
A broad brush function to save and restore all such settings exists;
saveAll
restoreAll |
| |
|
|
| Miscellaneous Geek Talk |
| |
|
PSL Supports
Callbacks
Garbage Collection
Error Warning and Trapping
Most everything that can be IS recursive in PSL
PSL is well suited to call other programs or be called by other programs.
A “runtime” version is available for executing PSL at remote locations (such as in the local print room or one miles away).
|
| |
|
|