Skip to content

Commit

Permalink
Rearrange the binary protocol docs and xml2rfc tools.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.sixapart.com/svn/memcached/branches/binary@776 b0b603af-a30f-0410-a34e-baf09ae79d0b
  • Loading branch information
Aaron Stone committed Apr 27, 2008
1 parent f1351f9 commit f5e4d26
Show file tree
Hide file tree
Showing 12 changed files with 748 additions and 67 deletions.
8 changes: 8 additions & 0 deletions doc/Makefile-xml2rfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%.txt: %.full
xml2rfc $< $@

%.chk: %.xml xml2rfc/rfc2629-refchk.xsl
xsltproc xml2rfc/rfc2629-refchk.xsl $< >$@

%.full: %.xml xml2rfc/rfc2629-noinc.xsl
xsltproc xml2rfc/rfc2629-noinc.xsl $< >$@
66 changes: 0 additions & 66 deletions doc/binary-protocol-plan.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<!DOCTYPE rfc SYSTEM "xml2rfc/rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt'?>
<?rfc toc="yes"?>
<?rfc strict="yes"?>
Expand Down
22 changes: 22 additions & 0 deletions doc/xml2rfc/reference.RFC.0768.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?>

<reference anchor='RFC0768'>

<front>
<title>User Datagram Protocol</title>
<author initials='J.' surname='Postel' fullname='J. Postel'>
<organization>University of Southern California (USC)/Information Sciences Institute</organization>
<address>
<postal>
<street>4676 Admiralty Way</street>
<city>Marina del Rey</city>
<region>CA</region>
<code>90291</code>
<country>US</country></postal>
<phone>+1 213 822 1511</phone></address></author>
<date year='1980' day='28' month='August' /></front>

<seriesInfo name='STD' value='6' />
<seriesInfo name='RFC' value='768' />
<format type='TXT' octets='5896' target='ftp://ftp.isi.edu/in-notes/rfc768.txt' />
</reference>
106 changes: 106 additions & 0 deletions doc/xml2rfc/rfc2629-noinc.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="xml"/>

<xsl:template name='noinc'>
<xsl:apply-templates mode='noinc'/>
</xsl:template>

<xsl:template match="*" mode='noinc'>
<xsl:copy>
<xsl:apply-templates select='@*' mode='noinc'/>
<xsl:apply-templates mode='noinc'/>
</xsl:copy>
</xsl:template>
<xsl:template match='@*' mode='noinc'>
<xsl:attribute name='{name()}'>
<xsl:value-of select='.'/>
</xsl:attribute>
</xsl:template>

<xsl:template match='processing-instruction("rfc")' mode='noinc'>
<xsl:choose>
<xsl:when test='substring-before(.,"=") = "include"'>
<xsl:call-template name='include-pi'>
<xsl:with-param name='include-href'>
<xsl:value-of select="translate( substring-after( ., '=' ), '&quot; ', '' )"/><xsl:text>.xml</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select='.'/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name='include-pi'>
<xsl:param name='include-href'/>
<xsl:apply-templates select="document( $include-href )" mode='noinc'/>
</xsl:template>

<xsl:template match='dwdrfc-ref' mode='noinc'>
<xsl:param name='include-href'>
<xsl:choose>
<xsl:when test='starts-with( @src, "http://" )'>
<xsl:value-of select='@src'/>
</xsl:when>
<xsl:otherwise>
<xsl:text>http://xml.resource.org/public/rfc/</xsl:text>
<xsl:value-of select='@src'/>
<xsl:text>.xml</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<reference anchor="{@anchor}">
<xsl:apply-templates select="document( $include-href )" mode="refrename"/>
</reference>
</xsl:template>

<xsl:template match='*' mode='refrename'>
<xsl:apply-templates mode='refrename'/>
</xsl:template>

<xsl:template match='reference' mode='refrename'>
<xsl:apply-templates mode='noinc'/>
</xsl:template>

