Search found 21 matches

by igorgatis
Wed Dec 23, 2015 6:30 pm
Forum: Development of MicroPython
Topic: Calling Python from C
Replies: 1
Views: 2842

Calling Python from C

Say I have a call like

Code: Select all

def bar(result):
    print(result)

def foo():
  nativemodulex.call(bar)

foo()
What the C code for nativemodulex.call look like?
by igorgatis
Wed Dec 16, 2015 8:10 pm
Forum: Development of MicroPython
Topic: SWIG (or similar wrapping tool) support?
Replies: 15
Views: 5614

Re: SWIG (or similar wrapping tool) support?

Say C function looks like this:

Code: Select all

int SetCallBacks(void (*A)(void), void (*B)(char *), int (*C)(char **, int, int, int *))
1. What the C code for SetCallBacks should look like?

2. What the Python code for callbacks A, B and C should look like?
by igorgatis
Wed Dec 16, 2015 2:04 pm
Forum: Development of MicroPython
Topic: SWIG (or similar wrapping tool) support?
Replies: 15
Views: 5614

Re: SWIG (or similar wrapping tool) support?

Let's say I find a good mechanism (be it through Clang or SWIG's XML) to generate micropython bindings. According to dhylands orientation, the generated binding needs to be "registered" as a builtin module. Is that the only way to go? Builtin modules? I guess that's almost by design since the port h...
by igorgatis
Tue Dec 15, 2015 11:52 am
Forum: Development of MicroPython
Topic: SWIG (or similar wrapping tool) support?
Replies: 15
Views: 5614

Re: SWIG (or similar wrapping tool) support?

dhylands: this is great documentation. Thanks a lot. stijn: I wrote a very simple python program which output most of the "important" stuff from .h file I want to create a module for. It prints function names, typedefs and even "enums" built with #define (PARSE_DETAILED_PROCESSING_RECORD required). ...
by igorgatis
Tue Dec 15, 2015 12:16 am
Forum: Development of MicroPython
Topic: SWIG (or similar wrapping tool) support?
Replies: 15
Views: 5614

Re: SWIG (or similar wrapping tool) support?

Great article: http://szelei.me/code-generator/ I had to make a small adjustment to have access to macros: translation_unit = index.parse(sys.argv[1], sys.argv[2:], options=clang.cindex.TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD) Works very well. Now I just need to master module creation. Any ...
by igorgatis
Wed Dec 09, 2015 9:37 am
Forum: Development of MicroPython
Topic: SWIG (or similar wrapping tool) support?
Replies: 15
Views: 5614

Re: SWIG (or similar wrapping tool) support?

Just learnt there are a handful of wrappers out there: SWIG, Boost.Python, SIP... Here is an interesting summary: http://stackoverflow.com/questions/1492755/python-c-binding-library-comparison# http://intermediate-and-advanced-software-carpentry.readthedocs.org/en/latest/c++-wrapping.html The line I...
by igorgatis
Mon Dec 07, 2015 8:17 pm
Forum: Development of MicroPython
Topic: SWIG (or similar wrapping tool) support?
Replies: 15
Views: 5614

Re: SWIG (or similar wrapping tool) support?

The platform I'm using upy on has this GUI API in C++. I found myself repeating wrap patterns. SWIG may add overhead but native GUI should still perform better than other python based approaches, I think. Perhaps I could check how much effort is needed to modify SWIG to support generating code compa...
by igorgatis
Mon Dec 07, 2015 2:57 pm
Forum: Development of MicroPython
Topic: SWIG (or similar wrapping tool) support?
Replies: 15
Views: 5614

SWIG (or similar wrapping tool) support?

Is there any support for SWIG or similar wrapping mechanism?
by igorgatis
Mon Nov 30, 2015 4:22 pm
Forum: Development of MicroPython
Topic: MICROPY_OBJ_REPR_C causes 'identifier "mp_float_t" is undefined'
Replies: 2
Views: 1366

MICROPY_OBJ_REPR_C causes 'identifier "mp_float_t" is undefined'

I'm trying to use MICROPY_OBJ_REPR_C but it fails with:

Code: Select all

 identifier "mp_float_t" is undefined
Should it include mpconfig.h?

In time: if I'm using a 32-bit (big endian) platform, what representation model should I use? A, B, C or D? And why?
by igorgatis
Wed Nov 25, 2015 11:10 pm
Forum: Development of MicroPython
Topic: No alloca.h
Replies: 3
Views: 1710

Re: No alloca.h

Great. Thanks a lot.