<HTML>
<HEAD>
<TITLE>Atoms - an easy way of organizing strings</TITLE>
</HEAD>
<BODY>
<H1>Atoms</H1>
<PRE>
/*
** (c) COPYRIGHT CERN 1994.
** Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>
<CODE>Atoms</CODE> are strings which are given representative pointer
values so that they can be stored more efficiently, and compaisons for
equality done more efficiently. The list of <CODE>atoms</CODE> are
stored in a has table, so when asking for a new atom you might infact
get back an existing one.<P>
There are a whole bunch of <A
HREF="HTFormat.html#FormatTypes">MIME-types</A> defined as
<CODE>atoms</CODE>, so please use them! <P>
This module is implemented by <A HREF="HTAtom.c">HTAtom.c</A>, and it
is a part of the <A NAME="z10"
HREF="http://info.cern.ch/hypertext/WWW/Library/User/Guide/Guide.html">Library
of Common Code</A>. <P>
<PRE>
#ifndef HTATOM_H
#define HTATOM_H
#include "HTList.h"
#ifdef SHORT_NAMES
#define HTAt_for HTAtom_for
#define HTAt_tMa HTAtom_templateMatches
#endif
typedef struct _HTAtom HTAtom;
struct _HTAtom {
HTAtom * next;
char * name;
}; /* struct _HTAtom */
</PRE>
<H2>Public Functions</H2>
The following methods are available for this class:
<H3>Get an Atom</H3>
This function returns a representative value (an <CODE>atom</CODE>)
such that it will always (within one run of the program) return the
same value for the same given string.
<PRE>
extern HTAtom * HTAtom_for PARAMS((CONST char * string));
</PRE>
<H3>Get Content of an Atom</H3>
<PRE>
#define HTAtom_name(a) ((a)->name)
</PRE>
This macro returns the string pointed to by the <CODE>atom</CODE>.
<H3>Search For Atoms</H3>
Returns a list of <CODE>atoms</CODE> which matches the template
given. It is especially made for MIME-types so that for example a
template like <CODE>text<slash><star></CODE> returns a
list of all MIME-types of type <CODE>text</CODE>.
<PRE>
extern HTList * HTAtom_templateMatches PARAMS((CONST char * templ));
</PRE>
<H3>Cleanup Memory</H3>
In order to cleanup memory, call this function. This is done
automaticly from the <A
HREF="HTAccess.html#Library">HTLibTerminate</A> function.
<PRE>
extern void HTAtom_deleteAll NOPARAMS;
#endif
</PRE>
End of HTAtom definition.
</BODY>
</HTML>
Webmaster