]> www.ginac.de Git - ginac.git/commitdiff
- archive file format is a little more compact (stores property name and type
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 31 Jan 2000 21:50:12 +0000 (21:50 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 31 Jan 2000 21:50:12 +0000 (21:50 +0000)
  as one unsigned value)
- moved #include "config.h" from lortensor.h to lortensor.cpp (none of the
  public headers must include config.h)

ginac/archive.cpp
ginac/archive.h
ginac/lortensor.cpp
ginac/lortensor.h

index 2b9ecdb72174803ce518aeada53b2b3a8154bf6f..058264d9150a82ac4b78b050748b632b26005bf5 100644 (file)
@@ -144,8 +144,8 @@ unsigned int archive::num_expressions(void) const
  *      - unsigned root node ID
  *   - unsigned number of nodes
  *      - unsigned number of properties
- *        - unsigned type (PTYPE_*)
- *        - unsigned name atom
+ *        - unsigned containing type (PTYPE_*) in its lower 3 bits and
+ *          name atom in the upper bits
  *        - unsigned property value
  *
  *  Unsigned quantities are stored in a compressed format:
@@ -202,8 +202,7 @@ ostream &operator<<(ostream &os, const archive_node &n)
        unsigned int num_props = n.props.size();
        write_unsigned(os, num_props);
        for (unsigned int i=0; i<num_props; i++) {
-               write_unsigned(os, n.props[i].type);
-               write_unsigned(os, n.props[i].name);
+               write_unsigned(os, n.props[i].type | (n.props[i].name << 3));
                write_unsigned(os, n.props[i].value);
        }
     return os;
@@ -248,8 +247,9 @@ istream &operator>>(istream &is, archive_node &n)
        unsigned int num_props = read_unsigned(is);
        n.props.resize(num_props);
        for (unsigned int i=0; i<num_props; i++) {
-               n.props[i].type = (archive_node::property_type)read_unsigned(is);
-               n.props[i].name = read_unsigned(is);
+               unsigned int name_type = read_unsigned(is);
+               n.props[i].type = (archive_node::property_type)(name_type & 7);
+               n.props[i].name = name_type >> 3;
                n.props[i].value = read_unsigned(is);
        }
     return is;
@@ -562,7 +562,7 @@ void archive_node::printraw(ostream &os) const
        if (has_expression)
                os << "(basic * " << e.bp << " = " << e << ")\n";
        else
-               os << "(no expression)\n";
+               os << "\n";
 
        // Dump properties
        vector<property>::const_iterator i = props.begin(), iend = props.end();
index 50317b8f7be5fac4a8911a666a5851ec0b28eadb..396820b392a7fc58f4ee4b77432b059c14cab0ad 100644 (file)
@@ -55,7 +55,7 @@ class archive_node
        friend istream &operator>>(istream &is, archive_node &ar);
 
 public:
-       archive_node() : a(*dummy_ar_creator()), has_expression(false) {}
+       archive_node() : a(*dummy_ar_creator()), has_expression(false) {} // hack for cint which always requires a default constructor
        archive_node(archive &ar) : a(ar), has_expression(false) {}
        archive_node(archive &ar, const ex &expr);
        ~archive_node() {}
index 4014481478e7e0dcb0d06096c2e825e2ba77866c..8a30034eca4af1c8deea7f4a55552f903e622897 100644 (file)
@@ -40,6 +40,7 @@
 #include "power.h"
 #include "symbol.h"
 #include "utils.h"
+#include "config.h"
 
 #ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
index c02552a76e777a53eeaa968a560cacdf0d302235..86bf70a04e9d46c6be033ae9fc9e1388bc8327d7 100644 (file)
@@ -26,7 +26,6 @@
 #include <string>
 #include <vector>
 #include <iostream>
-#include "config.h"
 #include "indexed.h"
 #include "lorentzidx.h"