Script Programming Language/Primitive Procedures: Difference between revisions
No edit summary |
|||
| (10 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[ | [[Category:SCI Pages]] | ||
[[Official SCI Documentation]]<br /> | |||
[[Script Programming Language | Table of Contents]] | |||
| |||
<div align="center"> | <div align="center"> | ||
Chapter: | Chapter: | ||
[[Script Programming Language/Introduction|1]] | | [[The Script Programming Language/Introduction|1]] | | ||
[[Script Programming Language/Files|2]] | | [[The Script Programming Language/Files|2]] | | ||
[[Script Programming Language/Definitions|3]] | | [[The Script Programming Language/Definitions|3]] | | ||
[[Script Programming Language/Data Types and Variables|4]] | | [[The Script Programming Language/Data Types and Variables|4]] | | ||
[[Script Programming Language/Primitive Procedures|5]] | | [[The Script Programming Language/Primitive Procedures|5]] | | ||
[[Script Programming Language/Control Flow|6]] | | [[The Script Programming Language/Control Flow|6]] | | ||
[[Script Programming Language/Procedures|7]] | | [[The Script Programming Language/Procedures|7]] | | ||
[[Script Programming Language/Using SC|8]] | | [[The Script Programming Language/Using SC|8]] | | ||
[[Script Programming Language/Index|Index]] | [[The Script Programming Language/Index|Index]] | ||
</div | </div> | ||
<div align="center"><span style="font-size: 22pt">Primitive Procedures</span><br />''Author: [[Jeff Stephenson]]''<br />''1988-04-04''</div></div> | |||
<div align="center" | |||
<br /> | |||
== <br /> Primitive Procedures == | == <br /> Primitive Procedures == | ||
| Line 93: | Line 93: | ||
===<br /> Assignment primitives: === | ===<br /> Assignment primitives: === | ||
<blockquote> | |||
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. | 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. | ||
</blockquote> | |||
<br /><div id="(= v e)"></div>'''(= v e)''' | <br /><div id="(= v e)"></div>'''(= v e)''' | ||
| Line 131: | Line 133: | ||
<blockquote>v = v - 1</blockquote> | <blockquote>v = v - 1</blockquote> | ||
==<br /> References == | |||
<references /><!-- Do not edit this section. It is autopopulated by <ref></ref> tags --> | |||
==<br /> Also See == | |||
< | |||
* [[:Category:SCI Documentation|SCI Documentation]] | |||
* [[:Category:Official SCI Documentation|Official SCI Documentation]] | |||
* [[:Category:SCI Scripting|SCI Scripting Articles]] | |||
* [[:Category:Variables|Variables Articles]] | |||
* [[:Category:Procedures|Procedures]] | |||
* [[:Category:Primitive Procedures|Primitive Procedures]] | |||
* [[:Category:Arithmetic Primitives|Arithmetic Primitives]] | |||
* [[:Category:Boolean Primitives|Boolean Primitives]] | |||
* [[:Category:Assignment Primitives|Assignment Primitives]] | |||
* [[Script Resource (SCI)]] | |||
* [[SCI Specifications: Chapter 1 - Introduction#SCRIPT|SCRIPT in the SCI Specifications]] | |||
| | ||
[[Official SCI Documentation]]<br /> | |||
[[Script Programming Language | Table of Contents]] | [[Script Programming Language | Table of Contents]] | ||
<span style="float: left">[[Script Programming Language/Data Types and Variables | < Previous: Data Types and Variables]]</span><span style="float: right">[[Script Programming Language/Control Flow | Next: Control Flow >]]</span> | <span style="float: left">[[The Script Programming Language/Data Types and Variables | < Previous: Data Types and Variables]]</span><span style="float: right">[[The Script Programming Language/Control Flow | Next: Control Flow >]]</span> | ||
| | ||
[[Category:References]] | |||
[[Category:SCI References]] | |||
[[Category:Historical Pages]] | |||
[[Category:SCI Historical Pages]] | |||
[[Category:Development]] | |||
[[Category:SCI Development]] | |||
[[Category:Documentation]] | |||
[[Category:SCI Documentation]] | [[Category:SCI Documentation]] | ||
[[Category:Official Documentation]] | |||
[[Category:Official SCI Documentation]] | |||
[[Category:Technical Info]] | |||
[[Category:SCI Technical Info]] | |||
[[Category:Scripting]] | [[Category:Scripting]] | ||
[[Category:SCI Scripting]] | |||
[[Category:Variables]] | |||
[[Category:SCI Variables]] | |||
[[Category:Procedures]] | [[Category:Procedures]] | ||
[[Category:SCI Procedures]] | |||
[[Category:Primitive Procedures]] | |||
[[Category:Arithmetic Primitives]] | |||
[[Category:Boolean Primitives]] | |||
[[Category:Assignment Primitives]] | |||
[[Category:Scripting]] | |||
[[Category:SCI Scripting]] | |||
[[Category:Official SCI Documentation]] | |||
[[Category:Primitive Procedures]] | |||
Latest revision as of 13:04, 2 January 2026
Official SCI Documentation
Table of Contents
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
- SCI Documentation
- Official SCI Documentation
- SCI Scripting Articles
- Variables Articles
- Procedures
- Primitive Procedures
- Arithmetic Primitives
- Boolean Primitives
- Assignment Primitives
- Script Resource (SCI)
- SCRIPT in the SCI Specifications
- SCI Pages
- SCI References
- Historical Pages
- SCI Historical Pages
- Development
- SCI Development
- SCI Documentation
- Official Documentation
- Official SCI Documentation
- Technical Info
- SCI Technical Info
- SCI Scripting
- Variables
- SCI Variables
- Procedures
- SCI Procedures
- Primitive Procedures
- Arithmetic Primitives
- Boolean Primitives
- Assignment Primitives