$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r60527 - in trunk/libs/spirit/example/scheme: . detail
From: joel_at_[hidden]
Date: 2010-03-12 18:49:27
Author: djowel
Date: 2010-03-12 18:49:26 EST (Fri, 12 Mar 2010)
New Revision: 60527
URL: http://svn.boost.org/trac/boost/changeset/60527
Log:
fix for 64 bits
Text files modified: 
   trunk/libs/spirit/example/scheme/detail/utree_detail1.hpp |    79 ++++++++++++++++++++------------------- 
   trunk/libs/spirit/example/scheme/simple_print.hpp         |     5 +-                                      
   trunk/libs/spirit/example/scheme/utree.hpp                |     1                                         
   trunk/libs/spirit/example/scheme/utree_test.cpp           |    13 ++++++                                  
   4 files changed, 57 insertions(+), 41 deletions(-)
Modified: trunk/libs/spirit/example/scheme/detail/utree_detail1.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/detail/utree_detail1.hpp	(original)
+++ trunk/libs/spirit/example/scheme/detail/utree_detail1.hpp	2010-03-12 18:49:26 EST (Fri, 12 Mar 2010)
@@ -40,6 +40,44 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
+    // Our POD double linked list. Straightforward implementation.
+    // This implementation is very primitive and is not meant to be
+    // used stand-alone. This is the internal data representation
+    // of lists in our utree.
+    ///////////////////////////////////////////////////////////////////////////
+    struct list // keep this a POD!
+    {
+        struct node;
+
+        template <typename Value>
+        class node_iterator;
+
+        void free();
+        void copy(list const& other);
+        void default_construct();
+
+        template <typename T>
+        void insert_before(T const& val, node* node);
+
+        template <typename T>
+        void insert_after(T const& val, node* node);
+
+        template <typename T>
+        void push_front(T const& val);
+
+        template <typename T>
+        void push_back(T const& val);
+
+        void pop_front();
+        void pop_back();
+        node* erase(node* pos);
+
+        node* first;
+        node* last;
+        std::size_t size;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
     // Our POD fast string. This implementation is very primitive and is not
     // meant to be used stand-alone. This is the internal data representation
     // of strings in our utree. This is deliberately a POD to allow it to be
@@ -56,7 +94,8 @@
     struct fast_string // Keep this a POD!
     {
         static std::size_t const
-            buff_size = (sizeof(double)*2)/sizeof(char);
+            buff_size = (sizeof(list) + boost::alignment_of<list>::value)
+                / sizeof(char);
 
         static std::size_t const
             small_string_size = buff_size-(sizeof(char)*2);
@@ -85,44 +124,6 @@
         void free();
         void copy(fast_string const& other);
     };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // Our POD double linked list. Straightforward implementation.
-    // This implementation is very primitive and is not meant to be
-    // used stand-alone. This is the internal data representation
-    // of lists in our utree.
-    ///////////////////////////////////////////////////////////////////////////
-    struct list // keep this a POD!
-    {
-        struct node;
-
-        template <typename Value>
-        class node_iterator;
-
-        void free();
-        void copy(list const& other);
-        void default_construct();
-
-        template <typename T>
-        void insert_before(T const& val, node* node);
-
-        template <typename T>
-        void insert_after(T const& val, node* node);
-
-        template <typename T>
-        void push_front(T const& val);
-
-        template <typename T>
-        void push_back(T const& val);
-
-        void pop_front();
-        void pop_back();
-        node* erase(node* pos);
-
-        node* first;
-        node* last;
-        std::size_t size;
-    };
 }}
 
 #endif
Modified: trunk/libs/spirit/example/scheme/simple_print.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/simple_print.hpp	(original)
+++ trunk/libs/spirit/example/scheme/simple_print.hpp	2010-03-12 18:49:26 EST (Fri, 12 Mar 2010)
@@ -59,9 +59,10 @@
             if (*i == '\1') // a 1 byte at the beginning signifies a byte string
             {
                 out << "b"; ++i;
+                out.width(2);
+                out.setf('0');
                 for (; i != range.end(); ++i)
-                    out << std::setw(2) << std::setfill('0')
-                        << std::hex << int((unsigned char)*i);
+                    out << std::hex << int((unsigned char)*i);
                 out << std::dec;
             }
             else
Modified: trunk/libs/spirit/example/scheme/utree.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/utree.hpp	(original)
+++ trunk/libs/spirit/example/scheme/utree.hpp	2010-03-12 18:49:26 EST (Fri, 12 Mar 2010)
@@ -15,6 +15,7 @@
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/range/iterator_range.hpp>
 #include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/alignment_of.hpp>
 #include <boost/ref.hpp>
 #include "detail/utree_detail1.hpp"
 
Modified: trunk/libs/spirit/example/scheme/utree_test.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/utree_test.cpp	(original)
+++ trunk/libs/spirit/example/scheme/utree_test.cpp	2010-03-12 18:49:26 EST (Fri, 12 Mar 2010)
@@ -169,5 +169,18 @@
         BOOST_ASSERT(ref[3] == utree(4));
     }
 
+    { // put it in an array
+
+        utree vals[] = {
+            utree(123),
+            utree("Hello, World"),
+            utree(123.456)
+        };
+
+        println(std::cout, vals[0]);
+        println(std::cout, vals[1]);
+        println(std::cout, vals[2]);
+    }
+
     return 0;
 }