aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-12-22 15:02:09 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-12-22 15:02:09 +0000
commit6d3c1cd9728981919f2ff1bc1f48b2bbbcbc5224 (patch)
tree5a0f4416ba510a66cd7c3ab6604fa1a7c21ab80e /src
parent2b43391851c9c61fed5ee5eacf2fd96347270ab4 (diff)
httpd wip
git-svn-id: svn://svn.berlios.de/openocd/trunk@1268 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/helper/jim.c2
-rw-r--r--src/server/Makefile.am7
-rw-r--r--src/server/httpd.c160
-rw-r--r--src/server/httpd/Stylizer.classbin0 -> 4493 bytes
-rw-r--r--src/server/httpd/Stylizer.java114
-rw-r--r--src/server/httpd/browsemem.tcl456
-rw-r--r--src/server/httpd/build.sh3
-rw-r--r--src/server/httpd/downloadmem.tcl368
-rw-r--r--src/server/httpd/editconfigs.tcl462
-rw-r--r--src/server/httpd/editfile.tcl436
-rw-r--r--src/server/httpd/erase.tcl389
-rw-r--r--src/server/httpd/flash.tcl461
-rw-r--r--src/server/httpd/flashinfo.tcl384
-rw-r--r--src/server/httpd/guiupload.tcl374
-rw-r--r--src/server/httpd/html2tcl.sh128
-rw-r--r--src/server/httpd/httpd.tcl108
-rw-r--r--src/server/httpd/index.tcl381
-rw-r--r--src/server/httpd/log.tcl343
-rw-r--r--src/server/httpd/menu.xml1038
-rw-r--r--src/server/httpd/menu.xsl298
-rw-r--r--src/server/httpd/menuweb.css132
-rw-r--r--src/server/httpd/openocd.tcl357
-rw-r--r--src/server/httpd/preconfig.tcl429
-rw-r--r--src/server/httpd/production.tcl394
-rw-r--r--src/server/httpd/readme.txt24
-rw-r--r--src/server/httpd/reload.tcl322
-rw-r--r--src/server/httpd/run.tcl384
-rw-r--r--src/server/httpd/support.tcl431
-rw-r--r--src/server/httpd/targets.tcl562
-rw-r--r--src/server/httpd/terminal.tcl366
-rw-r--r--src/server/httpd/upgrade.tcl418
31 files changed, 9658 insertions, 73 deletions
diff --git a/src/helper/jim.c b/src/helper/jim.c
index 800db234..f4336ae2 100644
--- a/src/helper/jim.c
+++ b/src/helper/jim.c
@@ -8695,7 +8695,7 @@ int Jim_EvalObj(Jim_Interp *interp, Jim_Obj *scriptObjPtr)
if (cmd->cmdProc) {
interp->cmdPrivData = cmd->privData;
retcode = cmd->cmdProc(interp, argc, argv);
- if (retcode == JIM_ERR_ADDSTACK) {
+ if ((retcode == JIM_ERR)||(retcode == JIM_ERR_ADDSTACK)) {
JimAppendStackTrace(interp, "", script->fileName, token[i-argc*2].linenr);
retcode = JIM_ERR;
}
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
index 0e3a3a47..89b5e364 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -12,3 +12,10 @@ endif
# tcl server addons
noinst_HEADERS += tcl_server.h
libserver_a_SOURCES += tcl_server.c
+
+if HTTPD
+nobase_dist_pkglib_DATA = $(wildcard $(srcdir)/httpd/*.tcl)
+nobase_dist_pkglib_DATA += $(wildcard $(srcdir)/httpd/*.css)
+nobase_dist_pkglib_DATA += $(wildcard $(srcdir)/httpd/menu_cuts/*.png)
+endif
+AM_CPPFLAGS = -DPKGLIBDIR=\"$(pkglibdir)\" @CPPFLAGS@ \ No newline at end of file
diff --git a/src/server/httpd.c b/src/server/httpd.c
index 96e33824..348a081b 100644
--- a/src/server/httpd.c
+++ b/src/server/httpd.c
@@ -261,13 +261,89 @@ static int record_arg(void *cls, enum MHD_ValueKind kind, const char *key,
return MHD_YES;
}
-static int ahc_echo(void * cls, struct MHD_Connection * connection,
- const char * url, const char * method, const char * version,
- const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+
+int handle_request(struct MHD_Connection * connection, const char * url)
{
struct MHD_Response * response;
+
int ret;
+ const char *suffix;
+ suffix = strrchr(url, '.');
+ if ((suffix != NULL) && (strcmp(suffix, ".tcl") == 0))
+ {
+ printf("Run tcl %s\n", url);
+
+ int retcode;
+
+ const char *script = alloc_printf(
+ "global httpdata; source {%s}; set httpdata", url);
+ retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
+ free((void *) script);
+
+ if (retcode == JIM_ERR)
+ {
+ printf("Tcl failed\n");
+ const char *t = httpd_exec_cgi_tcl_error(interp);
+ if (t == NULL)
+ return MHD_NO;
+
+ response = MHD_create_response_from_data(strlen(t), (void *) t,
+ MHD_YES, MHD_NO);
+ ret = MHD_queue_response(connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+ else
+ {
+ printf("Tcl OK\n");
+ /* FIX!!! how to handle mime types??? */
+ const char *result;
+ int reslen;
+ result = Jim_GetString(Jim_GetResult(interp), &reslen);
+ response = MHD_create_response_from_data(reslen, (void *) result,
+ MHD_NO, MHD_YES);
+ ret = MHD_queue_response(connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+ }
+ else
+ {
+ void *data;
+ int len;
+
+ int retval = loadFile(url, &data, &len);
+ if (retval != ERROR_OK)
+ {
+ printf("Did not find %s\n", url);
+
+ response = MHD_create_response_from_data(strlen(PAGE_NOT_FOUND),
+ (void *) PAGE_NOT_FOUND, MHD_NO, MHD_NO);
+ ret = MHD_queue_response(connection, MHD_HTTP_NOT_FOUND, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+
+ LOG_DEBUG("Serving %s length=%d", url, len);
+ /* serve file directly */
+ response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO);
+ MHD_add_response_header(response, "Content-Type", "image/png");
+
+ ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
+ MHD_destroy_response(response);
+
+ //free(data);
+ return ret;
+ }
+}
+
+static int ahc_echo(void * cls, struct MHD_Connection * connection,
+ const char * url, const char * method, const char * version,
+ const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+{
int post = 0;
if (0 == strcmp(method, "POST"))
@@ -337,79 +413,19 @@ static int ahc_echo(void * cls, struct MHD_Connection * connection,
* being subverted to evil purposes
*/
- url++; /* skip '/' */
+ const char *httpd_dir=PKGLIBDIR "/httpd";
- const char *suffix;
- suffix = strrchr(url, '.');
- if ((suffix != NULL) && (strcmp(suffix, ".tcl") == 0))
+ if (*url=='/')
{
- printf("Run tcl %s\n", url);
-
- int retcode;
-
- const char *script = alloc_printf(
- "global httpdata; source {%s}; set httpdata", url);
- retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
- free((void *) script);
-
- if (retcode == JIM_ERR)
- {
- printf("Tcl failed\n");
- const char *t = httpd_exec_cgi_tcl_error(interp);
- if (t == NULL)
- return MHD_NO;
-
- response = MHD_create_response_from_data(strlen(t), (void *) t,
- MHD_YES, MHD_NO);
- ret = MHD_queue_response(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR, response);
- MHD_destroy_response(response);
- return ret;
- }
- else
- {
- printf("Tcl OK\n");
- /* FIX!!! how to handle mime types??? */
- const char *result;
- int reslen;
- result = Jim_GetString(Jim_GetResult(interp), &reslen);
-
- response = MHD_create_response_from_data(reslen, (void *) result,
- MHD_NO, MHD_YES);
- ret = MHD_queue_response(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR, response);
- MHD_destroy_response(response);
- return ret;
- }
+ url++; /* skip '/' */
}
- else
- {
- void *data;
- int len;
-
- int retval = loadFile(url, &data, &len);
- if (retval != ERROR_OK)
- {
- printf("Did not find %s\n", url);
-
- response = MHD_create_response_from_data(strlen(PAGE_NOT_FOUND),
- (void *) PAGE_NOT_FOUND, MHD_NO, MHD_NO);
- ret = MHD_queue_response(connection, MHD_HTTP_NOT_FOUND, response);
- MHD_destroy_response(response);
- return ret;
- }
-
- printf("Serving %s length=%d\n", url, len);
- /* serve file directly */
- response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO);
- MHD_add_response_header(response, "Content-Type", "image/png");
+ if (!*url)
+ url="index.tcl";
- ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
- MHD_destroy_response(response);
-
- //free(data);
- return ret;
- }
+ const char *file_name=alloc_printf("%s/%s", httpd_dir, url);
+ int result = handle_request(connection, file_name);
+ free((void *)file_name);
+ return result;
}
static struct MHD_Daemon * d;
diff --git a/src/server/httpd/Stylizer.class b/src/server/httpd/Stylizer.class
new file mode 100644
index 00000000..ffa08ce7
--- /dev/null
+++ b/src/server/httpd/Stylizer.class
Binary files differ
diff --git a/src/server/httpd/Stylizer.java b/src/server/httpd/Stylizer.java
new file mode 100644
index 00000000..3b8bee3e
--- /dev/null
+++ b/src/server/httpd/Stylizer.java
@@ -0,0 +1,114 @@
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.xpath.XPathAPI;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/** used to generate .tcl files from */
+public class Stylizer
+{
+ // Global value so it can be ref'd by the tree-adapter
+ static Document document;
+ public static void main(String argv[])
+ {
+ if (argv.length != 3)
+ {
+ System.err.println("Usage: java Stylizer stylesheet xmlfile outputdir");
+ System.exit(1);
+ }
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ try
+ {
+ System.err.println("Starting conversion...");
+
+ File stylesheet = new File(argv[0]);
+ File datafile = new File(argv[1]);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ document = builder.parse(datafile);
+
+ NodeList list = XPathAPI.selectNodeList(document, "website/language/page");
+
+ for (int i=0; i<list.getLength(); i++)
+ {
+ Node node=list.item(i);
+
+ // Use a Transformer for output
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ StreamSource stylesource = new StreamSource(stylesheet);
+ Transformer transformer = tFactory.newTransformer(stylesource);
+
+ Node fileName = XPathAPI.selectSingleNode(node, "outfile/text()");
+
+ System.err.println("Converting " + fileName.getNodeValue());
+ DOMSource source = new DOMSource(document);
+
+ OutputStream output=new FileOutputStream(new File(argv[2], fileName.getNodeValue()));
+
+
+ try
+ {
+ StreamResult result = new StreamResult(output);
+
+ transformer.setParameter("pagetogenerate", fileName.getNodeValue());
+ transformer.transform(source, result);
+ }
+ finally
+ {
+ output.close();
+ }
+ }
+ } catch (TransformerConfigurationException tce)
+ {
+ // Error generated by the parser
+ System.out.println("\n** Transformer Factory error");
+ System.out.println(" " + tce.getMessage());
+ // Use the contained exception, if any
+ Throwable x = tce;
+ if (tce.getException() != null)
+ x = tce.getException();
+ x.printStackTrace();
+ } catch (TransformerException te)
+ {
+ // Error generated by the parser
+ System.out.println("\n** Transformation error");
+ System.out.println(" " + te.getMessage());
+ // Use the contained exception, if any
+ Throwable x = te;
+ if (te.getException() != null)
+ x = te.getException();
+ x.printStackTrace();
+ } catch (SAXException sxe)
+ {
+ // Error generated by this application
+ // (or a parser-initialization error)
+ Exception x = sxe;
+ if (sxe.getException() != null)
+ x = sxe.getException();
+ x.printStackTrace();
+ } catch (ParserConfigurationException pce)
+ {
+ // Parser with specified options can't be built
+ pce.printStackTrace();
+ } catch (IOException ioe)
+ {
+ // I/O error
+ ioe.printStackTrace();
+ }
+ } // main
+}
diff --git a/src/server/httpd/browsemem.tcl b/src/server/httpd/browsemem.tcl
new file mode 100644
index 00000000..b34ff692
--- /dev/null
+++ b/src/server/httpd/browsemem.tcl
@@ -0,0 +1,456 @@
+# converted to .tcl by html2tcl.tcl
+set buffer ""
+append buffer {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <html xmlns="http://www.w3.org/TR/REC-html40">
+<head>
+<title>OpenOCD debugger</title>
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>
+</head>
+}
+
+ set console ""
+ set upload_filename /ram/upload
+
+append buffer {
+<body style="margin:0px;">
+<div style="width:974px;height:85px;">
+<div style="float:left;position:relative;left:32px;width:478px;">
+<a href="/">
+ OpenOCD
+ </a>
+</div>
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">
+<div style="position:relative;left:15px;top:4px;" class="textlight">
+}
+append buffer [capture version]
+append buffer {
+</div>
+</div>
+</div>
+<table style="padding:0px;border-collapse:collapse;">
+<tr>
+<td style="width:33px;">
+<div style="width:20px;height:510px;">
+ &nbsp;
+ </div>
+</td>
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">
+<tr style="height:59px;">
+<td/>
+</tr>
+<tr>
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">
+<a href="browsemem.tcl" style="font-weight: bold;">Browse / Edit</a>
+</div>
+</td>
+</tr>
+<tr>
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">
+<a href="downloadmem.tcl" style="">Download</a>
+</div>
+</td>
+</tr>
+<tr>
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>
+</tr>
+<tr>
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>
+</tr>
+<tr>
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>
+</tr>
+</table>
+</td>
+<td style="vertical-align:top;padding:0px;height:100%">
+<table style="padding:0px;border-collapse:collapse;height:100%;">
+<tr>
+<td>
+<table style="padding:0px;border-collapse:collapse;">
+<tr>
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">
+<a href="index.tcl">Config Target</a>
+</div>
+</td>
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">
+<a href="flashinfo.tcl">Flash</a>
+</div>
+</td>
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">
+<a href="browsemem.tcl" style="font-weight: bold;">Memory</a>
+</div>
+</td>
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">
+<a href="openocd.tcl">OpenOCD</a>
+</div>
+</td>
+</tr>
+</table>
+</td>
+</tr>
+<tr>
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">
+<div style="width:500px;background-color:#ffffff;height:100%;">
+ &nbsp;
+ </div>
+</td>
+</tr>
+<tr>
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">
+<H1>Browse / Edit Memory</H1>
+</td>
+</tr>
+<tr style="height:100%;">
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">
+
+
+
+ }
+
+
+ set form_address [formfetch form_address]
+ set form_length [formfetch form_length]
+ set form_type [formfetch form_type]
+ set form_action [formfetch form_action]
+ set form_value [formfetch form_value]
+
+ if {[string compare $form_length ""]==0} {
+ set form_length 0
+ }
+ if {$form_length<=0} {
+ set form_length 0x80
+ }
+ if {$form_length>0x1000} {
+ set form_length 0x1000
+ }
+
+ if {[string compare $form_type ""]==0} {
+ set form_type mdw
+ }
+
+ if {[string compare $form_type "mdw"]==0} {
+ set wordsize 4
+ set modify_cmd mww
+ }
+ if {[string compare $form_type "mdh"]==0} {
+ set wordsize 2
+ set modify_cmd mwh
+ }
+ if {[string compare $form_type "mdb"]==0} {
+ set wordsize 1
+ set modify_cmd mwb
+ }
+
+
+
+
+ if {[string compare $form_address ""]!=0} {
+ if {[string compare $form_action "Previous"]==0} {
+ # Kludge! Work around problems parsing hex in Jim Tcl expressions
+ incr form_address ; set form_address [expr $form_address-1]
+ if {$form_address-$form_length>0} {
+ set form_address "0x[tohex [expr $form_address-$form_length]]"
+ } else {
+ set form_address "0x0"
+ }
+ }
+ if {[string compare $form_action "Next"]==0} {
+ # Kludge! Work around problems parsing hex in Jim Tcl expressions
+ incr form_address ; set form_address [expr $form_address-1]
+ set form_address "0x[tohex [expr $form_address+$form_length]]"
+ }
+ if {[string compare $form_action "Modify"]==0} {
+ append console [capture_catch "$modify_cmd $form_address $form_value"]
+ }
+ if {[string compare $form_action "Fill"]==0} {
+ append console [capture_catch "$modify_cmd $form_address $form_value $form_length"]
+ }
+ }
+
+
+
+append buffer {
+
+ <form action="browsemem.tcl" method="post">
+ <table>
+ <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="}
+append buffer $form_address
+append buffer {"></td></tr>
+ <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="}
+append buffer "0x[tohex $form_length]"
+append buffer {"></td></tr>
+ <tr><td class="formtext">Value</td><td><input type="text" name="form_value" value="}
+append buffer $form_value
+append buffer {"></td>
+ <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Modify"></td>
+ <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Fill"></td></tr>
+ <tr><td class="formtext">Type</td><td style="padding-top:1px;">
+ <select name="form_type">
+ <option
+ }
+if {[string compare $form_type "mdb"]==0} { append buffer {selected="selected"} }
+append buffer { value ="mdb">8 bit
+ </option>
+ <option
+ }
+if {[string compare $form_type "mdh"]==0} { append buffer {selected="selected"} }
+append buffer { value ="mdh">16 bit
+ </option>
+ <option
+ }
+if {[string compare $form_type "mdw"]==0} { append buffer {selected="selected"} }
+append buffer {value ="mdw">32 bit
+ </option>
+ </select>
+
+ </td></tr>
+ </table>
+ <table>
+ <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+ <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
+ <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+ </table>
+
+ <table><tr>
+ <td><input type="submit" name="form_action" value="Refresh"></td>
+ <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Previous" ></td>
+ <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Next" ></td>
+ </tr></table>
+ <br>
+
+ </form>
+ <p>
+ <div class="fontbigger">Memory:</div><p>
+ <code style="white-space: nowrap; font-size:11px;font:courier new;">
+ }
+
+ if {[string compare $form_address ""]!=0} {
+ append console [encode [capture_catch halt]]
+ append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]]
+ }
+
+append buffer {
+ </code>
+
+
+
+
+
+ </td>
+</tr>
+}
+
+
+ set toggle_details [formfetch toggle_details]
+ if {[string length $toggle_details]==0} {
+ set toggle_details 0
+ }
+ set show_details [load_var show_details]
+ if {[string length $show_details]==0} {
+ set show_details 0
+ }
+ if {$toggle_details==1} {
+ set show_details [expr 1-$show_details]
+ save_var show_details $show_details
+ }
+
+ if {[string length $console]!=0} {
+
+append buffer {
+<tr style="height:100%;">
+<td style="height:100%;background-color:red;" colspan="6">
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">
+<td style="width:25px;">&nbsp;</td>
+}
+
+ if {$show_details==1} {
+ append buffer <
+ append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}
+ append buffer >
+ } else {
+ append buffer <
+ append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}
+ append buffer >
+ }
+
+append buffer {
+<a class="openocd" href="browsemem.tcl?toggle_details=1">
+}
+
+ if {$show_details==1} {
+ append buffer "Hide details"
+ append buffer <br/>
+ } else {
+ append buffer {<div style="position:relative;top:7px;text-align:center;">}
+ append buffer "Show details"
+ append buffer {</div>}
+ }
+
+append buffer {
+</a>
+}
+
+ if {$show_details==1} {
+ append buffer $console
+ }
+
+append buffer {</td>}
+
+ if {$show_details!=1} {
+ append buffer {<td>&nbsp;</td>}
+ }
+
+append buffer {
+<td style="width:25px;">&nbsp;</td>
+</table>
+</td>
+</tr>
+}
+
+ }
+
+append buffer {
+<tr>
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">
+<div style="width:500px;background-color:#ffffff;height:100%;">
+ &nbsp;
+ </div>
+</td>
+</tr>
+</table>
+</td>
+<td style="width:6px;"/>
+<td style="width:245px;height:100%">
+<table style="padding:0px;border-collapse:collapse;height:100%;">
+<tr>
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">
+ Documentation
+ </div>
+</td>
+<td width="40px">
+ &nbsp;
+ </td>
+<td/>
+</tr>
+<tr>
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>
+</tr>
+<tr>
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>
+<br/>
+</td>
+</tr>
+<tr>
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>
+</tr>
+<tr>
+<td colspan="3">
+<table style="padding:0px;border-collapse:collapse;">
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>
+<td style="background-color:#999999;width:225px; height:1px;"/>
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>
+</table>
+</td>
+</tr>
+<tr>
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>
+</tr>
+<tr style="height:100%;">
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">
+
+ <p>Browse and edit target memory.<br>
+ Length is in bytes, maximum 4096 bytes.</p>
+ <p>An error message is shown when trying to browse or edit memory which cases a CPU fault.</p>
+ <p>CPU will be halted if required.</p>
+ <p><b>Modify</b> - Will modify only one byte, half-word or word starting at Address.</p>
+ <p><b>Fill</b> - Will fill the specified region with the specified value.</p>
+ <p><b>Refresh</b> - Display the content of the specified memory area.</p>
+
+ </td>
+</tr>
+<tr>
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">
+ &nbsp;
+ </td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+</body>
+</html>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+start_chunked "html"
+write_chunked $buffer
+end_chunked
+
diff --git a/src/server/httpd/build.sh b/src/server/httpd/build.sh
new file mode 100644
index 00000000..93831a50
--- /dev/null
+++ b/src/server/httpd/build.sh
@@ -0,0 +1,3 @@
+set e
+java -classpath ../../../../zy1000/build/xalan.jar\;. Stylizer menu.xsl menu.xml .
+find . -regex ".*\.tcl" -type f -exec sh html2tcl.sh {} {} \;
diff --git a/src/server/httpd/downloadmem.tcl b/src/server/httpd/downloadmem.tcl
new file mode 100644
index 00000000..035ff3d9
--- /dev/null
+++ b/src/server/httpd/downloadmem.tcl
@@ -0,0 +1,368 @@
+# converted to .tcl by html2tcl.tcl
+set buffer ""
+append buffer {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+