Alex Willmer
8b4b8ddc57
Use PyBytes_* Python CAPI functions
...
This removes any doubts about what type of string is in use.
2019-05-10 21:59:03 +01:00
Alex Willmer
287f71d561
Fix uses of retired builtins and builtin methods
...
In Python 3.x
- int and long types are unified. The unified type is called int.
- the text string type (unicode) is renamed to str.
- the byte string type (str) is renamed to bytes.
- chr returns a text string (i.e. str)
- xrange is renamed to range.
- dict.has_key() is removed
-
2019-05-10 21:59:03 +01:00
Meredith L. Patterson
42b25f4784
refactor SWIG PHP definitions into their own file
2013-12-22 18:09:25 +01:00
Meredith L. Patterson
8c074420f7
redefine in() and not_in() in terms of action with 'chr'
2013-12-22 18:09:25 +01:00
Meredith L. Patterson
a09bd53286
Fixed sequence, choice, h_in and h_not_in. ChRange needs its output coerced to char and we're good.
2013-12-22 18:09:25 +01:00
Meredith L. Patterson
9f55409246
EndTest is still failing, but the void*[] typemap isn't segfaulting anymore
2013-12-22 18:09:25 +01:00
Meredith L. Patterson
d544c2f4bb
sequence is still segfaulting; its inner parsers seem to be getting corrupted somehow
2013-12-22 18:09:25 +01:00
Meredith L. Patterson
4d649d93d3
fixed ch; need to figure out what to do with an array of SWIG wrapped types for sequence/choice
2013-12-22 18:09:24 +01:00
Meredith L. Patterson
9382f2720a
call_action compiles; will test later, need to get python-bindings into build now.
2013-12-22 18:09:24 +01:00
Meredith L. Patterson
6c4a8f17c6
need to figure out how to apply a function in zend to something other than an array; about to run out of battery though
2013-12-22 18:09:24 +01:00
Meredith L. Patterson
5fcd9fa88d
void*[] typemap compiles
2013-12-22 18:09:24 +01:00
Meredith L. Patterson
05cdf766ab
uint8_t typemap is happy now
2013-12-22 18:09:24 +01:00
Meredith L. Patterson
ddbde60396
TT_BYTES is converting properly; TT_UINT is not.
2013-12-22 18:09:24 +01:00
Meredith L. Patterson
49ca034b32
typemap for HParseResult is returning the appropriate zval, but why does PHP think it's null?
2013-12-22 18:09:24 +01:00
Meredith L. Patterson
0c0805591c
minimal working PHP tests, for h_token.
2013-12-22 17:58:52 +01:00
Meredith L. Patterson
8be21c3d28
uint8_t* input typemap works for h_token and h_parse
2013-12-22 17:58:52 +01:00
Meredith L. Patterson
213f338357
argument typemap for token works! next, make it work for parse as well.
2013-12-22 17:58:52 +01:00
Meredith L. Patterson
0733700343
gonna test these typemaps with the tests I'm gonna write next.
2013-12-22 17:57:44 +01:00
Meredith L. Patterson
689ee84415
stubbed PHP typemaps
2013-12-22 17:57:44 +01:00
Meredith L. Patterson
94d855c516
scons builds the SWIG PHP bindings that can create parsers but not parse any input yet
2013-12-22 17:54:53 +01:00
Dan Hirsch
1d11527924
Got perl bindings started
2013-12-03 21:29:02 +01:00
Meredith L. Patterson
2ee82f3ac7
Merge branch 'python-bindings' of https://github.com/thequux/hammer into python-bindings
...
Conflicts:
src/bindings/python/SConscript
src/bindings/python/hammer_tests.py
src/bindings/swig/hammer.i
src/hammer.h
2013-11-26 11:25:22 -08:00
Dan Hirsch
cdc7ea8381
Finished Python bindings
2013-11-25 02:49:02 -06:00
Dan Hirsch
43357bbcda
AttrBool working
2013-11-24 18:43:14 -06:00
Dan Hirsch
294bca3fce
Cleaned up python bindings interface a bit; now returns strings rather than character codes if appropriate
2013-11-23 19:53:58 -06:00
Dan Hirsch
26c358accf
Got rid of accessors in Python; made h_action work
2013-11-23 16:40:57 -06:00
Dan Hirsch
954b6e32d3
Changed typemap for strings to also parse lengths
2013-11-23 13:36:54 -06:00
Meredith L. Patterson
96760f1daf
kindasorta working. all tests (except h_action and h_attr_bool, need typemaps) have passed at one time or another, but some segfault at not-quite-random; h_and, h_epsilon_p, h_end_p, h_ignore, h_not, maybe h_choice seem culprity.
2013-11-23 13:33:24 -06:00
Meredith L. Patterson
3228a86b90
h_sequence, h_choice and HCountedSequence are all having weird issues, but tests are in a workable format now
2013-11-23 13:33:24 -06:00
Meredith L. Patterson
f685f9ea4e
there's the uint8_t problem (mostly) sorted
2013-11-23 13:33:24 -06:00
Meredith L. Patterson
073d6d8a27
python tests baked into scons; h_ch needs the first char of its input string as its input
2013-11-23 13:33:24 -06:00
Meredith L. Patterson
eba8ecc6c3
typemap to fix conversion from python strings to uint8_t*
2013-11-23 13:33:24 -06:00
Meredith L. Patterson
ada7bf89ee
There's a typemap problem between const uint8_t* and target-language strings, but I can create parsers in python and php.
2013-11-23 13:33:23 -06:00
Meredith L. Patterson
73eabc7bf9
SWIG bindings build, compile, and appear to work for python. Will port over tests next.
2013-11-23 13:33:23 -06:00
Meredith L. Patterson
0e4253d0ef
invoke swig with relative path instead, -I../../
2013-11-23 13:33:23 -06:00
Meredith L. Patterson
8f427b5a6d
fixed nested unions
2013-11-23 13:33:23 -06:00
Meredith L. Patterson
49f22e2aff
Import combinator and allocator APIs into SWIG. Next is glue. Need to fix unions in HParsedToken and HCaseResult.
2013-11-23 13:33:23 -06:00
Meredith L. Patterson
2e0c56f403
kindasorta working. all tests (except h_action and h_attr_bool, need typemaps) have passed at one time or another, but some segfault at not-quite-random; h_and, h_epsilon_p, h_end_p, h_ignore, h_not, maybe h_choice seem culprity.
2013-11-19 19:15:14 -06:00
Meredith L. Patterson
5ced9fe9d5
h_sequence, h_choice and HCountedSequence are all having weird issues, but tests are in a workable format now
2013-11-19 19:15:13 -06:00
Meredith L. Patterson
2d459282d4
there's the uint8_t problem (mostly) sorted
2013-11-19 19:15:13 -06:00
Meredith L. Patterson
b979f66c21
python tests baked into scons; h_ch needs the first char of its input string as its input
2013-11-19 19:15:13 -06:00
Meredith L. Patterson
6746df20db
typemap to fix conversion from python strings to uint8_t*
2013-11-19 19:15:13 -06:00
Meredith L. Patterson
551645e980
There's a typemap problem between const uint8_t* and target-language strings, but I can create parsers in python and php.
2013-11-19 19:15:13 -06:00
Meredith L. Patterson
902ca46b4d
SWIG bindings build, compile, and appear to work for python. Will port over tests next.
2013-11-19 19:15:13 -06:00
Meredith L. Patterson
21f16ebefd
invoke swig with relative path instead, -I../../
2013-11-19 19:15:13 -06:00
Meredith L. Patterson
eb04069817
fixed nested unions
2013-11-19 19:15:13 -06:00
Meredith L. Patterson
34062d50a2
Import combinator and allocator APIs into SWIG. Next is glue. Need to fix unions in HParsedToken and HCaseResult.
2013-11-19 19:15:13 -06:00