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

uset_resemblesPattern

関数
文字列がUSetパターンらしいかを判定する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

CHAR uset_resemblesPattern(
    const WORD* pattern,
    INT patternLength,
    INT pos
);

パラメーター

名前方向
patternWORD*in
patternLengthINTin
posINTin

戻り値の型: CHAR

各言語での呼び出し定義

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

CHAR uset_resemblesPattern(
    const WORD* pattern,
    INT patternLength,
    INT pos
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern sbyte uset_resemblesPattern(
    ref ushort pattern,   // WORD*
    int patternLength,   // INT
    int pos   // INT
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uset_resemblesPattern(
    ByRef pattern As UShort,   ' WORD*
    patternLength As Integer,   ' INT
    pos As Integer   ' INT
) As SByte
End Function
' pattern : WORD*
' patternLength : INT
' pos : INT
Declare PtrSafe Function uset_resemblesPattern Lib "icuuc" ( _
    ByRef pattern As Integer, _
    ByVal patternLength As Long, _
    ByVal pos As Long) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uset_resemblesPattern = ctypes.cdll.icuuc.uset_resemblesPattern
uset_resemblesPattern.restype = ctypes.c_byte
uset_resemblesPattern.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # pattern : WORD*
    ctypes.c_int,  # patternLength : INT
    ctypes.c_int,  # pos : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
uset_resemblesPattern = Fiddle::Function.new(
  lib['uset_resemblesPattern'],
  [
    Fiddle::TYPE_VOIDP,  # pattern : WORD*
    Fiddle::TYPE_INT,  # patternLength : INT
    Fiddle::TYPE_INT,  # pos : INT
  ],
  Fiddle::TYPE_CHAR, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn uset_resemblesPattern(
        pattern: *const u16,  // WORD*
        patternLength: i32,  // INT
        pos: i32  // INT
    ) -> i8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte uset_resemblesPattern(ref ushort pattern, int patternLength, int pos);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uset_resemblesPattern' -Namespace Win32 -PassThru
# $api::uset_resemblesPattern(pattern, patternLength, pos)
#uselib "icuuc.dll"
#func global uset_resemblesPattern "uset_resemblesPattern" sptr, sptr, sptr
; uset_resemblesPattern varptr(pattern), patternLength, pos   ; 戻り値は stat
; pattern : WORD* -> "sptr"
; patternLength : INT -> "sptr"
; pos : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global uset_resemblesPattern "uset_resemblesPattern" var, int, int
; res = uset_resemblesPattern(pattern, patternLength, pos)
; pattern : WORD* -> "var"
; patternLength : INT -> "int"
; pos : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; CHAR uset_resemblesPattern(WORD* pattern, INT patternLength, INT pos)
#uselib "icuuc.dll"
#cfunc global uset_resemblesPattern "uset_resemblesPattern" var, int, int
; res = uset_resemblesPattern(pattern, patternLength, pos)
; pattern : WORD* -> "var"
; patternLength : INT -> "int"
; pos : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procuset_resemblesPattern = icuuc.NewProc("uset_resemblesPattern")
)

// pattern (WORD*), patternLength (INT), pos (INT)
r1, _, err := procuset_resemblesPattern.Call(
	uintptr(pattern),
	uintptr(patternLength),
	uintptr(pos),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // CHAR
function uset_resemblesPattern(
  pattern: Pointer;   // WORD*
  patternLength: Integer;   // INT
  pos: Integer   // INT
): Shortint; cdecl;
  external 'icuuc.dll' name 'uset_resemblesPattern';
result := DllCall("icuuc\uset_resemblesPattern"
    , "Ptr", pattern   ; WORD*
    , "Int", patternLength   ; INT
    , "Int", pos   ; INT
    , "Cdecl Char")   ; return: CHAR
●uset_resemblesPattern(pattern, patternLength, pos) = DLL("icuuc.dll", "char uset_resemblesPattern(void*, int, int)")
# 呼び出し: uset_resemblesPattern(pattern, patternLength, pos)
# pattern : WORD* -> "void*"
# patternLength : INT -> "int"
# pos : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。