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

ucnv_setFromUCallBack

関数
変換器のUnicode方向からの変換コールバックを設定する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

void ucnv_setFromUCallBack(
    UConverter* converter,
    UConverterFromUCallback newAction,
    const void* newContext,
    UConverterFromUCallback* oldAction,
    const void** oldContext,
    UErrorCode* err
);

パラメーター

名前方向
converterUConverter*inout
newActionUConverterFromUCallbackin
newContextvoid*in
oldActionUConverterFromUCallback*inout
oldContextvoid**in
errUErrorCode*inout

戻り値の型: void

各言語での呼び出し定義

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

void ucnv_setFromUCallBack(
    UConverter* converter,
    UConverterFromUCallback newAction,
    const void* newContext,
    UConverterFromUCallback* oldAction,
    const void** oldContext,
    UErrorCode* err
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ucnv_setFromUCallBack(
    ref IntPtr converter,   // UConverter* in/out
    IntPtr newAction,   // UConverterFromUCallback
    IntPtr newContext,   // void*
    IntPtr oldAction,   // UConverterFromUCallback* in/out
    IntPtr oldContext,   // void**
    ref int err   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ucnv_setFromUCallBack(
    ByRef converter As IntPtr,   ' UConverter* in/out
    newAction As IntPtr,   ' UConverterFromUCallback
    newContext As IntPtr,   ' void*
    oldAction As IntPtr,   ' UConverterFromUCallback* in/out
    oldContext As IntPtr,   ' void**
    ByRef err As Integer   ' UErrorCode* in/out
)
End Sub
' converter : UConverter* in/out
' newAction : UConverterFromUCallback
' newContext : void*
' oldAction : UConverterFromUCallback* in/out
' oldContext : void**
' err : UErrorCode* in/out
Declare PtrSafe Sub ucnv_setFromUCallBack Lib "icuuc" ( _
    ByRef converter As LongPtr, _
    ByVal newAction As LongPtr, _
    ByVal newContext As LongPtr, _
    ByVal oldAction As LongPtr, _
    ByVal oldContext As LongPtr, _
    ByRef err As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucnv_setFromUCallBack = ctypes.cdll.icuuc.ucnv_setFromUCallBack
ucnv_setFromUCallBack.restype = None
ucnv_setFromUCallBack.argtypes = [
    ctypes.c_void_p,  # converter : UConverter* in/out
    ctypes.c_void_p,  # newAction : UConverterFromUCallback
    ctypes.POINTER(None),  # newContext : void*
    ctypes.c_void_p,  # oldAction : UConverterFromUCallback* in/out
    ctypes.c_void_p,  # oldContext : void**
    ctypes.c_void_p,  # err : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ucnv_setFromUCallBack = Fiddle::Function.new(
  lib['ucnv_setFromUCallBack'],
  [
    Fiddle::TYPE_VOIDP,  # converter : UConverter* in/out
    Fiddle::TYPE_VOIDP,  # newAction : UConverterFromUCallback
    Fiddle::TYPE_VOIDP,  # newContext : void*
    Fiddle::TYPE_VOIDP,  # oldAction : UConverterFromUCallback* in/out
    Fiddle::TYPE_VOIDP,  # oldContext : void**
    Fiddle::TYPE_VOIDP,  # err : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ucnv_setFromUCallBack(
        converter: *mut isize,  // UConverter* in/out
        newAction: *const core::ffi::c_void,  // UConverterFromUCallback
        newContext: *const (),  // void*
        oldAction: *mut *const core::ffi::c_void,  // UConverterFromUCallback* in/out
        oldContext: *const *const (),  // void**
        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_setFromUCallBack(ref IntPtr converter, IntPtr newAction, IntPtr newContext, IntPtr oldAction, IntPtr oldContext, ref int err);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_setFromUCallBack' -Namespace Win32 -PassThru
# $api::ucnv_setFromUCallBack(converter, newAction, newContext, oldAction, oldContext, err)
#uselib "icuuc.dll"
#func global ucnv_setFromUCallBack "ucnv_setFromUCallBack" sptr, sptr, sptr, sptr, sptr, sptr
; ucnv_setFromUCallBack converter, newAction, newContext, oldAction, oldContext, err
; converter : UConverter* in/out -> "sptr"
; newAction : UConverterFromUCallback -> "sptr"
; newContext : void* -> "sptr"
; oldAction : UConverterFromUCallback* in/out -> "sptr"
; oldContext : void** -> "sptr"
; err : UErrorCode* in/out -> "sptr"
#uselib "icuuc.dll"
#func global ucnv_setFromUCallBack "ucnv_setFromUCallBack" int, sptr, sptr, sptr, sptr, int
; ucnv_setFromUCallBack converter, newAction, newContext, oldAction, oldContext, err
; converter : UConverter* in/out -> "int"
; newAction : UConverterFromUCallback -> "sptr"
; newContext : void* -> "sptr"
; oldAction : UConverterFromUCallback* in/out -> "sptr"
; oldContext : void** -> "sptr"
; err : UErrorCode* in/out -> "int"
; void ucnv_setFromUCallBack(UConverter* converter, UConverterFromUCallback newAction, void* newContext, UConverterFromUCallback* oldAction, void** oldContext, UErrorCode* err)
#uselib "icuuc.dll"
#func global ucnv_setFromUCallBack "ucnv_setFromUCallBack" int, intptr, intptr, intptr, intptr, int
; ucnv_setFromUCallBack converter, newAction, newContext, oldAction, oldContext, err
; converter : UConverter* in/out -> "int"
; newAction : UConverterFromUCallback -> "intptr"
; newContext : void* -> "intptr"
; oldAction : UConverterFromUCallback* in/out -> "intptr"
; oldContext : void** -> "intptr"
; err : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucnv_setFromUCallBack = icuuc.NewProc("ucnv_setFromUCallBack")
)

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