add wrapper for kmenu

git-svn-id: svn://kolibrios.org@6454 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Serhii Sakhno 2016-06-27 05:06:24 +00:00
parent 0f225dfc05
commit 11f2e4b6a3
2 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#ifndef KOLIBRI_KMENU_H
#define KOLIBRI_KMENU_H
extern int init_kmenu_asm(void);
int kolibri_kmenu_init(void)
{
int asm_init_status = init_kmenu_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/
if(asm_init_status == 0)
return 0;
else
return 1;
}
extern void (*kmainmenu_draw)(void *) __attribute__((__stdcall__));
extern void (*kmainmenu_dispatch_cursorevent)(void *) __attribute__((__stdcall__));
extern void (*kmenu_init)(void *) __attribute__((__stdcall__));
extern void* (*ksubmenu_new)() __attribute__((__stdcall__));
extern void (*ksubmenu_add)(void *, void *) __attribute__((__stdcall__));
extern void* (*kmenuitem_new)(uint32_t, const char *, uint32_t) __attribute__((__stdcall__));
extern void* (*kmenuitem__submenu_new)(uint32_t, const char *, void *) __attribute__((__stdcall__));
#endif /* KOLIBRI_KMENU_H */

View File

@ -0,0 +1,68 @@
format coff
use32 ; Tell compiler to use 32 bit instructions
section '.init' code ; Keep this line before includes or GCC messes up call addresses
include '../../../programs/proc32.inc'
include '../../../programs/macros.inc'
purge section,mov,add,sub
include '../../../programs/dll.inc'
public init_kmenu as '_init_kmenu_asm'
;;; Returns 0 on success. -1 on failure.
proc init_kmenu
mcall 68,11
stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret
endp
@IMPORT:
library lib_kmenu, 'kmenu.obj'
import lib_kmenu, \
kmainmenu_draw, 'kmainmenu_draw' , \
kmainmenu_dispatch_cursorevent, 'kmainmenu_dispatch_cursorevent' , \
kmainmenu_get_height, 'kmainmenu_get_height', \
ksubmenu_new, 'ksubmenu_new' , \
ksubmenu_delete, 'ksubmenu_delete' , \
ksubmenu_draw, 'ksubmenu_draw' , \
ksubmenu_add, 'ksubmenu_add' , \
ksubmenu_set_items_margin, 'ksubmenu_set_items_margin' , \
ksubmenu_set_items_padding, 'ksubmenu_set_items_padding' , \
kmenuitem_new, 'kmenuitem_new' , \
kmenuitem_delete, 'kmenuitem_delete' , \
kmenuitem_draw, 'kmenuitem_draw' , \
kmenuitem_get_preffered_width, 'kmenuitem_get_preffered_width' , \
kmenuitem_get_preffered_height, 'kmenuitem_get_preffered_height' , \
kmenu_set_font, 'kmenu_set_font' , \
kmenu_init, 'kmenu_init'
public kmainmenu_draw as '_kmainmenu_draw'
public kmainmenu_dispatch_cursorevent as '_kmainmenu_dispatch_cursorevent'
public kmainmenu_get_height as '_kmainmenu_get_height'
public ksubmenu_new as '_ksubmenu_new'
public ksubmenu_delete as '_ksubmenu_delete'
public ksubmenu_draw as '_ksubmenu_draw'
public ksubmenu_add as '_ksubmenu_add'
public ksubmenu_set_items_margin as '_ksubmenu_set_items_margin'
public ksubmenu_set_items_padding as '_ksubmenu_set_items_padding'
public kmenuitem_new as '_kmenuitem_new'
public kmenuitem_new as '_kmenuitem__submenu_new'
public kmenuitem_delete as '_kmenuitem_delete'
public kmenuitem_draw as '_kmenuitem_draw'
public kmenuitem_get_preffered_width as '_kmenuitem_get_preffered_width'
public kmenuitem_get_preffered_height as '_kmenuitem_get_preffered_height'
public kmenu_set_font as '_kmenu_set_font'
public kmenu_init as '_kmenu_init'