145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** 245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \file assocdat.h 345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \brief YASM associated data storage (libyasm internal use) 445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \license 645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Copyright (C) 2003-2007 Peter Johnson 745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Redistribution and use in source and binary forms, with or without 945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * modification, are permitted provided that the following conditions 1045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * are met: 1145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * - Redistributions of source code must retain the above copyright 1245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * notice, this list of conditions and the following disclaimer. 1345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * - Redistributions in binary form must reproduce the above copyright 1445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * notice, this list of conditions and the following disclaimer in the 1545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * documentation and/or other materials provided with the distribution. 1645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 1745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 1845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 2145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * POSSIBILITY OF SUCH DAMAGE. 2845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \endlicense 2945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 3045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef YASM_ASSOCDAT_H 3145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define YASM_ASSOCDAT_H 3245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef YASM_LIB_DECL 3445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define YASM_LIB_DECL 3545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif 3645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Associated data container. */ 3845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtypedef struct yasm__assoc_data yasm__assoc_data; 3945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 4045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create an associated data container. */ 4145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 4245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm__assoc_data *yasm__assoc_data_create(void); 4345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 4445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get associated data for a data callback. 4545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param assoc_data container of associated data 4645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param callback callback used when adding data 4745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Associated data (NULL if none). 4845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 4945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 5045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@dependent@*/ /*@null@*/ void *yasm__assoc_data_get 5145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (/*@null@*/ yasm__assoc_data *assoc_data, 5245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const yasm_assoc_data_callback *callback); 5345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 5445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Add associated data to a associated data container. 5545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \attention Deletes any existing associated data for that data callback. 5645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param assoc_data container of associated data 5745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param callback callback 5845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param data data to associate 5945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 6045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 6145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm__assoc_data *yasm__assoc_data_add 6245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data, 6345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const yasm_assoc_data_callback *callback, 6445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@only@*/ /*@null@*/ void *data); 6545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 6645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Destroy all associated data in a container. */ 6745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 6845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm__assoc_data_destroy 6945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data); 7045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 7145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Print all associated data in a container. */ 7245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 7345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm__assoc_data_print(const yasm__assoc_data *assoc_data, FILE *f, 7445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int indent_level); 7545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 7645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif 77