ホーム › Globalization › ucnvsel_open
ucnvsel_open
関数コンバータ選択器UConverterSelectorを生成する。
シグネチャ
// icuuc.dll
#include <windows.h>
UConverterSelector* ucnvsel_open(
const CHAR** converterList,
INT converterListSize,
const USet* excludedCodePoints,
UConverterUnicodeSet whichSet,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| converterList | CHAR** | in |
| converterListSize | INT | in |
| excludedCodePoints | USet* | in |
| whichSet | UConverterUnicodeSet | in |
| status | UErrorCode* | inout |
戻り値の型: 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, excludedCodePoints, whichSet, 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, int, int, int ; res = ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status) ; converterList : CHAR** -> "var" ; converterListSize : INT -> "int" ; excludedCodePoints : USet* -> "int" ; whichSet : UConverterUnicodeSet -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global ucnvsel_open "ucnvsel_open" sptr, int, int, int, int ; res = ucnvsel_open(varptr(converterList), converterListSize, excludedCodePoints, whichSet, status) ; converterList : CHAR** -> "sptr" ; converterListSize : INT -> "int" ; excludedCodePoints : USet* -> "int" ; whichSet : UConverterUnicodeSet -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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, int, int, int ; res = ucnvsel_open(converterList, converterListSize, excludedCodePoints, whichSet, status) ; converterList : CHAR** -> "var" ; converterListSize : INT -> "int" ; excludedCodePoints : USet* -> "int" ; whichSet : UConverterUnicodeSet -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; UConverterSelector* ucnvsel_open(CHAR** converterList, INT converterListSize, USet* excludedCodePoints, UConverterUnicodeSet whichSet, UErrorCode* status) #uselib "icuuc.dll" #cfunc global ucnvsel_open "ucnvsel_open" intptr, int, int, int, int ; res = ucnvsel_open(varptr(converterList), converterListSize, excludedCodePoints, whichSet, status) ; converterList : CHAR** -> "intptr" ; converterListSize : INT -> "int" ; excludedCodePoints : USet* -> "int" ; whichSet : UConverterUnicodeSet -> "int" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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`,…) を使用。