跟小D每日学口语

Complete list of FS XML operators, functions and modifiers

Here is a complete list of FS XML operators, functions and modifiers, as published by Arne Bartels* many years ago:
Quote:
+ (binary operator) : adds the last two stack entries
- (binary operator) : subtracts the last two stack entries
* (binary operator) : multiplies the last two stack entries
/ (binary operator) : divides the last two stack entries
% (binary operator) : remainder divides the last two stack entries
/-/ (unary operator) : reverses sign of last stack entry
-- (unary operator) : decrements last stack entry
++ (unary operator) : increments last stack entry

> (binary operator) : ”>” gives 1 if last stack entry is greater than forelast stack entry
&lt; (binary operator) : ”<” gives 1 if last stack entry is smaller than forelast stack entry

&gt=; (binary operator) : ”>=” gives 1 if last stack entry is greater than or equal to forelast stack entry
&lt=; (binary operator) : ”<=” gives 1 if last stack entry is smaller than or equal to forelast stack entry
== (binary operator) : gives 1 if both last last stack entries are equal
&amp;&amp; (binary operator) : ”&&” logical AND, if both last stack entries are 1 gives 1 otherwise 0
|| (binary operator) : logical OR, if one of the last stack entries is 1 result is 1 otherwise 0
! (unary operator) : logical NOT, toggles last stack entry from 1 to 0 or 0 to 1
? (ternary operator) : ”short if-statement”, if the last entry is 1, the forelast entry is used, else the fore-forelast (or the other way round. Try it, see it)

&amp; (binary operator) : ”&” bitwise AND
| (binary operator) : bitwise OR
~ (unary operator) : bitwise NOT, toggles all bits
&lt;&lt; (binary operator) : ”<<” shift bits of forelast stack entry by last stack steps to the left
&gt;&gt; (binary operator) : ”>>” shift bits of forelast stack entry by last stack steps to the right

d : duplicates last stack entry
r : swaps last two stack entries
s0,s1,s2,.. : stores last stack entry in storage for later use
sp0,sp1,sp2,... : (presumably) the same as above
l0,l1,l2,... : loads value from storage and places on top of stack

abs (unary operator) : returns absolute value (removes ”–”)
int (unary operator) : cuts away digits after decimal
near (unary operator) : rounds to nearest integer
flr (unary operator) : gives next smallest integer
dnor (unary operator) : normalizes degrees (all values are ”wrapped round the circle” to 0°-360°)
rnor (unary operator) : normalizes radians (all values are ”wrapped round the circle” to 0-2p) (NOTE: doesn’t work too reliable)
dgrd (unary operator) : converts degrees to radians (also rddg available?)
pi : places p on top of stack
atg2 (binary operator) : gives atan2 in radians (other trigonometric functions? sin,cos,tg? Other functions? sqrt, ln?)
max (binary operator) : gives the greater of last two stack entries
min (binary operator) : gives the smaller of last two stack entries

others:
if{ ... } if last stack entry is 1, the code inside the brackets is executed (note that there is no SPACE between ”if” and ”{” but one after it and at least one SPACE before ”}”)
if{ ... } els{ ... } if last stack entry is 1, the code inside the brackets is executed, else the code in the second set of brackets (take also care to where SPACEs are allowed and where not)
quit leaves the execution immediately, last stack entry is used for further purposes
case hard to describe, therefore an example:

30 25 20 10 5 1 0 7 (A:Flaps handle index, number) case

the numbers 30 25 20 10 5 1 0 are pushed down the stack, 7 says how much entries, based on the result of (A:Flaps handle index, number) ”case” extracts one of the seven numbers. If (A:Flaps handle index, number) is 0 -> 0, 1->1, 2->5,... 6->30.
posted @ 2010-10-13 13:16  简简单单幸福  阅读(239)  评论(0编辑  收藏  举报