From 83ea1be016fd5fc27ee721cf62a18716675815dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 2 May 2018 17:28:55 +0200 Subject: New upstream version 6.8.2 --- doc/CALLOUTS.API | 385 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/CALLOUTS.API.ja | 382 +++++++++++++++++++++++++++++++++++++++++++++++ doc/CALLOUTS.BUILTIN | 35 +++-- doc/CALLOUTS.BUILTIN.ja | 17 ++- doc/RE | 23 ++- doc/RE.ja | 22 ++- 6 files changed, 835 insertions(+), 29 deletions(-) create mode 100644 doc/CALLOUTS.API create mode 100644 doc/CALLOUTS.API.ja (limited to 'doc') diff --git a/doc/CALLOUTS.API b/doc/CALLOUTS.API new file mode 100644 index 0000000..6003532 --- /dev/null +++ b/doc/CALLOUTS.API @@ -0,0 +1,385 @@ +Callouts API Version 6.8.2 2018/04/14 + +#include + +(1) Callout functions +(2) Set/Get functions for Callouts of contents +(3) Set functions for Callouts of name +(4) User data +(5) Get values from OnigCalloutArgs +(6) Tag +(7) Callout data (used in callout functions) +(8) Callout data (used in applications) +(9) Miscellaneous functions + + +(1) Callout functions + + type: OnigCalloutFunc + + typedef int (*OnigCalloutFunc)(OnigCalloutArgs* args, void* user_data); + + If 0 (NULL) is set as a callout function value, never called. + + + * Callout function return value (int) + + ONIG_CALLOUT_FAIL(1): fail + ONIG_CALLOUT_SUCCESS(0): success + less than -1: error code (terminate search/match) + + ONIG_CALLOUT_FAIL/SUCCESS values are ignored in retractions, + because retraction is a part of recovery process after failure. + + * Example of callout function + + extern int always_success(OnigCalloutArgs* args, void* user_data) + { + return ONIG_CALLOUT_SUCCESS; + } + + + +(2) Set/Get functions for Callouts of contents + +# OnigCalloutFunc onig_get_progress_callout(void) + + Get a function for callouts of contents in progress. + + +# int onig_set_progress_callout(OnigCalloutFunc f) + + Set a function for callouts of contents in progress. + This value set in onig_initialize_match_param() as a default + callout function. + + normal return: ONIG_NORMAL + + +# OnigCalloutFunc onig_get_retraction_callout(void) + + Get a function for callouts of contents in retraction (backtrack). + + +# int onig_set_retraction_callout(OnigCalloutFunc f) + + Set a function for callouts of contents in retraction (backtrack). + This value set in onig_initialize_match_param() as a default + callout function. + + normal return: ONIG_NORMAL + + +# int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) + + Set a function for callouts of contents in progress. + + arguments + 1 mp: match-param pointer + 2 f: function + + normal return: ONIG_NORMAL + + +# int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) + + Set a function for callouts of contents in retraction (backtrack). + + arguments + 1 mp: match-param pointer + 2 f: function + + normal return: ONIG_NORMAL + + + +(3) Set functions for Callouts of name + +# int onig_set_callout_of_name(OnigEncoding enc, OnigCalloutType type, OnigUChar* name, OnigUChar* name_end, int callout_in, OnigCalloutFunc callout, OnigCalloutFunc end_callout, int arg_num, unsigned int arg_types[], int opt_arg_num, OnigValue opt_defaults[]) + + Set a function for callouts of name. + Allowed name string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) + + (enc, name) pair is used as key value to find callout function. + You have to call this function for every encoding used in your applications. + But if enc is ASCII compatible and (enc, name) entry is not found, + then (ASCII, name) entry is used. + Therefore, if you use ASCII compatible encodings only, it is enough to call + this function one time for (ASCII, name). + + arguments + 1 enc: character encoding + 2 type: callout type (currently ONIG_CALLOUT_TYPE_SINGLE only supported) + 3 name: name string address (the string is encoded by enc) + 4 name_end: name string end address + 5 callout_in: direction (ONIG_CALLOUT_IN_PROGRESS/RETRACTION/BOTH) + 6 callout: callout function + 7 end_callout: * not used currently (set 0) + 8 arg_num: number of arguments (*limit by ONIG_CALLOUT_MAX_ARGS_NUM == 4) + 9 arg_types: type array of arguments + 10 opt_arg_num: number of optional arguments + 11 opt_defaults: default values array of optional arguments + + normal return: ONIG_NORMAL + error: + ONIGERR_INVALID_CALLOUT_NAME + ONIGERR_INVALID_ARGUMENT + ONIGERR_INVALID_CALLOUT_ARG + + + +(4) User data + +# int onig_set_callout_user_data_of_match_param(OnigMatchParam* param, void* user_data) + + Set a user_data value which passed as second argument of callout. + + normal return: ONIG_NORMAL + + + +(5) Get values from OnigCalloutArgs + +# int onig_get_callout_num_by_callout_args(OnigCalloutArgs* args) + + Returns callout number of this callout. + "Callout number" is an identifier of callout in a regex pattern. + + +# OnigCalloutIn onig_get_callout_in_by_callout_args(OnigCalloutArgs* args) + + Returns the direction of this callout. + (ONIG_CALLOUT_IN_PROGRESS or ONIG_CALLOUT_IN_RETRACTION) + + +# int onig_get_name_id_by_callout_args(OnigCalloutArgs* args) + + Returns the name identifier of this callout. + If this callout is callout of contents, then returns ONIG_NON_NAME_ID. + + +# const OnigUChar* onig_get_contents_by_callout_args(OnigCalloutArgs* args) + + Returns the contents string of this callout. (NULL terminated string) + If this callout is callout of name, then returns NULL. + + +# const OnigUChar* onig_get_contents_end_by_callout_args(OnigCalloutArgs* args) + + Returns the end of contents string of this callout. + If this callout is callout of name, then returns NULL. + + +# int onig_get_args_num_by_callout_args(OnigCalloutArgs* args) + + Returns the number of args of this callout. + It includes optional arguments that doesn't passed in regex pattern. + If this callout is callout of contents, then returns + ONIGERR_INVALID_ARGUMENT. + + +# int onig_get_passed_args_num_by_callout_args(OnigCalloutArgs* args) + + Returns the number of args that passed really in regex pattern. + If this callout is callout of contents, then returns + ONIGERR_INVALID_ARGUMENT. + + +# int onig_get_arg_by_callout_args(OnigCalloutArgs* args, int index, OnigType* type, OnigValue* val) + + Returns a value and a type of the callout argument. + If this callout is callout of contents, then returns + ONIGERR_INVALID_ARGUMENT. + + normal return: ONIG_NORMAL + + +# const OnigUChar* onig_get_string_by_callout_args(OnigCalloutArgs* args) + + Returns the subject string adress. + This is the second argument(str) of onig_search(). + + +# const OnigUChar* onig_get_string_end_by_callout_args(OnigCalloutArgs* args) + + Returns the end address of subject string. + This is the third argument(end) of onig_search(). + + +# const OnigUChar* onig_get_start_by_callout_args(OnigCalloutArgs* args) + + Returns the start address of subject string in current match process. + + +# const OnigUChar* onig_get_right_range_by_callout_args(OnigCalloutArgs* args) + + Returns the right range address of subject string. + + +# const OnigUChar* onig_get_current_by_callout_args(OnigCalloutArgs* args) + + Returns the current address of subject string in current match process. + + +# OnigRegex onig_get_regex_by_callout_args(OnigCalloutArgs* args) + + Returns the regex object address of this callout. + + +# unsigned long onig_get_retry_counter_by_callout_args(OnigCalloutArgs* args) + + Returns the current counter value for retry-limit-in-match. + + + +(6) Tag + + "Tag" is a name assigned to a callout in regexp pattern. + Allowed tag string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) + + +# int onig_callout_tag_is_exist_at_callout_num(OnigRegex reg, int callout_num) + + Returns 1 if tag is assigned for the callout, else returns 0. + + +# int onig_get_callout_num_by_tag(OnigRegex reg, const OnigUChar* tag, const OnigUChar* tag_end) + + Returns the callout number for the tag. + + +# const OnigUChar* onig_get_callout_tag_start(OnigRegex reg, int callout_num) + + Returns the start address of tag string for the callout. + (NULL terminated string) + + +# const OnigUChar* onig_get_callout_tag_end(OnigRegex reg, int callout_num) + + Returns the end address of tag string for the callout. + + + +(7) Callout data (used in callout functions) + + "Callout data" is ONIG_CALLOUT_DATA_SLOT_NUM(5) values area + for each callout in each search process. + Each value area in a callout is indicated by "slot" number (0 - 4). + Callout data are used for any purpose by callout function implementers. + + +# int onig_get_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType* type, OnigValue* val) + + Returns the callout data value/type for a callout slot indicated by + callout_num/slot. + + normal return: ONIG_NORMAL + 1: not yet set (type is ONIG_TYPE_VOID) + < 0: error code + + +# int onig_get_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) + + Returns self callout data value/type. + + normal return: ONIG_NORMAL + 1: not yet set (type is ONIG_TYPE_VOID) + < 0: error code + + +# int onig_set_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType type, OnigValue* val) + + Set the callout data value/type for a callout slot indicated by callout_num/slot. + + normal return: ONIG_NORMAL + < 0: error code + + +# int onig_set_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType type, OnigValue* val) + + Set self callout data value/type for a callout slot indicated by slot. + + normal return: ONIG_NORMAL + < 0: error code + + +# int onig_get_callout_data_by_callout_args_self_dont_clear_old(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) + + This function is almost same as onig_get_callout_data_by_callout_args_self(). + But this function doesn't clear values which set in previous failed match process. + Other onig_get_callout_data_xxxx() functions clear all values which set + in previous failed match process. + + For example, Builtin callout (*TOTAL_COUNT) is implemented by using this + function for accumulate count of all of match processes in a search process. + Builtin callout (*COUNT) returns count in last success match process only, + because it doesn't use this function. + + +(8) Callout data (used in apllications) + +# int onig_get_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) + + Returns the callout data value/type for a callout slot indicated by + callout_num/slot. + + normal return: ONIG_NORMAL + 1: not yet set (type is ONIG_TYPE_VOID) + < 0: error code + + +# int onig_get_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType* type, OnigValue* val) + + Returns the callout data value/type for a callout slot indicated by tag/slot. + + normal return: ONIG_NORMAL + 1: not yet set (type is ONIG_TYPE_VOID) + < 0: error code + + +# int onig_set_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType type, OnigValue* val) + + Set the callout data value/type for a callout slot indicated by callout_num/slot. + + normal return: ONIG_NORMAL + < 0: error code + + +# int onig_set_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType type, OnigValue* val) + + Set the callout data value/type for a callout slot indicated by tag/slot. + + normal return: ONIG_NORMAL + < 0: error code + + +# int onig_get_callout_data_dont_clear_old(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) + + No needs to use this function. + It will be abolished. + + + +(9) Miscellaneous functions + +# OnigUChar* onig_get_callout_name_by_name_id(int name_id) + + Returns callout name of the name id. + if invalid name id is passed, return 0. + + +# int onig_get_capture_range_in_callout(OnigCalloutArgs* args, int mem_num, int* begin, int* end) + + Returns current capture range position. + Position is byte length offset from subject string. + For uncaptured mem_num, ONIG_REGION_NOTPOS is set. + + +# int onig_get_used_stack_size_in_callout(OnigCalloutArgs* args, int* used_num, int* used_bytes) + + Returns current used match-stack size. + + used_num: number of match-stack elements + used_bytes: used byte size of match-stack + +//END diff --git a/doc/CALLOUTS.API.ja b/doc/CALLOUTS.API.ja new file mode 100644 index 0000000..49d0689 --- /dev/null +++ b/doc/CALLOUTS.API.ja @@ -0,0 +1,382 @@ +Callouts API Version 6.8.2 2018/04/13 + +#include + +(1) 呼び出し関数 +(2) 内容の呼び出し関数の設定/取得 +(3) 名前の呼び出し関数の設定 +(4) ユーザデータ +(5) OnigCalloutArgsからの値の取得 +(6) 名札 +(7) 呼び出しデータ (呼び出し関数内から使用される) +(8) 呼び出しデータ (アプリケーションから使用される) +(9) その他の関数 + + +(1) 呼び出し関数 + + 型: OnigCalloutFunc + + typedef int (*OnigCalloutFunc)(OnigCalloutArgs* args, void* user_data); + + 若し呼び出し関数として0(NULL)がセットされると、呼ばれることはない + + + * 呼び出し関数の戻り値 (int) + + ONIG_CALLOUT_FAIL(1): 失敗 + ONIG_CALLOUT_SUCCESS(0): 成功 + -1未満: エラーコード (検索/照合の終了) + + ONIG_CALLOUT_FAIL/SUCCESSは、後退中の呼び出しでは無視される。 + 後退は失敗の回復過程なので。 + + * 呼び出し関数の例 + + extern int always_success(OnigCalloutArgs* args, void* user_data) + { + return ONIG_CALLOUT_SUCCESS; + } + + + +(2) 内容の呼び出し関数の設定/取得 + +# OnigCalloutFunc onig_get_progress_callout(void) + + 内容の呼び出し関数(前進)を返す + + +# int onig_set_progress_callout(OnigCalloutFunc f) + + 内容の呼び出し関数(前進)をセットする。 + この値はonig_initialize_match_param()の中でデフォルトの呼び出し関数として + セットされる。 + + 正常終了: ONIG_NORMAL + + +# OnigCalloutFunc onig_get_retraction_callout(void) + + 内容の呼び出し関数(後退)を返す + + +# int onig_set_retraction_callout(OnigCalloutFunc f) + + 内容の呼び出し関数(後退)をセットする。 + この値はonig_initialize_match_param()の中でデフォルトの呼び出し関数として + セットされる。 + + 正常終了: ONIG_NORMAL + + +# int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) + + 内容の呼び出し関数(前進)をセットする。 + + 引数 + 1 mp: match-paramアドレス + 2 f: 関数 + + 正常終了: ONIG_NORMAL + + +# int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) + + 内容の呼び出し関数(後退)をセットする。 + + 引数 + 1 mp: match-paramアドレス + 2 f: 関数 + + 正常終了: ONIG_NORMAL + + + +(3) 名前の呼び出し関数の設定 + +# int onig_set_callout_of_name(OnigEncoding enc, OnigCalloutType type, OnigUChar* name, OnigUChar* name_end, int callout_in, OnigCalloutFunc callout, OnigCalloutFunc end_callout, int arg_num, unsigned int arg_types[], int opt_arg_num, OnigValue opt_defaults[]) + + 名前の呼び出し関数をセットする。 + 名前に許される文字: _ A-Z a-z 0-9 (* 最初の文字: _ A-Z a-z) + + (enc, name)のペアが、呼び出し関数を見つけるためのキーとして使用される。 + アプリケーションで使用される各エンコーディングに対してこの関数を呼ぶ必要がある。 + しかし若しencエンコーディングがASCII互換であり、(enc, name)に対するエントリが + 見つからない場合には、(ASCII, name)エントリが参照される。 + 従って、若しASCII互換エンコーディングのみ使用している場合には、この関数を(ASCII, name) + について一回呼べば十分である。 + + 引数 + 1 enc: 文字エンコーディング + 2 type: 呼び出し型 (現在は ONIG_CALLOUT_TYPE_SINGLE のみサポート) + 3 name: 名前のアドレス (encでエンコーディングされている文字列) + 4 name_end: 名前の終端アドレス + 5 callout_in: 方向フラグ (ONIG_CALLOUT_IN_PROGRESS/RETRACTION/BOTH) + 6 callout: 呼び出し関数 + 7 end_callout: *まだ使用していない (0をセット) + 8 arg_num: 引数の数 (* 最大値 ONIG_CALLOUT_MAX_ARGS_NUM == 4) + 9 arg_types: 引数の型の配列 + 10 opt_arg_num: オプション引数の数 + 11 opt_defaults: オプション引数のデフォルト値 + + 正常終了: ONIG_NORMAL + error: + ONIGERR_INVALID_CALLOUT_NAME + ONIGERR_INVALID_ARGUMENT + ONIGERR_INVALID_CALLOUT_ARG + + + +(4) ユーザデータ + +# int onig_set_callout_user_data_of_match_param(OnigMatchParam* param, void* user_data) + + 呼び出し関数の引数として渡されるユーザデータをセットする。 + + 正常終了: ONIG_NORMAL + + + +(5) OnigCalloutArgsからの値の取得 + +# int onig_get_callout_num_by_callout_args(OnigCalloutArgs* args) + + この呼び出しの呼び出し番号を返す。 + "呼び出し番号"とは、正規表現パターンの中の呼び出しに対する識別子である。 + + +# OnigCalloutIn onig_get_callout_in_by_callout_args(OnigCalloutArgs* args) + + この呼び出しが起きた時の方向(前進中/後退中)を返す。 + (ONIG_CALLOUT_IN_PROGRESS か ONIG_CALLOUT_IN_RETRACTION) + + +# int onig_get_name_id_by_callout_args(OnigCalloutArgs* args) + + この呼び出しの名前(name)の識別子を返す。 + 若しこの呼び出しが内容の呼び出しのときには、ONIG_NON_NAME_IDが返される。 + + +# const OnigUChar* onig_get_contents_by_callout_args(OnigCalloutArgs* args) + + この呼び出しの内容文字列(NULL終端あり)を返す。 + 若しこの呼び出しが名前の呼び出しのときには、NULLを返す。 + + +# const OnigUChar* onig_get_contents_end_by_callout_args(OnigCalloutArgs* args) + + この呼び出しの内容(contents)の終端を返す。 + 若しこの呼び出しが名前の呼び出しのときには、NULLを返す。 + + +# int onig_get_args_num_by_callout_args(OnigCalloutArgs* args) + + この呼び出しの引数の数を返す。 + 正規表現パターンの中で渡されなかったオプション引数も含む。 + 若しこの呼び出しが内容の呼び出しのときには、ONIGERR_INVALID_ARGUMENTが返される。 + + +# int onig_get_passed_args_num_by_callout_args(OnigCalloutArgs* args) + + この呼び出しの本当に渡された引数の数を返す。 + 若しこの呼び出しが内容の呼び出しのときには、ONIGERR_INVALID_ARGUMENTが返される。 + + +# int onig_get_arg_by_callout_args(OnigCalloutArgs* args, int index, OnigType* type, OnigValue* val) + + この呼び出しの一個の引数の値と型を返す。 + 若しこの呼び出しが内容の呼び出しのときには、ONIGERR_INVALID_ARGUMENTが返される。 + + 正常終了: ONIG_NORMAL + + +# const OnigUChar* onig_get_string_by_callout_args(OnigCalloutArgs* args) + + 対象文字列のアドレスを返す。 + onig_search()の二番目の引数(str)である。 + + +# const OnigUChar* onig_get_string_end_by_callout_args(OnigCalloutArgs* args) + + 対象文字列の終端アドレスを返す。 + onig_search()の三番目の引数(end)である。 + + +# const OnigUChar* onig_get_start_by_callout_args(OnigCalloutArgs* args) + + 対象文字列の現在の照合処理開始アドレスを返す。 + + +# const OnigUChar* onig_get_right_range_by_callout_args(OnigCalloutArgs* args) + + 対象文字列の現在の照合範囲アドレスを返す。 + + +# const OnigUChar* onig_get_current_by_callout_args(OnigCalloutArgs* args) + + 対象文字列の現在の照合位置アドレスを返す。 + + +# OnigRegex onig_get_regex_by_callout_args(OnigCalloutArgs* args) + + この呼び出しの正規表現オブジェクトのアドレスを返す。 + + +# unsigned long onig_get_retry_counter_by_callout_args(OnigCalloutArgs* args) + + retry-limit-in-matchのためのリトライカウンタの現在値を返す。 + + + +(6) 名札 + + "Tag" (名札)とは、正規表現パターンの中で呼び出しに割り当てられた名前である。 + tag文字列に使用できる文字: _ A-Z a-z 0-9 (* 先頭の文字: _ A-Z a-z) + + +# int onig_callout_tag_is_exist_at_callout_num(OnigRegex reg, int callout_num) + + その呼び出しにtagが割り当てられていれば1を返す、そうでなければ0を返す。 + + +# const OnigUChar* onig_get_callout_tag_start(OnigRegex reg, int callout_num) + + その呼び出しに対するtag文字列(NULL終端あり)の先頭アドレスを返す。 + + +# const OnigUChar* onig_get_callout_tag_end(OnigRegex reg, int callout_num) + + その呼び出しに対するtag文字列の終端アドレスを返す。 + + +# int onig_get_callout_num_by_tag(OnigRegex reg, const OnigUChar* tag, const OnigUChar* tag_end) + + そのtagに対する呼び出し番号を返す。 + + + +(7) 呼び出しデータ (呼び出し関数内から使用される) + + "呼び出しデータ" (callout data)とは、 + それぞれの呼び出しに対してそれぞれの検索処理の中で割り当てられた、 + ONIG_CALLOUT_DATA_SLOT_NUM(== 5)個の値の領域である。 + 一個の呼び出しに対する各値の領域は、"スロット"(slot)番号(0 - 4)によって示される。 + 呼び出しデータは呼び出し関数の実装者によって任意の目的に使用される。 + + +# int onig_get_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType* type, OnigValue* val) + + callout_num/slotによって示された呼び出しスロットに対するデータの値/型を返す。 + + 正常終了: ONIG_NORMAL + 1: 値が未セット (typeは ONIG_TYPE_VOID) + < 0: エラーコード + + +# int onig_get_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) + + 自分自身の呼び出しのslotによって示されたスロットに対するデータの値/型を返す。 + + 正常終了: ONIG_NORMAL + 1: 値が未セット (typeは ONIG_TYPE_VOID) + < 0: エラーコード + + +# int onig_set_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType type, OnigValue* val) + + callout_num/slotによって示された呼び出しスロットに対する値/型をセットする。。 + + 正常終了: ONIG_NORMAL + < 0: エラーコード + + +# int onig_set_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType type, OnigValue* val) + + 自分自身の呼び出しのslotによって示されたスロットに対する値/型をセットする。。 + + 正常終了: ONIG_NORMAL + < 0: エラーコード + + +# int onig_get_callout_data_by_callout_args_self_dont_clear_old(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) + + この関数は、onig_get_callout_data_by_callout_args_self()とほぼ同じである。 + しかしこの関数は、現在の照合処理以前の失敗した照合処理の中でセットされた値を + クリアしない。 + 他のonig_get_callout_data_xxxx()関数は、以前の失敗した照合処理の中でセットされた値を + クリアする。 + + 例えば、組み込み呼び出し(*TOTAL_COUNT)は、検索処理の中の全ての照合処理の積算カウントを + 得るためにこの関数を使用して実装されている。 + 組み込む呼び出し(*COUNT)は、この関数を使用しないので、最後の成功した照合処理だけの + カウントを返す。 + + + +(8) 呼び出しデータ (アプリケーションから使用される) + +# int onig_get_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) + + callout_num/slotによって示された呼び出しスロットに対するデータの値/型を返す。 + + 正常終了: ONIG_NORMAL + 1: 値が未セット (typeは ONIG_TYPE_VOID) + < 0: エラーコード + + +# int onig_get_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType* type, OnigValue* val) + + tag/slotによって示された呼び出しスロットに対するデータの値/型を返す。 + + 正常終了: ONIG_NORMAL + 1: 値が未セット (typeは ONIG_TYPE_VOID) + < 0: エラーコード + + +# int onig_set_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType type, OnigValue* val) + + callout_num/slotによって示された呼び出しスロットに対する値/型をセットする。。 + + 正常終了: ONIG_NORMAL + < 0: エラーコード + + +# int onig_set_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType type, OnigValue* val) + + tag/slotによって示された呼び出しスロットに対する値/型をセットする。。 + + 正常終了: ONIG_NORMAL + < 0: エラーコード + + +# int onig_get_callout_data_dont_clear_old(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) + + この関数を使用する必要はないと思われる。 + 廃止予定。 + + + +(9) その他の関数 + +# OnigUChar* onig_get_callout_name_by_name_id(int name_id) + + 名前の識別子に対する名前を返す。 + 不正な識別子が渡された場合には0を返す。 + + +# int onig_get_capture_range_in_callout(OnigCalloutArgs* args, int mem_num, int* begin, int* end) + + 現在の捕獲範囲を返す。 + 位置は、対象文字列に対するバイト単位で表される。 + 未捕獲のmem_numに対しては、ONIG_REGION_NOTPOSがセットされる。 + + +# int onig_get_used_stack_size_in_callout(OnigCalloutArgs* args, int* used_num, int* used_bytes) + + 現在使用されている照合処理用スタックサイズを返す。 + + used_num: 要素数 + used_bytes: バイト数 + +//END diff --git a/doc/CALLOUTS.BUILTIN b/doc/CALLOUTS.BUILTIN index dcf87f8..26840e7 100644 --- a/doc/CALLOUTS.BUILTIN +++ b/doc/CALLOUTS.BUILTIN @@ -1,4 +1,4 @@ -CALLOUTS.BUILTIN 2018/03/19 +CALLOUTS.BUILTIN 2018/03/26 * FAIL (progress) @@ -12,15 +12,15 @@ CALLOUTS.BUILTIN 2018/03/19 (*MISMATCH) - Terminate Match process. - Continue Search process. + Terminates Match process. + Continues Search process. * ERROR (progress) (*ERROR{n::LONG}) - Terminate Search/Match process. + Terminates Search/Match process. Return value is the argument 'n'. (The value must be less than -1) 'n' is an optional argument. (default value is ONIG_ABORT) @@ -28,12 +28,20 @@ CALLOUTS.BUILTIN 2018/03/19 * MAX (progress/retraction) - (*MAX{n::LONG}) + (*MAX{n::LONG/TAG, c::CHAR}) + + Restricts the maximum count of success(default), progress or retraction. + If 'n' type is tag, slot 0 value of the tag are used. + Depends on 'c' argument, the slot 0 value changes. + 'c' is an optional argument, default value is 'X'. + + (* success count = progress count - retraction count) - Restrict the maximum count of success. + + ex. "(?:(*COUNT[T]{X})a)*(?:(*MAX{T})c)*" [callout data] - slot 0: current success count. + slot 0: '>': progress count, '<': retraction count, 'X': success count (default) * COUNT (progress/retraction) @@ -42,15 +50,13 @@ CALLOUTS.BUILTIN 2018/03/19 Counter. Depends on 'c' argument, the slot 0 value changes. - 'c' is an optional argument, deefault value is '>'. + 'c' is an optional argument, default value is '>'. [callout data] - slot 0: '>': progress count, '<': retraction count, 'X': success count + slot 0: '>': progress count (default), '<': retraction count, 'X': success count slot 1: progress count slot 2: retraction count - (* success count = progress count - retraction count) - ** If option ONIG_OPTION_FIND_LONGEST or ONIG_OPTION_FIND_NOT_EMPTY is used, counts are not accurate. @@ -61,10 +67,10 @@ CALLOUTS.BUILTIN 2018/03/19 It's the almost same as COUNT. But the counts are integrated in a search process. - 'c' is an optional argument, deefault value is '>'. + 'c' is an optional argument, default value is '>'. [callout data] - slot 0: '>': progress count, '<': retraction count, 'X': success count + slot 0: '>': progress count (default), '<': retraction count, 'X': success count slot 1: progress count slot 2: retraction count @@ -76,7 +82,8 @@ CALLOUTS.BUILTIN 2018/03/19 (*CMP{x::TAG/LONG, op::STRING, y::TAG/LONG}) - Compare x value and y value with op operator. + Compares x value and y value with op operator. + If x and y types are tag, slot 0 value of the tag are used. op: '==', '!=', '>', '<', '>=', '<=' diff --git a/doc/CALLOUTS.BUILTIN.ja b/doc/CALLOUTS.BUILTIN.ja index e1a5b7a..d371beb 100644 --- a/doc/CALLOUTS.BUILTIN.ja +++ b/doc/CALLOUTS.BUILTIN.ja @@ -1,4 +1,4 @@ -CALLOUTS.BUILTIN.ja 2018/03/19 +CALLOUTS.BUILTIN.ja 2018/03/26 * FAIL (前進) @@ -27,12 +27,17 @@ CALLOUTS.BUILTIN.ja 2018/03/19 * MAX (前進/後退) - (*MAX{n::LONG}) + (*MAX{n::LONG/TAG, c::CHAR}) - 成功回数を制限する + 成功(デフォルト)、前進または後退回数を制限する + 'n'がTAGのときは、そのTAGのcalloutのslot 0の値が使用される + 'c'引数の値によって、slot 0の値が変化する + 'c'はオプション引数で、デフォルト値は'X' + + 例: "(?:(*COUNT[T]{X})a)*(?:(*MAX{T})c)*" [callout data] - slot 0: 現在の成功回数 + slot 0: '>': 前進回数, '<': 後退回数, 'X': 成功回数(デフォルト) * COUNT (前進/後退) @@ -44,7 +49,7 @@ CALLOUTS.BUILTIN.ja 2018/03/19 'c'はオプション引数で、デフォルト値は'>' [callout data] - slot 0: '>': 前進回数, '<': 後退回数, 'X': 成功回数 + slot 0: '>': 前進回数(デフォルト), '<': 後退回数, 'X': 成功回数 slot 1: 前進回数 slot 2: 後退回数 @@ -63,7 +68,7 @@ CALLOUTS.BUILTIN.ja 2018/03/19 'c'はオプション引数で、デフォルト値は'>' [callout data] - slot 0: '>': 前進回数, '<': 後退回数, 'X': 成功回数 + slot 0: '>': 前進回数(デフォルト), '<': 後退回数, 'X': 成功回数 slot 1: 前進回数 slot 2: 後退回数 diff --git a/doc/RE b/doc/RE index 4bd0e7d..e75daad 100644 --- a/doc/RE +++ b/doc/RE @@ -1,4 +1,4 @@ -Oniguruma Regular Expressions Version 6.8.0 2018/03/08 +Oniguruma Regular Expressions Version 6.8.0 2018/04/13 syntax: ONIG_SYNTAX_ONIGURUMA (default) @@ -266,19 +266,32 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default) * Callouts of contents - (?{...contents...}) callouts in progress - (?{...contents...}D) D is a direction flag char. ('X' or '<' or '>') - D = 'X': progress and retraction, '<': retraction only - '>': progress only (default) + (?{...contents...}) callout in progress + (?{...contents...}D) D is a direction flag char + D = 'X': in progress and retraction + '<': in retraction only + '>': in progress only (?{...contents...}[tag]) tag assigned (?{...contents...}[tag]D) + * Escape characters have no effects in contents. + * contents is not allowed to start with '{'. + + (?{{{...contents...}}}) n times continuations '}' in contents is allowed in + (n+1) times continuations {{{...}}}. + + Allowed tag string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) + + * Callouts of name (*name) (*name{args...}) with args (*name[tag]) tag assigned (*name[tag]{args...}) + Allowed name string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) + Allowed tag string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) + diff --git a/doc/RE.ja b/doc/RE.ja index a7f6b8d..8cc0990 100644 --- a/doc/RE.ja +++ b/doc/RE.ja @@ -1,4 +1,4 @@ -鬼車 正規表現 Version 6.8.0 2018/03/08 +鬼車 正規表現 Version 6.8.0 2018/04/13 使用文法: ONIG_SYNTAX_ONIGURUMA (既定値) @@ -269,17 +269,31 @@ * 内容の呼び出し (?{...contents...}) 前進中のみの呼び出し - (?{...contents...}D) Dは方向指定文字 ('X' or '<' or '>') - D = 'X': 前進および後退, '<' 後退のみ, '>': 前進のみ + (?{...contents...}D) Dは方向指定文字 + D = 'X': 前進中および後退中 + '<': 後退中のみ + '>': 前進中のみ (?{...contents...}[tag]) 名札付き (?{...contents...}[tag]D) + * エスケープ文字はcontentsの中で何の機能も持たない + * contentsは、'{'文字で始まってはならない + + (?{{{...contents...}}}) contentsの中のn個連続の'}'は、(n+1)個連続の{{{...}}} + の中で許される + + tagに許される文字: _ A-Z a-z 0-9 (* 最初の文字: _ A-Z a-z) + + * 名前の呼び出し (*name) (*name{args...}) 引数付き (*name[tag]) 名札付き (*name[tag]{args...}) + nameに許される文字: _ A-Z a-z 0-9 (* 最初の文字: _ A-Z a-z) + tag に許される文字: _ A-Z a-z 0-9 (* 最初の文字: _ A-Z a-z) + <不在機能群> @@ -296,7 +310,7 @@ 例 (?~|345|\d*) "12345678" ==> "12", "1", "" (?~|不在式) 不在停止 (* 原作) - この演算子を通過した後は、対象文字列の適合範囲の最後が + この演算子を通過した後は、対象文字列の適合範囲が <不在式>に適合する文字列を含まない範囲に制限される。 (?~|) 範囲消去 -- cgit v1.2.3