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

ucnvsel_open

関数
コンバータ選択器UConverterSelectorを生成する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

UConverterSelector* ucnvsel_open(
    const CHAR** converterList,
    INT converterListSize,
    const USet* excludedCodePoints,
    UConverterUnicodeSet whichSet,
    UErrorCode* status
);

パラメーター

名前方向説明
converterListCHAR**in候補となるコンバータ名(C文字列)の配列へのポインタ。NULLで全コンバータ対象。
converterListSizeINTinconverterListの要素数。0でNULL指定時は全コンバータを使用する。
excludedCodePointsUSet*in選択から除外するコードポイント集合。NULL可。
whichSetUConverterUnicodeSetin各コンバータのどのUnicode集合を用いるかを示すUConverterUnicodeSet列挙値。
statusUErrorCode*inoutエラーコードを受け取るUErrorCodeポインタ。コンバータセレクタを返す。

戻り値の型: UConverterSelector*

各言語での呼び出し定義

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

UConverterSelector* ucnvsel_open(
    const CHAR** converterList,
    INT converterListSize,
    const USet* excludedCodePoints,
    UConverterUnicodeSet whichSet,
    UErrorCode* status
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucnvsel_open(
    IntPtr converterList,   // CHAR**
    int converterListSize,   // INT
    ref IntPtr excludedCodePoints,   // USet*
    int whichSet,   // UConverterUnicodeSet
    ref int status   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucnvsel_open(
    converterList As IntPtr,   ' CHAR**
    converterListSize As Integer,   ' INT
    ByRef excludedCodePoints As IntPtr,   ' USet*
    whichSet As Integer,   ' UConverterUnicodeSet
    ByRef status As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' converterList : CHAR**
' converterListSize : INT
' excludedCodePoints : USet*
' whichSet : UConverterUnicodeSet
' status : UErrorCode* in/out
Declare PtrSafe Function ucnvsel_open Lib "icuuc" ( _
    ByVal converterList As LongPtr, _
    ByVal converterListSize As Long, _
    ByRef excludedCodePoints As LongPtr, _
    ByVal whichSet As Long, _
    ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucnvsel_open = ctypes.cdll.icuuc.ucnvsel_open
ucnvsel_open.restype = ctypes.c_void_p
ucnvsel_open.argtypes = [
    ctypes.c_void_p,  # converterList : CHAR**
    ctypes.c_int,  # converterListSize : INT
    ctypes.c_void_p,  # excludedCodePoints : USet*
    ctypes.c_int,  # whichSet : UConverterUnicodeSet
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ucnvsel_open = Fiddle::Function.new(
  lib['ucnvsel_open'],
  [
    Fiddle::TYPE_VOIDP,  # converterList : CHAR**
    Fiddle::TYPE_INT,  # converterListSize : INT
    Fiddle::TYPE_VOIDP,  # excludedCodePoints : USet*
    Fiddle::TYPE_INT,  # whichSet : UConverterUnicodeSet
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ucnvsel_open(
        converterList: *const *const i8,  // CHAR**
        converterListSize: i32,  // INT
        excludedCodePoints: *const isize,  // USet*
        whichSet: i32,  // UConverterUnicodeSet
        status: *mut i32  // UErrorCode* in/out
    ) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ucnvsel_open(IntPtr converterList, int converterListSize, ref IntPtr excludedCodePoints, int whichSet, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnvsel_open' -Namespace Win32 -PassThru
# $api::ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status)
#uselib "icuuc.dll"
#func global ucnvsel_open "ucnvsel_open" sptr, sptr, sptr, sptr, sptr
; ucnvsel_open varptr(converterList), converterListSize, varptr(excludedCodePoints), whichSet, varptr(status)   ; 戻り値は stat
; converterList : CHAR** -> "sptr"
; converterListSize : INT -> "sptr"
; excludedCodePoints : USet* -> "sptr"
; whichSet : UConverterUnicodeSet -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global ucnvsel_open "ucnvsel_open" var, int, var, int, var
; res = ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status)
; converterList : CHAR** -> "var"
; converterListSize : INT -> "int"
; excludedCodePoints : USet* -> "var"
; whichSet : UConverterUnicodeSet -> "int"
; status : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; UConverterSelector* ucnvsel_open(CHAR** converterList, INT converterListSize, USet* excludedCodePoints, UConverterUnicodeSet whichSet, UErrorCode* status)
#uselib "icuuc.dll"
#cfunc global ucnvsel_open "ucnvsel_open" var, int, var, int, var
; res = ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status)
; converterList : CHAR** -> "var"
; converterListSize : INT -> "int"
; excludedCodePoints : USet* -> "var"
; whichSet : UConverterUnicodeSet -> "int"
; status : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucnvsel_open = icuuc.NewProc("ucnvsel_open")
)

// converterList (CHAR**), converterListSize (INT), excludedCodePoints (USet*), whichSet (UConverterUnicodeSet), status (UErrorCode* in/out)
r1, _, err := procucnvsel_open.Call(
	uintptr(converterList),
	uintptr(converterListSize),
	uintptr(excludedCodePoints),
	uintptr(whichSet),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UConverterSelector*
function ucnvsel_open(
  converterList: Pointer;   // CHAR**
  converterListSize: Integer;   // INT
  excludedCodePoints: Pointer;   // USet*
  whichSet: Integer;   // UConverterUnicodeSet
  status: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuuc.dll' name 'ucnvsel_open';
result := DllCall("icuuc\ucnvsel_open"
    , "Ptr", converterList   ; CHAR**
    , "Int", converterListSize   ; INT
    , "Ptr", excludedCodePoints   ; USet*
    , "Int", whichSet   ; UConverterUnicodeSet
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: UConverterSelector*
●ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status) = DLL("icuuc.dll", "void* ucnvsel_open(void*, int, void*, int, void*)")
# 呼び出し: ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status)
# converterList : CHAR** -> "void*"
# converterListSize : INT -> "int"
# excludedCodePoints : USet* -> "void*"
# whichSet : UConverterUnicodeSet -> "int"
# status : 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 ucnvsel_open(
    converterList: [*c][*c]i8, // CHAR**
    converterListSize: i32, // INT
    excludedCodePoints: [*c]isize, // USet*
    whichSet: i32, // UConverterUnicodeSet
    status: [*c]i32 // UErrorCode* in/out
) callconv(.c) [*c]isize;
proc ucnvsel_open(
    converterList: ptr int8,  # CHAR**
    converterListSize: int32,  # INT
    excludedCodePoints: ptr int,  # USet*
    whichSet: int32,  # UConverterUnicodeSet
    status: ptr int32  # UErrorCode* in/out
): ptr int {.importc: "ucnvsel_open", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
ptrdiff_t* ucnvsel_open(
    byte** converterList,   // CHAR**
    int converterListSize,   // INT
    ptrdiff_t* excludedCodePoints,   // USet*
    int whichSet,   // UConverterUnicodeSet
    int* status   // UErrorCode* in/out
);
ccall((:ucnvsel_open, "icuuc.dll"), Ptr{Int},
      (Ptr{Int8}, Int32, Ptr{Int}, Int32, Ptr{Int32}),
      converterList, converterListSize, excludedCodePoints, whichSet, status)
# converterList : CHAR** -> Ptr{Int8}
# converterListSize : INT -> Int32
# excludedCodePoints : USet* -> Ptr{Int}
# whichSet : UConverterUnicodeSet -> Int32
# status : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
intptr_t* ucnvsel_open(
    int8_t** converterList,
    int32_t converterListSize,
    intptr_t* excludedCodePoints,
    int32_t whichSet,
    int32_t* status);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status)
-- converterList : CHAR**
-- converterListSize : INT
-- excludedCodePoints : USet*
-- whichSet : UConverterUnicodeSet
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const ucnvsel_open = lib.func('__cdecl', 'ucnvsel_open', 'intptr_t *', ['int8_t *', 'int32_t', 'intptr_t *', 'int32_t', 'int32_t *']);
// ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status)
// converterList : CHAR** -> 'int8_t *'
// converterListSize : INT -> 'int32_t'
// excludedCodePoints : USet* -> 'intptr_t *'
// whichSet : UConverterUnicodeSet -> 'int32_t'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  ucnvsel_open: { parameters: ["pointer", "i32", "pointer", "i32", "pointer"], result: "pointer" },
});
// lib.symbols.ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status)
// converterList : CHAR** -> "pointer"
// converterListSize : INT -> "i32"
// excludedCodePoints : USet* -> "pointer"
// whichSet : UConverterUnicodeSet -> "i32"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
intptr_t* ucnvsel_open(
    int8_t** converterList,
    int32_t converterListSize,
    intptr_t* excludedCodePoints,
    int32_t whichSet,
    int32_t* status);
C, "icuuc.dll");
// $ffi->ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status);
// converterList : CHAR**
// converterListSize : INT
// excludedCodePoints : USet*
// whichSet : UConverterUnicodeSet
// status : 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);
    Pointer ucnvsel_open(
        Pointer converterList,   // CHAR**
        int converterListSize,   // INT
        LongByReference excludedCodePoints,   // USet*
        int whichSet,   // UConverterUnicodeSet
        IntByReference status   // UErrorCode* in/out
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun ucnvsel_open = ucnvsel_open(
    converterList : Int8**,   # CHAR**
    converterListSize : Int32,   # INT
    excludedCodePoints : LibC::SSizeT*,   # USet*
    whichSet : Int32,   # UConverterUnicodeSet
    status : Int32*   # UErrorCode* in/out
  ) : LibC::SSizeT*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ucnvsel_openNative = Pointer<IntPtr> Function(Pointer<Int8>, Int32, Pointer<IntPtr>, Int32, Pointer<Int32>);
typedef ucnvsel_openDart = Pointer<IntPtr> Function(Pointer<Int8>, int, Pointer<IntPtr>, int, Pointer<Int32>);
final ucnvsel_open = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<ucnvsel_openNative, ucnvsel_openDart>('ucnvsel_open');
// converterList : CHAR** -> Pointer<Int8>
// converterListSize : INT -> Int32
// excludedCodePoints : USet* -> Pointer<IntPtr>
// whichSet : UConverterUnicodeSet -> Int32
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ucnvsel_open(
  converterList: Pointer;   // CHAR**
  converterListSize: Integer;   // INT
  excludedCodePoints: Pointer;   // USet*
  whichSet: Integer;   // UConverterUnicodeSet
  status: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuuc.dll' name 'ucnvsel_open';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ucnvsel_open"
  c_ucnvsel_open :: Ptr Int8 -> Int32 -> Ptr CIntPtr -> Int32 -> Ptr Int32 -> IO (Ptr CIntPtr)
-- converterList : CHAR** -> Ptr Int8
-- converterListSize : INT -> Int32
-- excludedCodePoints : USet* -> Ptr CIntPtr
-- whichSet : UConverterUnicodeSet -> Int32
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ucnvsel_open =
  foreign "ucnvsel_open"
    ((ptr int8_t) @-> int32_t @-> (ptr intptr_t) @-> int32_t @-> (ptr int32_t) @-> returning (ptr intptr_t))
(* converterList : CHAR** -> (ptr int8_t) *)
(* converterListSize : INT -> int32_t *)
(* excludedCodePoints : USet* -> (ptr intptr_t) *)
(* whichSet : UConverterUnicodeSet -> int32_t *)
(* status : 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 ("ucnvsel_open" ucnvsel-open :convention :cdecl) :pointer
  (converter-list :pointer)   ; CHAR**
  (converter-list-size :int32)   ; INT
  (excluded-code-points :pointer)   ; USet*
  (which-set :int32)   ; UConverterUnicodeSet
  (status :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ucnvsel_open = Win32::API::More->new('icuuc',
    'LPVOID ucnvsel_open(LPVOID converterList, int converterListSize, LPVOID excludedCodePoints, int whichSet, LPVOID status)');
# my $ret = $ucnvsel_open->Call($converterList, $converterListSize, $excludedCodePoints, $whichSet, $status);
# converterList : CHAR** -> LPVOID
# converterListSize : INT -> int
# excludedCodePoints : USet* -> LPVOID
# whichSet : UConverterUnicodeSet -> int
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型