module.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. #ifndef YASM_LIB_DECL
  30. #define YASM_LIB_DECL
  31. #endif
  32. typedef enum yasm_module_type {
  33. YASM_MODULE_ARCH = 0,
  34. YASM_MODULE_DBGFMT,
  35. YASM_MODULE_OBJFMT,
  36. YASM_MODULE_LISTFMT,
  37. YASM_MODULE_PARSER,
  38. YASM_MODULE_PREPROC
  39. } yasm_module_type;
  40. YASM_LIB_DECL
  41. /*@dependent@*/ /*@null@*/ void *yasm_load_module
  42. (yasm_module_type type, const char *keyword);
  43. #define yasm_load_arch(keyword) \
  44. yasm_load_module(YASM_MODULE_ARCH, keyword)
  45. #define yasm_load_dbgfmt(keyword) \
  46. yasm_load_module(YASM_MODULE_DBGFMT, keyword)
  47. #define yasm_load_objfmt(keyword) \
  48. yasm_load_module(YASM_MODULE_OBJFMT, keyword)
  49. #define yasm_load_listfmt(keyword) \
  50. yasm_load_module(YASM_MODULE_LISTFMT, keyword)
  51. #define yasm_load_parser(keyword) \
  52. yasm_load_module(YASM_MODULE_PARSER, keyword)
  53. #define yasm_load_preproc(keyword) \
  54. yasm_load_module(YASM_MODULE_PREPROC, keyword)
  55. YASM_LIB_DECL
  56. void yasm_list_modules
  57. (yasm_module_type type,
  58. void (*printfunc) (const char *name, const char *keyword));
  59. #define yasm_list_arch(func) \
  60. yasm_list_modules(YASM_MODULE_ARCH, func)
  61. #define yasm_list_dbgfmt(func) \
  62. yasm_list_modules(YASM_MODULE_DBGFMT, func)
  63. #define yasm_list_objfmt(func) \
  64. yasm_list_modules(YASM_MODULE_OBJFMT, func)
  65. #define yasm_list_listfmt(func) \
  66. yasm_list_modules(YASM_MODULE_LISTFMT, func)
  67. #define yasm_list_parser(func) \
  68. yasm_list_modules(YASM_MODULE_PARSER, func)
  69. #define yasm_list_preproc(func) \
  70. yasm_list_modules(YASM_MODULE_PREPROC, func)
  71. YASM_LIB_DECL
  72. void yasm_register_module(yasm_module_type type, const char *keyword,
  73. void *data);
  74. #endif