1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>KLone: atom.h Source File</title>
<link href="kl.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<div class="nav">
<a class="el" href="dir_000002.html">klone</a></div>
<h1>atom.h</h1><a href="atom_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>
00002 <span class="comment"> * Copyright (c) 2005, 2006 by KoanLogic s.r.l. <http://www.koanlogic.com></span>
00003 <span class="comment"> * All rights reserved.</span>
00004 <span class="comment"> *</span>
00005 <span class="comment"> * This file is part of KLone, and as such it is subject to the license stated</span>
00006 <span class="comment"> * in the LICENSE file which you have received as part of this distribution.</span>
00007 <span class="comment"> *</span>
00008 <span class="comment"> * $Id: atom.h,v 1.8 2006/01/09 12:38:37 tat Exp $</span>
00009 <span class="comment"> */</span>
00010
00011 <span class="preprocessor">#ifndef _KLONE_ATOM_H_</span>
00012 <span class="preprocessor"></span><span class="preprocessor">#define _KLONE_ATOM_H_</span>
00013 <span class="preprocessor"></span>
00014 <span class="preprocessor">#include <stdlib.h></span>
00015 <span class="preprocessor">#include <u/libu.h></span>
00016
00017 <span class="preprocessor">#ifdef __cplusplus</span>
00018 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00019 <span class="preprocessor">#endif </span>
00020 <span class="preprocessor"></span>
00021 <span class="comment">/* global server-maintaned atom list */</span>
<a name="l00022"></a><a class="code" href="structatom__s.html">00022</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structatom__s.html">atom_s</a>
00023 {
00024 LIST_ENTRY(<a class="code" href="structatom__s.html">atom_s</a>) np; <span class="comment">/* next & prev pointers */</span>
<a name="l00025"></a><a class="code" href="structatom__s.html#o0">00025</a> <span class="keywordtype">char</span> *id; <span class="comment">/* atom identifier */</span>
<a name="l00026"></a><a class="code" href="structatom__s.html#o1">00026</a> <span class="keywordtype">char</span> *data; <span class="comment">/* atom data block */</span>
<a name="l00027"></a><a class="code" href="structatom__s.html#o2">00027</a> size_t size; <span class="comment">/* atom data block size */</span>
<a name="l00028"></a><a class="code" href="structatom__s.html#o3">00028</a> <span class="keywordtype">void</span> *arg; <span class="comment">/* opaque data */</span>
00029 } <a class="code" href="structatom__s.html">atom_t</a>;
00030
00031 <span class="comment">/* define atom list */</span>
00032 <a class="code" href="page_8h.html#a10">LIST_HEAD</a>(atom_list_s, <a class="code" href="structatom__s.html">atom_s</a>);
<a name="l00033"></a><a class="code" href="atom_8h.html#a1">00033</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>atom_list_s <a class="code" href="atom_8h.html#a1">atom_list_t</a>;
00034
<a name="l00035"></a><a class="code" href="structatoms__s.html">00035</a> <span class="keyword">struct </span><a class="code" href="structatoms__s.html">atoms_s</a>
00036 {
<a name="l00037"></a><a class="code" href="structatoms__s.html#o0">00037</a> <a class="code" href="atom_8h.html#a1">atom_list_t</a> list;
<a name="l00038"></a><a class="code" href="structatoms__s.html#o1">00038</a> size_t size, count;
00039 };
00040
00041 <span class="comment">/* create an atom */</span>
00042 <span class="keywordtype">int</span> <a class="code" href="atom_8h.html#a4">atom_create</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">id</span>, <span class="keyword">const</span> <span class="keywordtype">char</span> *data, size_t size, <span class="keywordtype">void</span>* arg,
00043 <a class="code" href="structatom__s.html">atom_t</a>**pa);
00044 <span class="comment">/* free an atom */</span>
00045 <span class="keywordtype">int</span> <a class="code" href="atom_8h.html#a5">atom_free</a>(<a class="code" href="structatom__s.html">atom_t</a>* atom);
00046
00047 <span class="comment">/* atom_t list */</span>
00048 <span class="keyword">struct </span><a class="code" href="structatoms__s.html">atoms_s</a>;
<a name="l00049"></a><a class="code" href="atom_8h.html#a2">00049</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structatoms__s.html">atoms_s</a> <a class="code" href="atom_8h.html#a2">atoms_t</a>;
00050
00051 <span class="comment">/* create an atom list */</span>
00052 <span class="keywordtype">int</span> <a class="code" href="atom_8h.html#a6">atoms_create</a>(atoms_t **);
00053
00054 <span class="comment">/* free an atom list */</span>
00055 <span class="keywordtype">int</span> <a class="code" href="atom_8h.html#a7">atoms_free</a>(atoms_t *);
00056
00057 <span class="comment">/* sum of atoms size field */</span>
00058 size_t <a class="code" href="atom_8h.html#a8">atoms_size</a>(atoms_t *);
00059
00060 <span class="comment">/* # of atoms */</span>
00061 size_t <a class="code" href="atom_8h.html#a9">atoms_count</a>(atoms_t *);
00062
00063 <span class="comment">/* return the n-th atom */</span>
00064 <span class="keywordtype">int</span> <a class="code" href="atom_8h.html#a10">atoms_getn</a>(atoms_t *, size_t n, <a class="code" href="structatom__s.html">atom_t</a>**);
00065
00066 <span class="comment">/* return the atom whose ID is id */</span>
00067 <span class="keywordtype">int</span> <a class="code" href="atom_8h.html#a11">atoms_get</a>(atoms_t *, <span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">id</span>, <a class="code" href="structatom__s.html">atom_t</a>**);
00068
00069 <span class="comment">/* add an atom to the list */</span>
00070 <span class="keywordtype">int</span> <a class="code" href="atom_8h.html#a12">atoms_add</a>(atoms_t *, <a class="code" href="structatom__s.html">atom_t</a>*);
00071
00072 <span class="comment">/* add an atom to the list */</span>
00073 <span class="keywordtype">int</span> <a class="code" href="atom_8h.html#a13">atoms_remove</a>(atoms_t *, <a class="code" href="structatom__s.html">atom_t</a>*);
00074
00075 <span class="preprocessor">#ifdef __cplusplus</span>
00076 <span class="preprocessor"></span>}
00077 <span class="preprocessor">#endif </span>
00078 <span class="preprocessor"></span>
00079 <span class="preprocessor">#endif</span>
</pre></div><hr>
<div>
<div style="text-align:left">
<a href="http://www.koanlogic.com/kl/cont/gb/html/products.html">←Products</a>
</div>
<div style="text-align:center;">
© 2005-2006 - <a href="http://www.koanlogic.com">KoanLogic S.r.l.</a> - All rights reserved
</div>
</div>
</body>
</html>
|