ホーム › Globalization › u_enumCharNames
u_enumCharNames
関数指定範囲の文字名をコールバックで列挙する。
シグネチャ
// icuuc.dll
#include <windows.h>
void u_enumCharNames(
INT start,
INT limit,
UEnumCharNamesFn* fn,
void* context,
UCharNameChoice nameChoice,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| start | INT | in | 列挙を開始するコードポイント(この値を含む)。 |
| limit | INT | in | 列挙を終了するコードポイント(この値は含まない上限)。 |
| fn | UEnumCharNamesFn* | inout | 各文字名ごとに呼び出されるコールバック関数(UEnumCharNamesFn)へのポインタ。 |
| context | void* | inout | コールバックへそのまま渡されるユーザー定義データへのポインタ。NULL可。 |
| nameChoice | UCharNameChoice | in | 列挙対象とする名称の種類を指定する列挙値。 |
| pErrorCode | UErrorCode* | inout | ICUのエラーコードを受け渡すポインタ。呼び出し前にU_ZERO_ERRORで初期化する。 |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void u_enumCharNames(
INT start,
INT limit,
UEnumCharNamesFn* fn,
void* context,
UCharNameChoice nameChoice,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void u_enumCharNames(
int start, // INT
int limit, // INT
IntPtr fn, // UEnumCharNamesFn* in/out
IntPtr context, // void* in/out
int nameChoice, // UCharNameChoice
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub u_enumCharNames(
start As Integer, ' INT
limit As Integer, ' INT
fn As IntPtr, ' UEnumCharNamesFn* in/out
context As IntPtr, ' void* in/out
nameChoice As Integer, ' UCharNameChoice
ByRef pErrorCode As Integer ' UErrorCode* in/out
)
End Sub' start : INT
' limit : INT
' fn : UEnumCharNamesFn* in/out
' context : void* in/out
' nameChoice : UCharNameChoice
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Sub u_enumCharNames Lib "icuuc" ( _
ByVal start As Long, _
ByVal limit As Long, _
ByVal fn As LongPtr, _
ByVal context As LongPtr, _
ByVal nameChoice As Long, _
ByRef pErrorCode As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
u_enumCharNames = ctypes.cdll.icuuc.u_enumCharNames
u_enumCharNames.restype = None
u_enumCharNames.argtypes = [
ctypes.c_int, # start : INT
ctypes.c_int, # limit : INT
ctypes.c_void_p, # fn : UEnumCharNamesFn* in/out
ctypes.POINTER(None), # context : void* in/out
ctypes.c_int, # nameChoice : UCharNameChoice
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
u_enumCharNames = Fiddle::Function.new(
lib['u_enumCharNames'],
[
Fiddle::TYPE_INT, # start : INT
Fiddle::TYPE_INT, # limit : INT
Fiddle::TYPE_VOIDP, # fn : UEnumCharNamesFn* in/out
Fiddle::TYPE_VOIDP, # context : void* in/out
Fiddle::TYPE_INT, # nameChoice : UCharNameChoice
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn u_enumCharNames(
start: i32, // INT
limit: i32, // INT
fn: *mut *const core::ffi::c_void, // UEnumCharNamesFn* in/out
context: *mut (), // void* in/out
nameChoice: i32, // UCharNameChoice
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 u_enumCharNames(int start, int limit, IntPtr fn, IntPtr context, int nameChoice, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_enumCharNames' -Namespace Win32 -PassThru
# $api::u_enumCharNames(start, limit, fn, context, nameChoice, pErrorCode)#uselib "icuuc.dll"
#func global u_enumCharNames "u_enumCharNames" sptr, sptr, sptr, sptr, sptr, sptr
; u_enumCharNames start, limit, fn, context, nameChoice, varptr(pErrorCode)
; start : INT -> "sptr"
; limit : INT -> "sptr"
; fn : UEnumCharNamesFn* in/out -> "sptr"
; context : void* in/out -> "sptr"
; nameChoice : UCharNameChoice -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"出力引数:
#uselib "icuuc.dll" #func global u_enumCharNames "u_enumCharNames" int, int, sptr, sptr, int, var ; u_enumCharNames start, limit, fn, context, nameChoice, pErrorCode ; start : INT -> "int" ; limit : INT -> "int" ; fn : UEnumCharNamesFn* in/out -> "sptr" ; context : void* in/out -> "sptr" ; nameChoice : UCharNameChoice -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #func global u_enumCharNames "u_enumCharNames" int, int, sptr, sptr, int, sptr ; u_enumCharNames start, limit, fn, context, nameChoice, varptr(pErrorCode) ; start : INT -> "int" ; limit : INT -> "int" ; fn : UEnumCharNamesFn* in/out -> "sptr" ; context : void* in/out -> "sptr" ; nameChoice : UCharNameChoice -> "int" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void u_enumCharNames(INT start, INT limit, UEnumCharNamesFn* fn, void* context, UCharNameChoice nameChoice, UErrorCode* pErrorCode) #uselib "icuuc.dll" #func global u_enumCharNames "u_enumCharNames" int, int, intptr, intptr, int, var ; u_enumCharNames start, limit, fn, context, nameChoice, pErrorCode ; start : INT -> "int" ; limit : INT -> "int" ; fn : UEnumCharNamesFn* in/out -> "intptr" ; context : void* in/out -> "intptr" ; nameChoice : UCharNameChoice -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void u_enumCharNames(INT start, INT limit, UEnumCharNamesFn* fn, void* context, UCharNameChoice nameChoice, UErrorCode* pErrorCode) #uselib "icuuc.dll" #func global u_enumCharNames "u_enumCharNames" int, int, intptr, intptr, int, intptr ; u_enumCharNames start, limit, fn, context, nameChoice, varptr(pErrorCode) ; start : INT -> "int" ; limit : INT -> "int" ; fn : UEnumCharNamesFn* in/out -> "intptr" ; context : void* in/out -> "intptr" ; nameChoice : UCharNameChoice -> "int" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procu_enumCharNames = icuuc.NewProc("u_enumCharNames")
)
// start (INT), limit (INT), fn (UEnumCharNamesFn* in/out), context (void* in/out), nameChoice (UCharNameChoice), pErrorCode (UErrorCode* in/out)
r1, _, err := procu_enumCharNames.Call(
uintptr(start),
uintptr(limit),
uintptr(fn),
uintptr(context),
uintptr(nameChoice),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure u_enumCharNames(
start: Integer; // INT
limit: Integer; // INT
fn: Pointer; // UEnumCharNamesFn* in/out
context: Pointer; // void* in/out
nameChoice: Integer; // UCharNameChoice
pErrorCode: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'u_enumCharNames';result := DllCall("icuuc\u_enumCharNames"
, "Int", start ; INT
, "Int", limit ; INT
, "Ptr", fn ; UEnumCharNamesFn* in/out
, "Ptr", context ; void* in/out
, "Int", nameChoice ; UCharNameChoice
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: void●u_enumCharNames(start, limit, fn, context, nameChoice, pErrorCode) = DLL("icuuc.dll", "int u_enumCharNames(int, int, void*, void*, int, void*)")
# 呼び出し: u_enumCharNames(start, limit, fn, context, nameChoice, pErrorCode)
# start : INT -> "int"
# limit : INT -> "int"
# fn : UEnumCharNamesFn* in/out -> "void*"
# context : void* in/out -> "void*"
# nameChoice : UCharNameChoice -> "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 u_enumCharNames(
start: i32, // INT
limit: i32, // INT
fn: ?*anyopaque, // UEnumCharNamesFn* in/out
context: ?*anyopaque, // void* in/out
nameChoice: i32, // UCharNameChoice
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) void;proc u_enumCharNames(
start: int32, # INT
limit: int32, # INT
fn: pointer, # UEnumCharNamesFn* in/out
context: pointer, # void* in/out
nameChoice: int32, # UCharNameChoice
pErrorCode: ptr int32 # UErrorCode* in/out
) {.importc: "u_enumCharNames", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
void u_enumCharNames(
int start, // INT
int limit, // INT
void* fn, // UEnumCharNamesFn* in/out
void* context, // void* in/out
int nameChoice, // UCharNameChoice
int* pErrorCode // UErrorCode* in/out
);ccall((:u_enumCharNames, "icuuc.dll"), Cvoid,
(Int32, Int32, Ptr{Cvoid}, Ptr{Cvoid}, Int32, Ptr{Int32}),
start, limit, fn, context, nameChoice, pErrorCode)
# start : INT -> Int32
# limit : INT -> Int32
# fn : UEnumCharNamesFn* in/out -> Ptr{Cvoid}
# context : void* in/out -> Ptr{Cvoid}
# nameChoice : UCharNameChoice -> Int32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
void u_enumCharNames(
int32_t start,
int32_t limit,
void* fn,
void* context,
int32_t nameChoice,
int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.u_enumCharNames(start, limit, fn, context, nameChoice, pErrorCode)
-- start : INT
-- limit : INT
-- fn : UEnumCharNamesFn* in/out
-- context : void* in/out
-- nameChoice : UCharNameChoice
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const u_enumCharNames = lib.func('__cdecl', 'u_enumCharNames', 'void', ['int32_t', 'int32_t', 'void *', 'void *', 'int32_t', 'int32_t *']);
// u_enumCharNames(start, limit, fn, context, nameChoice, pErrorCode)
// start : INT -> 'int32_t'
// limit : INT -> 'int32_t'
// fn : UEnumCharNamesFn* in/out -> 'void *'
// context : void* in/out -> 'void *'
// nameChoice : UCharNameChoice -> 'int32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("icuuc.dll", {
u_enumCharNames: { parameters: ["i32", "i32", "pointer", "pointer", "i32", "pointer"], result: "void" },
});
// lib.symbols.u_enumCharNames(start, limit, fn, context, nameChoice, pErrorCode)
// start : INT -> "i32"
// limit : INT -> "i32"
// fn : UEnumCharNamesFn* in/out -> "pointer"
// context : void* in/out -> "pointer"
// nameChoice : UCharNameChoice -> "i32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void u_enumCharNames(
int32_t start,
int32_t limit,
void* fn,
void* context,
int32_t nameChoice,
int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->u_enumCharNames(start, limit, fn, context, nameChoice, pErrorCode);
// start : INT
// limit : INT
// fn : UEnumCharNamesFn* in/out
// context : void* in/out
// nameChoice : UCharNameChoice
// 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 u_enumCharNames(
int start, // INT
int limit, // INT
Callback fn, // UEnumCharNamesFn* in/out
Pointer context, // void* in/out
int nameChoice, // UCharNameChoice
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuuc")]
lib Libicuuc
fun u_enumCharNames = u_enumCharNames(
start : Int32, # INT
limit : Int32, # INT
fn : Void*, # UEnumCharNamesFn* in/out
context : Void*, # void* in/out
nameChoice : Int32, # UCharNameChoice
pErrorCode : Int32* # UErrorCode* in/out
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef u_enumCharNamesNative = Void Function(Int32, Int32, Pointer<Void>, Pointer<Void>, Int32, Pointer<Int32>);
typedef u_enumCharNamesDart = void Function(int, int, Pointer<Void>, Pointer<Void>, int, Pointer<Int32>);
final u_enumCharNames = DynamicLibrary.open('icuuc.dll')
.lookupFunction<u_enumCharNamesNative, u_enumCharNamesDart>('u_enumCharNames');
// start : INT -> Int32
// limit : INT -> Int32
// fn : UEnumCharNamesFn* in/out -> Pointer<Void>
// context : void* in/out -> Pointer<Void>
// nameChoice : UCharNameChoice -> Int32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure u_enumCharNames(
start: Integer; // INT
limit: Integer; // INT
fn: Pointer; // UEnumCharNamesFn* in/out
context: Pointer; // void* in/out
nameChoice: Integer; // UCharNameChoice
pErrorCode: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'u_enumCharNames';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "u_enumCharNames"
c_u_enumCharNames :: Int32 -> Int32 -> Ptr () -> Ptr () -> Int32 -> Ptr Int32 -> IO ()
-- start : INT -> Int32
-- limit : INT -> Int32
-- fn : UEnumCharNamesFn* in/out -> Ptr ()
-- context : void* in/out -> Ptr ()
-- nameChoice : UCharNameChoice -> Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let u_enumcharnames =
foreign "u_enumCharNames"
(int32_t @-> int32_t @-> (ptr void) @-> (ptr void) @-> int32_t @-> (ptr int32_t) @-> returning void)
(* start : INT -> int32_t *)
(* limit : INT -> int32_t *)
(* fn : UEnumCharNamesFn* in/out -> (ptr void) *)
(* context : void* in/out -> (ptr void) *)
(* nameChoice : UCharNameChoice -> 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 ("u_enumCharNames" u-enum-char-names :convention :cdecl) :void
(start :int32) ; INT
(limit :int32) ; INT
(fn :pointer) ; UEnumCharNamesFn* in/out
(context :pointer) ; void* in/out
(name-choice :int32) ; UCharNameChoice
(p-error-code :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $u_enumCharNames = Win32::API::More->new('icuuc',
'void u_enumCharNames(int start, int limit, LPVOID fn, LPVOID context, int nameChoice, LPVOID pErrorCode)');
# my $ret = $u_enumCharNames->Call($start, $limit, $fn, $context, $nameChoice, $pErrorCode);
# start : INT -> int
# limit : INT -> int
# fn : UEnumCharNamesFn* in/out -> LPVOID
# context : void* in/out -> LPVOID
# nameChoice : UCharNameChoice -> int
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。