C layer: change init function in wrappers

git-svn-id: svn://kolibrios.org@6495 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Serhii Sakhno 2016-08-21 23:09:23 +00:00
parent 69c1cf47a2
commit 7dc0d7cd36
14 changed files with 47 additions and 187 deletions

View File

@ -11,24 +11,14 @@ include '../../../programs/develop/libraries/box_lib/trunk/box_lib.mac'
include '../../../programs/system/run/trunk/txtbut.inc' include '../../../programs/system/run/trunk/txtbut.inc'
include '../../../programs/dll.inc' include '../../../programs/dll.inc'
public init_boxlib as '_init_boxlib_asm' public init_boxlib as '_kolibri_boxlib_init'
public editbox_key_thunk as '_editbox_key@4' ; renamed due to ambiguity public editbox_key_thunk as '_editbox_key@4' ; renamed due to ambiguity
public press_key as '_press_key' public press_key as '_press_key'
;;; Returns 0 on success. -1 on failure. ;;; Returns 0 on success. -1 on failure.
proc init_boxlib proc init_boxlib
mcall 68,11 mcall 68,11
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret ret
endp endp

View File

@ -10,22 +10,12 @@ purge section,mov,add,sub
include '../../../programs/dll.inc' include '../../../programs/dll.inc'
public init_buf2d as '_init_buf2d_asm' public init_buf2d as '_kolibri_buf2d_init'
;;; Returns 0 on success. -1 on failure. ;;; Returns 0 on success. -1 on failure.
proc init_buf2d proc init_buf2d
mcall 68,11 mcall 68,11
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret ret
endp endp

View File

@ -16,23 +16,13 @@ virtual at 0
http_msg http_msg http_msg http_msg
end virtual end virtual
public init_network as '_init_network_asm' public init_network as '_kolibri_http_init'
;;; Returns 0 on success. -1 on failure. ;;; Returns 0 on success. -1 on failure.
proc init_network proc init_network
mcall 68,11 mcall 68,11
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret ret
endp endp

View File

@ -9,22 +9,12 @@ purge section,mov,add,sub
include '../../../programs/dll.inc' include '../../../programs/dll.inc'
public init_kmenu as '_init_kmenu_asm' public init_kmenu as '_kolibri_kmenu_init'
;;; Returns 0 on success. -1 on failure. ;;; Returns 0 on success. -1 on failure.
proc init_kmenu proc init_kmenu
mcall 68,11 mcall 68,11
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret ret
endp endp

View File

@ -10,22 +10,12 @@ purge section,mov,add,sub
include '../../../programs/dll.inc' include '../../../programs/dll.inc'
public init_libimg as '_init_libimg_asm' public init_libimg as '_kolibri_libimg_init'
;;; Returns 0 on success. -1 on failure. ;;; Returns 0 on success. -1 on failure.
proc init_libimg proc init_libimg
mcall 68,11 mcall 68,11
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret ret
endp endp

View File

@ -10,23 +10,13 @@ purge section,mov,add,sub
include '../../../programs/dll.inc' include '../../../programs/dll.inc'
public init_libini as '_init_libini_asm' public init_libini as '_kolibri_libini_init'
;;; Returns 0 on success. -1 on failure. ;;; Returns 0 on success. -1 on failure.
proc init_libini proc init_libini
mcall 68,11 mcall 68,11
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret ret
endp endp

View File

@ -10,22 +10,12 @@ purge section,mov,add,sub
include '../../../programs/dll.inc' include '../../../programs/dll.inc'
public init_proclib as '_init_proclib_asm' public init_proclib as '_kolibri_proclib_init'
;;; Returns 0 on success. -1 on failure. ;;; Returns 0 on success. -1 on failure.
proc init_proclib proc init_proclib
mcall 68,11 mcall 68,11
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret ret
endp endp

View File

@ -14,13 +14,14 @@ int main()
kolibri_gui_init(); kolibri_gui_init();
kolibri_rasterworks_init(); kolibri_rasterworks_init();
/* Set gui_event to REDRAW so that window is drawn in first iteration */ /* Set gui_event to REDRAW so that window is drawn in first iteration */
unsigned int gui_event = KOLIBRI_EVENT_REDRAW;
unsigned int gui_event;
oskey_t key; oskey_t key;
unsigned int pressed_button
//extern volatile unsigned press_key;
kolibri_window *main_window = kolibri_new_window(50, 50, 800, 300, "rasterworks example"); kolibri_window *main_window = kolibri_new_window(50, 50, 800, 300, "rasterworks example");
extern volatile unsigned press_key;
int ln_str = countUTF8Z("Пример работы", -1); int ln_str = countUTF8Z("Пример работы", -1);
void *buffi = malloc(768*256*3 * sizeof(char)); void *buffi = malloc(768*256*3 * sizeof(char));
@ -38,40 +39,28 @@ int main()
drawText(buffi, 0, 128, "Пример работы", ln_str, 0xFF000000, 0x8030C18); drawText(buffi, 0, 128, "Пример работы", ln_str, 0xFF000000, 0x8030C18);
drawText(buffi, 0, 160, "Пример работы", ln_str, 0xFF000000, 0x0F031428); drawText(buffi, 0, 160, "Пример работы", ln_str, 0xFF000000, 0x0F031428);
do /* Start of main activity loop */ while(gui_event = get_os_event())
{ {
if(gui_event == KOLIBRI_EVENT_REDRAW) switch (gui_event)
{ {
case KOLIBRI_EVENT_REDRAW:
kolibri_handle_event_redraw(main_window); kolibri_handle_event_redraw(main_window);
DrawBitmap(buffi, 5, 5, 768, 256); DrawBitmap(buffi, 5, 5, 768, 256);
} break;
else if(gui_event == KOLIBRI_EVENT_KEY)
{
key = get_key();
switch (key.code)
{
}
press_key = key.val;
kolibri_handle_event_key(main_window); case KOLIBRI_EVENT_BUTTON:
} pressed_button = kolibri_button_get_identifier();
else if(gui_event == KOLIBRI_EVENT_BUTTON)
{
unsigned int pressed_button = kolibri_button_get_identifier();
switch (pressed_button) switch (pressed_button)
{ {
case BUTTON_CLOSE: case BUTTON_CLOSE:
kolibri_exit(); kolibri_exit();
} }
} break;
else if(gui_event == KOLIBRI_EVENT_MOUSE)
{ case KOLIBRI_EVENT_MOUSE:
kolibri_handle_event_mouse(main_window); kolibri_handle_event_mouse(main_window);
break;
}
} }
} while((gui_event = get_os_event())); /* End of main activity loop */
/* kolibri_quit(); */
return 0; return 0;
} }

