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
358e5d8b
Commit
358e5d8b
authored
8 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py/stream: Move uPy func obj wrappers to below their respective funcs.
parent
657aef66
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
py/stream.c
+5
-6
5 additions, 6 deletions
py/stream.c
with
5 additions
and
6 deletions
py/stream.c
+
5
−
6
View file @
358e5d8b
...
...
@@ -182,6 +182,7 @@ STATIC mp_obj_t stream_read(size_t n_args, const mp_obj_t *args) {
return
mp_obj_new_str_from_vstr
(
STREAM_CONTENT_TYPE
(
stream_p
),
&
vstr
);
}
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_stream_read_obj
,
1
,
2
,
stream_read
);
mp_obj_t
mp_stream_write
(
mp_obj_t
self_in
,
const
void
*
buf
,
size_t
len
)
{
const
mp_stream_p_t
*
stream_p
=
mp_get_stream_raise
(
self_in
,
MP_STREAM_OP_WRITE
);
...
...
@@ -228,6 +229,7 @@ STATIC mp_obj_t stream_write_method(mp_obj_t self_in, mp_obj_t arg) {
mp_get_buffer_raise
(
arg
,
&
bufinfo
,
MP_BUFFER_READ
);
return
mp_stream_write
(
self_in
,
bufinfo
.
buf
,
bufinfo
.
len
);
}
MP_DEFINE_CONST_FUN_OBJ_2
(
mp_stream_write_obj
,
stream_write_method
);
STATIC
mp_obj_t
stream_readinto
(
size_t
n_args
,
const
mp_obj_t
*
args
)
{
const
mp_stream_p_t
*
stream_p
=
mp_get_stream_raise
(
args
[
0
],
MP_STREAM_OP_READ
);
...
...
@@ -256,6 +258,7 @@ STATIC mp_obj_t stream_readinto(size_t n_args, const mp_obj_t *args) {
return
MP_OBJ_NEW_SMALL_INT
(
out_sz
);
}
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_stream_readinto_obj
,
2
,
3
,
stream_readinto
);
STATIC
mp_obj_t
stream_readall
(
mp_obj_t
self_in
)
{
const
mp_stream_p_t
*
stream_p
=
mp_get_stream_raise
(
self_in
,
MP_STREAM_OP_READ
);
...
...
@@ -300,6 +303,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in) {
vstr
.
len
=
total_size
;
return
mp_obj_new_str_from_vstr
(
STREAM_CONTENT_TYPE
(
stream_p
),
&
vstr
);
}
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_stream_readall_obj
,
stream_readall
);
// Unbuffered, inefficient implementation of readline() for raw I/O files.
STATIC
mp_obj_t
stream_unbuffered_readline
(
size_t
n_args
,
const
mp_obj_t
*
args
)
{
...
...
@@ -357,6 +361,7 @@ done:
return
mp_obj_new_str_from_vstr
(
STREAM_CONTENT_TYPE
(
stream_p
),
&
vstr
);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_stream_unbuffered_readline_obj
,
1
,
2
,
stream_unbuffered_readline
);
// TODO take an optional extra argument (what does it do exactly?)
STATIC
mp_obj_t
stream_unbuffered_readlines
(
mp_obj_t
self
)
{
...
...
@@ -432,9 +437,3 @@ STATIC mp_obj_t stream_ioctl(size_t n_args, const mp_obj_t *args) {
return
mp_obj_new_int
(
res
);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_stream_ioctl_obj
,
2
,
3
,
stream_ioctl
);
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_stream_read_obj
,
1
,
2
,
stream_read
);
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_stream_readinto_obj
,
2
,
3
,
stream_readinto
);
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_stream_readall_obj
,
stream_readall
);
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_stream_unbuffered_readline_obj
,
1
,
2
,
stream_unbuffered_readline
);
MP_DEFINE_CONST_FUN_OBJ_2
(
mp_stream_write_obj
,
stream_write_method
);
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