Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
pygobject
Commits
726a27c0
Commit
726a27c0
authored
Mar 28, 2011
by
John (J5) Palmieri
Browse files
[gi-invoke-ng] refactor FunctionCache to be more generic CallableCache
parent
3d5d9ff5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
gi/pygi-cache.c
View file @
726a27c0
This diff is collapsed.
Click to expand it.
gi/pygi-cache.h
View file @
726a27c0
...
...
@@ -30,17 +30,17 @@
G_BEGIN_DECLS
typedef
struct
_PyGI
Function
Cache
PyGI
Function
Cache
;
typedef
struct
_PyGI
Callable
Cache
PyGI
Callable
Cache
;
typedef
struct
_PyGIArgCache
PyGIArgCache
;
typedef
gboolean
(
*
PyGIMarshalInFunc
)
(
PyGIInvokeState
*
state
,
PyGI
FunctionCache
*
function
_cache
,
PyGI
CallableCache
*
callable
_cache
,
PyGIArgCache
*
arg_cache
,
PyObject
*
py_arg
,
GIArgument
*
arg
);
typedef
PyObject
*
(
*
PyGIMarshalOutFunc
)
(
PyGIInvokeState
*
state
,
PyGI
FunctionCache
*
function
_cache
,
PyGI
CallableCache
*
callable
_cache
,
PyGIArgCache
*
arg_cache
,
GIArgument
*
arg
);
...
...
@@ -113,7 +113,7 @@ typedef struct _PyGICallbackCache
GIInterfaceInfo
*
interface_info
;
}
PyGICallbackCache
;
struct
_PyGI
Function
Cache
struct
_PyGI
Callable
Cache
{
const
gchar
*
name
;
...
...
@@ -136,9 +136,9 @@ struct _PyGIFunctionCache
};
void
_pygi_arg_cache_clear
(
PyGIArgCache
*
cache
);
void
_pygi_
function
_cache_free
(
PyGI
Function
Cache
*
cache
);
void
_pygi_
callable
_cache_free
(
PyGI
Callable
Cache
*
cache
);
PyGI
Function
Cache
*
_pygi_function_cache_new
(
GI
FunctionInfo
*
function
_info
);
PyGI
Callable
Cache
*
_pygi_function_cache_new
(
GI
CallableInfo
*
callable
_info
);
G_END_DECLS
...
...
gi/pygi-info.c
View file @
726a27c0
...
...
@@ -39,7 +39,7 @@ _base_info_dealloc (PyGIBaseInfo *self)
g_base_info_unref
(
self
->
info
);
#ifdef ENABLE_INVOKE_NG
_pygi_
function
_cache_free
(
self
->
cache
);
_pygi_
callable
_cache_free
(
self
->
cache
);
#endif
Py_TYPE
(
(
PyObject
*
)
self
)
->
tp_free
(
(
PyObject
*
)
self
);
...
...
gi/pygi-invoke-ng.c
View file @
726a27c0
...
...
@@ -27,9 +27,9 @@
static
inline
gboolean
_invoke_
function
(
PyGIInvokeState
*
state
,
PyGI
Function
Cache
*
cache
,
GI
FunctionInfo
*
function
_info
)
_invoke_
callable
(
PyGIInvokeState
*
state
,
PyGI
Callable
Cache
*
cache
,
GI
CallableInfo
*
callable
_info
)
{
GError
*
error
;
gint
retval
;
...
...
@@ -40,16 +40,16 @@ _invoke_function (PyGIInvokeState *state,
/* FIXME: use this for now but we can streamline the calls */
if
(
cache
->
is_vfunc
)
retval
=
g_vfunc_info_invoke
(
function
_info
,
state
->
implementor_gtype
,
state
->
in_args
,
cache
->
n_in_args
,
state
->
out_args
,
cache
->
n_out_args
,
&
state
->
return_arg
,
&
error
);
retval
=
g_vfunc_info_invoke
(
callable
_info
,
state
->
implementor_gtype
,
state
->
in_args
,
cache
->
n_in_args
,
state
->
out_args
,
cache
->
n_out_args
,
&
state
->
return_arg
,
&
error
);
else
retval
=
g_function_info_invoke
(
function
_info
,
retval
=
g_function_info_invoke
(
callable
_info
,
state
->
in_args
,
cache
->
n_in_args
,
state
->
out_args
,
...
...
@@ -79,8 +79,8 @@ _invoke_function (PyGIInvokeState *state,
}
static
inline
gboolean
_invoke_state_init_from_
function
_cache
(
PyGIInvokeState
*
state
,
PyGIFunction
Cache
*
cache
,
_invoke_state_init_from_
callable
_cache
(
PyGIInvokeState
*
state
,
PyGICallable
Cache
*
cache
,
PyObject
*
py_args
,
PyObject
*
kwargs
)
{
...
...
@@ -162,7 +162,7 @@ _invoke_state_init_from_function_cache (PyGIInvokeState *state,
}
static
inline
void
_invoke_state_clear
(
PyGIInvokeState
*
state
,
PyGI
Function
Cache
*
cache
)
_invoke_state_clear
(
PyGIInvokeState
*
state
,
PyGI
Callable
Cache
*
cache
)
{
g_slice_free1
(
cache
->
n_args
*
sizeof
(
GIArgument
*
),
state
->
args
);
g_slice_free1
(
cache
->
n_in_args
*
sizeof
(
GIArgument
),
state
->
in_args
);
...
...
@@ -173,7 +173,7 @@ _invoke_state_clear(PyGIInvokeState *state, PyGIFunctionCache *cache)
}
static
inline
gboolean
_invoke_marshal_in_args
(
PyGIInvokeState
*
state
,
PyGI
Function
Cache
*
cache
)
_invoke_marshal_in_args
(
PyGIInvokeState
*
state
,
PyGI
Callable
Cache
*
cache
)
{
int
i
,
in_count
,
out_count
;
in_count
=
0
;
...
...
@@ -299,7 +299,7 @@ _invoke_marshal_in_args(PyGIInvokeState *state, PyGIFunctionCache *cache)
}
static
inline
PyObject
*
_invoke_marshal_out_args
(
PyGIInvokeState
*
state
,
PyGI
Function
Cache
*
cache
)
_invoke_marshal_out_args
(
PyGIInvokeState
*
state
,
PyGI
Callable
Cache
*
cache
)
{
PyObject
*
py_out
=
NULL
;
PyObject
*
py_return
=
NULL
;
...
...
@@ -375,16 +375,16 @@ _wrap_g_callable_info_invoke (PyGIBaseInfo *self,
PyObject
*
ret
;
if
(
self
->
cache
==
NULL
)
{
self
->
cache
=
_pygi_
function
_cache_new
(
self
->
info
);
self
->
cache
=
_pygi_
callable
_cache_new
(
self
->
info
);
if
(
self
->
cache
==
NULL
)
return
NULL
;
}
_invoke_state_init_from_
function
_cache
(
&
state
,
self
->
cache
,
py_args
,
kwargs
);
_invoke_state_init_from_
callable
_cache
(
&
state
,
self
->
cache
,
py_args
,
kwargs
);
if
(
!
_invoke_marshal_in_args
(
&
state
,
self
->
cache
))
goto
err
;
if
(
!
_invoke_
function
(
&
state
,
self
->
cache
,
self
->
info
))
if
(
!
_invoke_
callable
(
&
state
,
self
->
cache
,
self
->
info
))
goto
err
;
ret
=
_invoke_marshal_out_args
(
&
state
,
self
->
cache
);
...
...
gi/pygi-marshal.c
View file @
726a27c0
This diff is collapsed.
Click to expand it.
gi/pygi-marshal.h
View file @
726a27c0
This diff is collapsed.
Click to expand it.
gi/pygi.h
View file @
726a27c0
...
...
@@ -44,7 +44,7 @@ typedef struct {
GIBaseInfo
*
info
;
PyObject
*
inst_weakreflist
;
#ifdef ENABLE_INVOKE_NG
PyGI
Function
Cache
*
cache
;
PyGI
Callable
Cache
*
cache
;
#endif
}
PyGIBaseInfo
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment