juF*_*uFo 1 postscript operators
== 的值不是运算符,而是内置过程。
PLRM 第 526 页(pdf 第 540 页)。
一个内置程序,这是否意味着这是一个 PostScript 程序:
{ something here }
Run Code Online (Sandbox Code Playgroud)
还是您必须自己定义的实际功能,例如在 Java 中?
您可以使用/== load ==.
或者获取Frank Meritt Braswell所著的Inside Postscript一书。它有一整章关于该==过程如何在 Adobe 的打印机实现中工作。
但是这个简单的框架是基于type产生类型名的运算符的属性。更具体地说,它产生一个指定参数类型的可执行名称。因此,您可以使用字典轻松实现类型切换。
<<
/integertype { } % handle integer case
/realtype { } % handle floating-point case
/arraytype { } % handle array case
>> begin
5 type exec
2.0 type exec
{a b c} type exec
Run Code Online (Sandbox Code Playgroud)
不同类型的对象导致执行不同的过程。
使用它,我们可以处理可能传递给过程的不同类型。
/my== {
<<
/integertype { =string cvs print }
/realtype { =string cvs print }
/arraytype { dup xcheck {
({ ) print {my==} forall (} ) print
}{
([ ) print {my==} forall (] ) print
} }
>> begin dup type exec
} def
Run Code Online (Sandbox Code Playgroud)
=string(在书中描述)是一个预先分配的 128 字节暂存缓冲区,由=和==过程用于此确切目的:将参数提供给cvs.