Script Programming Language/Primitive Procedures: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
Andrew Branscom (talk | contribs)
No edit summary
Andrew Branscom (talk | contribs)
No edit summary
Line 141: Line 141:
* [[:Category:Scripting Articles|Scripting Articles]]
* [[:Category:Scripting Articles|Scripting Articles]]
* [[:Category:Variables|Variables Articles]]
* [[:Category:Variables|Variables Articles]]
* [[:Category:SCI Procedures|SCI Procedures]]
* [[:Category:Primitive Procedures|Primitive Procedures]]
* [[:Category:Arithmetic Primitives|Arithmetic Primitives]]
* [[:Category:Boolean Primitives|Boolean Primitives]]
* [[:Category:Assignment Primitives|Assignment Primitives]]
* [[Script Resource (SCI)]]
* [[Script Resource (SCI)]]
* [[SCI Specifications: Chapter 1 - Introduction#SCRIPT|SCRIPT in the SCI Specifications]]
* [[SCI Specifications: Chapter 1 - Introduction#SCRIPT|SCRIPT in the SCI Specifications]]
Line 164: Line 169:
[[Category:Scripting Articles]]
[[Category:Scripting Articles]]
[[Category:SCI Scripting Articles]]
[[Category:SCI Scripting Articles]]
[[Category:Variables]]
[[Category:SCI Variables]]
[[Category:Procedures]]
[[Category:SCI Procedures]]
[[Category:Primitive Procedures]]
[[Category:Arithmetic Primitives]]
[[Category:Boolean Primitives]]
[[Category:Assignment Primitives]]
[[Category:Script Resources]]
[[Category:Script Resources]]
[[Category:SCI Script Resources]]
[[Category:SCI Script Resources]]
[[Category:Procedures]]
[[Category:Official SCI Documentation]]
[[Category:SCI Procedures]]
[[Category:Primitive Procedures]]
[[Category:Primitive Procedures]]

Revision as of 16:04, 1 January 2026

Official SCI Documentation
Table of Contents  

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Index

Primitive Procedures
Author: Jeff Stephenson
1988-04-04



Primitive Procedures


Arithmetic primitives:

In the following, e1, e2, ... are arbitrary expressions.


(+ e1 e2 [e3...])

Evaluates to e1 + e2 [+ e3 ...]


(* e1 e2 [e3...])

Evaluates to e1 * e2 [* e3 ...]


(- e1 e2)

Evaluates to e1 - e2


(/ e1 e2)

Evaluates to e1 / e2


(mod e1 e2)

Evaluates to the remainder of e1 when divided by e2.


(<< e1 e2)

Evaluates to e1 << e2 where the << operation shifts its left hand side left by the number of bits specified by its right hand side. (As in C).


(>> e1 e2)

Evaluates to e1 >> e2 as in << except a right shift.


(^ e1 e2 [e3 ...])

Evaluates to e1 ^ e2 [^ e3 ^ ...] where '^' is the bitwise exclusive-or operator.


(& e1 e2 [e3 ...])

Evaluates to e1 & e2 [& e3 & ...] where '&' is the bitwise and operator.


(| e1 e2 [e3])

Evaluates to e1 | e2 [| e3 | ...] where '|' is the bitwise or operator.


(! e1)

Evaluates to TRUE if e1 == 0, else FALSE.


(~ e1)

Evaluates to the bit-wise not of e1, i.e. all 1 bits are changed to 0 and all 0 bits are changed to 1.


Boolean primitives:

These procedures are always guaranteed to evaluate their parameters left to right and to terminate the moment the truth value of the expression is determined. If the truth value of the boolean is determined before an expression is reached, the expression is never evaluated.


(> e1 e2 [e3...])

Evaluates to TRUE if e1 > e2 [> e3 ...], else FALSE.


(>= e1 e2 [e3...])

Evaluates to TRUE if e1 >= e2 [>= e3 ...], else FALSE.


(< e1 e2 [e3...])

Evaluates to TRUE if e1 < e2 [< e3 ...], else FALSE.


(<= e1 e2 [e3...])

Evaluates to TRUE if e1 <= e2 [<= e3 ...], else FALSE.


(== e1 e2 [e3...])

Evaluates to TRUE if e1 == e2 [== e3 ...], else FALSE.


(!= e1 e2 [e3...])

Evaluates to TRUE if e1 != e1 [!= e3 ...], else FALSE.


(and e1 e2 [e3...])

Evaluates to TRUE if all the expressions are non-zero, else FALSE.


(or e1 e2 [e3...])

Evaluates to TRUE if any of the expressions are non-zero, else FALSE.


(not e)

Evaluates to TRUE if the expression is zero, else FALSE.


Assignment primitives:

All assignment procedures store a value in a variable and return that value as the result of the assignment. In the following, v is a variable and e an expression.


(= v e)

v = e


(+= v e)

v = v + e


(-= v e)

v = v - e


(*= v e)

v = v * e


(/= v e)

v = v / e


(|= v e)

v = v | e


(&= v e)

v = v & e


(^= v e)

v = v ^ e


(>>= v e)

v = v >> e


(<<= v e)

v = v << e


(++ v)

v = v + 1


(-- v)

v = v - 1


References



Also See

 

Official SCI Documentation
Table of Contents

< Previous: Data Types and Variables Next: Control Flow >