Home | History | Annotate | Download | only in libyasm
      1 /*
      2  * YASM module loader header file
      3  *
      4  *  Copyright (C) 2002-2007  Peter Johnson
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
     16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
     19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25  * POSSIBILITY OF SUCH DAMAGE.
     26  */
     27 #ifndef YASM_MODULE_H
     28 #define YASM_MODULE_H
     29 
     30 #ifndef YASM_LIB_DECL
     31 #define YASM_LIB_DECL
     32 #endif
     33 
     34 typedef enum yasm_module_type {
     35     YASM_MODULE_ARCH = 0,
     36     YASM_MODULE_DBGFMT,
     37     YASM_MODULE_OBJFMT,
     38     YASM_MODULE_LISTFMT,
     39     YASM_MODULE_PARSER,
     40     YASM_MODULE_PREPROC
     41 } yasm_module_type;
     42 
     43 YASM_LIB_DECL
     44 /*@dependent@*/ /*@null@*/ void *yasm_load_module
     45     (yasm_module_type type, const char *keyword);
     46 
     47 #define yasm_load_arch(keyword) \
     48     yasm_load_module(YASM_MODULE_ARCH, keyword)
     49 #define yasm_load_dbgfmt(keyword)       \
     50     yasm_load_module(YASM_MODULE_DBGFMT, keyword)
     51 #define yasm_load_objfmt(keyword)       \
     52     yasm_load_module(YASM_MODULE_OBJFMT, keyword)
     53 #define yasm_load_listfmt(keyword)      \
     54     yasm_load_module(YASM_MODULE_LISTFMT, keyword)
     55 #define yasm_load_parser(keyword)       \
     56     yasm_load_module(YASM_MODULE_PARSER, keyword)
     57 #define yasm_load_preproc(keyword)      \
     58     yasm_load_module(YASM_MODULE_PREPROC, keyword)
     59 
     60 YASM_LIB_DECL
     61 void yasm_list_modules
     62     (yasm_module_type type,
     63      void (*printfunc) (const char *name, const char *keyword));
     64 
     65 #define yasm_list_arch(func)            \
     66     yasm_list_modules(YASM_MODULE_ARCH, func)
     67 #define yasm_list_dbgfmt(func)          \
     68     yasm_list_modules(YASM_MODULE_DBGFMT, func)
     69 #define yasm_list_objfmt(func)          \
     70     yasm_list_modules(YASM_MODULE_OBJFMT, func)
     71 #define yasm_list_listfmt(func)         \
     72     yasm_list_modules(YASM_MODULE_LISTFMT, func)
     73 #define yasm_list_parser(func)          \
     74     yasm_list_modules(YASM_MODULE_PARSER, func)
     75 #define yasm_list_preproc(func)         \
     76     yasm_list_modules(YASM_MODULE_PREPROC, func)
     77 
     78 YASM_LIB_DECL
     79 void yasm_register_module(yasm_module_type type, const char *keyword,
     80                           void *data);
     81 
     82 #endif
     83