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
2e2e404f
Commit
2e2e404f
authored
Mar 19, 2015
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Allow to compile with extra warnings (sign-compare, unused-param).
parent
02894b51
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
py/lexer.c
+7
-7
7 additions, 7 deletions
py/lexer.c
py/lexer.h
+2
-1
2 additions, 1 deletion
py/lexer.h
py/modbuiltins.c
+4
-2
4 additions, 2 deletions
py/modbuiltins.c
py/objarray.c
+2
-0
2 additions, 0 deletions
py/objarray.c
py/objstrunicode.c
+1
-1
1 addition, 1 deletion
py/objstrunicode.c
with
16 additions
and
11 deletions
py/lexer.c
+
7
−
7
View file @
2e2e404f
...
...
@@ -58,33 +58,33 @@ STATIC bool is_physical_newline(mp_lexer_t *lex) {
return
lex
->
chr0
==
'\n'
;
}
STATIC
bool
is_char
(
mp_lexer_t
*
lex
,
char
c
)
{
STATIC
bool
is_char
(
mp_lexer_t
*
lex
,
byte
c
)
{
return
lex
->
chr0
==
c
;
}
STATIC
bool
is_char_or
(
mp_lexer_t
*
lex
,
char
c1
,
char
c2
)
{
STATIC
bool
is_char_or
(
mp_lexer_t
*
lex
,
byte
c1
,
byte
c2
)
{
return
lex
->
chr0
==
c1
||
lex
->
chr0
==
c2
;
}
STATIC
bool
is_char_or3
(
mp_lexer_t
*
lex
,
char
c1
,
char
c2
,
char
c3
)
{
STATIC
bool
is_char_or3
(
mp_lexer_t
*
lex
,
byte
c1
,
byte
c2
,
byte
c3
)
{
return
lex
->
chr0
==
c1
||
lex
->
chr0
==
c2
||
lex
->
chr0
==
c3
;
}
/*
STATIC bool is_char_following(mp_lexer_t *lex,
char
c) {
STATIC bool is_char_following(mp_lexer_t *lex,
byte
c) {
return lex->chr1 == c;
}
*/
STATIC
bool
is_char_following_or
(
mp_lexer_t
*
lex
,
char
c1
,
char
c2
)
{
STATIC
bool
is_char_following_or
(
mp_lexer_t
*
lex
,
byte
c1
,
byte
c2
)
{
return
lex
->
chr1
==
c1
||
lex
->
chr1
==
c2
;
}
STATIC
bool
is_char_following_following_or
(
mp_lexer_t
*
lex
,
char
c1
,
char
c2
)
{
STATIC
bool
is_char_following_following_or
(
mp_lexer_t
*
lex
,
byte
c1
,
byte
c2
)
{
return
lex
->
chr2
==
c1
||
lex
->
chr2
==
c2
;
}
STATIC
bool
is_char_and
(
mp_lexer_t
*
lex
,
char
c1
,
char
c2
)
{
STATIC
bool
is_char_and
(
mp_lexer_t
*
lex
,
byte
c1
,
byte
c2
)
{
return
lex
->
chr0
==
c1
&&
lex
->
chr1
==
c2
;
}
...
...
This diff is collapsed.
Click to expand it.
py/lexer.h
+
2
−
1
View file @
2e2e404f
...
...
@@ -141,7 +141,8 @@ typedef enum _mp_token_kind_t {
// the next-byte function must return the next byte in the stream
// it must return MP_LEXER_EOF if end of stream
// it can be called again after returning MP_LEXER_EOF, and in that case must return MP_LEXER_EOF
#define MP_LEXER_EOF (-1)
#define MP_LEXER_EOF ((unichar)(-1))
typedef
mp_uint_t
(
*
mp_lexer_stream_next_byte_t
)(
void
*
);
typedef
void
(
*
mp_lexer_stream_close_t
)(
void
*
);
...
...
This diff is collapsed.
Click to expand it.
py/modbuiltins.c
+
4
−
2
View file @
2e2e404f
...
...
@@ -41,6 +41,10 @@
#include
<math.h>
#endif
#if MICROPY_PY_IO
extern
mp_uint_t
mp_sys_stdout_obj
;
// type is irrelevant, just need pointer
#endif
// args[0] is function from class body
// args[1] is class name
// args[2:] are base objects
...
...
@@ -403,7 +407,6 @@ STATIC mp_obj_t mp_builtin_print(mp_uint_t n_args, const mp_obj_t *args, mp_map_
end_data
=
mp_obj_str_get_data
(
end_elem
->
value
,
&
end_len
);
}
#if MICROPY_PY_IO
extern
mp_uint_t
mp_sys_stdout_obj
;
// type is irrelevant, just need pointer
mp_obj_t
stream_obj
=
&
mp_sys_stdout_obj
;
mp_map_elem_t
*
file_elem
=
mp_map_lookup
(
kwargs
,
MP_OBJ_NEW_QSTR
(
MP_QSTR_file
),
MP_MAP_LOOKUP
);
if
(
file_elem
!=
NULL
&&
file_elem
->
value
!=
mp_const_none
)
{
...
...
@@ -440,7 +443,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_print_obj, 0, mp_builtin_print);
STATIC
mp_obj_t
mp_builtin___repl_print__
(
mp_obj_t
o
)
{
if
(
o
!=
mp_const_none
)
{
#if MICROPY_PY_IO
extern
mp_uint_t
mp_sys_stdout_obj
;
// type is irrelevant, just need pointer
pfenv_t
pfenv
;
pfenv
.
data
=
&
mp_sys_stdout_obj
;
pfenv
.
print_strn
=
(
void
(
*
)(
void
*
,
const
char
*
,
mp_uint_t
))
mp_stream_write
;
...
...
This diff is collapsed.
Click to expand it.
py/objarray.c
+
2
−
0
View file @
2e2e404f
...
...
@@ -220,6 +220,8 @@ mp_obj_t mp_obj_new_memoryview(byte typecode, mp_uint_t nitems, void *items) {
}
STATIC
mp_obj_t
memoryview_make_new
(
mp_obj_t
type_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
(
void
)
type_in
;
// TODO possibly allow memoryview constructor to take start/stop so that one
// can do memoryview(b, 4, 8) instead of memoryview(b)[4:8] (uses less RAM)
...
...
This diff is collapsed.
Click to expand it.
py/objstrunicode.c
+
1
−
1
View file @
2e2e404f
...
...
@@ -53,7 +53,7 @@ STATIC void uni_print_quoted(void (*print)(void *env, const char *fmt, ...), voi
has_double_quote
=
true
;
}
}
int
quote_char
=
'\''
;
unichar
quote_char
=
'\''
;
if
(
has_single_quote
&&
!
has_double_quote
)
{
quote_char
=
'"'
;
}
...
...
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