附录 B(规范性)Type 4 函数中的操作符¶
Annex B (normative) Operators in Type 4 Functions
B.1 概述¶
B.1 General
本附件总结了可能出现在类型 4 函数中的 PostScript 运算符,如 7.10.5“类型 4(PostScript 计算器)函数”中所述。有关这些运算符的详细信息,请参阅《PostScript 语言参考》第三版。
This annex summarizes the PostScript operators that may appear in a type 4 function, as discussed in 7.10.5, "Type 4 (PostScript Calculator) Functions". For details on these operators, see the PostScript Language Reference, Third Edition.
B.2 算术操作符¶
B.2 Arithmetic Operators
add sum | 返回 | |
sub difference | 返回 | |
mul product | 返回 | |
div 商 | 返回 | |
idiv 商 | 返回 int1 除以 int2 后的整数 | |
mod 余数 | 返回 int1 除以 int2 后的余数 | |
neg | 返回 | |
abs | 返回 | |
ceiling | 返回 | |
floor | 返回 | |
round | 将 | |
truncate | 删除 | |
sqrt | 返回 num 的平方根 | |
num | sqrt real | 返回 num 的平方根 |
angle | sin real | 返回角度的正弦度 |
角度 | cos real | 返回角度的余弦度 |
num den | atan angle | 返回 num/den 的反正切度 |
base exponent | exp real | 将底数提升为指数幂 |
num | ln real | 返回自然对数(底数为 e) |
num | log real | 返回常用对数(底数为10) |
num | cvi int | 转换为整数 |
num | cvr real | 转换为实数 |
add sum | Return | |
sub difference | Return | |
mul product | Return | |
div quotient | Return | |
idiv quotient | Return int1 divided by int2 as an integer | |
mod remainder | Return remainder after dividing int1 by int2 | |
neg | Return negative of | |
abs | Return absolute of | |
ceiling | Return ceiling of | |
floor | Return floor of | |
round | Return | |
truncate | Remove fractional part of | |
sqrt | Return square root of num | |
num | sqrt real | Return square root of num |
angle | sin real | Return sine of angle degrees |
angle | cos real | Return cosine of angle degrees |
num den | atan angle | Return arc tangent of num/den in degrees |
base exponent | exp real | Raise base to exponent power |
num | ln real | Return natural logarithm (base e) |
num | log real | Return common logarithm (base 10) |
num | cvi int | Convert to integer |
num | cvr real | Convert to real |
B.3 关系、布尔和位操作符¶
B.3 Relational, Boolean, and Bitwise Operators
eq bool | 测试相等 | |
ne bool | 测试不相等 | |
gt bool | 测试大于 | |
ge bool | 测试大于或相等 | |
lt bool | 测试小于 | |
le bool | 测试小于或等于 | |
and | 执行逻辑 | 按位与 | |
或 | 执行逻辑 | 按位包含或 | |
xor | 执行逻辑 | 按位排他或 | |
非 | 执行逻辑 | 按位非 | |
bitshift | 执行 | |
– | true true | 返回布尔值 true |
– | false false | 返回布尔值 false |
eq bool | Test equal | |
ne bool | Test not equal | |
gt bool | Test greater than | |
ge bool | Test greater than or equal | |
lt bool | Test less than | |
le bool | Test less than or equal | |
and | Perform logical | bitwise and | |
or | Perform logical | bitwise inclusive or | |
xor | Perform logical | bitwise exclusive or | |
not | Perform logical | bitwise not | |
bitshift | Perform bitwise shift of | |
– | true true | Return boolean value true |
– | false false | Return boolean value false |
B.4 条件操作符¶
B.4 Conditional Operators
bool { expr } | if – | 如果 bool 为 true,则执行 expr |
bool { | ifelse – | 如果 bool 为 true,则执行 expr1,如果为 false,则执行 expr2 |
bool { expr } | if – | Execute expr if bool is true |
bool { | ifelse – | Execute expr1 if bool is true, expr2 if false |
B.5 栈操作符¶
B.5 Stack Operators
any | pop – | 丢弃顶部元素 |
exch | 交换顶部两个元素 | |
any | dup any any | 复制顶部元素 |
copy | 复制顶部 n元素 | |
index | 重复任意元素 | |
roll | cccc |
any | pop – | Discard top element |
exch | Exchange top two elements | |
any | dup any any | Duplicate top element |
copy | Duplicate top n elements | |
index | Duplicate arbitrary element | |
roll | cccc |