View File

@ -1,18 +1,6 @@
#ifndef KOLIBRI_BOXLIB_H #ifndef KOLIBRI_BOXLIB_H
#define KOLIBRI_BOXLIB_H #define KOLIBRI_BOXLIB_H
extern int init_boxlib_asm(void); extern int kolibri_boxlib_init(void);
int kolibri_boxlib_init(void)
{
int asm_init_status = init_boxlib_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/
if(asm_init_status == 0)
return 0;
else
return 1;
}
#endif /* KOLIBRI_BOXLIB_H */ #endif /* KOLIBRI_BOXLIB_H */

View File

@ -5,20 +5,7 @@
* voxel function * voxel function
*/ */
extern int init_buf2d_asm(void); extern int kolibri_buf2d_init(void);
int kolibri_buf2d_init(void)
{
int asm_init_status = init_buf2d_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/
if(asm_init_status == 0)
return 0;
else
return 1;
}
typedef struct { typedef struct {
unsigned int *buf_pointer; unsigned int *buf_pointer;

View File

@ -1,21 +1,19 @@
#ifndef KOLIBRI_KMENU_H #ifndef KOLIBRI_KMENU_H
#define KOLIBRI_KMENU_H #define KOLIBRI_KMENU_H
extern int init_kmenu_asm(void); #define KMENUITEM_NORMAL 0
#define KMENUITEM_SUBMENU 1
#define KMENUITEM_SEPARATOR 2
int kolibri_kmenu_init(void) #define KMENUITEM_MAINMENU 0x80000000
{
int asm_init_status = init_kmenu_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/ #define KMENUITEM_SEPARATOR_WIDTH 10//170
#define KMENUITEM_SEPARATOR_HEIGHT 2
if(asm_init_status == 0)
return 0;
else
return 1;
}
#define KMENU_LBORDER_SIZE 2
#define KMENU_DBORDER_SIZE 1
extern int kolibri_kmenu_init(void);
extern void (*kmainmenu_draw)(void *) __attribute__((__stdcall__)); extern void (*kmainmenu_draw)(void *) __attribute__((__stdcall__));
extern void (*kmainmenu_dispatch_cursorevent)(void *) __attribute__((__stdcall__)); extern void (*kmainmenu_dispatch_cursorevent)(void *) __attribute__((__stdcall__));

View File

@ -1,17 +1,7 @@
#ifndef KOLIBRI_LIBIMG_H #ifndef KOLIBRI_LIBIMG_H
#define KOLIBRI_LIBIMG_H #define KOLIBRI_LIBIMG_H
int kolibri_libimg_init(void) extern int kolibri_libimg_init(void);
{
int asm_init_status = init_libimg_asm();
/* just return asm_init_status? or return init_libimg_asm() ?*/
if(asm_init_status == 0)
return 0;
else
return 1;
}
//list of format id's //list of format id's
#define LIBIMG_FORMAT_BMP 1 #define LIBIMG_FORMAT_BMP 1

View File

@ -1,19 +1,7 @@
#ifndef KOLIBRI_LIBINI_H #ifndef KOLIBRI_LIBINI_H
#define KOLIBRI_LIBINI_H #define KOLIBRI_LIBINI_H
extern int init_libini_asm(void); extern int kolibri_libini_init(void);
int kolibri_libini_init(void)
{
int asm_init_status = init_libini_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/
if(asm_init_status == 0)
return 0;
else
return 1;
}
extern uint32_t (*LIBINI_enum_sections)(const char*, void*) __attribute__((__stdcall__)); extern uint32_t (*LIBINI_enum_sections)(const char*, void*) __attribute__((__stdcall__));
extern uint32_t (*LIBINI_enum_keys)(const char*, const char*, void*) __attribute__((__stdcall__)); extern uint32_t (*LIBINI_enum_keys)(const char*, const char*, void*) __attribute__((__stdcall__));

View File

@ -1,17 +1,7 @@
#ifndef KOLIBRI_PROCLIB_H #ifndef KOLIBRI_PROCLIB_H
#define KOLIBRI_PROCLIB_H #define KOLIBRI_PROCLIB_H
int kolibri_proclib_init(void) extern int kolibri_proclib_init(void)
{
int asm_init_status = init_proclib_asm();
/* just return asm_init_status? or return init_proclib_asm() ?*/
if(asm_init_status == 0)
return 0;
else
return 1;
}
enum Mode { enum Mode {
OD_OPEN, OD_OPEN,