mirror of
https://github.com/ptitSeb/box64.git
synced 2026-11-07 09:26:11 -10:00
[WRAPPER] Fixed g_option_group_add_entries (#3977)
This commit is contained in:
1 parent
9ddbc50844
commit
59c6aa4932
4 files changed
+57
-20
No files matched your search
@@ -4788,6 +4788,7 @@ wrappedglib2:
|
||||
- g_completion_set_compare
|
||||
- g_list_free_full
|
||||
- g_main_context_set_poll_func
|
||||
- g_option_group_add_entries
|
||||
- g_ptr_array_set_free_func
|
||||
- g_ptr_array_sort
|
||||
- g_ptr_array_sort_values
|
||||
|
||||
@@ -87,6 +87,7 @@ typedef int32_t (*iFpppuppppppp_t)(void*, void*, void*, uint32_t, void*, void*,
|
||||
GO(g_completion_set_compare, vFpp_t) \
|
||||
GO(g_list_free_full, vFpp_t) \
|
||||
GO(g_main_context_set_poll_func, vFpp_t) \
|
||||
GO(g_option_group_add_entries, vFpp_t) \
|
||||
GO(g_ptr_array_set_free_func, vFpp_t) \
|
||||
GO(g_ptr_array_sort, vFpp_t) \
|
||||
GO(g_ptr_array_sort_values, vFpp_t) \
|
||||
|
||||
+54
-19
@@ -621,6 +621,10 @@ static void* reverseGPrintFuncFct(void* fct)
|
||||
#undef GO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#undef SUPER
|
||||
#include "super80.h"
|
||||
|
||||
// GOptionArg ...
|
||||
#define GO(A) \
|
||||
static uintptr_t my_GOptionArg_fct_##A = 0; \
|
||||
@@ -651,6 +655,25 @@ static void* reverseGOptionArgFct(void* fct)
|
||||
#undef GO
|
||||
return (void*)AddCheckBridge(my_lib->w.bridge, iFpppp, fct, 0, "GOptionArgFunc");
|
||||
}
|
||||
|
||||
#undef SUPER
|
||||
#define SUPER() \
|
||||
GO(0) \
|
||||
GO(1) \
|
||||
GO(2) \
|
||||
GO(3) \
|
||||
GO(4) \
|
||||
GO(5) \
|
||||
GO(6) \
|
||||
GO(7) \
|
||||
GO(8) \
|
||||
GO(9) \
|
||||
GO(10) \
|
||||
GO(11) \
|
||||
GO(12) \
|
||||
GO(13) \
|
||||
GO(14) \
|
||||
|
||||
// GOptionParse ...
|
||||
#define GO(A) \
|
||||
static uintptr_t my_GOptionParse_fct_##A = 0; \
|
||||
@@ -1530,30 +1553,42 @@ typedef struct my_GOptionEntry_s {
|
||||
void* arg_description;
|
||||
} my_GOptionEntry_t;
|
||||
|
||||
static int countGOptionEntries(my_GOptionEntry_t* entries)
|
||||
{
|
||||
int idx = 0;
|
||||
while (entries && entries[idx].long_name)
|
||||
++idx;
|
||||
return idx;
|
||||
}
|
||||
|
||||
static void wrapGOptionEntries(my_GOptionEntry_t* dst, my_GOptionEntry_t* src, int count)
|
||||
{
|
||||
for (int i = 0; i < count; ++i) {
|
||||
dst[i] = src[i];
|
||||
if (src[i].arg == 3)
|
||||
dst[i].arg_data = findGOptionArgFct(src[i].arg_data);
|
||||
}
|
||||
dst[count] = src[count];
|
||||
}
|
||||
|
||||
EXPORT void my_g_option_context_add_main_entries(x64emu_t* emu, void* context, my_GOptionEntry_t* entries, void* domain)
|
||||
{
|
||||
my_GOptionEntry_t* p = entries;
|
||||
int idx = 0;
|
||||
while (p && p->long_name) {
|
||||
// wrap Callbacks
|
||||
++p;
|
||||
++idx;
|
||||
}
|
||||
p = entries;
|
||||
my_GOptionEntry_t my_entries[idx+1];
|
||||
idx = 0;
|
||||
while (p && p->long_name) {
|
||||
// wrap Callbacks
|
||||
my_entries[idx] = *p;
|
||||
if (p->arg == 3)
|
||||
my_entries[idx].arg_data = findGOptionArgFct(p->arg_data);
|
||||
++p;
|
||||
++idx;
|
||||
}
|
||||
if(p) my_entries[idx] = *p;
|
||||
int count = countGOptionEntries(entries);
|
||||
my_GOptionEntry_t my_entries[count+1];
|
||||
if(entries)
|
||||
wrapGOptionEntries(my_entries, entries, count);
|
||||
my->g_option_context_add_main_entries(context, entries?my_entries:NULL, domain);
|
||||
}
|
||||
|
||||
EXPORT void my_g_option_group_add_entries(x64emu_t* emu, void* group, my_GOptionEntry_t* entries)
|
||||
{
|
||||
int count = countGOptionEntries(entries);
|
||||
my_GOptionEntry_t my_entries[count+1];
|
||||
if(entries)
|
||||
wrapGOptionEntries(my_entries, entries, count);
|
||||
my->g_option_group_add_entries(group, entries?my_entries:NULL);
|
||||
}
|
||||
|
||||
EXPORT void* my_g_strconcat(x64emu_t* emu, void* first, uintptr_t* data)
|
||||
{
|
||||
int n = (first)?1:0;
|
||||
|
||||
@@ -790,7 +790,7 @@ GO(g_option_context_set_summary, vFpp)
|
||||
//GOM(g_option_context_set_translate_func, vFEpppp)
|
||||
GO(g_option_context_set_translation_domain, vFpp)
|
||||
GO(g_option_error_quark, uFv)
|
||||
GO(g_option_group_add_entries, vFpp)
|
||||
GOM(g_option_group_add_entries, vFEpp)
|
||||
GO(g_option_group_free, vFp)
|
||||
GOM(g_option_group_new, pFEppppp)
|
||||
GO(g_option_group_ref, pFp) // 2.44+
|
||||
|
||||
Reference in new issue
Block a user