Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
0c0f4468
Commit
0c0f4468
authored
Jun 11, 2014
by
Paul Sokolovsky
Browse files
objfun: Remove no longer used mp_obj_fun_prepare_simple_args().
parent
f4bf065d
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/obj.h
View file @
0c0f4468
...
...
@@ -534,8 +534,6 @@ typedef struct _mp_obj_fun_native_t { // need this so we can define const object
// such functions won't be able to access the global scope, but that's probably okay
}
mp_obj_fun_native_t
;
bool
mp_obj_fun_prepare_simple_args
(
mp_obj_t
self_in
,
uint
n_args
,
uint
n_kw
,
const
mp_obj_t
*
args
,
uint
*
out_args1_len
,
const
mp_obj_t
**
out_args1
,
uint
*
out_args2_len
,
const
mp_obj_t
**
out_args2
);
const
char
*
mp_obj_fun_get_name
(
mp_const_obj_t
fun
);
const
char
*
mp_obj_code_get_name
(
const
byte
*
code_info
);
...
...
py/objfun.c
View file @
0c0f4468
...
...
@@ -193,49 +193,6 @@ STATIC NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, uint expected, ui
#endif
}
// If it's possible to call a function without allocating new argument array,
// this function returns true, together with pointers to 2 subarrays to be used
// as arguments. Otherwise, it returns false. It is expected that this function
// will be accompanied by another, mp_obj_fun_prepare_full_args(), which will
// instead take pointer to full-length out-array, and will fill it in. Rationale
// being that a caller can try this function and if it succeeds, the function call
// can be made without allocating extra memory. Otherwise, caller can allocate memory
// and try "full" function. These functions are expected to be refactoring of
// code in fun_bc_call() and eventually replace it.
bool
mp_obj_fun_prepare_simple_args
(
mp_obj_t
self_in
,
uint
n_args
,
uint
n_kw
,
const
mp_obj_t
*
args
,
uint
*
out_args1_len
,
const
mp_obj_t
**
out_args1
,
uint
*
out_args2_len
,
const
mp_obj_t
**
out_args2
)
{
mp_obj_fun_bc_t
*
self
=
self_in
;
DEBUG_printf
(
"mp_obj_fun_prepare_simple_args: given: %d pos, %d kw, expected: %d pos (%d default)
\n
"
,
n_args
,
n_kw
,
self
->
n_pos_args
,
self
->
n_def_args
);
assert
(
n_kw
==
0
);
assert
(
self
->
n_kwonly_args
==
0
);
assert
(
self
->
takes_var_args
==
0
);
assert
(
self
->
takes_kw_args
==
0
);
mp_obj_t
*
extra_args
=
self
->
extra_args
+
self
->
n_def_args
;
uint
n_extra_args
=
0
;
if
(
n_args
>
self
->
n_pos_args
)
{
goto
arg_error
;
}
else
{
if
(
n_args
>=
self
->
n_pos_args
-
self
->
n_def_args
)
{
extra_args
-=
self
->
n_pos_args
-
n_args
;
n_extra_args
+=
self
->
n_pos_args
-
n_args
;
}
else
{
fun_pos_args_mismatch
(
self
,
self
->
n_pos_args
-
self
->
n_def_args
,
n_args
);
}
}
*
out_args1
=
args
;
*
out_args1_len
=
n_args
;
*
out_args2
=
extra_args
;
*
out_args2_len
=
n_extra_args
;
return
true
;
arg_error:
fun_pos_args_mismatch
(
self
,
self
->
n_pos_args
,
n_args
);
}
// With this macro you can tune the maximum number of function state bytes
// that will be allocated on the stack. Any function that needs more
// than this will use the heap.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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