diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-09-13 13:13:44 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-09-13 13:13:44 +0200 |
| commit | 9464a0c36318f8a801c07d6874bd0cea40f12504 (patch) | |
| tree | f0178491c19d4f1ebc7b92eede86690998466480 /src/cmd/godoc/codewalk.go | |
| parent | ba9fda6068cfadd42db0b152fdca7e8b67aaf77d (diff) | |
| parent | 5ff4c17907d5b19510a62e08fd8d3b11e62b431d (diff) | |
| download | golang-9464a0c36318f8a801c07d6874bd0cea40f12504.tar.gz | |
Merge commit 'upstream/60' into debian-sid
Diffstat (limited to 'src/cmd/godoc/codewalk.go')
| -rw-r--r-- | src/cmd/godoc/codewalk.go | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/src/cmd/godoc/codewalk.go b/src/cmd/godoc/codewalk.go index 50043e2ab..e2643e466 100644 --- a/src/cmd/godoc/codewalk.go +++ b/src/cmd/godoc/codewalk.go @@ -28,7 +28,6 @@ import ( "xml" ) - // Handler for /doc/codewalk/ and below. func codewalk(w http.ResponseWriter, r *http.Request) { relpath := r.URL.Path[len("/doc/codewalk/"):] @@ -71,7 +70,6 @@ func codewalk(w http.ResponseWriter, r *http.Request) { servePage(w, "Codewalk: "+cw.Title, "", "", b) } - // A Codewalk represents a single codewalk read from an XML file. type Codewalk struct { Title string `xml:"attr"` @@ -79,7 +77,6 @@ type Codewalk struct { Step []*Codestep } - // A Codestep is a single step in a codewalk. type Codestep struct { // Filled in from XML @@ -97,7 +94,6 @@ type Codestep struct { Data []byte } - // String method for printing in template. // Formats file address nicely. func (st *Codestep) String() string { @@ -111,7 +107,6 @@ func (st *Codestep) String() string { return s } - // loadCodewalk reads a codewalk from the named XML file. func loadCodewalk(filename string) (*Codewalk, os.Error) { f, err := fs.Open(filename) @@ -173,7 +168,6 @@ func loadCodewalk(filename string) (*Codewalk, os.Error) { return cw, nil } - // codewalkDir serves the codewalk directory listing. // It scans the directory for subdirectories or files named *.xml // and prepares a table. @@ -207,7 +201,6 @@ func codewalkDir(w http.ResponseWriter, r *http.Request, relpath, abspath string servePage(w, "Codewalks", "", "", b) } - // codewalkFileprint serves requests with ?fileprint=f&lo=lo&hi=hi. // The filename f has already been retrieved and is passed as an argument. // Lo and hi are the numbers of the first and last line to highlight @@ -256,7 +249,6 @@ func codewalkFileprint(w http.ResponseWriter, r *http.Request, f string) { io.WriteString(w, "</pre>") } - // addrToByte evaluates the given address starting at offset start in data. // It returns the lo and hi byte offset of the matched region within data. // See http://plan9.bell-labs.com/sys/doc/sam/sam.html Table II @@ -351,7 +343,6 @@ func addrToByteRange(addr string, start int, data []byte) (lo, hi int, err os.Er return lo, hi, nil } - // addrNumber applies the given dir, n, and charOffset to the address lo, hi. // dir is '+' or '-', n is the count, and charOffset is true if the syntax // used was #n. Applying +n (or +#n) means to advance n lines @@ -437,7 +428,6 @@ func addrNumber(data []byte, lo, hi int, dir byte, n int, charOffset bool) (int, return 0, 0, os.NewError("address out of range") } - // addrRegexp searches for pattern in the given direction starting at lo, hi. // The direction dir is '+' (search forward from hi) or '-' (search backward from lo). // Backward searches are unimplemented. @@ -465,7 +455,6 @@ func addrRegexp(data []byte, lo, hi int, dir byte, pattern string) (int, int, os return m[0], m[1], nil } - // lineToByte returns the byte index of the first byte of line n. // Line numbers begin at 1. func lineToByte(data []byte, n int) int { @@ -483,7 +472,6 @@ func lineToByte(data []byte, n int) int { return len(data) } - // byteToLine returns the number of the line containing the byte at index i. func byteToLine(data []byte, i int) int { l := 1 |
