diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2008-08-06 22:52:38 +0000 |
---|---|---|
committer | Flavio Cruz <flaviocruz@gmail.com> | 2008-08-06 22:52:38 +0000 |
commit | 6e601e7c2b50a92b2e6d758a776becff1d8598fd (patch) | |
tree | d0a4c84cd6b18594bc2ae0b865d62489250c3009 /libs/common.c | |
parent | 4ea11517c9054af2be5e50c514906d8663c84b94 (diff) |
Move stubs to libs. Create an unique library named liblisptrans.
--HG--
rename : stubs/io_wrapper.c => libs/io_wrapper.c
rename : stubs/io_wrapper.h => libs/io_wrapper.h
rename : stubs/notify_wrapper.h => libs/notify_wrapper.h
rename : stubs/fsys_wrapper.h => libs/fsys_wrapper.h
rename : stubs/fsys_wrapper.c => libs/fsys_wrapper.c
rename : stubs/common.c => libs/common.c
rename : stubs/notify_wrapper.c => libs/notify_wrapper.c
rename : stubs/fs_wrapper.h => libs/fs_wrapper.h
rename : stubs/fs_wrapper.c => libs/fs_wrapper.c
Diffstat (limited to 'libs/common.c')
-rw-r--r-- | libs/common.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libs/common.c b/libs/common.c new file mode 100644 index 000000000..1b2984d3a --- /dev/null +++ b/libs/common.c @@ -0,0 +1,41 @@ + +inline static void +_set_routine (const unsigned what, void *fun) +{ + assert (what < _NUMBER_OF_ROUTINES); + + if (routines[what] != NULL) + { + fprintf (stderr, "Warning: redefining routine %s\n", + routine_to_str (what)); + } + else + { + fprintf (stderr, "Information: defining routine %s\n", + routine_to_str (what)); + } + + routines[what] = fun; +} + +inline static void +_get_module_info (void) +{ + int i; + for (i = 0; i != _NUMBER_OF_ROUTINES; ++i) + { + if (routines[i] != NULL) + { + printf ("Routine #%d (%s): set to address %x\n", i, + routine_to_str (i), (vm_size_t) routines[i]); + } + } +} + +#define COMMON_FUNCTIONS(module) \ + void get_ ## module ## _info(void) { \ + _get_module_info(); \ + } \ + void set_ ## module ## _routine(const unsigned what, void *fun) { \ + _set_routine(what, fun); \ + } |