From 17e0e2b91cc434d9a64f4045505fca2f310bbac2 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Wed, 25 Sep 2013 15:26:43 +0200 Subject: [PATCH] Add page for yxml + misc changes --- dat/dump-nccolour | 4 -- dat/ncdc-faq | 8 --- dat/ncdu | 7 +- dat/ncdu-jsonfmt | 6 +- dat/yxml | 166 ++++++++++++++++++++++++++++++++++++++++++++++ index.cgi | 5 +- style.css | 2 +- 7 files changed, 179 insertions(+), 19 deletions(-) create mode 100644 dat/yxml diff --git a/dat/dump-nccolour b/dat/dump-nccolour index 3abf6e8..fd442db 100644 --- a/dat/dump-nccolour +++ b/dat/dump-nccolour @@ -11,10 +11,6 @@ used. B L (L) -Some screenshots can be found below, but more screenshots are always welcome! -Please send your (.png) screenshots to projects@yorhel.nl. - - =head2 Notes / observations =over diff --git a/dat/ncdc-faq b/dat/ncdc-faq index 9d007f2..23fcf76 100644 --- a/dat/ncdc-faq +++ b/dat/ncdc-faq @@ -80,14 +80,6 @@ on OS X, L may be helpful. -=head2 This "Generating certificates..." is taking ages! - -If you're on Linux with ncdc 1.14 or older and a GnuTLS older than 3.0, then -creating the certificates required access to C to obtain random -data. This could take a while to complete, especially on headless servers and -low-end devices. Updating to ncdc 1.15 or later should fix this. - - =head2 Ncdc crashes a lot! Ncdc 1.17 has no known bugs that may cause a crash. If you're running an diff --git a/dat/ncdu b/dat/ncdu index d2b1352..1997d0d 100644 --- a/dat/ncdu +++ b/dat/ncdu @@ -49,7 +49,7 @@ L - L - L - L - -L - +L - L - L - L - @@ -61,13 +61,16 @@ Mac OS X (L - L - L - L - -Slackware (L - L) - +Slackware (L - L) - L - L Packages for CentOS, RHEL and (open)SUSE can be found on the L. +Packages for NetBSD, DragonFlyBSD, MirBSD and others and be found on +L. + =head2 Similar projects diff --git a/dat/ncdu-jsonfmt b/dat/ncdu-jsonfmt index 26ce662..4de72bc 100644 --- a/dat/ncdu-jsonfmt +++ b/dat/ncdu-jsonfmt @@ -1,6 +1,6 @@ =pod -This document describes the file format that ncdu 1.9 uses for its +This document describes the file format that ncdu 1.9 and 1.10 uses for its export/import feature (the C<-o> and C<-f> options). Check the L for a description on how to use that feature. @@ -29,7 +29,7 @@ the existing format. =head2 Metadata The C<< >> element is a JSON object holding whatever (short) -metadata you'd want. This block is currently (1.9) ignored by ncdu when +metadata you'd want. This block is currently (1.9-1.10) ignored by ncdu when importing, but it writes out the following keys when exporting: =over @@ -40,7 +40,7 @@ String, name of the program that generated the file, i.e. C<"ncdu">. =item progver -String, version of the program that generated the file, e.g. C<"1.9">. +String, version of the program that generated the file, e.g. C<"1.10">. =item timestamp diff --git a/dat/yxml b/dat/yxml new file mode 100644 index 0000000..1359995 --- /dev/null +++ b/dat/yxml @@ -0,0 +1,166 @@ +=pod + +I<*But see the L below.> + +Yxml is a small (C<6 KiB>) non-validating yet mostly conforming XML parser +written in C. Its primary goals are small binary size, simplicity and +correctness. It also happens to be L. + +The code can be obtained from the L and +is available under a permissive MIT license. The only two files you need are +L and +L, which can easily be +included and compiled as part of your project. Minimal documentation is +included in yxml.h, more complete documentation is pending. + +The API follows a simple, mostly buffer-less design and only consists of two +functions: + + void yxml_init(yxml_t *x, char *stack, size_t stacksize); + yxml_ret_t yxml_parse(yxml_t *x, int ch); + +Be aware that I is not necessarily I or I. The API is +relatively low-level and designed to integrate into pretty much any application +and for any use case. This includes incrementally parsing data from a socket in +an event-driven fashion and parsing large XML files on memory-restricted +devices. It is possible to implement a more convenient and high-level API on +top of yxml, but I'm not very fond of libraries that do more than what I +strictly need. + +Yxml is still in a beta stage and hasn't been very thoroughly tested yet. There +are no tarball releases available at the moment. The API and ABI may still +change a bit, so I strongly advise against dynamic linking (I'm not sure if +I'll ever promise a stable ABI, but the API should certainly get stabilized at +some point). + +=head3 Features + +=over + +=item * Simple and low-level API. + +=item * Does not require C. + +=item * Pure C, should be very portable. + +=item * Recognizes and consumes the UTF-8 BOM. + +=item * Parses entity references (C<&>) and character references (C<&>). + +=item * Verifies most well-formedness constraints, including the correct +nesting of elements. + +=item * Parses XML documents in any ASCII-compatible encoding. + +=back + +But let's not be I optimistic, because there are also... + +=head3 Bugs and Limitations + +=over + +=item * Element and Attribute names may only consist of ASCII characters. + +=item * Does not verify that non-ASCII characters in attribute values or +element contents are within the allowed character ranges. + +=item * A conditional section in a C<< >> declaration will result +in a parse error. + +=item * Allows multiple C<< >> declarations. + +=item * Information encoded in the XML and doctype declarations is currently +not available through the API. + +=back + +I hope to have these issues fixed in the near future. + +=head3 Non-features + +And now follows a list of things that are not supported and probably never will +be. Most items on this list can be implemented on top of yxml. + +=over + +=item * Does not verify all well-formedness constraints. In particular, does +not verify that attribute names within the same element are unique, and does +not verify that the contents of a C<< >> declaration follow the +XML grammar. + +=item * No helper functions to deal with namespaces. Yxml will parse XML files +with namespaces just fine, but it's up to the application to do the rest. + +=item * No support for custom entity references, neither through the API nor +using C<< >>. + +=item * No DTD or XML Schema validation. + +=item * No XSLT. + +=item * No XPath. + +=item * Can't parse documents in a non-ASCII-compatible encoding. You'll have +to convert it to UTF-8 or something similar first. + +=item * Doesn't do your household chores. + +=back + + +=head2 Comparison + +The following benchmark compares L, +L and +L with yxml. A L +implementation is also included as an indication of the "theoretical" minimum. + + SIZE PERFORMANCE + LIB VER LICENSE OBJ STATIC WIKI DISCOGS + strlen 25 816 0.16 0.09 + expat 2.1.0 MIT 162 139 194 432 1.47 1.09 + libxml2 2.9.1 MIT 464 328 518 816 2.53 1.75 + mxml 2.7 LGPL2+static 32 733 75 832 12.38 7.80 + yxml git MIT 6 015 31 448 1.18 0.73 + +The code for these benchmarks is available in the +L directory on git. Some +explanatory notes: + +=over + +=item * C is the total size of all object code of the library, measured +with L. + +=item * C is the file size of a minimal statically linked binary when +linked against L 0.9.13, measured with +L after running L. + +=item * The performance is the time, in seconds, to load a large XML file. +C refers to C (162 MiB) from a L, C refers to +C (94 MiB) from a L. + +=item * Libxml2 has been compiled with most of its features disabled with +C<./configure>, but it still manages to be the very definition of bloat. + +=item * Everything has been compiled with gcc 4.8.1 at C<-O2>. + +=item * Benchmarks are run on Linux 3.10.7 with a 3 Ghz Intel Core Duo E8400 +and with 4GB RAM. + +=back + +And just for fun, here's the same comparison when compiled with C<-Os>, i.e. +optimized for small size. Interestingly enough, Mini-XML actually runs faster +with C<-Os> than with C<-O2>. + + SIZE PERFORMANCE + LIB VER LICENSE OBJ STATIC WIKI DISCOGS + strlen 25 816 0.16 0.09 + expat 2.1.0 MIT 113 314 145 632 1.58 1.20 + libxml2 2.9.1 MIT 356 948 412 256 3.01 2.08 + mxml 2.7 LGPL2+static 27 725 71 704 11.70 7.44 + yxml git MIT 4 835 30 264 1.72 1.05 diff --git a/index.cgi b/index.cgi index 5b2bf85..44f422f 100755 --- a/index.cgi +++ b/index.cgi @@ -12,6 +12,7 @@ BEGIN { ($ROOT = abs_path $0) =~ s{index\.cgi$}{}; } my @changes = ( + [ '2013-09-03', '/yxml', 'Announcing yxml: A small, fast and correct XML parser' ], [ '2013-07-05', '/dump/insbench', 'Documented a little data structure benchmark' ], [ '2013-06-15', '/ncdc', 'ncdc 1.17 released' ], [ '2013-05-09', '/ncdu', 'ncdu 1.10 released' ], @@ -96,6 +97,7 @@ TUWF::register( qr{tuwf/man(?:/(db|misc|request|response|xml))?} => \&tuwfmanual, qr{tuwf/changes} => sub { changelog(shift, 'tuwf-changelog', 'TUWF', 'tuwf', 'changes', 'TUWF Changelog') }, qr{ylib} => sub { podpage(shift, 'ylib/README.pod', 'ylib', '', 'Ylib') }, + qr{yxml} => sub { podpage(shift, 'yxml', 'yxml', '', 'Yxml - A small, fast and correct* XML parser') }, qr{doc} => sub { podpage(shift, 'doc', 'doc', '', 'Articles') }, qr{doc/sqlaccess} => sub { podpage(shift, 'sqlaccess', 'doc', '', 'Multi-threaded Access to an SQLite3 Database', 1) }, qr{doc/commvis} => sub { podpage(shift, 'doc-commvis', 'doc', '', 'A Distributed Communication System for Modular Applications', 1) }, @@ -454,7 +456,7 @@ sub htmlHeader { sub htmlFooter { end 'div'; # main div id => 'footer'; - p 'my software, your toaster'; + p 'all lefts and rights reversed'; end; end 'div'; # body end 'body'; @@ -522,6 +524,7 @@ sub htmlMenu { $m->('/globster', 'Globster '); $m->('/tuwf', 'Tuwf '); $m->('/ylib', 'Ylib', $o{page} eq 'ylib'); + $m->('/yxml', 'Yxml', $o{page} eq 'yxml'); $m->('/doc', 'Articles', $o{page} eq 'doc'); $m->('/dump', 'Code dump', $o{page} eq 'dump', sub { $m->('/dump', 'Misc.', $o{page} eq 'dump' && !$o{sec}); diff --git a/style.css b/style.css index b306e91..2db9953 100644 --- a/style.css +++ b/style.css @@ -47,7 +47,7 @@ pre.interface { border-left: 3px solid #03a; font-size: 12px } dd { margin-left: 15px } dt a { color: #333 } dt { margin-left: 15px } -i { font-style: italic } +i, i a { font-style: italic } .sig { vertical-align: super } .sig, .sig a { font-size: 9px; color: #333; text-decoration: none } textarea, input, select { background: #fcfcfc; color: #000; border: 1px solid #999 }