A lot of projects ported from the old metanohi site.
This commit is contained in:
57
site/projects/enigma/doc/enigma-0.1-html/Booleans.html
Normal file
57
site/projects/enigma/doc/enigma-0.1-html/Booleans.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Booleans - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Lists.html#Lists" title="Lists">
|
||||
<link rel="next" href="Files.html#Files" title="Files">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Booleans"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Files.html#Files">Files</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Lists.html#Lists">Lists</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.5 Booleans</h3>
|
||||
|
||||
<p><a name="index-booleans-8"></a>Booleans are used a lot in Enigma. The predefined variables <code>true</code>
|
||||
and <code>false</code> can be used.
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Built-In functions - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Built_002dIn.html#Built_002dIn" title="Built-In">
|
||||
<link rel="prev" href="Built_002dIn-values.html#Built_002dIn-values" title="Built-In values">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Built-In-functions"></a>
|
||||
<a name="Built_002dIn-functions"></a>
|
||||
<p>
|
||||
Previous: <a rel="previous" accesskey="p" href="Built_002dIn-values.html#Built_002dIn-values">Built-In values</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Built_002dIn.html#Built_002dIn">Built-In</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">6.2 Functions</h3>
|
||||
|
||||
<p><a name="index-built_002din-functions-17"></a>Enigma has few built-in functions. But they do exist.
|
||||
|
||||
<p class="noindent"><code>str(OBJECT...)</code>: Converts all supplied values to strings.
|
||||
|
||||
<p class="noindent"><code>num(OBJECT...)</code>: Converts all supplied values to numbers.
|
||||
|
||||
<p class="noindent"><code>list(OBJECT...)</code>: Puts all supplied values in a list and destroys
|
||||
nested lists at one level.
|
||||
|
||||
<p class="noindent"><code>bool(OBJECT...)</code>: Converts all supplied values to booleans.
|
||||
|
||||
<p class="noindent"><code>code(OBJECT...)</code>: Converts all supplied values to code strings.
|
||||
|
||||
<p class="noindent"><code>repr(OBJECT...)</code>: Converts all supplied values to representational
|
||||
strings. Strings get prepended and appended by " characters, code
|
||||
objects are surrounded by { and }, and so on.
|
||||
|
||||
<p class="noindent"><code>type(OBJECT...)</code>: Converts all supplied values to type strings
|
||||
(string, number, file, etc.).
|
||||
|
||||
<p class="noindent"><code>len(OBJECT...)</code>: Converts all supplied values to their length. This
|
||||
can be used for both strings and lists.
|
||||
|
||||
<p class="noindent"><code>clone(OBJECT...)</code>: Clones all supplied values. When an object is
|
||||
cloned, its value is assigned to a new variable. The list of clones is
|
||||
returned.
|
||||
|
||||
<p class="noindent"><code>slice(LIST|STRING, NUMBER, NUMBER)</code>: Returns a list value sliced
|
||||
according to the first and second number if the first variable is a
|
||||
list variable, or a substring if the first variable is a string
|
||||
variable.
|
||||
|
||||
<p class="noindent"><code>loop(FUNCTION, [OBJECT]...)</code>: Executes function until it returns
|
||||
false. Sends the rest of the specified variables (if any) to the
|
||||
function as arguments.
|
||||
|
||||
<p class="noindent"><code>open(STRING, STRING)</code>: Opens the file by the name of the first
|
||||
string, using the second string as its guide as to how it should be
|
||||
opened. "r" means to read, "w" means to write, and "a" means to
|
||||
append. Returns a file object.
|
||||
|
||||
<p class="noindent"><code>close(FILE...)</code>: Closes files.
|
||||
|
||||
<p class="noindent"><code>read(FILE)</code>: Reads one character of a file and returns it. If no
|
||||
more characters are present, an empty string is returned.
|
||||
|
||||
<p class="noindent"><code>write(FILE, STRING)</code>: Writes a string to a file.
|
||||
|
||||
<p class="noindent"><code>greater(NUMBER, NUMBER...</code>: Checks if the first number is
|
||||
greater than the rest and returns true or false.
|
||||
|
||||
<p class="noindent"><code>lesser(NUMBER, NUMBER...</code>: Checks if the first number is
|
||||
lesser than the rest and returns true or false.
|
||||
|
||||
<p class="noindent"><code>equal(OBJECT, OBJECT...</code>: Checks if the objects are equal and returns
|
||||
true or false.
|
||||
|
||||
<p class="noindent"><code>and(BOOLEAN...)</code>: Checks if all booleans are true and returns true
|
||||
or false.
|
||||
|
||||
<p class="noindent"><code>or(BOOLEAN...)</code>: Checks if at least one boolean is true and returns
|
||||
true or false.
|
||||
|
||||
<p class="noindent"><code>not(BOOLEAN...)</code>: Converts values of true to values of false, and
|
||||
vice-versa.
|
||||
|
||||
<p class="noindent"><code>act(BOOLEAN, FUNCTION, [OBJECT]...)</code>: Run the function with the
|
||||
optional objects as arguments if the boolean is true.
|
||||
|
||||
<p class="noindent"><code>system(STRING...)</code>: Join the strings and run the result as a
|
||||
system command.
|
||||
|
||||
<p class="noindent"><code>add(NUMBER|STRING|CODE|LIST...)</code>: Add objects together. Numbers, strings, code
|
||||
strings and lists can be used, but only with similar types. The type
|
||||
of the first object determines what types the rest must be. The result
|
||||
is stored in the first object and also returned.
|
||||
|
||||
<p class="noindent"><code>subtract(NUMBER...)</code>: Subtract numbers from each other. The
|
||||
first object receives the final number. It is also returned.
|
||||
|
||||
<p class="noindent"><code>multiply(NUMBER...)</code>: Multiply numbers with each other. The
|
||||
first object receives the final number. It is also returned.
|
||||
|
||||
<p class="noindent"><code>divide(NUMBER...)</code>: Divide numbers with each other. The
|
||||
first object receives the final number. It is also returned.
|
||||
|
||||
<p class="noindent"><code>mod(NUMBER, NUMBER)</code>: Finds the remainder of the first number
|
||||
divided with the second number and returns it as a new variable.
|
||||
|
||||
<p class="noindent"><code>pow(NUMBER, NUMBER)</code>: Returns first number^second number.
|
||||
|
||||
<p class="noindent"><code>log(NUMBER, [NUMBER])</code>: Returns the logarithm of the first
|
||||
number. If the second number is not specified, the natural logarith is
|
||||
used.
|
||||
|
||||
<p class="noindent"><code>random()</code>: Returns a random number between 0 and 1.
|
||||
|
||||
<p class="noindent"><code>abs(NUMBER...)</code>: Sets and returns absolute values of numbers.
|
||||
|
||||
<p class="noindent"><code>round(NUMBER, NUMBER)</code>: Rounds the first number with x decimals,
|
||||
where x is the second number.
|
||||
|
||||
<p class="noindent"><code>floor(NUMBER, NUMBER)</code>: Floors the first number with x decimals,
|
||||
where x is the second number.
|
||||
|
||||
<p class="noindent"><code>ceil(NUMBER, NUMBER)</code>: "Ceils" the first number with x decimals,
|
||||
where x is the second number.
|
||||
|
||||
<p class="noindent"><code>sin(NUMBER...)</code>: Sets and returns sine values.
|
||||
|
||||
<p class="noindent"><code>cos(NUMBER...)</code>: Sets and returns cosine values.
|
||||
|
||||
<p class="noindent"><code>tan(NUMBER...)</code>: Sets and returns tangent values.
|
||||
|
||||
<p class="noindent"><code>asin(NUMBER...)</code>: Sets and returns arcsine values.
|
||||
|
||||
<p class="noindent"><code>acos(NUMBER...)</code>: Sets and returns arccosine values.
|
||||
|
||||
<p class="noindent"><code>atan(NUMBER...)</code>: Sets and returns arctangent values.
|
||||
|
||||
<p class="noindent"><code>sinh(NUMBER...)</code>: Sets and returns hyperbolic sine values.
|
||||
|
||||
<p class="noindent"><code>cosh(NUMBER...)</code>: Sets and returns hyperbolic cosine values.
|
||||
|
||||
<p class="noindent"><code>tanh(NUMBER...)</code>: Sets and returns hyperbolic tangent values.
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Built-In values - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Built_002dIn.html#Built_002dIn" title="Built-In">
|
||||
<link rel="prev" href="Built_002dIn.html#Built_002dIn" title="Built-In">
|
||||
<link rel="next" href="Built_002dIn-functions.html#Built_002dIn-functions" title="Built-In functions">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Built-In-values"></a>
|
||||
<a name="Built_002dIn-values"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Built_002dIn-functions.html#Built_002dIn-functions">Built-In functions</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Built_002dIn.html#Built_002dIn">Built-In</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Built_002dIn.html#Built_002dIn">Built-In</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">6.1 Values</h3>
|
||||
|
||||
<p><a name="index-built_002din-values-16"></a>The following variables are special and can be accessed anytime. They can
|
||||
even be overwritten.
|
||||
<pre class="verbatim">args, return, temp, stdin, stderr, stdout, zero, true, false, none, @pi,
|
||||
@e, cwd, cpd, fnm
|
||||
</pre>
|
||||
<code>zero</code> is a fake writable file that does nothing. <code>none</code> is an
|
||||
abstract variable with an internal value of.. none. <code>@pi</code> is
|
||||
Pi. <code>@e</code> is Euler's number. <code>cwd</code> is the directory from which
|
||||
Enigma is run, <code>cpd</code> is the directory in which the current program
|
||||
file resides, and <code>fnm</code> is the filename of the current program
|
||||
file. The rest are self-explanatory — and <code>args</code>, <code>return</code>
|
||||
and <code>temp</code> are extra special.
|
||||
|
||||
</body></html>
|
||||
|
||||
59
site/projects/enigma/doc/enigma-0.1-html/Built_002dIn.html
Normal file
59
site/projects/enigma/doc/enigma-0.1-html/Built_002dIn.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Built-In - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="prev" href="Comparison.html#Comparison" title="Comparison">
|
||||
<link rel="next" href="Copying-This-Manual.html#Copying-This-Manual" title="Copying This Manual">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Built-In"></a>
|
||||
<a name="Built_002dIn"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Copying-This-Manual.html#Copying-This-Manual">Copying This Manual</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Comparison.html#Comparison">Comparison</a>,
|
||||
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="chapter">6 Built-in values and functions</h2>
|
||||
|
||||
<ul class="menu">
|
||||
<li><a accesskey="1" href="Built_002dIn-values.html#Built_002dIn-values">Built-In values</a>
|
||||
<li><a accesskey="2" href="Built_002dIn-functions.html#Built_002dIn-functions">Built-In functions</a>
|
||||
</ul>
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Compared assigning - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Comparison.html#Comparison" title="Comparison">
|
||||
<link rel="prev" href="Comparison.html#Comparison" title="Comparison">
|
||||
<link rel="next" href="Compared-conditionals.html#Compared-conditionals" title="Compared conditionals">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Compared-assigning"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Compared-conditionals.html#Compared-conditionals">Compared conditionals</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Comparison.html#Comparison">Comparison</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Comparison.html#Comparison">Comparison</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">5.1 Assigning values</h3>
|
||||
|
||||
<blockquote>
|
||||
<b>C:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> type var = value;
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<b>Python:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> var = value
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<b>Enigma:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> value = var;
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Compared conditionals - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Comparison.html#Comparison" title="Comparison">
|
||||
<link rel="prev" href="Compared-assigning.html#Compared-assigning" title="Compared assigning">
|
||||
<link rel="next" href="Compared-looping.html#Compared-looping" title="Compared looping">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Compared-conditionals"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Compared-looping.html#Compared-looping">Compared looping</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Compared-assigning.html#Compared-assigning">Compared assigning</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Comparison.html#Comparison">Comparison</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">5.2 Conditionals</h3>
|
||||
|
||||
<blockquote>
|
||||
<b>C:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> if ((a == 2 && b < 5) || (c != 4 && !d)) do_something();
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<b>Python:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> if (a == 2 and b < 5) or (c != 4 and not d):
|
||||
do_something()
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<b>Enigma:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> a 2 ! equal = cond-a;
|
||||
b 5 ! lesser = cond-b;
|
||||
c 4 ! equal ! not = cond-c;
|
||||
d ! not = cond-d;
|
||||
cond-a cond-b ! and = ncond-ab;
|
||||
cond-c cond-d ! and = ncond-cd;
|
||||
ncond-ab ncond-cd ! or = actcond;
|
||||
actcond do-something ! act;
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Compared functions - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Comparison.html#Comparison" title="Comparison">
|
||||
<link rel="prev" href="Compared-looping.html#Compared-looping" title="Compared looping">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Compared-functions"></a>
|
||||
<p>
|
||||
Previous: <a rel="previous" accesskey="p" href="Compared-looping.html#Compared-looping">Compared looping</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Comparison.html#Comparison">Comparison</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">5.4 Functions</h3>
|
||||
|
||||
<blockquote>
|
||||
<b>C:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="verbatim">int time(float space) {
|
||||
return (int) space / 3;
|
||||
}
|
||||
|
||||
t = time(81.65);
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<b>Python:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> def time(space):
|
||||
return int(space / 3)
|
||||
|
||||
t = time(81.65)
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<b>Enigma:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="verbatim">{/space/space 3 ! divide ! clone ! round = return;} = time;
|
||||
|
||||
81.65 ! time = t;
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Compared looping - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Comparison.html#Comparison" title="Comparison">
|
||||
<link rel="prev" href="Compared-conditionals.html#Compared-conditionals" title="Compared conditionals">
|
||||
<link rel="next" href="Compared-functions.html#Compared-functions" title="Compared functions">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Compared-looping"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Compared-functions.html#Compared-functions">Compared functions</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Compared-conditionals.html#Compared-conditionals">Compared conditionals</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Comparison.html#Comparison">Comparison</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">5.3 Looping</h3>
|
||||
|
||||
<blockquote>
|
||||
<b>C:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> while (thinking) run();
|
||||
|
||||
for (int i = 0; i < 18; i++) run(i);
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<b>Python:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="example"> while thinking: run()
|
||||
|
||||
for i in range(18): run(i)
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<b>Enigma:</b> <p><table class="cartouche" summary="cartouche" border="1"><tr><td>
|
||||
<pre class="verbatim">{!run; thinking ! clone = return;} ! loop;
|
||||
|
||||
0 = i;
|
||||
{i ! run; i 1 ! add; i 18 ! equal = return;} ! loop;
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
</blockquote>
|
||||
|
||||
</body></html>
|
||||
|
||||
60
site/projects/enigma/doc/enigma-0.1-html/Comparison.html
Normal file
60
site/projects/enigma/doc/enigma-0.1-html/Comparison.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Comparison - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="prev" href="Implementations.html#Implementations" title="Implementations">
|
||||
<link rel="next" href="Built_002dIn.html#Built_002dIn" title="Built-In">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Comparison"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Built_002dIn.html#Built_002dIn">Built-In</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Implementations.html#Implementations">Implementations</a>,
|
||||
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="chapter">5 Comparison with other languages</h2>
|
||||
|
||||
<ul class="menu">
|
||||
<li><a accesskey="1" href="Compared-assigning.html#Compared-assigning">Compared assigning</a>
|
||||
<li><a accesskey="2" href="Compared-conditionals.html#Compared-conditionals">Compared conditionals</a>
|
||||
<li><a accesskey="3" href="Compared-looping.html#Compared-looping">Compared looping</a>
|
||||
<li><a accesskey="4" href="Compared-functions.html#Compared-functions">Compared functions</a>
|
||||
</ul>
|
||||
|
||||
</body></html>
|
||||
|
||||
83
site/projects/enigma/doc/enigma-0.1-html/Conditionals.html
Normal file
83
site/projects/enigma/doc/enigma-0.1-html/Conditionals.html
Normal file
@@ -0,0 +1,83 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Conditionals - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Functions.html#Functions" title="Functions">
|
||||
<link rel="next" href="Loops.html#Loops" title="Loops">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Conditionals"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Loops.html#Loops">Loops</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Functions.html#Functions">Functions</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.8 Conditionals</h3>
|
||||
|
||||
<p>Any value can be related to another value. 78 is less than 85. 2 equals
|
||||
2. "Hi" is not "Bye". Enigma comes with a basic set of functions that
|
||||
can be used to test these relations. The functions <code>greater</code>,
|
||||
<code>lesser</code>, <code>equal</code>, <code>not</code>, <code>or</code> and <code>and</code> are
|
||||
available. These functions return either true or false. To run a
|
||||
function on the condition that a relational function has returned true,
|
||||
use the function <code>act</code>.
|
||||
|
||||
<p>While <code>lesser</code> and <code>greater</code> are aimed at numbers only,
|
||||
and <code>and</code>, <code>or</code> and <code>not</code> are aimed at booleans only,
|
||||
<code>equal</code> can be used on all objects. It tests for all equalities.
|
||||
|
||||
<pre class="verbatim">2 = a;
|
||||
4 = b;
|
||||
|
||||
a 2 ! add | temp b ! equal = cond1;
|
||||
"47" ! num | temp 48 ! greater = cond2;
|
||||
|
||||
cond1 cond2 ! and | temp write stdout "4 = 4 and 47 > 48\n" ! act;
|
||||
cond1 cond2 ! or | temp write stdout "4 = 4 or 47 > 48\n" ! act;
|
||||
cond2 ! not | cond1 temp ! and | temp write stdout "4 = 4 and !(47 >
|
||||
48)\n" ! act;
|
||||
</pre>
|
||||
|
||||
<p>Even simpler, one can do this (though there's no real need for it):
|
||||
<pre class="verbatim"># Instead of stdout "Hello" !write;
|
||||
true write stdout "Hello" !act;
|
||||
</pre>
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -0,0 +1,519 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Copying This Manual - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="prev" href="Built_002dIn.html#Built_002dIn" title="Built-In">
|
||||
<link rel="next" href="Index.html#Index" title="Index">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Copying-This-Manual"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Index.html#Index">Index</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Built_002dIn.html#Built_002dIn">Built-In</a>,
|
||||
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="appendix">Appendix A GNU Free Documentation License</h2>
|
||||
|
||||
<!-- The GNU Free Documentation License. -->
|
||||
<div align="center">Version 1.3, 3 November 2008</div>
|
||||
|
||||
<!-- This file is intended to be included within another document, -->
|
||||
<!-- hence no sectioning command or @node. -->
|
||||
<pre class="display"> Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
|
||||
<a href="http://fsf.org/">http://fsf.org/</a>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
</pre>
|
||||
<ol type=1 start=0>
|
||||
<li>PREAMBLE
|
||||
|
||||
<p>The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document <dfn>free</dfn> in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
<p>This License is a kind of “copyleft”, which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
<p>We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
<li>APPLICABILITY AND DEFINITIONS
|
||||
|
||||
<p>This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The “Document”, below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as “you”. You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
<p>A “Modified Version” of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
<p>A “Secondary Section” is a named appendix or a front-matter section
|
||||
of the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall
|
||||
subject (or to related matters) and contains nothing that could fall
|
||||
directly within that overall subject. (Thus, if the Document is in
|
||||
part a textbook of mathematics, a Secondary Section may not explain
|
||||
any mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
<p>The “Invariant Sections” are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
<p>The “Cover Texts” are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
<p>A “Transparent” copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not “Transparent” is called “Opaque”.
|
||||
|
||||
<p>Examples of suitable formats for Transparent copies include plain
|
||||
<span class="sc">ascii</span> without markup, Texinfo input format, LaTeX input
|
||||
format, <acronym>SGML</acronym> or <acronym>XML</acronym> using a publicly available
|
||||
<acronym>DTD</acronym>, and standard-conforming simple <acronym>HTML</acronym>,
|
||||
PostScript or <acronym>PDF</acronym> designed for human modification. Examples
|
||||
of transparent image formats include <acronym>PNG</acronym>, <acronym>XCF</acronym> and
|
||||
<acronym>JPG</acronym>. Opaque formats include proprietary formats that can be
|
||||
read and edited only by proprietary word processors, <acronym>SGML</acronym> or
|
||||
<acronym>XML</acronym> for which the <acronym>DTD</acronym> and/or processing tools are
|
||||
not generally available, and the machine-generated <acronym>HTML</acronym>,
|
||||
PostScript or <acronym>PDF</acronym> produced by some word processors for
|
||||
output purposes only.
|
||||
|
||||
<p>The “Title Page” means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, “Title Page” means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
<p>The “publisher” means any person or entity that distributes copies
|
||||
of the Document to the public.
|
||||
|
||||
<p>A section “Entitled XYZ” means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as “Acknowledgements”,
|
||||
“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title”
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section “Entitled XYZ” according to this definition.
|
||||
|
||||
<p>The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
<li>VERBATIM COPYING
|
||||
|
||||
<p>You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
<p>You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
<li>COPYING IN QUANTITY
|
||||
|
||||
<p>If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
<p>If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
<p>If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
<p>It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
<li>MODIFICATIONS
|
||||
|
||||
<p>You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
<ol type=A start=1>
|
||||
<li>Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
|
||||
<li>List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
|
||||
<li>State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
|
||||
<li>Preserve all the copyright notices of the Document.
|
||||
|
||||
<li>Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
|
||||
<li>Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
|
||||
<li>Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
|
||||
<li>Include an unaltered copy of this License.
|
||||
|
||||
<li>Preserve the section Entitled “History”, Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled “History” in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
|
||||
<li>Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the “History” section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
|
||||
<li>For any section Entitled “Acknowledgements” or “Dedications”, Preserve
|
||||
the Title of the section, and preserve in the section all the
|
||||
substance and tone of each of the contributor acknowledgements and/or
|
||||
dedications given therein.
|
||||
|
||||
<li>Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
|
||||
<li>Delete any section Entitled “Endorsements”. Such a section
|
||||
may not be included in the Modified Version.
|
||||
|
||||
<li>Do not retitle any existing section to be Entitled “Endorsements” or
|
||||
to conflict in title with any Invariant Section.
|
||||
|
||||
<li>Preserve any Warranty Disclaimers.
|
||||
</ol>
|
||||
|
||||
<p>If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
<p>You may add a section Entitled “Endorsements”, provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties—for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
<p>You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
<p>The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
<li>COMBINING DOCUMENTS
|
||||
|
||||
<p>You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
<p>The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
<p>In the combination, you must combine any sections Entitled “History”
|
||||
in the various original documents, forming one section Entitled
|
||||
“History”; likewise combine any sections Entitled “Acknowledgements”,
|
||||
and any sections Entitled “Dedications”. You must delete all
|
||||
sections Entitled “Endorsements.”
|
||||
|
||||
<li>COLLECTIONS OF DOCUMENTS
|
||||
|
||||
<p>You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
<p>You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
<li>AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
<p>A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an “aggregate” if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
<p>If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
<li>TRANSLATION
|
||||
|
||||
<p>Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
<p>If a section in the Document is Entitled “Acknowledgements”,
|
||||
“Dedications”, or “History”, the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
<li>TERMINATION
|
||||
|
||||
<p>You may not copy, modify, sublicense, or distribute the Document
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense, or distribute it is void, and
|
||||
will automatically terminate your rights under this License.
|
||||
|
||||
<p>However, if you cease all violation of this License, then your license
|
||||
from a particular copyright holder is reinstated (a) provisionally,
|
||||
unless and until the copyright holder explicitly and finally
|
||||
terminates your license, and (b) permanently, if the copyright holder
|
||||
fails to notify you of the violation by some reasonable means prior to
|
||||
60 days after the cessation.
|
||||
|
||||
<p>Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
<p>Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, receipt of a copy of some or all of the same material does
|
||||
not give you any rights to use it.
|
||||
|
||||
<li>FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
<p>The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
<a href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>.
|
||||
|
||||
<p>Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License “or any later version” applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation. If the Document
|
||||
specifies that a proxy can decide which future versions of this
|
||||
License can be used, that proxy's public statement of acceptance of a
|
||||
version permanently authorizes you to choose that version for the
|
||||
Document.
|
||||
|
||||
<li>RELICENSING
|
||||
|
||||
<p>“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
|
||||
World Wide Web server that publishes copyrightable works and also
|
||||
provides prominent facilities for anybody to edit those works. A
|
||||
public wiki that anybody can edit is an example of such a server. A
|
||||
“Massive Multiauthor Collaboration” (or “MMC”) contained in the
|
||||
site means any set of copyrightable works thus published on the MMC
|
||||
site.
|
||||
|
||||
<p>“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
|
||||
license published by Creative Commons Corporation, a not-for-profit
|
||||
corporation with a principal place of business in San Francisco,
|
||||
California, as well as future copyleft versions of that license
|
||||
published by that same organization.
|
||||
|
||||
<p>“Incorporate” means to publish or republish a Document, in whole or
|
||||
in part, as part of another Document.
|
||||
|
||||
<p>An MMC is “eligible for relicensing” if it is licensed under this
|
||||
License, and if all works that were first published under this License
|
||||
somewhere other than this MMC, and subsequently incorporated in whole
|
||||
or in part into the MMC, (1) had no cover texts or invariant sections,
|
||||
and (2) were thus incorporated prior to November 1, 2008.
|
||||
|
||||
<p>The operator of an MMC Site may republish an MMC contained in the site
|
||||
under CC-BY-SA on the same site at any time before August 1, 2009,
|
||||
provided the MMC is eligible for relicensing.
|
||||
|
||||
</ol>
|
||||
|
||||
<h3 class="heading">ADDENDUM: How to use this License for your documents</h3>
|
||||
|
||||
<p>To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
<pre class="smallexample"> Copyright (C) <var>year</var> <var>your name</var>.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
</pre>
|
||||
<p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the “with<small class="dots">...</small>Texts.” line with this:
|
||||
|
||||
<pre class="smallexample"> with the Invariant Sections being <var>list their titles</var>, with
|
||||
the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts
|
||||
being <var>list</var>.
|
||||
</pre>
|
||||
<p>If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
<p>If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
|
||||
<!-- Local Variables: -->
|
||||
<!-- ispell-local-pdict: "ispell-dict" -->
|
||||
<!-- End: -->
|
||||
</body></html>
|
||||
|
||||
85
site/projects/enigma/doc/enigma-0.1-html/Files.html
Normal file
85
site/projects/enigma/doc/enigma-0.1-html/Files.html
Normal file
@@ -0,0 +1,85 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Files - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Booleans.html#Booleans" title="Booleans">
|
||||
<link rel="next" href="Functions.html#Functions" title="Functions">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Files"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Functions.html#Functions">Functions</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Booleans.html#Booleans">Booleans</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.6 Files</h3>
|
||||
|
||||
<p><a name="index-files-9"></a>Files can only be created using the built-in function <code>open</code>. Files
|
||||
are either readable or writeable. If a file is writeable, text written
|
||||
to the file may optionally be appended to any existing text.
|
||||
|
||||
<p><a name="index-read-10"></a><a name="index-write-11"></a><a name="index-open-12"></a><a name="index-close-13"></a>
|
||||
<pre class="verbatim">"a" "r" ! open = f1;
|
||||
"b" "w" ! open = f2;
|
||||
"c" "a" ! open = f3;
|
||||
|
||||
# Read one character
|
||||
f1 ! read | stdout temp ! write;
|
||||
# Write a string
|
||||
f2 "Aaar" ! write;
|
||||
# Append a string
|
||||
f3 "Ouu" ! write;
|
||||
|
||||
f1!close;f2!close;f3!close;
|
||||
</pre>
|
||||
|
||||
<p>To read an entire file, one must use a loop
|
||||
construct. See <a href="Loops.html#Loops">Loops</a>. When there are no more characters left, the
|
||||
<code>read</code> function returns an empty string. Using equality testing,
|
||||
reading a complete file is thus possible. See <a href="Conditionals.html#Conditionals">Conditionals</a>.
|
||||
|
||||
<pre class="verbatim">filename "r" ! open = f;
|
||||
{f ! read = c; stdout c ! write; c "" ! equal ! not = return;} ! loop;
|
||||
</pre>
|
||||
|
||||
<p>At this point, it may not be obvious why this works. This will be
|
||||
explained in the next sections.
|
||||
|
||||
</body></html>
|
||||
|
||||
97
site/projects/enigma/doc/enigma-0.1-html/Functions.html
Normal file
97
site/projects/enigma/doc/enigma-0.1-html/Functions.html
Normal file
@@ -0,0 +1,97 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Functions - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Files.html#Files" title="Files">
|
||||
<link rel="next" href="Conditionals.html#Conditionals" title="Conditionals">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Functions"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Conditionals.html#Conditionals">Conditionals</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Files.html#Files">Files</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.7 Functions</h3>
|
||||
|
||||
<p><a name="index-functions-14"></a>Functions are defined and called using the following syntax:
|
||||
|
||||
<pre class="verbatim"># Defining them
|
||||
{stdout "Hello" ! write;} = func;
|
||||
{/x,y/stdout "x=" x ", y=" y!write;} = coorprint;
|
||||
{stdout args ! write;} = aprint;
|
||||
|
||||
# Calling them
|
||||
!func; # Outputs "Hello"
|
||||
52 12 ! coorprint; # Outputs "x=52, y=12"
|
||||
999 "abc" 21 ! aprint; # Outputs "999 abc 21"
|
||||
</pre>
|
||||
|
||||
<p>Arguments can thus be accessed either by using the <code>/.../</code> syntax
|
||||
in the beginning of the function or by using the local <code>args</code>
|
||||
variable. Furthermore, to make <em>all</em> new variables save in the
|
||||
global space, prepend the function content with a <code>*</code>. This will
|
||||
have the same effect as replacing all <code>=</code> signs in the function
|
||||
with the <code>*</code> operator.
|
||||
|
||||
<p>Remember that your file is also a function, just without the curly
|
||||
brackets. This means that when working on the top level of your program,
|
||||
<code>args</code> actually refer to the arguments specified on the command
|
||||
line. All arguments are strings, but built-in functions that can convert
|
||||
them to numbers exist.
|
||||
|
||||
<p>The previous example functions did not have any return values. This is
|
||||
merely because they didn't need such things. To define a return value,
|
||||
the return value must be sent to the special variable <code>return</code>.
|
||||
<pre class="verbatim">{/a,b/a b ! multiply = return;} = 2mul;
|
||||
33 3 ! 2mul = 2mult;
|
||||
stdout 2mult ! write;
|
||||
</pre>
|
||||
The execution of a function does <em>not</em> stop when a value
|
||||
is assigned to <code>return</code>. This has both advantages and
|
||||
disadvantages.
|
||||
|
||||
<p>Many things are almost impossible to do without the built-in
|
||||
functions. Some are completely impossible. See <a href="Built_002dIn.html#Built_002dIn">Built-In</a>. As all
|
||||
objects in Enigma are pointers, several built-in functions actually
|
||||
modify the objects sent to them as arguments. To solve this problem, one
|
||||
must use the <code>clone</code> function.
|
||||
|
||||
</body></html>
|
||||
|
||||
67
site/projects/enigma/doc/enigma-0.1-html/Future.html
Normal file
67
site/projects/enigma/doc/enigma-0.1-html/Future.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Future - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="prev" href="Language.html#Language" title="Language">
|
||||
<link rel="next" href="Implementations.html#Implementations" title="Implementations">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Future"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Implementations.html#Implementations">Implementations</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Language.html#Language">Language</a>,
|
||||
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="chapter">3 Future aspects</h2>
|
||||
|
||||
<p>As Enigma is right now, it is quite limited. The only way that it can
|
||||
interact with the rest of one's system is by reading and writing files
|
||||
and by executing shell commands using the <code>system</code> built-in
|
||||
function. This obviously needs to be improved. A foreign function
|
||||
interface system must be implemented in version 0.2. It should be
|
||||
possible for Enigma to do everything C can.
|
||||
|
||||
<p>The number of built-in functions seems reasonable, but it may be a good
|
||||
idea to implement a few more. These eventual functions should be focused
|
||||
on making things easier. Specifically, an import function should be
|
||||
considered. It is possible to create an import function in Enigma
|
||||
directly, but it's not exactly fast. Introducing a “compile” function
|
||||
should solve that.
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Implementations - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="prev" href="Future.html#Future" title="Future">
|
||||
<link rel="next" href="Comparison.html#Comparison" title="Comparison">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Implementations"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Comparison.html#Comparison">Comparison</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Future.html#Future">Future</a>,
|
||||
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="chapter">4 Implementations</h2>
|
||||
|
||||
<p><a name="index-enigma-15"></a>As of right now (beginning of June 2010) there is only one
|
||||
implementation. It is written in Java and is called enigma (with a
|
||||
lowercase e). The code is bulky and was not written by an experienced
|
||||
Java hacker. For v0.2 it may be a good idea to write the interpreter in
|
||||
C instead. Implementing a foreign function interface should be easier
|
||||
that way.
|
||||
|
||||
<p>The current implementation can be downloaded at
|
||||
<a href="http://metanohi.org/projects/enigma">http://metanohi.org/projects/enigma</a>.
|
||||
|
||||
</body></html>
|
||||
|
||||
69
site/projects/enigma/doc/enigma-0.1-html/Index.html
Normal file
69
site/projects/enigma/doc/enigma-0.1-html/Index.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Index - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="prev" href="Copying-This-Manual.html#Copying-This-Manual" title="Copying This Manual">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Index"></a>
|
||||
<p>
|
||||
Previous: <a rel="previous" accesskey="p" href="Copying-This-Manual.html#Copying-This-Manual">Copying This Manual</a>,
|
||||
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="unnumbered">Index</h2>
|
||||
|
||||
<ul class="index-cp" compact>
|
||||
<li><a href="Lists.html#index-arrays-7">arrays</a>: <a href="Lists.html#Lists">Lists</a></li>
|
||||
<li><a href="Booleans.html#index-booleans-8">booleans</a>: <a href="Booleans.html#Booleans">Booleans</a></li>
|
||||
<li><a href="Built_002dIn-functions.html#index-built_002din-functions-17">built-in functions</a>: <a href="Built_002dIn-functions.html#Built_002dIn-functions">Built-In functions</a></li>
|
||||
<li><a href="Built_002dIn-values.html#index-built_002din-values-16">built-in values</a>: <a href="Built_002dIn-values.html#Built_002dIn-values">Built-In values</a></li>
|
||||
<li><a href="Strings.html#index-characters-5">characters</a>: <a href="Strings.html#Strings">Strings</a></li>
|
||||
<li><a href="Files.html#index-close-13">close</a>: <a href="Files.html#Files">Files</a></li>
|
||||
<li><a href="Implementations.html#index-enigma-15"><code>enigma</code></a>: <a href="Implementations.html#Implementations">Implementations</a></li>
|
||||
<li><a href="Files.html#index-files-9">files</a>: <a href="Files.html#Files">Files</a></li>
|
||||
<li><a href="Functions.html#index-functions-14">functions</a>: <a href="Functions.html#Functions">Functions</a></li>
|
||||
<li><a href="Lists.html#index-lists-6">lists</a>: <a href="Lists.html#Lists">Lists</a></li>
|
||||
<li><a href="Numbers.html#index-numbers-3">numbers</a>: <a href="Numbers.html#Numbers">Numbers</a></li>
|
||||
<li><a href="Files.html#index-open-12">open</a>: <a href="Files.html#Files">Files</a></li>
|
||||
<li><a href="Operators.html#index-operators-2">operators</a>: <a href="Operators.html#Operators">Operators</a></li>
|
||||
<li><a href="Introduction.html#index-pointers-1">pointers</a>: <a href="Introduction.html#Introduction">Introduction</a></li>
|
||||
<li><a href="Files.html#index-read-10">read</a>: <a href="Files.html#Files">Files</a></li>
|
||||
<li><a href="Strings.html#index-strings-4">strings</a>: <a href="Strings.html#Strings">Strings</a></li>
|
||||
<li><a href="Files.html#index-write-11">write</a>: <a href="Files.html#Files">Files</a></li>
|
||||
</ul></body></html>
|
||||
|
||||
93
site/projects/enigma/doc/enigma-0.1-html/Introduction.html
Normal file
93
site/projects/enigma/doc/enigma-0.1-html/Introduction.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Introduction - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="prev" href="index.html#Top" title="Top">
|
||||
<link rel="next" href="Language.html#Language" title="Language">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Introduction"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Language.html#Language">Language</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="index.html#Top">Top</a>,
|
||||
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="chapter">1 A short introduction</h2>
|
||||
|
||||
<p>Today, in the world of programming, the commonly used programming
|
||||
languages have — to some extent — adapted the same basic
|
||||
syntax. Both C, C++, Java, Python and Ruby (and others) all share
|
||||
several paradigms, even though they are still very different. Enigma, on
|
||||
the other hand, is very different from the “common” languages. See
|
||||
this small program to get an idea of Enigma:
|
||||
|
||||
<pre class="verbatim">{/a,b/
|
||||
a 2 ! multiply = c;
|
||||
b c ! add = return;
|
||||
} = odd-add;
|
||||
|
||||
9 4 ! odd-add | stdout temp ! write;
|
||||
</pre>
|
||||
|
||||
<p class="noindent">Here, 9 is first multiplied with 2 and then added to 4. The
|
||||
program then prints the result (22).
|
||||
|
||||
<p>With only a few constructs and built-in variables, Enigma is quite small
|
||||
and relatively simple. Any logic can be expressed in Enigma. The above
|
||||
example may seem odd, but its aspects will be dealt with in the next
|
||||
chapter.
|
||||
|
||||
<p>Enigma is <em>not</em> the kind of programming language that likes to
|
||||
control programmers. When programming in Enigma, one creates functions
|
||||
that call other functions — instead of creating functions that are
|
||||
called by built-in functions.
|
||||
|
||||
<p>On the other hand, Enigma is very restrictive. There are limits to
|
||||
certain things. If these limits were not present, chaos would
|
||||
ensue. Perhaps.
|
||||
|
||||
<p><a name="index-pointers-1"></a>Like many other languages, Enigma is quite fond of pointers. In Enigma,
|
||||
all variables are pointers. When <code>x</code> is assigned to <code>a</code>, and
|
||||
<code>b</code> is assigned to <code>a</code>, changing <code>b</code> also changes
|
||||
<code>a</code>. As a matter of fact, when two pointers points to the same
|
||||
place, they are <strong>forever</strong> linked together.
|
||||
|
||||
<p>Enigma is not recommended for serious use. Use with <strong>caution</strong>!
|
||||
|
||||
</body></html>
|
||||
|
||||
82
site/projects/enigma/doc/enigma-0.1-html/Language.html
Normal file
82
site/projects/enigma/doc/enigma-0.1-html/Language.html
Normal file
@@ -0,0 +1,82 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Language - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="prev" href="Introduction.html#Introduction" title="Introduction">
|
||||
<link rel="next" href="Future.html#Future" title="Future">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Language"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Future.html#Future">Future</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Introduction.html#Introduction">Introduction</a>,
|
||||
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="chapter">2 The language</h2>
|
||||
|
||||
<p>Enigma consists of functions. Any file being parsed is a
|
||||
function. Within functions there can be local variables. These variables
|
||||
are to disappear when the function exits.
|
||||
|
||||
<p>Functions have return values. These values can be determined by the
|
||||
programmer.
|
||||
|
||||
<p>Within functions, there are commands. These commands constitute the very
|
||||
base of Enigma. Commands can interact with built-in functions, meaning
|
||||
that writing to and reading from files, calculating, as well as
|
||||
manipulating strings and lists, is possible.
|
||||
|
||||
<p>There are no simple types. Enigma lies in the world of objects. Numbers,
|
||||
strings, lists.. It's just objects. Also, all commands must end with a
|
||||
semicolon<code>;</code>
|
||||
|
||||
<ul class="menu">
|
||||
<li><a accesskey="1" href="Operators.html#Operators">Operators</a>
|
||||
<li><a accesskey="2" href="Numbers.html#Numbers">Numbers</a>
|
||||
<li><a accesskey="3" href="Strings.html#Strings">Strings</a>
|
||||
<li><a accesskey="4" href="Lists.html#Lists">Lists</a>
|
||||
<li><a accesskey="5" href="Booleans.html#Booleans">Booleans</a>
|
||||
<li><a accesskey="6" href="Files.html#Files">Files</a>
|
||||
<li><a accesskey="7" href="Functions.html#Functions">Functions</a>
|
||||
<li><a accesskey="8" href="Conditionals.html#Conditionals">Conditionals</a>
|
||||
<li><a accesskey="9" href="Loops.html#Loops">Loops</a>
|
||||
<li><a href="Undefined.html#Undefined">Undefined</a>
|
||||
</ul>
|
||||
|
||||
</body></html>
|
||||
|
||||
63
site/projects/enigma/doc/enigma-0.1-html/Lists.html
Normal file
63
site/projects/enigma/doc/enigma-0.1-html/Lists.html
Normal file
@@ -0,0 +1,63 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Lists - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Strings.html#Strings" title="Strings">
|
||||
<link rel="next" href="Booleans.html#Booleans" title="Booleans">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Lists"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Booleans.html#Booleans">Booleans</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Strings.html#Strings">Strings</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.4 Lists</h3>
|
||||
|
||||
<p><a name="index-lists-6"></a><a name="index-arrays-7"></a>Lists are special in Enigma. They are used a lot, but unlike eg. numbers
|
||||
and strings they cannot be defined in their own syntax. When one writes
|
||||
this:
|
||||
|
||||
<pre class="verbatim">123 "witch" = lst;
|
||||
</pre>
|
||||
|
||||
<p>..one creates a list. Lists can be nested.
|
||||
|
||||
</body></html>
|
||||
|
||||
67
site/projects/enigma/doc/enigma-0.1-html/Loops.html
Normal file
67
site/projects/enigma/doc/enigma-0.1-html/Loops.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Loops - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Conditionals.html#Conditionals" title="Conditionals">
|
||||
<link rel="next" href="Undefined.html#Undefined" title="Undefined">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Loops"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Undefined.html#Undefined">Undefined</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Conditionals.html#Conditionals">Conditionals</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.9 Loops</h3>
|
||||
|
||||
<p>There are several ways to loop pieces of code in Enigma. One can create
|
||||
a function that calls itself, for example. It is, however, advised to
|
||||
use the <code>loop</code> function.
|
||||
<pre class="verbatim"># Infinite loop
|
||||
{stdout "Forever\n" ! write; true = return;} ! loop;
|
||||
</pre>
|
||||
<code>loop</code> works a bit like <code>act</code>, except that it runs on the
|
||||
premise of the return value of the function it calls. If it returns
|
||||
true, or any other value that can be considered true (non-zero numbers,
|
||||
non-empty strings, files, etc.), it runs the function again. If it
|
||||
returns false, the loop stops. It naturally runs the first time no
|
||||
matter what (no return value has been created yet).
|
||||
|
||||
</body></html>
|
||||
|
||||
61
site/projects/enigma/doc/enigma-0.1-html/Numbers.html
Normal file
61
site/projects/enigma/doc/enigma-0.1-html/Numbers.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Numbers - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Operators.html#Operators" title="Operators">
|
||||
<link rel="next" href="Strings.html#Strings" title="Strings">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Numbers"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Strings.html#Strings">Strings</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Operators.html#Operators">Operators</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.2 Numbers</h3>
|
||||
|
||||
<p><a name="index-numbers-3"></a>Numbers in Enigma can be arbitrarily large. They are written as one
|
||||
usually writes numbers. Currently only the decimal system is supported.
|
||||
|
||||
<pre class="verbatim">7587 = age;
|
||||
2556 ! numfunc;
|
||||
</pre>
|
||||
|
||||
</body></html>
|
||||
|
||||
99
site/projects/enigma/doc/enigma-0.1-html/Operators.html
Normal file
99
site/projects/enigma/doc/enigma-0.1-html/Operators.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Operators - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Language.html#Language" title="Language">
|
||||
<link rel="next" href="Numbers.html#Numbers" title="Numbers">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Operators"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Numbers.html#Numbers">Numbers</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Language.html#Language">Language</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.1 Operators</h3>
|
||||
|
||||
<p><a name="index-operators-2"></a>Enigma has 4 operators: <code>!</code>, <code>=</code>, <code>|</code>, and
|
||||
<code>*</code>. <code>!</code> and <code>=</code> are the most important ones.
|
||||
|
||||
<p>To assign values to variables, use the <code>=</code> operator. For example:
|
||||
<pre class="verbatim">obj = hello-string;
|
||||
</pre>
|
||||
Here, the variable <code>hello-string</code> receives the object <code>obj</code>. Note
|
||||
the syntax. The objects comes first. Unless <code>hello-string</code> is
|
||||
already defined, it is created as a local variable.
|
||||
|
||||
<p>Now, say we have a function called <code>think</code> and we want to send
|
||||
objects to it. This is how that's done:
|
||||
|
||||
<pre class="verbatim">obj1 obj2 obj3 ! think;
|
||||
</pre>
|
||||
|
||||
<p>There are no limits to the amount of objects that can be sent to a
|
||||
function. Whitespace characters are used to separate objects, also when
|
||||
assigning them to a variable. There <em>is</em> a difference between
|
||||
using one object and more objects as arguments, though. When using only
|
||||
one object, that object is simply used, but when using more objects, a
|
||||
list containing all objects is created and transmitted instead. So, in
|
||||
reality, when assigning two or more objects to a variable, the variable
|
||||
points to a list with the objects. More about lists later.
|
||||
|
||||
<p>The <code>|</code> operator is merely a shortcut operator. It can merge
|
||||
several commands into one, long command. See the following example:
|
||||
|
||||
<pre class="verbatim"># Long version
|
||||
a ! b = c;
|
||||
d c ! e = c;
|
||||
# Short version
|
||||
a ! b | d temp ! e = c;
|
||||
</pre>
|
||||
|
||||
<p>Here, <code>a</code> is sent to <code>b</code>, which is then — together with
|
||||
<code>d</code> — sent to <code>e</code> and saved in <code>c</code>. The <code>|</code> acts
|
||||
like the semicolon, but it copies the return value of the last function
|
||||
(in this case <code>b</code>) and stores the value in the local variable
|
||||
<code>temp</code>. Hackers are encouraged to use this operator.
|
||||
|
||||
<p>The final operator, <code>*</code>, has the same function as <code>=</code>, except
|
||||
that it works on a global level. So, if the code is <code>b = a;</code> and
|
||||
<code>a</code> does not exist, it is created — in the global space.
|
||||
|
||||
</body></html>
|
||||
|
||||
64
site/projects/enigma/doc/enigma-0.1-html/Strings.html
Normal file
64
site/projects/enigma/doc/enigma-0.1-html/Strings.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Strings - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Numbers.html#Numbers" title="Numbers">
|
||||
<link rel="next" href="Lists.html#Lists" title="Lists">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Strings"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Lists.html#Lists">Lists</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="Numbers.html#Numbers">Numbers</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.3 Strings</h3>
|
||||
|
||||
<p><a name="index-strings-4"></a><a name="index-characters-5"></a>Strings are defined using the <code>"</code> character.
|
||||
|
||||
<pre class="verbatim">"This is a string!" " This too!" ! add;
|
||||
"A" = A;
|
||||
"Now comes
|
||||
a newline" = nl;
|
||||
"\"\\\n\t\
|
||||
" = escaped;
|
||||
</pre>
|
||||
|
||||
</body></html>
|
||||
|
||||
57
site/projects/enigma/doc/enigma-0.1-html/Undefined.html
Normal file
57
site/projects/enigma/doc/enigma-0.1-html/Undefined.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Undefined - Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="index.html#Top">
|
||||
<link rel="up" href="Language.html#Language" title="Language">
|
||||
<link rel="prev" href="Loops.html#Loops" title="Loops">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="node">
|
||||
<a name="Undefined"></a>
|
||||
<p>
|
||||
Previous: <a rel="previous" accesskey="p" href="Loops.html#Loops">Loops</a>,
|
||||
Up: <a rel="up" accesskey="u" href="Language.html#Language">Language</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="section">2.10 Undefined behaviour</h3>
|
||||
|
||||
<p>Enigma is still new. The way built-in functions act, the way error
|
||||
messages appear, and the way some odd details of the language works are
|
||||
still undefined. In general, when something seems likely to work, it
|
||||
will work. But it's not necessarily defined to work.
|
||||
|
||||
</body></html>
|
||||
|
||||
121
site/projects/enigma/doc/enigma-0.1-html/index.html
Normal file
121
site/projects/enigma/doc/enigma-0.1-html/index.html
Normal file
@@ -0,0 +1,121 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Enigma</title>
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
<meta name="description" content="Enigma">
|
||||
<meta name="generator" content="makeinfo 4.13">
|
||||
<link title="Top" rel="start" href="#Top">
|
||||
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||||
<!--
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright (C) 2010 Niels Serup
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative
|
||||
Commons Attribution-Share Alike 3.0 (or any later version)
|
||||
Unported license. A copy of the license is available at
|
||||
`http://creativecommons.org/licenses/by-sa/3.0/legalcode'.
|
||||
-->
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<style type="text/css"><!--
|
||||
pre.display { font-family:inherit }
|
||||
pre.format { font-family:inherit }
|
||||
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||||
pre.smallformat { font-family:inherit; font-size:smaller }
|
||||
pre.smallexample { font-size:smaller }
|
||||
pre.smalllisp { font-size:smaller }
|
||||
span.sc { font-variant:small-caps }
|
||||
span.roman { font-family:serif; font-weight:normal; }
|
||||
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="settitle">Enigma</h1>
|
||||
<div class="contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<ul>
|
||||
<li><a name="toc_Top" href="index.html#Top">Enigma</a>
|
||||
<li><a name="toc_Introduction" href="Introduction.html#Introduction">1 A short introduction</a>
|
||||
<li><a name="toc_Language" href="Language.html#Language">2 The language</a>
|
||||
<ul>
|
||||
<li><a href="Operators.html#Operators">2.1 Operators</a>
|
||||
<li><a href="Numbers.html#Numbers">2.2 Numbers</a>
|
||||
<li><a href="Strings.html#Strings">2.3 Strings</a>
|
||||
<li><a href="Lists.html#Lists">2.4 Lists</a>
|
||||
<li><a href="Booleans.html#Booleans">2.5 Booleans</a>
|
||||
<li><a href="Files.html#Files">2.6 Files</a>
|
||||
<li><a href="Functions.html#Functions">2.7 Functions</a>
|
||||
<li><a href="Conditionals.html#Conditionals">2.8 Conditionals</a>
|
||||
<li><a href="Loops.html#Loops">2.9 Loops</a>
|
||||
<li><a href="Undefined.html#Undefined">2.10 Undefined behaviour</a>
|
||||
</li></ul>
|
||||
<li><a name="toc_Future" href="Future.html#Future">3 Future aspects</a>
|
||||
<li><a name="toc_Implementations" href="Implementations.html#Implementations">4 Implementations</a>
|
||||
<li><a name="toc_Comparison" href="Comparison.html#Comparison">5 Comparison with other languages</a>
|
||||
<ul>
|
||||
<li><a href="Compared-assigning.html#Compared-assigning">5.1 Assigning values</a>
|
||||
<li><a href="Compared-conditionals.html#Compared-conditionals">5.2 Conditionals</a>
|
||||
<li><a href="Compared-looping.html#Compared-looping">5.3 Looping</a>
|
||||
<li><a href="Compared-functions.html#Compared-functions">5.4 Functions</a>
|
||||
</li></ul>
|
||||
<li><a name="toc_Built_002dIn" href="Built_002dIn.html#Built_002dIn">6 Built-in values and functions</a>
|
||||
<ul>
|
||||
<li><a href="Built_002dIn-values.html#Built_002dIn-values">6.1 Values</a>
|
||||
<li><a href="Built_002dIn-functions.html#Built_002dIn-functions">6.2 Functions</a>
|
||||
</li></ul>
|
||||
<li><a name="toc_Copying-This-Manual" href="Copying-This-Manual.html#Copying-This-Manual">Appendix A GNU Free Documentation License</a>
|
||||
<li><a name="toc_Index" href="Index.html#Index">Index</a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="node">
|
||||
<a name="Top"></a>
|
||||
<p>
|
||||
Next: <a rel="next" accesskey="n" href="Introduction.html#Introduction">Introduction</a>,
|
||||
Previous: <a rel="previous" accesskey="p" href="../index.html#dir">(dir)</a>,
|
||||
Up: <a rel="up" accesskey="u" href="../index.html#dir">(dir)</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2 class="unnumbered">Enigma</h2>
|
||||
|
||||
<p>This manual is for Enigma, version 0.1.
|
||||
Copyright © 2010 Niels Serup
|
||||
<blockquote>
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
||||
copy of the license is included in the section entitled "GNU Free
|
||||
Documentation License".
|
||||
|
||||
<p>This document is also available under the terms of the Creative Commons
|
||||
Attribution-Share Alike 3.0 (or any later version) Unported license. A
|
||||
copy of the license is available at
|
||||
<a href="http://creativecommons.org/licenses/by-sa/3.0/legalcode">http://creativecommons.org/licenses/by-sa/3.0/legalcode</a>.
|
||||
</blockquote>
|
||||
|
||||
<p>New versions of this manual will be available at
|
||||
<a href="http://metanohi.org/projects/enigma/">http://metanohi.org/projects/enigma/</a>.
|
||||
|
||||
<ul class="menu">
|
||||
<li><a accesskey="1" href="Introduction.html#Introduction">Introduction</a>
|
||||
<li><a accesskey="2" href="Language.html#Language">Language</a>
|
||||
<li><a accesskey="3" href="Future.html#Future">Future</a>
|
||||
<li><a accesskey="4" href="Implementations.html#Implementations">Implementations</a>
|
||||
<li><a accesskey="5" href="Comparison.html#Comparison">Comparison</a>
|
||||
<li><a accesskey="6" href="Built_002dIn.html#Built_002dIn">Built-In</a>
|
||||
<li><a accesskey="7" href="Copying-This-Manual.html#Copying-This-Manual">Copying This Manual</a>
|
||||
<li><a accesskey="8" href="Index.html#Index">Index</a>
|
||||
</ul>
|
||||
|
||||
</body></html>
|
||||
|
||||
BIN
site/projects/enigma/doc/enigma-0.1.pdf
Normal file
BIN
site/projects/enigma/doc/enigma-0.1.pdf
Normal file
Binary file not shown.
697
site/projects/enigma/doc/enigma-0.1.texinfo
Normal file
697
site/projects/enigma/doc/enigma-0.1.texinfo
Normal file
@@ -0,0 +1,697 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header
|
||||
@setfilename enigma-documentation.info
|
||||
@finalout
|
||||
@settitle Enigma
|
||||
@afourpaper
|
||||
@syncodeindex pg cp
|
||||
@comment %**end of header
|
||||
@copying
|
||||
This manual is for Enigma, version 0.1.
|
||||
Copyright @copyright{} 2010 Niels Serup
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
||||
copy of the license is included in the section entitled "GNU Free
|
||||
Documentation License".
|
||||
|
||||
This document is also available under the terms of the Creative Commons
|
||||
Attribution-Share Alike 3.0 (or any later version) Unported license. A
|
||||
copy of the license is available at
|
||||
@url{http://creativecommons.org/@/licenses/@/by-sa/@/3.0/@/legalcode}.
|
||||
@end quotation
|
||||
@end copying
|
||||
@titlepage
|
||||
@title Enigma
|
||||
@subtitle A programming language @hskip 0pt plus 1filll Version 0.1
|
||||
@sp 8
|
||||
@center @image{../art/enigma-logo,11cm,,Enigma logo}
|
||||
@author Niels Serup (@email{ns@@metanohi.org})
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
@contents
|
||||
@ifnottex
|
||||
@node Top, Introduction, (dir), (dir)
|
||||
@top Enigma
|
||||
@insertcopying
|
||||
|
||||
New versions of this manual will be available at
|
||||
@url{http://metanohi.org/@/projects/@/enigma/}.
|
||||
@end ifnottex
|
||||
@menu
|
||||
* Introduction::
|
||||
* Language::
|
||||
* Future::
|
||||
* Implementations::
|
||||
* Comparison::
|
||||
* Built-In::
|
||||
* Copying This Manual::
|
||||
* Index::
|
||||
@end menu
|
||||
|
||||
@node Introduction, Language, Top, Top
|
||||
@chapter A short introduction
|
||||
Today, in the world of programming, the commonly used programming
|
||||
languages have --- to some extent --- adapted the same basic
|
||||
syntax. Both C, C++, Java, Python and Ruby (and others) all share
|
||||
several paradigms, even though they are still very different. Enigma, on
|
||||
the other hand, is very different from the ``common'' languages. See
|
||||
this small program to get an idea of Enigma:
|
||||
|
||||
@verbatim
|
||||
{/a,b/
|
||||
a 2 ! multiply = c;
|
||||
b c ! add = return;
|
||||
} = odd-add;
|
||||
|
||||
9 4 ! odd-add | stdout temp ! write;
|
||||
@end verbatim
|
||||
|
||||
@noindent Here, 9 is first multiplied with 2 and then added to 4. The
|
||||
program then prints the result (22).
|
||||
|
||||
With only a few constructs and built-in variables, Enigma is quite small
|
||||
and relatively simple. Any logic can be expressed in Enigma. The above
|
||||
example may seem odd, but its aspects will be dealt with in the next
|
||||
chapter.
|
||||
|
||||
Enigma is @emph{not} the kind of programming language that likes to
|
||||
control programmers. When programming in Enigma, one creates functions
|
||||
that call other functions --- instead of creating functions that are
|
||||
called by built-in functions.
|
||||
|
||||
On the other hand, Enigma is very restrictive. There are limits to
|
||||
certain things. If these limits were not present, chaos would
|
||||
ensue. Perhaps.
|
||||
|
||||
@cindex pointers
|
||||
Like many other languages, Enigma is quite fond of pointers. In Enigma,
|
||||
all variables are pointers. When @code{x} is assigned to @code{a}, and
|
||||
@code{b} is assigned to @code{a}, changing @code{b} also changes
|
||||
@code{a}. As a matter of fact, when two pointers points to the same
|
||||
place, they are @strong{forever} linked together.
|
||||
|
||||
Enigma is not recommended for serious use. Use with @strong{caution}!
|
||||
|
||||
|
||||
@node Language, Future, Introduction, Top
|
||||
@chapter The language
|
||||
Enigma consists of functions. Any file being parsed is a
|
||||
function. Within functions there can be local variables. These variables
|
||||
are to disappear when the function exits.
|
||||
|
||||
Functions have return values. These values can be determined by the
|
||||
programmer.
|
||||
|
||||
Within functions, there are commands. These commands constitute the very
|
||||
base of Enigma. Commands can interact with built-in functions, meaning
|
||||
that writing to and reading from files, calculating, as well as
|
||||
manipulating strings and lists, is possible.
|
||||
|
||||
There are no simple types. Enigma lies in the world of objects. Numbers,
|
||||
strings, lists.. It's just objects. Also, all commands must end with a
|
||||
semicolon@code{;}
|
||||
|
||||
|
||||
@menu
|
||||
* Operators::
|
||||
* Numbers::
|
||||
* Strings::
|
||||
* Lists::
|
||||
* Booleans::
|
||||
* Files::
|
||||
* Functions::
|
||||
* Conditionals::
|
||||
* Loops::
|
||||
* Undefined::
|
||||
@end menu
|
||||
|
||||
|
||||
@node Operators, Numbers, Language, Language
|
||||
@section Operators
|
||||
@cindex operators
|
||||
Enigma has 4 operators: @code{!}, @code{=}, @code{|}, and
|
||||
@code{*}. @code{!} and @code{=} are the most important ones.
|
||||
|
||||
To assign values to variables, use the @code{=} operator. For example:
|
||||
@verbatim
|
||||
obj = hello-string;
|
||||
@end verbatim
|
||||
Here, the variable @code{hello-string} receives the object @code{obj}. Note
|
||||
the syntax. The objects comes first. Unless @code{hello-string} is
|
||||
already defined, it is created as a local variable.
|
||||
|
||||
Now, say we have a function called @code{think} and we want to send
|
||||
objects to it. This is how that's done:
|
||||
|
||||
@verbatim
|
||||
obj1 obj2 obj3 ! think;
|
||||
@end verbatim
|
||||
|
||||
There are no limits to the amount of objects that can be sent to a
|
||||
function. Whitespace characters are used to separate objects, also when
|
||||
assigning them to a variable. There @emph{is} a difference between
|
||||
using one object and more objects as arguments, though. When using only
|
||||
one object, that object is simply used, but when using more objects, a
|
||||
list containing all objects is created and transmitted instead. So, in
|
||||
reality, when assigning two or more objects to a variable, the variable
|
||||
points to a list with the objects. More about lists later.
|
||||
|
||||
The @code{|} operator is merely a shortcut operator. It can merge
|
||||
several commands into one, long command. See the following example:
|
||||
|
||||
@verbatim
|
||||
# Long version
|
||||
a ! b = c;
|
||||
d c ! e = c;
|
||||
# Short version
|
||||
a ! b | d temp ! e = c;
|
||||
@end verbatim
|
||||
|
||||
Here, @code{a} is sent to @code{b}, which is then --- together with
|
||||
@code{d} --- sent to @code{e} and saved in @code{c}. The @code{|} acts
|
||||
like the semicolon, but it copies the return value of the last function
|
||||
(in this case @code{b}) and stores the value in the local variable
|
||||
@code{temp}. Hackers are encouraged to use this operator.
|
||||
|
||||
The final operator, @code{*}, has the same function as @code{=}, except
|
||||
that it works on a global level. So, if the code is @code{b = a;} and
|
||||
@code{a} does not exist, it is created --- in the global space.
|
||||
|
||||
|
||||
@node Numbers, Strings, Operators, Language
|
||||
@section Numbers
|
||||
@cindex numbers
|
||||
Numbers in Enigma can be arbitrarily large. They are written as one
|
||||
usually writes numbers. Currently only the decimal system is supported.
|
||||
|
||||
@verbatim
|
||||
7587 = age;
|
||||
2556 ! numfunc;
|
||||
@end verbatim
|
||||
|
||||
|
||||
@node Strings, Lists, Numbers, Language
|
||||
@section Strings
|
||||
@cindex strings
|
||||
@cindex characters
|
||||
Strings are defined using the @code{"} character.
|
||||
|
||||
@verbatim
|
||||
"This is a string!" " This too!" ! add;
|
||||
"A" = A;
|
||||
"Now comes
|
||||
a newline" = nl;
|
||||
"\"\\\n\t\
|
||||
" = escaped;
|
||||
@end verbatim
|
||||
|
||||
|
||||
@node Lists, Booleans, Strings, Language
|
||||
@section Lists
|
||||
@cindex lists
|
||||
@cindex arrays
|
||||
Lists are special in Enigma. They are used a lot, but unlike eg. numbers
|
||||
and strings they cannot be defined in their own syntax. When one writes
|
||||
this:
|
||||
|
||||
@verbatim
|
||||
123 "witch" = lst;
|
||||
@end verbatim
|
||||
|
||||
..one creates a list. Lists can be nested.
|
||||
|
||||
|
||||
@node Booleans, Files, Lists, Language
|
||||
@section Booleans
|
||||
@cindex booleans
|
||||
Booleans are used a lot in Enigma. The predefined variables @code{true}
|
||||
and @code{false} can be used.
|
||||
|
||||
|
||||
@node Files, Functions, Booleans, Language
|
||||
@section Files
|
||||
@cindex files
|
||||
Files can only be created using the built-in function @code{open}. Files
|
||||
are either readable or writeable. If a file is writeable, text written
|
||||
to the file may optionally be appended to any existing text.
|
||||
|
||||
@cindex read
|
||||
@cindex write
|
||||
@cindex open
|
||||
@cindex close
|
||||
@verbatim
|
||||
"a" "r" ! open = f1;
|
||||
"b" "w" ! open = f2;
|
||||
"c" "a" ! open = f3;
|
||||
|
||||
# Read one character
|
||||
f1 ! read | stdout temp ! write;
|
||||
# Write a string
|
||||
f2 "Aaar" ! write;
|
||||
# Append a string
|
||||
f3 "Ouu" ! write;
|
||||
|
||||
f1!close;f2!close;f3!close;
|
||||
@end verbatim
|
||||
|
||||
To read an entire file, one must use a loop
|
||||
construct. @xref{Loops}. When there are no more characters left, the
|
||||
@code{read} function returns an empty string. Using equality testing,
|
||||
reading a complete file is thus possible. @xref{Conditionals}.
|
||||
|
||||
@verbatim
|
||||
filename "r" ! open = f;
|
||||
{f ! read = c; stdout c ! write; c "" ! equal ! not = return;} ! loop;
|
||||
@end verbatim
|
||||
|
||||
At this point, it may not be obvious why this works. This will be
|
||||
explained in the next sections.
|
||||
|
||||
|
||||
@node Functions, Conditionals, Files, Language
|
||||
@section Functions
|
||||
@cindex functions
|
||||
Functions are defined and called using the following syntax:
|
||||
|
||||
@verbatim
|
||||
# Defining them
|
||||
{stdout "Hello" ! write;} = func;
|
||||
{/x,y/stdout "x=" x ", y=" y!write;} = coorprint;
|
||||
{stdout args ! write;} = aprint;
|
||||
|
||||
# Calling them
|
||||
!func; # Outputs "Hello"
|
||||
52 12 ! coorprint; # Outputs "x=52, y=12"
|
||||
999 "abc" 21 ! aprint; # Outputs "999 abc 21"
|
||||
@end verbatim
|
||||
|
||||
Arguments can thus be accessed either by using the @code{/.../} syntax
|
||||
in the beginning of the function or by using the local @code{args}
|
||||
variable. Furthermore, to make @emph{all} new variables save in the
|
||||
global space, prepend the function content with a @code{*}. This will
|
||||
have the same effect as replacing all @code{=} signs in the function
|
||||
with the @code{*} operator.
|
||||
|
||||
Remember that your file is also a function, just without the curly
|
||||
brackets. This means that when working on the top level of your program,
|
||||
@code{args} actually refer to the arguments specified on the command
|
||||
line. All arguments are strings, but built-in functions that can convert
|
||||
them to numbers exist.
|
||||
|
||||
The previous example functions did not have any return values. This is
|
||||
merely because they didn't need such things. To define a return value,
|
||||
the return value must be sent to the special variable @code{return}.
|
||||
@verbatim
|
||||
{/a,b/a b ! multiply = return;} = 2mul;
|
||||
33 3 ! 2mul = 2mult;
|
||||
stdout 2mult ! write;
|
||||
@end verbatim
|
||||
The execution of a function does @strong{@emph{not}} stop when a value
|
||||
is assigned to @code{return}. This has both advantages and
|
||||
disadvantages.
|
||||
|
||||
Many things are almost impossible to do without the built-in
|
||||
functions. Some are completely impossible. @xref{Built-In}. As all
|
||||
objects in Enigma are pointers, several built-in functions actually
|
||||
modify the objects sent to them as arguments. To solve this problem, one
|
||||
must use the @code{clone} function.
|
||||
|
||||
|
||||
@node Conditionals, Loops, Functions, Language
|
||||
@section Conditionals
|
||||
Any value can be related to another value. 78 is less than 85. 2 equals
|
||||
2. "Hi" is not "Bye". Enigma comes with a basic set of functions that
|
||||
can be used to test these relations. The functions @code{greater},
|
||||
@code{lesser}, @code{equal}, @code{not}, @code{or} and @code{and} are
|
||||
available. These functions return either true or false. To run a
|
||||
function on the condition that a relational function has returned true,
|
||||
use the function @code{act}.
|
||||
|
||||
While @code{lesser} and @code{greater} are aimed at numbers only,
|
||||
and @code{and}, @code{or} and @code{not} are aimed at booleans only,
|
||||
@code{equal} can be used on all objects. It tests for all equalities.
|
||||
|
||||
@verbatim
|
||||
2 = a;
|
||||
4 = b;
|
||||
|
||||
a 2 ! add | temp b ! equal = cond1;
|
||||
"47" ! num | temp 48 ! greater = cond2;
|
||||
|
||||
cond1 cond2 ! and | temp write stdout "4 = 4 and 47 > 48\n" ! act;
|
||||
cond1 cond2 ! or | temp write stdout "4 = 4 or 47 > 48\n" ! act;
|
||||
cond2 ! not | cond1 temp ! and | temp write stdout "4 = 4 and !(47 >
|
||||
48)\n" ! act;
|
||||
@end verbatim
|
||||
|
||||
Even simpler, one can do this (though there's no real need for it):
|
||||
@verbatim
|
||||
# Instead of stdout "Hello" !write;
|
||||
true write stdout "Hello" !act;
|
||||
@end verbatim
|
||||
|
||||
|
||||
@node Loops, Undefined, Conditionals, Language
|
||||
@section Loops
|
||||
There are several ways to loop pieces of code in Enigma. One can create
|
||||
a function that calls itself, for example. It is, however, advised to
|
||||
use the @code{loop} function.
|
||||
@verbatim
|
||||
# Infinite loop
|
||||
{stdout "Forever\n" ! write; true = return;} ! loop;
|
||||
@end verbatim
|
||||
@code{loop} works a bit like @code{act}, except that it runs on the
|
||||
premise of the return value of the function it calls. If it returns
|
||||
true, or any other value that can be considered true (non-zero numbers,
|
||||
non-empty strings, files, etc.), it runs the function again. If it
|
||||
returns false, the loop stops. It naturally runs the first time no
|
||||
matter what (no return value has been created yet).
|
||||
|
||||
|
||||
@node Undefined, , Loops, Language
|
||||
@section Undefined behaviour
|
||||
Enigma is still new. The way built-in functions act, the way error
|
||||
messages appear, and the way some odd details of the language works are
|
||||
still undefined. In general, when something seems likely to work, it
|
||||
will work. But it's not necessarily defined to work.
|
||||
|
||||
|
||||
@node Future, Implementations, Language, Top
|
||||
@chapter Future aspects
|
||||
As Enigma is right now, it is quite limited. The only way that it can
|
||||
interact with the rest of one's system is by reading and writing files
|
||||
and by executing shell commands using the @code{system} built-in
|
||||
function. This obviously needs to be improved. A foreign function
|
||||
interface system must be implemented in version 0.2. It should be
|
||||
possible for Enigma to do everything C can.
|
||||
|
||||
The number of built-in functions seems reasonable, but it may be a good
|
||||
idea to implement a few more. These eventual functions should be focused
|
||||
on making things easier. Specifically, an import function should be
|
||||
considered. It is possible to create an import function in Enigma
|
||||
directly, but it's not exactly fast. Introducing a ``compile'' function
|
||||
should solve that.
|
||||
|
||||
|
||||
@node Implementations, Comparison, Future, Top
|
||||
@chapter Implementations
|
||||
@pindex enigma
|
||||
As of right now (beginning of June 2010) there is only one
|
||||
implementation. It is written in Java and is called enigma (with a
|
||||
lowercase e). The code is bulky and was not written by an experienced
|
||||
Java hacker. For v0.2 it may be a good idea to write the interpreter in
|
||||
C instead. Implementing a foreign function interface should be easier
|
||||
that way.
|
||||
|
||||
The current implementation can be downloaded at
|
||||
@url{http://metanohi.org/@/projects/@/enigma}.
|
||||
|
||||
|
||||
@node Comparison, Built-In, Implementations, Top
|
||||
@chapter Comparison with other languages
|
||||
@macro exmpl {lang,content}
|
||||
@quotation \lang\
|
||||
@cartouche
|
||||
@example
|
||||
\content\
|
||||
@end example
|
||||
@end cartouche
|
||||
@end quotation
|
||||
@end macro
|
||||
|
||||
|
||||
@menu
|
||||
* Compared assigning::
|
||||
* Compared conditionals::
|
||||
* Compared looping::
|
||||
* Compared functions::
|
||||
@end menu
|
||||
|
||||
|
||||
@node Compared assigning, Compared conditionals, Comparison, Comparison
|
||||
@section Assigning values
|
||||
@exmpl{C,type var = value;}
|
||||
@exmpl{Python,var = value}
|
||||
@exmpl{Enigma,value = var;}
|
||||
|
||||
|
||||
@node Compared conditionals, Compared looping, Compared assigning, Comparison
|
||||
@section Conditionals
|
||||
@exmpl{C,if ((a == 2 && b < 5) || (c != 4 && !d)) do_something();}
|
||||
@exmpl{Python,if (a == 2 and b < 5) or (c != 4 and not d):
|
||||
do_something()}
|
||||
@quotation Enigma
|
||||
@cartouche
|
||||
@example
|
||||
a 2 ! equal = cond-a;
|
||||
b 5 ! lesser = cond-b;
|
||||
c 4 ! equal ! not = cond-c;
|
||||
d ! not = cond-d;
|
||||
cond-a cond-b ! and = ncond-ab;
|
||||
cond-c cond-d ! and = ncond-cd;
|
||||
ncond-ab ncond-cd ! or = actcond;
|
||||
actcond do-something ! act;
|
||||
@end example
|
||||
@end cartouche
|
||||
@end quotation
|
||||
|
||||
|
||||
@node Compared looping, Compared functions, Compared conditionals, Comparison
|
||||
@section Looping
|
||||
@quotation C
|
||||
@cartouche
|
||||
@example
|
||||
while (thinking) run();
|
||||
|
||||
for (int i = 0; i < 18; i++) run(i);
|
||||
@end example
|
||||
@end cartouche
|
||||
@end quotation
|
||||
@quotation Python
|
||||
@cartouche
|
||||
@example
|
||||
while thinking: run()
|
||||
|
||||
for i in range(18): run(i)
|
||||
@end example
|
||||
@end cartouche
|
||||
@end quotation
|
||||
@quotation Enigma
|
||||
@cartouche
|
||||
@verbatim
|
||||
{!run; thinking ! clone = return;} ! loop;
|
||||
|
||||
0 = i;
|
||||
{i ! run; i 1 ! add; i 18 ! equal = return;} ! loop;
|
||||
@end verbatim
|
||||
@end cartouche
|
||||
@end quotation
|
||||
|
||||
|
||||
@node Compared functions, , Compared looping, Comparison
|
||||
@section Functions
|
||||
@quotation C
|
||||
@cartouche
|
||||
@verbatim
|
||||
int time(float space) {
|
||||
return (int) space / 3;
|
||||
}
|
||||
|
||||
t = time(81.65);
|
||||
@end verbatim
|
||||
@end cartouche
|
||||
@end quotation
|
||||
@quotation Python
|
||||
@cartouche
|
||||
@example
|
||||
def time(space):
|
||||
return int(space / 3)
|
||||
|
||||
t = time(81.65)
|
||||
@end example
|
||||
@end cartouche
|
||||
@end quotation
|
||||
@quotation Enigma
|
||||
@cartouche
|
||||
@verbatim
|
||||
{/space/space 3 ! divide ! clone ! round = return;} = time;
|
||||
|
||||
81.65 ! time = t;
|
||||
@end verbatim
|
||||
@end cartouche
|
||||
@end quotation
|
||||
|
||||
|
||||
@node Built-In, Copying This Manual, Comparison, Top
|
||||
@chapter Built-in values and functions
|
||||
|
||||
|
||||
@menu
|
||||
* Built-In values::
|
||||
* Built-In functions::
|
||||
@end menu
|
||||
|
||||
|
||||
@node Built-In values, Built-In functions, Built-In, Built-In
|
||||
@section Values
|
||||
@cindex built-in values
|
||||
The following variables are special and can be accessed anytime. They can
|
||||
even be overwritten.
|
||||
@verbatim
|
||||
args, return, temp, stdin, stderr, stdout, zero, true, false, none, @pi,
|
||||
@e, cwd, cpd, fnm
|
||||
@end verbatim
|
||||
@code{zero} is a fake writable file that does nothing. @code{none} is an
|
||||
abstract variable with an internal value of.. none. @code{@@pi} is
|
||||
Pi. @code{@@e} is Euler's number. @code{cwd} is the directory from which
|
||||
Enigma is run, @code{cpd} is the directory in which the current program
|
||||
file resides, and @code{fnm} is the filename of the current program
|
||||
file. The rest are self-explanatory --- and @code{args}, @code{return}
|
||||
and @code{temp} are extra special.
|
||||
|
||||
|
||||
@node Built-In functions, , Built-In values, Built-In
|
||||
@section Functions
|
||||
@cindex built-in functions
|
||||
@macro func {param}
|
||||
@noindent @code{\param\}
|
||||
@end macro
|
||||
Enigma has few built-in functions. But they do exist.
|
||||
|
||||
@func{str(OBJECT...)}: Converts all supplied values to strings.
|
||||
|
||||
@func{num(OBJECT...)}: Converts all supplied values to numbers.
|
||||
|
||||
@func{list(OBJECT...)}: Puts all supplied values in a list and destroys
|
||||
nested lists at one level.
|
||||
|
||||
@func{bool(OBJECT...)}: Converts all supplied values to booleans.
|
||||
|
||||
@func{code(OBJECT...)}: Converts all supplied values to code strings.
|
||||
|
||||
@func{repr(OBJECT...)}: Converts all supplied values to representational
|
||||
strings. Strings get prepended and appended by " characters, code
|
||||
objects are surrounded by @{ and @}, and so on.
|
||||
|
||||
@func{type(OBJECT...)}: Converts all supplied values to type strings
|
||||
(string, number, file, etc.).
|
||||
|
||||
@func{len(OBJECT...)}: Converts all supplied values to their length. This
|
||||
can be used for both strings and lists.
|
||||
|
||||
@func{clone(OBJECT...)}: Clones all supplied values. When an object is
|
||||
cloned, its value is assigned to a new variable. The list of clones is
|
||||
returned.
|
||||
|
||||
@func{slice(LIST|STRING, NUMBER, NUMBER)}: Returns a list value sliced
|
||||
according to the first and second number if the first variable is a
|
||||
list variable, or a substring if the first variable is a string
|
||||
variable.
|
||||
|
||||
@func{loop(FUNCTION, [OBJECT]...)}: Executes function until it returns
|
||||
false. Sends the rest of the specified variables (if any) to the
|
||||
function as arguments.
|
||||
|
||||
@func{open(STRING, STRING)}: Opens the file by the name of the first
|
||||
string, using the second string as its guide as to how it should be
|
||||
opened. "r" means to read, "w" means to write, and "a" means to
|
||||
append. Returns a file object.
|
||||
|
||||
@func{close(FILE...)}: Closes files.
|
||||
|
||||
@func{read(FILE)}: Reads one character of a file and returns it. If no
|
||||
more characters are present, an empty string is returned.
|
||||
|
||||
@func{write(FILE, STRING)}: Writes a string to a file.
|
||||
|
||||
@func{greater(NUMBER, NUMBER...}: Checks if the first number is
|
||||
greater than the rest and returns true or false.
|
||||
|
||||
@func{lesser(NUMBER, NUMBER...}: Checks if the first number is
|
||||
lesser than the rest and returns true or false.
|
||||
|
||||
@func{equal(OBJECT, OBJECT...}: Checks if the objects are equal and returns
|
||||
true or false.
|
||||
|
||||
@func{and(BOOLEAN...)}: Checks if all booleans are true and returns true
|
||||
or false.
|
||||
|
||||
@func{or(BOOLEAN...)}: Checks if at least one boolean is true and returns
|
||||
true or false.
|
||||
|
||||
@func{not(BOOLEAN...)}: Converts values of true to values of false, and
|
||||
vice-versa.
|
||||
|
||||
@func{act(BOOLEAN, FUNCTION, [OBJECT]...)}: Run the function with the
|
||||
optional objects as arguments if the boolean is true.
|
||||
|
||||
@func{system(STRING...)}: Join the strings and run the result as a
|
||||
system command.
|
||||
|
||||
@func{add(NUMBER|STRING|CODE|LIST...)}: Add objects together. Numbers, strings, code
|
||||
strings and lists can be used, but only with similar types. The type
|
||||
of the first object determines what types the rest must be. The result
|
||||
is stored in the first object and also returned.
|
||||
|
||||
@func{subtract(NUMBER...)}: Subtract numbers from each other. The
|
||||
first object receives the final number. It is also returned.
|
||||
|
||||
@func{multiply(NUMBER...)}: Multiply numbers with each other. The
|
||||
first object receives the final number. It is also returned.
|
||||
|
||||
@func{divide(NUMBER...)}: Divide numbers with each other. The
|
||||
first object receives the final number. It is also returned.
|
||||
|
||||
@func{mod(NUMBER, NUMBER)}: Finds the remainder of the first number
|
||||
divided with the second number and returns it as a new variable.
|
||||
|
||||
@func{pow(NUMBER, NUMBER)}: Returns first number^second number.
|
||||
|
||||
@func{log(NUMBER, [NUMBER])}: Returns the logarithm of the first
|
||||
number. If the second number is not specified, the natural logarith is
|
||||
used.
|
||||
|
||||
@func{random()}: Returns a random number between 0 and 1.
|
||||
|
||||
@func{abs(NUMBER...)}: Sets and returns absolute values of numbers.
|
||||
|
||||
@func{round(NUMBER, NUMBER)}: Rounds the first number with x decimals,
|
||||
where x is the second number.
|
||||
|
||||
@func{floor(NUMBER, NUMBER)}: Floors the first number with x decimals,
|
||||
where x is the second number.
|
||||
|
||||
@func{ceil(NUMBER, NUMBER)}: "Ceils" the first number with x decimals,
|
||||
where x is the second number.
|
||||
|
||||
@func{sin(NUMBER...)}: Sets and returns sine values.
|
||||
|
||||
@func{cos(NUMBER...)}: Sets and returns cosine values.
|
||||
|
||||
@func{tan(NUMBER...)}: Sets and returns tangent values.
|
||||
|
||||
@func{asin(NUMBER...)}: Sets and returns arcsine values.
|
||||
|
||||
@func{acos(NUMBER...)}: Sets and returns arccosine values.
|
||||
|
||||
@func{atan(NUMBER...)}: Sets and returns arctangent values.
|
||||
|
||||
@func{sinh(NUMBER...)}: Sets and returns hyperbolic sine values.
|
||||
|
||||
@func{cosh(NUMBER...)}: Sets and returns hyperbolic cosine values.
|
||||
|
||||
@func{tanh(NUMBER...)}: Sets and returns hyperbolic tangent values.
|
||||
|
||||
|
||||
@node Copying This Manual, Index, Built-In, Top
|
||||
@appendix GNU Free Documentation License
|
||||
@include fdl.texi
|
||||
@node Index, , Copying This Manual, Top
|
||||
@unnumbered Index
|
||||
@printindex cp
|
||||
@bye
|
||||
1002
site/projects/enigma/doc/enigma-0.1.xml
Normal file
1002
site/projects/enigma/doc/enigma-0.1.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
site/projects/enigma/doc/enigma-rapport-da.pdf
Normal file
BIN
site/projects/enigma/doc/enigma-rapport-da.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user