API 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953
  1. Oniguruma API Version 6.9.4 2019/09/30
  2. #include <oniguruma.h>
  3. # int onig_initialize(OnigEncoding use_encodings[], int num_encodings)
  4. Initialize library.
  5. You have to call it explicitly.
  6. * onig_init() is deprecated.
  7. arguments
  8. 1 use_encodings: array of encodings used in application.
  9. 2 num_encodings: number of encodings.
  10. # int onig_error_code_to_str(UChar* err_buf, int err_code, ...)
  11. Get error message string.
  12. If this function is used for onig_new(),
  13. don't call this after the pattern argument of onig_new() is freed.
  14. normal return: error message string length
  15. arguments
  16. 1 err_buf: error message string buffer.
  17. (required size: ONIG_MAX_ERROR_MESSAGE_LEN)
  18. 2 err_code: error code returned by other API functions.
  19. 3 err_info (optional): error info returned by onig_new().
  20. # void onig_set_warn_func(OnigWarnFunc func)
  21. Set warning function.
  22. WARNING:
  23. '[', '-', ']' in character class without escape.
  24. ']' in pattern without escape.
  25. arguments
  26. 1 func: function pointer. void (*func)(char* warning_message)
  27. # void onig_set_verb_warn_func(OnigWarnFunc func)
  28. Set verbose warning function.
  29. WARNING:
  30. redundant nested repeat operator.
  31. arguments
  32. 1 func: function pointer. void (*func)(char* warning_message)
  33. # int onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
  34. OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax,
  35. OnigErrorInfo* err_info)
  36. Create a regex object.
  37. normal return: ONIG_NORMAL
  38. arguments
  39. 1 reg: return regex object's address.
  40. 2 pattern: regex pattern string.
  41. 3 pattern_end: terminate address of pattern. (pattern + pattern length)
  42. 4 option: compile time options.
  43. ONIG_OPTION_NONE no option
  44. ONIG_OPTION_SINGLELINE '^' -> '\A', '$' -> '\Z'
  45. ONIG_OPTION_MULTILINE '.' match with newline
  46. ONIG_OPTION_IGNORECASE ambiguity match on
  47. ONIG_OPTION_EXTEND extended pattern form
  48. ONIG_OPTION_FIND_LONGEST find longest match
  49. ONIG_OPTION_FIND_NOT_EMPTY ignore empty match
  50. ONIG_OPTION_NEGATE_SINGLELINE
  51. clear ONIG_OPTION_SINGLELINE which is enabled on
  52. ONIG_SYNTAX_POSIX_BASIC, ONIG_SYNTAX_POSIX_EXTENDED,
  53. ONIG_SYNTAX_PERL, ONIG_SYNTAX_PERL_NG, ONIG_SYNTAX_JAVA
  54. ONIG_OPTION_DONT_CAPTURE_GROUP only named group captured.
  55. ONIG_OPTION_CAPTURE_GROUP named and no-named group captured.
  56. ONIG_OPTION_WORD_IS_ASCII ASCII only word (\w, \p{Word}, [[:word:]])
  57. ASCII only word bound (\b)
  58. ONIG_OPTION_DIGIT_IS_ASCII ASCII only digit (\d, \p{Digit}, [[:digit:]])
  59. ONIG_OPTION_SPACE_IS_ASCII ASCII only space (\s, \p{Space}, [[:space:]])
  60. ONIG_OPTION_POSIX_IS_ASCII ASCII only POSIX properties
  61. (includes word, digit, space)
  62. (alnum, alpha, blank, cntrl, digit, graph,
  63. lower, print, punct, space, upper, xdigit,
  64. word)
  65. ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER Extended Grapheme Cluster mode
  66. ONIG_OPTION_TEXT_SEGMENT_WORD Word mode
  67. 5 enc: character encoding.
  68. ONIG_ENCODING_ASCII ASCII
  69. ONIG_ENCODING_ISO_8859_1 ISO 8859-1
  70. ONIG_ENCODING_ISO_8859_2 ISO 8859-2
  71. ONIG_ENCODING_ISO_8859_3 ISO 8859-3
  72. ONIG_ENCODING_ISO_8859_4 ISO 8859-4
  73. ONIG_ENCODING_ISO_8859_5 ISO 8859-5
  74. ONIG_ENCODING_ISO_8859_6 ISO 8859-6
  75. ONIG_ENCODING_ISO_8859_7 ISO 8859-7
  76. ONIG_ENCODING_ISO_8859_8 ISO 8859-8
  77. ONIG_ENCODING_ISO_8859_9 ISO 8859-9
  78. ONIG_ENCODING_ISO_8859_10 ISO 8859-10
  79. ONIG_ENCODING_ISO_8859_11 ISO 8859-11
  80. ONIG_ENCODING_ISO_8859_13 ISO 8859-13
  81. ONIG_ENCODING_ISO_8859_14 ISO 8859-14
  82. ONIG_ENCODING_ISO_8859_15 ISO 8859-15
  83. ONIG_ENCODING_ISO_8859_16 ISO 8859-16
  84. ONIG_ENCODING_UTF8 UTF-8
  85. ONIG_ENCODING_UTF16_BE UTF-16BE
  86. ONIG_ENCODING_UTF16_LE UTF-16LE
  87. ONIG_ENCODING_UTF32_BE UTF-32BE
  88. ONIG_ENCODING_UTF32_LE UTF-32LE
  89. ONIG_ENCODING_EUC_JP EUC-JP
  90. ONIG_ENCODING_EUC_TW EUC-TW
  91. ONIG_ENCODING_EUC_KR EUC-KR
  92. ONIG_ENCODING_EUC_CN EUC-CN
  93. ONIG_ENCODING_SJIS Shift_JIS
  94. ONIG_ENCODING_KOI8_R KOI8-R
  95. ONIG_ENCODING_CP1251 CP1251
  96. ONIG_ENCODING_BIG5 Big5
  97. ONIG_ENCODING_GB18030 GB18030
  98. or any OnigEncodingType data address defined by user.
  99. 6 syntax: address of pattern syntax definition.
  100. ONIG_SYNTAX_ASIS plain text
  101. ONIG_SYNTAX_POSIX_BASIC POSIX Basic RE
  102. ONIG_SYNTAX_POSIX_EXTENDED POSIX Extended RE
  103. ONIG_SYNTAX_EMACS Emacs
  104. ONIG_SYNTAX_GREP grep
  105. ONIG_SYNTAX_GNU_REGEX GNU regex
  106. ONIG_SYNTAX_JAVA Java (Sun java.util.regex)
  107. ONIG_SYNTAX_PERL Perl
  108. ONIG_SYNTAX_PERL_NG Perl + named group
  109. ONIG_SYNTAX_RUBY Ruby
  110. ONIG_SYNTAX_ONIGURUMA Oniguruma
  111. ONIG_SYNTAX_DEFAULT default (== ONIG_SYNTAX_ONIGURUMA)
  112. onig_set_default_syntax()
  113. or any OnigSyntaxType data address defined by user.
  114. 7 err_info: address for return optional error info.
  115. Use this value as 3rd argument of onig_error_code_to_str().
  116. # int onig_new_without_alloc(regex_t* reg, const UChar* pattern,
  117. const UChar* pattern_end,
  118. OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax,
  119. OnigErrorInfo* err_info)
  120. Create a regex object.
  121. reg object area is not allocated in this function.
  122. normal return: ONIG_NORMAL
  123. # int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
  124. OnigCompileInfo* ci, OnigErrorInfo* einfo)
  125. This function is deprecated, and it does not allow the case where
  126. the encoding of pattern and target is different.
  127. Create a regex object.
  128. This function is deluxe version of onig_new().
  129. normal return: ONIG_NORMAL
  130. arguments
  131. 1 reg: return address of regex object.
  132. 2 pattern: regex pattern string.
  133. 3 pattern_end: terminate address of pattern. (pattern + pattern length)
  134. 4 ci: compile time info.
  135. ci->num_of_elements: number of elements in ci. (current version: 5)
  136. ci->pattern_enc: pattern string character encoding.
  137. ci->target_enc: target string character encoding.
  138. ci->syntax: address of pattern syntax definition.
  139. ci->option: compile time option.
  140. ci->case_fold_flag: character matching case fold bit flag for
  141. ONIG_OPTION_IGNORECASE mode.
  142. ONIGENC_CASE_FOLD_MIN: minimum
  143. ONIGENC_CASE_FOLD_DEFAULT: minimum
  144. onig_set_default_case_fold_flag()
  145. 5 err_info: address for return optional error info.
  146. Use this value as 3rd argument of onig_error_code_to_str().
  147. Different character encoding combination is allowed for
  148. the following cases only.
  149. pattern_enc: ASCII, ISO_8859_1
  150. target_enc: UTF16_BE, UTF16_LE, UTF32_BE, UTF32_LE
  151. pattern_enc: UTF16_BE/LE
  152. target_enc: UTF16_LE/BE
  153. pattern_enc: UTF32_BE/LE
  154. target_enc: UTF32_LE/BE
  155. # void onig_free(regex_t* reg)
  156. Free memory used by regex object.
  157. arguments
  158. 1 reg: regex object.
  159. # void onig_free_body(regex_t* reg)
  160. Free memory used by regex object. (Except reg oneself.)
  161. arguments
  162. 1 reg: regex object.
  163. # OnigMatchParam* onig_new_match_param()
  164. Allocate a OnigMatchParam object and initialize the contents by
  165. onig_initialize_match_param().
  166. # void onig_free_match_param(OnigMatchParam* mp)
  167. Free memory used by a OnigMatchParam object.
  168. arguments
  169. 1 mp: OnigMatchParam object
  170. # void onig_initialize_match_param(OnigMatchParam* mp)
  171. Set match-param fields to default values.
  172. Match-param is used in onig_match_with_param() and onig_search_with_param().
  173. arguments
  174. 1 mp: match-param pointer
  175. # int onig_set_match_stack_limit_size_of_match_param(OnigMatchParam* mp, unsigned int limit)
  176. Set a maximum number of match-stack depth.
  177. 0 means unlimited.
  178. arguments
  179. 1 mp: match-param pointer
  180. 2 limit: number of limit
  181. normal return: ONIG_NORMAL
  182. # int onig_set_retry_limit_in_match_of_match_param(OnigMatchParam* mp, unsigned long limit)
  183. Set a retry limit count of a match process.
  184. arguments
  185. 1 mp: match-param pointer
  186. 2 limit: number of limit
  187. normal return: ONIG_NORMAL
  188. # int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f)
  189. Set a function for callouts of contents in progress.
  190. If 0 (NULL) is set, never called in progress.
  191. arguments
  192. 1 mp: match-param pointer
  193. 2 f: function
  194. normal return: ONIG_NORMAL
  195. # int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f)
  196. Set a function for callouts of contents in retraction (backtrack).
  197. If 0 (NULL) is set, never called in retraction.
  198. arguments
  199. 1 mp: match-param pointer
  200. 2 f: function
  201. normal return: ONIG_NORMAL
  202. # int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start,
  203. const UChar* range, OnigRegion* region, OnigOptionType option)
  204. Search string and return search result and matching region.
  205. Do not pass invalid byte string in the regex character encoding.
  206. normal return: match position offset (i.e. p - str >= 0)
  207. not found: ONIG_MISMATCH (< 0)
  208. error: error code (< 0)
  209. arguments
  210. 1 reg: regex object
  211. 2 str: target string
  212. 3 end: terminate address of target string
  213. 4 start: search start address of target string
  214. 5 range: search terminate address of target string
  215. in forward search (start <= searched string < range)
  216. in backward search (range <= searched string <= start)
  217. 6 region: address for return group match range info (NULL is allowed)
  218. 7 option: search time option
  219. ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line
  220. ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line
  221. ONIG_OPTION_POSIX_REGION region argument is regmatch_t[] of POSIX API.
  222. # int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end,
  223. const UChar* start, const UChar* range, OnigRegion* region,
  224. OnigOptionType option, OnigMatchParam* mp)
  225. Search string and return search result and matching region.
  226. Do not pass invalid byte string in the regex character encoding.
  227. arguments
  228. 1-7: same as onig_search()
  229. 8 mp: match parameter values (match_stack_limit, retry_limit_in_match)
  230. # int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at,
  231. OnigRegion* region, OnigOptionType option)
  232. Match string and return result and matching region.
  233. Do not pass invalid byte string in the regex character encoding.
  234. normal return: match length (>= 0)
  235. not match: ONIG_MISMATCH (< 0)
  236. error: error code (< 0)
  237. arguments
  238. 1 reg: regex object
  239. 2 str: target string
  240. 3 end: terminate address of target string
  241. 4 at: match address of target string
  242. 5 region: address for return group match range info (NULL is allowed)
  243. 6 option: search time option
  244. ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line
  245. ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line
  246. ONIG_OPTION_POSIX_REGION region argument is regmatch_t[] type of POSIX API.
  247. # int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end,
  248. const UChar* at, OnigRegion* region,
  249. OnigOptionType option, OnigMatchParam* mp)
  250. Match string and return result and matching region.
  251. Do not pass invalid byte string in the regex character encoding.
  252. arguments
  253. 1-6: same as onig_match()
  254. 7 mp: match parameter values (match_stack_limit, retry_limit_in_match)
  255. # int onig_scan(regex_t* reg, const UChar* str, const UChar* end,
  256. OnigRegion* region, OnigOptionType option,
  257. int (*scan_callback)(int, int, OnigRegion*, void*),
  258. void* callback_arg)
  259. Scan string and callback with matching region.
  260. Do not pass invalid byte string in the regex character encoding.
  261. normal return: number of matching times
  262. error: error code
  263. interruption: return value of callback function (!= 0)
  264. arguments
  265. 1 reg: regex object
  266. 2 str: target string
  267. 3 end: terminate address of target string
  268. 4 region: address for return group match range info (NULL is allowed)
  269. 5 option: search time option
  270. 6 scan_callback: callback function (defined by user)
  271. 7 callback_arg: optional argument passed to callback
  272. # int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[])
  273. Create a regset object.
  274. All regex objects must have the same character encoding.
  275. All regex objects are prohibited from having the ONIG_OPTION_FIND_LONGEST option.
  276. arguments
  277. 1 rset: return address of regset object
  278. 2 n: number of regex in regs
  279. 3 regs: array of regex
  280. normal return: ONIG_NORMAL
  281. # int onig_regset_add(OnigRegSet* set, regex_t* reg)
  282. Add a regex into regset.
  283. The regex object must have the same character encoding with the regset.
  284. The regex object is prohibited from having the ONIG_OPTION_FIND_LONGEST option.
  285. arguments
  286. 1 set: regset object
  287. 2 reg: regex object
  288. normal return: ONIG_NORMAL
  289. # int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg)
  290. Replace a regex in regset with another one.
  291. If the reg argument value is NULL, then remove at-th regex. (and indexes of other regexes are changed)
  292. arguments
  293. 1 set: regset object
  294. 2 at: index of regex (zero origin)
  295. 3 reg: regex object
  296. normal return: ONIG_NORMAL
  297. # void onig_regset_free(OnigRegSet* set)
  298. Free memory used by regset object and regex objects in the regset.
  299. If the same regex object is registered twice, the situation becomes destructive.
  300. arguments
  301. 1 set: regset object
  302. # int onig_regset_number_of_regex(OnigRegSet* set)
  303. Returns number of regex objects in the regset.
  304. arguments
  305. 1 set: regset object
  306. # regex_t* onig_regset_get_regex(OnigRegSet* set, int at)
  307. Returns the regex object corresponding to the at-th regex.
  308. arguments
  309. 1 set: regset object
  310. 2 at: index of regex array (zero origin)
  311. # OnigRegion* onig_regset_get_region(OnigRegSet* set, int at)
  312. Returns the region object corresponding to the at-th regex.
  313. arguments
  314. 1 set: regset object
  315. 2 at: index of regex array (zero origin)
  316. # 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)
  317. Perform a search with regset.
  318. return value:
  319. normal return: index of match regex (zero origin)
  320. not found: ONIG_MISMATCH (< 0)
  321. error: error code (< 0)
  322. arguments
  323. 1 set: regset object
  324. 2 str: target string
  325. 3 end: terminate address of target string
  326. 4 start: search start address of target string
  327. 5 range: search terminate address of target string
  328. 6 lead: outer loop element
  329. ONIG_REGSET_POSITION_LEAD (returns most left position)
  330. ONIG_REGSET_REGEX_LEAD (returns most left position)
  331. ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
  332. 7 option: search time option
  333. ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line
  334. ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line
  335. 8 rmatch_pos: return address of match position (match_address - str)
  336. * ONIG_REGSET_POSITION_LEAD and ONIG_REGSET_REGEX_LEAD return the same result.
  337. These differences only appear in search time.
  338. In most cases, ONIG_REGSET_POSITION_LEAD seems to be faster.
  339. # 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)
  340. Perform a search with regset and match-params.
  341. return value:
  342. normal return: index of match regex (zero origin)
  343. not found: ONIG_MISMATCH (< 0)
  344. error: error code (< 0)
  345. arguments
  346. 1 set: regset object
  347. 2 str: target string
  348. 3 end: terminate address of target string
  349. 4 start: search start address of target string
  350. 5 range: search terminate address of target string
  351. 6 lead: outer loop element
  352. ONIG_REGSET_POSITION_LEAD (returns most left position)
  353. ONIG_REGSET_REGEX_LEAD (returns most left position)
  354. ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
  355. 7 option: search time option
  356. ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line
  357. ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line
  358. 8 mps: array of match-params
  359. 9 rmatch_pos: return address of match position (match_address - str)
  360. # OnigRegion* onig_region_new(void)
  361. Create a region.
  362. # void onig_region_free(OnigRegion* region, int free_self)
  363. Free memory used by region.
  364. arguments
  365. 1 region: target region
  366. 2 free_self: [1: free all, 0: free memory used in region but not self]
  367. # void onig_region_copy(OnigRegion* to, OnigRegion* from)
  368. Copy contents of region.
  369. arguments
  370. 1 to: target region
  371. 2 from: source region
  372. # void onig_region_clear(OnigRegion* region)
  373. Clear contents of region.
  374. arguments
  375. 1 region: target region
  376. # int onig_region_resize(OnigRegion* region, int n)
  377. Resize group range area of region.
  378. normal return: ONIG_NORMAL
  379. arguments
  380. 1 region: target region
  381. 2 n: new size
  382. # int onig_name_to_group_numbers(regex_t* reg, const UChar* name, const UChar* name_end,
  383. int** num_list)
  384. Return the group number list of the name.
  385. Named subexp is defined by (?<name>....).
  386. normal return: number of groups for the name.
  387. (ex. /(?<x>..)(?<x>..)/ ==> 2)
  388. name not found: -1
  389. arguments
  390. 1 reg: regex object.
  391. 2 name: group name.
  392. 3 name_end: terminate address of group name.
  393. 4 num_list: return list of group number.
  394. # int onig_name_to_backref_number(regex_t* reg, const UChar* name, const UChar* name_end,
  395. OnigRegion *region)
  396. Return the group number corresponding to the named backref (\k<name>).
  397. If two or more regions for the groups of the name are effective,
  398. the greatest number in it is obtained.
  399. normal return: group number.
  400. arguments
  401. 1 reg: regex object.
  402. 2 name: group name.
  403. 3 name_end: terminate address of group name.
  404. 4 region: search/match result region.
  405. # int onig_foreach_name(regex_t* reg,
  406. int (*func)(const UChar*, const UChar*, int,int*,regex_t*,void*),
  407. void* arg)
  408. Iterate function call for all names.
  409. normal return: 0
  410. error: func's return value.
  411. arguments
  412. 1 reg: regex object.
  413. 2 func: callback function.
  414. func(name, name_end, <number of groups>, <group number's list>,
  415. reg, arg);
  416. if func does not return 0, then iteration is stopped.
  417. 3 arg: argument for func.
  418. # int onig_number_of_names(regex_t* reg)
  419. Return the number of names defined in the pattern.
  420. Multiple definitions of one name is counted as one.
  421. arguments
  422. 1 reg: regex object.
  423. # OnigEncoding onig_get_encoding(regex_t* reg)
  424. # OnigOptionType onig_get_options(regex_t* reg)
  425. # OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg)
  426. # OnigSyntaxType* onig_get_syntax(regex_t* reg)
  427. Return a value of the regex object.
  428. arguments
  429. 1 reg: regex object.
  430. # int onig_number_of_captures(regex_t* reg)
  431. Return the number of capture group in the pattern.
  432. arguments
  433. 1 reg: regex object.
  434. # int onig_number_of_capture_histories(regex_t* reg)
  435. Return the number of capture history defined in the pattern.
  436. You can't use capture history if ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY
  437. is disabled in the pattern syntax.(disabled in the default syntax)
  438. arguments
  439. 1 reg: regex object.
  440. # OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region)
  441. Return the root node of capture history data tree.
  442. This value is undefined if matching has faild.
  443. arguments
  444. 1 region: matching result.
  445. # int onig_capture_tree_traverse(OnigRegion* region, int at,
  446. int(*func)(int,int,int,int,int,void*), void* arg)
  447. Traverse and callback in capture history data tree.
  448. normal return: 0
  449. error: callback func's return value.
  450. arguments
  451. 1 region: match region data.
  452. 2 at: callback position.
  453. ONIG_TRAVERSE_CALLBACK_AT_FIRST: callback first, then traverse children.
  454. ONIG_TRAVERSE_CALLBACK_AT_LAST: traverse children first, then callback.
  455. ONIG_TRAVERSE_CALLBACK_AT_BOTH: callback first, then traverse children,
  456. and at last callback again.
  457. 3 func: callback function.
  458. if func does not return 0, then traverse is stopped.
  459. int func(int group, int beg, int end, int level, int at,
  460. void* arg)
  461. group: group number
  462. beg: capture start position
  463. end: capture end position
  464. level: nest level (from 0)
  465. at: callback position
  466. ONIG_TRAVERSE_CALLBACK_AT_FIRST
  467. ONIG_TRAVERSE_CALLBACK_AT_LAST
  468. arg: optional callback argument
  469. 4 arg; optional callback argument.
  470. # int onig_noname_group_capture_is_active(regex_t* reg)
  471. Return noname group capture activity.
  472. active: 1
  473. inactive: 0
  474. arguments
  475. 1 reg: regex object.
  476. if option ONIG_OPTION_DONT_CAPTURE_GROUP == ON
  477. --> inactive
  478. if the regex pattern have named group
  479. and syntax ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP == ON
  480. and option ONIG_OPTION_CAPTURE_GROUP == OFF
  481. --> inactive
  482. else --> active
  483. # UChar* onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s)
  484. Return previous character head address.
  485. arguments
  486. 1 enc: character encoding
  487. 2 start: string address
  488. 3 s: target address of string
  489. # UChar* onigenc_get_left_adjust_char_head(OnigEncoding enc,
  490. const UChar* start, const UChar* s)
  491. Return left-adjusted head address of a character.
  492. arguments
  493. 1 enc: character encoding
  494. 2 start: string address
  495. 3 s: target address of string
  496. # UChar* onigenc_get_right_adjust_char_head(OnigEncoding enc,
  497. const UChar* start, const UChar* s)
  498. Return right-adjusted head address of a character.
  499. arguments
  500. 1 enc: character encoding
  501. 2 start: string address
  502. 3 s: target address of string
  503. # int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end)
  504. Return number of characters in the string.
  505. # int onigenc_strlen_null(OnigEncoding enc, const UChar* s)
  506. Return number of characters in the string.
  507. Do not pass invalid byte string in the character encoding.
  508. # int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
  509. Return number of bytes in the string.
  510. Do not pass invalid byte string in the character encoding.
  511. # int onig_set_default_syntax(OnigSyntaxType* syntax)
  512. Set default syntax.
  513. arguments
  514. 1 syntax: address of pattern syntax definition.
  515. # void onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from)
  516. Copy syntax.
  517. arguments
  518. 1 to: destination address.
  519. 2 from: source address.
  520. # unsigned int onig_get_syntax_op(OnigSyntaxType* syntax)
  521. # unsigned int onig_get_syntax_op2(OnigSyntaxType* syntax)
  522. # unsigned int onig_get_syntax_behavior(OnigSyntaxType* syntax)
  523. # OnigOptionType onig_get_syntax_options(OnigSyntaxType* syntax)
  524. # void onig_set_syntax_op(OnigSyntaxType* syntax, unsigned int op)
  525. # void onig_set_syntax_op2(OnigSyntaxType* syntax, unsigned int op2)
  526. # void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior)
  527. # void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options)
  528. Get/Set elements of the syntax.
  529. arguments
  530. 1 syntax: syntax
  531. 2 op, op2, behavior, options: value of element.
  532. # void onig_copy_encoding(OnigEncoding to, OnigEncoding from)
  533. Copy encoding.
  534. arguments
  535. 1 to: destination address.
  536. 2 from: source address.
  537. # int onig_set_meta_char(OnigSyntaxType* syntax, unsigned int what,
  538. OnigCodePoint code)
  539. Set a variable meta character to the code point value.
  540. Except for an escape character, this meta characters specification
  541. is not work, if ONIG_SYN_OP_VARIABLE_META_CHARACTERS is not effective
  542. by the syntax. (Build-in syntaxes are not effective.)
  543. normal return: ONIG_NORMAL
  544. arguments
  545. 1 syntax: target syntax
  546. 2 what: specifies which meta character it is.
  547. ONIG_META_CHAR_ESCAPE
  548. ONIG_META_CHAR_ANYCHAR
  549. ONIG_META_CHAR_ANYTIME
  550. ONIG_META_CHAR_ZERO_OR_ONE_TIME
  551. ONIG_META_CHAR_ONE_OR_MORE_TIME
  552. ONIG_META_CHAR_ANYCHAR_ANYTIME
  553. 3 code: meta character or ONIG_INEFFECTIVE_META_CHAR.
  554. # OnigCaseFoldType onig_get_default_case_fold_flag()
  555. Get default case fold flag.
  556. # int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
  557. Set default case fold flag.
  558. 1 case_fold_flag: case fold flag
  559. # unsigned int onig_get_match_stack_limit_size(void)
  560. Return the maximum number of stack size.
  561. (default: 0 == unlimited)
  562. # int onig_set_match_stack_limit_size(unsigned int size)
  563. Set the maximum number of stack size.
  564. (size = 0: unlimited)
  565. normal return: ONIG_NORMAL
  566. # unsigned long onig_get_retry_limit_in_match(void)
  567. Return the limit of retry counts in matching process.
  568. (default: 10000000)
  569. normal return: limit value
  570. # int onig_set_retry_limit_in_match(unsigned long n)
  571. Set the limit of retry counts in matching process.
  572. normal return: ONIG_NORMAL
  573. # OnigCalloutFunc onig_get_progress_callout(void)
  574. Get a function for callouts of contents in progress.
  575. # int onig_set_progress_callout(OnigCalloutFunc f)
  576. Set a function for callouts of contents in progress.
  577. If 0 (NULL) is set, never called in progress.
  578. normal return: ONIG_NORMAL
  579. # OnigCalloutFunc onig_get_retraction_callout(void)
  580. Get a function for callouts of contents in retraction (backtrack).
  581. # int onig_set_retraction_callout(OnigCalloutFunc f)
  582. Set a function for callouts of contents in retraction (backtrack).
  583. If 0 (NULL) is set, never called in retraction.
  584. normal return: ONIG_NORMAL
  585. # int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges))
  586. Define new Unicode property.
  587. (This function is not thread safe.)
  588. arguments
  589. 1 name: property name (ASCII only. character ' ', '-', '_' are ignored.)
  590. 2 ranges: property code point ranges
  591. (first element is number of ranges.)
  592. [num-of-ranges, 1st-range-start, 1st-range-end, 2nd-range-start... ]
  593. * Don't destroy the ranges after having called this function.
  594. normal return: ONIG_NORMAL
  595. # unsigned int onig_get_parse_depth_limit(void)
  596. Return the maximum depth of parser recursion.
  597. (default: DEFAULT_PARSE_DEPTH_LIMIT defined in regint.h. Currently 4096.)
  598. # int onig_set_parse_depth_limit(unsigned int depth)
  599. Set the maximum depth of parser recursion.
  600. (depth = 0: Set to the default value defined in regint.h.)
  601. normal return: ONIG_NORMAL
  602. # int onig_end(void)
  603. The use of this library is finished.
  604. normal return: ONIG_NORMAL
  605. It is not allowed to use regex objects which created
  606. before onig_end() call.
  607. # const char* onig_version(void)
  608. Return version string. (ex. "5.0.3")
  609. // END