From 043992e7301b9cf9b87ef3c87c009ac6159ceaab Mon Sep 17 00:00:00 2001 From: Serhii Sakhno Date: Mon, 20 Jun 2016 02:23:22 +0000 Subject: [PATCH] add wrapper for libini git-svn-id: svn://kolibrios.org@6448 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/C_Layer/libini/kolibri_libini.h | 26 +++++++++++++ contrib/C_Layer/libini/loadlibini.asm | 52 +++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 contrib/C_Layer/libini/kolibri_libini.h create mode 100644 contrib/C_Layer/libini/loadlibini.asm diff --git a/contrib/C_Layer/libini/kolibri_libini.h b/contrib/C_Layer/libini/kolibri_libini.h new file mode 100644 index 0000000000..bef2015686 --- /dev/null +++ b/contrib/C_Layer/libini/kolibri_libini.h @@ -0,0 +1,26 @@ +#ifndef KOLIBRI_LIBINI_H +#define KOLIBRI_LIBINI_H + +extern int init_libini_asm(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_keys)(const char*, const char*, void*) __attribute__((__stdcall__)); + +extern uint32_t (*LIBINI_get_str)(const char*, const char*, const char*, char*, uint32_t) __attribute__((__stdcall__)); +extern uint32_t (*LIBINI_set_str)(const char*, const char*, const char*, const char*, uint32_t) __attribute__((__stdcall__)); +extern uint32_t (*LIBINI_get_int)(const char*, const char*, const char*, uint32_t) __attribute__((__stdcall__)); +extern uint32_t (*LIBINI_set_int)(const char*, const char*, const char*, uint32_t) __attribute__((__stdcall__)); + +#endif /* KOLIBRI_LIBINI_H */ diff --git a/contrib/C_Layer/libini/loadlibini.asm b/contrib/C_Layer/libini/loadlibini.asm new file mode 100644 index 0000000000..3c69888bd3 --- /dev/null +++ b/contrib/C_Layer/libini/loadlibini.asm @@ -0,0 +1,52 @@ +format coff +use32 ; Tell compiler to use 32 bit instructions + +section '.flat' code ; Keep this line before includes or GCC messes up call addresses + +;include 'struct.inc' +include '../../../programs/proc32.inc' +include '../../../programs/macros.inc' +purge section,mov,add,sub + +include '../../../programs/dll.inc' + +public init_libini as '_init_libini_asm' + +;;; Returns 0 on success. -1 on failure. + +proc init_libini + + 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_libini, 'libini.obj' + +import lib_libini, \ + LIBINI_enum_sections , 'ini_enum_sections' , \ + LIBINI_enum_keys , 'ini_enum_keys' , \ + LIBINI_get_str , 'ini_get_str' , \ + LIBINI_get_int , 'ini_get_int' , \ + LIBINI_get_color , 'int_get_color' , \ + LIBINI_set_str , 'ini_set_str' , \ + LIBINI_set_int , 'ini_set_int' + +public LIBINI_enum_sections as '_LIBINI_enum_sections' +public LIBINI_enum_keys as '_LIBINI_enum_keys' +public LIBINI_get_str as '_LIBINI_get_str' +public LIBINI_get_int as '_LIBINI_get_int' +public LIBINI_get_color as '_LIBINI_get_color' +public LIBINI_set_str as '_LIBINI_set_str' +public LIBINI_set_int as '_LIBINI_set_int'