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