[DO-973] harfbuzz package (!10)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/10
This commit is contained in:
34
recipes/pcre2/all/test_package/test_package.c
Normal file
34
recipes/pcre2/all/test_package/test_package.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#include <pcre2.h>
|
||||
|
||||
|
||||
int main() {
|
||||
pcre2_code *re;
|
||||
int rc;
|
||||
PCRE2_SIZE erroffset;
|
||||
int errcode;
|
||||
PCRE2_SIZE* ovector;
|
||||
const char *pattern = "\\w+";
|
||||
size_t pattern_size = strlen(pattern);
|
||||
const char *subject = "conan";
|
||||
size_t subject_size = strlen(subject);
|
||||
uint32_t options = 0;
|
||||
pcre2_match_data *match_data;
|
||||
uint32_t ovecsize = 128;
|
||||
|
||||
re = pcre2_compile(pattern, pattern_size, options, &errcode, &erroffset, NULL);
|
||||
match_data = pcre2_match_data_create(ovecsize, NULL);
|
||||
rc = pcre2_match(re, subject, subject_size, 0, options, match_data, NULL);
|
||||
ovector = pcre2_get_ovector_pointer(match_data);
|
||||
PCRE2_SPTR start = subject + ovector[0];
|
||||
PCRE2_SIZE slen = ovector[1] - ovector[0];
|
||||
printf("match: %.*s\n", (int)slen, (char *)start );
|
||||
pcre2_match_data_free(match_data);
|
||||
pcre2_code_free(re);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user