/usr/share/doc/libembryo-doc/html/Small_Page.html is in libembryo-doc 1.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | <html>
<head>
<title>Embryo: Brief Introduction to Small</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta name="author" content="Andres Blanc" >
<link rel="icon" href="img/favicon.png" type="image/x-icon">
<link rel="shortcut icon" href="img/favicon.png" type="image/x-icon">
<link rel="icon" href="img/favicon.png" type="image/ico">
<link rel="shortcut icon" href="img/favicon.png" type="image/ico">
<link rel="stylesheet" type="text/css" media="screen" href="e.css">
<link rel="stylesheet" type="text/css" media="screen" href="edoxy.css">
</head>
<body>
<div id="container">
<div id="header">
<div class="layout">
<h1><span>Enlightenment</span></h1>
<h2><span>Beauty at your fingertips</span></h2>
<div class="menu-container">
<div class="menu">
<ul>
<li class="current"><a href="http://web.enlightenment.org/p.php?p=docs">Docs</a></li>
<li><a href="http://trac.enlightenment.org/e">Tracker</a></li>
<li><a href="http://www.enlightenment.org/p.php?p=contact">Contact</a></li>
<li><a href="http://www.enlightenment.org/p.php?p=contribute">Contribute</a></li>
<li><a href="http://www.enlightenment.org/p.php?p=support">Support</a></li>
<li><a href="http://www.enlightenment.org/p.php?p=download">Download</a></li>
<li><a href="http://www.enlightenment.org/p.php?p=about">About</a></li>
<li><a href="http://www.enlightenment.org/p.php?p=news">News</a></li>
<li><a href="http://www.enlightenment.org/">Home</a></li>
</ul>
</div>
</div>
<div class="doxytitle">
Embryo Documentation <small>at Sun May 1 2011</small>
</div>
<div class="menu-container">
<div class="submenu">
<ul class="current">
<li><a href="todo.html">Todo</a></li>
<li><a href="files.html">Files</a></li>
<li><a href="annotated.html">Data Structures</a></li>
<li><a href="globals.html">Globals</a></li>
<li><a href="modules.html">Modules</a></li>
<li><a href="pages.html">Related Pages</a></li>
<li class="current"><a href="index.html">Main Page</a></li>
</ul>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div id="content">
<div class="layout">
<!-- Generated by Doxygen 1.7.3 -->
</div>
<div class="header">
<div class="headertitle">
<h1>Brief Introduction to Small </h1> </div>
</div>
<div class="contents">
<div class="textblock"><p>This section describes the basics of Small, as compiled and interpreted with Embryo.</p>
<p>This summary assumes that you are familar with C. For a full list of differences between C and Small, again, see the full documentation.</p>
<h2><a class="anchor" id="Small_Variables_Section"></a>
Variables</h2>
<h3><a class="anchor" id="Small_Type_Subsection"></a>
Types</h3>
<p>There is only one type, known as the "cell", which can hold an integer.</p>
<h3><a class="anchor" id="Small_Scope_Subsection"></a>
Scope</h3>
<p>The scope and usage of a variable depends on its declaration.</p>
<ul>
<li>A local variable is normally declared with the <code>new</code> keyword. E.g. <div class="fragment"><pre class="fragment"> <span class="keyword">new</span> variable
</pre></div> </li>
<li>A static function variable is defined within a function with the <code>static</code> keyword. </li>
<li>A global static variable is one that is only available within the file it was declared in. Again, use the <code>static</code> keyword, but outside of any function. </li>
<li>A stock variable is one that may not be compiled into a program if it is not used. It is declared using <code>stock</code>. </li>
<li>A public variable is one that can be read by the host program using <a class="el" href="group__Embryo__Public__Variable__Group.html#ga9714d1cbd46b3b0315a71c23413ad921">embryo_program_variable_find</a>. It is declared using <code>public</code> keyword.</li>
</ul>
<p>Remember that the keywords above are to be used on their own. That is, for example: </p>
<div class="fragment"><pre class="fragment"> <span class="keyword">public</span> testvar
</pre></div><p> not: </p>
<div class="fragment"><pre class="fragment"> <span class="keyword">new</span> <span class="keyword">public</span> testvar
</pre></div><h3><a class="anchor" id="Small_Constants_Subsection"></a>
Constants</h3>
<p>You can declare constants in two ways: </p>
<ul>
<li>Using the preprocessor macro <code>#define</code>. </li>
<li>By inserting <code>const</code> between the keyword and variable name of a variable declaration. For example, to declare the variable <code>var1</code> constant, you type <div class="fragment"><pre class="fragment"> <span class="keyword">new</span> <span class="keyword">const</span> var1 = 2
</pre></div> Now <code>var1</code> cannot be changed.</li>
</ul>
<h3><a class="anchor" id="Small_Arrays_Subsection"></a>
Arrays</h3>
<p>To declare an array, append square brackets to the end of the variable name. The following examples show how to declare arrays. Note the use of the ellipsis operator, which bases the array based on the last two declared values:</p>
<div class="fragment"><pre class="fragment"><span class="keyword">new</span> msg[] = <span class="stringliteral">"A message."</span>
<span class="keyword">new</span> ints[] = {1, 3, 4}
<span class="keyword">new</span> ints2[20] = {1, 3} <span class="comment">// All other elements 0.</span>
<span class="keyword">new</span> ints3[10] = {1, ... } <span class="comment">// All elements = 1</span>
<span class="keyword">new</span> ints4[10] = {10, 20, ... } <span class="comment">// Elements = 10 -> 100.</span>
<span class="comment">// The difference can be negative.</span>
<span class="keyword">new</span> ints5[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
</pre></div><dl class="note"><dt><b>Note:</b></dt><dd>Array initialisers need to be constant.</dd></dl>
<h2><a class="anchor" id="Small_Func_Calls_Section"></a>
Function Calls</h2>
<p>A typical function declaration is as follows:</p>
<div class="fragment"><pre class="fragment">testfunc(param) {
<span class="comment">// Do something ...</span>
<span class="comment">// over a couple of lines.</span>
}
</pre></div><p>You can pass by reference. That is, the parameter you pass is changed outside of the function. For example:</p>
<div class="fragment"><pre class="fragment">testfunc(&param) {
param = 10
<span class="comment">// The passed variable will be set to 10 outside of the function.</span>
}
</pre></div><p>To pass an array:</p>
<div class="fragment"><pre class="fragment">testfunc(param[]) {
<span class="comment">// Do something to the array</span>
}
</pre></div><dl class="note"><dt><b>Note:</b></dt><dd>Arrays are passed by reference.</dd></dl>
<h2><a class="anchor" id="Small_Control_Subsection"></a>
Control Structures.</h2>
<p>Small has the following control structures, which similar to their C counterparts: </p>
<ul>
<li><div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span> (expression) statement1 <span class="keywordflow">else</span> statement2
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"> <span class="keywordflow">switch</span> (expression) {
<span class="keywordflow">case</span> 0:
statement1 <span class="comment">// Can only be one statement. Look Ma, no breaks!</span>
<span class="keywordflow">case</span> 1..3: <span class="comment">// For values between 1 and 3 inclusive.</span>
statement2
<span class="keywordflow">default</span>: <span class="comment">// Optional</span>
statement3
}
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"> <span class="keywordflow">while</span>(expression) statement
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"> <span class="keywordflow">do</span> statement <span class="keywordflow">while</span> (expression)
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"> <span class="keywordflow">for</span> (init_expression; before_iter_test_expression; after_iter_expression) statement
</pre></div></li>
</ul>
<h2><a class="anchor" id="Small_Preprocessor_Section"></a>
Preprocessor</h2>
<p>The following preprocessor directives are available: </p>
<ul>
<li><div class="fragment"><pre class="fragment"><span class="preprocessor"> #assert constant_expression </span>
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"><span class="preprocessor"> #define pattern replacement </span>
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"><span class="preprocessor"> #define pattern(%1,%2,...) replacement </span>
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"><span class="preprocessor"> #include filename </span>
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"><span class="preprocessor"> #if constant_expression</span>
<span class="preprocessor"></span> <span class="comment">// Various bits of code</span>
<span class="preprocessor">#else</span>
<span class="preprocessor"></span> <span class="comment">// Other bits of code</span>
<span class="preprocessor">#endif </span>
</pre></div> </li>
<li><div class="fragment"><pre class="fragment"><span class="preprocessor"> #undef pattern </span>
</pre></div> </li>
</ul>
</div></div>
<div id="push"></div>
</div> <!-- #content -->
</div> <!-- .layout -->
</div> <!-- #container -->
<div id="footer">
<table><tr>
<td class="poweredby"><img src="doxygen.png"></td>
<td class="copyright">Copyright ©2011 Enlightenment</td>
<td class="generated">Docs generated Sun May 1 2011 06:19:33</td>
</tr></table>
</div>
</body>
</html>
|