[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1439 - GNUnet-docs/WWW
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1439 - GNUnet-docs/WWW |
Date: |
Tue, 12 Jul 2005 18:22:30 -0700 (PDT) |
Author: grothoff
Date: 2005-07-12 18:22:27 -0700 (Tue, 12 Jul 2005)
New Revision: 1439
Modified:
GNUnet-docs/WWW/protocol_p2p.php3
GNUnet-docs/WWW/scripts.inc
Log:
try
Modified: GNUnet-docs/WWW/protocol_p2p.php3
===================================================================
--- GNUnet-docs/WWW/protocol_p2p.php3 2005-07-13 00:50:13 UTC (rev 1438)
+++ GNUnet-docs/WWW/protocol_p2p.php3 2005-07-13 01:22:27 UTC (rev 1439)
@@ -26,11 +26,9 @@
extlink_("doxygen/html/structMessagePart.html","header"));
EP();
-echo "<table class=\"border\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0\">\n";
-include("bittable.inc");
-row(shortEntry_("message size", NBO_()),
- shortEntry_("request type", NBO_()));
-echo "</table>\n";
+LAYOUT("MessagePart",
+ ARRAY(N("message size", NBO_()) => 2,
+ N("request type", NBO_()) => 2));
BP();
W("The header is followed by <tt>message size</tt> octets for the message.");
Modified: GNUnet-docs/WWW/scripts.inc
===================================================================
--- GNUnet-docs/WWW/scripts.inc 2005-07-13 00:50:13 UTC (rev 1438)
+++ GNUnet-docs/WWW/scripts.inc 2005-07-13 01:22:27 UTC (rev 1439)
@@ -27,55 +27,92 @@
<?php
}
-function shortEntry_($a, $b="") {
- return "<td class=\"tbl\">" . W_($a) . $b . "</td>";
+// create an alement name consisting of the translation of $name
+// and the concrete value $name and possibly an NBO tag
+function V($name, $val, $nbo="") {
+ return W_($name) . " (" . $val . (($nbo == "")?"":",$nbo") . ")";
}
-function shortEntryVerbatim_($a, $b="") {
- return "<td class=\"tbl\">" . $a . $b . "</td>";
+
+// create an alement name consisting of the translation of $name
+// and possibly an NBO tag
+function N($name, $nbo="") {
+ return W_($name) . " (" . $val . (($nbo == "")?"":",$nbo") . ")";
}
-function row($a, $b) {
- echo "<tr>" . $a . $b . "</tr>\n";
+
+// formats a struct for showStructLayout
+// $elements is an (ordered!) list mapping a name
+function F($elements) {
+ $ret = ARRAY();
+ $offset = 0;
+ $currString = "";
+ foreach($elements as $name => $size) {
+ if (($offset % 4) == 0) {
+ if ($size >= 4) {
+ $ret[] = "<td>$offset</td><td colspan=4>$name</td>";
+ $mod = $size % 4;
+ if ($mod > 0) {
+ $offset += $size - $mod;
+ $currString = "<td>$offset</td><td colspan=$mod>$name</td>";
+ $offset += $mod;
+ } else {
+ $offset += $size;
+ }
+ } else {
+ $left = 4 - ($offset % 4);
+ if ($left > $size)
+ $left = $size;
+ $currString = $currString . "<td>$offset</td><td
colspan=$left>$name</td>";
+ $offset += $left;
+ $size -= $left;
+ if ($offset % 4 == 0) {
+ $ret[] = $currString;
+ $currString = "";
+ }
+ if ($size > 0) {
+ $mod = $size % 4;
+ if ($size >= 4) {
+ $size -= $mod;
+ $ret[] = "<td>$offset</td><td colspan=4>$name</td>";
+ $offset += $size;
+ }
+ if ($mod > 0) {
+ $currString = "<td>$offset</td><td colspan=$mod>$name</td>";
+ $offset += $mod;
+ }
+ }
+ }
+ }
+ }
+ return $ret;
}
-function rowIntEntry($a, $b="") {
- echo "<tr><td class=\"tbl\" colspan=2>" . W_($a) . $b . "</td></tr>\n";
+
+function LAYOUT($structName,
+ $fieldArray) {
+ echo "<table class=\"border\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0\">\n";
+ echo "<tr><th colspan=5 valign=center><a href=\"doxygen/html/struct" .
+ $structName . ".html\">" . $structName . "</a></th></tr>";
+ echo "<tr><th rowspan=2>" . W_("Offset") .
+ "</th><th colspan=4>" . W_("Bit position") .
+ "</th></tr>\n";
+ echo "<tr><th>0-7</th><th>8-15</th><th>16-23</th><th>24-31</th></tr>\n";
+ $cnt = 0;
+ foreach($fieldArray as $value) {
+ echo "<tr>" . $value . "</tr>\n";
+ $cnt++;
+ }
+ if ($cnt > 5)
+ echo "<tr><th>0-7</th><th>8-15</th><th>16-23</th><th>24-31</th></tr>\n";
+ echo "</table>\n";
}
-function rowIntEntryNBO($a) {
- rowIntEntry($a, NBO_());
-}
-function fiveRowIntEntries($a) {
- for ($i=0;$i<5;$i++)
- rowIntEntry($a);
-}
-function rowIntEntryVerbatim($a, $b="") {
- echo "<tr><td class=\"tbl\" colspan=2>" . $a . $b . "</td></tr>\n";
-}
-function rowSizeType($size, $type) {
- row(shortEntryVerbatim_($size . " (" . W_("size") . ")", NBO_()),
- shortEntryVerbatim_($type . " (" . W_("type") . ")", NBO_()));
-}
-function NBO() {
- global $haveNBO;
-
- $haveNBO = 1;
- echo "(<a href=\"#NBO\">NBO</a>)";
-}
+
function NBO_() {
global $haveNBO;
$haveNBO = 1;
return "(<a href=\"#NBO\">NBO</a>)";
}
+function NBO() {
+ echo NBO_();
+}
-
-//H2("Footnotes");
-//ANCHOR("nbo");H3("NBO - network byte order");
-/*Fields of this type are in network byte order.");
- W("Before reading these
- fields, they must be converted to host byte order using <tt>htons</tt>
- for 2-byte values and <tt>htonl</tt> for 4-byte values.");
- W("Before writing
- to these fields, the value must be converted using <tt>ntohs</tt> and
- <tt>ntohl</tt> respectively.");
-*/
-
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1439 - GNUnet-docs/WWW,
grothoff <=