.\" -*-nroff-*-
-.TH alloc 3mLib "8 May 1999" "mLib"
+.TH alloc 3 "8 May 1999" "mLib"
+.\" @xmalloc
+.\" @xrealloc
+.\" @xstrdup
.SH NAME
alloc \- mLib low-level memory allocation
.SH SYNOPSIS
.BR malloc (3),
.BR realloc (3),
.BR free (3),
-.BR exc (3mLib).
+.BR exc (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH base64 3mLib "20 June 1999" mLib
+.TH base64 3 "20 June 1999" mLib
.SH NAME
base64 \- conversion to and from base64 encoding
+.\" @base64_encode
+.\" @base64_decode
+.\" @base64_init
.SH SYNOPSIS
.nf
.B "#include <mLib/base64.h>
and a pointer to a dynamic string
.I d
in which to write its output (see
-.BR dstr (3mLib)
+.BR dstr (3)
for details on dynamic strings). Once all the input data has been
passed through
.B base64_encode
characters in the string and works out the final block length
automatically based on the input size.
.SH "SEE ALSO"
-.BR dstr (3mLib).
+.BR dstr (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH bits 3mLib "20 June 1999" mLib
+.TH bits 3 "20 June 1999" mLib
.SH NAME
bits \- portable bit manipulation macros
+.\" @U8
+.\" @U16
+.\" @U32
+.\"
+.\" @LSL8
+.\" @LSR8
+.\" @LSL16
+.\" @LSR16
+.\" @LSL32
+.\" @LSR32
+.\"
+.\" @ROL8
+.\" @ROR8
+.\" @ROL16
+.\" @ROR16
+.\" @ROL32
+.\" @ROR32
+.\"
+.\" @GETBYTE
+.\" @PUTBYTE
+.\"
+.\" @LOAD8
+.\" @STORE8
+.\"
+.\" @LOAD16_L
+.\" @LOAD16_B
+.\" @LOAD16
+.\" @STORE16_L
+.\" @STORE16_B
+.\" @STORE16
+.\"
+.\" @LOAD32_L
+.\" @LOAD32_B
+.\" @LOAD32
+.\" @STORE32_L
+.\" @STORE32_B
+.\" @STORE32
+.\"
.SH SYNOPSIS
.nf
.B "#include <mLib/bits.h>"
all appropriate type casting and masking. Again, these macros are
written with portability foremost in mind, although it seems they don't
actually perform at all badly in real use.
+.SH "SEE ALSO"
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH conn 3mLib "23 May 1999" mLib
+.TH conn 3 "23 May 1999" mLib
+.\" @conn_init
+.\" @conn_kill
.SH NAME
conn \- selector for nonblocking connections
.SH SYNOPSIS
Pointer to a multiplexor object (type
.BR sel_state )
to which this selector should be attached. See
-.BR sel (3mLib)
+.BR sel (3)
for more details about multiplexors, and how this whole system works.
.TP
.I fd
.B conn_kill
with the address of the selector. The file descriptor is closed, and
the selector becomes safe to be discarded.
+.SH "SEE ALSO"
+.BR connect (2),
+.BR sel (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH crc32 3mLib "8 May 1999" "mLib"
+.TH crc32 3 "8 May 1999" "mLib"
.SH NAME
crc32 \- calculate 32-bit CRC
+.\" @crc32
.SH SYNOPSIS
.nf
.B "#include <mLib/crc32.h>"
carefully chosen polynomial of order 32.
.SH "RETURN VALUE"
The return value is the 32-bit CRC of the input block.
+.SH "SEE ALSO"
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.sp 1
.fi
..
-.TH dspool 3mLib "20 June 1999" mLib
+.TH dspool 3 "20 June 1999" mLib
.SH NAME
dspool \- pools of preallocated dynamic strings
+.\" @dspool_create
+.\" @dspool_destroy
+.\" @dspool_get
+.\" @dspool_put
+.\"
+.\" @DSGET
+.\" @DSPUT
+.\"
.SH SYNOPSIS
.nf
.B "#include <mLib/dspool.h>
except for improved performance.
.SH CAVEATS
The string pool allocator requires the suballocator (see
-.BR sub (3mLib)
+.BR sub (3)
for details). You must ensure that
.B sub_init
is called before any strings are allocated from a string pool.
.SH SEE ALSO
-.BR dstr (3mLib),
-.BR sub (3mLib).
+.BR dstr (3),
+.BR sub (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.RE
.sp 1
..
-.de HP
+.de hP
.IP
.ft B
\h'-\w'\\$1\ 'u'\\$1\ \c
..
.ie t .ds o \(bu
.el .ds o o
-.TH dstr 3mLib "8 May 1999" "mLib"
+.TH dstr 3 "8 May 1999" "mLib"
dstr \- a simple dynamic string type
+.\" @dstr_create
+.\" @dstr_destroy
+.\" @dstr_reset
+.\" @dstr_ensure
+.\" @dstr_tidy
+.\"
+.\" @dstr_putc
+.\" @dstr_putz
+.\" @dstr_puts
+.\" @dstr_putf
+.\" @dstr_putd
+.\" @dstr_putm
+.\" @dstr_putline
+.\" @dstr_write
+.\"
+.\" @DCREATE
+.\" @DDESTROY
+.\" @DRESET
+.\" @DENSURE
+.\" @DPUTC
+.\" @DPUTZ
+.\" @DPUTS
+.\" @DPUTD
+.\" @DPUTM
+.\" @DWRITE
+.\"
.SH SYNOPSIS
.nf
.B "#include <mLib/dstr.h>"
.BI "void DDESTROY(dstr *" d );
.BI "void DRESET(dstr *" d );
.BI "void DENSURE(dstr *" d ", size_t " sz );
+.BI "void DPUTC(dstr *" c ", char " ch );
.BI "void DPUTZ(dstr *" d );
.BI "void DPUTS(dstr *" d ", const char *" s );
.BI "void DPUTD(dstr *" d ", const dstr *" p );
The following invariants are maintained by
.B dstr
and must hold when any function is called:
-.HP \*o
+.hP \*o
If
.B sz
is nonzero, then
is zero, then
.B buf
is a null pointer.
-.HP \*o
+.hP \*o
At all times,
.BI sz " >= " len\fR.
.PP
The caller is responsible for allocating the
.B dstr
structure. It can be initialized in any of the following ways:
-.HP \*o
+.hP \*o
Using the macro
.B DSTR_INIT
as an initializer in the declaration of the object.
-.HP \*o
+.hP \*o
Passing its address to the
.B dstr_create
function.
-.HP \*o
+.hP \*o
Passing its address to the (equivalent)
.B DCREATE
macro.
isn't enough memory for a longer string, the exception
.B EXC_NOMEM
is raised. See
-.BR exc (3mLib)
+.BR exc (3)
for more information about
.BR mLib 's
exception handling system.
.B dstr_putf
functions is quite complicated, and could do with some checking by
independent people who know what they're doing.
+.SH "SEE ALSO"
+.BR exc (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.sp 1
.fi
..
-.TH exc 3mLib "20 June 1999" mLib
+.TH exc 3 "20 June 1999" mLib
.SH NAME
exc \- exception handling for C programs
+.\" @TRY
+.\" @CATCH
+.\" @END_TRY
+.\" @THROW
+.\" @RETHROW
+.\"
+.\" @exc_encaught
+.\"
+.\" @EXC_PAIR
+.\" @EXC_ALLOC
+.\" @EXC_ALLOCN
+.\" @EXC_ALLOCI
+.\" @EXC_ALLOCP
+.\" @EXC_ALLOCS
+.\"
.SH SYNOPSIS
.B "#include <mLib/exc.h>
.sp 1
and automatic data apply. Also, note that status such as the signal
mask is not reset, so you might have to do that manually in order to
recover from a signal.
+.SH "SEE ALSO"
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH lock 3mLib "23 May 1999" mLib
+.TH lock 3 "23 May 1999" mLib
.SH NAME
lock \- oversimplified file locking interface
+.\" @lock_file
.SH SYNOPSIS
.nf
.B "#include <mLib/lock.h>
.B errno
is set to
.BR EINTR .
+.SH "SEE ALSO"
+.BR fcntl (2),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH quis 3mLib "22 May 1999" mLib
+.TH quis 3 "22 May 1999" mLib
.SH NAME
quis \- remember the program's name for use in messages
+.\" @quis
+.\" @ego
+.\" @QUIS
.SH SYNOPSIS
.nf
.B "#include <mLib/quis.h>"
hysterical.
.PP
The program name is used in the messages produced by the
-.BR die (3mLib)
+.BR die (3)
and
-.BR moan (3mLib)
+.BR moan (3)
functions.
+.SH "SEE ALSO"
+.BR report (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH report 3mLib "20 June 1999" mLib
+.TH report 3 "20 June 1999" mLib
.SH NAME
report \- report errors
+.\" @moan
+.\" @die
.SH SYNOPSIS
.nf
.B "#include <mLib/report.h>"
program's name (as read by the
.B quis
function; see
-.BR quis (3mLib) for details),
+.BR quis (3) for details),
a colon, a space, and the
.BR printf -style
formatted string
program.
.SH SEE ALSO
.BR exit (3),
-.BR quis (3mLib).
+.BR quis (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH sel 3mLib "22 May 1999" mLib
+.TH sel 3 "22 May 1999" mLib
.SH NAME
sel \- low level interface for waiting for I/O
+.\" @sel_init
+.\" @sel_initfile
+.\" @sel_addfile
+.\" @sel_rmfile
+.\" @sel_addtimer
+.\" @sel_rmtimer
+.\" @sel_select
.SH SYNOPSIS
.nf
.B "#include <mLib/sel.h>"
using
.BR sel 's
interface. For examples, see
-.BR selbuf (3mLib)
+.BR selbuf (3)
and
-.BR conn (3mLib).
+.BR conn (3).
.SH "PROGRAMMING INTERFACE"
A multiplexor is represented using the type
.B sel_state
.BR poll (2)
instead would be fairly trivial to make, and would look just the same
from the outside.
+.SH "SEE ALSO"
+.BR select (2),
+.BR poll (2),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH selbuf 3mLib "23 May 1999" mLib
+.TH selbuf 3 "23 May 1999" mLib
.SH NAME
selbuf \- line-buffering input selector
+.\" @selbuf_enable
+.\" @selbuf_disable
+.\" @selbuf_init
.SH SYNOPSIS
.nf
.B "#include <mLib/selbuf.h>"
The
.B selbuf
subsystem is a selector which integrates with the
-.BR sel (3mLib)
+.BR sel (3)
system for I/O multiplexing. It reads entire text lines from a file
descriptor and passes them to a caller-defined function. It uses the
line buffer described in
-.BR lbuf (3mLib)
+.BR lbuf (3)
to do its work: you should read about it in order to understand exactly
what gets considered to be a line of text and what doesn't, and the
exact rules about what your line handling function should and shouldn't
Pointer to a multiplexor object (type
.BR sel_state )
to which this selector should be attached. See
-.BR sel (3mLib)
+.BR sel (3)
for more details about multiplexors, and how this whole system works.
.TP
.I fd
the next
.B sel_select
call.
+.SH "SEE ALSO"
+.BR lbuf (3),
+.BR sel (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.sp 1
.fi
..
-.TH str 3mLib "20 June 1999" mLib
+.TH str 3 "20 June 1999" mLib
.SH NAME
str \- small string utilities
+.\" @str_getword
+.\" @str_split
+.\" @str_sanitize
.SH SYNOPSIS
.nf
.B "#include <mLib/str.h>"
and
.B rest
will be null.
+.SH "SEE ALSO"
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.RE
.sp 1
..
-.TH sub 3mLib "8 May 1999" mLib
+.TH sub 3 "8 May 1999" mLib
.SH NAME
sub \- efficient allocation and freeing of small blocks
+.\" @sub_alloc
+.\" @sub_free
+.\" @sub_init
+.\"
+.\" @CREATE
+.\" @DESTROY
+.\"
.SH SYNOPSIS
.nf
.B "#include <mLib/sub.h>"
operation requires the block size as an argument, so there's no data
overhead for an allocated block. The system takes advantage of this by
allocating big chunks from the underlying system (actually via
-.BR xmalloc (3mLib),
+.BR xmalloc (3),
q.v.) and splitting the chunks into smaller blocks of the right size, so
the space and time overhead from the underlying allocator is divided
over many blocks.
to
.BR free (3);
similarly, don't try to pass blocks allocated by
-.BR xmalloc (3mLib)
+.BR xmalloc (3)
or
.BR malloc (3)
to
must be called before any of the other
.B sub
functions or macros.
+.SH "SEE ALSO"
+.BR exc (3),
+.BR alloc (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.RE
.sp 1
..
-.TH sym 3mLib "8 May 1999" mLib
+.TH sym 3 "8 May 1999" mLib
.SH NAME
sym \- symbol table manager
+.\" @sym_create
+.\" @sym_destroy
+.\" @sym_find
+.\" @sym_remove
+.\" @sym_mkiter
+.\" @sym_next
+.\"
+.\" @SYM_NAME
+.\"
.SH SYNOPSIS
.nf
.B "#include <mLib/sym.h>"
That ought to be enough examples to be getting on with.
.SH CAVEATS
The symbol table manager requires the suballocator (see
-.BR sub (3mLib)
+.BR sub (3)
for details). You must ensure that
.B sub_init
has been called before using any symbol tables in your program.
actually). Every time a symbol is found, its block is promoted to the
front of its bin chain so it gets found faster next time.
.SH SEE ALSO
-.BR sub (3mLib).
+.BR sub (3),
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.\" -*-nroff-*-
-.TH tv 3mLib "22 May 1999" mLib
+.TH tv 3 "22 May 1999" mLib
.SH NAME
tv \- arithmetic on \fBstruct timeval\fR objects
+.\" @tv_add
+.\" @tv_addl
+.\" @tv_sub
+.\" @tv_subl
+.\" @tv_cmp
+.\"
+.\" @TV_ADD
+.\" @TV_ADDL
+.\" @TV_SUB
+.\" @TV_SUBL
+.\" @TV_CMP
+.\"
.SH SYNOPSIS
.nf
.B "#include <mLib/tv.h>"
although I can't see why there'd be a problem. (If there is one, then
my implementation has it too, because they're the same. I don't
document the restriction because I don't think it exists.)
+.SH "SEE ALSO"
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>
.sp 1
.fi
..
-.TH url 3mLib "20 June 1999" mLib
+.TH url 3 "20 June 1999" mLib
.SH NAME
url \- manipulation of form-urlencoded strings
+.\" @url_initenc
+.\" @url_enc
+.\" @url_initdec
+.\" @url_dec
.SH SYNOPSIS
.nf
.B "#include <mLib/url.h>
.B url_enc
encodes one name/value pair, appending the encoded output to a dynamic
string (see
-.BR dstr (3mLib)
+.BR dstr (3)
for details).
.PP
Decoding a sequence of name/value pairs is performed using the
url_enc(&c, d, SYM_NAME(v), v->v);
}
.VE
+.SH "SEE ALSO"
+.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>.