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

uset_span

関数
文字列先頭からUSet条件に合う範囲長を返す。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT uset_span(
    const USet* set,
    const WORD* s,
    INT length,
    USetSpanCondition spanCondition
);

パラメーター

名前方向
setUSet*in
sWORD*in
lengthINTin
spanConditionUSetSpanConditionin

戻り値の型: INT

各言語での呼び出し定義

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

INT uset_span(
    const USet* set,
    const WORD* s,
    INT length,
    USetSpanCondition spanCondition
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uset_span(
    ref IntPtr set,   // USet*
    ref ushort s,   // WORD*
    int length,   // INT
    int spanCondition   // USetSpanCondition
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uset_span(
    ByRef [set] As IntPtr,   ' USet*
    ByRef s As UShort,   ' WORD*
    length As Integer,   ' INT
    spanCondition As Integer   ' USetSpanCondition
) As Integer
End Function
' set : USet*
' s : WORD*
' length : INT
' spanCondition : USetSpanCondition
Declare PtrSafe Function uset_span Lib "icuuc" ( _
    ByRef set As LongPtr, _
    ByRef s As Integer, _
    ByVal length As Long, _
    ByVal spanCondition As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uset_span = ctypes.cdll.icuuc.uset_span
uset_span.restype = ctypes.c_int
uset_span.argtypes = [
    ctypes.c_void_p,  # set : USet*
    ctypes.POINTER(ctypes.c_ushort),  # s : WORD*
    ctypes.c_int,  # length : INT
    ctypes.c_int,  # spanCondition : USetSpanCondition
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procuset_span = icuuc.NewProc("uset_span")
)

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