1Oniguruma API  Version 6.9.7  2021/03/03
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
281  arguments
282  1 mp: match-param pointer
283  2 limit: number of limit
284
285  normal return: ONIG_NORMAL
286
287
288# int onig_set_retry_limit_in_search_of_match_param(OnigMatchParam* mp, unsigned long limit)
289
290  Set a retry limit count of a search process.
291  0 means unlimited.
292
293  arguments
294  1 mp: match-param pointer
295  2 limit: number of limit
296
297  normal return: ONIG_NORMAL
298
299
300# int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f)
301
302  Set a function for callouts of contents in progress.
303  If 0 (NULL) is set, never called in progress.
304
305  arguments
306  1 mp: match-param pointer
307  2 f: function
308
309  normal return: ONIG_NORMAL
310
311
312# int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f)
313
314  Set a function for callouts of contents in retraction (backtrack).
315  If 0 (NULL) is set, never called in retraction.
316
317  arguments
318  1 mp: match-param pointer
319  2 f: function
320
321  normal return: ONIG_NORMAL
322
323
324
325# int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start,
326                   const UChar* range, OnigRegion* region, OnigOptionType option)
327
328  Search string and return search result and matching region.
329  Do not pass invalid byte string in the regex character encoding.
330
331  return value
332  normal:    match position offset (i.e.  p - str >= 0)
333  not found: ONIG_MISMATCH (< 0)
334  error:     error code    (< 0)
335
336    * If option ONIG_OPTION_CALLBACK_EACH_MATCH is used,
337      it will return ONIG_MISMATCH even if there is a match.
338
339  arguments
340  1 reg:    regex object
341  2 str:    target string
342  3 end:    terminate address of target string
343  4 start:  search start address of target string
344  5 range:  search terminate address of target string
345    in forward search  (start <= searched string < range)
346    in backward search (range <= searched string <= start)
347  6 region: address for return group match range info (NULL is allowed)
348  7 option: search time option
349
350    ONIG_OPTION_NOTBOL              Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string
351    ONIG_OPTION_NOTEOL              Do not regard the (end) as the end of a line and the end of a string
352    ONIG_OPTION_NOT_BEGIN_STRING    Do not regard the beginning of the (str) as the beginning of a string  (* fail \A)
353    ONIG_OPTION_NOT_END_STRING      Do not regard the (end) as a string endpoint  (* fail \z, \Z)
354    ONIG_OPTION_NOT_BEGIN_POSITION  Do not regard the (start) as start position of search  (* fail \G)
355
356    ONIG_OPTION_CALLBACK_EACH_MATCH
357      Call back for all successful matches.
358      (including the case of the same matching start position)
359      The search does not stop when a match is found at a certain position.
360      The callback function to be called is set by
361      onig_set_callback_each_match().
362      The user_data in the argument passed to the callback function is
363      specified by onig_set_callout_user_data_of_match_param(mp, user_data).
364      Therefore, if you want to specify user_data,
365      use onig_search_with_param() instead of onig_search().
366      The user_data specified by onig_set_callout_user_data_of_match_param()
367      will be shared with callout.
368
369
370# int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end,
371                   const UChar* start, const UChar* range, OnigRegion* region,
372                   OnigOptionType option, OnigMatchParam* mp)
373
374  Search string and return search result and matching region.
375  Do not pass invalid byte string in the regex character encoding.
376
377  arguments
378  1-7:  same as onig_search()
379  8 mp: match parameter values (match_stack_limit, retry_limit_in_match, retry_limit_in_search)
380
381
382# int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at,
383                 OnigRegion* region, OnigOptionType option)
384
385  Match string and return result and matching region.
386  Do not pass invalid byte string in the regex character encoding.
387
388  return value
389  normal:    match length  (>= 0)
390  not match: ONIG_MISMATCH (< 0)
391  error:     error code    (< 0)
392
393    * If option ONIG_OPTION_CALLBACK_EACH_MATCH is used,
394      it will return ONIG_MISMATCH even if there is a match.
395
396  arguments
397  1 reg:    regex object
398  2 str:    target string
399  3 end:    terminate address of target string
400  4 at:     match address of target string
401  5 region: address for return group match range info (NULL is allowed)
402  6 option: search time option
403
404    ONIG_OPTION_NOTBOL              Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string
405    ONIG_OPTION_NOTEOL              Do not regard the (end) as the end of a line and the end of a string
406    ONIG_OPTION_NOT_BEGIN_STRING    Do not regard the beginning of the (str) as the beginning of a string  (* fail \A)
407    ONIG_OPTION_NOT_END_STRING      Do not regard the (end) as a string endpoint  (* fail \z, \Z)
408    ONIG_OPTION_NOT_BEGIN_POSITION  Do not regard the (start) as start position of search  (* fail \G)
409    ONIG_OPTION_CALLBACK_EACH_MATCH Call back for all successful matches.
410
411
412# int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end,
413                            const UChar* at, OnigRegion* region,
414                            OnigOptionType option, OnigMatchParam* mp)
415
416  Match string and return result and matching region.
417  Do not pass invalid byte string in the regex character encoding.
418
419   arguments
420   1-6:  same as onig_match()
421   7 mp: match parameter values (match_stack_limit, retry_limit_in_match, retry_limit_in_search)
422
423
424# int onig_scan(regex_t* reg, const UChar* str, const UChar* end,
425                OnigRegion* region, OnigOptionType option,
426                int (*scan_callback)(int, int, OnigRegion*, void*),
427                void* callback_arg)
428
429  Scan string and callback with matching region.
430  Do not pass invalid byte string in the regex character encoding.
431
432  return value
433  normal:       number of matching times
434  error:        error code
435  interruption: return value of callback function (!= 0)
436
437  arguments
438  1 reg:    regex object
439  2 str:    target string
440  3 end:    terminate address of target string
441  4 region: address for return group match range info (NULL is allowed)
442  5 option: search time option
443  6 scan_callback: callback function (defined by user)
444  7 callback_arg:  optional argument passed to callback
445
446
447# int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[])
448
449  Create a regset object.
450  All regex objects must have the same character encoding.
451  All regex objects are prohibited from having the ONIG_OPTION_FIND_LONGEST option.
452
453  arguments
454  1 rset: return address of regset object
455  2 n:    number of regex in regs
456  3 regs: array of regex
457
458  return value
459  normal: ONIG_NORMAL == 0
460  error:  error code < 0
461
462
463# int onig_regset_add(OnigRegSet* set, regex_t* reg)
464
465  Add a regex into regset.
466  The regex object must have the same character encoding with the regset.
467  The regex object is prohibited from having the ONIG_OPTION_FIND_LONGEST option.
468
469  arguments
470  1 set: regset object
471  2 reg: regex object
472
473  return value
474  normal: ONIG_NORMAL == 0
475  error:  error code < 0
476
477
478# int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg)
479
480  Replace a regex in regset with another one.
481  If the reg argument value is NULL, then remove at-th regex. (and indexes of other regexes are changed)
482
483  arguments
484  1 set: regset object
485  2 at:  index of regex (zero origin)
486  3 reg: regex object
487
488  return value
489  normal: ONIG_NORMAL == 0
490  error:  error code < 0
491
492
493# void onig_regset_free(OnigRegSet* set)
494
495  Free memory used by regset object and regex objects in the regset.
496  If the same regex object is registered twice, the situation becomes destructive.
497
498  arguments
499  1 set: regset object
500
501
502# int onig_regset_number_of_regex(OnigRegSet* set)
503
504  Returns number of regex objects in the regset.
505
506  arguments
507  1 set: regset object
508
509
510# regex_t* onig_regset_get_regex(OnigRegSet* set, int at)
511
512  Returns the regex object corresponding to the at-th regex.
513
514  arguments
515  1 set: regset object
516  2 at:  index of regex array (zero origin)
517
518
519# OnigRegion* onig_regset_get_region(OnigRegSet* set, int at)
520
521  Returns the region object corresponding to the at-th regex.
522
523  arguments
524  1 set: regset object
525  2 at:  index of regex array (zero origin)
526
527
528# 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)
529
530  Perform a search with regset.
531
532  return value:
533  normal:    index of match regex (zero origin)
534  not found: ONIG_MISMATCH (< 0)
535  error:     error code    (< 0)
536
537  arguments
538  1 set:    regset object
539  2 str:    target string
540  3 end:    terminate address of target string
541  4 start:  search start address of target string
542  5 range:  search terminate address of target string
543  6 lead:   outer loop element
544      ONIG_REGSET_POSITION_LEAD (returns most left position)
545      ONIG_REGSET_REGEX_LEAD    (returns most left position)
546      ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
547  7 option: search time option
548    ONIG_OPTION_NOTBOL             Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string
549    ONIG_OPTION_NOTEOL             Do not regard the (end) as the end of a line and the end of a string
550    ONIG_OPTION_NOT_BEGIN_STRING   Do not regard the beginning of the (str) as the beginning of a string  (* fail \A)
551    ONIG_OPTION_NOT_END_STRING     Do not regard the (end) as a string endpoint  (* fail \z, \Z)
552    ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search  (* fail \G)
553
554  8 rmatch_pos: return address of match position (match_address - str)
555
556  * ONIG_REGSET_POSITION_LEAD and ONIG_REGSET_REGEX_LEAD return the same result.
557    These differences only appear in search time.
558    In most cases, ONIG_REGSET_POSITION_LEAD seems to be faster.
559
560
561# 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)
562
563  Perform a search with regset and match-params.
564
565  return value:
566  normal:    index of match regex (zero origin)
567  not found: ONIG_MISMATCH (< 0)
568  error:     error code    (< 0)
569
570  arguments
571  1 set:    regset object
572  2 str:    target string
573  3 end:    terminate address of target string
574  4 start:  search start address of target string
575  5 range:  search terminate address of target string
576  6 lead:   outer loop element
577      ONIG_REGSET_POSITION_LEAD (returns most left position)
578      ONIG_REGSET_REGEX_LEAD    (returns most left position)
579      ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
580  7 option: search time option
581    ONIG_OPTION_NOTBOL             Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string
582    ONIG_OPTION_NOTEOL             Do not regard the (end) as the end of a line and the end of a string
583    ONIG_OPTION_NOT_BEGIN_STRING   Do not regard the beginning of the (str) as the beginning of a string  (* fail \A)
584    ONIG_OPTION_NOT_END_STRING     Do not regard the (end) as a string endpoint  (* fail \z, \Z)
585    ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search  (* fail \G)
586
587  8 mps:    array of match-params
588  9 rmatch_pos: return address of match position (match_address - str)
589
590
591# OnigRegion* onig_region_new(void)
592
593  Create a region.
594
595
596# void onig_region_free(OnigRegion* region, int free_self)
597
598  Free memory used by region.
599
600  arguments
601  1 region:    target region
602  2 free_self: [1: free all, 0: free memory used in region but not self]
603
604
605# void onig_region_copy(OnigRegion* to, OnigRegion* from)
606
607  Copy contents of region.
608
609  arguments
610  1 to:   target region
611  2 from: source region
612
613
614# void onig_region_clear(OnigRegion* region)
615
616  Clear contents of region.
617
618  arguments
619  1 region: target region
620
621
622# int onig_region_resize(OnigRegion* region, int n)
623
624  Resize group range area of region.
625
626  return value
627  normal: ONIG_NORMAL == 0
628  error:  error code < 0
629
630  arguments
631  1 region: target region
632  2 n:      new size
633
634
635# int onig_name_to_group_numbers(regex_t* reg, const UChar* name, const UChar* name_end,
636                                  int** num_list)
637
638  Return the group number list of the name.
639  Named subexp is defined by (?<name>....).
640
641  return value
642  normal: number of groups for the name.
643          (ex. /(?<x>..)(?<x>..)/  ==>  2)
644  name not found: -1
645
646  arguments
647  1 reg:       regex object.
648  2 name:      group name.
649  3 name_end:  terminate address of group name.
650  4 num_list:  return list of group number.
651
652
653# int onig_name_to_backref_number(regex_t* reg, const UChar* name, const UChar* name_end,
654                                  OnigRegion *region)
655
656  Return the group number corresponding to the named backref (\k<name>).
657  If two or more regions for the groups of the name are effective,
658  the greatest number in it is obtained.
659
660  return value
661  normal: group number
662  error:  error code < 0
663
664  arguments
665  1 reg:      regex object.
666  2 name:     group name.
667  3 name_end: terminate address of group name.
668  4 region:   search/match result region.
669
670
671# int onig_foreach_name(regex_t* reg,
672          int (*func)(const UChar*, const UChar*, int,int*,regex_t*,void*),
673          void* arg)
674
675  Iterate function call for all names.
676
677  return value
678  normal: 0
679  error:  return value of callback function
680
681  arguments
682  1 reg:     regex object.
683  2 func:    callback function.
684             func(name, name_end, <number of groups>, <group number's list>,
685                  reg, arg);
686             if func does not return 0, then iteration is stopped.
687  3 arg:     argument for func.
688
689
690# int onig_number_of_names(regex_t* reg)
691
692  Return the number of names defined in the pattern.
693  Multiple definitions of one name is counted as one.
694
695  arguments
696  1 reg:     regex object.
697
698
699# OnigEncoding     onig_get_encoding(regex_t* reg)
700# OnigOptionType   onig_get_options(regex_t* reg)
701# OnigSyntaxType*  onig_get_syntax(regex_t* reg)
702
703  Return a value of the regex object.
704
705  arguments
706  1 reg:     regex object.
707
708
709# OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg)
710
711  Return the case_fold_flag of the regex object.
712  This function is deprecated.
713
714  arguments
715  1 reg:     regex object.
716
717
718# int onig_number_of_captures(regex_t* reg)
719
720  Return the number of capture group in the pattern.
721
722  arguments
723  1 reg:     regex object.
724
725
726# OnigCallbackEachMatchFunc onig_get_callback_each_match(void)
727
728  Return the current callback function for ONIG_OPTION_CALLBACK_EACH_MATCH.
729
730
731# int onig_set_callback_each_match(OnigCallbackEachMatchFunc func)
732
733  Set the callback function for ONIG_OPTION_CALLBACK_EACH_MATCH.
734  If NULL is set, the callback will never be executed.
735
736  return value
737  normal: 0
738
739  arguments
740  1 func: callback function
741
742
743# int onig_number_of_capture_histories(regex_t* reg)
744
745  Return the number of capture history defined in the pattern.
746
747  You can't use capture history if ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY
748  is disabled in the pattern syntax.(disabled in the default syntax)
749
750  arguments
751  1 reg:     regex object.
752
753
754# OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region)
755
756  Return the root node of capture history data tree.
757
758  This value is undefined if matching has failed.
759
760  arguments
761  1 region: matching result.
762
763
764# int onig_capture_tree_traverse(OnigRegion* region, int at,
765                  int(*func)(int,int,int,int,int,void*), void* arg)
766
767 Traverse and callback in capture history data tree.
768
769  return value
770  normal: 0
771  error:  return value of callback function
772
773  arguments
774  1 region:  match region data.
775  2 at:      callback position.
776
777    ONIG_TRAVERSE_CALLBACK_AT_FIRST: callback first, then traverse children.
778    ONIG_TRAVERSE_CALLBACK_AT_LAST:  traverse children first, then callback.
779    ONIG_TRAVERSE_CALLBACK_AT_BOTH:  callback first, then traverse children,
780                                     and at last callback again.
781
782  3 func:    callback function.
783             if func does not return 0, then traverse is stopped.
784
785             int func(int group, int beg, int end, int level, int at,
786                      void* arg)
787
788               group: group number
789               beg:   capture start position
790               end:   capture end position
791               level: nest level (from 0)
792               at:    callback position
793                      ONIG_TRAVERSE_CALLBACK_AT_FIRST
794                      ONIG_TRAVERSE_CALLBACK_AT_LAST
795               arg:   optional callback argument
796
797  4 arg;     optional callback argument.
798
799
800# int onig_noname_group_capture_is_active(regex_t* reg)
801
802  Return noname group capture activity.
803
804  return value
805  active:   1
806  inactive: 0
807
808  arguments
809  1 reg:     regex object.
810
811  if option ONIG_OPTION_DONT_CAPTURE_GROUP == ON
812    --> inactive
813
814  if the regex pattern have named group
815     and syntax ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP == ON
816     and option ONIG_OPTION_CAPTURE_GROUP == OFF
817    --> inactive
818
819  else --> active
820
821
822# UChar* onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s)
823
824  Return previous character head address.
825
826  arguments
827  1 enc:   character encoding
828  2 start: string address
829  3 s:     target address of string
830
831
832# UChar* onigenc_get_left_adjust_char_head(OnigEncoding enc,
833                                           const UChar* start, const UChar* s)
834
835  Return left-adjusted head address of a character.
836
837  arguments
838  1 enc:   character encoding
839  2 start: string address
840  3 s:     target address of string
841
842
843# UChar* onigenc_get_right_adjust_char_head(OnigEncoding enc,
844                                            const UChar* start, const UChar* s)
845
846  Return right-adjusted head address of a character.
847
848  arguments
849  1 enc:   character encoding
850  2 start: string address
851  3 s:     target address of string
852
853
854# int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end)
855
856  Return number of characters in the string.
857
858
859# int onigenc_strlen_null(OnigEncoding enc, const UChar* s)
860
861  Return number of characters in the string.
862  Do not pass invalid byte string in the character encoding.
863
864
865# int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
866
867  Return number of bytes in the string.
868  Do not pass invalid byte string in the character encoding.
869
870
871# int onig_set_default_syntax(OnigSyntaxType* syntax)
872
873  Set default syntax.
874
875  arguments
876  1 syntax: address of pattern syntax definition.
877
878
879# void onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from)
880
881  Copy syntax.
882
883  arguments
884  1 to:   destination address.
885  2 from: source address.
886
887
888# unsigned int onig_get_syntax_op(OnigSyntaxType* syntax)
889# unsigned int onig_get_syntax_op2(OnigSyntaxType* syntax)
890# unsigned int onig_get_syntax_behavior(OnigSyntaxType* syntax)
891# OnigOptionType onig_get_syntax_options(OnigSyntaxType* syntax)
892
893# void onig_set_syntax_op(OnigSyntaxType* syntax, unsigned int op)
894# void onig_set_syntax_op2(OnigSyntaxType* syntax, unsigned int op2)
895# void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior)
896# void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options)
897
898 Get/Set elements of the syntax.
899
900  arguments
901  1 syntax:  syntax
902  2 op, op2, behavior, options: value of element.
903
904
905# void onig_copy_encoding(OnigEncoding to, OnigEncoding from)
906
907  Copy encoding.
908
909  arguments
910  1 to:   destination address.
911  2 from: source address.
912
913
914# int onig_set_meta_char(OnigSyntaxType* syntax, unsigned int what,
915                         OnigCodePoint code)
916
917  Set a variable meta character to the code point value.
918  Except for an escape character, this meta characters specification
919  is not work, if ONIG_SYN_OP_VARIABLE_META_CHARACTERS is not effective
920  by the syntax. (Build-in syntaxes are not effective.)
921
922  normal return: ONIG_NORMAL
923
924  arguments
925  1 syntax: target syntax
926  2 what:   specifies which meta character it is.
927
928          ONIG_META_CHAR_ESCAPE
929          ONIG_META_CHAR_ANYCHAR
930          ONIG_META_CHAR_ANYTIME
931          ONIG_META_CHAR_ZERO_OR_ONE_TIME
932          ONIG_META_CHAR_ONE_OR_MORE_TIME
933          ONIG_META_CHAR_ANYCHAR_ANYTIME
934
935  3 code: meta character or ONIG_INEFFECTIVE_META_CHAR.
936
937
938# OnigCaseFoldType onig_get_default_case_fold_flag()
939
940  Get default case fold flag.
941  This function is deprecated.
942
943
944# int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
945
946  Set default case fold flag.
947  This function is deprecated.
948
949  1 case_fold_flag: case fold flag
950
951
952# unsigned int onig_get_match_stack_limit_size(void)
953
954  Return the maximum number of stack size.
955  (default: 0 == unlimited)
956
957
958# int onig_set_match_stack_limit_size(unsigned int size)
959
960  Set the maximum number of stack size.
961  (size = 0: unlimited)
962
963  normal return: ONIG_NORMAL
964
965
966# unsigned long onig_get_retry_limit_in_match(void)
967
968  Return the limit of retry counts in a matching process.
969  (default: 10000000)
970
971  normal return: current limit value
972
973
974# unsigned long onig_get_retry_limit_in_search(void)
975
976  Return the limit of retry counts in a search process.
977  0 means unlimited.
978  (default: 0)
979
980  normal return: current limit value
981
982
983# int onig_set_retry_limit_in_match(unsigned long limit)
984
985  Set the limit of retry counts in matching process.
986
987  normal return: ONIG_NORMAL
988
989
990# int onig_set_retry_limit_in_search(unsigned long limit)
991
992  Set a retry limit count of a search process.
993  0 means unlimited.
994
995  normal return: ONIG_NORMAL
996
997
998# unsigned long onig_get_subexp_call_limit_in_search(void)
999
1000  Return the limit of subexp call count.
1001  (default: 0:unlimited)
1002
1003  normal return: current limit value
1004
1005
1006# int onig_set_subexp_call_limit_in_search(unsigned long n)
1007
1008  Set a limit count of subexp call.
1009
1010  normal return: ONIG_NORMAL
1011
1012
1013# int onig_get_subexp_call_max_nest_level(void)
1014
1015  Return the limit of subexp call nest level.
1016  (default: 24)
1017
1018  normal return: current limit value
1019
1020
1021# int onig_set_subexp_call_max_nest_level(int max_level)
1022
1023  Set a limit level of subexp call nest level.
1024
1025  normal return: ONIG_NORMAL
1026
1027
1028# OnigCalloutFunc onig_get_progress_callout(void)
1029
1030  Get a function for callouts of contents in progress.
1031
1032
1033# int onig_set_progress_callout(OnigCalloutFunc f)
1034
1035  Set a function for callouts of contents in progress.
1036  If 0 (NULL) is set, never called in progress.
1037
1038  normal return: ONIG_NORMAL
1039
1040
1041# OnigCalloutFunc onig_get_retraction_callout(void)
1042
1043  Get a function for callouts of contents in retraction (backtrack).
1044
1045
1046# int onig_set_retraction_callout(OnigCalloutFunc f)
1047
1048  Set a function for callouts of contents in retraction (backtrack).
1049  If 0 (NULL) is set, never called in retraction.
1050
1051  normal return: ONIG_NORMAL
1052
1053
1054# int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges))
1055
1056  Define new Unicode property.
1057  (This function is not thread safe.)
1058
1059  arguments
1060  1 name:    property name (ASCII only. character ' ', '-', '_' are ignored.)
1061  2 ranges:  property code point ranges
1062             (first element is number of ranges.)
1063
1064    [num-of-ranges, 1st-range-start, 1st-range-end, 2nd-range-start... ]
1065
1066    * Don't destroy the ranges after having called this function.
1067
1068  return value
1069  normal: ONIG_NORMAL == 0
1070  error:  error code < 0
1071
1072
1073# unsigned int onig_get_parse_depth_limit(void)
1074
1075  Return the maximum depth of parser recursion.
1076  (default: DEFAULT_PARSE_DEPTH_LIMIT defined in regint.h. Currently 4096.)
1077
1078
1079# int onig_set_parse_depth_limit(unsigned int depth)
1080
1081  Set the maximum depth of parser recursion.
1082  (depth = 0: Set to the default value defined in regint.h.)
1083
1084  normal return: ONIG_NORMAL
1085
1086
1087# int onig_end(void)
1088
1089  The use of this library is finished.
1090
1091  normal return: ONIG_NORMAL
1092
1093  It is not allowed to use regex objects which created
1094  before onig_end() call.
1095
1096
1097# const char* onig_version(void)
1098
1099  Return version string.  (ex. "5.0.3")
1100
1101// END
1102