ホーム › Globalization › uregex_group
uregex_group
関数一致したグループの文字列を取得する。
シグネチャ
// icuin.dll
#include <windows.h>
INT uregex_group(
URegularExpression* regexp,
INT groupNum,
WORD* dest,
INT destCapacity,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| regexp | URegularExpression* | inout |
| groupNum | INT | in |
| dest | WORD* | inout |
| destCapacity | INT | in |
| status | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT uregex_group(
URegularExpression* regexp,
INT groupNum,
WORD* dest,
INT destCapacity,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uregex_group(
ref IntPtr regexp, // URegularExpression* in/out
int groupNum, // INT
ref ushort dest, // WORD* in/out
int destCapacity, // INT
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uregex_group(
ByRef regexp As IntPtr, ' URegularExpression* in/out
groupNum As Integer, ' INT
ByRef dest As UShort, ' WORD* in/out
destCapacity As Integer, ' INT
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' regexp : URegularExpression* in/out
' groupNum : INT
' dest : WORD* in/out
' destCapacity : INT
' status : UErrorCode* in/out
Declare PtrSafe Function uregex_group Lib "icuin" ( _
ByRef regexp As LongPtr, _
ByVal groupNum As Long, _
ByRef dest As Integer, _
ByVal destCapacity As Long, _
ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uregex_group = ctypes.cdll.icuin.uregex_group
uregex_group.restype = ctypes.c_int
uregex_group.argtypes = [
ctypes.c_void_p, # regexp : URegularExpression* in/out
ctypes.c_int, # groupNum : INT
ctypes.POINTER(ctypes.c_ushort), # dest : WORD* in/out
ctypes.c_int, # destCapacity : INT
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
uregex_group = Fiddle::Function.new(
lib['uregex_group'],
[
Fiddle::TYPE_VOIDP, # regexp : URegularExpression* in/out
Fiddle::TYPE_INT, # groupNum : INT
Fiddle::TYPE_VOIDP, # dest : WORD* in/out
Fiddle::TYPE_INT, # destCapacity : INT
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn uregex_group(
regexp: *mut isize, // URegularExpression* in/out
groupNum: i32, // INT
dest: *mut u16, // WORD* in/out
destCapacity: i32, // INT
status: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int uregex_group(ref IntPtr regexp, int groupNum, ref ushort dest, int destCapacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uregex_group' -Namespace Win32 -PassThru
# $api::uregex_group(regexp, groupNum, dest, destCapacity, status)#uselib "icuin.dll"
#func global uregex_group "uregex_group" sptr, sptr, sptr, sptr, sptr
; uregex_group regexp, groupNum, varptr(dest), destCapacity, status ; 戻り値は stat
; regexp : URegularExpression* in/out -> "sptr"
; groupNum : INT -> "sptr"
; dest : WORD* in/out -> "sptr"
; destCapacity : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global uregex_group "uregex_group" int, int, var, int, int ; res = uregex_group(regexp, groupNum, dest, destCapacity, status) ; regexp : URegularExpression* in/out -> "int" ; groupNum : INT -> "int" ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global uregex_group "uregex_group" int, int, sptr, int, int ; res = uregex_group(regexp, groupNum, varptr(dest), destCapacity, status) ; regexp : URegularExpression* in/out -> "int" ; groupNum : INT -> "int" ; dest : WORD* in/out -> "sptr" ; destCapacity : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT uregex_group(URegularExpression* regexp, INT groupNum, WORD* dest, INT destCapacity, UErrorCode* status) #uselib "icuin.dll" #cfunc global uregex_group "uregex_group" int, int, var, int, int ; res = uregex_group(regexp, groupNum, dest, destCapacity, status) ; regexp : URegularExpression* in/out -> "int" ; groupNum : INT -> "int" ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT uregex_group(URegularExpression* regexp, INT groupNum, WORD* dest, INT destCapacity, UErrorCode* status) #uselib "icuin.dll" #cfunc global uregex_group "uregex_group" int, int, intptr, int, int ; res = uregex_group(regexp, groupNum, varptr(dest), destCapacity, status) ; regexp : URegularExpression* in/out -> "int" ; groupNum : INT -> "int" ; dest : WORD* in/out -> "intptr" ; destCapacity : INT -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procuregex_group = icuin.NewProc("uregex_group")
)
// regexp (URegularExpression* in/out), groupNum (INT), dest (WORD* in/out), destCapacity (INT), status (UErrorCode* in/out)
r1, _, err := procuregex_group.Call(
uintptr(regexp),
uintptr(groupNum),
uintptr(dest),
uintptr(destCapacity),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction uregex_group(
regexp: Pointer; // URegularExpression* in/out
groupNum: Integer; // INT
dest: Pointer; // WORD* in/out
destCapacity: Integer; // INT
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'uregex_group';result := DllCall("icuin\uregex_group"
, "Ptr", regexp ; URegularExpression* in/out
, "Int", groupNum ; INT
, "Ptr", dest ; WORD* in/out
, "Int", destCapacity ; INT
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●uregex_group(regexp, groupNum, dest, destCapacity, status) = DLL("icuin.dll", "int uregex_group(void*, int, void*, int, void*)")
# 呼び出し: uregex_group(regexp, groupNum, dest, destCapacity, status)
# regexp : URegularExpression* in/out -> "void*"
# groupNum : INT -> "int"
# dest : WORD* in/out -> "void*"
# destCapacity : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。