23 Commits

Author SHA1 Message Date
Andrew Gallant
f094d15678 Update github links. 2016-12-31 16:49:30 -05:00
Andrew Gallant
0c59d416cd Add RegexSetBuilder.
This API mirrors RegexBuilder, but for multiple patterns.

Also, modify regex-capi to use RegexSetBuilder internally.
2016-12-31 15:09:17 -05:00
Andrew Gallant
403b27aa99 Switch to more idiomatic builder definition.
Specifically, use mutable references instead of passing ownership.
2016-12-30 01:06:16 -05:00
Andrew Gallant
fab4069788 Remove the submatch iterators.
All use cases can be replaced with Regex::capture_names.
2016-12-30 01:05:50 -05:00
Andrew Gallant
a6722a32ec Reorganize capture slot handling, but don't make any public API changes. 2016-12-30 01:05:50 -05:00
Steve Klabnik
66a44ab6c1 dylib -> cdylib
The newer cdylib crate type is specifically for the "expose to other languages" case.
2016-12-02 11:28:57 -05:00
tiehuis
f54bd2428a Update rure_set documentation for new fields 2016-10-24 15:04:01 +13:00
tiehuis
d464edf3d6 Add two more tests for options and match start sanity 2016-10-24 15:01:57 +13:00
tiehuis
8beff765a5 Adjust rure to use internal regex methods where needed 2016-10-24 14:46:19 +13:00
tiehuis
01644e0f25 Update prototypes with mock values 2016-10-24 14:04:44 +13:00
tiehuis
1a71cfc03e Update documentation + add rure_set_len function 2016-10-20 20:06:04 +13:00
tiehuis
143ff2f531 Add RegexSet functionality to C API
These functions implement a C interface to the RegexSet api.

Some notes:
 * These do not include start offsets as the standard regex functions
   do. The reason being is down to how these are implemented in the core
   regex crate. The RegexSet api does not expose a public is_match_at
   whilst the Regex api does.

 * This only tests a complete compile/match mainly for sanity. One or
   two more tests targetting the specific areas would be preferred.

 * Set matches take a mutuable array to fill with results. This is more
   C-like and allows the caller to manage the memory on the stack if
   they want.
2016-10-19 18:32:12 +13:00
David Blewett
7f3d36402f Expose the CaptureNames iterator to the C API:
* Add new `rure_iter_capture_names` struct
  - Opaque pointer encapsulates access to:
  - Underyling Rust iterator
  - Each capture group name CString
* Add functions for instantiating the iterator and processing:
  - `rure_iter_capture_names_new`
  - `rure_iter_capture_names_next`
  - `rure_iter_capture_names_free`
* Track CString objects handed out, and free them when called.
* Add unit test for new functions
2016-09-25 23:25:29 -04:00
Brose Johnstone
d91728d2c2 add module files 2016-06-16 13:38:47 -07:00
Brose Johnstone
43c72ab73e split C api into modules 2016-06-16 13:36:58 -07:00
Andrew Gallant
998e945467 Fix nits from so_you_like_donuts on reddit. 2016-05-04 07:17:11 -04:00
Andrew Gallant
9a966ee108 better title 2016-05-02 14:10:44 -04:00
Andrew Gallant
29529523d2 Merge pull request #220 from baby-bell/master
fix mismatched/redundant integer types in c interface
2016-04-30 22:49:25 -04:00
baby-bell
41bf1085d9 remove redundant casts to/from size_t for c interface 2016-04-30 19:15:37 -07:00
Brose Johnstone
7ff53feef9 fix mismatched/redundant integer types 2016-04-29 23:29:32 -07:00
Andrew Gallant
fc90897c86 update doc link 2016-04-29 17:01:51 -04:00
Andrew Gallant
d8773c6aef regex-capi 0.1.0 2016-04-29 16:59:44 -04:00
Andrew Gallant
97d374b680 Add rure, a C API.
This commit contains a new sub-crate called `regex-capi` which provides
a C library called `rure`.

A new `RegexBuilder` type was also added to the Rust API proper, which
permits both users of C and Rust to tweak various knobs on a `Regex`.
This fixes issue #166.

Since it's likely that this API will be used to provide bindings to
other languages, I've created bindings to Go as a proof of concept:
https://github.com/BurntSushi/rure-go --- to my knowledge, the wrapper
has as little overhead as it can. It was in particular important for the
C library to not store any pointers provided by the caller, as this can
be problematic in languages with managed runtimes and a moving GC.

The C API doesn't expose `RegexSet` and a few other convenience functions
such as splitting or replacing. That can be future work.

Note that the regex-capi crate requires Rust 1.9, since it uses
`panic::catch_unwind`.

This also includes tests of basic API functionality and a commented
example. Both should now run as part of CI.
2016-04-29 10:42:11 -04:00