Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
flow3r firmware
Commits
28391683
Commit
28391683
authored
Oct 24, 2013
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
Add py_get_array_fixed_n function.
parent
7ee80bac
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
py/runtime.c
+12
-0
12 additions, 0 deletions
py/runtime.c
py/runtime.h
+1
-0
1 addition, 0 deletions
py/runtime.h
with
13 additions
and
0 deletions
py/runtime.c
+
12
−
0
View file @
28391683
...
@@ -871,6 +871,18 @@ qstr py_get_qstr(py_obj_t arg) {
...
@@ -871,6 +871,18 @@ qstr py_get_qstr(py_obj_t arg) {
}
}
}
}
py_obj_t
*
py_get_array_fixed_n
(
py_obj_t
o_in
,
int
n
)
{
if
(
IS_O
(
o_in
,
O_TUPLE
)
||
IS_O
(
o_in
,
O_LIST
))
{
py_obj_base_t
*
o
=
o_in
;
if
(
o
->
u_tuple_list
.
len
!=
n
)
{
nlr_jump
(
py_obj_new_exception_2
(
q_IndexError
,
"requested length %d but object has length %d"
,
(
void
*
)
n
,
(
void
*
)
o
->
u_tuple_list
.
len
));
}
return
o
->
u_tuple_list
.
items
;
}
else
{
nlr_jump
(
py_obj_new_exception_2
(
q_TypeError
,
"object '%s' is not a tuple or list"
,
py_obj_get_type_str
(
o_in
),
NULL
));
}
}
py_obj_t
rt_load_const_str
(
qstr
qstr
)
{
py_obj_t
rt_load_const_str
(
qstr
qstr
)
{
DEBUG_OP_printf
(
"load '%s'
\n
"
,
qstr_str
(
qstr
));
DEBUG_OP_printf
(
"load '%s'
\n
"
,
qstr_str
(
qstr
));
return
py_obj_new_str
(
qstr
);
return
py_obj_new_str
(
qstr
);
...
...
This diff is collapsed.
Click to expand it.
py/runtime.h
+
1
−
0
View file @
28391683
...
@@ -99,6 +99,7 @@ void py_obj_print(py_obj_t o);
...
@@ -99,6 +99,7 @@ void py_obj_print(py_obj_t o);
int
rt_is_true
(
py_obj_t
arg
);
int
rt_is_true
(
py_obj_t
arg
);
int
py_get_int
(
py_obj_t
arg
);
int
py_get_int
(
py_obj_t
arg
);
qstr
py_get_qstr
(
py_obj_t
arg
);
qstr
py_get_qstr
(
py_obj_t
arg
);
py_obj_t
*
py_get_array_fixed_n
(
py_obj_t
o
,
int
n
);
py_obj_t
py_obj_new_int
(
int
value
);
py_obj_t
py_obj_new_int
(
int
value
);
py_obj_t
rt_load_const_str
(
qstr
qstr
);
py_obj_t
rt_load_const_str
(
qstr
qstr
);
py_obj_t
rt_load_name
(
qstr
qstr
);
py_obj_t
rt_load_name
(
qstr
qstr
);
...
...
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