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コールバックに渡される任意のユーザーデータ。NULL可。
fromUArgsUConverterFromUnicodeArgs*inoutUnicode→外部符号化変換の状態を保持する引数構造体へのポインタ。
codeUnitsWORD*in問題が生じたUnicodeコードユニット列(UTF-16)へのポインタ。
lengthINTincodeUnitsの要素数。
codePointINTin対象のコードポイント。
reasonUConverterCallbackReasoninコールバックが呼ばれた理由を示す列挙値。
errUErrorCode*inoutエラーコードを入出力するポインタ。SKIPでは該当文字を読み飛ばす。

戻り値の型: 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, varptr(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, var
; 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 -> "var"
; ※出力/バッファ引数は 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, var
; 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 -> "var"
; ※出力/バッファ引数は 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`,…) を使用。
const std = @import("std");

extern "icuuc" fn UCNV_FROM_U_CALLBACK_SKIP(
    context: ?*anyopaque, // void*
    fromUArgs: [*c]UConverterFromUnicodeArgs, // UConverterFromUnicodeArgs* in/out
    codeUnits: [*c]u16, // WORD*
    length: i32, // INT
    codePoint: i32, // INT
    reason: i32, // UConverterCallbackReason
    err: [*c]i32 // UErrorCode* in/out
) callconv(.c) void;
proc UCNV_FROM_U_CALLBACK_SKIP(
    context: pointer,  # void*
    fromUArgs: ptr UConverterFromUnicodeArgs,  # UConverterFromUnicodeArgs* in/out
    codeUnits: ptr uint16,  # WORD*
    length: int32,  # INT
    codePoint: int32,  # INT
    reason: int32,  # UConverterCallbackReason
    err: ptr int32  # UErrorCode* in/out
) {.importc: "UCNV_FROM_U_CALLBACK_SKIP", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
void UCNV_FROM_U_CALLBACK_SKIP(
    void* context,   // void*
    UConverterFromUnicodeArgs* fromUArgs,   // UConverterFromUnicodeArgs* in/out
    ushort* codeUnits,   // WORD*
    int length,   // INT
    int codePoint,   // INT
    int reason,   // UConverterCallbackReason
    int* err   // UErrorCode* in/out
);
ccall((:UCNV_FROM_U_CALLBACK_SKIP, "icuuc.dll"), Cvoid,
      (Ptr{Cvoid}, Ptr{UConverterFromUnicodeArgs}, Ptr{UInt16}, Int32, Int32, Int32, Ptr{Int32}),
      context, fromUArgs, codeUnits, length, codePoint, reason, err)
# context : void* -> Ptr{Cvoid}
# fromUArgs : UConverterFromUnicodeArgs* in/out -> Ptr{UConverterFromUnicodeArgs}
# codeUnits : WORD* -> Ptr{UInt16}
# length : INT -> Int32
# codePoint : INT -> Int32
# reason : UConverterCallbackReason -> Int32
# err : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
void UCNV_FROM_U_CALLBACK_SKIP(
    void* context,
    void* fromUArgs,
    uint16_t* codeUnits,
    int32_t length,
    int32_t codePoint,
    int32_t reason,
    int32_t* err);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.UCNV_FROM_U_CALLBACK_SKIP(context, fromUArgs, codeUnits, length, codePoint, reason, err)
-- context : void*
-- fromUArgs : UConverterFromUnicodeArgs* in/out
-- codeUnits : WORD*
-- length : INT
-- codePoint : INT
-- reason : UConverterCallbackReason
-- err : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const UCNV_FROM_U_CALLBACK_SKIP = lib.func('__cdecl', 'UCNV_FROM_U_CALLBACK_SKIP', 'void', ['void *', 'void *', 'uint16_t *', 'int32_t', 'int32_t', 'int32_t', 'int32_t *']);
// UCNV_FROM_U_CALLBACK_SKIP(context, fromUArgs, codeUnits, length, codePoint, reason, err)
// context : void* -> 'void *'
// fromUArgs : UConverterFromUnicodeArgs* in/out -> 'void *'
// codeUnits : WORD* -> 'uint16_t *'
// length : INT -> 'int32_t'
// codePoint : INT -> 'int32_t'
// reason : UConverterCallbackReason -> 'int32_t'
// err : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  UCNV_FROM_U_CALLBACK_SKIP: { parameters: ["pointer", "pointer", "pointer", "i32", "i32", "i32", "pointer"], result: "void" },
});
// lib.symbols.UCNV_FROM_U_CALLBACK_SKIP(context, fromUArgs, codeUnits, length, codePoint, reason, err)
// context : void* -> "pointer"
// fromUArgs : UConverterFromUnicodeArgs* in/out -> "pointer"
// codeUnits : WORD* -> "pointer"
// length : INT -> "i32"
// codePoint : INT -> "i32"
// reason : UConverterCallbackReason -> "i32"
// err : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void UCNV_FROM_U_CALLBACK_SKIP(
    void* context,
    void* fromUArgs,
    uint16_t* codeUnits,
    int32_t length,
    int32_t codePoint,
    int32_t reason,
    int32_t* err);
C, "icuuc.dll");
// $ffi->UCNV_FROM_U_CALLBACK_SKIP(context, fromUArgs, codeUnits, length, codePoint, reason, err);
// context : void*
// fromUArgs : UConverterFromUnicodeArgs* in/out
// codeUnits : WORD*
// length : INT
// codePoint : INT
// reason : UConverterCallbackReason
// err : UErrorCode* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuuc extends Library {
    Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
    void UCNV_FROM_U_CALLBACK_SKIP(
        Pointer context,   // void*
        Pointer fromUArgs,   // UConverterFromUnicodeArgs* in/out
        ShortByReference codeUnits,   // WORD*
        int length,   // INT
        int codePoint,   // INT
        int reason,   // UConverterCallbackReason
        IntByReference err   // UErrorCode* in/out
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun UCNV_FROM_U_CALLBACK_SKIP = UCNV_FROM_U_CALLBACK_SKIP(
    context : Void*,   # void*
    fromUArgs : UConverterFromUnicodeArgs*,   # UConverterFromUnicodeArgs* in/out
    codeUnits : UInt16*,   # WORD*
    length : Int32,   # INT
    codePoint : Int32,   # INT
    reason : Int32,   # UConverterCallbackReason
    err : Int32*   # UErrorCode* in/out
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef UCNV_FROM_U_CALLBACK_SKIPNative = Void Function(Pointer<Void>, Pointer<Void>, Pointer<Uint16>, Int32, Int32, Int32, Pointer<Int32>);
typedef UCNV_FROM_U_CALLBACK_SKIPDart = void Function(Pointer<Void>, Pointer<Void>, Pointer<Uint16>, int, int, int, Pointer<Int32>);
final UCNV_FROM_U_CALLBACK_SKIP = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<UCNV_FROM_U_CALLBACK_SKIPNative, UCNV_FROM_U_CALLBACK_SKIPDart>('UCNV_FROM_U_CALLBACK_SKIP');
// context : void* -> Pointer<Void>
// fromUArgs : UConverterFromUnicodeArgs* in/out -> Pointer<Void>
// codeUnits : WORD* -> Pointer<Uint16>
// length : INT -> Int32
// codePoint : INT -> Int32
// reason : UConverterCallbackReason -> Int32
// err : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
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';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "UCNV_FROM_U_CALLBACK_SKIP"
  c_UCNV_FROM_U_CALLBACK_SKIP :: Ptr () -> Ptr () -> Ptr Word16 -> Int32 -> Int32 -> Int32 -> Ptr Int32 -> IO ()
-- context : void* -> Ptr ()
-- fromUArgs : UConverterFromUnicodeArgs* in/out -> Ptr ()
-- codeUnits : WORD* -> Ptr Word16
-- length : INT -> Int32
-- codePoint : INT -> Int32
-- reason : UConverterCallbackReason -> Int32
-- err : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ucnv_from_u_callback_skip =
  foreign "UCNV_FROM_U_CALLBACK_SKIP"
    ((ptr void) @-> (ptr void) @-> (ptr uint16_t) @-> int32_t @-> int32_t @-> int32_t @-> (ptr int32_t) @-> returning void)
(* context : void* -> (ptr void) *)
(* fromUArgs : UConverterFromUnicodeArgs* in/out -> (ptr void) *)
(* codeUnits : WORD* -> (ptr uint16_t) *)
(* length : INT -> int32_t *)
(* codePoint : INT -> int32_t *)
(* reason : UConverterCallbackReason -> int32_t *)
(* err : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)

(cffi:defcfun ("UCNV_FROM_U_CALLBACK_SKIP" ucnv-from-u-callback-skip :convention :cdecl) :void
  (context :pointer)   ; void*
  (from-uargs :pointer)   ; UConverterFromUnicodeArgs* in/out
  (code-units :pointer)   ; WORD*
  (length :int32)   ; INT
  (code-point :int32)   ; INT
  (reason :int32)   ; UConverterCallbackReason
  (err :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $UCNV_FROM_U_CALLBACK_SKIP = Win32::API::More->new('icuuc',
    'void UCNV_FROM_U_CALLBACK_SKIP(LPVOID context, LPVOID fromUArgs, LPVOID codeUnits, int length, int codePoint, int reason, LPVOID err)');
# my $ret = $UCNV_FROM_U_CALLBACK_SKIP->Call($context, $fromUArgs, $codeUnits, $length, $codePoint, $reason, $err);
# context : void* -> LPVOID
# fromUArgs : UConverterFromUnicodeArgs* in/out -> LPVOID
# codeUnits : WORD* -> LPVOID
# length : INT -> int
# codePoint : INT -> int
# reason : UConverterCallbackReason -> int
# err : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型