<xsl:template match='/'>
<xsl:call-template name='noinc'/>
</xsl:template>

<xsl:template name='output'>
<xsl:param name='foo'/>
<xsl:copy-of select='$foo'/>
<xsl:apply-templates select='$foo'/>
</xsl:template>

<xsl:template match='*' mode='output'>
<element>
<xsl:value-of select='name()'/>
<xsl:apply-templates mode='output'/>
</element>
</xsl:template>
<xsl:template match='text()' mode='output'/>

<!-- Reference checking attributes stripped here. -->
<xsl:template match='references' mode='noinc'>
<xsl:element name='references'>
<xsl:attribute name='title'>
<xsl:value-of select='@title'/>
</xsl:attribute>
<xsl:apply-templates mode='noinc'/>
</xsl:element>
</xsl:template>

<xsl:template match='xref' mode='noinc'>
<xsl:element name='xref'>
<xsl:attribute name='target'>
<xsl:value-of select='@target'/>
</xsl:attribute>
<xsl:apply-templates mode='noinc'/>
</xsl:element>
</xsl:template>

</xsl:stylesheet>
61 changes: 61 additions & 0 deletions doc/xml2rfc/rfc2629-other.ent
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!-- rfc2629-other.ent

Character entity set for RFC-2629 source xml documents.
There is no need to invoke this directly from
the source document itself; just invoke the DTD.

These are unknown to (X)HTML, so any converter to these
formats must either substitute these entities
or invoke this file from the output file.

Conversion to txt or nroff format will replace
these entities by the parenthesized text.

Typical invocation:
<!ENTITY % rfc2629-other
PUBLIC "-//IETF//ENTITIES Other for RFC 2629//EN"
"http://xml.resource.org/authoring/rfc2629-other.ent">
%rfc2629-other;
-->

<!-- Magical -->
<!-- rfc.number (automatically expanded to content
of number="..." attribute
of <rfc> element, or to "XXXX") -->

<!-- ASCII -->
<!ENTITY excl "&#33;"><!-- U+0021 EXCLAMATION MARK ("!") -->
<!ENTITY num "&#35;"><!-- U+0023 NUMBER SIGN ("#") -->
<!ENTITY dollar "&#36;"><!-- U+0024 DOLLAR SIGN ("$") -->
<!ENTITY percnt "&#37;"><!-- U+0025 PERCENT SIGN ("%") -->
<!ENTITY lpar "&#40;"><!-- U+0028 LEFT PARENTHESIS ("(") -->
<!ENTITY rpar "&#41;"><!-- U+0029 RIGHT PARENTHESIS (")") -->
<!ENTITY ast "&#42;"><!-- U+002A ASTERISK ("*") -->
<!ENTITY plus "&#43;"><!-- U+002B PLUS SIGN ("+") -->
<!ENTITY comma "&#44;"><!-- U+002C COMMA (",") -->
<!ENTITY hyphen "&#45;"><!-- U+002D HYPHEN-MINUS ("-") -->
<!ENTITY period "&#46;"><!-- U+002E FULL STOP (".") -->
<!ENTITY sol "&#47;"><!-- U+002F SOLIDUS ("/") -->
<!ENTITY colon "&#58;"><!-- U+003A COLON (":") -->
<!ENTITY semi "&#59;"><!-- U+003B SEMICOLON (";") -->
<!ENTITY equals "&#61;"><!-- U+003D EQUALS SIGN ("=") -->
<!ENTITY quest "&#63;"><!-- U+003F QUESTION MARK ("?") -->
<!ENTITY commat "&#64;"><!-- U+0040 COMMERCIAL AT ("@") -->
<!ENTITY lsqb "&#91;"><!-- U+005B LEFT SQUARE BRACKET ("[") -->
<!ENTITY bsol "&#92;"><!-- U+005C REVERSE SOLIDUS ("\\") -->
<!ENTITY rsqb "&#93;"><!-- U+005D RIGHT SQUARE BRACKET ("]") -->
<!ENTITY circ "&#94;"><!-- U+005E CIRCUMFLEX ACCENT ("^") -->
<!ENTITY lowbar "&#95;"><!-- U+005F LOW LINE ("_") -->
<!ENTITY grave "&#96;"><!-- U+0060 GRAVE ACCENT ("`") -->
<!ENTITY lcub "&#123;"><!-- U+007B LEFT CURLY BRACKET ("{") -->
<!ENTITY verbar "&#124;"><!-- U+007C VERTICAL LINE ("|") -->
<!ENTITY rcub "&#125;"><!-- U+007D RIGHT CURLY BRACKET ("}") -->

