ホーム › Globalization › utrans_transIncrementalUChars
utrans_transIncrementalUChars
関数文字配列に増分的な音訳変換を適用する。
シグネチャ
// icuin.dll
#include <windows.h>
void utrans_transIncrementalUChars(
const void** trans,
WORD* text,
INT* textLength,
INT textCapacity,
UTransPosition* pos,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| trans | void** | in | 適用する対象のトランスリテレータハンドルへのポインター。 |
| text | WORD* | inout | 変換対象かつ結果を格納するUTF-16コード単位(WORD)配列へのポインター。 |
| textLength | INT* | inout | テキスト長を入出力するインデックスへのポインター。-1でNUL終端扱い。 |
| textCapacity | INT | in | textバッファの容量(コード単位数)。 |
| pos | UTransPosition* | inout | 変換の開始・終了・確定位置を入出力するUTransPositionへのポインター。 |
| status | UErrorCode* | inout | ICUのエラーコードを入出力するUErrorCodeへのポインター。 |
戻り値の型: void
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
void utrans_transIncrementalUChars(
const void** trans,
WORD* text,
INT* textLength,
INT textCapacity,
UTransPosition* pos,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void utrans_transIncrementalUChars(
IntPtr trans, // void**
ref ushort text, // WORD* in/out
ref int textLength, // INT* in/out
int textCapacity, // INT
IntPtr pos, // UTransPosition* in/out
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub utrans_transIncrementalUChars(
trans As IntPtr, ' void**
ByRef text As UShort, ' WORD* in/out
ByRef textLength As Integer, ' INT* in/out
textCapacity As Integer, ' INT
pos As IntPtr, ' UTransPosition* in/out
ByRef status As Integer ' UErrorCode* in/out
)
End Sub' trans : void**
' text : WORD* in/out
' textLength : INT* in/out
' textCapacity : INT
' pos : UTransPosition* in/out
' status : UErrorCode* in/out
Declare PtrSafe Sub utrans_transIncrementalUChars Lib "icuin" ( _
ByVal trans As LongPtr, _
ByRef text As Integer, _
ByRef textLength As Long, _
ByVal textCapacity As Long, _
ByVal pos As LongPtr, _
ByRef status As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
utrans_transIncrementalUChars = ctypes.cdll.icuin.utrans_transIncrementalUChars
utrans_transIncrementalUChars.restype = None
utrans_transIncrementalUChars.argtypes = [
ctypes.c_void_p, # trans : void**
ctypes.POINTER(ctypes.c_ushort), # text : WORD* in/out
ctypes.POINTER(ctypes.c_int), # textLength : INT* in/out
ctypes.c_int, # textCapacity : INT
ctypes.c_void_p, # pos : UTransPosition* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
utrans_transIncrementalUChars = Fiddle::Function.new(
lib['utrans_transIncrementalUChars'],
[
Fiddle::TYPE_VOIDP, # trans : void**
Fiddle::TYPE_VOIDP, # text : WORD* in/out
Fiddle::TYPE_VOIDP, # textLength : INT* in/out
Fiddle::TYPE_INT, # textCapacity : INT
Fiddle::TYPE_VOIDP, # pos : UTransPosition* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn utrans_transIncrementalUChars(
trans: *const *const (), // void**
text: *mut u16, // WORD* in/out
textLength: *mut i32, // INT* in/out
textCapacity: i32, // INT
pos: *mut UTransPosition, // UTransPosition* in/out
status: *mut i32 // UErrorCode* in/out
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void utrans_transIncrementalUChars(IntPtr trans, ref ushort text, ref int textLength, int textCapacity, IntPtr pos, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_utrans_transIncrementalUChars' -Namespace Win32 -PassThru
# $api::utrans_transIncrementalUChars(trans, text, textLength, textCapacity, pos, status)#uselib "icuin.dll"
#func global utrans_transIncrementalUChars "utrans_transIncrementalUChars" sptr, sptr, sptr, sptr, sptr, sptr
; utrans_transIncrementalUChars trans, varptr(text), varptr(textLength), textCapacity, varptr(pos), varptr(status)
; trans : void** -> "sptr"
; text : WORD* in/out -> "sptr"
; textLength : INT* in/out -> "sptr"
; textCapacity : INT -> "sptr"
; pos : UTransPosition* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"出力引数:
#uselib "icuin.dll" #func global utrans_transIncrementalUChars "utrans_transIncrementalUChars" sptr, var, var, int, var, var ; utrans_transIncrementalUChars trans, text, textLength, textCapacity, pos, status ; trans : void** -> "sptr" ; text : WORD* in/out -> "var" ; textLength : INT* in/out -> "var" ; textCapacity : INT -> "int" ; pos : UTransPosition* in/out -> "var" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #func global utrans_transIncrementalUChars "utrans_transIncrementalUChars" sptr, sptr, sptr, int, sptr, sptr ; utrans_transIncrementalUChars trans, varptr(text), varptr(textLength), textCapacity, varptr(pos), varptr(status) ; trans : void** -> "sptr" ; text : WORD* in/out -> "sptr" ; textLength : INT* in/out -> "sptr" ; textCapacity : INT -> "int" ; pos : UTransPosition* in/out -> "sptr" ; status : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void utrans_transIncrementalUChars(void** trans, WORD* text, INT* textLength, INT textCapacity, UTransPosition* pos, UErrorCode* status) #uselib "icuin.dll" #func global utrans_transIncrementalUChars "utrans_transIncrementalUChars" intptr, var, var, int, var, var ; utrans_transIncrementalUChars trans, text, textLength, textCapacity, pos, status ; trans : void** -> "intptr" ; text : WORD* in/out -> "var" ; textLength : INT* in/out -> "var" ; textCapacity : INT -> "int" ; pos : UTransPosition* in/out -> "var" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void utrans_transIncrementalUChars(void** trans, WORD* text, INT* textLength, INT textCapacity, UTransPosition* pos, UErrorCode* status) #uselib "icuin.dll" #func global utrans_transIncrementalUChars "utrans_transIncrementalUChars" intptr, intptr, intptr, int, intptr, intptr ; utrans_transIncrementalUChars trans, varptr(text), varptr(textLength), textCapacity, varptr(pos), varptr(status) ; trans : void** -> "intptr" ; text : WORD* in/out -> "intptr" ; textLength : INT* in/out -> "intptr" ; textCapacity : INT -> "int" ; pos : UTransPosition* in/out -> "intptr" ; status : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procutrans_transIncrementalUChars = icuin.NewProc("utrans_transIncrementalUChars")
)
// trans (void**), text (WORD* in/out), textLength (INT* in/out), textCapacity (INT), pos (UTransPosition* in/out), status (UErrorCode* in/out)
r1, _, err := procutrans_transIncrementalUChars.Call(
uintptr(trans),
uintptr(text),
uintptr(textLength),
uintptr(textCapacity),
uintptr(pos),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure utrans_transIncrementalUChars(
trans: Pointer; // void**
text: Pointer; // WORD* in/out
textLength: Pointer; // INT* in/out
textCapacity: Integer; // INT
pos: Pointer; // UTransPosition* in/out
status: Pointer // UErrorCode* in/out
); cdecl;
external 'icuin.dll' name 'utrans_transIncrementalUChars';result := DllCall("icuin\utrans_transIncrementalUChars"
, "Ptr", trans ; void**
, "Ptr", text ; WORD* in/out
, "Ptr", textLength ; INT* in/out
, "Int", textCapacity ; INT
, "Ptr", pos ; UTransPosition* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: void●utrans_transIncrementalUChars(trans, text, textLength, textCapacity, pos, status) = DLL("icuin.dll", "int utrans_transIncrementalUChars(void*, void*, void*, int, void*, void*)")
# 呼び出し: utrans_transIncrementalUChars(trans, text, textLength, textCapacity, pos, status)
# trans : void** -> "void*"
# text : WORD* in/out -> "void*"
# textLength : INT* in/out -> "void*"
# textCapacity : INT -> "int"
# pos : UTransPosition* in/out -> "void*"
# 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 "icuin" fn utrans_transIncrementalUChars(
trans: ?*anyopaque, // void**
text: [*c]u16, // WORD* in/out
textLength: [*c]i32, // INT* in/out
textCapacity: i32, // INT
pos: [*c]UTransPosition, // UTransPosition* in/out
status: [*c]i32 // UErrorCode* in/out
) callconv(.c) void;proc utrans_transIncrementalUChars(
trans: pointer, # void**
text: ptr uint16, # WORD* in/out
textLength: ptr int32, # INT* in/out
textCapacity: int32, # INT
pos: ptr UTransPosition, # UTransPosition* in/out
status: ptr int32 # UErrorCode* in/out
) {.importc: "utrans_transIncrementalUChars", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
void utrans_transIncrementalUChars(
void** trans, // void**
ushort* text, // WORD* in/out
int* textLength, // INT* in/out
int textCapacity, // INT
UTransPosition* pos, // UTransPosition* in/out
int* status // UErrorCode* in/out
);ccall((:utrans_transIncrementalUChars, "icuin.dll"), Cvoid,
(Ptr{Cvoid}, Ptr{UInt16}, Ptr{Int32}, Int32, Ptr{UTransPosition}, Ptr{Int32}),
trans, text, textLength, textCapacity, pos, status)
# trans : void** -> Ptr{Cvoid}
# text : WORD* in/out -> Ptr{UInt16}
# textLength : INT* in/out -> Ptr{Int32}
# textCapacity : INT -> Int32
# pos : UTransPosition* in/out -> Ptr{UTransPosition}
# status : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
void utrans_transIncrementalUChars(
void** trans,
uint16_t* text,
int32_t* textLength,
int32_t textCapacity,
void* pos,
int32_t* status);
]]
local icuin = ffi.load("icuin")
-- icuin.utrans_transIncrementalUChars(trans, text, textLength, textCapacity, pos, status)
-- trans : void**
-- text : WORD* in/out
-- textLength : INT* in/out
-- textCapacity : INT
-- pos : UTransPosition* in/out
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const utrans_transIncrementalUChars = lib.func('__cdecl', 'utrans_transIncrementalUChars', 'void', ['void *', 'uint16_t *', 'int32_t *', 'int32_t', 'void *', 'int32_t *']);
// utrans_transIncrementalUChars(trans, text, textLength, textCapacity, pos, status)
// trans : void** -> 'void *'
// text : WORD* in/out -> 'uint16_t *'
// textLength : INT* in/out -> 'int32_t *'
// textCapacity : INT -> 'int32_t'
// pos : UTransPosition* in/out -> 'void *'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
utrans_transIncrementalUChars: { parameters: ["pointer", "pointer", "pointer", "i32", "pointer", "pointer"], result: "void" },
});
// lib.symbols.utrans_transIncrementalUChars(trans, text, textLength, textCapacity, pos, status)
// trans : void** -> "pointer"
// text : WORD* in/out -> "pointer"
// textLength : INT* in/out -> "pointer"
// textCapacity : INT -> "i32"
// pos : UTransPosition* in/out -> "pointer"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void utrans_transIncrementalUChars(
void** trans,
uint16_t* text,
int32_t* textLength,
int32_t textCapacity,
void* pos,
int32_t* status);
C, "icuin.dll");
// $ffi->utrans_transIncrementalUChars(trans, text, textLength, textCapacity, pos, status);
// trans : void**
// text : WORD* in/out
// textLength : INT* in/out
// textCapacity : INT
// pos : UTransPosition* in/out
// 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 Icuin extends Library {
Icuin INSTANCE = Native.load("icuin", Icuin.class);
void utrans_transIncrementalUChars(
Pointer trans, // void**
ShortByReference text, // WORD* in/out
IntByReference textLength, // INT* in/out
int textCapacity, // INT
Pointer pos, // UTransPosition* in/out
IntByReference status // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun utrans_transIncrementalUChars = utrans_transIncrementalUChars(
trans : Void**, # void**
text : UInt16*, # WORD* in/out
textLength : Int32*, # INT* in/out
textCapacity : Int32, # INT
pos : UTransPosition*, # UTransPosition* in/out
status : Int32* # UErrorCode* in/out
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef utrans_transIncrementalUCharsNative = Void Function(Pointer<Void>, Pointer<Uint16>, Pointer<Int32>, Int32, Pointer<Void>, Pointer<Int32>);
typedef utrans_transIncrementalUCharsDart = void Function(Pointer<Void>, Pointer<Uint16>, Pointer<Int32>, int, Pointer<Void>, Pointer<Int32>);
final utrans_transIncrementalUChars = DynamicLibrary.open('icuin.dll')
.lookupFunction<utrans_transIncrementalUCharsNative, utrans_transIncrementalUCharsDart>('utrans_transIncrementalUChars');
// trans : void** -> Pointer<Void>
// text : WORD* in/out -> Pointer<Uint16>
// textLength : INT* in/out -> Pointer<Int32>
// textCapacity : INT -> Int32
// pos : UTransPosition* in/out -> Pointer<Void>
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure utrans_transIncrementalUChars(
trans: Pointer; // void**
text: Pointer; // WORD* in/out
textLength: Pointer; // INT* in/out
textCapacity: Integer; // INT
pos: Pointer; // UTransPosition* in/out
status: Pointer // UErrorCode* in/out
); cdecl;
external 'icuin.dll' name 'utrans_transIncrementalUChars';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "utrans_transIncrementalUChars"
c_utrans_transIncrementalUChars :: Ptr () -> Ptr Word16 -> Ptr Int32 -> Int32 -> Ptr () -> Ptr Int32 -> IO ()
-- trans : void** -> Ptr ()
-- text : WORD* in/out -> Ptr Word16
-- textLength : INT* in/out -> Ptr Int32
-- textCapacity : INT -> Int32
-- pos : UTransPosition* in/out -> Ptr ()
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let utrans_transincrementaluchars =
foreign "utrans_transIncrementalUChars"
((ptr void) @-> (ptr uint16_t) @-> (ptr int32_t) @-> int32_t @-> (ptr void) @-> (ptr int32_t) @-> returning void)
(* trans : void** -> (ptr void) *)
(* text : WORD* in/out -> (ptr uint16_t) *)
(* textLength : INT* in/out -> (ptr int32_t) *)
(* textCapacity : INT -> int32_t *)
(* pos : UTransPosition* in/out -> (ptr void) *)
(* status : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("utrans_transIncrementalUChars" utrans-trans-incremental-uchars :convention :cdecl) :void
(trans :pointer) ; void**
(text :pointer) ; WORD* in/out
(text-length :pointer) ; INT* in/out
(text-capacity :int32) ; INT
(pos :pointer) ; UTransPosition* in/out
(status :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $utrans_transIncrementalUChars = Win32::API::More->new('icuin',
'void utrans_transIncrementalUChars(LPVOID trans, LPVOID text, LPVOID textLength, int textCapacity, LPVOID pos, LPVOID status)');
# my $ret = $utrans_transIncrementalUChars->Call($trans, $text, $textLength, $textCapacity, $pos, $status);
# trans : void** -> LPVOID
# text : WORD* in/out -> LPVOID
# textLength : INT* in/out -> LPVOID
# textCapacity : INT -> int
# pos : UTransPosition* in/out -> LPVOID
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。