diff options
-rw-r--r-- | nuttx/ChangeLog | 6 | ||||
-rw-r--r-- | nuttx/tools/kconfig2html.c | 92 | ||||
-rwxr-xr-x | nuttx/tools/mkconfigvars.sh | 3 |
3 files changed, 80 insertions, 21 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 7ae3d73ed..8b81b1989 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4591,8 +4591,12 @@ at Documentation/NuttXConfigVariables.html (2014-4-22). * arch/arm/src/lpc17xx/lpc17_adc.c: Only one ADC pin was configured. Need to configure all that are in the ADC0 set. From MKannan - (2014-4-23). + (2014-4-23). * configs/zkit-arm-1769/src: ADC and SPI/USB MSC updates from MKannan (2014-4-23). * 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) + * 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. diff --git a/nuttx/tools/kconfig2html.c b/nuttx/tools/kconfig2html.c index de749cb7d..e29fd4788 100644 --- a/nuttx/tools/kconfig2html.c +++ b/nuttx/tools/kconfig2html.c @@ -52,6 +52,8 @@ * Pre-processor Definitions ****************************************************************************/ +#undef USE_JQUERY + #define LINE_SIZE 1024 #define SCRATCH_SIZE 2048 #define MAX_DEPENDENCIES 100 @@ -902,6 +904,15 @@ static char *get_token(void) /* Search for the trailing quotation mark */ pend = findchar(pbegin + 1, '"'); + + /* Did we find the trailing quotation mark */ + + if (pend) + { + /* Yes.. skip over it */ + + pend++; + } } else { @@ -950,22 +961,43 @@ static char *get_html_string(void) pbegin = strchr(g_lnptr, '"'); if (pbegin) { - /* Skip over the quote */ + /* We found the leading quote. Skip over the leading quote */ 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); + } - pend = findchar(pbegin, '"'); - if (pend) - { - /* Replace the final quote with a NUL */ + /* Search for the trailing quotation mark. If there is none, then + * the string goes to the end of the line. + */ - *pend = '\0'; - } + pend = findchar(pbegin, '"'); + if (pend) + { + /* Replace the final quote with a NUL. g_lnptr is set to to + * the next valid character after the terminating quote. + */ + + *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); } @@ -1561,6 +1593,7 @@ static inline char *process_config(FILE *stream, const char *configname, /* Process each line in the configuration */ help = false; + token = NULL; while ((ptr = kconfig_line(stream)) != NULL) { @@ -1734,7 +1767,7 @@ static inline char *process_config(FILE *stream, const char *configname, } } - /* Is this an internal configuration varaible with no description? + /* Is this an internal configuration varaible with no description? * If so, send the output to the appendix file. */ @@ -2108,30 +2141,34 @@ static inline char *process_menu(FILE *stream, const char *kconfigdir) paranum = get_paranum(); if (menu.m_name) { - output("<li><a href=\"#menu_%d\">%s Menu: %s</a></li>\n", - g_menu_number, paranum, menu.m_name); + output("<li><a name=\"menu_%d_toc\"><a href=\"#menu_%d\">%s Menu: %s</a></a></li>\n", + g_menu_number, g_menu_number, paranum, menu.m_name); body("\n<h1><a name=\"menu_%d\">%s Menu: %s</a></h1>\n", g_menu_number, paranum, menu.m_name); } else { - output("<li><a href=\"#menu_%d\">%s Menu</a></li>\n", - g_menu_number, paranum); + output("<li><a name=\"menu_%d_toc\"><a href=\"#menu_%d\">%s Menu</a></a></li>\n", + g_menu_number, g_menu_number, paranum); body("\n<h1><a name=\"menu_%d\">%s Menu</a></h1>\n", g_menu_number, paranum); } - g_menu_number++; - /* Output logic to toggle the contents below the menu in the table of * contents. */ - output("<a href=\"#\" onclick=\"toggle('toggle_%d', this)\">Expand</a>\n", - g_toggle_number); +#ifdef USE_JQUERY + 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", g_toggle_number); + g_menu_number++; g_toggle_number++; /* Print the list of dependencies (if any) */ @@ -2506,7 +2543,23 @@ int main(int argc, char **argv, char **envp) output("</td>\n"); output("</tr>\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("function toggle(id, link) {\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("</script>\n"); +#endif output("<hr><hr>\n"); output("<table width =\"100%%\">\n"); diff --git a/nuttx/tools/mkconfigvars.sh b/nuttx/tools/mkconfigvars.sh index 7bccefd65..011599659 100755 --- a/nuttx/tools/mkconfigvars.sh +++ b/nuttx/tools/mkconfigvars.sh @@ -36,6 +36,7 @@ # see the directories to tar up MYNAME=`basename $0` +KCONFIG2HTML_TARGET=kconfig2html KCONFIG2HTML1=tools/kconfig2html KCONFIG2HTML2=tools/kconfig2html.exe KCONFIG2MAKEFILE=Makefile.host @@ -81,7 +82,7 @@ else if [ -x ${KCONFIG2HTML2} ]; then KCONFIG2HTML=${KCONFIG2HTML2} else - make -C ${KCONFIG2MAKEDIR} -f ${KCONFIG2MAKEFILE} ${KCONFIG2HTML1} || \ + make -C ${KCONFIG2MAKEDIR} -f ${KCONFIG2MAKEFILE} ${KCONFIG2HTML_TARGET} || \ { echo "ERROR: make ${KCONFIG2HTML1} failed" ; exit 1 ; } fi fi |