config_host/config_version.h.in | 8 ++--- unoidl/README | 54 +++++++++++++++++++++++++++++++++------ unoidl/source/reg2unoidl.cxx | 9 +++++- unoidl/source/unoidlprovider.cxx | 5 ++- 4 files changed, 61 insertions(+), 15 deletions(-)
New commits: commit 1ad700f5a449aeee1dfbbb5ae37b3bf43638d394 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed May 8 17:29:37 2013 +0200 Minor improvements to UNOIDL binary format Change-Id: Ia215b34842ce85bfbd1ad90a286abcbae0884bd5 diff --git a/config_host/config_version.h.in b/config_host/config_version.h.in index 0d78882..cc9cd98 100644 --- a/config_host/config_version.h.in +++ b/config_host/config_version.h.in @@ -16,10 +16,10 @@ Version settings #undef LIBO_THIS_YEAR #define LIBO_VERSION_DOTTED \ - (LIBO_VERSION_STRINGIFY(LIBO_VERSION_MAJOR) "." \ - LIBO_VERSION_STRINGIFY(LIBO_VERSION_MINOR) "." \ - LIBO_VERSION_STRINGIFY(LIBO_VERSION_MICRO) "." \ - LIBO_VERSION_STRINGIFY(LIBO_VERSION_PATCH)) + LIBO_VERSION_STRINGIFY(LIBO_VERSION_MAJOR) "." \ + LIBO_VERSION_STRINGIFY(LIBO_VERSION_MINOR) "." \ + LIBO_VERSION_STRINGIFY(LIBO_VERSION_MICRO) "." \ + LIBO_VERSION_STRINGIFY(LIBO_VERSION_PATCH) #define LIBO_VERSION_ENCODED_IN_32BITS \ ((LIBO_VERSION_MAJOR << 24) | (LIBO_VERSION_MINOR << 16) | (LIBO_VERSION_MICRO << 8) | LIBO_VERSION_PATCH) diff --git a/unoidl/README b/unoidl/README index 2e159c6..5daff7a 100644 --- a/unoidl/README +++ b/unoidl/README @@ -45,11 +45,18 @@ The file starts with an 8 byte header, followed by information about the root map (reg2unoidl generates files in a single depth-first pass, so the root map itself is at the end of the file): -* 8 byte header "UNOIDL\0\xFF" +* 7 byte magic header "UNOIDL\xFF" +* version byte 0 * Offset of root Map * UInt32 number of entries of root Map ... +Files generated by reg2unoidl follow that by a + + "\0** Created by LibreOffice " LIBO_VERSION_DOTTED " reg2unoidl **\0" + +banner (cf. config_host/config_version.h.in), as a debugging aid. + Layout of per-entry payload in the root or a module Map: * kind byte: diff --git a/unoidl/source/reg2unoidl.cxx b/unoidl/source/reg2unoidl.cxx index a311147..2bd9e56 100644 --- a/unoidl/source/reg2unoidl.cxx +++ b/unoidl/source/reg2unoidl.cxx @@ -17,11 +17,13 @@ #include <utility> #include <vector> +#include "config_version.h" #include "osl/endian.h" #include "osl/file.h" #include "osl/file.hxx" #include "osl/process.h" #include "rtl/process.h" +#include "rtl/string.h" #include "rtl/string.hxx" #include "rtl/textenc.h" #include "rtl/textcvt.h" @@ -746,9 +748,14 @@ SAL_IMPLEMENT_MAIN() { << +e << std::endl; std::exit(EXIT_FAILURE); } - write(f, "UNOIDL\0\xFF", 8); + write(f, "UNOIDL\xFF\0", 8); write32(f, 0); // root map offset write32(f, 0); // root map size + write( + f, + RTL_CONSTASCII_STRINGPARAM( + "\0** Created by LibreOffice " LIBO_VERSION_DOTTED + " reg2unoidl **\0")); sal_uInt64 off; std::size_t size; try { diff --git a/unoidl/source/unoidlprovider.cxx b/unoidl/source/unoidlprovider.cxx index 6ead9cf..33848a1 100644 --- a/unoidl/source/unoidlprovider.cxx +++ b/unoidl/source/unoidlprovider.cxx @@ -1058,11 +1058,12 @@ rtl::Reference< Entity > readEntity( UnoidlProvider::UnoidlProvider(OUString const & uri): file_(new detail::MappedFile(uri)) { - if (file_->size < 8 || std::memcmp(file_->address, "UNOIDL\0\xFF", 8) != 0) + if (file_->size < 8 || std::memcmp(file_->address, "UNOIDL\xFF\0", 8) != 0) { throw FileFormatException( file_->uri, - "UNOIDL format: does not begin with magic UNOIDL\\0\\xFF"); + "UNOIDL format: does not begin with magic UNOIDL\\xFF and version" + " 0"); } sal_uInt32 off = file_->read32(8); mapSize_ = file_->read32(12); commit 79774d961644ea81b4e790114c9b785d38bcd8a4 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed May 8 16:20:12 2013 +0200 unoidl/README improvements Change-Id: I5123d984f8f9bf49f5d1ad8e8decebfaaa6e7769 diff --git a/unoidl/README b/unoidl/README index ed9ee25..2e159c6 100644 --- a/unoidl/README +++ b/unoidl/README @@ -21,7 +21,13 @@ format). == Specification of the new UNOIDL types.rdb format == -Uses the following definitions: +The format uses byte-oriented, platform-independent, binary files. Larger +quantities are stored LSB first, without alignment requirements. Offsets are +32 bit, effectively limiting the overall file size to 4GB, but that is not +considered a limitation in practice (and avoids unnecessary bloat compared to +64 bit offsets). + +The following definitions are used throughout: * UInt16: 2-byte value, LSB first * UInt32: 4-byte value, LSB first @@ -35,24 +41,37 @@ Uses the following definitions: * Entry: Offset of NUL-Name followed by Offset of payload * Map: zero or more Entries +The file starts with an 8 byte header, followed by information about the root +map (reg2unoidl generates files in a single depth-first pass, so the root map +itself is at the end of the file): + +* 8 byte header "UNOIDL\0\xFF" +* Offset of root Map +* UInt32 number of entries of root Map +... + Layout of per-entry payload in the root or a module Map: * kind byte: + ** 0: module *** followed by: **** UInt32 number N1 of entries of Map **** N1 * Entry + ** otherwise: *** 0x80 bit: 1 if published *** 0x40 bit: 1 if deprecated *** 0x20 bit: flag (may only be 1 for certain kinds, see below) *** remaining bits: + **** 1: enum type ***** followed by: ****** UInt32 number N1 of members ****** N1 * tuple of: ******* Offset of Idx-Name ******* UInt32 + **** 2: plain struct type (with base if flag is 1) ***** followed by: ****** if "with base": Offset of Idx-Name @@ -60,6 +79,7 @@ Layout of per-entry payload in the root or a module Map: ****** N1 * tuple of: ******* Offset of Idx-Name name ******* Offset of Idx-Name type + **** 3: polymorphic struct type template ***** followed by: ****** UInt32 number N1 of type parameters @@ -69,6 +89,7 @@ Layout of per-entry payload in the root or a module Map: ******* kind byte: 0x01 bit is 1 if parameterized type ******* Offset of Idx-Name name ******* Offset of Idx-Name type + **** 4: exception type (with base if flag is 1) ***** followed by: ****** if "with base": Offset of Idx-Name @@ -76,6 +97,7 @@ Layout of per-entry payload in the root or a module Map: ****** N1 * tuple of: ******* Offset of Idx-Name name ******* Offset of Idx-Name type + **** 5: interface type ***** followed by: ****** UInt32 number N1 of direct mandatory bases @@ -104,13 +126,16 @@ Layout of per-entry payload in the root or a module Map: ******** Offset of Idx-Name type ******* UInt32 number N8 of exceptions ******* N8 * Offset of Idx-Name + **** 6: typedef ***** followed by: ****** Offset of Idx-Name + **** 7: constant group ***** followed by: ****** UInt32 number N1 of entries of Map ****** N1 * Entry + **** 8: single-interface--based service (with default constructor if flag is 1) ***** followed by: ****** Offset of Idx-Name @@ -125,6 +150,7 @@ Layout of per-entry payload in the root or a module Map: ********* Offset of Idx-Name type ******** UInt32 number N3 of exceptions ******** N3 * Offset of Idx-Name + **** 9: accumulation-based service ***** followed by: ****** UInt32 number N1 of direct mandatory base services @@ -149,9 +175,11 @@ Layout of per-entry payload in the root or a module Map: ******** 0x0001 bit: 1 if maybevoid ******* Offset of Idx-Name name ******* Offset of Idx-Name type + **** 10: interface-based singleton ***** followed by: ****** Offset of Idx-Name + **** 11: service-based singleton ***** followed by: ****** Offset of Idx-Name @@ -161,32 +189,35 @@ Layout of per-entry payload in a constant group Map: * kind byte: ** 0x80 bit: 1 if deprecated ** remaining bits: + *** 0: BOOLEAN **** followed by value byte, 0 represents false, 1 represents true + *** 1: BYTE **** followed by value byte, representing values with two's complement + *** 2: SHORT **** followed by UInt16 value, representing values with two's complement + *** 3: UNSIGNED SHORT **** followed by UInt16 value + *** 4: LONG **** followed by UInt32 value, representing values with two's complement + *** 5: UNSIGNED LONG **** followed by UInt32 value + *** 6: HYPER **** followed by UInt64 value, representing values with two's complement + *** 7: UNSIGNED HYPER **** followed by UInt64 value + *** 8: FLOAT **** followed by 4-byte value, representing values in ISO 60599 binary32 format, LSB first + *** 9: DOUBLE **** followed by 8-byte value, representing values in ISO 60599 binary64 format, LSB first - -Memory layout: - -* 8 byte header "UNOIDL\0\xFF -* Offset of root Map -* UInt32 number of entries of root Map -... _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits