Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
3b973a56
Commit
3b973a56
authored
6 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Move mp_native_type_from_qstr() from emitnative.c to nativeglue.c.
parent
28c2873d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
py/emit.h
+0
-2
0 additions, 2 deletions
py/emit.h
py/emitnative.c
+0
-14
0 additions, 14 deletions
py/emitnative.c
py/nativeglue.c
+14
-0
14 additions, 0 deletions
py/nativeglue.c
py/runtime.h
+1
-0
1 addition, 0 deletions
py/runtime.h
with
15 additions
and
16 deletions
py/emit.h
+
0
−
2
View file @
3b973a56
...
...
@@ -156,8 +156,6 @@ typedef struct _emit_method_table_t {
void
(
*
end_except_handler
)(
emit_t
*
emit
);
}
emit_method_table_t
;
int
mp_native_type_from_qstr
(
qstr
qst
);
static
inline
void
mp_emit_common_get_id_for_load
(
scope_t
*
scope
,
qstr
qst
)
{
scope_find_or_add_id
(
scope
,
qst
,
ID_INFO_KIND_GLOBAL_IMPLICIT
);
}
...
...
This diff is collapsed.
Click to expand it.
py/emitnative.c
+
0
−
14
View file @
3b973a56
...
...
@@ -136,20 +136,6 @@ typedef enum {
VTYPE_BUILTIN_CAST
=
0x70
|
MP_NATIVE_TYPE_OBJ
,
}
vtype_kind_t
;
int
mp_native_type_from_qstr
(
qstr
qst
)
{
switch
(
qst
)
{
case
MP_QSTR_object
:
return
MP_NATIVE_TYPE_OBJ
;
case
MP_QSTR_bool
:
return
MP_NATIVE_TYPE_BOOL
;
case
MP_QSTR_int
:
return
MP_NATIVE_TYPE_INT
;
case
MP_QSTR_uint
:
return
MP_NATIVE_TYPE_UINT
;
case
MP_QSTR_ptr
:
return
MP_NATIVE_TYPE_PTR
;
case
MP_QSTR_ptr8
:
return
MP_NATIVE_TYPE_PTR8
;
case
MP_QSTR_ptr16
:
return
MP_NATIVE_TYPE_PTR16
;
case
MP_QSTR_ptr32
:
return
MP_NATIVE_TYPE_PTR32
;
default:
return
-
1
;
}
}
STATIC
qstr
vtype_to_qstr
(
vtype_kind_t
vtype
)
{
switch
(
vtype
)
{
case
VTYPE_PYOBJ
:
return
MP_QSTR_object
;
...
...
This diff is collapsed.
Click to expand it.
py/nativeglue.c
+
14
−
0
View file @
3b973a56
...
...
@@ -41,6 +41,20 @@
#if MICROPY_EMIT_NATIVE
int
mp_native_type_from_qstr
(
qstr
qst
)
{
switch
(
qst
)
{
case
MP_QSTR_object
:
return
MP_NATIVE_TYPE_OBJ
;
case
MP_QSTR_bool
:
return
MP_NATIVE_TYPE_BOOL
;
case
MP_QSTR_int
:
return
MP_NATIVE_TYPE_INT
;
case
MP_QSTR_uint
:
return
MP_NATIVE_TYPE_UINT
;
case
MP_QSTR_ptr
:
return
MP_NATIVE_TYPE_PTR
;
case
MP_QSTR_ptr8
:
return
MP_NATIVE_TYPE_PTR8
;
case
MP_QSTR_ptr16
:
return
MP_NATIVE_TYPE_PTR16
;
case
MP_QSTR_ptr32
:
return
MP_NATIVE_TYPE_PTR32
;
default:
return
-
1
;
}
}
// convert a MicroPython object to a valid native value based on type
mp_uint_t
mp_convert_obj_to_native
(
mp_obj_t
obj
,
mp_uint_t
type
)
{
DEBUG_printf
(
"mp_convert_obj_to_native(%p, "
UINT_FMT
")
\n
"
,
obj
,
type
);
...
...
This diff is collapsed.
Click to expand it.
py/runtime.h
+
1
−
0
View file @
3b973a56
...
...
@@ -169,6 +169,7 @@ NORETURN void mp_raise_recursion_depth(void);
#endif
// helper functions for native/viper code
int
mp_native_type_from_qstr
(
qstr
qst
);
mp_uint_t
mp_convert_obj_to_native
(
mp_obj_t
obj
,
mp_uint_t
type
);
mp_obj_t
mp_convert_native_to_obj
(
mp_uint_t
val
,
mp_uint_t
type
);
mp_obj_dict_t
*
mp_native_swap_globals
(
mp_obj_dict_t
*
new_globals
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment