PSrte is a PostScript program, that accepts WASD RTE request, prepares CGI-like environment and runs the requested PostScript script. When the request is serviced, it waits for the new request and runs the next PostScript script, and so on, while httpd doesn't abort the PSrte process.
PSrte gets CGI variables from httpd, places them into PostScript string variables, finds the requested PostScript script, executes it and closes the httpd transaction.
PSrte is tested against Aladdin GhostScript.
All the request CGI variables are placed in the PostScript string variables, named just like httpd names them - WWW_*. For example WWW_QUERY_STRING PostScript string variable represents the request query string. This variables are stored in the WWW dictionary just under the userdict which is the topmost dictionary.
The basic way of script output is the PostScript ... print procedure. As stdout is opened to SYS$OUTPUT: all such output comes directly to httpd. The graphics output is made using PostScript ... showpage procedure and comes to httpd via SYS$OUTPUT: too.
In addition the file can be opened to RTE_output pointing to SYS$OUTPUT: and everything can be written there.
The PSrte to httpd communication mode should be specially configured by sending a special string variable RTE_script_control to httpd in the end of CGI header (the terminating empty line is here too).
All text lines should be terminated by \n character.
Normally PSrte inputs PUT/POST data directly by reading from file named $RTE_input pointing to HTTP$INPUT: or simply reading from stdin opened to HTTP$INPUT:.
There is a number of special names for RTE to script interaction. See RTEset for detailed information. This variables are stored in the RTE dictionary just under the WWW.
PSrte has a built-in RTE_error_report procedure. To report an error the script should call it with the following parameters:
http_status error_text module_name line_number RTE_error_report
In addition PSrte has an error handler supporting any error traps from script - the script shouldn't redefine it.
PSrte has a built-in RTE_callout procedure. To make server callout he script should call it with the following parameters:
callout calldata RTE_callout result
The procedure will return the server response as a substring or an empty string if the server doesn't response with success status.
PSrte supports special request parameters for output control. This parameters can be defined in the request URL in the form "...?param=value" or predefined in the mapping rules in the form "set ... script=params=(param=value)".
Two scripts are supplied with PSrte - PSview and PDFview. Both suppot PS/PDF file browsing and page preview.
PSview caches PostScript document's resource preamble and reuses it as possible making use of PSrte script reuse feature.
PSview and PDFview have the same directory listing control compatible with the HTdir one. The following CGI variables are available:
This variables can be set via "set ... html=param=value" mapping rule.