2003-06-04 03:07:47 +00:00
|
|
|
/*
|
2003-12-03 22:22:49 +00:00
|
|
|
* "$Id: mxmldoc.c,v 1.21 2003/12/03 22:22:49 mike Exp $"
|
2003-06-04 03:07:47 +00:00
|
|
|
*
|
2003-06-04 16:30:40 +00:00
|
|
|
* Documentation generator using mini-XML, a small XML-like file parsing
|
2003-06-04 03:07:47 +00:00
|
|
|
* library.
|
|
|
|
*
|
|
|
|
* Copyright 2003 by Michael Sweet.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* Contents:
|
|
|
|
*
|
2003-06-14 22:14:17 +00:00
|
|
|
* main() - Main entry for test program.
|
|
|
|
* add_variable() - Add a variable or argument.
|
2003-12-03 03:59:04 +00:00
|
|
|
* safe_strcpy() - Copy a string allowing for overlapping strings.
|
2003-06-14 22:14:17 +00:00
|
|
|
* scan_file() - Scan a source file.
|
|
|
|
* sort_node() - Insert a node sorted into a tree.
|
|
|
|
* update_comment() - Update a comment node.
|
|
|
|
* write_documentation() - Write HTML documentation.
|
|
|
|
* write_element() - Write an elements text nodes.
|
|
|
|
* write_string() - Write a string, quoting XHTML special chars
|
|
|
|
* as needed...
|
|
|
|
* ws_cb() - Whitespace callback for saving.
|
2003-06-04 03:07:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Include necessary headers...
|
|
|
|
*/
|
|
|
|
|
2003-07-20 13:41:17 +00:00
|
|
|
#include "config.h"
|
2003-07-27 23:11:40 +00:00
|
|
|
#include "mxml.h"
|
2003-06-04 03:07:47 +00:00
|
|
|
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
/*
|
|
|
|
* This program scans source and header files and produces public API
|
|
|
|
* documentation for code that conforms to the CUPS Configuration
|
|
|
|
* Management Plan (CMP) coding standards. Please see the following web
|
|
|
|
* page for details:
|
|
|
|
*
|
|
|
|
* http://www.cups.org/cmp.html
|
|
|
|
*
|
|
|
|
* Using Mini-XML, this program creates and maintains an XML representation
|
|
|
|
* of the public API code documentation which can then be converted to HTML
|
|
|
|
* as desired. The following is a poor-man's schema:
|
|
|
|
*
|
2003-06-05 12:11:53 +00:00
|
|
|
* <?xml version="1.0"?>
|
|
|
|
* <namespace name=""> [optional...]
|
2003-06-04 16:30:40 +00:00
|
|
|
* <constant name="">
|
|
|
|
* <description>descriptive text</description>
|
|
|
|
* </constant>
|
|
|
|
*
|
|
|
|
* <enumeration name="">
|
|
|
|
* <constant name="">...</constant>
|
|
|
|
* </enumeration>
|
|
|
|
*
|
|
|
|
* <typedef name="">
|
|
|
|
* <description>descriptive text</description>
|
|
|
|
* <type>type string</type>
|
|
|
|
* </typedef>
|
|
|
|
*
|
|
|
|
* <function name="">
|
|
|
|
* <description>descriptive text</description>
|
2003-06-04 21:19:00 +00:00
|
|
|
* <argument name="" direction="I|O|IO">
|
2003-06-04 16:30:40 +00:00
|
|
|
* <description>descriptive text</description>
|
|
|
|
* <type>type string</type>
|
2003-06-04 21:19:00 +00:00
|
|
|
* </argument>
|
2003-06-04 16:30:40 +00:00
|
|
|
* <returnvalue>
|
|
|
|
* <description>descriptive text</description>
|
|
|
|
* <type>type string</type>
|
|
|
|
* </returnvalue>
|
|
|
|
* <seealso>function names separated by spaces</seealso>
|
|
|
|
* </function>
|
|
|
|
*
|
|
|
|
* <variable name="">
|
|
|
|
* <description>descriptive text</description>
|
|
|
|
* <type>type string</type>
|
|
|
|
* </variable>
|
|
|
|
*
|
|
|
|
* <struct name="">
|
|
|
|
* <description>descriptive text</description>
|
|
|
|
* <variable name="">...</variable>
|
|
|
|
* <function name="">...</function>
|
|
|
|
* </struct>
|
|
|
|
*
|
|
|
|
* <class name="" parent="">
|
|
|
|
* <description>descriptive text</description>
|
|
|
|
* <class name="">...</class>
|
|
|
|
* <enumeration name="">...</enumeration>
|
|
|
|
* <function name="">...</function>
|
|
|
|
* <struct name="">...</struct>
|
|
|
|
* <variable name="">...</variable>
|
|
|
|
* </class>
|
|
|
|
* </namespace>
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2003-12-03 03:59:04 +00:00
|
|
|
/*
|
|
|
|
* Basic states for file parser...
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define STATE_NONE 0 /* No state - whitespace, etc. */
|
|
|
|
#define STATE_PREPROCESSOR 1 /* Preprocessor directive */
|
|
|
|
#define STATE_C_COMMENT 2 /* Inside a C comment */
|
|
|
|
#define STATE_CXX_COMMENT 3 /* Inside a C++ comment */
|
|
|
|
#define STATE_STRING 4 /* Inside a string constant */
|
|
|
|
#define STATE_CHARACTER 5 /* Inside a character constant */
|
|
|
|
#define STATE_IDENTIFIER 6 /* Inside a keyword/identifier */
|
|
|
|
|
|
|
|
|
2003-06-04 03:07:47 +00:00
|
|
|
/*
|
|
|
|
* Local functions...
|
|
|
|
*/
|
|
|
|
|
2003-06-06 03:09:31 +00:00
|
|
|
static mxml_node_t *add_variable(mxml_node_t *parent, const char *name,
|
|
|
|
mxml_node_t *type);
|
2003-12-03 03:59:04 +00:00
|
|
|
static void safe_strcpy(char *dst, const char *src);
|
2003-06-04 16:30:40 +00:00
|
|
|
static int scan_file(const char *filename, FILE *fp,
|
|
|
|
mxml_node_t *doc);
|
2003-06-04 17:37:23 +00:00
|
|
|
static void sort_node(mxml_node_t *tree, mxml_node_t *func);
|
2003-06-05 03:06:20 +00:00
|
|
|
static void update_comment(mxml_node_t *parent,
|
|
|
|
mxml_node_t *comment);
|
2003-06-05 12:11:53 +00:00
|
|
|
static void write_documentation(mxml_node_t *doc);
|
2003-06-14 23:56:47 +00:00
|
|
|
static void write_element(mxml_node_t *doc, mxml_node_t *element);
|
2003-06-05 13:49:14 +00:00
|
|
|
static void write_string(const char *s);
|
2003-06-04 23:20:31 +00:00
|
|
|
static int ws_cb(mxml_node_t *node, int where);
|
2003-06-04 03:07:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 'main()' - Main entry for test program.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int /* O - Exit status */
|
|
|
|
main(int argc, /* I - Number of command-line args */
|
|
|
|
char *argv[]) /* I - Command-line args */
|
|
|
|
{
|
2003-06-04 16:30:40 +00:00
|
|
|
int i; /* Looping var */
|
2003-06-04 03:07:47 +00:00
|
|
|
FILE *fp; /* File to read */
|
2003-06-04 16:30:40 +00:00
|
|
|
mxml_node_t *doc; /* XML documentation tree */
|
2003-06-04 03:07:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check arguments...
|
|
|
|
*/
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
if (argc < 2)
|
2003-06-04 03:07:47 +00:00
|
|
|
{
|
2003-06-04 16:30:40 +00:00
|
|
|
fputs("Usage: mxmldoc filename.xml [source files] >filename.html\n", stderr);
|
2003-06-04 03:07:47 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2003-06-04 16:30:40 +00:00
|
|
|
* Read the XML documentation file, if it exists...
|
2003-06-04 03:07:47 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
if ((fp = fopen(argv[1], "r")) != NULL)
|
2003-06-04 03:07:47 +00:00
|
|
|
{
|
2003-06-04 16:30:40 +00:00
|
|
|
/*
|
|
|
|
* Read the existing XML file...
|
|
|
|
*/
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
doc = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK);
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
fclose(fp);
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
if (!doc)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Unable to read the XML documentation file \"%s\"!\n",
|
|
|
|
argv[1]);
|
|
|
|
return (1);
|
|
|
|
}
|
2003-06-04 03:07:47 +00:00
|
|
|
}
|
2003-06-04 16:30:40 +00:00
|
|
|
else
|
2003-06-04 03:07:47 +00:00
|
|
|
{
|
|
|
|
/*
|
2003-06-04 16:30:40 +00:00
|
|
|
* Create an empty XML documentation file...
|
2003-06-04 03:07:47 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-04 23:20:31 +00:00
|
|
|
doc = mxmlNewElement(NULL, "?xml");
|
|
|
|
mxmlElementSetAttr(doc, "version", "1.0");
|
2003-06-04 16:30:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Loop through all of the source files...
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (i = 2; i < argc; i ++)
|
|
|
|
if ((fp = fopen(argv[i], "r")) == NULL)
|
2003-06-04 03:07:47 +00:00
|
|
|
{
|
2003-06-04 16:30:40 +00:00
|
|
|
fprintf(stderr, "Unable to open source file \"%s\": %s\n", argv[i],
|
|
|
|
strerror(errno));
|
|
|
|
mxmlDelete(doc);
|
2003-06-04 03:07:47 +00:00
|
|
|
return (1);
|
|
|
|
}
|
2003-06-04 16:30:40 +00:00
|
|
|
else if (scan_file(argv[i], fp, doc))
|
2003-06-04 03:07:47 +00:00
|
|
|
{
|
2003-06-04 16:30:40 +00:00
|
|
|
fclose(fp);
|
|
|
|
mxmlDelete(doc);
|
2003-06-04 03:07:47 +00:00
|
|
|
return (1);
|
|
|
|
}
|
2003-06-04 16:30:40 +00:00
|
|
|
else
|
|
|
|
fclose(fp);
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
if (argc > 2)
|
2003-06-04 16:30:40 +00:00
|
|
|
{
|
|
|
|
/*
|
2003-06-05 12:11:53 +00:00
|
|
|
* Save the updated XML documentation file...
|
2003-06-04 16:30:40 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
if ((fp = fopen(argv[1], "w")) != NULL)
|
2003-06-04 16:30:40 +00:00
|
|
|
{
|
2003-06-05 12:11:53 +00:00
|
|
|
/*
|
|
|
|
* Write over the existing XML file...
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (mxmlSaveFile(doc, fp, ws_cb))
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Unable to write the XML documentation file \"%s\": %s!\n",
|
|
|
|
argv[1], strerror(errno));
|
|
|
|
fclose(fp);
|
|
|
|
mxmlDelete(doc);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
fclose(fp);
|
2003-06-05 12:11:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Unable to create the XML documentation file \"%s\": %s!\n",
|
|
|
|
argv[1], strerror(errno));
|
2003-06-04 16:30:40 +00:00
|
|
|
mxmlDelete(doc);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
/*
|
|
|
|
* Write HTML documentation...
|
|
|
|
*/
|
|
|
|
|
|
|
|
write_documentation(doc);
|
|
|
|
|
2003-06-04 03:07:47 +00:00
|
|
|
/*
|
|
|
|
* Delete the tree and return...
|
|
|
|
*/
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
mxmlDelete(doc);
|
2003-06-04 03:07:47 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-06 03:09:31 +00:00
|
|
|
/*
|
|
|
|
* 'add_variable()' - Add a variable or argument.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static mxml_node_t * /* O - New variable/argument */
|
|
|
|
add_variable(mxml_node_t *parent, /* I - Parent node */
|
|
|
|
const char *name, /* I - "argument" or "variable" */
|
|
|
|
mxml_node_t *type) /* I - Type nodes */
|
|
|
|
{
|
|
|
|
mxml_node_t *variable, /* New variable */
|
|
|
|
*node, /* Current node */
|
|
|
|
*next; /* Next node */
|
|
|
|
char buffer[16384], /* String buffer */
|
|
|
|
*bufptr; /* Pointer into buffer */
|
|
|
|
|
|
|
|
|
|
|
|
if (!type || !type->child)
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
variable = mxmlNewElement(parent, name);
|
|
|
|
|
|
|
|
if (type->last_child->value.text.string[0] == ')')
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Handle "type (*name)(args)"...
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (node = type->child; node; node = node->next)
|
|
|
|
if (node->value.text.string[0] == '(')
|
|
|
|
break;
|
|
|
|
|
|
|
|
for (bufptr = buffer; node; bufptr += strlen(bufptr))
|
|
|
|
{
|
|
|
|
if (node->value.text.whitespace)
|
|
|
|
*bufptr++ = ' ';
|
|
|
|
|
|
|
|
strcpy(bufptr, node->value.text.string);
|
|
|
|
|
|
|
|
next = node->next;
|
|
|
|
mxmlDelete(node);
|
|
|
|
node = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Handle "type name"...
|
|
|
|
*/
|
|
|
|
|
|
|
|
strcpy(buffer, type->last_child->value.text.string);
|
|
|
|
mxmlDelete(type->last_child);
|
|
|
|
}
|
|
|
|
|
|
|
|
mxmlElementSetAttr(variable, "name", buffer);
|
|
|
|
|
|
|
|
mxmlAdd(variable, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, type);
|
|
|
|
|
|
|
|
return (variable);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-04 21:19:00 +00:00
|
|
|
/*
|
2003-12-03 03:59:04 +00:00
|
|
|
* 'safe_strcpy()' - Copy a string allowing for overlapping strings.
|
2003-06-04 21:19:00 +00:00
|
|
|
*/
|
|
|
|
|
2003-12-03 03:59:04 +00:00
|
|
|
static void
|
|
|
|
safe_strcpy(char *dst, /* I - Destination string */
|
|
|
|
const char *src) /* I - Source string */
|
|
|
|
{
|
|
|
|
while (*src)
|
|
|
|
*dst++ = *src++;
|
|
|
|
|
|
|
|
*dst = '\0';
|
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
|
2003-06-04 03:07:47 +00:00
|
|
|
/*
|
2003-06-04 17:37:23 +00:00
|
|
|
* 'scan_file()' - Scan a source file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int /* O - 0 on success, -1 on error */
|
|
|
|
scan_file(const char *filename, /* I - Filename */
|
|
|
|
FILE *fp, /* I - File to scan */
|
|
|
|
mxml_node_t *tree) /* I - Function tree */
|
|
|
|
{
|
2003-06-04 21:19:00 +00:00
|
|
|
int state, /* Current parser state */
|
|
|
|
braces, /* Number of braces active */
|
|
|
|
parens; /* Number of active parenthesis */
|
2003-06-06 03:09:31 +00:00
|
|
|
int ch; /* Current character */
|
2003-12-03 03:59:04 +00:00
|
|
|
char buffer[65536], /* String buffer */
|
2003-06-06 03:09:31 +00:00
|
|
|
*bufptr; /* Pointer into buffer */
|
2003-06-04 21:19:00 +00:00
|
|
|
mxml_node_t *comment, /* <comment> node */
|
2003-06-07 21:27:05 +00:00
|
|
|
*constant, /* <constant> node */
|
|
|
|
*enumeration, /* <enumeration> node */
|
2003-06-04 21:19:00 +00:00
|
|
|
*function, /* <function> node */
|
2003-06-07 21:27:05 +00:00
|
|
|
*structclass, /* <struct> or <class> node */
|
|
|
|
*typedefnode, /* <typedef> node */
|
2003-06-04 21:19:00 +00:00
|
|
|
*variable, /* <variable> or <argument> node */
|
|
|
|
*returnvalue, /* <returnvalue> node */
|
|
|
|
*type, /* <type> node */
|
|
|
|
*description; /* <description> node */
|
2003-06-06 03:09:31 +00:00
|
|
|
#if DEBUG > 1
|
2003-06-07 21:27:05 +00:00
|
|
|
mxml_node_t *temp; /* Temporary node */
|
2003-06-05 03:06:20 +00:00
|
|
|
int oldstate, /* Previous state */
|
|
|
|
oldch; /* Old character */
|
|
|
|
static const char *states[] = /* State strings */
|
2003-06-04 21:19:00 +00:00
|
|
|
{
|
|
|
|
"STATE_NONE",
|
|
|
|
"STATE_PREPROCESSOR",
|
|
|
|
"STATE_C_COMMENT",
|
|
|
|
"STATE_CXX_COMMENT",
|
|
|
|
"STATE_STRING",
|
|
|
|
"STATE_CHARACTER",
|
|
|
|
"STATE_IDENTIFIER"
|
|
|
|
};
|
2003-06-06 03:09:31 +00:00
|
|
|
#endif /* DEBUG > 1 */
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the finite state machine...
|
|
|
|
*/
|
|
|
|
|
|
|
|
state = STATE_NONE;
|
|
|
|
braces = 0;
|
|
|
|
parens = 0;
|
|
|
|
bufptr = buffer;
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
comment = mxmlNewElement(MXML_NO_PARENT, "temp");
|
2003-06-07 21:27:05 +00:00
|
|
|
constant = NULL;
|
|
|
|
enumeration = NULL;
|
2003-06-04 21:19:00 +00:00
|
|
|
function = NULL;
|
|
|
|
variable = NULL;
|
|
|
|
returnvalue = NULL;
|
|
|
|
type = NULL;
|
|
|
|
description = NULL;
|
2003-06-07 21:27:05 +00:00
|
|
|
typedefnode = NULL;
|
|
|
|
structclass = NULL;
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Read until end-of-file...
|
|
|
|
*/
|
|
|
|
|
|
|
|
while ((ch = getc(fp)) != EOF)
|
|
|
|
{
|
2003-06-06 03:09:31 +00:00
|
|
|
#if DEBUG > 1
|
2003-06-04 21:19:00 +00:00
|
|
|
oldstate = state;
|
|
|
|
oldch = ch;
|
2003-06-06 03:09:31 +00:00
|
|
|
#endif /* DEBUG > 1 */
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case STATE_NONE : /* No state - whitespace, etc. */
|
|
|
|
switch (ch)
|
|
|
|
{
|
|
|
|
case '/' : /* Possible C/C++ comment */
|
|
|
|
ch = getc(fp);
|
|
|
|
bufptr = buffer;
|
|
|
|
|
|
|
|
if (ch == '*')
|
|
|
|
state = STATE_C_COMMENT;
|
|
|
|
else if (ch == '/')
|
|
|
|
state = STATE_CXX_COMMENT;
|
|
|
|
else
|
|
|
|
ungetc(ch, fp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '#' : /* Preprocessor */
|
2003-12-03 04:26:30 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" #preprocessor...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-04 21:19:00 +00:00
|
|
|
state = STATE_PREPROCESSOR;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\'' : /* Character constant */
|
|
|
|
state = STATE_CHARACTER;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\"' : /* String constant */
|
|
|
|
state = STATE_STRING;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '{' :
|
2003-06-07 21:27:05 +00:00
|
|
|
#ifdef DEBUG
|
2003-12-03 04:26:30 +00:00
|
|
|
fprintf(stderr, " open brace, function=%p, type=%p...\n",
|
|
|
|
function, type);
|
|
|
|
if (type)
|
|
|
|
fprintf(stderr, " type->child=\"%s\"...\n",
|
|
|
|
type->child->value.text.string);
|
2003-06-07 21:27:05 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
if (function)
|
2003-06-07 21:27:05 +00:00
|
|
|
sort_node(tree, function);
|
|
|
|
else if (type && type->child &&
|
|
|
|
((!strcmp(type->child->value.text.string, "typedef") &&
|
|
|
|
type->child->next &&
|
|
|
|
(!strcmp(type->child->next->value.text.string, "struct") ||
|
|
|
|
!strcmp(type->child->next->value.text.string, "union") ||
|
|
|
|
!strcmp(type->child->next->value.text.string, "class"))) ||
|
|
|
|
!strcmp(type->child->value.text.string, "union") ||
|
|
|
|
!strcmp(type->child->value.text.string, "struct") ||
|
|
|
|
!strcmp(type->child->value.text.string, "class")))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Start of a class or structure...
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!strcmp(type->child->value.text.string, "typedef"))
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" starting typedef...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef");
|
|
|
|
mxmlDelete(type->child);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
typedefnode = NULL;
|
|
|
|
|
|
|
|
structclass = mxmlNewElement(MXML_NO_PARENT,
|
|
|
|
type->child->value.text.string);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "%c%s: <<<< %s >>>\n",
|
2003-06-07 21:27:05 +00:00
|
|
|
toupper(type->child->value.text.string[0]),
|
|
|
|
type->child->value.text.string + 1,
|
|
|
|
type->child->next ?
|
|
|
|
type->child->next->value.text.string : "(noname)");
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
if (type->child->next)
|
|
|
|
{
|
|
|
|
mxmlElementSetAttr(structclass, "name",
|
|
|
|
type->child->next->value.text.string);
|
|
|
|
sort_node(tree, structclass);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typedefnode && type->child)
|
|
|
|
type->child->value.text.whitespace = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mxmlDelete(type);
|
|
|
|
type = NULL;
|
|
|
|
}
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (typedefnode && comment->last_child)
|
2003-06-14 22:14:17 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Copy comment for typedef as well as class/struct/union...
|
|
|
|
*/
|
|
|
|
|
|
|
|
mxmlNewText(comment, 0,
|
|
|
|
comment->last_child->value.text.string);
|
|
|
|
description = mxmlNewElement(typedefnode, "description");
|
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" duplicating comment for typedef...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
update_comment(typedefnode, comment->last_child);
|
|
|
|
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
|
|
|
comment->last_child);
|
|
|
|
}
|
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
description = mxmlNewElement(structclass, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " adding comment to %s...\n",
|
|
|
|
structclass->value.element.name);
|
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
update_comment(structclass, comment->last_child);
|
|
|
|
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
|
|
|
comment->last_child);
|
|
|
|
|
|
|
|
if (scan_file(filename, fp, structclass))
|
2003-12-03 03:59:04 +00:00
|
|
|
{
|
|
|
|
mxmlDelete(comment);
|
2003-06-07 21:27:05 +00:00
|
|
|
return (-1);
|
2003-12-03 03:59:04 +00:00
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" ended typedef...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-14 23:56:47 +00:00
|
|
|
structclass = NULL;
|
2003-06-07 21:27:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (type && type->child && type->child->next &&
|
|
|
|
(!strcmp(type->child->value.text.string, "enum") ||
|
|
|
|
(!strcmp(type->child->value.text.string, "typedef") &&
|
|
|
|
!strcmp(type->child->next->value.text.string, "enum"))))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Enumeration type...
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!strcmp(type->child->value.text.string, "typedef"))
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" starting typedef...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef");
|
|
|
|
mxmlDelete(type->child);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
typedefnode = NULL;
|
|
|
|
|
|
|
|
enumeration = mxmlNewElement(MXML_NO_PARENT, "enumeration");
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "Enumeration: <<<< %s >>>\n",
|
2003-06-07 21:27:05 +00:00
|
|
|
type->child->next ?
|
|
|
|
type->child->next->value.text.string : "(noname)");
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
if (type->child->next)
|
|
|
|
{
|
|
|
|
mxmlElementSetAttr(enumeration, "name",
|
|
|
|
type->child->next->value.text.string);
|
|
|
|
sort_node(tree, enumeration);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typedefnode && type->child)
|
|
|
|
type->child->value.text.whitespace = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mxmlDelete(type);
|
|
|
|
type = NULL;
|
|
|
|
}
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (typedefnode && comment->last_child)
|
2003-06-14 22:14:17 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Copy comment for typedef as well as class/struct/union...
|
|
|
|
*/
|
|
|
|
|
|
|
|
mxmlNewText(comment, 0,
|
|
|
|
comment->last_child->value.text.string);
|
|
|
|
description = mxmlNewElement(typedefnode, "description");
|
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" duplicating comment for typedef...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
update_comment(typedefnode, comment->last_child);
|
|
|
|
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
|
|
|
comment->last_child);
|
|
|
|
}
|
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
description = mxmlNewElement(enumeration, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to enumeration...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
update_comment(enumeration, comment->last_child);
|
|
|
|
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
|
|
|
comment->last_child);
|
|
|
|
}
|
2003-12-03 22:22:49 +00:00
|
|
|
else if (type && type->child &&
|
|
|
|
!strcmp(type->child->value.text.string, "extern"))
|
|
|
|
{
|
|
|
|
if (scan_file(filename, fp, tree))
|
|
|
|
{
|
|
|
|
mxmlDelete(comment);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
else if (type)
|
|
|
|
{
|
|
|
|
mxmlDelete(type);
|
|
|
|
type = NULL;
|
|
|
|
}
|
2003-06-05 12:11:53 +00:00
|
|
|
|
2003-06-04 21:19:00 +00:00
|
|
|
braces ++;
|
2003-06-04 23:20:31 +00:00
|
|
|
function = NULL;
|
|
|
|
variable = NULL;
|
2003-06-04 21:19:00 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '}' :
|
2003-06-07 21:27:05 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" close brace...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
enumeration = NULL;
|
2003-06-14 22:14:17 +00:00
|
|
|
constant = NULL;
|
2003-06-14 23:56:47 +00:00
|
|
|
structclass = NULL;
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-04 21:19:00 +00:00
|
|
|
if (braces > 0)
|
|
|
|
braces --;
|
2003-06-07 21:27:05 +00:00
|
|
|
else
|
2003-12-03 03:59:04 +00:00
|
|
|
{
|
|
|
|
mxmlDelete(comment);
|
2003-06-07 21:27:05 +00:00
|
|
|
return (0);
|
2003-12-03 03:59:04 +00:00
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '(' :
|
2003-06-06 03:09:31 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fputs("Identifier: <<<< ( >>>\n", stderr);
|
2003-06-06 03:09:31 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
mxmlNewText(type, 0, "(");
|
|
|
|
}
|
|
|
|
|
2003-06-04 21:19:00 +00:00
|
|
|
parens ++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ')' :
|
|
|
|
if (parens > 0)
|
|
|
|
parens --;
|
2003-06-06 03:09:31 +00:00
|
|
|
|
|
|
|
if (type && parens)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fputs("Identifier: <<<< ) >>>\n", stderr);
|
2003-06-06 03:09:31 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
mxmlNewText(type, 0, ")");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (function && type && !parens)
|
|
|
|
{
|
|
|
|
variable = add_variable(function, "argument", type);
|
|
|
|
type = NULL;
|
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
break;
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
case ';' :
|
2003-12-03 04:26:30 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs("Identifier: <<<< ; >>>\n", stderr);
|
|
|
|
fprintf(stderr, " function=%p, type=%p\n", function, type);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
if (function)
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-06-05 12:11:53 +00:00
|
|
|
mxmlDelete(function);
|
2003-06-07 21:27:05 +00:00
|
|
|
function = NULL;
|
|
|
|
}
|
2003-06-05 12:11:53 +00:00
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
mxmlDelete(type);
|
|
|
|
type = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ':' :
|
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fputs("Identifier: <<<< : >>>\n", stderr);
|
2003-06-07 21:27:05 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
mxmlNewText(type, 1, ":");
|
|
|
|
}
|
2003-06-05 03:06:20 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '*' :
|
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fputs("Identifier: <<<< * >>>\n", stderr);
|
2003-06-05 03:06:20 +00:00
|
|
|
#endif /* DEBUG */
|
2003-06-06 03:09:31 +00:00
|
|
|
ch = type->last_child->value.text.string[0];
|
|
|
|
mxmlNewText(type, isalnum(ch) || ch == '_', "*");
|
2003-06-05 03:06:20 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-06-04 21:19:00 +00:00
|
|
|
default : /* Other */
|
2003-09-28 21:09:04 +00:00
|
|
|
if (isalpha(ch) || ch == '_' || ch == '.')
|
2003-06-04 21:19:00 +00:00
|
|
|
{
|
|
|
|
state = STATE_IDENTIFIER;
|
|
|
|
bufptr = buffer;
|
|
|
|
*bufptr++ = ch;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_PREPROCESSOR : /* Preprocessor directive */
|
|
|
|
if (ch == '\n')
|
|
|
|
state = STATE_NONE;
|
|
|
|
else if (ch == '\\')
|
|
|
|
getc(fp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_C_COMMENT : /* Inside a C comment */
|
|
|
|
switch (ch)
|
|
|
|
{
|
|
|
|
case '\n' :
|
|
|
|
while ((ch = getc(fp)) != EOF)
|
|
|
|
if (ch == '*')
|
|
|
|
{
|
|
|
|
ch = getc(fp);
|
|
|
|
|
|
|
|
if (ch == '/')
|
|
|
|
{
|
|
|
|
*bufptr = '\0';
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
if (comment->child != comment->last_child)
|
2003-06-14 22:14:17 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " removing comment %p, last comment %p...\n",
|
|
|
|
comment->child, comment->last_child);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlDelete(comment->child);
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " new comment %p, last comment %p...\n",
|
|
|
|
comment->child, comment->last_child);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " processing comment, variable=%p, constant=%p, tree=\"%s\"\n",
|
|
|
|
variable, constant, tree->value.element.name);
|
|
|
|
#endif /* DEBUG */
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
if (variable)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(variable, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to variable...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 03:06:20 +00:00
|
|
|
update_comment(variable,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
else if (constant)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(constant, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to constant...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
update_comment(constant,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-14 23:56:47 +00:00
|
|
|
else if (typedefnode)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(typedefnode, "description");
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " adding comment to typedef %s...\n",
|
|
|
|
mxmlElementGetAttr(typedefnode, "name"));
|
|
|
|
#endif /* DEBUG */
|
|
|
|
update_comment(typedefnode,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
else if (strcmp(tree->value.element.name, "?xml") &&
|
|
|
|
!mxmlFindElement(tree, tree, "description",
|
|
|
|
NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(tree, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to parent...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
update_comment(tree,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
else
|
2003-06-14 22:14:17 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " before adding comment, child=%p, last_child=%p\n",
|
|
|
|
comment->child, comment->last_child);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlNewText(comment, 0, buffer);
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " after adding comment, child=%p, last_child=%p\n",
|
|
|
|
comment->child, comment->last_child);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
}
|
2003-06-05 03:06:20 +00:00
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "C comment: <<<< %s >>>\n", buffer);
|
2003-06-05 03:06:20 +00:00
|
|
|
#endif /* DEBUG */
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
state = STATE_NONE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ungetc(ch, fp);
|
|
|
|
}
|
2003-06-04 23:20:31 +00:00
|
|
|
else if (ch == '\n' && bufptr > buffer &&
|
|
|
|
bufptr < (buffer + sizeof(buffer) - 1))
|
2003-06-04 21:19:00 +00:00
|
|
|
*bufptr++ = ch;
|
|
|
|
else if (!isspace(ch))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (ch != EOF)
|
|
|
|
ungetc(ch, fp);
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
if (bufptr > buffer && bufptr < (buffer + sizeof(buffer) - 1))
|
2003-06-04 21:19:00 +00:00
|
|
|
*bufptr++ = '\n';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '/' :
|
|
|
|
if (ch == '/' && bufptr > buffer && bufptr[-1] == '*')
|
|
|
|
{
|
|
|
|
while (bufptr > buffer &&
|
|
|
|
(bufptr[-1] == '*' || isspace(bufptr[-1])))
|
|
|
|
bufptr --;
|
|
|
|
*bufptr = '\0';
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
if (comment->child != comment->last_child)
|
2003-06-14 22:14:17 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " removing comment %p, last comment %p...\n",
|
|
|
|
comment->child, comment->last_child);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlDelete(comment->child);
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " new comment %p, last comment %p...\n",
|
|
|
|
comment->child, comment->last_child);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
if (variable)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(variable, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to variable...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 03:06:20 +00:00
|
|
|
update_comment(variable,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
else if (constant)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(constant, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to constant...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
update_comment(constant,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-14 23:56:47 +00:00
|
|
|
else if (typedefnode)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(typedefnode, "description");
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " adding comment to typedef %s...\n",
|
|
|
|
mxmlElementGetAttr(typedefnode, "name"));
|
|
|
|
#endif /* DEBUG */
|
|
|
|
update_comment(typedefnode,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
else if (strcmp(tree->value.element.name, "?xml") &&
|
|
|
|
!mxmlFindElement(tree, tree, "description",
|
|
|
|
NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(tree, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to parent...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
update_comment(tree,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
else
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlNewText(comment, 0, buffer);
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "C comment: <<<< %s >>>\n", buffer);
|
2003-06-05 03:06:20 +00:00
|
|
|
#endif /* DEBUG */
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
state = STATE_NONE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default :
|
|
|
|
if (ch == ' ' && bufptr == buffer)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (bufptr < (buffer + sizeof(buffer) - 1))
|
|
|
|
*bufptr++ = ch;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_CXX_COMMENT : /* Inside a C++ comment */
|
|
|
|
if (ch == '\n')
|
|
|
|
{
|
|
|
|
*bufptr = '\0';
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
if (comment->child != comment->last_child)
|
2003-06-14 22:14:17 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " removing comment %p, last comment %p...\n",
|
|
|
|
comment->child, comment->last_child);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlDelete(comment->child);
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " new comment %p, last comment %p...\n",
|
|
|
|
comment->child, comment->last_child);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
if (variable)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(variable, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to variable...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 03:06:20 +00:00
|
|
|
update_comment(variable,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
else if (constant)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(constant, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to constant...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
update_comment(constant,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-14 23:56:47 +00:00
|
|
|
else if (typedefnode)
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(typedefnode, "description");
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " adding comment to typedef %s...\n",
|
|
|
|
mxmlElementGetAttr(typedefnode, "name"));
|
|
|
|
#endif /* DEBUG */
|
|
|
|
update_comment(typedefnode,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
else if (strcmp(tree->value.element.name, "?xml") &&
|
|
|
|
!mxmlFindElement(tree, tree, "description",
|
|
|
|
NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
{
|
|
|
|
description = mxmlNewElement(tree, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to parent...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
update_comment(tree,
|
|
|
|
mxmlNewText(description, 0, buffer));
|
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
else
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlNewText(comment, 0, buffer);
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "C++ comment: <<<< %s >>>\n", buffer);
|
2003-06-05 03:06:20 +00:00
|
|
|
#endif /* DEBUG */
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
|
|
|
else if (ch == ' ' && bufptr == buffer)
|
|
|
|
break;
|
|
|
|
else if (bufptr < (buffer + sizeof(buffer) - 1))
|
|
|
|
*bufptr++ = ch;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_STRING : /* Inside a string constant */
|
|
|
|
if (ch == '\\')
|
|
|
|
getc(fp);
|
|
|
|
else if (ch == '\"')
|
|
|
|
state = STATE_NONE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_CHARACTER : /* Inside a character constant */
|
|
|
|
if (ch == '\\')
|
|
|
|
getc(fp);
|
|
|
|
else if (ch == '\'')
|
|
|
|
state = STATE_NONE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_IDENTIFIER : /* Inside a keyword or identifier */
|
2003-09-28 21:09:04 +00:00
|
|
|
if (isalnum(ch) || ch == '_' || ch == '[' || ch == ']' ||
|
|
|
|
(ch == ',' && parens > 1) || ch == ':' || ch == '.')
|
2003-06-04 21:19:00 +00:00
|
|
|
{
|
|
|
|
if (bufptr < (buffer + sizeof(buffer) - 1))
|
|
|
|
*bufptr++ = ch;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ungetc(ch, fp);
|
|
|
|
*bufptr = '\0';
|
2003-06-05 03:06:20 +00:00
|
|
|
state = STATE_NONE;
|
2003-06-04 21:19:00 +00:00
|
|
|
|
|
|
|
if (!braces)
|
|
|
|
{
|
|
|
|
if (!type)
|
|
|
|
type = mxmlNewElement(MXML_NO_PARENT, "type");
|
|
|
|
|
2003-06-06 03:09:31 +00:00
|
|
|
#ifdef DEBUG
|
2003-06-07 21:27:05 +00:00
|
|
|
fprintf(stderr, " function=%p (%s), type->child=%p, ch='%c', parens=%d\n",
|
2003-06-06 03:09:31 +00:00
|
|
|
function,
|
|
|
|
function ? mxmlElementGetAttr(function, "name") : "null",
|
2003-06-07 21:27:05 +00:00
|
|
|
type->child, ch, parens);
|
2003-06-06 03:09:31 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2003-06-04 21:19:00 +00:00
|
|
|
if (!function && ch == '(')
|
|
|
|
{
|
2003-06-05 03:06:20 +00:00
|
|
|
if (type->child &&
|
|
|
|
!strcmp(type->child->value.text.string, "extern"))
|
|
|
|
{
|
2003-06-05 13:49:14 +00:00
|
|
|
/*
|
|
|
|
* Remove external declarations...
|
|
|
|
*/
|
|
|
|
|
|
|
|
mxmlDelete(type);
|
|
|
|
type = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type->child &&
|
|
|
|
!strcmp(type->child->value.text.string, "static") &&
|
2003-06-07 21:27:05 +00:00
|
|
|
!strcmp(tree->value.element.name, "?xml"))
|
2003-06-05 13:49:14 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Remove static functions...
|
|
|
|
*/
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlDelete(type);
|
|
|
|
type = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-06-04 21:19:00 +00:00
|
|
|
function = mxmlNewElement(MXML_NO_PARENT, "function");
|
|
|
|
mxmlElementSetAttr(function, "name", buffer);
|
|
|
|
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, "function: %s\n", buffer);
|
|
|
|
fprintf(stderr, " child = (%p) %s\n",
|
|
|
|
comment->child, comment->child->value.text.string);
|
|
|
|
fprintf(stderr, " last_child = (%p) %s\n",
|
|
|
|
comment->last_child,
|
|
|
|
comment->last_child->value.text.string);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
if (!type->last_child ||
|
|
|
|
strcmp(type->last_child->value.text.string, "void"))
|
|
|
|
{
|
|
|
|
returnvalue = mxmlNewElement(function, "returnvalue");
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
description = mxmlNewElement(returnvalue, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to returnvalue...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 12:11:53 +00:00
|
|
|
update_comment(returnvalue, comment->last_child);
|
|
|
|
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
|
|
|
comment->last_child);
|
2003-06-05 03:06:20 +00:00
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
mxmlAdd(returnvalue, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, type);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
mxmlDelete(type);
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
description = mxmlNewElement(function, "description");
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fputs(" adding comment to function...\n", stderr);
|
|
|
|
#endif /* DEBUG */
|
2003-06-05 12:11:53 +00:00
|
|
|
update_comment(function, comment->last_child);
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
2003-06-05 12:11:53 +00:00
|
|
|
comment->last_child);
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
type = NULL;
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
2003-06-06 03:09:31 +00:00
|
|
|
else if (function && ((ch == ')' && parens == 1) || ch == ','))
|
2003-06-04 21:19:00 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Argument definition...
|
|
|
|
*/
|
|
|
|
|
2003-06-06 03:09:31 +00:00
|
|
|
mxmlNewText(type, type->child != NULL &&
|
|
|
|
type->last_child->value.text.string[0] != '(' &&
|
|
|
|
type->last_child->value.text.string[0] != '*',
|
|
|
|
buffer);
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "Argument: <<<< %s >>>\n", buffer);
|
2003-06-07 21:27:05 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2003-06-06 03:09:31 +00:00
|
|
|
variable = add_variable(function, "argument", type);
|
|
|
|
type = NULL;
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
else if (type->child && !function && (ch == ';' || ch == ','))
|
2003-06-04 21:19:00 +00:00
|
|
|
{
|
2003-06-07 21:27:05 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " got semicolon, typedefnode=%p, structclass=%p\n",
|
|
|
|
typedefnode, structclass);
|
|
|
|
#endif /* DEBUG */
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
if (typedefnode || structclass)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "Typedef/struct/class: <<<< %s >>>>\n", buffer);
|
2003-06-07 21:27:05 +00:00
|
|
|
#endif /* DEBUG */
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
if (typedefnode)
|
|
|
|
{
|
|
|
|
mxmlElementSetAttr(typedefnode, "name", buffer);
|
2003-06-04 21:19:00 +00:00
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
sort_node(tree, typedefnode);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (structclass && !mxmlElementGetAttr(structclass, "name"))
|
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
#ifdef DEBUG
|
2003-06-07 21:27:05 +00:00
|
|
|
fprintf(stderr, "setting struct/class name to %s!\n",
|
|
|
|
type->last_child->value.text.string);
|
2003-06-14 23:56:47 +00:00
|
|
|
#endif /* DEBUG */
|
2003-06-07 21:27:05 +00:00
|
|
|
mxmlElementSetAttr(structclass, "name", buffer);
|
|
|
|
|
|
|
|
sort_node(tree, structclass);
|
|
|
|
structclass = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typedefnode)
|
|
|
|
mxmlAdd(typedefnode, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
|
|
|
type);
|
|
|
|
else
|
|
|
|
mxmlDelete(type);
|
|
|
|
|
|
|
|
type = NULL;
|
|
|
|
typedefnode = NULL;
|
|
|
|
}
|
2003-06-14 23:56:47 +00:00
|
|
|
else if (type->child &&
|
|
|
|
!strcmp(type->child->value.text.string, "typedef"))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Simple typedef...
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "Typedef: <<<< %s >>>\n", buffer);
|
2003-06-14 23:56:47 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef");
|
|
|
|
mxmlElementSetAttr(typedefnode, "name", buffer);
|
|
|
|
mxmlDelete(type->child);
|
|
|
|
|
|
|
|
sort_node(tree, typedefnode);
|
|
|
|
|
|
|
|
if (type->child)
|
|
|
|
type->child->value.text.whitespace = 0;
|
|
|
|
|
|
|
|
mxmlAdd(typedefnode, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, type);
|
|
|
|
type = NULL;
|
|
|
|
}
|
2003-06-14 22:14:17 +00:00
|
|
|
else if (!parens)
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Variable definition...
|
|
|
|
*/
|
|
|
|
|
|
|
|
mxmlNewText(type, type->child != NULL &&
|
|
|
|
type->last_child->value.text.string[0] != '(' &&
|
|
|
|
type->last_child->value.text.string[0] != '*',
|
|
|
|
buffer);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "Variable: <<<< %s >>>>\n", buffer);
|
2003-06-07 21:27:05 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
variable = add_variable(MXML_NO_PARENT, "variable", type);
|
|
|
|
type = NULL;
|
|
|
|
|
|
|
|
sort_node(tree, variable);
|
|
|
|
}
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
|
|
|
else
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "Identifier: <<<< %s >>>>\n", buffer);
|
2003-06-07 21:27:05 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2003-06-06 03:09:31 +00:00
|
|
|
mxmlNewText(type, type->child != NULL &&
|
|
|
|
type->last_child->value.text.string[0] != '(' &&
|
|
|
|
type->last_child->value.text.string[0] != '*',
|
|
|
|
buffer);
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (enumeration)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2003-12-03 03:59:04 +00:00
|
|
|
fprintf(stderr, "Constant: <<<< %s >>>\n", buffer);
|
2003-06-07 21:27:05 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
constant = mxmlNewElement(MXML_NO_PARENT, "constant");
|
|
|
|
mxmlElementSetAttr(constant, "name", buffer);
|
|
|
|
sort_node(enumeration, constant);
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
|
|
|
else if (type)
|
|
|
|
{
|
|
|
|
mxmlDelete(type);
|
|
|
|
type = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-06-06 03:09:31 +00:00
|
|
|
#if DEBUG > 1
|
2003-06-04 21:19:00 +00:00
|
|
|
if (state != oldstate)
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
|
|
|
fprintf(stderr, " changed states from %s to %s on receipt of character '%c'...\n",
|
2003-06-05 03:06:20 +00:00
|
|
|
states[oldstate], states[state], oldch);
|
2003-06-07 21:27:05 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
fputs(" type =", stderr);
|
|
|
|
for (temp = type->child; temp; temp = temp->next)
|
|
|
|
fprintf(stderr, " \"%s\"", temp->value.text.string);
|
|
|
|
fputs("\n", stderr);
|
|
|
|
}
|
|
|
|
}
|
2003-06-06 03:09:31 +00:00
|
|
|
#endif /* DEBUG > 1 */
|
2003-06-04 21:19:00 +00:00
|
|
|
}
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
mxmlDelete(comment);
|
|
|
|
|
2003-06-04 21:19:00 +00:00
|
|
|
/*
|
|
|
|
* All done, return with no errors...
|
|
|
|
*/
|
|
|
|
|
|
|
|
return (0);
|
2003-06-04 17:37:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 'sort_node()' - Insert a node sorted into a tree.
|
2003-06-04 03:07:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2003-06-04 17:37:23 +00:00
|
|
|
sort_node(mxml_node_t *tree, /* I - Tree to sort into */
|
|
|
|
mxml_node_t *node) /* I - Node to add */
|
2003-06-04 03:07:47 +00:00
|
|
|
{
|
2003-06-04 16:30:40 +00:00
|
|
|
mxml_node_t *temp; /* Current node */
|
|
|
|
const char *tempname, /* Name of current node */
|
|
|
|
*nodename; /* Name of node */
|
2003-06-04 03:07:47 +00:00
|
|
|
|
|
|
|
|
2003-12-03 03:59:04 +00:00
|
|
|
#if DEBUG > 1
|
|
|
|
fprintf(stderr, " sort_node(tree=%p, node=%p)\n", tree, node);
|
|
|
|
#endif /* DEBUG > 1 */
|
|
|
|
|
2003-06-06 03:09:31 +00:00
|
|
|
/*
|
|
|
|
* Range check input...
|
|
|
|
*/
|
|
|
|
|
2003-12-03 03:59:04 +00:00
|
|
|
if (!tree || !node || node->parent == tree)
|
2003-06-06 03:09:31 +00:00
|
|
|
return;
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
/*
|
|
|
|
* Get the node name...
|
|
|
|
*/
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-12-03 03:59:04 +00:00
|
|
|
if ((nodename = mxmlElementGetAttr(node, "name")) == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
#if DEBUG > 1
|
|
|
|
fprintf(stderr, " nodename=%p (\"%s\")\n", nodename, nodename);
|
|
|
|
#endif /* DEBUG > 1 */
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
/*
|
2003-06-04 17:37:23 +00:00
|
|
|
* Delete any existing definition at this level, if one exists...
|
2003-06-04 16:30:40 +00:00
|
|
|
*/
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
if ((temp = mxmlFindElement(tree, tree, node->value.element.name,
|
|
|
|
"name", nodename, MXML_DESCEND_FIRST)) != NULL)
|
|
|
|
mxmlDelete(temp);
|
|
|
|
|
|
|
|
/*
|
2003-06-04 17:37:23 +00:00
|
|
|
* Add the node into the tree at the proper place...
|
2003-06-04 16:30:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
for (temp = tree->child; temp; temp = temp->next)
|
|
|
|
{
|
2003-12-03 03:59:04 +00:00
|
|
|
#if DEBUG > 1
|
|
|
|
fprintf(stderr, " temp=%p\n", temp);
|
|
|
|
#endif /* DEBUG > 1 */
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
if ((tempname = mxmlElementGetAttr(temp, "name")) == NULL)
|
|
|
|
continue;
|
2003-06-04 03:07:47 +00:00
|
|
|
|
2003-12-03 03:59:04 +00:00
|
|
|
#if DEBUG > 1
|
|
|
|
fprintf(stderr, " tempname=%p (\"%s\")\n", tempname, tempname);
|
|
|
|
#endif /* DEBUG > 1 */
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
if (strcmp(nodename, tempname) < 0)
|
2003-06-04 03:07:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
if (temp)
|
|
|
|
mxmlAdd(tree, MXML_ADD_BEFORE, temp, node);
|
|
|
|
else
|
|
|
|
mxmlAdd(tree, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, node);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 'update_comment()' - Update a comment node.
|
|
|
|
*/
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
static void
|
2003-06-05 03:06:20 +00:00
|
|
|
update_comment(mxml_node_t *parent, /* I - Parent node */
|
|
|
|
mxml_node_t *comment) /* I - Comment node */
|
|
|
|
{
|
|
|
|
char *ptr; /* Pointer into comment */
|
|
|
|
|
|
|
|
|
2003-06-14 22:14:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, "update_comment(parent=%p, comment=%p)\n",
|
|
|
|
parent, comment);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2003-06-05 03:06:20 +00:00
|
|
|
/*
|
|
|
|
* Range check the input...
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!parent || !comment)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Update the comment...
|
|
|
|
*/
|
|
|
|
|
|
|
|
ptr = comment->value.text.string;
|
|
|
|
|
|
|
|
if (*ptr == '\'')
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Convert "'name()' - description" to "description".
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (ptr ++; *ptr && *ptr != '\''; ptr ++);
|
|
|
|
|
|
|
|
if (*ptr == '\'')
|
|
|
|
{
|
|
|
|
ptr ++;
|
|
|
|
while (isspace(*ptr))
|
|
|
|
ptr ++;
|
|
|
|
|
|
|
|
if (*ptr == '-')
|
|
|
|
ptr ++;
|
|
|
|
|
|
|
|
while (isspace(*ptr))
|
|
|
|
ptr ++;
|
|
|
|
|
2003-12-03 03:59:04 +00:00
|
|
|
safe_strcpy(comment->value.text.string, ptr);
|
2003-06-05 03:06:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!strncmp(ptr, "I ", 2) || !strncmp(ptr, "O ", 2) ||
|
|
|
|
!strncmp(ptr, "IO ", 3))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* 'Convert "I - description", "IO - description", or "O - description"
|
|
|
|
* to description + directory attribute.
|
|
|
|
*/
|
|
|
|
|
|
|
|
ptr = strchr(ptr, ' ');
|
|
|
|
*ptr++ = '\0';
|
|
|
|
|
|
|
|
if (!strcmp(parent->value.element.name, "argument"))
|
|
|
|
mxmlElementSetAttr(parent, "direction", comment->value.text.string);
|
|
|
|
|
|
|
|
while (isspace(*ptr))
|
|
|
|
ptr ++;
|
|
|
|
|
|
|
|
if (*ptr == '-')
|
|
|
|
ptr ++;
|
|
|
|
|
|
|
|
while (isspace(*ptr))
|
|
|
|
ptr ++;
|
|
|
|
|
2003-12-03 03:59:04 +00:00
|
|
|
safe_strcpy(comment->value.text.string, ptr);
|
2003-06-05 03:06:20 +00:00
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Eliminate leading and trailing *'s...
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (ptr = comment->value.text.string; *ptr == '*'; ptr ++);
|
|
|
|
for (; isspace(*ptr); ptr ++);
|
|
|
|
if (ptr > comment->value.text.string)
|
2003-12-03 03:59:04 +00:00
|
|
|
safe_strcpy(comment->value.text.string, ptr);
|
2003-06-07 21:27:05 +00:00
|
|
|
|
|
|
|
for (ptr = comment->value.text.string + strlen(comment->value.text.string) - 1;
|
|
|
|
ptr > comment->value.text.string && *ptr == '*';
|
|
|
|
ptr --)
|
|
|
|
*ptr = '\0';
|
|
|
|
for (; ptr > comment->value.text.string && isspace(*ptr); ptr --)
|
|
|
|
*ptr = '\0';
|
2003-06-14 22:14:17 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, " updated comment = %s\n", comment->value.text.string);
|
|
|
|
#endif /* DEBUG */
|
2003-06-04 03:07:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
/*
|
|
|
|
* 'write_documentation()' - Write HTML documentation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
write_documentation(mxml_node_t *doc) /* I - XML documentation */
|
|
|
|
{
|
2003-06-07 21:27:05 +00:00
|
|
|
mxml_node_t *function, /* Current function */
|
|
|
|
*scut, /* Struct/class/union/typedef */
|
2003-06-05 12:11:53 +00:00
|
|
|
*arg, /* Current argument */
|
2003-09-28 21:09:04 +00:00
|
|
|
*description, /* Description of function/var */
|
|
|
|
*type; /* Type for argument */
|
2003-06-05 12:11:53 +00:00
|
|
|
const char *name; /* Name of function/type */
|
2003-06-05 13:49:14 +00:00
|
|
|
char prefix; /* Prefix character */
|
2003-06-05 12:11:53 +00:00
|
|
|
|
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
/*
|
|
|
|
* Standard header...
|
|
|
|
*/
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
puts("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
|
|
|
|
"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
|
|
|
|
puts("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">");
|
|
|
|
puts("<head>");
|
2003-06-05 13:49:14 +00:00
|
|
|
puts("\t<title>Documentation</title>");
|
2003-06-05 12:11:53 +00:00
|
|
|
puts("\t<style><!--");
|
|
|
|
puts("\th1, h2, h3, p { font-family: sans-serif; text-align: justify; }");
|
2003-06-05 13:49:14 +00:00
|
|
|
puts("\ttt, pre a:link, pre a:visited, tt a:link, tt a:visited { font-weight: bold; color: #7f0000; }");
|
2003-06-06 03:09:31 +00:00
|
|
|
puts("\tpre { font-weight: bold; color: #7f0000; margin-left: 2em; }");
|
2003-06-05 12:11:53 +00:00
|
|
|
puts("\t--></style>");
|
|
|
|
puts("</head>");
|
|
|
|
puts("<body>");
|
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Table of contents...
|
|
|
|
*/
|
|
|
|
|
|
|
|
puts("<h1>Contents</h1>");
|
|
|
|
puts("<ul>");
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "class", NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
puts("\t<li><a href=\"#_classes\">Classes</a></li>");
|
|
|
|
if (mxmlFindElement(doc, doc, "enumeration", NULL, NULL, MXML_DESCEND_FIRST))
|
2003-07-20 14:37:34 +00:00
|
|
|
puts("\t<li><a href=\"#_enumerations\">Enumerations</a></li>");
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "function", NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
puts("\t<li><a href=\"#_functions\">Functions</a></li>");
|
|
|
|
if (mxmlFindElement(doc, doc, "struct", NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
puts("\t<li><a href=\"#_structures\">Structures</a></li>");
|
|
|
|
if (mxmlFindElement(doc, doc, "typedef", NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
puts("\t<li><a href=\"#_types\">Types</a></li>");
|
|
|
|
if (mxmlFindElement(doc, doc, "union", NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
puts("\t<li><a href=\"#_unions\">Unions</a></li>");
|
|
|
|
if (mxmlFindElement(doc, doc, "variable", NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
puts("\t<li><a href=\"#_variables\">Variables</a></li>");
|
2003-06-07 21:27:05 +00:00
|
|
|
puts("</ul>");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List of classes...
|
|
|
|
*/
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "class", NULL, NULL, MXML_DESCEND_FIRST))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-09-28 21:09:04 +00:00
|
|
|
puts("<hr noshade/>");
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h1><a name=\"_classes\">Classes</a></h1>");
|
|
|
|
puts("<ul>");
|
|
|
|
|
|
|
|
for (scut = mxmlFindElement(doc, doc, "class", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "class", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</ul>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (scut = mxmlFindElement(doc, doc, "class", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "class", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
description = mxmlFindElement(scut, scut, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
|
|
|
if (description)
|
|
|
|
{
|
|
|
|
fputs("<p>", stdout);
|
|
|
|
write_element(NULL, description);
|
|
|
|
puts("</p>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Definition</h3>");
|
|
|
|
puts("<pre>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
printf("struct %s\n{\n", name);
|
|
|
|
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
printf(" ");
|
|
|
|
write_element(doc, mxmlFindElement(arg, arg, "type", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("};\n</pre>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Members</h3>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
|
|
|
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
|
|
|
puts("<tbody>");
|
|
|
|
|
|
|
|
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
write_element(NULL, mxmlFindElement(arg, arg, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
|
|
|
|
puts("</td></tr>");
|
|
|
|
}
|
|
|
|
|
|
|
|
puts("</tbody></table></p>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List of enumerations...
|
|
|
|
*/
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "enumeration", NULL, NULL, MXML_DESCEND_FIRST))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-09-28 21:09:04 +00:00
|
|
|
puts("<hr noshade/>");
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h1><a name=\"_enumerations\">Enumerations</a></h1>");
|
|
|
|
puts("<ul>");
|
|
|
|
|
|
|
|
for (scut = mxmlFindElement(doc, doc, "enumeration", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "enumeration", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</ul>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (scut = mxmlFindElement(doc, doc, "enumeration", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "enumeration", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
description = mxmlFindElement(scut, scut, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
|
|
|
if (description)
|
|
|
|
{
|
|
|
|
fputs("<p>", stdout);
|
|
|
|
write_element(NULL, description);
|
|
|
|
puts("</p>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Values</h3>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
|
|
|
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
|
|
|
puts("<tbody>");
|
|
|
|
|
|
|
|
for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, scut, "constant", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
write_element(doc, mxmlFindElement(arg, arg, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</td></tr>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</tbody></table></p>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
2003-06-14 23:56:47 +00:00
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
/*
|
|
|
|
* List of functions...
|
|
|
|
*/
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "function", NULL, NULL, MXML_DESCEND_FIRST))
|
2003-06-05 12:11:53 +00:00
|
|
|
{
|
2003-09-28 21:09:04 +00:00
|
|
|
puts("<hr noshade/>");
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h1><a name=\"_functions\">Functions</a></h1>");
|
|
|
|
puts("<ul>");
|
|
|
|
|
|
|
|
for (function = mxmlFindElement(doc, doc, "function", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
function;
|
|
|
|
function = mxmlFindElement(function, doc, "function", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-05 13:49:14 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(function, "name");
|
|
|
|
printf("\t<li><a href=\"#%s\"><tt>%s()</tt></a></li>\n", name, name);
|
2003-06-05 13:49:14 +00:00
|
|
|
}
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</ul>");
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (function = mxmlFindElement(doc, doc, "function", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
function;
|
|
|
|
function = mxmlFindElement(function, doc, "function", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-05 13:49:14 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(function, "name");
|
|
|
|
printf("<h2><a name=\"%s\">%s()</a></h2>\n", name, name);
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
description = mxmlFindElement(function, function, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
|
|
|
if (description)
|
|
|
|
{
|
|
|
|
fputs("<p>", stdout);
|
|
|
|
write_element(NULL, description);
|
|
|
|
puts("</p>");
|
|
|
|
}
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Syntax</h3>");
|
|
|
|
puts("<pre>");
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
arg = mxmlFindElement(function, function, "returnvalue", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (arg)
|
|
|
|
write_element(doc, mxmlFindElement(arg, arg, "type", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
else
|
|
|
|
fputs("void", stdout);
|
|
|
|
|
|
|
|
printf("\n%s", name);
|
2003-06-05 13:49:14 +00:00
|
|
|
for (arg = mxmlFindElement(function, function, "argument", NULL, NULL,
|
2003-06-14 23:56:47 +00:00
|
|
|
MXML_DESCEND_FIRST), prefix = '(';
|
2003-06-05 13:49:14 +00:00
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, function, "argument", NULL, NULL,
|
2003-06-14 23:56:47 +00:00
|
|
|
MXML_NO_DESCEND), prefix = ',')
|
2003-06-05 12:11:53 +00:00
|
|
|
{
|
2003-09-28 21:09:04 +00:00
|
|
|
type = mxmlFindElement(arg, arg, "type", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
printf("%c\n ", prefix);
|
2003-09-28 21:09:04 +00:00
|
|
|
write_element(doc, type);
|
|
|
|
printf("%s%s", type->child ? " " : "", mxmlElementGetAttr(arg, "name"));
|
2003-06-14 23:56:47 +00:00
|
|
|
}
|
2003-06-05 12:11:53 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (prefix == '(')
|
|
|
|
puts("(void);\n</pre>");
|
|
|
|
else
|
|
|
|
puts(");\n</pre>");
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Arguments</h3>");
|
2003-06-05 12:11:53 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (prefix == '(')
|
|
|
|
puts("<p>None.</p>");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
|
|
|
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
|
|
|
puts("<tbody>");
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (arg = mxmlFindElement(function, function, "argument", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, function, "argument", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
write_element(NULL, mxmlFindElement(arg, arg, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
2003-06-05 13:49:14 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</td></tr>");
|
|
|
|
}
|
|
|
|
|
|
|
|
puts("</tbody></table></p>");
|
|
|
|
}
|
|
|
|
|
|
|
|
puts("<h3>Returns</h3>");
|
|
|
|
|
|
|
|
arg = mxmlFindElement(function, function, "returnvalue", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
|
|
|
|
|
|
|
if (!arg)
|
|
|
|
puts("<p>Nothing.</p>");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fputs("<p>", stdout);
|
|
|
|
write_element(NULL, mxmlFindElement(arg, arg, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
puts("</p>");
|
|
|
|
}
|
2003-06-05 13:49:14 +00:00
|
|
|
}
|
2003-06-05 12:11:53 +00:00
|
|
|
}
|
|
|
|
|
2003-06-07 21:27:05 +00:00
|
|
|
/*
|
|
|
|
* List of structures...
|
|
|
|
*/
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "struct", NULL, NULL, MXML_DESCEND_FIRST))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-09-28 21:09:04 +00:00
|
|
|
puts("<hr noshade/>");
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h1><a name=\"_structures\">Structures</a></h1>");
|
|
|
|
puts("<ul>");
|
|
|
|
|
|
|
|
for (scut = mxmlFindElement(doc, doc, "struct", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "struct", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</ul>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (scut = mxmlFindElement(doc, doc, "struct", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "struct", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
description = mxmlFindElement(scut, scut, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
|
|
|
if (description)
|
|
|
|
{
|
|
|
|
fputs("<p>", stdout);
|
|
|
|
write_element(NULL, description);
|
|
|
|
puts("</p>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Definition</h3>");
|
|
|
|
puts("<pre>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
printf("struct %s\n{\n", name);
|
|
|
|
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
printf(" ");
|
|
|
|
write_element(doc, mxmlFindElement(arg, arg, "type", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("};\n</pre>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Members</h3>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
|
|
|
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
|
|
|
puts("<tbody>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
|
|
|
|
|
|
|
write_element(NULL, mxmlFindElement(arg, arg, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
|
|
|
|
puts("</td></tr>");
|
|
|
|
}
|
|
|
|
|
|
|
|
puts("</tbody></table></p>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List of types...
|
|
|
|
*/
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "typedef", NULL, NULL, MXML_DESCEND_FIRST))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-09-28 21:09:04 +00:00
|
|
|
puts("<hr noshade/>");
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h1><a name=\"_types\">Types</a></h1>");
|
|
|
|
puts("<ul>");
|
|
|
|
|
|
|
|
for (scut = mxmlFindElement(doc, doc, "typedef", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "typedef", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</ul>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (scut = mxmlFindElement(doc, doc, "typedef", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "typedef", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
|
|
|
|
|
|
|
description = mxmlFindElement(scut, scut, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
|
|
|
if (description)
|
|
|
|
{
|
|
|
|
fputs("<p>", stdout);
|
|
|
|
write_element(NULL, description);
|
|
|
|
puts("</p>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Definition</h3>");
|
|
|
|
puts("<pre>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
printf("typedef ");
|
|
|
|
write_element(doc, mxmlFindElement(scut, scut, "type", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
printf(" %s;\n</pre>\n", name);
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List of unions...
|
|
|
|
*/
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "union", NULL, NULL, MXML_DESCEND_FIRST))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-09-28 21:09:04 +00:00
|
|
|
puts("<hr noshade/>");
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h1><a name=\"_unions\">Unions</a></h1>");
|
|
|
|
puts("<ul>");
|
|
|
|
|
|
|
|
for (scut = mxmlFindElement(doc, doc, "union", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "union", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</ul>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (scut = mxmlFindElement(doc, doc, "union", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
scut;
|
|
|
|
scut = mxmlFindElement(scut, doc, "union", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
2003-06-07 21:27:05 +00:00
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(scut, "name");
|
|
|
|
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
|
|
|
|
|
|
|
description = mxmlFindElement(scut, scut, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
|
|
|
if (description)
|
|
|
|
{
|
|
|
|
fputs("<p>", stdout);
|
|
|
|
write_element(NULL, description);
|
|
|
|
puts("</p>");
|
|
|
|
}
|
|
|
|
|
|
|
|
puts("<h3>Definition</h3>");
|
|
|
|
puts("<pre>");
|
|
|
|
|
|
|
|
printf("struct %s\n{\n", name);
|
|
|
|
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
printf(" ");
|
|
|
|
write_element(doc, mxmlFindElement(arg, arg, "type", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
|
|
|
|
}
|
|
|
|
|
|
|
|
puts("};\n</pre>");
|
|
|
|
|
|
|
|
puts("<h3>Members</h3>");
|
|
|
|
|
|
|
|
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
|
|
|
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
|
|
|
puts("<tbody>");
|
|
|
|
|
|
|
|
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
|
|
|
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
|
|
|
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
|
|
|
|
|
|
|
write_element(NULL, mxmlFindElement(arg, arg, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
|
|
|
|
puts("</td></tr>");
|
|
|
|
}
|
|
|
|
|
|
|
|
puts("</tbody></table></p>");
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
2003-06-14 23:56:47 +00:00
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
/*
|
|
|
|
* Variables...
|
|
|
|
*/
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "variable", NULL, NULL, MXML_DESCEND_FIRST))
|
|
|
|
{
|
2003-09-28 21:09:04 +00:00
|
|
|
puts("<hr noshade/>");
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h1><a name=\"_variables\">Variables</a></h1>");
|
|
|
|
puts("<ul>");
|
|
|
|
|
|
|
|
for (arg = mxmlFindElement(doc, doc, "variable", NULL, NULL,
|
2003-06-07 21:27:05 +00:00
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
2003-06-14 23:56:47 +00:00
|
|
|
arg = mxmlFindElement(arg, doc, "variable", NULL, NULL,
|
2003-06-07 21:27:05 +00:00
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(arg, "name");
|
|
|
|
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("</ul>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
for (arg = mxmlFindElement(doc, doc, "variable", NULL, NULL,
|
2003-06-07 21:27:05 +00:00
|
|
|
MXML_DESCEND_FIRST);
|
|
|
|
arg;
|
2003-06-14 23:56:47 +00:00
|
|
|
arg = mxmlFindElement(arg, doc, "variable", NULL, NULL,
|
2003-06-07 21:27:05 +00:00
|
|
|
MXML_NO_DESCEND))
|
|
|
|
{
|
2003-06-14 23:56:47 +00:00
|
|
|
name = mxmlElementGetAttr(arg, "name");
|
|
|
|
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
description = mxmlFindElement(arg, arg, "description", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST);
|
|
|
|
if (description)
|
|
|
|
{
|
|
|
|
fputs("<p>", stdout);
|
|
|
|
write_element(NULL, description);
|
|
|
|
puts("</p>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
puts("<h3>Definition</h3>");
|
|
|
|
puts("<pre>");
|
2003-06-07 21:27:05 +00:00
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
write_element(doc, mxmlFindElement(arg, arg, "type", NULL,
|
|
|
|
NULL, MXML_DESCEND_FIRST));
|
|
|
|
printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
|
|
|
|
|
|
|
|
puts("</pre>");
|
|
|
|
}
|
2003-06-07 21:27:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Standard footer...
|
|
|
|
*/
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
puts("</body>");
|
|
|
|
puts("</html>");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-05 13:49:14 +00:00
|
|
|
/*
|
|
|
|
* 'write_element()' - Write an element's text nodes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2003-06-14 23:56:47 +00:00
|
|
|
write_element(mxml_node_t *doc, /* I - Document tree */
|
|
|
|
mxml_node_t *element) /* I - Element to write */
|
2003-06-05 13:49:14 +00:00
|
|
|
{
|
|
|
|
mxml_node_t *node; /* Current node */
|
|
|
|
|
|
|
|
|
2003-09-28 21:09:04 +00:00
|
|
|
if (!element)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (node = element->child;
|
2003-06-05 13:49:14 +00:00
|
|
|
node;
|
2003-09-28 21:09:04 +00:00
|
|
|
node = mxmlWalkNext(node, element, MXML_NO_DESCEND))
|
2003-06-05 13:49:14 +00:00
|
|
|
if (node->type == MXML_TEXT)
|
|
|
|
{
|
|
|
|
if (node->value.text.whitespace)
|
|
|
|
putchar(' ');
|
|
|
|
|
2003-06-14 23:56:47 +00:00
|
|
|
if (mxmlFindElement(doc, doc, "class", "name", node->value.text.string,
|
|
|
|
MXML_DESCEND) ||
|
|
|
|
mxmlFindElement(doc, doc, "enumeration", "name",
|
|
|
|
node->value.text.string, MXML_DESCEND) ||
|
|
|
|
mxmlFindElement(doc, doc, "struct", "name", node->value.text.string,
|
|
|
|
MXML_DESCEND) ||
|
|
|
|
mxmlFindElement(doc, doc, "typedef", "name", node->value.text.string,
|
|
|
|
MXML_DESCEND) ||
|
|
|
|
mxmlFindElement(doc, doc, "union", "name", node->value.text.string,
|
|
|
|
MXML_DESCEND))
|
|
|
|
{
|
|
|
|
printf("<a href=\"#");
|
|
|
|
write_string(node->value.text.string);
|
|
|
|
printf("\">");
|
|
|
|
write_string(node->value.text.string);
|
|
|
|
printf("</a>");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
write_string(node->value.text.string);
|
2003-06-05 13:49:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 'write_string()' - Write a string, quoting XHTML special chars as needed...
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
write_string(const char *s) /* I - String to write */
|
|
|
|
{
|
|
|
|
while (*s)
|
|
|
|
{
|
|
|
|
if (*s == '&')
|
|
|
|
fputs("&", stdout);
|
|
|
|
else if (*s == '<')
|
|
|
|
fputs("<", stdout);
|
|
|
|
else if (*s == '>')
|
|
|
|
fputs(">", stdout);
|
|
|
|
else if (*s == '\"')
|
|
|
|
fputs(""", stdout);
|
|
|
|
else if (*s & 128)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Convert UTF-8 to Unicode constant...
|
|
|
|
*/
|
|
|
|
|
|
|
|
int ch; /* Unicode character */
|
|
|
|
|
|
|
|
|
|
|
|
ch = *s & 255;
|
|
|
|
|
|
|
|
if ((ch & 0xe0) == 0xc0)
|
|
|
|
{
|
|
|
|
ch = ((ch & 0x1f) << 6) | (s[1] & 0x3f);
|
|
|
|
s ++;
|
|
|
|
}
|
|
|
|
else if ((ch & 0xf0) == 0xe0)
|
|
|
|
{
|
|
|
|
ch = ((((ch * 0x0f) << 6) | (s[1] & 0x3f)) << 6) | (s[2] & 0x3f);
|
|
|
|
s += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ch == 0xa0)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Handle non-breaking space as-is...
|
|
|
|
*/
|
|
|
|
|
|
|
|
fputs(" ", stdout);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
printf("&#x%x;", ch);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
putchar(*s);
|
|
|
|
|
|
|
|
s ++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-04 03:07:47 +00:00
|
|
|
/*
|
2003-06-04 23:20:31 +00:00
|
|
|
* 'ws_cb()' - Whitespace callback for saving.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int /* O - Whitespace char or 0 for none */
|
|
|
|
ws_cb(mxml_node_t *node, /* I - Element node */
|
|
|
|
int where) /* I - Where value */
|
|
|
|
{
|
|
|
|
const char *name; /* Name of element */
|
|
|
|
|
|
|
|
|
|
|
|
name = node->value.element.name;
|
|
|
|
|
2003-06-05 12:11:53 +00:00
|
|
|
if ((!strcmp(name, "namespace") || !strcmp(name, "enumeration") ||
|
|
|
|
!strcmp(name, "typedef") || !strcmp(name, "function") ||
|
|
|
|
!strcmp(name, "variable") || !strcmp(name, "struct") ||
|
|
|
|
!strcmp(name, "class") || !strcmp(name, "constant") ||
|
|
|
|
!strcmp(name, "argument") || !strcmp(name, "returnvalue")) &&
|
|
|
|
where == MXML_WS_AFTER_CLOSE)
|
2003-06-04 23:20:31 +00:00
|
|
|
return ('\n');
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2003-12-03 22:22:49 +00:00
|
|
|
* End of "$Id: mxmldoc.c,v 1.21 2003/12/03 22:22:49 mike Exp $".
|
2003-06-04 03:07:47 +00:00
|
|
|
*/
|