summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-24 22:50:40 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-24 22:56:26 +0200
commit91fb1c9b13021e90fa2f8c2105c135fc14ac71db (patch)
tree9edfc5ee0ddbfd03d14934321c7c963a5c6c7921 /py/obj.h
parent2b2cb7b7f4f467b67082f79053118df78f48e66e (diff)
downloadmicropython-91fb1c9b13021e90fa2f8c2105c135fc14ac71db.tar.gz
micropython-91fb1c9b13021e90fa2f8c2105c135fc14ac71db.zip
Add basic implementation of bytes type, piggybacking on str.
This reuses as much str implementation as possible, from this we can make them more separate as needed.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/py/obj.h b/py/obj.h
index 05ccb27574..68d9588b4d 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -208,6 +208,7 @@ mp_obj_t mp_obj_new_int(machine_int_t value);
mp_obj_t mp_obj_new_int_from_uint(machine_uint_t value);
mp_obj_t mp_obj_new_int_from_long_str(const char *s);
mp_obj_t mp_obj_new_str(const byte* data, uint len, bool make_qstr_if_not_already);
+mp_obj_t mp_obj_new_bytes(const byte* data, uint len);
#if MICROPY_ENABLE_FLOAT
mp_obj_t mp_obj_new_float(mp_float_t val);
mp_obj_t mp_obj_new_complex(mp_float_t real, mp_float_t imag);
@@ -280,7 +281,7 @@ void mp_obj_exception_get_traceback(mp_obj_t self_in, machine_uint_t *n, machine
// str
extern const mp_obj_type_t str_type;
-mp_obj_t mp_obj_str_builder_start(uint len, byte **data);
+mp_obj_t mp_obj_str_builder_start(const mp_obj_type_t *type, uint len, byte **data);
mp_obj_t mp_obj_str_builder_end(mp_obj_t o_in);
bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2);
uint mp_obj_str_get_hash(mp_obj_t self_in);
@@ -288,6 +289,9 @@ uint mp_obj_str_get_len(mp_obj_t self_in);
const char *mp_obj_str_get_str(mp_obj_t self_in); // use this only if you need the string to be null terminated
const byte *mp_obj_str_get_data(mp_obj_t self_in, uint *len);
+// bytes
+extern const mp_obj_type_t bytes_type;
+
#if MICROPY_ENABLE_FLOAT
// float
extern const mp_obj_type_t float_type;