toaruos/modules/test.c

35 lines
780 B
C
Raw Normal View History

2014-03-10 10:01:30 +04:00
#include <system.h>
#include <hashmap.h>
extern char * special_thing;
2014-03-10 09:37:49 +04:00
char test_module_string[] = "I am a char[] in the module.\n";
char * test_module_string_ptr = "I am a char * in the module.\n";
2014-03-10 09:31:34 +04:00
static int a_function(void (*callback)(char *)) {
2014-03-10 09:37:49 +04:00
callback("I am a static function in the module.\n");
return 42;
}
int b_function(void (*callback)(char *)) {
2014-03-10 09:37:49 +04:00
callback("I am a global function in a module!\n");
callback(special_thing);
2014-03-10 09:31:34 +04:00
a_function(callback);
2014-03-10 09:37:49 +04:00
callback(test_module_string);
callback(test_module_string_ptr);
2014-03-10 10:01:30 +04:00
hashmap_t * map = hashmap_create(10);
callback("Inserting into hashmap...\n");
hashmap_set(map, "hello", (void *)"cake\n");
callback("getting value...\n");
callback(hashmap_get(map, "hello"));
hashmap_free(map);
free(map);
return 25;
}