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
c327c0de
Commit
c327c0de
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
unix: Remove test class and code.
parent
2c9c2004
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
unix/main.c
+5
-50
5 additions, 50 deletions
unix/main.c
with
5 additions
and
50 deletions
unix/main.c
+
5
−
50
View file @
c327c0de
...
...
@@ -203,51 +203,6 @@ STATIC void do_str(const char *str) {
execute_from_lexer
(
lex
,
MP_PARSE_SINGLE_INPUT
,
false
);
}
typedef
struct
_test_obj_t
{
mp_obj_base_t
base
;
int
value
;
}
test_obj_t
;
STATIC
void
test_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
test_obj_t
*
self
=
self_in
;
print
(
env
,
"<test %d>"
,
self
->
value
);
}
STATIC
mp_obj_t
test_get
(
mp_obj_t
self_in
)
{
test_obj_t
*
self
=
self_in
;
return
mp_obj_new_int
(
self
->
value
);
}
STATIC
mp_obj_t
test_set
(
mp_obj_t
self_in
,
mp_obj_t
arg
)
{
test_obj_t
*
self
=
self_in
;
self
->
value
=
mp_obj_get_int
(
arg
);
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
test_get_obj
,
test_get
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
test_set_obj
,
test_set
);
STATIC
const
mp_map_elem_t
test_locals_dict_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_get
),
(
mp_obj_t
)
&
test_get_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_set
),
(
mp_obj_t
)
&
test_set_obj
},
};
STATIC
MP_DEFINE_CONST_DICT
(
test_locals_dict
,
test_locals_dict_table
);
STATIC
const
mp_obj_type_t
test_type
=
{
{
&
mp_type_type
},
.
name
=
MP_QSTR_Test
,
.
print
=
test_print
,
.
locals_dict
=
(
mp_obj_t
)
&
test_locals_dict
,
};
mp_obj_t
test_obj_new
(
int
value
)
{
test_obj_t
*
o
=
m_new_obj
(
test_obj_t
);
o
->
base
.
type
=
&
test_type
;
o
->
value
=
value
;
return
o
;
}
int
usage
(
char
**
argv
)
{
printf
(
"usage: %s [-X <opt>] [-c <command>] [<filename>]
\n
"
...
...
@@ -378,7 +333,6 @@ int main(int argc, char **argv) {
mp_obj_list_init
(
mp_sys_argv
,
0
);
mp_store_name
(
qstr_from_str
(
"test"
),
test_obj_new
(
42
));
mp_store_name
(
qstr_from_str
(
"mem_info"
),
mp_make_function_n
(
0
,
mem_info
));
mp_store_name
(
qstr_from_str
(
"qstr_info"
),
mp_make_function_n
(
0
,
qstr_info
));
#if MICROPY_ENABLE_GC
...
...
@@ -392,10 +346,11 @@ int main(int argc, char **argv) {
// pass
// test_obj = TestClass()
// test_obj.attr = 42
mp_obj_t
test_class_type
,
test_class_instance
;
test_class_type
=
mp_obj_new_type
(
QSTR_FROM_STR_STATIC
(
"TestClass"
),
mp_const_empty_tuple
,
mp_obj_new_dict
(
0
));
mp_store_name
(
QSTR_FROM_STR_STATIC
(
"test_obj"
),
test_class_instance
=
mp_call_function_0
(
test_class_type
));
mp_store_attr
(
test_class_instance
,
QSTR_FROM_STR_STATIC
(
"attr"
),
mp_obj_new_int
(
42
));
//
// mp_obj_t test_class_type, test_class_instance;
// test_class_type = mp_obj_new_type(QSTR_FROM_STR_STATIC("TestClass"), mp_const_empty_tuple, mp_obj_new_dict(0));
// mp_store_name(QSTR_FROM_STR_STATIC("test_obj"), test_class_instance = mp_call_function_0(test_class_type));
// mp_store_attr(test_class_instance, QSTR_FROM_STR_STATIC("attr"), mp_obj_new_int(42));
/*
printf("bytes:\n");
...
...
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