From e36fbb474a226037bfcbe6a05852c737a8990316 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Sun, 22 Nov 2009 23:03:45 +0100 Subject: [PATCH] prefix bytecodeproc with xasm_ Prepare to move the bytecode walker into unit.c so that it can be used by others, not just the linker (e.g. an object dumper). --- unit.h | 3 +++ xlnk.c | 19 ++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/unit.h b/unit.h index 6c694fa..4a1bff9 100644 --- a/unit.h +++ b/unit.h @@ -144,6 +144,9 @@ struct tag_xasm_unit { typedef struct tag_xasm_unit xasm_unit; +/** Signature for procedure to process a bytecode */ +typedef void (*xasm_bytecodeproc)(const unsigned char *, void *); + /*---------------------------------------------------------------------------*/ /* Function prototypes. */ diff --git a/xlnk.c b/xlnk.c index 55d8b07..74da6f5 100644 --- a/xlnk.c +++ b/xlnk.c @@ -627,9 +627,6 @@ static int label_cmd_args_size(const unsigned char *bytes) return size; } -/** Signature for procedure to process a bytecode */ -typedef void (*bytecodeproc)(const unsigned char *, void *); - /** * Walks an array of bytecodes, calling corresponding bytecode handlers * along the way. @@ -637,7 +634,7 @@ typedef void (*bytecodeproc)(const unsigned char *, void *); * @param handlers Array of bytecode handlers (entries can be NULL) * @param arg Argument passed to bytecode handler, can be anything */ -static void bytecode_walk(const unsigned char *bytes, bytecodeproc *handlers, void *arg) +static void bytecode_walk(const unsigned char *bytes, xasm_bytecodeproc *handlers, void *arg) { int i; unsigned char cmd; @@ -1322,7 +1319,7 @@ static void write_as_binary(FILE *fp, xunit *u) { write_binary_args args; /* Table of callback functions for our purpose. */ - bytecodeproc handlers[] = + static xasm_bytecodeproc handlers[] = { NULL, /* CMD_END */ write_bin8, /* CMD_BIN8 */ @@ -1639,7 +1636,7 @@ static void write_as_assembly(FILE *fp, xunit *u) { write_binary_args args; /* Table of callback functions for our purpose. */ - bytecodeproc handlers[] = + static xasm_bytecodeproc handlers[] = { NULL, /* CMD_END */ asm_write_bin8, /* CMD_BIN8 */ @@ -1715,7 +1712,7 @@ static void print_it(const unsigned char *b, void *arg) */ static void print_bytecodes(const unsigned char *bytes) { - bytecodeproc handlers[] = + static xasm_bytecodeproc handlers[] = { print_it,print_it,print_it,print_it,print_it, print_it,print_it,print_it,print_it,print_it, @@ -1795,7 +1792,7 @@ static int count_locals(const unsigned char *b) { int count; /* Table of callback functions for our purpose. */ - bytecodeproc handlers[] = + static xasm_bytecodeproc handlers[] = { NULL, /* CMD_END */ NULL, /* CMD_BIN8 */ @@ -1880,7 +1877,7 @@ static void register_locals(const unsigned char *b, local_array *la, xunit *xu) local *lptr; local **lpptr; /* Table of callback functions for our purpose. */ - bytecodeproc handlers[] = + static xasm_bytecodeproc handlers[] = { NULL, /* CMD_END */ NULL, /* CMD_BIN8 */ @@ -1986,7 +1983,7 @@ static void calc_data_addresses(xunit *u) { calc_address_args args; /* Table of callback functions for our purpose. */ - bytecodeproc handlers[] = + static xasm_bytecodeproc handlers[] = { NULL, /* CMD_END */ NULL, /* CMD_BIN8 */ @@ -2173,7 +2170,7 @@ static void calc_code_addresses(xunit *u) { calc_address_args args; /* Table of callback functions for our purpose. */ - bytecodeproc handlers[] = + static xasm_bytecodeproc handlers[] = { NULL, /* CMD_END */ inc_pc_count8, /* CMD_BIN8 */ -- 2.11.4.GIT