void CONSOLE_INIT(char title[]) { kol_struct_import *imp; imp = kol_cofflib_load("/sys/lib/console.obj"); if (imp == NULL) kol_exit(); con_init = ( _stdcall void (*)(unsigned, unsigned, unsigned, unsigned, const char*)) kol_cofflib_procload (imp, "con_init"); if (con_init == NULL) kol_exit(); printf = ( _cdecl void (*)(const char*,...)) kol_cofflib_procload (imp, "con_printf"); if (printf == NULL) kol_exit(); _exit = ( _stdcall void (*)(char)) kol_cofflib_procload (imp, "con_exit"); if (_exit == NULL) kol_exit(); gets = ( _stdcall void (*)(char*, int)) kol_cofflib_procload (imp, "con_gets"); if (gets == NULL) kol_exit(); getch = ( _stdcall int (*)(void)) kol_cofflib_procload (imp, "con_getch2"); if (getch == NULL) kol_exit(); con_get_font_height = ( _stdcall int (*)(void)) kol_cofflib_procload (imp, "con_get_font_height"); if (con_get_font_height == NULL) kol_exit(); con_set_cursor_height = ( _stdcall int (*)(int)) kol_cofflib_procload (imp, "con_set_cursor_height"); if (con_set_cursor_height == NULL) kol_exit(); con_get_flags = ( _stdcall unsigned (*)(void)) kol_cofflib_procload (imp, "con_get_flags"); if (con_get_flags == NULL) kol_exit(); con_set_flags = ( _stdcall unsigned (*)(unsigned)) kol_cofflib_procload (imp, "con_set_flags"); if (con_set_flags == NULL) kol_exit(); con_cls = ( _stdcall void (*)(void)) kol_cofflib_procload (imp, "con_cls"); if (con_cls == NULL) kol_exit(); con_init(-1, -1, -1, -1, title); }
void kol_main() { #define NUM 20000 kol_struct_import *imp_qs; int *a; int i; CONSOLE_INIT("Example"); imp_qs = kol_cofflib_load("/sys/lib/qs.obj"); qsi = ( _stdcall void (*)(int*, int)) kol_cofflib_procload (imp_qs, "qsi"); a = malloc(NUM*sizeof(int)); for (i = 0; i < NUM; i++) *(a+i) = random(10000); for (i = 0; i < 5; i++) printf("%7d", *(a+i)); printf (" ..."); for (i = NUM-5; i < NUM; i++) printf("%7d", *(a+i)); qsi(a, NUM); printf ("\n"); for (i = 0; i < 5; i++) printf("%7d", *(a+i)); printf (" ..."); for (i = NUM-5; i < NUM; i++) printf("%7d", *(a+i)); free(a); _exit(0); kol_exit(); }