mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-24 03:15:30 +00:00
Remove unused code and update docos.
This commit is contained in:
parent
30fedd64d8
commit
99736682f1
@ -51,7 +51,7 @@ integrated Mini-XML into Gutenprint and removed libxml2.
|
||||
|
||||
Thanks to lots of feedback and support from various developers, Mini-XML has
|
||||
evolved since then to provide a more complete XML implementation and now stands
|
||||
at a whopping 4,371 lines of code, compared to 175,808 lines of code for libxml2
|
||||
at a whopping 3,751 lines of code, compared to 175,808 lines of code for libxml2
|
||||
version 2.11.7.
|
||||
|
||||
|
||||
|
BIN
doc/mxml.epub
BIN
doc/mxml.epub
Binary file not shown.
@ -428,7 +428,7 @@ span.string {
|
||||
<p>Given the limited scope of what you use in XML, it should be trivial to code a mini-XML API in a few hundred lines of code.</p>
|
||||
</blockquote>
|
||||
<p>I took my own challenge and coded furiously for two days to produced the initial public release of Mini-XML, total lines of code: 696. Robert promptly integrated Mini-XML into Gutenprint and removed libxml2.</p>
|
||||
<p>Thanks to lots of feedback and support from various developers, Mini-XML has evolved since then to provide a more complete XML implementation and now stands at a whopping 4,371 lines of code, compared to 175,808 lines of code for libxml2 version 2.11.7.</p>
|
||||
<p>Thanks to lots of feedback and support from various developers, Mini-XML has evolved since then to provide a more complete XML implementation and now stands at a whopping 3,751 lines of code, compared to 175,808 lines of code for libxml2 version 2.11.7.</p>
|
||||
<h3 class="title" id="resources">Resources</h3>
|
||||
<p>The Mini-XML home page can be found at <a href="https://www.msweet.org/mxml">https://www.msweet.org/mxml</a>. From there you can download the current version of Mini-XML, access the issue tracker, and find other resources.</p>
|
||||
<h3 class="title" id="legal-stuff">Legal Stuff</h3>
|
||||
|
49
mxml-file.c
49
mxml-file.c
@ -55,7 +55,6 @@ static inline int mxml_isspace(int ch)
|
||||
}
|
||||
static mxml_node_t *mxml_load_data(mxml_read_cb_t read_cb, void *read_cbdata, mxml_node_t *top, mxml_load_cb_t load_cb, void *load_cbdata, mxml_sax_cb_t sax_cb, void *sax_data);
|
||||
static int mxml_parse_element(mxml_read_cb_t read_cb, void *read_cbdata, mxml_node_t *node, _mxml_encoding_t *encoding, int *line);
|
||||
static bool mxml_putc(mxml_write_cb_t write_cb, void *write_cbdata, int ch);
|
||||
static ssize_t mxml_read_cb_fd(int *fd, void *buffer, size_t bytes);
|
||||
static ssize_t mxml_read_cb_file(FILE *fp, void *buffer, size_t bytes);
|
||||
static ssize_t mxml_read_cb_string(_mxml_stringbuf_t *sb, void *buffer, size_t bytes);
|
||||
@ -1825,54 +1824,6 @@ mxml_parse_element(
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'mxml_putc()' - Write a single Unicode character with UTF-8 encoding.
|
||||
//
|
||||
|
||||
static bool // O - `true` on success, `false` on error
|
||||
mxml_putc(mxml_write_cb_t write_cb, // I - Write callback function
|
||||
void *write_cbdata,// I - Write callback data
|
||||
int ch) // I - Character to write
|
||||
{
|
||||
size_t bytes; // Number of bytes
|
||||
unsigned char buffer[4]; // Output buffer
|
||||
|
||||
|
||||
if (ch < 128)
|
||||
{
|
||||
// One byte
|
||||
bytes = 1;
|
||||
buffer[0] = (unsigned char)ch;
|
||||
}
|
||||
else if (ch < 0x800)
|
||||
{
|
||||
// Two bytes
|
||||
bytes = 2;
|
||||
buffer[0] = (unsigned char)(0xc0 | ((ch >> 6) & 0x1f));
|
||||
buffer[1] = (unsigned char)(0x80 | (ch & 0x3f));
|
||||
}
|
||||
else if (ch < 0x10000)
|
||||
{
|
||||
// Three bytes
|
||||
bytes = 3;
|
||||
buffer[0] = (unsigned char)(0xe0 | ((ch >> 12) & 0x0f));
|
||||
buffer[1] = (unsigned char)(0x80 | ((ch >> 6) & 0x3f));
|
||||
buffer[2] = (unsigned char)(0x80 | (ch & 0x3f));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Four bytes
|
||||
bytes = 4;
|
||||
buffer[0] = (unsigned char)(0xf0 | ((ch >> 18) & 0x07));
|
||||
buffer[1] = (unsigned char)(0x80 | ((ch >> 12) & 0x3f));
|
||||
buffer[2] = (unsigned char)(0x80 | ((ch >> 6) & 0x3f));
|
||||
buffer[3] = (unsigned char)(0x80 | (ch & 0x3f));
|
||||
}
|
||||
|
||||
return ((write_cb)(write_cbdata, buffer, bytes) == (ssize_t)bytes);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'mxml_read_cb_fd()' - Read bytes from a file descriptor.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user