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
a60b0263
Commit
a60b0263
authored
8 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
py/stream: Implement generic flush() method, in terms of C-level ioctl.
parent
ade36806
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
py/stream.c
+11
-0
11 additions, 0 deletions
py/stream.c
py/stream.h
+1
-0
1 addition, 0 deletions
py/stream.h
with
12 additions
and
0 deletions
py/stream.c
+
11
−
0
View file @
a60b0263
...
...
@@ -477,6 +477,17 @@ STATIC mp_obj_t stream_tell(mp_obj_t self) {
}
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_stream_tell_obj
,
stream_tell
);
STATIC
mp_obj_t
stream_flush
(
mp_obj_t
self
)
{
const
mp_stream_p_t
*
stream_p
=
mp_get_stream_raise
(
self
,
MP_STREAM_OP_IOCTL
);
int
error
;
mp_uint_t
res
=
stream_p
->
ioctl
(
self
,
MP_STREAM_FLUSH
,
0
,
&
error
);
if
(
res
==
MP_STREAM_ERROR
)
{
nlr_raise
(
mp_obj_new_exception_arg1
(
&
mp_type_OSError
,
MP_OBJ_NEW_SMALL_INT
(
error
)));
}
return
mp_const_none
;
}
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_stream_flush_obj
,
stream_flush
);
STATIC
mp_obj_t
stream_ioctl
(
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_IOCTL
);
...
...
This diff is collapsed.
Click to expand it.
py/stream.h
+
1
−
0
View file @
a60b0263
...
...
@@ -58,6 +58,7 @@ MP_DECLARE_CONST_FUN_OBJ(mp_stream_write_obj);
MP_DECLARE_CONST_FUN_OBJ
(
mp_stream_write1_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_stream_seek_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_stream_tell_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_stream_flush_obj
);
MP_DECLARE_CONST_FUN_OBJ
(
mp_stream_ioctl_obj
);
// these are for mp_get_stream_raise and can be or'd together
...
...
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