Implement support for sys.path when loading modules.
sys.path is not initialized by rt_init(), that's left for platform-specific startup code. (For example, bare metal port may have some hardcoded defaults, and let user change sys.path directly; while port for OS with environment feature can take path from environment). If it's not explicitly initialized, modules will be imported only from a current directory.
This commit is contained in:
11
py/misc.h
11
py/misc.h
@@ -90,6 +90,17 @@ void vstr_add_strn(vstr_t *vstr, const char *str, int len);
|
||||
void vstr_cut_tail(vstr_t *vstr, int len);
|
||||
void vstr_printf(vstr_t *vstr, const char *fmt, ...);
|
||||
|
||||
/** non-dynamic size-bounded variable buffer/string *************/
|
||||
|
||||
#define CHECKBUF(buf, max_size) char buf[max_size + 1]; uint buf##_len = max_size; char *buf##_p = buf;
|
||||
#define CHECKBUF_APPEND(buf, src, src_len) \
|
||||
{ int l = MIN(src_len, buf##_len); \
|
||||
memcpy(buf##_p, src, l); \
|
||||
buf##_len -= l; \
|
||||
buf##_p += l; }
|
||||
#define CHECKBUF_APPEND_0(buf) { *buf##_p = 0; }
|
||||
#define CHECKBUF_LEN(buf) (buf##_p - buf)
|
||||
|
||||
#ifdef va_start
|
||||
void vstr_vprintf(vstr_t *vstr, const char *fmt, va_list ap);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user