ホーム › Globalization › ucnv_setToUCallBack
ucnv_setToUCallBack
関数変換器のUnicode方向への変換コールバックを設定する。
シグネチャ
// icuuc.dll
#include <windows.h>
void ucnv_setToUCallBack(
UConverter* converter,
UConverterToUCallback newAction,
const void* newContext,
UConverterToUCallback* oldAction,
const void** oldContext,
UErrorCode* err
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| converter | UConverter* | inout |
| newAction | UConverterToUCallback | in |
| newContext | void* | in |
| oldAction | UConverterToUCallback* | inout |
| oldContext | void** | in |
| err | UErrorCode* | inout |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void ucnv_setToUCallBack(
UConverter* converter,
UConverterToUCallback newAction,
const void* newContext,
UConverterToUCallback* oldAction,
const void** oldContext,
UErrorCode* err
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ucnv_setToUCallBack(
ref IntPtr converter, // UConverter* in/out
IntPtr newAction, // UConverterToUCallback
IntPtr newContext, // void*
IntPtr oldAction, // UConverterToUCallback* in/out
IntPtr oldContext, // void**
ref int err // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ucnv_setToUCallBack(
ByRef converter As IntPtr, ' UConverter* in/out
newAction As IntPtr, ' UConverterToUCallback
newContext As IntPtr, ' void*
oldAction As IntPtr, ' UConverterToUCallback* in/out
oldContext As IntPtr, ' void**
ByRef err As Integer ' UErrorCode* in/out
)
End Sub' converter : UConverter* in/out
' newAction : UConverterToUCallback
' newContext : void*
' oldAction : UConverterToUCallback* in/out
' oldContext : void**
' err : UErrorCode* in/out
Declare PtrSafe Sub ucnv_setToUCallBack 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_setToUCallBack = ctypes.cdll.icuuc.ucnv_setToUCallBack
ucnv_setToUCallBack.restype = None
ucnv_setToUCallBack.argtypes = [
ctypes.c_void_p, # converter : UConverter* in/out
ctypes.c_void_p, # newAction : UConverterToUCallback
ctypes.POINTER(None), # newContext : void*
ctypes.c_void_p, # oldAction : UConverterToUCallback* 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_setToUCallBack = Fiddle::Function.new(
lib['ucnv_setToUCallBack'],
[
Fiddle::TYPE_VOIDP, # converter : UConverter* in/out
Fiddle::TYPE_VOIDP, # newAction : UConverterToUCallback
Fiddle::TYPE_VOIDP, # newContext : void*
Fiddle::TYPE_VOIDP, # oldAction : UConverterToUCallback* 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_setToUCallBack(
converter: *mut isize, // UConverter* in/out
newAction: *const core::ffi::c_void, // UConverterToUCallback
newContext: *const (), // void*
oldAction: *mut *const core::ffi::c_void, // UConverterToUCallback* 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_setToUCallBack(ref IntPtr converter, IntPtr newAction, IntPtr newContext, IntPtr oldAction, IntPtr oldContext, ref int err);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_setToUCallBack' -Namespace Win32 -PassThru
# $api::ucnv_setToUCallBack(converter, newAction, newContext, oldAction, oldContext, err)#uselib "icuuc.dll"
#func global ucnv_setToUCallBack "ucnv_setToUCallBack" sptr, sptr, sptr, sptr, sptr, sptr
; ucnv_setToUCallBack converter, newAction, newContext, oldAction, oldContext, err
; converter : UConverter* in/out -> "sptr"
; newAction : UConverterToUCallback -> "sptr"
; newContext : void* -> "sptr"
; oldAction : UConverterToUCallback* in/out -> "sptr"
; oldContext : void** -> "sptr"
; err : UErrorCode* in/out -> "sptr"#uselib "icuuc.dll"
#func global ucnv_setToUCallBack "ucnv_setToUCallBack" int, sptr, sptr, sptr, sptr, int
; ucnv_setToUCallBack converter, newAction, newContext, oldAction, oldContext, err
; converter : UConverter* in/out -> "int"
; newAction : UConverterToUCallback -> "sptr"
; newContext : void* -> "sptr"
; oldAction : UConverterToUCallback* in/out -> "sptr"
; oldContext : void** -> "sptr"
; err : UErrorCode* in/out -> "int"; void ucnv_setToUCallBack(UConverter* converter, UConverterToUCallback newAction, void* newContext, UConverterToUCallback* oldAction, void** oldContext, UErrorCode* err)
#uselib "icuuc.dll"
#func global ucnv_setToUCallBack "ucnv_setToUCallBack" int, intptr, intptr, intptr, intptr, int
; ucnv_setToUCallBack converter, newAction, newContext, oldAction, oldContext, err
; converter : UConverter* in/out -> "int"
; newAction : UConverterToUCallback -> "intptr"
; newContext : void* -> "intptr"
; oldAction : UConverterToUCallback* 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_setToUCallBack = icuuc.NewProc("ucnv_setToUCallBack")
)
// converter (UConverter* in/out), newAction (UConverterToUCallback), newContext (void*), oldAction (UConverterToUCallback* in/out), oldContext (void**), err (UErrorCode* in/out)
r1, _, err := procucnv_setToUCallBack.Call(
uintptr(converter),
uintptr(newAction),
uintptr(newContext),
uintptr(oldAction),
uintptr(oldContext),
uintptr(err),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ucnv_setToUCallBack(
converter: Pointer; // UConverter* in/out
newAction: Pointer; // UConverterToUCallback
newContext: Pointer; // void*
oldAction: Pointer; // UConverterToUCallback* in/out
oldContext: Pointer; // void**
err: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'ucnv_setToUCallBack';result := DllCall("icuuc\ucnv_setToUCallBack"
, "Ptr", converter ; UConverter* in/out
, "Ptr", newAction ; UConverterToUCallback
, "Ptr", newContext ; void*
, "Ptr", oldAction ; UConverterToUCallback* in/out
, "Ptr", oldContext ; void**
, "Ptr", err ; UErrorCode* in/out
, "Cdecl Int") ; return: void●ucnv_setToUCallBack(converter, newAction, newContext, oldAction, oldContext, err) = DLL("icuuc.dll", "int ucnv_setToUCallBack(void*, void*, void*, void*, void*, void*)")
# 呼び出し: ucnv_setToUCallBack(converter, newAction, newContext, oldAction, oldContext, err)
# converter : UConverter* in/out -> "void*"
# newAction : UConverterToUCallback -> "void*"
# newContext : void* -> "void*"
# oldAction : UConverterToUCallback* 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`,…) を使用。