Browse Source

clean up the notebook a bit

pull/8/head
Zoltán Vörös 5 years ago
parent
commit
9d4fdf42c8
  1. 10
      consumeiterable/consumeiterable.c
  2. 2039
      docs/developing_micropython.ipynb
  3. 31
      docs/ulab.ipynb
  4. 31
      docs/umath-test.ipynb
  5. 10
      keywordfunction/keywordfunction.c
  6. 10
      makeiterable/makeiterable.c
  7. 11
      profiling/profiling.c
  8. 10
      returniterable/returniterable.c
  9. 10
      simpleclass/simpleclass.c
  10. 10
      simplefunction/simplefunction.c
  11. 2
      sliceextiterable/sliceextiterable.c
  12. 22
      sliceiterable/sliceiterable.c
  13. 10
      specialclass/specialclass.c
  14. 10
      subscriptiterable/subscriptiterable.c
  15. 14
      vector/vector.c

10
consumeiterable/consumeiterable.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include "py/obj.h"
#include "py/runtime.h"

2039
docs/developing_micropython.ipynb

File diff suppressed because it is too large

31
docs/ulab.ipynb

@ -125,7 +125,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.3"
},
"toc": {
"base_numbering": 1,
@ -139,6 +139,35 @@
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,

31
docs/umath-test.ipynb

@ -1878,7 +1878,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.3"
},
"toc": {
"base_numbering": 1,
@ -1897,6 +1897,35 @@
},
"toc_section_display": true,
"toc_window_display": true
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,

10
keywordfunction/keywordfunction.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include <stdio.h>
#include "py/obj.h"
#include "py/runtime.h"

10
makeiterable/makeiterable.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include <stdlib.h>
#include "py/obj.h"
#include "py/runtime.h"

11
profiling/profiling.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include <math.h>
#include <stdio.h>
#include "py/obj.h"
@ -59,4 +69,3 @@ const mp_obj_module_t profiling_user_cmodule = {
};
MP_REGISTER_MODULE(MP_QSTR_profiling, profiling_user_cmodule, MODULE_PROFILING_ENABLED);

10
returniterable/returniterable.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include "py/obj.h"
#include "py/runtime.h"

10
simpleclass/simpleclass.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include <stdio.h>
#include "py/runtime.h"
#include "py/obj.h"

10
simplefunction/simplefunction.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include "py/obj.h"
#include "py/runtime.h"

2
sliceextiterable/sliceextiterable.c

@ -2,6 +2,7 @@
#include "py/obj.h"
#include "py/runtime.h"
#if 0
typedef struct _sliceextitarray_obj_t {
mp_obj_base_t base;
mp_fun_1_t iternext;
@ -129,3 +130,4 @@ mp_obj_t mp_obj_new_sliceextitarray_iterator(mp_obj_t sliceitarray, size_t cur,
o->cur = cur;
return MP_OBJ_FROM_PTR(o);
}
#endif

22
sliceiterable/sliceiterable.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include <stdlib.h>
#include "py/obj.h"
#include "py/runtime.h"
@ -51,12 +61,12 @@ STATIC mp_obj_t sliceitarray_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t v
#if MICROPY_PY_BUILTINS_SLICE
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
return mp_const_none;
}
sliceitarray_obj_t *res = create_new_sliceitarray(slice.stop - slice.start);
for(size_t i=0; i < slice.stop-slice.start; i++) {
res->elements[i] = self->elements[i+slice.start];
mp_seq_get_fast_slice_indexes(self->len, index, &slice);
printf("start: %ld, stop: %ld, step: %ld\n", slice.start, slice.stop, slice.step);
uint16_t len = (slice.stop - slice.start) / slice.step;
sliceitarray_obj_t *res = create_new_sliceitarray(len);
for(size_t i=0; i < len; i++) {
res->elements[i] = self->elements[slice.start+i*slice.step];
}
return MP_OBJ_FROM_PTR(res);
}

10
specialclass/specialclass.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include <stdio.h>
#include "py/runtime.h"
#include "py/obj.h"

10
subscriptiterable/subscriptiterable.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include <stdlib.h>
#include "py/obj.h"
#include "py/runtime.h"

14
vector/vector.c

@ -1,3 +1,13 @@
/*
* This file is part of the micropython-usermod project,
*
* https://github.com/v923z/micropython-usermod
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Zoltán Vörös
*/
#include <math.h>
#include <stdio.h>
#include "py/obj.h"
@ -21,12 +31,9 @@ STATIC mp_obj_t vector_length(mp_obj_t o_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(vector_length_obj, vector_length);
STATIC void vector_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
vector_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_print_str(print, ", ");
mp_print_float(print, self->x, 'f', 0, 0, 10, 6);
printf("vector(%f, %f, %f)\n", (double)self->x, (double)self->y, (double)self->z);
}
@ -61,4 +68,3 @@ const mp_obj_module_t vector_user_cmodule = {
};
MP_REGISTER_MODULE(MP_QSTR_vector, vector_user_cmodule, MODULE_VECTOR_ENABLED);

Loading…
Cancel
Save