blob: cf423867755370b58dd69832ed1f139a3a7e7a85 [file] [log] [blame]
Peter Johnson55438b72003-10-02 05:03:50 +00001/**
2 * \file assocdat.h
3 * \brief YASM associated data storage (libyasm internal use)
4 *
Peter Johnson55438b72003-10-02 05:03:50 +00005 * \license
Peter Johnson469e54f2007-04-22 05:09:49 +00006 * Copyright (C) 2003-2007 Peter Johnson
Peter Johnson55438b72003-10-02 05:03:50 +00007 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 * \endlicense
29 */
30#ifndef YASM_ASSOCDAT_H
31#define YASM_ASSOCDAT_H
32
Peter Johnsoneb7b1ad2008-05-23 06:46:51 +000033#ifndef YASM_LIB_DECL
34#define YASM_LIB_DECL
35#endif
36
Peter Johnson55438b72003-10-02 05:03:50 +000037/** Associated data container. */
38typedef struct yasm__assoc_data yasm__assoc_data;
39
40/** Create an associated data container. */
Peter Johnsoneb7b1ad2008-05-23 06:46:51 +000041YASM_LIB_DECL
Peter Johnson55438b72003-10-02 05:03:50 +000042/*@only@*/ yasm__assoc_data *yasm__assoc_data_create(void);
43
44/** Get associated data for a data callback.
Peter Johnson00473ca2007-04-22 03:32:46 +000045 * \param assoc_data container of associated data
46 * \param callback callback used when adding data
Peter Johnson55438b72003-10-02 05:03:50 +000047 * \return Associated data (NULL if none).
48 */
Peter Johnsoneb7b1ad2008-05-23 06:46:51 +000049YASM_LIB_DECL
Peter Johnson55438b72003-10-02 05:03:50 +000050/*@dependent@*/ /*@null@*/ void *yasm__assoc_data_get
51 (/*@null@*/ yasm__assoc_data *assoc_data,
52 const yasm_assoc_data_callback *callback);
53
54/** Add associated data to a associated data container.
55 * \attention Deletes any existing associated data for that data callback.
Peter Johnson00473ca2007-04-22 03:32:46 +000056 * \param assoc_data container of associated data
57 * \param callback callback
58 * \param data data to associate
Peter Johnson55438b72003-10-02 05:03:50 +000059 */
Peter Johnsoneb7b1ad2008-05-23 06:46:51 +000060YASM_LIB_DECL
Peter Johnson55438b72003-10-02 05:03:50 +000061/*@only@*/ yasm__assoc_data *yasm__assoc_data_add
62 (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data,
63 const yasm_assoc_data_callback *callback,
64 /*@only@*/ /*@null@*/ void *data);
65
66/** Destroy all associated data in a container. */
Peter Johnsoneb7b1ad2008-05-23 06:46:51 +000067YASM_LIB_DECL
Peter Johnson55438b72003-10-02 05:03:50 +000068void yasm__assoc_data_destroy
69 (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data);
70
71/** Print all associated data in a container. */
Peter Johnsoneb7b1ad2008-05-23 06:46:51 +000072YASM_LIB_DECL
Peter Johnson55438b72003-10-02 05:03:50 +000073void yasm__assoc_data_print(const yasm__assoc_data *assoc_data, FILE *f,
Peter Johnson00473ca2007-04-22 03:32:46 +000074 int indent_level);
Peter Johnson55438b72003-10-02 05:03:50 +000075
76#endif