std-princ-to


Synopsis

(std-princ-to <msg> <output>)

Description

STD-PRINC-TO is a workaround for not being able to define optional arguments in AutoLISP alone. It is used to print lists of variable argument types to a stream, which are difficult to concatenate with strcat, in user-friendly format, in comparison to (PRIN1) which is used to print in a format suitable to being read in again with (READ).

The output argument is either a file open for writing,

a symbol, then the resulting string is assigned to this symbol or

nil which princs expr to the console as with std-princ.

As STD-PRINC it also honors the global variables *PRINT-LENGTH* and *PRINT-LEVEL*

Note on #- SMALL

In the small package STD-PRINC-TO is the same as PRINC, so lists are printed as lists and not as consecutive elements, and *PRINT-LENGTH* and *PRINT-LEVEL* are ignored

Examples

(std-princ-to (list "A number: " i " and another unknown: " lst) file)
prints to file, if file is file object

(std-princ-to "test" nil)
prints to console

(std-princ-to (list "A number: " i " and another unknown: " lst) 's)
changes symbol s

Arguments

msg: any valid lisp expression. Most likely a list of to be printed expressions.

output: a file (=stream) open to write, a symbol or nil

Return Value

Not defined. Most likely NIL

Side Effects

Prints a string to the console, to a file or destructively changes a symbol. This is a typical function only used for its side effect.

Module

(std-require 'STDLISP)

Defined in STDLISP

Affected by #- SMALL