[seed] [docs] Add simple "Hello world" to docs
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [docs] Add simple "Hello world" to docs
- Date: Wed, 8 Jul 2009 05:10:37 +0000 (UTC)
commit 37591fb2e2c449a91b76306eb8ae2cfcae761ebe
Author: Tim Horton <hortont424 gmail com>
Date: Wed Jul 8 00:23:46 2009 -0400
[docs] Add simple "Hello world" to docs
doc/reference/tmpl/seed-main.sgml | 25 ++++++++-
doc/reference/tmpl/seed-unused.sgml | 110 -----------------------------------
2 files changed, 24 insertions(+), 111 deletions(-)
---
diff --git a/doc/reference/tmpl/seed-main.sgml b/doc/reference/tmpl/seed-main.sgml
index 7995c0b..f8e76e2 100644
--- a/doc/reference/tmpl/seed-main.sgml
+++ b/doc/reference/tmpl/seed-main.sgml
@@ -6,9 +6,32 @@ Overall setup of the Seed engine
<!-- ##### SECTION Long_Description ##### -->
<para>
-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 seed_init(), which will provide you with a #SeedEngine. Only one SeedEngine is permitted per application; use a #SeedContext to sandbox code execution.
+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 seed_init(), which will provide you with a #SeedEngine. Only one #SeedEngine is permitted per application; use a #SeedContext to sandbox code execution.
</para>
+<example>
+<title>Very simple <function>main</function> function for a Seed program</title>
+<programlisting>
+int main (int argc, char **argv)
+{
+ SeedEngine * eng;
+ SeedScript * script;
+
+ /* Initialize the Seed engine */
+ eng = seed_init(&argc, &argv);
+
+ /* Create a simple #SeedScript */
+ script = seed_make_script(eng->context, "print('Hello, world!')", NULL, 0);
+
+ /* Evaluate the #SeedScript in the default context */
+ seed_evaluate(eng->context, script, 0);
+
+ g_free(script);
+ return 0;
+}
+</programlisting>
+</example>
+
<!-- ##### SECTION See_Also ##### -->
<para>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]