ホーム › Globalization › ucnv_getUnicodeSet
ucnv_getUnicodeSet
関数変換器が扱えるUnicode文字集合を取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
void ucnv_getUnicodeSet(
const UConverter* cnv,
USet* setFillIn,
UConverterUnicodeSet whichSet,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| cnv | UConverter* | in | 対象のコンバーターへのポインタ。 |
| setFillIn | USet* | inout | 変換可能/未対応の文字集合を受け取るUSetへのポインタ。 |
| whichSet | UConverterUnicodeSet | in | 取得する集合の種類(ROUNDTRIP_SET等)を示す列挙値。 |
| pErrorCode | UErrorCode* | inout | エラーコードを入出力するポインタ。事前にU_ZERO_ERRORで初期化する。 |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void ucnv_getUnicodeSet(
const UConverter* cnv,
USet* setFillIn,
UConverterUnicodeSet whichSet,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ucnv_getUnicodeSet(
ref IntPtr cnv, // UConverter*
ref IntPtr setFillIn, // USet* in/out
int whichSet, // UConverterUnicodeSet
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ucnv_getUnicodeSet(
ByRef cnv As IntPtr, ' UConverter*
ByRef setFillIn As IntPtr, ' USet* in/out
whichSet As Integer, ' UConverterUnicodeSet
ByRef pErrorCode As Integer ' UErrorCode* in/out
)
End Sub' cnv : UConverter*
' setFillIn : USet* in/out
' whichSet : UConverterUnicodeSet
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Sub ucnv_getUnicodeSet Lib "icuuc" ( _
ByRef cnv As LongPtr, _
ByRef setFillIn As LongPtr, _
ByVal whichSet As Long, _
ByRef pErrorCode As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucnv_getUnicodeSet = ctypes.cdll.icuuc.ucnv_getUnicodeSet
ucnv_getUnicodeSet.restype = None
ucnv_getUnicodeSet.argtypes = [
ctypes.c_void_p, # cnv : UConverter*
ctypes.c_void_p, # setFillIn : USet* in/out
ctypes.c_int, # whichSet : UConverterUnicodeSet
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucnv_getUnicodeSet = Fiddle::Function.new(
lib['ucnv_getUnicodeSet'],
[
Fiddle::TYPE_VOIDP, # cnv : UConverter*
Fiddle::TYPE_VOIDP, # setFillIn : USet* in/out
Fiddle::TYPE_INT, # whichSet : UConverterUnicodeSet
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucnv_getUnicodeSet(
cnv: *const isize, // UConverter*
setFillIn: *mut isize, // USet* in/out
whichSet: i32, // UConverterUnicodeSet
pErrorCode: *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_getUnicodeSet(ref IntPtr cnv, ref IntPtr setFillIn, int whichSet, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_getUnicodeSet' -Namespace Win32 -PassThru
# $api::ucnv_getUnicodeSet(cnv, setFillIn, whichSet, pErrorCode)#uselib "icuuc.dll"
#func global ucnv_getUnicodeSet "ucnv_getUnicodeSet" sptr, sptr, sptr, sptr
; ucnv_getUnicodeSet varptr(cnv), varptr(setFillIn), whichSet, varptr(pErrorCode)
; cnv : UConverter* -> "sptr"
; setFillIn : USet* in/out -> "sptr"
; whichSet : UConverterUnicodeSet -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"出力引数:
#uselib "icuuc.dll" #func global ucnv_getUnicodeSet "ucnv_getUnicodeSet" var, var, int, var ; ucnv_getUnicodeSet cnv, setFillIn, whichSet, pErrorCode ; cnv : UConverter* -> "var" ; setFillIn : USet* in/out -> "var" ; whichSet : UConverterUnicodeSet -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #func global ucnv_getUnicodeSet "ucnv_getUnicodeSet" sptr, sptr, int, sptr ; ucnv_getUnicodeSet varptr(cnv), varptr(setFillIn), whichSet, varptr(pErrorCode) ; cnv : UConverter* -> "sptr" ; setFillIn : USet* in/out -> "sptr" ; whichSet : UConverterUnicodeSet -> "int" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void ucnv_getUnicodeSet(UConverter* cnv, USet* setFillIn, UConverterUnicodeSet whichSet, UErrorCode* pErrorCode) #uselib "icuuc.dll" #func global ucnv_getUnicodeSet "ucnv_getUnicodeSet" var, var, int, var ; ucnv_getUnicodeSet cnv, setFillIn, whichSet, pErrorCode ; cnv : UConverter* -> "var" ; setFillIn : USet* in/out -> "var" ; whichSet : UConverterUnicodeSet -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void ucnv_getUnicodeSet(UConverter* cnv, USet* setFillIn, UConverterUnicodeSet whichSet, UErrorCode* pErrorCode) #uselib "icuuc.dll" #func global ucnv_getUnicodeSet "ucnv_getUnicodeSet" intptr, intptr, int, intptr ; ucnv_getUnicodeSet varptr(cnv), varptr(setFillIn), whichSet, varptr(pErrorCode) ; cnv : UConverter* -> "intptr" ; setFillIn : USet* in/out -> "intptr" ; whichSet : UConverterUnicodeSet -> "int" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucnv_getUnicodeSet = icuuc.NewProc("ucnv_getUnicodeSet")
)
// cnv (UConverter*), setFillIn (USet* in/out), whichSet (UConverterUnicodeSet), pErrorCode (UErrorCode* in/out)
r1, _, err := procucnv_getUnicodeSet.Call(
uintptr(cnv),
uintptr(setFillIn),
uintptr(whichSet),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ucnv_getUnicodeSet(
cnv: Pointer; // UConverter*
setFillIn: Pointer; // USet* in/out
whichSet: Integer; // UConverterUnicodeSet
pErrorCode: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'ucnv_getUnicodeSet';result := DllCall("icuuc\ucnv_getUnicodeSet"
, "Ptr", cnv ; UConverter*
, "Ptr", setFillIn ; USet* in/out
, "Int", whichSet ; UConverterUnicodeSet
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: void●ucnv_getUnicodeSet(cnv, setFillIn, whichSet, pErrorCode) = DLL("icuuc.dll", "int ucnv_getUnicodeSet(void*, void*, int, void*)")
# 呼び出し: ucnv_getUnicodeSet(cnv, setFillIn, whichSet, pErrorCode)
# cnv : UConverter* -> "void*"
# setFillIn : USet* in/out -> "void*"
# whichSet : UConverterUnicodeSet -> "int"
# pErrorCode : 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_getUnicodeSet(
cnv: [*c]isize, // UConverter*
setFillIn: [*c]isize, // USet* in/out
whichSet: i32, // UConverterUnicodeSet
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) void;proc ucnv_getUnicodeSet(
cnv: ptr int, # UConverter*
setFillIn: ptr int, # USet* in/out
whichSet: int32, # UConverterUnicodeSet
pErrorCode: ptr int32 # UErrorCode* in/out
) {.importc: "ucnv_getUnicodeSet", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
void ucnv_getUnicodeSet(
ptrdiff_t* cnv, // UConverter*
ptrdiff_t* setFillIn, // USet* in/out
int whichSet, // UConverterUnicodeSet
int* pErrorCode // UErrorCode* in/out
);ccall((:ucnv_getUnicodeSet, "icuuc.dll"), Cvoid,
(Ptr{Int}, Ptr{Int}, Int32, Ptr{Int32}),
cnv, setFillIn, whichSet, pErrorCode)
# cnv : UConverter* -> Ptr{Int}
# setFillIn : USet* in/out -> Ptr{Int}
# whichSet : UConverterUnicodeSet -> Int32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
void ucnv_getUnicodeSet(
intptr_t* cnv,
intptr_t* setFillIn,
int32_t whichSet,
int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.ucnv_getUnicodeSet(cnv, setFillIn, whichSet, pErrorCode)
-- cnv : UConverter*
-- setFillIn : USet* in/out
-- whichSet : UConverterUnicodeSet
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const ucnv_getUnicodeSet = lib.func('__cdecl', 'ucnv_getUnicodeSet', 'void', ['intptr_t *', 'intptr_t *', 'int32_t', 'int32_t *']);
// ucnv_getUnicodeSet(cnv, setFillIn, whichSet, pErrorCode)
// cnv : UConverter* -> 'intptr_t *'
// setFillIn : USet* in/out -> 'intptr_t *'
// whichSet : UConverterUnicodeSet -> 'int32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
ucnv_getUnicodeSet: { parameters: ["pointer", "pointer", "i32", "pointer"], result: "void" },
});
// lib.symbols.ucnv_getUnicodeSet(cnv, setFillIn, whichSet, pErrorCode)
// cnv : UConverter* -> "pointer"
// setFillIn : USet* in/out -> "pointer"
// whichSet : UConverterUnicodeSet -> "i32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void ucnv_getUnicodeSet(
intptr_t* cnv,
intptr_t* setFillIn,
int32_t whichSet,
int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->ucnv_getUnicodeSet(cnv, setFillIn, whichSet, pErrorCode);
// cnv : UConverter*
// setFillIn : USet* in/out
// whichSet : UConverterUnicodeSet
// pErrorCode : 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_getUnicodeSet(
LongByReference cnv, // UConverter*
LongByReference setFillIn, // USet* in/out
int whichSet, // UConverterUnicodeSet
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuuc")]
lib Libicuuc
fun ucnv_getUnicodeSet = ucnv_getUnicodeSet(
cnv : LibC::SSizeT*, # UConverter*
setFillIn : LibC::SSizeT*, # USet* in/out
whichSet : Int32, # UConverterUnicodeSet
pErrorCode : Int32* # UErrorCode* in/out
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucnv_getUnicodeSetNative = Void Function(Pointer<IntPtr>, Pointer<IntPtr>, Int32, Pointer<Int32>);
typedef ucnv_getUnicodeSetDart = void Function(Pointer<IntPtr>, Pointer<IntPtr>, int, Pointer<Int32>);
final ucnv_getUnicodeSet = DynamicLibrary.open('icuuc.dll')
.lookupFunction<ucnv_getUnicodeSetNative, ucnv_getUnicodeSetDart>('ucnv_getUnicodeSet');
// cnv : UConverter* -> Pointer<IntPtr>
// setFillIn : USet* in/out -> Pointer<IntPtr>
// whichSet : UConverterUnicodeSet -> Int32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure ucnv_getUnicodeSet(
cnv: Pointer; // UConverter*
setFillIn: Pointer; // USet* in/out
whichSet: Integer; // UConverterUnicodeSet
pErrorCode: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'ucnv_getUnicodeSet';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucnv_getUnicodeSet"
c_ucnv_getUnicodeSet :: Ptr CIntPtr -> Ptr CIntPtr -> Int32 -> Ptr Int32 -> IO ()
-- cnv : UConverter* -> Ptr CIntPtr
-- setFillIn : USet* in/out -> Ptr CIntPtr
-- whichSet : UConverterUnicodeSet -> Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucnv_getunicodeset =
foreign "ucnv_getUnicodeSet"
((ptr intptr_t) @-> (ptr intptr_t) @-> int32_t @-> (ptr int32_t) @-> returning void)
(* cnv : UConverter* -> (ptr intptr_t) *)
(* setFillIn : USet* in/out -> (ptr intptr_t) *)
(* whichSet : UConverterUnicodeSet -> int32_t *)
(* pErrorCode : 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_getUnicodeSet" ucnv-get-unicode-set :convention :cdecl) :void
(cnv :pointer) ; UConverter*
(set-fill-in :pointer) ; USet* in/out
(which-set :int32) ; UConverterUnicodeSet
(p-error-code :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucnv_getUnicodeSet = Win32::API::More->new('icuuc',
'void ucnv_getUnicodeSet(LPVOID cnv, LPVOID setFillIn, int whichSet, LPVOID pErrorCode)');
# my $ret = $ucnv_getUnicodeSet->Call($cnv, $setFillIn, $whichSet, $pErrorCode);
# cnv : UConverter* -> LPVOID
# setFillIn : USet* in/out -> LPVOID
# whichSet : UConverterUnicodeSet -> int
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。