Skip to content

Commit 01644e0

Browse files
committed
Update prototypes with mock values
1 parent 1a71cfc commit 01644e0

File tree

6 files changed

+22
-10
lines changed

6 files changed

+22
-10
lines changed

regex-capi/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,5 @@ There are a few things missing from the C API that are present in the Rust API.
9999
There's no particular (known) reason why they don't, they just haven't been
100100
implemented yet.
101101

102-
* RegexSet, which permits matching multiple regular expressions simultaneously
103-
in a single linear time search.
104102
* Splitting a string by a regex.
105103
* Replacing regex matches in a string with some other text.

regex-capi/ctest/test.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,10 @@ bool test_regex_set_matches() {
346346
rure_error *err = rure_error_new();
347347
rure_set *re = rure_compile_set((const uint8_t **) patterns,
348348
patterns_lengths,
349-
PAT_COUNT, err);
349+
PAT_COUNT,
350+
0,
351+
NULL,
352+
err);
350353
if (re == NULL) {
351354
passed = false;
352355
goto done2;
@@ -357,18 +360,18 @@ bool test_regex_set_matches() {
357360
goto done1;
358361
}
359362

360-
if (!rure_set_is_match(re, (const uint8_t *) "foobar", 6)) {
363+
if (!rure_set_is_match(re, (const uint8_t *) "foobar", 6, 0)) {
361364
passed = false;
362365
goto done1;
363366
}
364367

365-
if (rure_set_is_match(re, (const uint8_t *) "", 0)) {
368+
if (rure_set_is_match(re, (const uint8_t *) "", 0, 0)) {
366369
passed = false;
367370
goto done1;
368371
}
369372

370373
bool matches[PAT_COUNT];
371-
if (!rure_set_matches(re, (const uint8_t *) "foobar", 6, matches)) {
374+
if (!rure_set_matches(re, (const uint8_t *) "foobar", 6, 0, matches)) {
372375
passed = false;
373376
goto done1;
374377
}

regex-capi/include/rure.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,10 @@ void rure_options_dfa_size_limit(rure_options *options, size_t limit);
468468
*/
469469
rure_set *rure_compile_set(const uint8_t **patterns,
470470
const size_t *patterns_lengths,
471-
size_t patterns_count, rure_error *error);
471+
size_t patterns_count,
472+
uint32_t flags,
473+
rure_options *options,
474+
rure_error *error);
472475

473476
/*
474477
* rure_set_free frees the given compiled regular expression set.
@@ -486,7 +489,8 @@ void rure_set_free(rure_set *re);
486489
* useful. UTF-8 is even more useful. Other text encodings aren't supported.
487490
* length should be the number of bytes in haystack.
488491
*/
489-
bool rure_set_is_match(rure_set *re, const uint8_t *haystack, size_t length);
492+
bool rure_set_is_match(rure_set *re, const uint8_t *haystack, size_t length,
493+
size_t start);
490494

491495
/*
492496
* rure_set_matches compares each regex in the set against the haystack and
@@ -507,7 +511,7 @@ bool rure_set_is_match(rure_set *re, const uint8_t *haystack, size_t length);
507511
* caring which, use rure_set_is_match.
508512
*/
509513
bool rure_set_matches(rure_set *re, const uint8_t *haystack, size_t length,
510-
bool *matches);
514+
size_t start, bool *matches);
511515

512516
/*
513517
* rure_set_len returns the number of patterns rure_set was compiled with.

regex-capi/src/rure.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use ::error::{Error, ErrorKind};
22

33
use ::regex::bytes;
4+
use ::regex::internal::{Exec, ExecBuilder, RegexOptions};
45
use ::libc::{c_char, size_t};
56

67
use ::std::collections::HashMap;
@@ -469,6 +470,8 @@ ffi_fn! {
469470
patterns: *const *const u8,
470471
patterns_lengths: *const size_t,
471472
patterns_count: size_t,
473+
flags: u32,
474+
options: *const Options,
472475
error: *mut Error
473476
) -> *const RegexSet {
474477
let (raw_pats, raw_patsl) = unsafe {
@@ -525,7 +528,8 @@ ffi_fn! {
525528
fn rure_set_is_match(
526529
re: *const RegexSet,
527530
haystack: *const u8,
528-
len: size_t
531+
len: size_t,
532+
start: size_t
529533
) -> bool {
530534
let re = unsafe { &*re };
531535
let haystack = unsafe { slice::from_raw_parts(haystack, len) };
@@ -538,6 +542,7 @@ ffi_fn! {
538542
re: *const RegexSet,
539543
haystack: *const u8,
540544
len: size_t,
545+
start: size_t,
541546
matches: *mut bool
542547
) -> bool {
543548
let re = unsafe { &*re };

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,4 +603,5 @@ pub mod internal {
603603
pub use prog::{Program, Inst, EmptyLook, InstRanges};
604604
pub use re_plugin::Plugin;
605605
pub use re_unicode::_Regex;
606+
pub use re_builder::RegexOptions;
606607
}

src/re_builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10+
#![allow(missing_docs)]
1011

1112
/// The set of user configurable options for compiling zero or more regexes.
1213
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)