]> granicus.if.org Git - yasm/commitdiff
Const-ify yasm_arch_module and yasm_parser_module usage.
authorPeter Johnson <peter@tortall.net>
Mon, 6 Oct 2003 00:23:31 +0000 (00:23 -0000)
committerPeter Johnson <peter@tortall.net>
Mon, 6 Oct 2003 00:23:31 +0000 (00:23 -0000)
Hide yasm_arch implementation behind YASM_LIB_INTERNAL.

svn path=/trunk/yasm/; revision=1066

frontends/yasm/yasm.c
libyasm/arch.c
libyasm/arch.h
modules/arch/x86/x86arch.c
modules/parsers/nasm/nasm-parser.c

index acee6d6f5ee71f13511b44a467357a73072c58c8..16091479541f05841f216b88e119d19f57986b5e 100644 (file)
@@ -66,8 +66,10 @@ do { \
 /*@null@*/ /*@only@*/ static char *machine_name = NULL;
 static int special_options = 0;
 /*@null@*/ /*@dependent@*/ static yasm_arch *cur_arch = NULL;
-/*@null@*/ /*@dependent@*/ static yasm_arch_module *cur_arch_module = NULL;
-/*@null@*/ /*@dependent@*/ static yasm_parser_module *cur_parser_module = NULL;
+/*@null@*/ /*@dependent@*/ static const yasm_arch_module *
+    cur_arch_module = NULL;
+/*@null@*/ /*@dependent@*/ static const yasm_parser_module *
+    cur_parser_module = NULL;
 /*@null@*/ /*@dependent@*/ static yasm_preproc *cur_preproc = NULL;
 /*@null@*/ /*@dependent@*/ static yasm_objfmt *cur_objfmt = NULL;
 /*@null@*/ /*@dependent@*/ static yasm_optimizer *cur_optimizer = NULL;
index 57fbd4d2d0f2131f9dd2a131194754f3e5e951e1..239e400c0697b407a1a2e2d71d42b920e500a3e5 100644 (file)
@@ -38,7 +38,7 @@
 #include "arch.h"
 
 
-yasm_arch_module *
+const yasm_arch_module *
 yasm_arch_get_module(yasm_arch *arch)
 {
     return arch->module;
index 3c790c873e1016820e1c842a6c2b94c765655a62..031f868afc981ce0960161e62e3096f8f9d852f3 100644 (file)
@@ -54,13 +54,15 @@ typedef struct yasm_insn_operandhead yasm_insn_operandhead;
 /*@reldef@*/ STAILQ_HEAD(yasm_insn_operandhead, yasm_insn_operand);
 #endif
 
+#ifdef YASM_LIB_INTERNAL
 /** Base #yasm_arch structure.  Must be present as the first element in any
  * #yasm_arch implementation.
  */
 struct yasm_arch {
     /** #yasm_arch_module implementation for this architecture. */
-    struct yasm_arch_module *module;
+    const struct yasm_arch_module *module;
 };
+#endif
 
 /** "Flavor" of the parser.
  * Different assemblers order instruction operands differently.  Also, some
@@ -340,7 +342,7 @@ struct yasm_insn_operand {
  * \param arch architecture
  * \return Module implementation.
  */
-yasm_arch_module *yasm_arch_get_module(yasm_arch *arch);
+const yasm_arch_module *yasm_arch_get_module(yasm_arch *arch);
 
 /** Create an instruction operand from a register.
  * \param reg  register
index f098f64b0513e8b3719cc6c2ae6013cd0d751fe7..669f883f13434010ddb4944185ba970c12d7d86a 100644 (file)
@@ -33,7 +33,7 @@
 #include "x86arch.h"
 
 
-yasm_arch_module yasm_x86_LTX_arch;
+const yasm_arch_module yasm_x86_LTX_arch;
 
 
 static /*@only@*/ yasm_arch *
@@ -247,7 +247,7 @@ static yasm_arch_machine x86_machines[] = {
 };
 
 /* Define arch structure -- see arch.h for details */
-yasm_arch_module yasm_x86_LTX_arch = {
+const yasm_arch_module yasm_x86_LTX_arch = {
     YASM_ARCH_VERSION,
     "x86 (IA-32 and derivatives), AMD64",
     "x86",
index 1b6b60ed920901dc59e3d257763943719c7c24f9..649cd353082279ad4f50dc6c25e0395d076efc48 100644 (file)
@@ -96,7 +96,7 @@ static const char *nasm_parser_preproc_keywords[] = {
 };
 
 /* Define parser structure -- see parser.h for details */
-yasm_parser_module yasm_nasm_LTX_parser = {
+const yasm_parser_module yasm_nasm_LTX_parser = {
     YASM_PARSER_VERSION,
     "NASM-compatible parser",
     "nasm",