/usr/share/gtk-doc/html/seed/seed-Initialization.html is in seed-doc 3.2.0-1ubuntu1.
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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Initialization</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Seed Reference Manual">
<link rel="up" href="api.html" title="Part III. Seed API Reference">
<link rel="prev" href="api.html" title="Part III. Seed API Reference">
<link rel="next" href="seed-Contexts.html" title="Working with Contexts">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="api.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="api.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Seed Reference Manual</th>
<td><a accesskey="n" href="seed-Contexts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#seed-Initialization.synopsis" class="shortcut">Top</a>
|
<a href="#seed-Initialization.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="seed-Initialization"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="seed-Initialization.top_of_page"></a>Initialization</span></h2>
<p>Initialization — Overall setup of the Seed engine</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="seed-Initialization.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include <seed/seed.h>
struct <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine">SeedEngine</a>;
<a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="returnvalue">SeedEngine</span></a> * <a class="link" href="seed-Initialization.html#seed-init" title="seed_init ()">seed_init</a> (<em class="parameter"><code><span class="type">gint</span> *argc</code></em>,
<em class="parameter"><code><span class="type">gchar</span> ***argv</code></em>);
<a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="returnvalue">SeedEngine</span></a> * <a class="link" href="seed-Initialization.html#seed-init-with-context-group" title="seed_init_with_context_group ()">seed_init_with_context_group</a> (<em class="parameter"><code><span class="type">gint</span> *argc</code></em>,
<em class="parameter"><code><span class="type">gchar</span> ***argv</code></em>,
<em class="parameter"><code><a class="link" href="seed-Contexts.html#SeedContextGroup" title="SeedContextGroup"><span class="type">SeedContextGroup</span></a> group</code></em>);
<span class="returnvalue">void</span> <a class="link" href="seed-Initialization.html#seed-engine-set-search-path" title="seed_engine_set_search_path ()">seed_engine_set_search_path</a> (<em class="parameter"><code><a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a> *eng</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *path</code></em>);
<span class="returnvalue">gchar</span> ** <a class="link" href="seed-Initialization.html#seed-engine-get-search-path" title="seed_engine_get_search_path ()">seed_engine_get_search_path</a> (<em class="parameter"><code><a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a> *eng</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="seed-Initialization.description"></a><h2>Description</h2>
<p>
Before any other Seed functions can be used, you must initialize the engine, which creates an initial JavaScript context and sets up JavaScriptCore and GLib. To do this in most cases, you will use <a class="link" href="seed-Initialization.html#seed-init" title="seed_init ()"><code class="function">seed_init()</code></a>, which will provide you with a <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a>. Only one <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a> is permitted per application; use a <a class="link" href="seed-Contexts.html#SeedContext" title="SeedContext"><span class="type">SeedContext</span></a> to sandbox code execution.
</p>
<div class="example">
<a name="idp4766528"></a><p class="title"><b>Example 5. Very simple <code class="function">main</code> function for a Seed program</b></p>
<div class="example-contents"><pre class="programlisting">
int main (int argc, char **argv)
{
SeedEngine * eng;
SeedScript * script;
/* Initialize the Seed engine */
eng = seed_init(&argc, &argv);
/* Create a simple <a class="link" href="seed-Evaluation.html#SeedScript" title="SeedScript">SeedScript</a> */
script = seed_make_script(eng->context, "print('Hello, world!')", NULL, 0);
/* Evaluate the <a class="link" href="seed-Evaluation.html#SeedScript" title="SeedScript">SeedScript</a> in the default context */
seed_evaluate(eng->context, script, 0);
g_free(script);
return 0;
}
</pre></div>
</div>
<br class="example-break">
</div>
<div class="refsect1">
<a name="seed-Initialization.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="SeedEngine"></a><h3>struct SeedEngine</h3>
<pre class="programlisting">struct SeedEngine {
JSGlobalContextRef context;
JSObjectRef global;
gchar **search_path;
JSContextGroupRef group;
};
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="seed-init"></a><h3>seed_init ()</h3>
<pre class="programlisting"><a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="returnvalue">SeedEngine</span></a> * seed_init (<em class="parameter"><code><span class="type">gint</span> *argc</code></em>,
<em class="parameter"><code><span class="type">gchar</span> ***argv</code></em>);</pre>
<p>
Initializes a new <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a>. This involves initializing GLib, creating
an initial context with all of the default globals, and initializing
various internal parts of Seed.
</p>
<p>
This function should only be called once within a single Seed application.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>argc</code></em> :</span></p></td>
<td>A reference to the number of arguments remaining to parse.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>argv</code></em> :</span></p></td>
<td>A reference to an array of string arguments remaining to parse.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The newly created and initialized <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="seed-init-with-context-group"></a><h3>seed_init_with_context_group ()</h3>
<pre class="programlisting"><a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="returnvalue">SeedEngine</span></a> * seed_init_with_context_group (<em class="parameter"><code><span class="type">gint</span> *argc</code></em>,
<em class="parameter"><code><span class="type">gchar</span> ***argv</code></em>,
<em class="parameter"><code><a class="link" href="seed-Contexts.html#SeedContextGroup" title="SeedContextGroup"><span class="type">SeedContextGroup</span></a> group</code></em>);</pre>
<p>
Initializes a new <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a>. This involves initializing GLib, creating
an initial context (in <span class="type">group</span>) with all of the default globals, and
initializing various internal parts of Seed.
</p>
<p>
This function should only be called once within a single Seed application.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>argc</code></em> :</span></p></td>
<td>A reference to the number of arguments remaining to parse.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>argv</code></em> :</span></p></td>
<td>A reference to an array of string arguments remaining to parse.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
<td>A <a class="link" href="seed-Contexts.html#SeedContextGroup" title="SeedContextGroup"><span class="type">SeedContextGroup</span></a> within which to create the initial context.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The newly created and initialized <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="seed-engine-set-search-path"></a><h3>seed_engine_set_search_path ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> seed_engine_set_search_path (<em class="parameter"><code><a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a> *eng</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *path</code></em>);</pre>
<p>
Sets the search path for the imports system.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>eng</code></em> :</span></p></td>
<td>A <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a>, on which to set the path.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
<td>A <span class="type">const</span> gchar*, a colon separated string containing the path to set</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="seed-engine-get-search-path"></a><h3>seed_engine_get_search_path ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> ** seed_engine_get_search_path (<em class="parameter"><code><a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a> *eng</code></em>);</pre>
<p>
Retrieves the search path for the imports system. The returned value is
owned by the <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a>, and shouldn't be freed by the application writer.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>eng</code></em> :</span></p></td>
<td>A <a class="link" href="seed-Initialization.html#SeedEngine" title="struct SeedEngine"><span class="type">SeedEngine</span></a>, to get the currently set search path.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A null-terminated array of strings containing the paths.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.18</div>
</body>
</html>
|