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

UCNV_FROM_U_CALLBACK_SKIP

関数
Unicodeから変換失敗時に該当文字を無視するコールバック。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

void UCNV_FROM_U_CALLBACK_SKIP(
    const void* context,
    UConverterFromUnicodeArgs* fromUArgs,
    const WORD* codeUnits,
    INT length,
    INT codePoint,
    UConverterCallbackReason reason,
    UErrorCode* err
);

パラメーター

名前方向
contextvoid*in
fromUArgsUConverterFromUnicodeArgs*inout
codeUnitsWORD*in
lengthINTin
codePointINTin
reasonUConverterCallbackReasonin
errUErrorCode*inout

戻り値の型: void

各言語での呼び出し定義

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

void UCNV_FROM_U_CALLBACK_SKIP(
    const void* context,
    UConverterFromUnicodeArgs* fromUArgs,
    const WORD* codeUnits,
    INT length,
    INT codePoint,
    UConverterCallbackReason reason,
    UErrorCode* err
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void UCNV_FROM_U_CALLBACK_SKIP(
    IntPtr context,   // void*
    IntPtr fromUArgs,   // UConverterFromUnicodeArgs* in/out
    ref ushort codeUnits,   // WORD*
    int length,   // INT
    int codePoint,   // INT
    int reason,   // UConverterCallbackReason
    ref int err   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub UCNV_FROM_U_CALLBACK_SKIP(
    context As IntPtr,   ' void*
    fromUArgs As IntPtr,   ' UConverterFromUnicodeArgs* in/out
    ByRef codeUnits As UShort,   ' WORD*
    length As Integer,   ' INT
    codePoint As Integer,   ' INT
    reason As Integer,   ' UConverterCallbackReason
    ByRef err As Integer   ' UErrorCode* in/out
)
End Sub
' context : void*
' fromUArgs : UConverterFromUnicodeArgs* in/out
' codeUnits : WORD*
' length : INT
' codePoint : INT
' reason : UConverterCallbackReason
' err : UErrorCode* in/out
Declare PtrSafe Sub UCNV_FROM_U_CALLBACK_SKIP Lib "icuuc" ( _
    ByVal context As LongPtr, _
    ByVal fromUArgs As LongPtr, _
    ByRef codeUnits As Integer, _
    ByVal length As Long, _
    ByVal codePoint As Long, _
    ByVal reason As Long, _
    ByRef err As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UCNV_FROM_U_CALLBACK_SKIP = ctypes.cdll.icuuc.UCNV_FROM_U_CALLBACK_SKIP
UCNV_FROM_U_CALLBACK_SKIP.restype = None
UCNV_FROM_U_CALLBACK_SKIP.argtypes = [
    ctypes.POINTER(None),  # context : void*
    ctypes.c_void_p,  # fromUArgs : UConverterFromUnicodeArgs* in/out
    ctypes.POINTER(ctypes.c_ushort),  # codeUnits : WORD*
    ctypes.c_int,  # length : INT
    ctypes.c_int,  # codePoint : INT
    ctypes.c_int,  # reason : UConverterCallbackReason
    ctypes.c_void_p,  # err : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
UCNV_FROM_U_CALLBACK_SKIP = Fiddle::Function.new(
  lib['UCNV_FROM_U_CALLBACK_SKIP'],
  [
    Fiddle::TYPE_VOIDP,  # context : void*
    Fiddle::TYPE_VOIDP,  # fromUArgs : UConverterFromUnicodeArgs* in/out
    Fiddle::TYPE_VOIDP,  # codeUnits : WORD*
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_INT,  # codePoint : INT
    Fiddle::TYPE_INT,  # reason : UConverterCallbackReason
    Fiddle::TYPE_VOIDP,  # err : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn UCNV_FROM_U_CALLBACK_SKIP(
        context: *const (),  // void*
        fromUArgs: *mut UConverterFromUnicodeArgs,  // UConverterFromUnicodeArgs* in/out
        codeUnits: *const u16,  // WORD*
        length: i32,  // INT
        codePoint: i32,  // INT
        reason: i32,  // UConverterCallbackReason
        err: *mut i32  // UErrorCode* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void UCNV_FROM_U_CALLBACK_SKIP(IntPtr context, IntPtr fromUArgs, ref ushort codeUnits, int length, int codePoint, int reason, ref int err);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_UCNV_FROM_U_CALLBACK_SKIP' -Namespace Win32 -PassThru
# $api::UCNV_FROM_U_CALLBACK_SKIP(context, fromUArgs, codeUnits, length, codePoint, reason, err)
#uselib "icuuc.dll"
#func global UCNV_FROM_U_CALLBACK_SKIP "UCNV_FROM_U_CALLBACK_SKIP" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; UCNV_FROM_U_CALLBACK_SKIP context, varptr(fromUArgs), varptr(codeUnits), length, codePoint, reason, err
; context : void* -> "sptr"
; fromUArgs : UConverterFromUnicodeArgs* in/out -> "sptr"
; codeUnits : WORD* -> "sptr"
; length : INT -> "sptr"
; codePoint : INT -> "sptr"
; reason : UConverterCallbackReason -> "sptr"
; err : UErrorCode* in/out -> "sptr"
出力引数:
#uselib "icuuc.dll"
#func global UCNV_FROM_U_CALLBACK_SKIP "UCNV_FROM_U_CALLBACK_SKIP" sptr, var, var, int, int, int, int
; UCNV_FROM_U_CALLBACK_SKIP context, fromUArgs, codeUnits, length, codePoint, reason, err
; context : void* -> "sptr"
; fromUArgs : UConverterFromUnicodeArgs* in/out -> "var"
; codeUnits : WORD* -> "var"
; length : INT -> "int"
; codePoint : INT -> "int"
; reason : UConverterCallbackReason -> "int"
; err : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void UCNV_FROM_U_CALLBACK_SKIP(void* context, UConverterFromUnicodeArgs* fromUArgs, WORD* codeUnits, INT length, INT codePoint, UConverterCallbackReason reason, UErrorCode* err)
#uselib "icuuc.dll"
#func global UCNV_FROM_U_CALLBACK_SKIP "UCNV_FROM_U_CALLBACK_SKIP" intptr, var, var, int, int, int, int
; UCNV_FROM_U_CALLBACK_SKIP context, fromUArgs, codeUnits, length, codePoint, reason, err
; context : void* -> "intptr"
; fromUArgs : UConverterFromUnicodeArgs* in/out -> "var"
; codeUnits : WORD* -> "var"
; length : INT -> "int"
; codePoint : INT -> "int"
; reason : UConverterCallbackReason -> "int"
; err : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procUCNV_FROM_U_CALLBACK_SKIP = icuuc.NewProc("UCNV_FROM_U_CALLBACK_SKIP")
)

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