diff options
author | dos-reis <gdr@axiomatics.org> | 2013-06-21 22:47:20 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-06-21 22:47:20 +0000 |
commit | edb5b025bce95004b908440b55f0183c2fcf34cc (patch) | |
tree | 030e03fd887a52347893943462c6887ac5cb6656 /src | |
parent | 71d28a360d8178fa4a0270cad0a41de26c1b0c7d (diff) | |
download | open-axiom-edb5b025bce95004b908440b55f0183c2fcf34cc.tar.gz |
* include/dialect.H: New.
* include/diagnostics.H: Likewise.
* include/storage.H: Move from utils/.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/Makefile.am | 8 | ||||
-rw-r--r-- | src/Makefile.in | 81 | ||||
-rw-r--r-- | src/algebra/Makefile.in | 62 | ||||
-rw-r--r-- | src/include/dialect.H | 42 | ||||
-rw-r--r-- | src/include/storage.H (renamed from src/utils/storage.H) | 54 | ||||
-rw-r--r-- | src/io/Makefile.in | 61 | ||||
-rw-r--r-- | src/syntax/Makefile.in | 61 | ||||
-rw-r--r-- | src/utils/Makefile.in | 6 | ||||
-rw-r--r-- | src/utils/storage.cc | 27 |
10 files changed, 284 insertions, 124 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 30e2eea7..fdc84220 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * include/dialect.H: New. + * include/diagnostics.H: Likewise. + * include/storage.H: Move from utils/. + 2013-06-20 Gabriel Dos Reis <gdr@integrable-solutions.net> * include/diagnostics.H: New. diff --git a/src/Makefile.am b/src/Makefile.am index 0758724c..9d4c9d10 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,8 +51,10 @@ oa_src_include_headers = \ defaults.H \ structure.H \ iterator.H \ + storage.H \ Input.H \ diagnostics.H \ + dialect.H \ token.H if OA_BUILD_SMAN @@ -91,10 +93,10 @@ stamp-subdirs: all-driver: all-utils all-lib cd driver && $(MAKE) $(AM_MAKEFLAGS) $@ -all-utils: stamp-subdirs +all-utils: stamp-subdirs all-headers cd utils && $(MAKE) $(AM_MAKEFLAGS) $@ -all-io: all-headers +all-io: all-utils cd io && $(MAKE) $(AM_MAKEFLAGS) $@ all-syntax: all-io @@ -119,7 +121,7 @@ all-share: all-doc: stamp-subdirs cd doc && $(MAKE) $(AM_MAKEFLAGS) $@ -all-lib: stamp-subdirs +all-lib: stamp-subdirs all-utils cd lib && $(MAKE) $(AM_MAKEFLAGS) $@ all-lisp: all-lib all-driver diff --git a/src/Makefile.in b/src/Makefile.in index f8d671ce..b4c117dc 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.13.1 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -46,23 +46,51 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ esac; \ - test $$am__dry = yes; \ - } + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -368,8 +396,10 @@ oa_src_include_headers = \ defaults.H \ structure.H \ iterator.H \ + storage.H \ Input.H \ diagnostics.H \ + dialect.H \ token.H @OA_BUILD_SMAN_TRUE@OA_SMAN_TARGETS = all-sman all-clef @@ -423,13 +453,12 @@ clean-libtool: # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ @@ -713,10 +742,10 @@ stamp-subdirs: all-driver: all-utils all-lib cd driver && $(MAKE) $(AM_MAKEFLAGS) $@ -all-utils: stamp-subdirs +all-utils: stamp-subdirs all-headers cd utils && $(MAKE) $(AM_MAKEFLAGS) $@ -all-io: all-headers +all-io: all-utils cd io && $(MAKE) $(AM_MAKEFLAGS) $@ all-syntax: all-io @@ -741,7 +770,7 @@ all-share: all-doc: stamp-subdirs cd doc && $(MAKE) $(AM_MAKEFLAGS) $@ -all-lib: stamp-subdirs +all-lib: stamp-subdirs all-utils cd lib && $(MAKE) $(AM_MAKEFLAGS) $@ all-lisp: all-lib all-driver diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in index 7a245f7c..bc1ad529 100644 --- a/src/algebra/Makefile.in +++ b/src/algebra/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.13.1 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -86,23 +86,51 @@ # than a lattice. # VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -1313,7 +1341,7 @@ cscope cscopelist: $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not -# exand to empty, as could happen e.g. with make check TESTS=''. +# expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: diff --git a/src/include/dialect.H b/src/include/dialect.H new file mode 100644 index 00000000..a471981d --- /dev/null +++ b/src/include/dialect.H @@ -0,0 +1,42 @@ +// Copyright (C) 2013, Gabriel Dos Reis. +// All rights reserved. +// Written by Gabriel Dos Reis. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// - Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the +// distribution. +// +// - Neither the name of OpenAxiom. nor the names of its contributors +// may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef OPENAXIOM_DIALECT_included +#define OPENAXIOM_DIALECT_included + +namespace OpenAxiom { + enum class Language { + Spad, Boot + }; +} + +#endif // OPENAXIOM_DIALECT_included diff --git a/src/utils/storage.H b/src/include/storage.H index 72b9eb1e..b75ced9d 100644 --- a/src/utils/storage.H +++ b/src/include/storage.H @@ -1,5 +1,6 @@ -// Copyright (C) 2010-2011, Gabriel Dos Reis. +// Copyright (C) 2010-2013, Gabriel Dos Reis. // All rights reserved. +// Written by Gabriel Dos Reis. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -13,9 +14,9 @@ // the documentation and/or other materials provided with the // distribution. // -// - Neither the name of The Numerical Algorithms Group Ltd. nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. +// - Neither the name of OpenAxiom. nor the names of its contributors +// may be used to endorse or promote products derived from this +// software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -35,16 +36,15 @@ // --% from the host OS. Provide random access read to // --% files through file mapping. -#ifndef OPENAXIOM_STORAGE_INCLUDED -#define OPENAXIOM_STORAGE_INCLUDED +#ifndef OPENAXIOM_STORAGE_included +#define OPENAXIOM_STORAGE_included +#include <open-axiom/config> #include <stddef.h> #include <new> #include <cmath> #include <string> -#include <open-axiom/config> - namespace OpenAxiom { // ----------------- // -- SystemError -- @@ -65,10 +65,10 @@ namespace OpenAxiom { namespace Memory { // Datatype for the unit of storage. - typedef unsigned char Byte; + using Byte = unsigned char; // Datatype for pointers to data. - typedef void* Pointer; + using Pointer = void*; // Precision of the host OS storage page unit in byte count size_t page_size(); @@ -217,7 +217,7 @@ namespace OpenAxiom { size_t Arena<T>::population() const { size_t n = 0; - for (Handle* h = store; h != 0; h = previous(h)) + for (Handle* h = store; h != nullptr; h = previous(h)) n += object_count(h); return n; } @@ -247,7 +247,7 @@ namespace OpenAxiom { Arena<T>::~Arena() { // Release storage in the reverse order of their // their allocation. - while (store != 0) { + while (store != nullptr) { Handle* current = store; store = BlockStorage::previous(store); BlockStorage::release(current); @@ -259,7 +259,7 @@ namespace OpenAxiom { // ------------- template<typename T> struct Factory : Arena<T> { - typedef typename Arena<T>::Handle Handle; + using Handler = typename Arena<T>::Handle; Factory() : Arena<T>(nominal_population()) { } ~Factory(); @@ -270,21 +270,9 @@ namespace OpenAxiom { } // Allocate storage and construct an object of type `T'. - template<typename U> - T* make(const U& u) { - return new(this->allocate(1)) T(u); - } - - // Allocate storage and construct an object of type `T'. - template<typename U, typename V> - T* make(const U& u, const V& v) { - return new(this->allocate(1)) T(u, v); - } - - // Allocate storage and construct an object of type `T'. - template<typename U, typename V, typename W> - T* make(const U& u, const V& v, const W& w) { - return new(this->allocate(1)) T(u, v, w); + template<typename... Args> + T* make(const Args&... args) { + return new(this->allocate(1)) T(args...); } private: @@ -300,7 +288,7 @@ namespace OpenAxiom { // Destroy objects in the reverse order of their construction. template<typename T> Factory<T>::~Factory() { - for (Handle* s = this->store; s != 0; s = Arena<T>::previous(s)) { + for (auto s = this->store; s != nullptr; s = Arena<T>::previous(s)) { T* last = Arena<T>::last_object(s); for (--last; last >= Arena<T>::first_object(s); --last) last->~T(); @@ -312,6 +300,7 @@ namespace OpenAxiom { // ----------------- struct FileMapping { explicit FileMapping(std::string); + FileMapping(FileMapping&&); ~FileMapping(); const char* begin() const { return static_cast<const char*>(start); } const char* end() const { return begin() + extent; } @@ -320,11 +309,12 @@ namespace OpenAxiom { Pointer start; // address at the mapped storage size_t extent; // length (in bytes) of the storage private: - FileMapping(const FileMapping&); // not implemented - FileMapping& operator=(const FileMapping&); // idem + FileMapping(const FileMapping&) = delete; + FileMapping& operator=(const FileMapping&) = delete; }; } } -#endif // OPENAXIOM_STORAGE_INCLUDED +#endif // OPENAXIOM_STORAGE_included + diff --git a/src/io/Makefile.in b/src/io/Makefile.in index 728286d7..1cbd8406 100644 --- a/src/io/Makefile.in +++ b/src/io/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.13.1 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -47,23 +47,51 @@ # VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ esac; \ - test $$am__dry = yes; \ - } + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -388,6 +416,7 @@ $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + libio.a: $(libio_a_OBJECTS) $(libio_a_DEPENDENCIES) $(EXTRA_libio_a_DEPENDENCIES) $(AM_V_at)-rm -f libio.a $(AM_V_AR)$(libio_a_AR) libio.a $(libio_a_OBJECTS) $(libio_a_LIBADD) diff --git a/src/syntax/Makefile.in b/src/syntax/Makefile.in index bab9086a..bba5226d 100644 --- a/src/syntax/Makefile.in +++ b/src/syntax/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.13.1 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -47,23 +47,51 @@ # VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ esac; \ - test $$am__dry = yes; \ - } + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -387,6 +415,7 @@ $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + libsyntax.a: $(libsyntax_a_OBJECTS) $(libsyntax_a_DEPENDENCIES) $(EXTRA_libsyntax_a_DEPENDENCIES) $(AM_V_at)-rm -f libsyntax.a $(AM_V_AR)$(libsyntax_a_AR) libsyntax.a $(libsyntax_a_OBJECTS) $(libsyntax_a_LIBADD) diff --git a/src/utils/Makefile.in b/src/utils/Makefile.in index e9734fd2..a3021748 100644 --- a/src/utils/Makefile.in +++ b/src/utils/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2011, Gabriel Dos Reis. +# Copyright (C) 2013, Gabriel Dos Reis. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -36,14 +36,14 @@ hammer_SOURCES = hammer.cc hammer_OBJECTS = $(hammer_SOURCES:.cc=.lo) hammer_LDADD = -L. -lOpenAxiom -libOpenAxiom_HEADERS = storage.H hash-table.H string-pool.H sexpr.H vm.H +libOpenAxiom_HEADERS = hash-table.H string-pool.H sexpr.H vm.H libOpenAxiom_SOURCES = \ storage.cc string-pool.cc sexpr.cc command.cc \ filesystem.cc vm.cc libOpenAxiom_OBJECTS = $(libOpenAxiom_SOURCES:.cc=.lo) -oa_public_headers = storage hash-table string-pool sexpr vm +oa_public_headers = hash-table string-pool sexpr vm ## Where we store public header files oa_target_headerdir = $(oa_target_includedir)/open-axiom diff --git a/src/utils/storage.cc b/src/utils/storage.cc index 4f5fc67c..54d14761 100644 --- a/src/utils/storage.cc +++ b/src/utils/storage.cc @@ -31,8 +31,7 @@ // --%: Gabriel Dos Reis. -#include <open-axiom/config> - +#include <open-axiom/storage> #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif @@ -55,8 +54,6 @@ #include <errno.h> #include <stdlib.h> #include <string.h> -#include <new> // for placement new. -#include <open-axiom/storage> namespace OpenAxiom { // ---------------- @@ -111,7 +108,7 @@ namespace OpenAxiom { Pointer os_acquire_raw_memory(size_t nbytes) { Pointer p = os_allocate_read_write_raw_memory(nbytes); - if (p == 0) + if (p == nullptr) throw SystemError("cannot acquire more memory"); return memset(p, nbytes, 0); } @@ -206,8 +203,8 @@ namespace OpenAxiom { TwoWayLinkHeader* h = acquire_storage_with_header<TwoWayLinkHeader>(overhead + n); h->start = byte_address (h) + overhead; - h->previous = 0; - h->next = 0; + h->previous = nullptr; + h->next = nullptr; return h; } @@ -232,7 +229,7 @@ namespace OpenAxiom { h->available = byte_address(h) + overhead; // That is also where the actual object storage starts. h->start = h->available; - h->previous = 0; + h->previous = nullptr; return h; } @@ -293,14 +290,22 @@ namespace OpenAxiom { #endif // OPENAXIOM_MS_WINDOWS_HOST } + FileMapping::FileMapping(FileMapping&& f) + : start(f.start), extent(f.extent) { + f.start = nullptr; + f.extent = 0; + } + FileMapping::~FileMapping() { + if (start != nullptr) { #if defined(OPENAXIOM_MS_WINDOWS_HOST) - UnmapViewOfFile(start); + UnmapViewOfFile(start); #elif defined(HAVE_SYS_MMAN_H) - munmap(start, extent); + munmap(start, extent); #else # error "Don't know how to unmap a file on this platform" -#endif +#endif + } } } } |