ホーム › Globalization › ucnv_getToUCallBack
ucnv_getToUCallBack
関数変換器のUnicode方向への変換コールバックを取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
void ucnv_getToUCallBack(
const UConverter* converter,
UConverterToUCallback* action,
const void** context
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| converter | UConverter* | in | 対象のコンバーターへのポインタ。 |
| action | UConverterToUCallback* | inout | 現在のToUnicodeコールバック関数を受け取る出力ポインタ。 |
| context | void** | in | 現在のコールバックコンテキストを受け取る出力ポインタ。 |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void ucnv_getToUCallBack(
const UConverter* converter,
UConverterToUCallback* action,
const void** context
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ucnv_getToUCallBack(
ref IntPtr converter, // UConverter*
IntPtr action, // UConverterToUCallback* in/out
IntPtr context // void**
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ucnv_getToUCallBack(
ByRef converter As IntPtr, ' UConverter*
action As IntPtr, ' UConverterToUCallback* in/out
context As IntPtr ' void**
)
End Sub' converter : UConverter*
' action : UConverterToUCallback* in/out
' context : void**
Declare PtrSafe Sub ucnv_getToUCallBack Lib "icuuc" ( _
ByRef converter As LongPtr, _
ByVal action As LongPtr, _
ByVal context As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucnv_getToUCallBack = ctypes.cdll.icuuc.ucnv_getToUCallBack
ucnv_getToUCallBack.restype = None
ucnv_getToUCallBack.argtypes = [
ctypes.c_void_p, # converter : UConverter*
ctypes.c_void_p, # action : UConverterToUCallback* in/out
ctypes.c_void_p, # context : void**
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucnv_getToUCallBack = Fiddle::Function.new(
lib['ucnv_getToUCallBack'],
[
Fiddle::TYPE_VOIDP, # converter : UConverter*
Fiddle::TYPE_VOIDP, # action : UConverterToUCallback* in/out
Fiddle::TYPE_VOIDP, # context : void**
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucnv_getToUCallBack(
converter: *const isize, // UConverter*
action: *mut *const core::ffi::c_void, // UConverterToUCallback* in/out
context: *const *const () // void**
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ucnv_getToUCallBack(ref IntPtr converter, IntPtr action, IntPtr context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_getToUCallBack' -Namespace Win32 -PassThru
# $api::ucnv_getToUCallBack(converter, action, context)#uselib "icuuc.dll"
#func global ucnv_getToUCallBack "ucnv_getToUCallBack" sptr, sptr, sptr
; ucnv_getToUCallBack varptr(converter), action, context
; converter : UConverter* -> "sptr"
; action : UConverterToUCallback* in/out -> "sptr"
; context : void** -> "sptr"出力引数:
#uselib "icuuc.dll" #func global ucnv_getToUCallBack "ucnv_getToUCallBack" var, sptr, sptr ; ucnv_getToUCallBack converter, action, context ; converter : UConverter* -> "var" ; action : UConverterToUCallback* in/out -> "sptr" ; context : void** -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #func global ucnv_getToUCallBack "ucnv_getToUCallBack" sptr, sptr, sptr ; ucnv_getToUCallBack varptr(converter), action, context ; converter : UConverter* -> "sptr" ; action : UConverterToUCallback* in/out -> "sptr" ; context : void** -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void ucnv_getToUCallBack(UConverter* converter, UConverterToUCallback* action, void** context) #uselib "icuuc.dll" #func global ucnv_getToUCallBack "ucnv_getToUCallBack" var, intptr, intptr ; ucnv_getToUCallBack converter, action, context ; converter : UConverter* -> "var" ; action : UConverterToUCallback* in/out -> "intptr" ; context : void** -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void ucnv_getToUCallBack(UConverter* converter, UConverterToUCallback* action, void** context) #uselib "icuuc.dll" #func global ucnv_getToUCallBack "ucnv_getToUCallBack" intptr, intptr, intptr ; ucnv_getToUCallBack varptr(converter), action, context ; converter : UConverter* -> "intptr" ; action : UConverterToUCallback* in/out -> "intptr" ; context : void** -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucnv_getToUCallBack = icuuc.NewProc("ucnv_getToUCallBack")
)
// converter (UConverter*), action (UConverterToUCallback* in/out), context (void**)
r1, _, err := procucnv_getToUCallBack.Call(
uintptr(converter),
uintptr(action),
uintptr(context),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ucnv_getToUCallBack(
converter: Pointer; // UConverter*
action: Pointer; // UConverterToUCallback* in/out
context: Pointer // void**
); cdecl;
external 'icuuc.dll' name 'ucnv_getToUCallBack';result := DllCall("icuuc\ucnv_getToUCallBack"
, "Ptr", converter ; UConverter*
, "Ptr", action ; UConverterToUCallback* in/out
, "Ptr", context ; void**
, "Cdecl Int") ; return: void●ucnv_getToUCallBack(converter, action, context) = DLL("icuuc.dll", "int ucnv_getToUCallBack(void*, void*, void*)")
# 呼び出し: ucnv_getToUCallBack(converter, action, context)
# converter : UConverter* -> "void*"
# action : UConverterToUCallback* in/out -> "void*"
# context : void** -> "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_getToUCallBack(
converter: [*c]isize, // UConverter*
action: ?*anyopaque, // UConverterToUCallback* in/out
context: ?*anyopaque // void**
) callconv(.c) void;proc ucnv_getToUCallBack(
`converter`: ptr int, # UConverter*
action: pointer, # UConverterToUCallback* in/out
context: pointer # void**
) {.importc: "ucnv_getToUCallBack", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
void ucnv_getToUCallBack(
ptrdiff_t* converter, // UConverter*
void* action, // UConverterToUCallback* in/out
void** context // void**
);ccall((:ucnv_getToUCallBack, "icuuc.dll"), Cvoid,
(Ptr{Int}, Ptr{Cvoid}, Ptr{Cvoid}),
converter, action, context)
# converter : UConverter* -> Ptr{Int}
# action : UConverterToUCallback* in/out -> Ptr{Cvoid}
# context : void** -> Ptr{Cvoid}local ffi = require("ffi")
ffi.cdef[[
void ucnv_getToUCallBack(
intptr_t* converter,
void* action,
void** context);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.ucnv_getToUCallBack(converter, action, context)
-- converter : UConverter*
-- action : UConverterToUCallback* in/out
-- context : void**
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const ucnv_getToUCallBack = lib.func('__cdecl', 'ucnv_getToUCallBack', 'void', ['intptr_t *', 'void *', 'void *']);
// ucnv_getToUCallBack(converter, action, context)
// converter : UConverter* -> 'intptr_t *'
// action : UConverterToUCallback* in/out -> 'void *'
// context : void** -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("icuuc.dll", {
ucnv_getToUCallBack: { parameters: ["pointer", "pointer", "pointer"], result: "void" },
});
// lib.symbols.ucnv_getToUCallBack(converter, action, context)
// converter : UConverter* -> "pointer"
// action : UConverterToUCallback* in/out -> "pointer"
// context : void** -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void ucnv_getToUCallBack(
intptr_t* converter,
void* action,
void** context);
C, "icuuc.dll");
// $ffi->ucnv_getToUCallBack(converter, action, context);
// converter : UConverter*
// action : UConverterToUCallback* in/out
// context : void**
// 構造体/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_getToUCallBack(
LongByReference converter, // UConverter*
Callback action, // UConverterToUCallback* in/out
Pointer context // void**
);
}@[Link("icuuc")]
lib Libicuuc
fun ucnv_getToUCallBack = ucnv_getToUCallBack(
converter : LibC::SSizeT*, # UConverter*
action : Void*, # UConverterToUCallback* in/out
context : Void** # void**
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucnv_getToUCallBackNative = Void Function(Pointer<IntPtr>, Pointer<Void>, Pointer<Void>);
typedef ucnv_getToUCallBackDart = void Function(Pointer<IntPtr>, Pointer<Void>, Pointer<Void>);
final ucnv_getToUCallBack = DynamicLibrary.open('icuuc.dll')
.lookupFunction<ucnv_getToUCallBackNative, ucnv_getToUCallBackDart>('ucnv_getToUCallBack');
// converter : UConverter* -> Pointer<IntPtr>
// action : UConverterToUCallback* in/out -> Pointer<Void>
// context : void** -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure ucnv_getToUCallBack(
converter: Pointer; // UConverter*
action: Pointer; // UConverterToUCallback* in/out
context: Pointer // void**
); cdecl;
external 'icuuc.dll' name 'ucnv_getToUCallBack';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucnv_getToUCallBack"
c_ucnv_getToUCallBack :: Ptr CIntPtr -> Ptr () -> Ptr () -> IO ()
-- converter : UConverter* -> Ptr CIntPtr
-- action : UConverterToUCallback* in/out -> Ptr ()
-- context : void** -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucnv_gettoucallback =
foreign "ucnv_getToUCallBack"
((ptr intptr_t) @-> (ptr void) @-> (ptr void) @-> returning void)
(* converter : UConverter* -> (ptr intptr_t) *)
(* action : UConverterToUCallback* in/out -> (ptr void) *)
(* context : void** -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("ucnv_getToUCallBack" ucnv-get-to-ucall-back :convention :cdecl) :void
(converter :pointer) ; UConverter*
(action :pointer) ; UConverterToUCallback* in/out
(context :pointer)) ; void**
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucnv_getToUCallBack = Win32::API::More->new('icuuc',
'void ucnv_getToUCallBack(LPVOID converter, LPVOID action, LPVOID context)');
# my $ret = $ucnv_getToUCallBack->Call($converter, $action, $context);
# converter : UConverter* -> LPVOID
# action : UConverterToUCallback* in/out -> LPVOID
# context : void** -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。