Debian Codegraph @

debian/rust-vendor/onig_sys/oniguruma/doc/API

raw
1 Oniguruma API Version 6.9.10 2024/06/26
2
3 #include <oniguruma.h>
4
5
6 # int onig_initialize(OnigEncoding use_encodings[], int num_encodings)
7
8 Initialize library.
9
10 You have to call it explicitly.
11
12 * onig_init() is deprecated.
13
14 arguments
15 1 use_encodings: array of encodings used in application.
16 2 num_encodings: number of encodings.
17
18 return value
19 normal: ONIG_NORMAL == 0
20 error: error code < 0
21
22
23 # int onig_error_code_to_str(UChar* err_buf, int err_code, ...)
24
25 Get error message string.
26 If this function is used for onig_new(),
27 don't call this after the pattern argument of onig_new() is freed.
28
29 return value
30 normal: error message string length
31
32 arguments
33 1 err_buf: error message string buffer.
34 (required size: ONIG_MAX_ERROR_MESSAGE_LEN)
35 2 err_code: error code returned by other API functions.
36 3 err_info (optional): error info returned by onig_new().
37
38
39 # void onig_set_warn_func(OnigWarnFunc func)
40
41 Set warning function.
42
43 WARNING:
44 '[', '-', ']' in character class without escape.
45 ']' in pattern without escape.
46
47 arguments
48 1 func: function pointer. void (*func)(char* warning_message)
49
50
51 # void onig_set_verb_warn_func(OnigWarnFunc func)
52
53 Set verbose warning function.
54
55 WARNING:
56 redundant nested repeat operator.
57
58 arguments
59 1 func: function pointer. void (*func)(char* warning_message)
60
61
62 # int onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
63 OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax,
64 OnigErrorInfo* err_info)
65
66 Create a regex object.
67
68 return value
69 normal: ONIG_NORMAL == 0
70 error: error code < 0
71
72 arguments
73 1 reg: return regex object's address.
74 2 pattern: regex pattern string.
75 3 pattern_end: terminate address of pattern. (pattern + pattern length)
76 4 option: compile time options.
77
78 ONIG_OPTION_NONE no option
79 ONIG_OPTION_SINGLELINE '^' -> '\A', '$' -> '\Z'
80 ONIG_OPTION_MULTILINE '.' match with newline
81 ONIG_OPTION_IGNORECASE ambiguity match on
82 ONIG_OPTION_EXTEND extended pattern form
83 ONIG_OPTION_FIND_LONGEST find longest match
84 ONIG_OPTION_FIND_NOT_EMPTY ignore empty match
85 ONIG_OPTION_NEGATE_SINGLELINE clear ONIG_OPTION_SINGLELINE which is enabled on ONIG_SYNTAX_POSIX_BASIC/POSIX_EXTENDED/PERL/PERL_NG/PYTHON/JAVA
86
87 ONIG_OPTION_DONT_CAPTURE_GROUP only named group captured.
88 ONIG_OPTION_CAPTURE_GROUP named and no-named group captured.
89
90 ONIG_OPTION_IGNORECASE_IS_ASCII Limit IGNORECASE((?i)) to a range of ASCII characters
91 ONIG_OPTION_WORD_IS_ASCII ASCII only word (\w, \p{Word}, [[:word:]])
92 ASCII only word bound (\b)
93 ONIG_OPTION_DIGIT_IS_ASCII ASCII only digit (\d, \p{Digit}, [[:digit:]])
94 ONIG_OPTION_SPACE_IS_ASCII ASCII only space (\s, \p{Space}, [[:space:]])
95 ONIG_OPTION_POSIX_IS_ASCII ASCII only POSIX properties
96 (includes word, digit, space)
97 (alnum, alpha, blank, cntrl, digit, graph,
98 lower, print, punct, space, upper, xdigit,
99 word)
100 ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER Extended Grapheme Cluster mode
101 ONIG_OPTION_TEXT_SEGMENT_WORD Word mode
102
103
104 * The ONIG_OPTION_FIND_LONGEST option doesn't work properly during backward search of onig_search().
105
106
107 5 enc: character encoding.
108
109 ONIG_ENCODING_ASCII ASCII
110 ONIG_ENCODING_ISO_8859_1 ISO 8859-1
111 ONIG_ENCODING_ISO_8859_2 ISO 8859-2
112 ONIG_ENCODING_ISO_8859_3 ISO 8859-3
113 ONIG_ENCODING_ISO_8859_4 ISO 8859-4
114 ONIG_ENCODING_ISO_8859_5 ISO 8859-5
115 ONIG_ENCODING_ISO_8859_6 ISO 8859-6
116 ONIG_ENCODING_ISO_8859_7 ISO 8859-7
117 ONIG_ENCODING_ISO_8859_8 ISO 8859-8
118 ONIG_ENCODING_ISO_8859_9 ISO 8859-9
119 ONIG_ENCODING_ISO_8859_10 ISO 8859-10
120 ONIG_ENCODING_ISO_8859_11 ISO 8859-11
121 ONIG_ENCODING_ISO_8859_13 ISO 8859-13
122 ONIG_ENCODING_ISO_8859_14 ISO 8859-14
123 ONIG_ENCODING_ISO_8859_15 ISO 8859-15
124 ONIG_ENCODING_ISO_8859_16 ISO 8859-16
125 ONIG_ENCODING_UTF8 UTF-8
126 ONIG_ENCODING_UTF16_BE UTF-16BE
127 ONIG_ENCODING_UTF16_LE UTF-16LE
128 ONIG_ENCODING_UTF32_BE UTF-32BE
129 ONIG_ENCODING_UTF32_LE UTF-32LE
130 ONIG_ENCODING_EUC_JP EUC-JP
131 ONIG_ENCODING_EUC_TW EUC-TW
132 ONIG_ENCODING_EUC_KR EUC-KR
133 ONIG_ENCODING_EUC_CN EUC-CN
134 ONIG_ENCODING_SJIS Shift_JIS
135 ONIG_ENCODING_KOI8_R KOI8-R
136 ONIG_ENCODING_CP1251 CP1251
137 ONIG_ENCODING_BIG5 Big5
138 ONIG_ENCODING_GB18030 GB18030
139
140 or any OnigEncodingType data address defined by user.
141
142 6 syntax: address of pattern syntax definition.
143
144 ONIG_SYNTAX_ASIS plain text
145 ONIG_SYNTAX_POSIX_BASIC POSIX Basic RE
146 ONIG_SYNTAX_POSIX_EXTENDED POSIX Extended RE
147 ONIG_SYNTAX_EMACS Emacs
148 ONIG_SYNTAX_GREP grep
149 ONIG_SYNTAX_GNU_REGEX GNU regex
150 ONIG_SYNTAX_JAVA Java (Sun java.util.regex)
151 ONIG_SYNTAX_PERL Perl
152 ONIG_SYNTAX_PERL_NG Perl + named group
153 ONIG_SYNTAX_PYTHON Python
154 ONIG_SYNTAX_ONIGURUMA Oniguruma
155 ONIG_SYNTAX_DEFAULT default (== ONIG_SYNTAX_ONIGURUMA)
156 onig_set_default_syntax()
157
158 or any OnigSyntaxType data address defined by user.
159
160 7 err_info: address for return optional error info.
161 Use this value as 3rd argument of onig_error_code_to_str().
162
163
164
165 # int onig_new_without_alloc(regex_t* reg, const UChar* pattern,
166 const UChar* pattern_end,
167 OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax,
168 OnigErrorInfo* err_info)
169
170 Create a regex object.
171 reg object area is not allocated in this function.
172
173 return value
174 normal: ONIG_NORMAL == 0
175 error: error code < 0
176
177
178 # int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
179 OnigCompileInfo* ci, OnigErrorInfo* einfo)
180
181 This function is deprecated, and it does not allow the case where
182 the encoding of pattern and target is different.
183
184 Create a regex object.
185 This function is deluxe version of onig_new().
186
187 return value
188 normal: ONIG_NORMAL == 0
189 error: error code < 0
190
191 arguments
192 1 reg: return address of regex object.
193 2 pattern: regex pattern string.
194 3 pattern_end: terminate address of pattern. (pattern + pattern length)
195 4 ci: compile time info.
196
197 ci->num_of_elements: number of elements in ci. (current version: 5)
198 ci->pattern_enc: pattern string character encoding.
199 ci->target_enc: target string character encoding.
200 ci->syntax: address of pattern syntax definition.
201 ci->option: compile time option.
202 ci->case_fold_flag: character matching case fold bit flag for
203 ONIG_OPTION_IGNORECASE mode.
204
205 ONIGENC_CASE_FOLD_MIN: minimum
206 ONIGENC_CASE_FOLD_DEFAULT: minimum
207 onig_set_default_case_fold_flag()
208
209 5 err_info: address for return optional error info.
210 Use this value as 3rd argument of onig_error_code_to_str().
211
212
213 Different character encoding combination is allowed for
214 the following cases only.
215
216 pattern_enc: ASCII, ISO_8859_1
217 target_enc: UTF16_BE, UTF16_LE, UTF32_BE, UTF32_LE
218
219 pattern_enc: UTF16_BE/LE
220 target_enc: UTF16_LE/BE
221
222 pattern_enc: UTF32_BE/LE
223 target_enc: UTF32_LE/BE
224
225
226 # void onig_free(regex_t* reg)
227
228 Free memory used by regex object.
229
230 arguments
231 1 reg: regex object.
232
233
234 # void onig_free_body(regex_t* reg)
235
236 Free memory used by regex object. (Except reg oneself.)
237
238 arguments
239 1 reg: regex object.
240
241
242 # OnigMatchParam* onig_new_match_param()
243
244 Allocate a OnigMatchParam object and initialize the contents by
245 onig_initialize_match_param().
246
247
248 # void onig_free_match_param(OnigMatchParam* mp)
249
250 Free memory used by a OnigMatchParam object.
251
252 arguments
253 1 mp: OnigMatchParam object
254
255
256 # void onig_initialize_match_param(OnigMatchParam* mp)
257
258 Set match-param fields to default values.
259 Match-param is used in onig_match_with_param() and onig_search_with_param().
260
261 arguments
262 1 mp: match-param pointer
263
264
265 # int onig_set_match_stack_limit_size_of_match_param(OnigMatchParam* mp, unsigned int limit)
266
267 Set a maximum number of match-stack depth.
268 0 means unlimited.
269
270 arguments
271 1 mp: match-param pointer
272 2 limit: number of limit
273
274 normal return: ONIG_NORMAL
275
276
277 # int onig_set_retry_limit_in_match_of_match_param(OnigMatchParam* mp, unsigned long limit)
278
279 Set a retry limit count of a match process.
280 0 means unlimited.
281
282 arguments
283 1 mp: match-param pointer
284 2 limit: number of limit
285
286 normal return: ONIG_NORMAL
287
288
289 # int onig_set_retry_limit_in_search_of_match_param(OnigMatchParam* mp, unsigned long limit)
290
291 Set a retry limit count of a search process.
292 0 means unlimited.
293
294 arguments
295 1 mp: match-param pointer
296 2 limit: number of limit
297
298 normal return: ONIG_NORMAL
299
300
301 # int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f)
302
303 Set a function for callouts of contents in progress.
304 If 0 (NULL) is set, never called in progress.
305
306 arguments
307 1 mp: match-param pointer
308 2 f: function
309
310 normal return: ONIG_NORMAL
311
312
313 # int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f)
314
315 Set a function for callouts of contents in retraction (backtrack).
316 If 0 (NULL) is set, never called in retraction.
317
318 arguments
319 1 mp: match-param pointer
320 2 f: function
321
322 normal return: ONIG_NORMAL
323
324
325
326 # int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start,
327 const UChar* range, OnigRegion* region, OnigOptionType option)
328
329 Search string and return search result and matching region.
330 Do not pass invalid byte string in the regex character encoding.
331
332 return value
333 normal: match position offset (i.e. p - str >= 0)
334 not found: ONIG_MISMATCH (< 0)
335 error: error code (< 0)
336
337 * If option ONIG_OPTION_CALLBACK_EACH_MATCH is used,
338 it will return ONIG_MISMATCH even if there is a match.
339
340 arguments
341 1 reg: regex object
342 2 str: target string
343 3 end: terminate address of target string
344 4 start: search start address of target string
345 5 range: search terminate address of target string
346 in forward search (start <= searched string < range)
347 in backward search (range <= searched string <= start)
348 6 region: address for return group match range info (NULL is allowed)
349 7 option: search time option
350
351 ONIG_OPTION_NOTBOL Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string
352 ONIG_OPTION_NOTEOL Do not regard the (end) as the end of a line and the end of a string
353 ONIG_OPTION_NOT_BEGIN_STRING Do not regard the beginning of the (str) as the beginning of a string (* fail \A)
354 ONIG_OPTION_NOT_END_STRING Do not regard the (end) as a string endpoint (* fail \z, \Z)
355 ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search (* fail \G)
356
357 ONIG_OPTION_CALLBACK_EACH_MATCH
358 Call back for all successful matches.
359 (including the case of the same matching start position)
360 The search does not stop when a match is found at a certain position.
361 The callback function to be called is set by
362 onig_set_callback_each_match().
363 The user_data in the argument passed to the callback function is
364 specified by onig_set_callout_user_data_of_match_param(mp, user_data).
365 Therefore, if you want to specify user_data,
366 use onig_search_with_param() instead of onig_search().
367 The user_data specified by onig_set_callout_user_data_of_match_param()
368 will be shared with callout.
369
370 ONIG_OPTION_MATCH_WHOLE_STRING Try to match the whole of (str), rather than returning after the first match is found.
371
372
373 # int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end,
374 const UChar* start, const UChar* range, OnigRegion* region,
375 OnigOptionType option, OnigMatchParam* mp)
376
377 Search string and return search result and matching region.
378 Do not pass invalid byte string in the regex character encoding.
379
380 arguments
381 1-7: same as onig_search()
382 8 mp: match parameter values (match_stack_limit, retry_limit_in_match, retry_limit_in_search)
383
384
385 # int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at,
386 OnigRegion* region, OnigOptionType option)
387
388 Match string and return result and matching region.
389 Do not pass invalid byte string in the regex character encoding.
390
391 return value
392 normal: match length (>= 0)
393 not match: ONIG_MISMATCH (< 0)
394 error: error code (< 0)
395
396 * If option ONIG_OPTION_CALLBACK_EACH_MATCH is used,
397 it will return ONIG_MISMATCH even if there is a match.
398
399 arguments
400 1 reg: regex object
401 2 str: target string
402 3 end: terminate address of target string
403 4 at: match address of target string
404 5 region: address for return group match range info (NULL is allowed)
405 6 option: search time option
406
407 ONIG_OPTION_NOTBOL Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string
408 ONIG_OPTION_NOTEOL Do not regard the (end) as the end of a line and the end of a string
409 ONIG_OPTION_NOT_BEGIN_STRING Do not regard the beginning of the (str) as the beginning of a string (* fail \A)
410 ONIG_OPTION_NOT_END_STRING Do not regard the (end) as a string endpoint (* fail \z, \Z)
411 ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search (* fail \G)
412 ONIG_OPTION_CALLBACK_EACH_MATCH Call back for all successful matches.
413 ONIG_OPTION_MATCH_WHOLE_STRING Try to match the whole of (str), rather than returning after the first match is found.
414
415 # int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end,
416 const UChar* at, OnigRegion* region,
417 OnigOptionType option, OnigMatchParam* mp)
418
419 Match string and return result and matching region.
420 Do not pass invalid byte string in the regex character encoding.
421
422 arguments
423 1-6: same as onig_match()
424 7 mp: match parameter values (match_stack_limit, retry_limit_in_match, retry_limit_in_search)
425
426
427 # int onig_scan(regex_t* reg, const UChar* str, const UChar* end,
428 OnigRegion* region, OnigOptionType option,
429 int (*scan_callback)(int, int, OnigRegion*, void*),
430 void* callback_arg)
431
432 Scan string and callback with matching region.
433 Do not pass invalid byte string in the regex character encoding.
434
435 return value
436 normal: number of matching times
437 error: error code
438 interruption: return value of callback function (!= 0)
439
440 arguments
441 1 reg: regex object
442 2 str: target string
443 3 end: terminate address of target string
444 4 region: address for return group match range info (NULL is allowed)
445 5 option: search time option
446 6 scan_callback: callback function (defined by user)
447 7 callback_arg: optional argument passed to callback
448
449
450 # int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[])
451
452 Create a regset object.
453 All regex objects must have the same character encoding.
454 All regex objects are prohibited from having the ONIG_OPTION_FIND_LONGEST option.
455
456 arguments
457 1 rset: return address of regset object
458 2 n: number of regex in regs
459 3 regs: array of regex
460
461 return value
462 normal: ONIG_NORMAL == 0
463 error: error code < 0
464
465
466 # int onig_regset_add(OnigRegSet* set, regex_t* reg)
467
468 Add a regex into regset.
469 The regex object must have the same character encoding with the regset.
470 The regex object is prohibited from having the ONIG_OPTION_FIND_LONGEST option.
471
472 arguments
473 1 set: regset object
474 2 reg: regex object
475
476 return value
477 normal: ONIG_NORMAL == 0
478 error: error code < 0
479
480
481 # int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg)
482
483 Replace a regex in regset with another one.
484 If the reg argument value is NULL, then remove at-th regex. (and indexes of other regexes are changed)
485
486 arguments
487 1 set: regset object
488 2 at: index of regex (zero origin)
489 3 reg: regex object
490
491 return value
492 normal: ONIG_NORMAL == 0
493 error: error code < 0
494
495
496 # void onig_regset_free(OnigRegSet* set)
497
498 Free memory used by regset object and regex objects in the regset.
499 If the same regex object is registered twice, the situation becomes destructive.
500
501 arguments
502 1 set: regset object
503
504
505 # int onig_regset_number_of_regex(OnigRegSet* set)
506
507 Returns number of regex objects in the regset.
508
509 arguments
510 1 set: regset object
511
512
513 # regex_t* onig_regset_get_regex(OnigRegSet* set, int at)
514
515 Returns the regex object corresponding to the at-th regex.
516
517 arguments
518 1 set: regset object
519 2 at: index of regex array (zero origin)
520
521
522 # OnigRegion* onig_regset_get_region(OnigRegSet* set, int at)
523
524 Returns the region object corresponding to the at-th regex.
525
526 arguments
527 1 set: regset object
528 2 at: index of regex array (zero origin)
529
530
531 # int onig_regset_search(OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, int* rmatch_pos)
532
533 Perform a search with regset.
534
535 return value:
536 normal: index of match regex (zero origin)
537 not found: ONIG_MISMATCH (< 0)
538 error: error code (< 0)
539
540 arguments
541 1 set: regset object
542 2 str: target string
543 3 end: terminate address of target string
544 4 start: search start address of target string
545 5 range: search terminate address of target string
546 6 lead: outer loop element
547 ONIG_REGSET_POSITION_LEAD (returns most left position)
548 ONIG_REGSET_REGEX_LEAD (returns most left position)
549 ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
550 7 option: search time option
551 ONIG_OPTION_NOTBOL Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string
552 ONIG_OPTION_NOTEOL Do not regard the (end) as the end of a line and the end of a string
553 ONIG_OPTION_NOT_BEGIN_STRING Do not regard the beginning of the (str) as the beginning of a string (* fail \A)
554 ONIG_OPTION_NOT_END_STRING Do not regard the (end) as a string endpoint (* fail \z, \Z)
555 ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search (* fail \G)
556
557 8 rmatch_pos: return address of match position (match_address - str)
558
559 * ONIG_REGSET_POSITION_LEAD and ONIG_REGSET_REGEX_LEAD return the same result.
560 These differences only appear in search time.
561 In most cases, ONIG_REGSET_POSITION_LEAD seems to be faster.
562
563
564 # int onig_regset_search_with_param(OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, OnigMatchParam* mps[], int* rmatch_pos)
565
566 Perform a search with regset and match-params.
567
568 return value:
569 normal: index of match regex (zero origin)
570 not found: ONIG_MISMATCH (< 0)
571 error: error code (< 0)
572
573 arguments
574 1 set: regset object
575 2 str: target string
576 3 end: terminate address of target string
577 4 start: search start address of target string
578 5 range: search terminate address of target string
579 6 lead: outer loop element
580 ONIG_REGSET_POSITION_LEAD (returns most left position)
581 ONIG_REGSET_REGEX_LEAD (returns most left position)
582 ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
583 7 option: search time option
584 ONIG_OPTION_NOTBOL Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string
585 ONIG_OPTION_NOTEOL Do not regard the (end) as the end of a line and the end of a string
586 ONIG_OPTION_NOT_BEGIN_STRING Do not regard the beginning of the (str) as the beginning of a string (* fail \A)
587 ONIG_OPTION_NOT_END_STRING Do not regard the (end) as a string endpoint (* fail \z, \Z)
588 ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search (* fail \G)
589
590 8 mps: array of match-params
591 9 rmatch_pos: return address of match position (match_address - str)
592
593
594 # OnigRegion* onig_region_new(void)
595
596 Create a region.
597
598
599 # void onig_region_free(OnigRegion* region, int free_self)
600
601 Free memory used by region.
602
603 arguments
604 1 region: target region
605 2 free_self: [1: free all, 0: free memory used in region but not self]
606
607
608 # void onig_region_copy(OnigRegion* to, OnigRegion* from)
609
610 Copy contents of region.
611
612 arguments
613 1 to: target region
614 2 from: source region
615
616
617 # void onig_region_clear(OnigRegion* region)
618
619 Clear contents of region.
620
621 arguments
622 1 region: target region
623
624
625 # int onig_region_resize(OnigRegion* region, int n)
626
627 Resize group range area of region.
628
629 return value
630 normal: ONIG_NORMAL == 0
631 error: error code < 0
632
633 arguments
634 1 region: target region
635 2 n: new size
636
637
638 # int onig_name_to_group_numbers(regex_t* reg, const UChar* name, const UChar* name_end,
639 int** num_list)
640
641 Return the group number list of the name.
642 Named subexp is defined by (?<name>....).
643
644 return value
645 normal: number of groups for the name.
646 (ex. /(?<x>..)(?<x>..)/ ==> 2)
647 name not found: ONIGERR_UNDEFINED_NAME_REFERENCE
648
649 arguments
650 1 reg: regex object.
651 2 name: group name.
652 3 name_end: terminate address of group name.
653 4 num_list: return list of group number.
654
655
656 # int onig_name_to_backref_number(regex_t* reg, const UChar* name, const UChar* name_end,
657 OnigRegion *region)
658
659 Return the group number corresponding to the named backref (\k<name>).
660 If two or more regions for the groups of the name are effective,
661 the greatest number in it is obtained.
662
663 return value
664 normal: group number
665 error: error code < 0
666
667 arguments
668 1 reg: regex object.
669 2 name: group name.
670 3 name_end: terminate address of group name.
671 4 region: search/match result region.
672
673
674 # int onig_foreach_name(regex_t* reg,
675 int (*func)(const UChar*, const UChar*, int,int*,regex_t*,void*),
676 void* arg)
677
678 Iterate function call for all names.
679
680 return value
681 normal: 0
682 error: return value of callback function
683
684 arguments
685 1 reg: regex object.
686 2 func: callback function.
687 func(name, name_end, <number of groups>, <group number's list>,
688 reg, arg);
689 if func does not return 0, then iteration is stopped.
690 3 arg: argument for func.
691
692
693 # int onig_number_of_names(regex_t* reg)
694
695 Return the number of names defined in the pattern.
696 Multiple definitions of one name is counted as one.
697
698 arguments
699 1 reg: regex object.
700
701
702 # OnigEncoding onig_get_encoding(regex_t* reg)
703 # OnigOptionType onig_get_options(regex_t* reg)
704 # OnigSyntaxType* onig_get_syntax(regex_t* reg)
705
706 Return a value of the regex object.
707
708 arguments
709 1 reg: regex object.
710
711
712 # OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg)
713
714 Return the case_fold_flag of the regex object.
715 This function is deprecated.
716
717 arguments
718 1 reg: regex object.
719
720
721 # int onig_number_of_captures(regex_t* reg)
722
723 Return the number of capture group in the pattern.
724
725 arguments
726 1 reg: regex object.
727
728
729 # OnigCallbackEachMatchFunc onig_get_callback_each_match(void)
730
731 Return the current callback function for ONIG_OPTION_CALLBACK_EACH_MATCH.
732
733
734 # int onig_set_callback_each_match(OnigCallbackEachMatchFunc func)
735
736 Set the callback function for ONIG_OPTION_CALLBACK_EACH_MATCH.
737 If NULL is set, the callback will never be executed.
738
739 return value
740 normal: 0
741
742 arguments
743 1 func: callback function
744
745
746 # int onig_number_of_capture_histories(regex_t* reg)
747
748 Return the number of capture history defined in the pattern.
749
750 You can't use capture history if ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY
751 is disabled in the pattern syntax.(disabled in the default syntax)
752
753 arguments
754 1 reg: regex object.
755
756
757 # OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region)
758
759 Return the root node of capture history data tree.
760
761 This value is undefined if matching has failed.
762
763 arguments
764 1 region: matching result.
765
766
767 # int onig_capture_tree_traverse(OnigRegion* region, int at,
768 int(*func)(int,int,int,int,int,void*), void* arg)
769
770 Traverse and callback in capture history data tree.
771
772 return value
773 normal: 0
774 error: return value of callback function
775
776 arguments
777 1 region: match region data.
778 2 at: callback position.
779
780 ONIG_TRAVERSE_CALLBACK_AT_FIRST: callback first, then traverse children.
781 ONIG_TRAVERSE_CALLBACK_AT_LAST: traverse children first, then callback.
782 ONIG_TRAVERSE_CALLBACK_AT_BOTH: callback first, then traverse children,
783 and at last callback again.
784
785 3 func: callback function.
786 if func does not return 0, then traverse is stopped.
787
788 int func(int group, int beg, int end, int level, int at,
789 void* arg)
790
791 group: group number
792 beg: capture start position
793 end: capture end position
794 level: nest level (from 0)
795 at: callback position
796 ONIG_TRAVERSE_CALLBACK_AT_FIRST
797 ONIG_TRAVERSE_CALLBACK_AT_LAST
798 arg: optional callback argument
799
800 4 arg; optional callback argument.
801
802
803 # int onig_noname_group_capture_is_active(regex_t* reg)
804
805 Return noname group capture activity.
806
807 return value
808 active: 1
809 inactive: 0
810
811 arguments
812 1 reg: regex object.
813
814 if option ONIG_OPTION_DONT_CAPTURE_GROUP == ON
815 --> inactive
816
817 if the regex pattern have named group
818 and syntax ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP == ON
819 and option ONIG_OPTION_CAPTURE_GROUP == OFF
820 --> inactive
821
822 else --> active
823
824
825 # UChar* onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s)
826
827 Return previous character head address.
828
829 arguments
830 1 enc: character encoding
831 2 start: string address
832 3 s: target address of string
833
834
835 # UChar* onigenc_get_left_adjust_char_head(OnigEncoding enc,
836 const UChar* start, const UChar* s)
837
838 Return left-adjusted head address of a character.
839
840 arguments
841 1 enc: character encoding
842 2 start: string address
843 3 s: target address of string
844
845
846 # UChar* onigenc_get_right_adjust_char_head(OnigEncoding enc,
847 const UChar* start, const UChar* s)
848
849 Return right-adjusted head address of a character.
850
851 arguments
852 1 enc: character encoding
853 2 start: string address
854 3 s: target address of string
855
856
857 # int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end)
858
859 Return number of characters in the string.
860
861
862 # int onigenc_strlen_null(OnigEncoding enc, const UChar* s)
863
864 Return number of characters in the string.
865 Do not pass invalid byte string in the character encoding.
866
867
868 # int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
869
870 Return number of bytes in the string.
871 Do not pass invalid byte string in the character encoding.
872
873
874 # int onig_set_default_syntax(OnigSyntaxType* syntax)
875
876 Set default syntax.
877
878 arguments
879 1 syntax: address of pattern syntax definition.
880
881
882 # void onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from)
883
884 Copy syntax.
885
886 arguments
887 1 to: destination address.
888 2 from: source address.
889
890
891 # unsigned int onig_get_syntax_op(OnigSyntaxType* syntax)
892 # unsigned int onig_get_syntax_op2(OnigSyntaxType* syntax)
893 # unsigned int onig_get_syntax_behavior(OnigSyntaxType* syntax)
894 # OnigOptionType onig_get_syntax_options(OnigSyntaxType* syntax)
895
896 # void onig_set_syntax_op(OnigSyntaxType* syntax, unsigned int op)
897 # void onig_set_syntax_op2(OnigSyntaxType* syntax, unsigned int op2)
898 # void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior)
899 # void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options)
900
901 Get/Set elements of the syntax.
902
903 arguments
904 1 syntax: syntax
905 2 op, op2, behavior, options: value of element.
906
907
908 # void onig_copy_encoding(OnigEncoding to, OnigEncoding from)
909
910 Copy encoding.
911
912 arguments
913 1 to: destination address.
914 2 from: source address.
915
916
917 # int onig_set_meta_char(OnigSyntaxType* syntax, unsigned int what,
918 OnigCodePoint code)
919
920 Set a variable meta character to the code point value.
921 Except for an escape character, this meta characters specification
922 is not work, if ONIG_SYN_OP_VARIABLE_META_CHARACTERS is not effective
923 by the syntax. (Build-in syntaxes are not effective.)
924
925 normal return: ONIG_NORMAL
926
927 arguments
928 1 syntax: target syntax
929 2 what: specifies which meta character it is.
930
931 ONIG_META_CHAR_ESCAPE
932 ONIG_META_CHAR_ANYCHAR
933 ONIG_META_CHAR_ANYTIME
934 ONIG_META_CHAR_ZERO_OR_ONE_TIME
935 ONIG_META_CHAR_ONE_OR_MORE_TIME
936 ONIG_META_CHAR_ANYCHAR_ANYTIME
937
938 3 code: meta character or ONIG_INEFFECTIVE_META_CHAR.
939
940
941 # OnigCaseFoldType onig_get_default_case_fold_flag()
942
943 Get default case fold flag.
944 This function is deprecated.
945
946
947 # int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
948
949 Set default case fold flag.
950 This function is deprecated.
951
952 1 case_fold_flag: case fold flag
953
954
955 # unsigned int onig_get_match_stack_limit_size(void)
956
957 Return the maximum number of stack size.
958 (default: 0 == unlimited)
959
960
961 # int onig_set_match_stack_limit_size(unsigned int size)
962
963 Set the maximum number of stack size.
964 (size = 0: unlimited)
965
966 normal return: ONIG_NORMAL
967
968
969 # unsigned long onig_get_retry_limit_in_match(void)
970
971 Return the limit of retry counts in a matching process.
972 (default: 10000000)
973
974 normal return: current limit value
975
976
977 # unsigned long onig_get_retry_limit_in_search(void)
978
979 Return the limit of retry counts in a search process.
980 0 means unlimited.
981 (default: 0)
982
983 normal return: current limit value
984
985
986 # int onig_set_retry_limit_in_match(unsigned long limit)
987
988 Set the limit of retry counts in matching process.
989 0 means unlimited.
990
991 normal return: ONIG_NORMAL
992
993
994 # int onig_set_retry_limit_in_search(unsigned long limit)
995
996 Set a retry limit count of a search process.
997 0 means unlimited.
998
999 normal return: ONIG_NORMAL
1000
1001
1002 # unsigned long onig_get_subexp_call_limit_in_search(void)
1003
1004 Return the limit of subexp call count.
1005 (default: 0:unlimited)
1006
1007 normal return: current limit value
1008
1009
1010 # int onig_set_subexp_call_limit_in_search(unsigned long n)
1011
1012 Set a limit count of subexp call.
1013
1014 normal return: ONIG_NORMAL
1015
1016
1017 # int onig_get_subexp_call_max_nest_level(void)
1018
1019 Return the limit of subexp call nest level.
1020 (default: 24)
1021
1022 normal return: current limit value
1023
1024
1025 # int onig_set_subexp_call_max_nest_level(int max_level)
1026
1027 Set a limit level of subexp call nest level.
1028
1029 normal return: ONIG_NORMAL
1030
1031
1032 # OnigCalloutFunc onig_get_progress_callout(void)
1033
1034 Get a function for callouts of contents in progress.
1035
1036
1037 # int onig_set_progress_callout(OnigCalloutFunc f)
1038
1039 Set a function for callouts of contents in progress.
1040 If 0 (NULL) is set, never called in progress.
1041
1042 normal return: ONIG_NORMAL
1043
1044
1045 # OnigCalloutFunc onig_get_retraction_callout(void)
1046
1047 Get a function for callouts of contents in retraction (backtrack).
1048
1049
1050 # int onig_set_retraction_callout(OnigCalloutFunc f)
1051
1052 Set a function for callouts of contents in retraction (backtrack).
1053 If 0 (NULL) is set, never called in retraction.
1054
1055 normal return: ONIG_NORMAL
1056
1057
1058 # int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges))
1059
1060 Define new Unicode property.
1061 (This function is not thread safe.)
1062
1063 arguments
1064 1 name: property name (ASCII only. character ' ', '-', '_' are ignored.)
1065 2 ranges: property code point ranges
1066 (first element is number of ranges.)
1067
1068 [num-of-ranges, 1st-range-start, 1st-range-end, 2nd-range-start... ]
1069
1070 * Don't destroy the ranges after having called this function.
1071
1072 return value
1073 normal: ONIG_NORMAL == 0
1074 error: error code < 0
1075
1076
1077 # unsigned int onig_get_parse_depth_limit(void)
1078
1079 Return the maximum depth of parser recursion.
1080 (default: DEFAULT_PARSE_DEPTH_LIMIT defined in regint.h. Currently 4096.)
1081
1082
1083 # int onig_set_parse_depth_limit(unsigned int depth)
1084
1085 Set the maximum depth of parser recursion.
1086 (depth = 0: Set to the default value defined in regint.h.)
1087
1088 normal return: ONIG_NORMAL
1089
1090
1091 # int onig_end(void)
1092
1093 The use of this library is finished.
1094
1095 normal return: ONIG_NORMAL
1096
1097 It is not allowed to use regex objects which created
1098 before onig_end() call.
1099
1100
1101 # const char* onig_version(void)
1102
1103 Return version string. (ex. "5.0.3")
1104
1105 // END