Win32 API 日本語リファレンス
ホームGlobalization › uregex_split

uregex_split

関数
一致箇所を区切りとして文字列を分割する。
DLLicuin.dll呼出規約cdecl

シグネチャ

// icuin.dll
#include <windows.h>

INT uregex_split(
    URegularExpression* regexp,
    WORD* destBuf,
    INT destCapacity,
    INT* requiredCapacity,
    WORD** destFields,
    INT destFieldsCapacity,
    UErrorCode* status
);

パラメーター

名前方向
regexpURegularExpression*inout
destBufWORD*inout
destCapacityINTin
requiredCapacityINT*inout
destFieldsWORD**inout
destFieldsCapacityINTin
statusUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

// icuin.dll
#include <windows.h>

INT uregex_split(
    URegularExpression* regexp,
    WORD* destBuf,
    INT destCapacity,
    INT* requiredCapacity,
    WORD** destFields,
    INT destFieldsCapacity,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uregex_split(
    ref IntPtr regexp,   // URegularExpression* in/out
    ref ushort destBuf,   // WORD* in/out
    int destCapacity,   // INT
    ref int requiredCapacity,   // INT* in/out
    IntPtr destFields,   // WORD** in/out
    int destFieldsCapacity,   // INT
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uregex_split(
    ByRef regexp As IntPtr,   ' URegularExpression* in/out
    ByRef destBuf As UShort,   ' WORD* in/out
    destCapacity As Integer,   ' INT
    ByRef requiredCapacity As Integer,   ' INT* in/out
    destFields As IntPtr,   ' WORD** in/out
    destFieldsCapacity As Integer,   ' INT
    ByRef status As Integer   ' UErrorCode* in/out
) As Integer
End Function
' regexp : URegularExpression* in/out
' destBuf : WORD* in/out
' destCapacity : INT
' requiredCapacity : INT* in/out
' destFields : WORD** in/out
' destFieldsCapacity : INT
' status : UErrorCode* in/out
Declare PtrSafe Function uregex_split Lib "icuin" ( _
    ByRef regexp As LongPtr, _
    ByRef destBuf As Integer, _
    ByVal destCapacity As Long, _
    ByRef requiredCapacity As Long, _
    ByVal destFields As LongPtr, _
    ByVal destFieldsCapacity 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_split = ctypes.cdll.icuin.uregex_split
uregex_split.restype = ctypes.c_int
uregex_split.argtypes = [
    ctypes.c_void_p,  # regexp : URegularExpression* in/out
    ctypes.POINTER(ctypes.c_ushort),  # destBuf : WORD* in/out
    ctypes.c_int,  # destCapacity : INT
    ctypes.POINTER(ctypes.c_int),  # requiredCapacity : INT* in/out
    ctypes.c_void_p,  # destFields : WORD** in/out
    ctypes.c_int,  # destFieldsCapacity : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
uregex_split = Fiddle::Function.new(
  lib['uregex_split'],
  [
    Fiddle::TYPE_VOIDP,  # regexp : URegularExpression* in/out
    Fiddle::TYPE_VOIDP,  # destBuf : WORD* in/out
    Fiddle::TYPE_INT,  # destCapacity : INT
    Fiddle::TYPE_VOIDP,  # requiredCapacity : INT* in/out
    Fiddle::TYPE_VOIDP,  # destFields : WORD** in/out
    Fiddle::TYPE_INT,  # destFieldsCapacity : INT
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn uregex_split(
        regexp: *mut isize,  // URegularExpression* in/out
        destBuf: *mut u16,  // WORD* in/out
        destCapacity: i32,  // INT
        requiredCapacity: *mut i32,  // INT* in/out
        destFields: *mut *mut u16,  // WORD** in/out
        destFieldsCapacity: 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_split(ref IntPtr regexp, ref ushort destBuf, int destCapacity, ref int requiredCapacity, IntPtr destFields, int destFieldsCapacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uregex_split' -Namespace Win32 -PassThru
# $api::uregex_split(regexp, destBuf, destCapacity, requiredCapacity, destFields, destFieldsCapacity, status)
#uselib "icuin.dll"
#func global uregex_split "uregex_split" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; uregex_split regexp, varptr(destBuf), destCapacity, varptr(requiredCapacity), varptr(destFields), destFieldsCapacity, status   ; 戻り値は stat
; regexp : URegularExpression* in/out -> "sptr"
; destBuf : WORD* in/out -> "sptr"
; destCapacity : INT -> "sptr"
; requiredCapacity : INT* in/out -> "sptr"
; destFields : WORD** in/out -> "sptr"
; destFieldsCapacity : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuin.dll"
#cfunc global uregex_split "uregex_split" int, var, int, var, var, int, int
; res = uregex_split(regexp, destBuf, destCapacity, requiredCapacity, destFields, destFieldsCapacity, status)
; regexp : URegularExpression* in/out -> "int"
; destBuf : WORD* in/out -> "var"
; destCapacity : INT -> "int"
; requiredCapacity : INT* in/out -> "var"
; destFields : WORD** in/out -> "var"
; destFieldsCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT uregex_split(URegularExpression* regexp, WORD* destBuf, INT destCapacity, INT* requiredCapacity, WORD** destFields, INT destFieldsCapacity, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global uregex_split "uregex_split" int, var, int, var, var, int, int
; res = uregex_split(regexp, destBuf, destCapacity, requiredCapacity, destFields, destFieldsCapacity, status)
; regexp : URegularExpression* in/out -> "int"
; destBuf : WORD* in/out -> "var"
; destCapacity : INT -> "int"
; requiredCapacity : INT* in/out -> "var"
; destFields : WORD** in/out -> "var"
; destFieldsCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procuregex_split = icuin.NewProc("uregex_split")
)

// regexp (URegularExpression* in/out), destBuf (WORD* in/out), destCapacity (INT), requiredCapacity (INT* in/out), destFields (WORD** in/out), destFieldsCapacity (INT), status (UErrorCode* in/out)
r1, _, err := procuregex_split.Call(
	uintptr(regexp),
	uintptr(destBuf),
	uintptr(destCapacity),
	uintptr(requiredCapacity),
	uintptr(destFields),
	uintptr(destFieldsCapacity),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function uregex_split(
  regexp: Pointer;   // URegularExpression* in/out
  destBuf: Pointer;   // WORD* in/out
  destCapacity: Integer;   // INT
  requiredCapacity: Pointer;   // INT* in/out
  destFields: Pointer;   // WORD** in/out
  destFieldsCapacity: Integer;   // INT
  status: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuin.dll' name 'uregex_split';
result := DllCall("icuin\uregex_split"
    , "Ptr", regexp   ; URegularExpression* in/out
    , "Ptr", destBuf   ; WORD* in/out
    , "Int", destCapacity   ; INT
    , "Ptr", requiredCapacity   ; INT* in/out
    , "Ptr", destFields   ; WORD** in/out
    , "Int", destFieldsCapacity   ; INT
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: INT
●uregex_split(regexp, destBuf, destCapacity, requiredCapacity, destFields, destFieldsCapacity, status) = DLL("icuin.dll", "int uregex_split(void*, void*, int, void*, void*, int, void*)")
# 呼び出し: uregex_split(regexp, destBuf, destCapacity, requiredCapacity, destFields, destFieldsCapacity, status)
# regexp : URegularExpression* in/out -> "void*"
# destBuf : WORD* in/out -> "void*"
# destCapacity : INT -> "int"
# requiredCapacity : INT* in/out -> "void*"
# destFields : WORD** in/out -> "void*"
# destFieldsCapacity : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。