File tree 20 files changed +2
-151
lines changed
20 files changed +2
-151
lines changed Original file line number Diff line number Diff line change 135
135
#define mp_type_fileio mp_type_vfs_fat_fileio
136
136
#define mp_type_textio mp_type_vfs_fat_textio
137
137
138
- // use vfs's functions for import stat and builtin open
139
- #define mp_import_stat mp_vfs_import_stat
140
- #define mp_builtin_open mp_vfs_open
141
- #define mp_builtin_open_obj mp_vfs_open_obj
142
-
143
- // extra built in names to add to the global namespace
144
- #define MICROPY_PORT_BUILTINS \
145
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, \
146
-
147
138
// extra constants
148
139
#define MICROPY_PORT_CONSTANTS \
149
140
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \
Original file line number Diff line number Diff line change 126
126
#define mp_type_fileio mp_type_vfs_fat_fileio
127
127
#define mp_type_textio mp_type_vfs_fat_textio
128
128
129
- // use vfs's functions for import stat and builtin open
130
- #define mp_import_stat mp_vfs_import_stat
131
- #define mp_builtin_open mp_vfs_open
132
- #define mp_builtin_open_obj mp_vfs_open_obj
133
-
134
- // extra built in names to add to the global namespace
135
- #define MICROPY_PORT_BUILTINS \
136
- { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
137
- { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
138
-
139
129
#define MP_STATE_PORT MP_STATE_VM
140
130
141
131
struct _machine_timer_obj_t ;
Original file line number Diff line number Diff line change @@ -150,15 +150,6 @@ extern const struct _mp_print_t mp_debug_print;
150
150
#define mp_type_textio mp_type_vfs_lfs2_textio
151
151
#endif
152
152
153
- // use vfs's functions for import stat and builtin open
154
- #define mp_import_stat mp_vfs_import_stat
155
- #define mp_builtin_open mp_vfs_open
156
- #define mp_builtin_open_obj mp_vfs_open_obj
157
-
158
- // extra built in names to add to the global namespace
159
- #define MICROPY_PORT_BUILTINS \
160
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
161
-
162
153
#define MP_STATE_PORT MP_STATE_VM
163
154
164
155
#define MICROPY_PORT_ROOT_POINTERS \
Original file line number Diff line number Diff line change @@ -175,10 +175,6 @@ typedef int mp_int_t; // must be pointer size
175
175
typedef unsigned mp_uint_t ; // must be pointer size
176
176
typedef long mp_off_t ;
177
177
178
- // extra built in names to add to the global namespace
179
- #define MICROPY_PORT_BUILTINS \
180
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
181
-
182
178
// We need to provide a declaration/definition of alloca()
183
179
#include <alloca.h>
184
180
Original file line number Diff line number Diff line change @@ -188,11 +188,6 @@ uint32_t trng_random_u32(void);
188
188
#define mp_type_fileio mp_type_vfs_lfs2_fileio
189
189
#define mp_type_textio mp_type_vfs_lfs2_textio
190
190
191
- // Use VFS's functions for import stat and builtin open
192
- #define mp_import_stat mp_vfs_import_stat
193
- #define mp_builtin_open mp_vfs_open
194
- #define mp_builtin_open_obj mp_vfs_open_obj
195
-
196
191
// Hooks to add builtins
197
192
198
193
__attribute__((always_inline )) static inline void enable_irq (uint32_t state ) {
@@ -225,9 +220,6 @@ static inline void restore_irq_pri(uint32_t basepri) {
225
220
#define MICROPY_BEGIN_ATOMIC_SECTION () disable_irq()
226
221
#define MICROPY_END_ATOMIC_SECTION (state ) enable_irq(state)
227
222
228
- #define MICROPY_PORT_BUILTINS \
229
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
230
-
231
223
#if defined(MICROPY_HW_ETH_MDC )
232
224
extern const struct _mp_obj_type_t network_lan_type ;
233
225
#define MICROPY_HW_NIC_ETH { MP_ROM_QSTR(MP_QSTR_LAN), MP_ROM_PTR(&network_lan_type) },
Original file line number Diff line number Diff line change @@ -81,11 +81,6 @@ mp_import_stat_t mp_import_stat(const char *path) {
81
81
return MP_IMPORT_STAT_NO_EXIST ;
82
82
}
83
83
84
- mp_obj_t mp_builtin_open (size_t n_args , const mp_obj_t * args , mp_map_t * kwargs ) {
85
- return mp_const_none ;
86
- }
87
- MP_DEFINE_CONST_FUN_OBJ_KW (mp_builtin_open_obj , 1 , mp_builtin_open );
88
-
89
84
void nlr_jump_fail (void * val ) {
90
85
while (1 ) {
91
86
;
Original file line number Diff line number Diff line change @@ -25,10 +25,6 @@ typedef intptr_t mp_int_t; // must be pointer size
25
25
typedef uintptr_t mp_uint_t ; // must be pointer size
26
26
typedef long mp_off_t ;
27
27
28
- // extra built in names to add to the global namespace
29
- #define MICROPY_PORT_BUILTINS \
30
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
31
-
32
28
// We need to provide a declaration/definition of alloca()
33
29
#include <alloca.h>
34
30
Original file line number Diff line number Diff line change 85
85
#define mp_type_fileio fatfs_type_fileio
86
86
#define mp_type_textio fatfs_type_textio
87
87
88
- // use vfs's functions for import stat and builtin open
89
- #if MICROPY_VFS
90
- #define mp_import_stat mp_vfs_import_stat
91
- #define mp_builtin_open mp_vfs_open
92
- #define mp_builtin_open_obj mp_vfs_open_obj
93
- #endif
94
-
95
88
// Enable micro:bit filesystem by default.
96
89
#ifndef MICROPY_MBFS
97
90
#define MICROPY_MBFS (1)
Original file line number Diff line number Diff line change @@ -45,15 +45,6 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
45
45
mp_raise_OSError (MP_ENOENT );
46
46
}
47
47
48
- mp_import_stat_t mp_import_stat (const char * path ) {
49
- return MP_IMPORT_STAT_NO_EXIST ;
50
- }
51
-
52
- mp_obj_t mp_builtin_open (size_t n_args , const mp_obj_t * args , mp_map_t * kwargs ) {
53
- return mp_const_none ;
54
- }
55
- MP_DEFINE_CONST_FUN_OBJ_KW (mp_builtin_open_obj , 1 , mp_builtin_open );
56
-
57
48
void nlr_jump_fail (void * val ) {
58
49
printf ("uncaught NLR\n" );
59
50
exit (1 );
Original file line number Diff line number Diff line change @@ -61,10 +61,6 @@ typedef int32_t mp_int_t; // must be pointer size
61
61
typedef uint32_t mp_uint_t ; // must be pointer size
62
62
typedef long mp_off_t ;
63
63
64
- // extra built in names to add to the global namespace
65
- #define MICROPY_PORT_BUILTINS \
66
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
67
-
68
64
// We need to provide a declaration/definition of alloca()
69
65
#include <alloca.h>
70
66
Original file line number Diff line number Diff line change 5
5
#include <malloc.h>
6
6
#include <setjmp.h>
7
7
8
- #include "py/builtin.h"
9
8
#include "py/compile.h"
10
9
#include "py/runtime.h"
11
10
#include "py/stackctrl.h"
@@ -39,15 +38,6 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
39
38
mp_raise_OSError (MP_ENOENT );
40
39
}
41
40
42
- mp_import_stat_t mp_import_stat (const char * path ) {
43
- return MP_IMPORT_STAT_NO_EXIST ;
44
- }
45
-
46
- mp_obj_t mp_builtin_open (size_t n_args , const mp_obj_t * args , mp_map_t * kwargs ) {
47
- return mp_const_none ;
48
- }
49
- MP_DEFINE_CONST_FUN_OBJ_KW (mp_builtin_open_obj , 1 , mp_builtin_open );
50
-
51
41
void nlr_jump_fail (void * val ) {
52
42
printf ("uncaught NLR\n" );
53
43
exit (1 );
Original file line number Diff line number Diff line change 149
149
#define mp_type_textio mp_type_vfs_lfs2_textio
150
150
#endif
151
151
152
- // use vfs's functions for import stat and builtin open
153
- #define mp_import_stat mp_vfs_import_stat
154
- #define mp_builtin_open mp_vfs_open
155
- #define mp_builtin_open_obj mp_vfs_open_obj
156
-
157
- // extra built in names to add to the global namespace
158
- #define MICROPY_PORT_BUILTINS \
159
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
160
-
161
152
#if MICROPY_PY_MACHINE
162
153
#define MACHINE_BUILTIN_MODULE_CONSTANTS \
163
154
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \
Original file line number Diff line number Diff line change 125
125
#define mp_type_textio mp_type_vfs_lfs2_textio
126
126
#endif
127
127
128
- // Use VFS's functions for import stat and builtin open
129
- #define mp_import_stat mp_vfs_import_stat
130
- #define mp_builtin_open_obj mp_vfs_open_obj
131
-
132
- // Hooks to add builtins
133
-
134
- #define MICROPY_PORT_BUILTINS \
135
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
136
-
137
128
#if MICROPY_PY_NETWORK
138
129
#define NETWORK_ROOT_POINTERS mp_obj_list_t mod_network_nic_list;
139
130
#else
Original file line number Diff line number Diff line change @@ -73,23 +73,6 @@ void gc_collect(void) {
73
73
gc_collect_end ();
74
74
}
75
75
76
- /*
77
- mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
78
- mp_raise_OSError(MP_ENOENT);
79
- }
80
- */
81
-
82
- #if !MICROPY_VFS
83
- mp_import_stat_t mp_import_stat (const char * path ) {
84
- return MP_IMPORT_STAT_NO_EXIST ;
85
- }
86
-
87
- mp_obj_t mp_builtin_open (size_t n_args , const mp_obj_t * args , mp_map_t * kwargs ) {
88
- return mp_const_none ;
89
- }
90
- MP_DEFINE_CONST_FUN_OBJ_KW (mp_builtin_open_obj , 1 , mp_builtin_open );
91
- #endif
92
-
93
76
void nlr_jump_fail (void * val ) {
94
77
for (;;) {
95
78
}
Original file line number Diff line number Diff line change 99
99
#define mp_type_fileio mp_type_vfs_lfs1_fileio
100
100
#define mp_type_textio mp_type_vfs_lfs1_textio
101
101
102
- // Use VFS's functions for import stat and builtin open
103
- #define mp_import_stat mp_vfs_import_stat
104
- #define mp_builtin_open_obj mp_vfs_open_obj
105
-
106
- // Hooks to add builtins
107
-
108
- #define MICROPY_PORT_BUILTINS \
109
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
110
-
111
102
#define MICROPY_PORT_ROOT_POINTERS \
112
103
const char *readline_hist[8];
113
104
Original file line number Diff line number Diff line change 163
163
#define mp_type_textio mp_type_vfs_lfs2_textio
164
164
#endif
165
165
166
- // use vfs's functions for import stat and builtin open
167
- #define mp_import_stat mp_vfs_import_stat
168
- #define mp_builtin_open mp_vfs_open
169
- #define mp_builtin_open_obj mp_vfs_open_obj
170
-
171
- // extra built in names to add to the global namespace
172
- #define MICROPY_PORT_BUILTINS \
173
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
174
-
175
166
#if MICROPY_PY_PYB
176
167
extern const struct _mp_obj_module_t pyb_module ;
177
168
#define PYB_BUILTIN_MODULE_CONSTANTS \
Original file line number Diff line number Diff line change @@ -214,8 +214,6 @@ extern const struct _mp_print_t mp_stderr_print;
214
214
#define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (256)
215
215
#define MICROPY_ASYNC_KBD_INTR (1)
216
216
217
- #define mp_import_stat mp_vfs_import_stat
218
- #define mp_builtin_open_obj mp_vfs_open_obj
219
217
#define mp_type_fileio mp_type_vfs_posix_fileio
220
218
#define mp_type_textio mp_type_vfs_posix_textio
221
219
@@ -273,9 +271,6 @@ void mp_unix_mark_exec(void);
273
271
#endif
274
272
#endif
275
273
276
- #define MICROPY_PORT_BUILTINS \
277
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
278
-
279
274
#define MP_STATE_PORT MP_STATE_VM
280
275
281
276
#if MICROPY_PY_BLUETOOTH
Original file line number Diff line number Diff line change 109
109
110
110
#define MICROPY_PORT_ROOT_POINTERS \
111
111
112
- #define mp_import_stat mp_vfs_import_stat
113
112
#define mp_type_fileio mp_type_vfs_posix_fileio
114
113
#define mp_type_textio mp_type_vfs_posix_textio
115
114
Original file line number Diff line number Diff line change @@ -171,8 +171,6 @@ extern const struct _mp_print_t mp_stderr_print;
171
171
#define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (256)
172
172
#define MICROPY_KBD_EXCEPTION (1)
173
173
174
- #define mp_import_stat mp_vfs_import_stat
175
- #define mp_builtin_open_obj mp_vfs_open_obj
176
174
#define mp_type_fileio mp_type_vfs_posix_fileio
177
175
#define mp_type_textio mp_type_vfs_posix_textio
178
176
@@ -212,9 +210,6 @@ typedef long long mp_off_t;
212
210
typedef long mp_off_t ;
213
211
#endif
214
212
215
- #define MICROPY_PORT_BUILTINS \
216
- { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
217
-
218
213
#if MICROPY_USE_READLINE == 1
219
214
#define MICROPY_PORT_ROOT_POINTERS \
220
215
char *readline_hist[50];
Original file line number Diff line number Diff line change @@ -195,22 +195,16 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
195
195
}
196
196
#endif
197
197
198
+ #if !MICROPY_VFS
198
199
mp_import_stat_t mp_import_stat (const char * path ) {
199
- #if MICROPY_VFS
200
- return mp_vfs_import_stat (path );
201
- #else
202
200
return MP_IMPORT_STAT_NO_EXIST ;
203
- #endif
204
201
}
205
202
206
203
mp_obj_t mp_builtin_open (size_t n_args , const mp_obj_t * args , mp_map_t * kwargs ) {
207
- #if MICROPY_VFS
208
- return mp_vfs_open (n_args , args , kwargs );
209
- #else
210
204
return mp_const_none ;
211
- #endif
212
205
}
213
206
MP_DEFINE_CONST_FUN_OBJ_KW (mp_builtin_open_obj , 1 , mp_builtin_open );
207
+ #endif
214
208
215
209
NORETURN void nlr_jump_fail (void * val ) {
216
210
while (1 ) {
You can’t perform that action at this time.
0 commit comments