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