toaruos/modules/test.c

42 lines
876 B
C
Raw Normal View History

2014-03-10 10:01:30 +04:00
#include <system.h>
#include <hashmap.h>
#include <module.h>
#include <logging.h>
2014-03-10 10:01:30 +04:00
extern char * special_thing;
char test_module_string[] = "I am a char[] in the module.";
char * test_module_string_ptr = "I am a char * in the module.";
2014-03-10 09:31:34 +04:00
2014-03-12 11:18:55 +04:00
int a_function(void) {
debug_print(WARNING, ("I am an exported function in the module."));
return 42;
}
2014-03-12 11:18:55 +04:00
static int hello(void) {
debug_print(NOTICE, special_thing);
a_function();
debug_print(NOTICE, test_module_string);
debug_print(NOTICE, test_module_string_ptr);
2014-03-10 10:01:30 +04:00
hashmap_t * map = hashmap_create(10);
debug_print(NOTICE, "Inserting into hashmap...");
2014-03-10 10:01:30 +04:00
hashmap_set(map, "hello", (void *)"cake");
debug_print(NOTICE, "getting value: %s", hashmap_get(map, "hello"));
2014-03-10 10:01:30 +04:00
hashmap_free(map);
free(map);
return 25;
}
2014-03-12 11:18:55 +04:00
static int goodbye(void) {
debug_print(NOTICE, "Goodbye!");
return 0;
}
2014-03-12 11:18:55 +04:00
MODULE_DEF(test, hello, goodbye);