1987-01-05 17:20:13 +00:00
|
|
|
.TH IDF 3ACK "March 17, 1986"
|
1987-03-11 14:19:02 +00:00
|
|
|
.ad
|
1987-01-05 17:20:13 +00:00
|
|
|
.SH NAME
|
1987-02-23 11:23:46 +00:00
|
|
|
init_idf, str2idf, findidf\ \-\ a namelist module
|
1987-01-05 17:20:13 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.PP
|
|
|
|
.B init_idf()
|
|
|
|
.PP
|
|
|
|
.B struct idf *str2idf(tag, cpy)
|
|
|
|
.br
|
|
|
|
.B char *tag;
|
|
|
|
.PP
|
|
|
|
.B struct idf *findidf(tag)
|
|
|
|
.br
|
|
|
|
.B char *tag;
|
|
|
|
.SH DESCRIPTION
|
|
|
|
This is a generic namelist module. It provides a fast mechanism for
|
|
|
|
associating information with identifiers. To get an instantiation, the
|
|
|
|
user must provide two files \fIidf.h\fR and \fIidf.c\fR.
|
|
|
|
\fIidf.h\fR could contain the following:
|
|
|
|
.br
|
|
|
|
.PP
|
|
|
|
.RS
|
|
|
|
.nf
|
|
|
|
#define IDF_TYPE struct id_info
|
|
|
|
#define IDF_HSIZE 8
|
|
|
|
|
|
|
|
#include <idf_pkg.spec>
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.PP
|
|
|
|
and \fIidf.c\fR could contain:
|
|
|
|
.br
|
|
|
|
.PP
|
|
|
|
.RS
|
|
|
|
.nf
|
|
|
|
#include "id_info.h" /* contains definition for struct id_info */
|
|
|
|
#include "idf.h"
|
|
|
|
#include <idf_pkg.body>
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.PP
|
|
|
|
IDF_TYPE denotes a type containing all information associated with
|
|
|
|
an identifier. If it is not defined, the instantiation will not contain
|
|
|
|
any user-defined information.
|
|
|
|
.PP
|
|
|
|
IDF_HSIZE denotes the number of significant characters for the hashing
|
|
|
|
function. It's default value is 64. Notice that this value does \fBnot\fP
|
|
|
|
denote the number of significant characters, but only the number of characters
|
|
|
|
that are used for hashing.
|
|
|
|
.PP
|
|
|
|
The user can also define IDF_NAME, to give a name to the selector in the
|
|
|
|
idf-structure. It's default value is \fIid_user\fP.
|
|
|
|
.PP
|
|
|
|
The routine \fIinit_idf\fR initializes the namelist.
|
|
|
|
.PP
|
|
|
|
The function
|
|
|
|
\fIstr2idf\fR searches for the string \fItag\fR in the namelist, and
|
|
|
|
creates an entry for it if necessary. A pointer to this entry is
|
|
|
|
returned. If \fIcpy\fR is non-zero, a copy of the \fItag\fR is made,
|
|
|
|
otherwise the \fItag\fR itself is used.
|
1987-02-23 11:23:46 +00:00
|
|
|
The entry has the following structure, defined in \fIidf_pkg.spec\fR:
|
1987-01-05 17:20:13 +00:00
|
|
|
.PP
|
|
|
|
.nf
|
|
|
|
struct idf {
|
|
|
|
struct idf *next; \kx/* links idf-structures together */
|
|
|
|
char *id_text;\h'|\nxu'/* string representing the name */
|
|
|
|
#ifdef IDF_TYPE
|
|
|
|
IDF_TYPE IDF_NAME;\h'|\nxu'/* user defined type */
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
.fi
|
|
|
|
.PP
|
|
|
|
The field \fIid_text\fR will point to a copy of \fItag\fR, or
|
|
|
|
to the \fItag\fR itself, depending on \fIcpy\fR.
|
|
|
|
The field \fInext\fR is used for internal information and must not
|
|
|
|
be changed by the user of this module.
|
1987-05-14 16:51:53 +00:00
|
|
|
The user-defined part of the structure is initialized with zeros.
|
1987-01-05 17:20:13 +00:00
|
|
|
.PP
|
|
|
|
The function \fIfindidf\fP searches for the string \fItag\fP in the
|
1987-02-23 11:23:46 +00:00
|
|
|
namelist, but returns 0 when it is not present.
|
1987-01-05 17:20:13 +00:00
|
|
|
.SH "MODULES USED"
|
|
|
|
alloc(3)
|
|
|
|
.SH FILES
|
|
|
|
~em/modules/pkg/idf_pkg.spec
|
|
|
|
.br
|
|
|
|
~em/modules/pkg/idf_pkg.body
|