$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r73227 - sandbox/numpy/libs/numpy/doc
From: seefeld_at_[hidden]
Date: 2011-07-19 00:32:27
Author: stefan
Date: 2011-07-19 00:32:25 EDT (Tue, 19 Jul 2011)
New Revision: 73227
URL: http://svn.boost.org/trac/boost/changeset/73227
Log:
Add support for ReST docs.
Added:
   sandbox/numpy/libs/numpy/doc/
   sandbox/numpy/libs/numpy/doc/Jamfile   (contents, props changed)
   sandbox/numpy/libs/numpy/doc/rst.css   (contents, props changed)
   sandbox/numpy/libs/numpy/doc/tutorial.rst   (contents, props changed)
Added: sandbox/numpy/libs/numpy/doc/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/Jamfile	2011-07-19 00:32:25 EDT (Tue, 19 Jul 2011)
@@ -0,0 +1,25 @@
+# Copyright David Abrahams 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+project user-config : requirements <docutils-cmd>rst2html ;
+
+import docutils ;
+
+import path ;
+sources = tutorial.rst ;
+bases = $(sources:S=) ;
+  
+# This is a path relative to the html/ subdirectory where the
+# generated output will eventually be moved.
+stylesheet = "--stylesheet=rst.css" ;
+
+for local b in $(bases)
+{
+    html $(b) : $(b).rst : 
+      
+    <docutils-html>"-gdt --source-url="./$(b).rst" --link-stylesheet --traceback --trim-footnote-reference-space --footnote-references=superscript "$(stylesheet)
+  ;
+}
+
+alias htmls : $(bases) ;
+stage . : $(bases) ;
Added: sandbox/numpy/libs/numpy/doc/rst.css
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/rst.css	2011-07-19 00:32:25 EDT (Tue, 19 Jul 2011)
@@ -0,0 +1,149 @@
+@import url("doc/src/boostbook.css");
+@import url("doc/src/docutils.css");
+/* Copyright David Abrahams 2006. Distributed under the Boost
+   Software License, Version 1.0. (See accompanying
+   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+dl.docutils dt {
+  font-weight: bold }
+
+img.boost-logo {
+  border: none;
+  vertical-align: middle
+}
+
+pre.literal-block span.concept {
+  font-style: italic;
+}
+
+.nav { 
+display: inline;
+list-style-type: none;
+}
+
+.prevpage {
+padding-top: -5px;
+text-align: left;
+float: left;
+}
+
+.nextpage {
+padding-top: -20px;
+text-align: right;
+float: right;
+}
+
+div.small {
+   font-size: smaller }
+
+h2 a { 
+   font-size: 90%; 
+}
+h3 a { 
+   font-size: 80%; 
+}
+h4 a { 
+   font-size: 70%; 
+}
+h5 a { 
+   font-size: 60%; 
+}
+
+dl,table
+{
+   text-align: left;
+   font-size: 10pt; 
+   line-height: 1.15;
+}
+
+
+/*=============================================================================
+    Tables
+=============================================================================*/
+
+/* The only clue docutils gives us that tables are logically tables,
+   and not, e.g., footnotes, is that they have border="1".  Therefore
+   we're keying off of that.  We used to manually patch docutils to
+   add a "table" class to all logical tables, but that proved much too
+   fragile.
+*/
+
+    table[border="1"]
+    {
+        width: 92%;
+        margin-left: 4%;
+        margin-right: 4%;
+    }
+    
+    table[border="1"]
+    {
+        padding: 4px;
+    }
+    
+    /* Table Cells */
+    table[border="1"] tr td
+    {
+        padding: 0.5em;
+        text-align: left;
+        font-size: 9pt;
+    }
+
+    table[border="1"] tr th
+    {
+        padding: 0.5em 0.5em 0.5em 0.5em;
+        border: 1pt solid white;
+        font-size: 80%;
+    }
+
+    @media screen
+    {
+    
+    /* Tables */
+        table[border="1"] tr td
+        {
+            border: 1px solid #DCDCDC;
+        }
+    
+        table[border="1"] tr th
+        {
+            background-color: #F0F0F0;
+            border: 1px solid #DCDCDC;
+        }
+
+        pre, 
+        .screen
+        {
+            border: 1px solid #DCDCDC;
+        }
+    
+        td pre
+        td .screen
+        {
+            border: 0px
+        }
+    
+        .sidebar pre
+        {
+            border: 0px
+        }
+    
+    }
+
+    pre, 
+    .screen
+    {
+        font-size: 9pt;
+        display: block;
+        margin: 1pc 4% 0pc 4%;
+        padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+    }
+
+    /* Program listings in tables don't get borders */
+    td pre, 
+    td .screen
+    {
+        margin: 0pc 0pc 0pc 0pc;
+        padding:  0pc 0pc 0pc 0pc;
+    }
+
Added: sandbox/numpy/libs/numpy/doc/tutorial.rst
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/tutorial.rst	2011-07-19 00:32:25 EDT (Tue, 19 Jul 2011)
@@ -0,0 +1,37 @@
+A simple tutorial on Arrays
+===========================
+
+Let's start with a simple tutorial to create and modify arrays.
+
+Get the necessary headers for numpy components and set up necessary namespaces::
+
+	#include <boost/numpy.hpp>
+	#include <iostream>
+
+	namespace p = boost::python;
+	namespace np = boost::numpy;
+
+Initialise the Python runtime, and the numpy module. Failure to call these results in segmentation errors::
+
+	int main(int argc, char **argv)
+	{
+	  Py_Initialize();
+	  np::initialize();
+
+
+Zero filled n-dimensional arrays can be created using the shape and data-type of the array as a parameter. Here, the shape is 3x3 and the datatype is the built-in float type::
+
+	  p::tuple shape = p::make_tuple(3, 3);
+	  np::dtype dtype = np::dtype::get_builtin<float>();
+	  np::ndarray a = np::zeros(shape, dtype);
+
+Print the original and reshaped array. The array a which is a list is first converted to a string, and each value in the list is extracted using extract< >::
+
+	  std::cout << "Original array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
+
+	  // Reshape the array into a 1D array
+	  a = a.reshape(p::make_tuple(9));
+	  // Print it again.
+	  std::cout << "Reshaped array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
+	}
+