Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ab3a250

Browse files
committed
libsocket.tex: send[to] returns nbytes.
libstring.tex: added count(). ref2.tex: new keywords; moved keyword printing program to keywords.py.
1 parent 7f43da7 commit ab3a250

6 files changed

Lines changed: 56 additions & 4 deletions

File tree

Doc/keywords.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /usr/local/bin/python
2+
3+
# This Python program sorts and reformats the table of keywords in ref2.tex
4+
5+
import string
6+
l = []
7+
try:
8+
while 1:
9+
l = l + string.split(raw_input())
10+
except EOFError:
11+
pass
12+
l.sort()
13+
for x in l[:]:
14+
while l.count(x) > 1: l.remove(x)
15+
ncols = 5
16+
nrows = (len(l)+ncols-1)/ncols
17+
for i in range(nrows):
18+
for j in range(i, len(l), nrows):
19+
print string.ljust(l[j], 10),
20+
print

Doc/lib/libsocket.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ \subsection{Socket Object Methods}
193193

194194
\begin{funcdesc}{send}{string}
195195
Send data to the socket. The socket must be connected to a remote
196-
socket.
196+
socket. Return the number of bytes sent.
197197
\end{funcdesc}
198198

199199
\begin{funcdesc}{sendto}{string\, address}
200200
Send data to the socket. The socket should not be connected to a
201201
remote socket, since the destination socket is specified by
202-
\code{address}.
202+
\code{address}. Return the number of bytes sent.
203203
(The format of \var{address} depends on the address family -- see above.)
204204
\end{funcdesc}
205205

Doc/lib/libstring.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ \section{Standard Module \sectcode{string}}
130130
not found.
131131
\end{funcdesc}
132132

133+
\begin{funcdesc}{count}{s\, sub\, i}
134+
Return the number of (non-overlapping) occurrences of substring
135+
\var{sub} in string \var{s} with index at least \var{i}.
136+
If \var{i} is omitted, it defaults to \code{0}.
137+
\end{funcdesc}
138+
133139
\begin{funcdesc}{lower}{s}
134140
Convert letters to lower case.
135141
\end{funcdesc}

Doc/libsocket.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ \subsection{Socket Object Methods}
193193

194194
\begin{funcdesc}{send}{string}
195195
Send data to the socket. The socket must be connected to a remote
196-
socket.
196+
socket. Return the number of bytes sent.
197197
\end{funcdesc}
198198

199199
\begin{funcdesc}{sendto}{string\, address}
200200
Send data to the socket. The socket should not be connected to a
201201
remote socket, since the destination socket is specified by
202-
\code{address}.
202+
\code{address}. Return the number of bytes sent.
203203
(The format of \var{address} depends on the address family -- see above.)
204204
\end{funcdesc}
205205

Doc/libstring.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ \section{Standard Module \sectcode{string}}
130130
not found.
131131
\end{funcdesc}
132132

133+
\begin{funcdesc}{count}{s\, sub\, i}
134+
Return the number of (non-overlapping) occurrences of substring
135+
\var{sub} in string \var{s} with index at least \var{i}.
136+
If \var{i} is omitted, it defaults to \code{0}.
137+
\end{funcdesc}
138+
133139
\begin{funcdesc}{lower}{s}
134140
Convert letters to lower case.
135141
\end{funcdesc}

Doc/tools/keywords.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /usr/local/bin/python
2+
3+
# This Python program sorts and reformats the table of keywords in ref2.tex
4+
5+
import string
6+
l = []
7+
try:
8+
while 1:
9+
l = l + string.split(raw_input())
10+
except EOFError:
11+
pass
12+
l.sort()
13+
for x in l[:]:
14+
while l.count(x) > 1: l.remove(x)
15+
ncols = 5
16+
nrows = (len(l)+ncols-1)/ncols
17+
for i in range(nrows):
18+
for j in range(i, len(l), nrows):
19+
print string.ljust(l[j], 10),
20+
print

0 commit comments

Comments
 (0)