kolibrios/contrib/other/lua-5.2.0/console.c
CleverMouse 0025f294e3 add lua to autobuild
git-svn-id: svn://kolibrios.org@5205 a494cfbc-eb01-0410-851d-a64ba20cac60
2014-12-01 11:19:51 +00:00

89 lines
2.4 KiB
C

///===========================
#define CON_COLOR_BLUE 1
#define CON_COLOR_GREEN 2
#define CON_COLOR_RED 4
#define CON_COLOR_BRIGHT 8
/* öâåò ôîíà */
#define CON_BGR_BLUE 0x10
#define CON_BGR_GREEN 0x20
#define CON_BGR_RED 0x40
#define CON_BGR_BRIGHT 0x80
///===========================
void (* _stdcall con_init)(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
void (* _cdecl kprintf)(const char* format,...);
void (* _stdcall _exit2)(char bCloseWindow);
void (* __stdcall kgets)(char* str, int n);
int (* __stdcall getch)(void);
int (* __stdcall con_get_font_height)(void);
int (* __stdcall con_set_cursor_height)(int new_height);
unsigned (*__stdcall con_get_flags)(void);
unsigned (*__stdcall con_set_flags)(unsigned new_flags);
void (*__stdcall con_cls)(void);
///===========================
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();
kprintf = ( _cdecl void (*)(const char*,...))
kol_cofflib_procload (imp, "con_printf");
if (printf == NULL)
kol_exit();
_exit2 = ( _stdcall void (*)(char))
kol_cofflib_procload (imp, "con_exit");
if (_exit2 == NULL)
kol_exit();
kgets = ( _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);
}