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