<!-- Useful Unicode -->
<!ENTITY Zcaron "&#381;"><!-- U+017D LATIN CAPITAL LETTER Z WITH CARON ("Z") -->
<!ENTITY zcaron "&#382;"><!-- U+017E LATIN SMALL LETTER Z WITH CARON ("z") -->
<!ENTITY dash "&#8208;"><!-- U+2010 HYPHEN ("-") -->
<!ENTITY nbhy "&#8209;"><!-- U+2011 NON-BREAKING HYPHEN (special "-") -->
<!ENTITY wj "&#8288;"><!-- U+2060 WORD JOINER (special "") -->

<!-- EOF -->
81 changes: 81 additions & 0 deletions doc/xml2rfc/rfc2629-refchk.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="xml"/>

<xsl:template match='/'>
<refcheck>
<xsl:apply-templates select='//xref' mode='missing'/>
<xsl:apply-templates select='//reference' mode='orphans'/>
<xsl:apply-templates select='//references[@dwdrfc-type = "norm"]' mode='normcheck'/>
<xsl:apply-templates select='//xref[@dwdrfc-type = "norm"]' mode='normrefs'/>
</refcheck>
</xsl:template>

<xsl:template match='xref' mode='missing'>
<xsl:param name='refname'>
<xsl:value-of select='@target'/>
</xsl:param>
<xsl:param name='reftgt'>
<xsl:value-of select='//*[@anchor = $refname]/@anchor'/>
</xsl:param>
<xsl:choose>
<xsl:when test='$reftgt = $refname'/>
<xsl:otherwise>
<missing><xsl:value-of select='$refname'/></missing><xsl:text>
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match='xref' mode='normrefs'>
<xsl:param name='refname'>
<xsl:value-of select='@target'/>
</xsl:param>
<xsl:param name='reftgt'>
<xsl:value-of select='//references[@dwdrfc-type = "norm"]/*[@anchor = $refname]/@anchor'/>
</xsl:param>
<xsl:choose>
<xsl:when test='$reftgt = $refname'/>
<xsl:otherwise>
<missing-norm><xsl:value-of select='$refname'/></missing-norm><xsl:text>
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match='reference' mode='orphans'>
<xsl:param name='refname'>
<xsl:value-of select='@anchor'/>
</xsl:param>
<xsl:param name='reftgt'>
<xsl:value-of select='//xref[@target = $refname]/@target'/>
</xsl:param>
<xsl:if test='$reftgt != $refname'>
<orphan><xsl:value-of select='$refname'/></orphan><xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>

<xsl:template match='references' mode='normcheck'>
<xsl:apply-templates mode='normcheck'/>
</xsl:template>

<xsl:template match='*' mode='normcheck'>
<!-- Need to find at least one normative reference -->
<xsl:param name='refname'>
<xsl:value-of select='@anchor'/>
</xsl:param>
<xsl:param name='reftgt'>
<xsl:value-of select='//xref[@dwdrfc-type = "norm" and @target = $refname]/@target'/>
</xsl:param>
<xsl:if test='$refname != $reftgt'>
<normchk><xsl:value-of select='$refname'/></normchk><xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>

<xsl:template match='text()' mode='normcheck'/>

</xsl:stylesheet>
Loading

0 comments on commit f5e4d26

Please sign in to comment.