add xsltproc as optional dependency add initial structure for the Vala
authorJuerg Billeter <j@bitron.ch>
Sat, 1 Sep 2007 11:44:15 +0000 (11:44 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 1 Sep 2007 11:44:15 +0000 (11:44 +0000)
2007-09-01  Juerg Billeter  <j@bitron.ch>

* configure.ac: add xsltproc as optional dependency
* doc/vala/: add initial structure for the Vala Reference Manual, will
  be built and installed if xsltproc is available
* tests/hello.exp, tests/hello.vala: add hello world test case
* doc/Makefile.am, tests/Makefile.am: updated

svn path=/trunk/; revision=561

21 files changed:
ChangeLog
configure.ac
doc/Makefile.am
doc/vala/Makefile.am [new file with mode: 0644]
doc/vala/classes.xml [new file with mode: 0644]
doc/vala/default.css [new file with mode: 0644]
doc/vala/delegates.xml [new file with mode: 0644]
doc/vala/devhelp.xsl [new file with mode: 0644]
doc/vala/enums.xml [new file with mode: 0644]
doc/vala/expressions.xml [new file with mode: 0644]
doc/vala/index.xml [new file with mode: 0644]
doc/vala/interfaces.xml [new file with mode: 0644]
doc/vala/namespaces.xml [new file with mode: 0644]
doc/vala/overview.xml [new file with mode: 0644]
doc/vala/statements.xml [new file with mode: 0644]
doc/vala/structs.xml [new file with mode: 0644]
doc/vala/types.xml [new file with mode: 0644]
doc/vala/xhtml.xsl [new file with mode: 0644]
tests/Makefile.am
tests/hello.exp [new file with mode: 0644]
tests/hello.vala [new file with mode: 0644]

index a2cf888..32d3f16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2007-09-01  Jürg Billeter  <j@bitron.ch>
 
+       * configure.ac: add xsltproc as optional dependency
+       * doc/vala/: add initial structure for the Vala Reference Manual, will
+         be built and installed if xsltproc is available
+       * tests/hello.exp, tests/hello.vala: add hello world test case
+       * doc/Makefile.am, tests/Makefile.am: updated
+
+2007-09-01  Jürg Billeter  <j@bitron.ch>
+
        * vala/valasemanticanalyzer.vala: check arguments of methods with
          ellipsis parameters
 
index dd8604f..f68cffa 100644 (file)
@@ -37,6 +37,9 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
+AC_PATH_PROG([XSLTPROC], [xsltproc], :)
+AM_CONDITIONAL(HAVE_XSLTPROC, test "$XSLTPROC" != :)
+
 PKG_CHECK_MODULES(ENCHANT, enchant >= $ENCHANT_REQUIRED, have_enchant=yes, have_enchant=no)
 AM_CONDITIONAL(HAVE_ENCHANT, test x$have_enchant = xyes)
 
@@ -53,6 +56,7 @@ AC_CONFIG_FILES([Makefile
            vapi/Makefile
            tests/Makefile
            doc/Makefile
+           doc/vala/Makefile
            gobject-introspection/Makefile
            vapigen/Makefile
            vapigen/gidlgen/Makefile
index 84f0410..16a19c3 100644 (file)
@@ -1,5 +1,9 @@
 NULL =
 
+SUBDIRS = \
+       vala \
+       $(NULL)
+
 if ENABLE_VAPIGEN
 VAPIGEN_MANS = \
        gidlgen.1 \
diff --git a/doc/vala/Makefile.am b/doc/vala/Makefile.am
new file mode 100644 (file)
index 0000000..6688268
--- /dev/null
@@ -0,0 +1,59 @@
+bookdir=$(datadir)/devhelp/books/vala
+
+chapter_data = \
+       overview.html \
+       types.html \
+       expressions.html \
+       statements.html \
+       namespaces.html \
+       classes.html \
+       structs.html \
+       interfaces.html \
+       enums.html \
+       delegates.html \
+       $(NULL)
+
+built_data = \
+       index.html \
+       $(chapter_data) \
+       vala.devhelp2 \
+       $(NULL)
+
+if HAVE_XSLTPROC
+book_DATA = \
+       $(built_data) \
+       default.css \
+       $(NULL)
+endif
+
+index.html: $(book_sources) xhtml.xsl
+       $(XSLTPROC) --xinclude $(srcdir)/xhtml.xsl $(srcdir)/index.xml > index.html
+
+$(chapter_data): index.html
+
+vala.devhelp2: $(book_sources) devhelp.xsl
+       $(XSLTPROC) --xinclude $(srcdir)/devhelp.xsl $(srcdir)/index.xml > vala.devhelp2
+
+book_sources = \
+       index.xml \
+       overview.xml \
+       types.xml \
+       expressions.xml \
+       statements.xml \
+       namespaces.xml \
+       classes.xml \
+       structs.xml \
+       interfaces.xml \
+       enums.xml \
+       delegates.xml \
+       $(NULL)
+
+MOSTLYCLEANFILES = $(built_data)
+
+EXTRA_DIST = \
+       $(book_sources) \
+       default.css \
+       xhtml.xsl \
+       devhelp.xsl \
+       $(NULL)
+
diff --git a/doc/vala/classes.xml b/doc/vala/classes.xml
new file mode 100644 (file)
index 0000000..1d23b44
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="classes">
+       <h>Classes</h>
+</section>
+
diff --git a/doc/vala/default.css b/doc/vala/default.css
new file mode 100644 (file)
index 0000000..a49a2c6
--- /dev/null
@@ -0,0 +1,48 @@
+body {
+       font-family: sans-serif;
+       margin-top: 2.8em;
+}
+
+h1, h2, h3 {
+       color: #005a9c;
+}
+
+a {
+       color: #005a9c;
+       text-decoration: none;
+}
+
+.toc {
+       font-weight: bold;
+       font-size: larger;
+}
+
+.toc li {
+       list-style-type: none;
+}
+
+.toc li li {
+       font-size: smaller;
+}
+
+h3 a {
+       /* ensure anchors don't vanish below the fixed header */
+       position: relative;
+       top: -2.8em;
+}
+
+.header {
+       background-color: #005a9c;
+       font-weight: bold;
+       padding: .35em;
+       position: fixed;
+       left: 0;
+       top: 0;
+       width: 100%;
+       height: 1.4em;
+}
+
+.header a {
+       color: white;
+}
+
diff --git a/doc/vala/delegates.xml b/doc/vala/delegates.xml
new file mode 100644 (file)
index 0000000..0517ed9
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="delegates">
+       <h>Delegates</h>
+</section>
+
diff --git a/doc/vala/devhelp.xsl b/doc/vala/devhelp.xsl
new file mode 100644 (file)
index 0000000..735ff18
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns="http://www.devhelp.net/book" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
+       <xsl:output method="xml" indent="yes"/>
+       <xsl:template match="/">
+               <book title="{//title/text()}" link="index.html" author="" name="vala" version="2">
+                       <chapters>
+                               <xsl:for-each select="//body/section">
+                                       <sub name="{h/text()}" link="{@id}.html">
+                                               <xsl:for-each select="section">
+                                                       <sub name="{h/text()}" link="{../@id}.html#{@id}"/>
+                                               </xsl:for-each>
+                                       </sub>
+                               </xsl:for-each>
+                       </chapters>
+               </book>
+       </xsl:template>
+</xsl:stylesheet>
+
diff --git a/doc/vala/enums.xml b/doc/vala/enums.xml
new file mode 100644 (file)
index 0000000..5b13675
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="enums">
+       <h>Enums</h>
+</section>
+
diff --git a/doc/vala/expressions.xml b/doc/vala/expressions.xml
new file mode 100644 (file)
index 0000000..95e937e
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="expressions">
+       <h>Expressions</h>
+</section>
+
diff --git a/doc/vala/index.xml b/doc/vala/index.xml
new file mode 100644 (file)
index 0000000..1a45706
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<html xmlns:xi="http://www.w3.org/2001/XInclude">
+       <head>
+               <title>Vala Reference Manual</title>
+       </head>
+       <body>
+               <h>Vala Reference Manual</h>
+               <xi:include href="overview.xml"/>
+               <xi:include href="types.xml"/>
+               <xi:include href="expressions.xml"/>
+               <xi:include href="statements.xml"/>
+               <xi:include href="namespaces.xml"/>
+               <xi:include href="classes.xml"/>
+               <xi:include href="structs.xml"/>
+               <xi:include href="interfaces.xml"/>
+               <xi:include href="enums.xml"/>
+               <xi:include href="delegates.xml"/>
+       </body>
+</html>
+
diff --git a/doc/vala/interfaces.xml b/doc/vala/interfaces.xml
new file mode 100644 (file)
index 0000000..a692511
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="interfaces">
+       <h>Interfaces</h>
+</section>
+
diff --git a/doc/vala/namespaces.xml b/doc/vala/namespaces.xml
new file mode 100644 (file)
index 0000000..da568ff
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="namespaces">
+       <h>Namespaces</h>
+</section>
+
diff --git a/doc/vala/overview.xml b/doc/vala/overview.xml
new file mode 100644 (file)
index 0000000..7748d84
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<section id="overview">
+       <h>Overview</h>
+       <p>Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C.</p>
+       <section id="gettingstarted">
+               <h>Getting started</h>
+               <p>The classic "Hello, world" example in Vala:</p>
+               <blockcode>
+using GLib;
+
+public class Sample : Object {
+       public Sample () {
+       }
+
+       public void run () {
+               stdout.printf ("Hello, world!\n");
+       }
+
+       static int main (string[] args) {
+               var sample = new Sample ();
+               sample.run ();
+               return 0;
+       }
+}</blockcode>
+               <p>Store the code in a file whose name ends in ".vala", such as <code>hello.vala</code>, and compile it with the command:</p>
+               <blockcode>valac -o hello hello.vala</blockcode>
+               <p>This will produce an executable file called <code>hello</code>.</p>
+       </section>
+</section>
+
diff --git a/doc/vala/statements.xml b/doc/vala/statements.xml
new file mode 100644 (file)
index 0000000..421bc94
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="statements">
+       <h>Statements</h>
+</section>
+
diff --git a/doc/vala/structs.xml b/doc/vala/structs.xml
new file mode 100644 (file)
index 0000000..478f302
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="structs">
+       <h>Structs</h>
+</section>
+
diff --git a/doc/vala/types.xml b/doc/vala/types.xml
new file mode 100644 (file)
index 0000000..55954c6
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<section id="types">
+       <h>Types</h>
+</section>
+
diff --git a/doc/vala/xhtml.xsl b/doc/vala/xhtml.xsl
new file mode 100644 (file)
index 0000000..0f5ac8b
--- /dev/null
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
+       <xsl:output method="xml" indent="yes" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
+       <xsl:template match="/">
+               <xsl:apply-templates select="html"/>
+       </xsl:template>
+       <xsl:template match="html">
+               <html><xsl:apply-templates select="head|body"/></html>
+       </xsl:template>
+       <xsl:template match="head">
+               <head>
+                       <xsl:apply-templates select="title"/>
+                       <link rel="stylesheet" type="text/css" href="default.css"/>
+               </head>
+       </xsl:template>
+       <xsl:template match="title">
+               <title><xsl:value-of select="."/></title>
+       </xsl:template>
+       <xsl:template match="body">
+               <body>
+                       <div class="header">
+                               <a href="index.html"><xsl:value-of select="//title/text()"/></a>
+                       </div>
+                       <xsl:apply-templates select="h|p|section"/>
+                       <ul class="toc">
+                               <xsl:for-each select="section">
+                                       <li>
+                                               <a href="{@id}.html"><xsl:value-of select="h/text()"/></a>
+                                               <xsl:if test="count(section) > 0">
+                                                       <ul>
+                                                               <xsl:for-each select="section">
+                                                                       <li><a href="{../@id}.html#{@id}"><xsl:value-of select="h/text()"/></a></li>
+                                                               </xsl:for-each>
+                                                       </ul>
+                                               </xsl:if>
+                                       </li>
+                               </xsl:for-each>
+                       </ul>
+               </body>
+       </xsl:template>
+       <xsl:template match="body/h">
+               <h1><xsl:value-of select="text()"/></h1>
+       </xsl:template>
+       <xsl:template match="body/section">
+               <xsl:document href="{@id}.html" method="xml" indent="yes">
+                       <html>
+                               <head>
+                                       <title><xsl:value-of select="h/text()"/> - <xsl:value-of select="//title/text()"/></title>
+                                       <link rel="stylesheet" type="text/css" href="default.css"/>
+                               </head>
+                               <body>
+                                       <div class="header">
+                                               <a href="index.html"><xsl:value-of select="//title/text()"/></a>
+                                       </div>
+                                       <xsl:apply-templates select="h|p|section"/>
+                               </body>
+                       </html>
+               </xsl:document>
+       </xsl:template>
+       <xsl:template match="body/section/h">
+               <h2><xsl:value-of select="text()"/></h2>
+       </xsl:template>
+       <xsl:template match="body/section/section">
+               <xsl:apply-templates select="h|p|blockcode|section"/>
+       </xsl:template>
+       <xsl:template match="body/section/section/h">
+               <h3><xsl:value-of select="text()"/><a id="{../@id}"><xsl:text> </xsl:text></a></h3>
+       </xsl:template>
+       <xsl:template match="p">
+               <p><xsl:apply-templates select="text()|code"/></p>
+       </xsl:template>
+       <xsl:template match="code">
+               <code><xsl:value-of select="text()"/></code>
+       </xsl:template>
+       <xsl:template match="blockcode">
+               <pre><xsl:value-of select="text()"/></pre>
+       </xsl:template>
+</xsl:stylesheet>
+
index 036bddc..af64e4e 100644 (file)
@@ -33,6 +33,7 @@ testenchant.stamp: $(filter %.vala,$(testenchant_SOURCES))
 TESTS_ENVIRONMENT = $(srcdir)/testrunner.sh
 
 TESTS = \
+       hello.vala \
        test-001.vala \
        test-002.vala \
        test-003.vala \
@@ -72,41 +73,8 @@ TESTS = \
 
 EXTRA_DIST = \
        testrunner.sh \
-       test-001.vala \
-       test-002.vala \
-       test-003.vala \
-       test-004.vala \
-       test-005.vala \
-       test-006.vala \
-       test-007.vala \
-       test-008.vala \
-       test-009.vala \
-       test-010.vala \
-       test-011.vala \
-       test-012.vala \
-       test-013.vala \
-       test-014.vala \
-       test-015.vala \
-       test-016.vala \
-       test-017.vala \
-       test-018.vala \
-       test-019.vala \
-       test-020.vala \
-       test-021.vala \
-       test-022.vala \
-       test-023.vala \
-       test-024.vala \
-       test-025.vala \
-       test-026.vala \
-       test-027.vala \
-       test-028.vala \
-       test-029.vala \
-       test-030.vala \
-       test-031.vala \
-       test-032.vala \
-       test-033.vala \
-       test-034.vala \
-       test-035.vala \
+       $(TESTS) \
+       hello.exp \
        test-001.exp \
        test-002.exp \
        test-003.exp \
diff --git a/tests/hello.exp b/tests/hello.exp
new file mode 100644 (file)
index 0000000..af5626b
--- /dev/null
@@ -0,0 +1 @@
+Hello, world!
diff --git a/tests/hello.vala b/tests/hello.vala
new file mode 100644 (file)
index 0000000..ddc5603
--- /dev/null
@@ -0,0 +1,17 @@
+using GLib;
+
+public class Sample : Object {
+       public Sample () {
+       }
+
+       public void run () {
+               stdout.printf ("Hello, world!\n");
+       }
+
+       static int main (string[] args) {
+               var sample = new Sample ();
+               sample.run ();
+               return 0;
+       }
+}
+