mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
kconfig2html: Improve expand/collapse TOC + misc bug-fixes
This commit is contained in:
@@ -4596,3 +4596,7 @@
|
|||||||
MKannan (2014-4-23).
|
MKannan (2014-4-23).
|
||||||
* arm/src/armv7-m/ram_vectors.h and arm/src/armv7-m/up_ramvec_initialize.c:
|
* arm/src/armv7-m/ram_vectors.h and arm/src/armv7-m/up_ramvec_initialize.c:
|
||||||
Fixes to RAM vector logic from Paul Y. Zhang (2014-4-23)
|
Fixes to RAM vector logic from Paul Y. Zhang (2014-4-23)
|
||||||
|
* tools/kconfig2html.c: Improve behavior of Expand/Collapse
|
||||||
|
Table of Contents; Handle errors in parsing of strings and in
|
||||||
|
some uninitialized variables. Add an option to use jQuery.
|
||||||
|
* tools/mkconfigvar.sh: Fix make target.
|
||||||
|
|||||||
+66
-12
@@ -52,6 +52,8 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef USE_JQUERY
|
||||||
|
|
||||||
#define LINE_SIZE 1024
|
#define LINE_SIZE 1024
|
||||||
#define SCRATCH_SIZE 2048
|
#define SCRATCH_SIZE 2048
|
||||||
#define MAX_DEPENDENCIES 100
|
#define MAX_DEPENDENCIES 100
|
||||||
@@ -902,6 +904,15 @@ static char *get_token(void)
|
|||||||
/* Search for the trailing quotation mark */
|
/* Search for the trailing quotation mark */
|
||||||
|
|
||||||
pend = findchar(pbegin + 1, '"');
|
pend = findchar(pbegin + 1, '"');
|
||||||
|
|
||||||
|
/* Did we find the trailing quotation mark */
|
||||||
|
|
||||||
|
if (pend)
|
||||||
|
{
|
||||||
|
/* Yes.. skip over it */
|
||||||
|
|
||||||
|
pend++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -950,22 +961,43 @@ static char *get_html_string(void)
|
|||||||
pbegin = strchr(g_lnptr, '"');
|
pbegin = strchr(g_lnptr, '"');
|
||||||
if (pbegin)
|
if (pbegin)
|
||||||
{
|
{
|
||||||
/* Skip over the quote */
|
/* We found the leading quote. Skip over the leading quote */
|
||||||
|
|
||||||
pbegin++;
|
pbegin++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The string is unquoted. The beginning of the string is here,
|
||||||
|
* skipping over any leading whitespace.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Search for the trailing quotation mark */
|
pbegin = skip_space(g_lnptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search for the trailing quotation mark. If there is none, then
|
||||||
|
* the string goes to the end of the line.
|
||||||
|
*/
|
||||||
|
|
||||||
pend = findchar(pbegin, '"');
|
pend = findchar(pbegin, '"');
|
||||||
if (pend)
|
if (pend)
|
||||||
{
|
{
|
||||||
/* Replace the final quote with a NUL */
|
/* Replace the final quote with a NUL. g_lnptr is set to to
|
||||||
|
* the next valid character after the terminating quote.
|
||||||
|
*/
|
||||||
|
|
||||||
*pend = '\0';
|
*pend = '\0';
|
||||||
|
g_lnptr = pend + 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Use the rest of the line. g_lnptr is set to point at the
|
||||||
|
* terminating NUL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
pend = pbegin + strlen(pbegin);
|
||||||
|
g_lnptr = pend;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_lnptr = pend + 1;
|
|
||||||
return htmlize_text(pbegin);
|
return htmlize_text(pbegin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1561,6 +1593,7 @@ static inline char *process_config(FILE *stream, const char *configname,
|
|||||||
/* Process each line in the configuration */
|
/* Process each line in the configuration */
|
||||||
|
|
||||||
help = false;
|
help = false;
|
||||||
|
token = NULL;
|
||||||
|
|
||||||
while ((ptr = kconfig_line(stream)) != NULL)
|
while ((ptr = kconfig_line(stream)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -2108,30 +2141,34 @@ static inline char *process_menu(FILE *stream, const char *kconfigdir)
|
|||||||
paranum = get_paranum();
|
paranum = get_paranum();
|
||||||
if (menu.m_name)
|
if (menu.m_name)
|
||||||
{
|
{
|
||||||
output("<li><a href=\"#menu_%d\">%s Menu: %s</a></li>\n",
|
output("<li><a name=\"menu_%d_toc\"><a href=\"#menu_%d\">%s Menu: %s</a></a></li>\n",
|
||||||
g_menu_number, paranum, menu.m_name);
|
g_menu_number, g_menu_number, paranum, menu.m_name);
|
||||||
body("\n<h1><a name=\"menu_%d\">%s Menu: %s</a></h1>\n",
|
body("\n<h1><a name=\"menu_%d\">%s Menu: %s</a></h1>\n",
|
||||||
g_menu_number, paranum, menu.m_name);
|
g_menu_number, paranum, menu.m_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output("<li><a href=\"#menu_%d\">%s Menu</a></li>\n",
|
output("<li><a name=\"menu_%d_toc\"><a href=\"#menu_%d\">%s Menu</a></a></li>\n",
|
||||||
g_menu_number, paranum);
|
g_menu_number, g_menu_number, paranum);
|
||||||
body("\n<h1><a name=\"menu_%d\">%s Menu</a></h1>\n",
|
body("\n<h1><a name=\"menu_%d\">%s Menu</a></h1>\n",
|
||||||
g_menu_number, paranum);
|
g_menu_number, paranum);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_menu_number++;
|
|
||||||
|
|
||||||
/* Output logic to toggle the contents below the menu in the table of
|
/* Output logic to toggle the contents below the menu in the table of
|
||||||
* contents.
|
* contents.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
output("<a href=\"#\" onclick=\"toggle('toggle_%d', this)\">Expand</a>\n",
|
#ifdef USE_JQUERY
|
||||||
g_toggle_number);
|
output("<a id=\"link_%d\" href=\"#menu_%d_toc\" onclick=\"toggle('toggle_%d', 'link_%d')\">Expand</a>\n",
|
||||||
|
g_menu_number, g_toggle_number, g_toggle_number);
|
||||||
|
#else
|
||||||
|
output("<a href=\"#menu_%d_toc\" onclick=\"toggle('toggle_%d', this)\">Expand</a>\n",
|
||||||
|
g_menu_number, g_toggle_number);
|
||||||
|
#endif
|
||||||
output("<ul id=\"toggle_%d\" style=\"display:none\">\n",
|
output("<ul id=\"toggle_%d\" style=\"display:none\">\n",
|
||||||
g_toggle_number);
|
g_toggle_number);
|
||||||
|
|
||||||
|
g_menu_number++;
|
||||||
g_toggle_number++;
|
g_toggle_number++;
|
||||||
|
|
||||||
/* Print the list of dependencies (if any) */
|
/* Print the list of dependencies (if any) */
|
||||||
@@ -2507,6 +2544,22 @@ int main(int argc, char **argv, char **envp)
|
|||||||
output("</tr>\n");
|
output("</tr>\n");
|
||||||
output("</table>\n");
|
output("</table>\n");
|
||||||
|
|
||||||
|
#ifdef USE_JQUERY
|
||||||
|
output("<script src=\"http://code.jquery.com/jquery-1.9.1.js\"></script>\n");
|
||||||
|
output("<script type=\"text/javascript\">\n");
|
||||||
|
output("function toggle(list_id, link_id) {\n");
|
||||||
|
output(" var list = $('#' + list_id);\n");
|
||||||
|
output(" var link = $('#' + link_id);\n");
|
||||||
|
output(" if (list.is(\":visible\")) {\n");
|
||||||
|
output(" list.hide();\n");
|
||||||
|
output(" link.text('Expand');\n");
|
||||||
|
output(" } else {\n");
|
||||||
|
output(" list.show();\n");
|
||||||
|
output(" link.text('Collapse');\n");
|
||||||
|
output(" }\n");
|
||||||
|
output("}\n");
|
||||||
|
output("</script>\n");
|
||||||
|
#else
|
||||||
output("<script type=\"text/javascript\">\n");
|
output("<script type=\"text/javascript\">\n");
|
||||||
output("function toggle(id, link) {\n");
|
output("function toggle(id, link) {\n");
|
||||||
output(" var e = document.getElementById(id);\n");
|
output(" var e = document.getElementById(id);\n");
|
||||||
@@ -2519,6 +2572,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
output(" }\n");
|
output(" }\n");
|
||||||
output("}\n");
|
output("}\n");
|
||||||
output("</script>\n");
|
output("</script>\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
output("<hr><hr>\n");
|
output("<hr><hr>\n");
|
||||||
output("<table width =\"100%%\">\n");
|
output("<table width =\"100%%\">\n");
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
# see the directories to tar up
|
# see the directories to tar up
|
||||||
|
|
||||||
MYNAME=`basename $0`
|
MYNAME=`basename $0`
|
||||||
|
KCONFIG2HTML_TARGET=kconfig2html
|
||||||
KCONFIG2HTML1=tools/kconfig2html
|
KCONFIG2HTML1=tools/kconfig2html
|
||||||
KCONFIG2HTML2=tools/kconfig2html.exe
|
KCONFIG2HTML2=tools/kconfig2html.exe
|
||||||
KCONFIG2MAKEFILE=Makefile.host
|
KCONFIG2MAKEFILE=Makefile.host
|
||||||
@@ -81,7 +82,7 @@ else
|
|||||||
if [ -x ${KCONFIG2HTML2} ]; then
|
if [ -x ${KCONFIG2HTML2} ]; then
|
||||||
KCONFIG2HTML=${KCONFIG2HTML2}
|
KCONFIG2HTML=${KCONFIG2HTML2}
|
||||||
else
|
else
|
||||||
make -C ${KCONFIG2MAKEDIR} -f ${KCONFIG2MAKEFILE} ${KCONFIG2HTML1} || \
|
make -C ${KCONFIG2MAKEDIR} -f ${KCONFIG2MAKEFILE} ${KCONFIG2HTML_TARGET} || \
|
||||||
{ echo "ERROR: make ${KCONFIG2HTML1} failed" ; exit 1 ; }
|
{ echo "ERROR: make ${KCONFIG2HTML1} failed" ; exit 1 ; }
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user