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
GitLab 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
b5b1f2c5
Commit
b5b1f2c5
authored
Nov 20, 2015
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py/emitglue: Add mp_raw_code_load_mem to load raw-code from memory.
parent
f148727b
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/emitglue.c
+20
-0
20 additions, 0 deletions
py/emitglue.c
py/emitglue.h
+1
-0
1 addition, 0 deletions
py/emitglue.h
with
21 additions
and
0 deletions
py/emitglue.c
+
20
−
0
View file @
b5b1f2c5
...
@@ -324,6 +324,26 @@ mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader) {
...
@@ -324,6 +324,26 @@ mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader) {
return
load_raw_code
(
reader
);
return
load_raw_code
(
reader
);
}
}
typedef
struct
_mp_mem_reader_t
{
const
byte
*
cur
;
const
byte
*
end
;
}
mp_mem_reader_t
;
STATIC
mp_uint_t
mp_mem_reader_next_byte
(
void
*
br_in
)
{
mp_mem_reader_t
*
br
=
br_in
;
if
(
br
->
cur
<
br
->
end
)
{
return
*
br
->
cur
++
;
}
else
{
return
(
mp_uint_t
)
-
1
;
}
}
mp_raw_code_t
*
mp_raw_code_load_mem
(
const
byte
*
buf
,
size_t
len
)
{
mp_mem_reader_t
mr
=
{
buf
,
buf
+
len
};
mp_reader_t
reader
=
{
&
mr
,
mp_mem_reader_next_byte
};
return
mp_raw_code_load
(
&
reader
);
}
// here we define mp_raw_code_load_file depending on the port
// here we define mp_raw_code_load_file depending on the port
// TODO abstract this away properly
// TODO abstract this away properly
...
...
This diff is collapsed.
Click to expand it.
py/emitglue.h
+
1
−
0
View file @
b5b1f2c5
...
@@ -62,6 +62,7 @@ typedef struct _mp_reader_t {
...
@@ -62,6 +62,7 @@ typedef struct _mp_reader_t {
}
mp_reader_t
;
}
mp_reader_t
;
mp_raw_code_t
*
mp_raw_code_load
(
mp_reader_t
*
reader
);
mp_raw_code_t
*
mp_raw_code_load
(
mp_reader_t
*
reader
);
mp_raw_code_t
*
mp_raw_code_load_mem
(
const
byte
*
buf
,
size_t
len
);
mp_raw_code_t
*
mp_raw_code_load_file
(
const
char
*
filename
);
mp_raw_code_t
*
mp_raw_code_load_file
(
const
char
*
filename
);
#endif
#endif
...
...
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