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
70f33cde
Commit
70f33cde
authored
Apr 2, 2014
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Fix up so that it can compile without float.
parent
af6edc61
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
py/gc.c
+0
-1
0 additions, 1 deletion
py/gc.c
py/malloc.c
+0
-1
0 additions, 1 deletion
py/malloc.c
py/objstr.c
+6
-2
6 additions, 2 deletions
py/objstr.c
py/runtime.c
+4
-2
4 additions, 2 deletions
py/runtime.c
with
10 additions
and
6 deletions
py/gc.c
+
0
−
1
View file @
70f33cde
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
#include
"mpconfig.h"
#include
"mpconfig.h"
...
...
This diff is collapsed.
Click to expand it.
py/malloc.c
+
0
−
1
View file @
70f33cde
#include
<unistd.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
...
...
This diff is collapsed.
Click to expand it.
py/objstr.c
+
6
−
2
View file @
70f33cde
...
@@ -788,9 +788,9 @@ mp_obj_t str_format(uint n_args, const mp_obj_t *args) {
...
@@ -788,9 +788,9 @@ mp_obj_t str_format(uint n_args, const mp_obj_t *args) {
nlr_jump
(
mp_obj_new_exception_msg_varg
(
&
mp_type_ValueError
,
nlr_jump
(
mp_obj_new_exception_msg_varg
(
&
mp_type_ValueError
,
"Unknown format code '%c' for object of type '%s'"
,
type
,
mp_obj_get_type_str
(
arg
)));
"Unknown format code '%c' for object of type '%s'"
,
type
,
mp_obj_get_type_str
(
arg
)));
}
}
}
#if MICROPY_ENABLE_FLOAT
#if MICROPY_ENABLE_FLOAT
if
(
arg_looks_numeric
(
arg
))
{
}
else
if
(
arg_looks_numeric
(
arg
))
{
if
(
!
type
)
{
if
(
!
type
)
{
// Even though the docs say that an unspecified type is the same
// Even though the docs say that an unspecified type is the same
...
@@ -848,10 +848,14 @@ mp_obj_t str_format(uint n_args, const mp_obj_t *args) {
...
@@ -848,10 +848,14 @@ mp_obj_t str_format(uint n_args, const mp_obj_t *args) {
type
,
mp_obj_get_type_str
(
arg
)));
type
,
mp_obj_get_type_str
(
arg
)));
}
}
#endif
#endif
}
else
{
}
else
{
// arg doesn't look like a number
if
(
align
==
'='
)
{
if
(
align
==
'='
)
{
nlr_jump
(
mp_obj_new_exception_msg
(
&
mp_type_ValueError
,
"'=' alignment not allowed in string format specifier"
));
nlr_jump
(
mp_obj_new_exception_msg
(
&
mp_type_ValueError
,
"'=' alignment not allowed in string format specifier"
));
}
}
switch
(
type
)
{
switch
(
type
)
{
case
'\0'
:
case
'\0'
:
mp_obj_print_helper
((
void
(
*
)(
void
*
,
const
char
*
,
...))
vstr_printf
,
vstr
,
arg
,
PRINT_STR
);
mp_obj_print_helper
((
void
(
*
)(
void
*
,
const
char
*
,
...))
vstr_printf
,
vstr
,
arg
,
PRINT_STR
);
...
...
This diff is collapsed.
Click to expand it.
py/runtime.c
+
4
−
2
View file @
70f33cde
...
@@ -346,8 +346,7 @@ mp_obj_t mp_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
...
@@ -346,8 +346,7 @@ mp_obj_t mp_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
case
MP_BINARY_OP_TRUE_DIVIDE
:
case
MP_BINARY_OP_TRUE_DIVIDE
:
case
MP_BINARY_OP_INPLACE_TRUE_DIVIDE
:
case
MP_BINARY_OP_INPLACE_TRUE_DIVIDE
:
if
(
rhs_val
==
0
)
{
if
(
rhs_val
==
0
)
{
zero_division:
goto
zero_division
;
nlr_jump
(
mp_obj_new_exception_msg
(
&
mp_type_ZeroDivisionError
,
"division by zero"
));
}
}
return
mp_obj_new_float
((
mp_float_t
)
lhs_val
/
(
mp_float_t
)
rhs_val
);
return
mp_obj_new_float
((
mp_float_t
)
lhs_val
/
(
mp_float_t
)
rhs_val
);
#endif
#endif
...
@@ -451,6 +450,9 @@ generic_binary_op:
...
@@ -451,6 +450,9 @@ generic_binary_op:
"unsupported operand types for binary operator: '%s', '%s'"
,
"unsupported operand types for binary operator: '%s', '%s'"
,
mp_obj_get_type_str
(
lhs
),
mp_obj_get_type_str
(
rhs
)));
mp_obj_get_type_str
(
lhs
),
mp_obj_get_type_str
(
rhs
)));
return
mp_const_none
;
return
mp_const_none
;
zero_division:
nlr_jump
(
mp_obj_new_exception_msg
(
&
mp_type_ZeroDivisionError
,
"division by zero"
));
}
}
mp_obj_t
mp_call_function_0
(
mp_obj_t
fun
)
{
mp_obj_t
mp_call_function_0
(
mp_obj_t
fun
)
{
...
...
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