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

utrans_transUChars

関数
文字配列に音訳変換を適用する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

void utrans_transUChars(
    const void** trans,
    WORD* text,
    INT* textLength,
    INT textCapacity,
    INT start,
    INT* limit,
    UErrorCode* status
);

パラメーター

名前方向説明
transvoid**in適用する対象のトランスリテレータハンドルへのポインター。
textWORD*inout変換対象かつ結果を格納するUTF-16コード単位(WORD)配列へのポインター。
textLengthINT*inoutテキスト長を入出力するインデックスへのポインター。-1でNUL終端扱い。
textCapacityINTintextバッファの容量(コード単位数)。
startINTin変換を開始するインデックス。
limitINT*inout変換終了位置を入出力するインデックスへのポインター(変換後に更新される)。
statusUErrorCode*inoutICUのエラーコードを入出力するUErrorCodeへのポインター。

戻り値の型: void

各言語での呼び出し定義

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

void utrans_transUChars(
    const void** trans,
    WORD* text,
    INT* textLength,
    INT textCapacity,
    INT start,
    INT* limit,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void utrans_transUChars(
    IntPtr trans,   // void**
    ref ushort text,   // WORD* in/out
    ref int textLength,   // INT* in/out
    int textCapacity,   // INT
    int start,   // INT
    ref int limit,   // INT* in/out
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub utrans_transUChars(
    trans As IntPtr,   ' void**
    ByRef text As UShort,   ' WORD* in/out
    ByRef textLength As Integer,   ' INT* in/out
    textCapacity As Integer,   ' INT
    start As Integer,   ' INT
    ByRef limit As Integer,   ' INT* in/out
    ByRef status As Integer   ' UErrorCode* in/out
)
End Sub
' trans : void**
' text : WORD* in/out
' textLength : INT* in/out
' textCapacity : INT
' start : INT
' limit : INT* in/out
' status : UErrorCode* in/out
Declare PtrSafe Sub utrans_transUChars Lib "icuin" ( _
    ByVal trans As LongPtr, _
    ByRef text As Integer, _
    ByRef textLength As Long, _
    ByVal textCapacity As Long, _
    ByVal start As Long, _
    ByRef limit As Long, _
    ByRef status As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

utrans_transUChars = ctypes.cdll.icuin.utrans_transUChars
utrans_transUChars.restype = None
utrans_transUChars.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_int,  # start : INT
    ctypes.POINTER(ctypes.c_int),  # limit : INT* in/out
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
utrans_transUChars = Fiddle::Function.new(
  lib['utrans_transUChars'],
  [
    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_INT,  # start : INT
    Fiddle::TYPE_VOIDP,  # limit : INT* in/out
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn utrans_transUChars(
        trans: *const *const (),  // void**
        text: *mut u16,  // WORD* in/out
        textLength: *mut i32,  // INT* in/out
        textCapacity: i32,  // INT
        start: i32,  // INT
        limit: *mut i32,  // INT* 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_transUChars(IntPtr trans, ref ushort text, ref int textLength, int textCapacity, int start, ref int limit, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_utrans_transUChars' -Namespace Win32 -PassThru
# $api::utrans_transUChars(trans, text, textLength, textCapacity, start, limit, status)
#uselib "icuin.dll"
#func global utrans_transUChars "utrans_transUChars" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; utrans_transUChars trans, varptr(text), varptr(textLength), textCapacity, start, varptr(limit), varptr(status)
; trans : void** -> "sptr"
; text : WORD* in/out -> "sptr"
; textLength : INT* in/out -> "sptr"
; textCapacity : INT -> "sptr"
; start : INT -> "sptr"
; limit : INT* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
出力引数:
#uselib "icuin.dll"
#func global utrans_transUChars "utrans_transUChars" sptr, var, var, int, int, var, var
; utrans_transUChars trans, text, textLength, textCapacity, start, limit, status
; trans : void** -> "sptr"
; text : WORD* in/out -> "var"
; textLength : INT* in/out -> "var"
; textCapacity : INT -> "int"
; start : INT -> "int"
; limit : INT* in/out -> "var"
; status : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void utrans_transUChars(void** trans, WORD* text, INT* textLength, INT textCapacity, INT start, INT* limit, UErrorCode* status)
#uselib "icuin.dll"
#func global utrans_transUChars "utrans_transUChars" intptr, var, var, int, int, var, var
; utrans_transUChars trans, text, textLength, textCapacity, start, limit, status
; trans : void** -> "intptr"
; text : WORD* in/out -> "var"
; textLength : INT* in/out -> "var"
; textCapacity : INT -> "int"
; start : INT -> "int"
; limit : INT* in/out -> "var"
; status : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procutrans_transUChars = icuin.NewProc("utrans_transUChars")
)

// trans (void**), text (WORD* in/out), textLength (INT* in/out), textCapacity (INT), start (INT), limit (INT* in/out), status (UErrorCode* in/out)
r1, _, err := procutrans_transUChars.Call(
	uintptr(trans),
	uintptr(text),
	uintptr(textLength),
	uintptr(textCapacity),
	uintptr(start),
	uintptr(limit),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure utrans_transUChars(
  trans: Pointer;   // void**
  text: Pointer;   // WORD* in/out
  textLength: Pointer;   // INT* in/out
  textCapacity: Integer;   // INT
  start: Integer;   // INT
  limit: Pointer;   // INT* in/out
  status: Pointer   // UErrorCode* in/out
); cdecl;
  external 'icuin.dll' name 'utrans_transUChars';
result := DllCall("icuin\utrans_transUChars"
    , "Ptr", trans   ; void**
    , "Ptr", text   ; WORD* in/out
    , "Ptr", textLength   ; INT* in/out
    , "Int", textCapacity   ; INT
    , "Int", start   ; INT
    , "Ptr", limit   ; INT* in/out
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: void
●utrans_transUChars(trans, text, textLength, textCapacity, start, limit, status) = DLL("icuin.dll", "int utrans_transUChars(void*, void*, void*, int, int, void*, void*)")
# 呼び出し: utrans_transUChars(trans, text, textLength, textCapacity, start, limit, status)
# trans : void** -> "void*"
# text : WORD* in/out -> "void*"
# textLength : INT* in/out -> "void*"
# textCapacity : INT -> "int"
# start : INT -> "int"
# limit : INT* 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_transUChars(
    trans: ?*anyopaque, // void**
    text: [*c]u16, // WORD* in/out
    textLength: [*c]i32, // INT* in/out
    textCapacity: i32, // INT
    start: i32, // INT
    limit: [*c]i32, // INT* in/out
    status: [*c]i32 // UErrorCode* in/out
) callconv(.c) void;
proc utrans_transUChars(
    trans: pointer,  # void**
    text: ptr uint16,  # WORD* in/out
    textLength: ptr int32,  # INT* in/out
    textCapacity: int32,  # INT
    start: int32,  # INT
    limit: ptr int32,  # INT* in/out
    status: ptr int32  # UErrorCode* in/out
) {.importc: "utrans_transUChars", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
void utrans_transUChars(
    void** trans,   // void**
    ushort* text,   // WORD* in/out
    int* textLength,   // INT* in/out
    int textCapacity,   // INT
    int start,   // INT
    int* limit,   // INT* in/out
    int* status   // UErrorCode* in/out
);
ccall((:utrans_transUChars, "icuin.dll"), Cvoid,
      (Ptr{Cvoid}, Ptr{UInt16}, Ptr{Int32}, Int32, Int32, Ptr{Int32}, Ptr{Int32}),
      trans, text, textLength, textCapacity, start, limit, status)
# trans : void** -> Ptr{Cvoid}
# text : WORD* in/out -> Ptr{UInt16}
# textLength : INT* in/out -> Ptr{Int32}
# textCapacity : INT -> Int32
# start : INT -> Int32
# limit : INT* in/out -> Ptr{Int32}
# status : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
void utrans_transUChars(
    void** trans,
    uint16_t* text,
    int32_t* textLength,
    int32_t textCapacity,
    int32_t start,
    int32_t* limit,
    int32_t* status);
]]
local icuin = ffi.load("icuin")
-- icuin.utrans_transUChars(trans, text, textLength, textCapacity, start, limit, status)
-- trans : void**
-- text : WORD* in/out
-- textLength : INT* in/out
-- textCapacity : INT
-- start : INT
-- limit : INT* in/out
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const utrans_transUChars = lib.func('__cdecl', 'utrans_transUChars', 'void', ['void *', 'uint16_t *', 'int32_t *', 'int32_t', 'int32_t', 'int32_t *', 'int32_t *']);
// utrans_transUChars(trans, text, textLength, textCapacity, start, limit, status)
// trans : void** -> 'void *'
// text : WORD* in/out -> 'uint16_t *'
// textLength : INT* in/out -> 'int32_t *'
// textCapacity : INT -> 'int32_t'
// start : INT -> 'int32_t'
// limit : INT* in/out -> 'int32_t *'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  utrans_transUChars: { parameters: ["pointer", "pointer", "pointer", "i32", "i32", "pointer", "pointer"], result: "void" },
});
// lib.symbols.utrans_transUChars(trans, text, textLength, textCapacity, start, limit, status)
// trans : void** -> "pointer"
// text : WORD* in/out -> "pointer"
// textLength : INT* in/out -> "pointer"
// textCapacity : INT -> "i32"
// start : INT -> "i32"
// limit : INT* in/out -> "pointer"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void utrans_transUChars(
    void** trans,
    uint16_t* text,
    int32_t* textLength,
    int32_t textCapacity,
    int32_t start,
    int32_t* limit,
    int32_t* status);
C, "icuin.dll");
// $ffi->utrans_transUChars(trans, text, textLength, textCapacity, start, limit, status);
// trans : void**
// text : WORD* in/out
// textLength : INT* in/out
// textCapacity : INT
// start : INT
// limit : INT* 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_transUChars(
        Pointer trans,   // void**
        ShortByReference text,   // WORD* in/out
        IntByReference textLength,   // INT* in/out
        int textCapacity,   // INT
        int start,   // INT
        IntByReference limit,   // INT* in/out
        IntByReference status   // UErrorCode* in/out
    );
}
@[Link("icuin")]
lib Libicuin
  fun utrans_transUChars = utrans_transUChars(
    trans : Void**,   # void**
    text : UInt16*,   # WORD* in/out
    textLength : Int32*,   # INT* in/out
    textCapacity : Int32,   # INT
    start : Int32,   # INT
    limit : Int32*,   # INT* in/out
    status : Int32*   # UErrorCode* in/out
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef utrans_transUCharsNative = Void Function(Pointer<Void>, Pointer<Uint16>, Pointer<Int32>, Int32, Int32, Pointer<Int32>, Pointer<Int32>);
typedef utrans_transUCharsDart = void Function(Pointer<Void>, Pointer<Uint16>, Pointer<Int32>, int, int, Pointer<Int32>, Pointer<Int32>);
final utrans_transUChars = DynamicLibrary.open('icuin.dll')
    .lookupFunction<utrans_transUCharsNative, utrans_transUCharsDart>('utrans_transUChars');
// trans : void** -> Pointer<Void>
// text : WORD* in/out -> Pointer<Uint16>
// textLength : INT* in/out -> Pointer<Int32>
// textCapacity : INT -> Int32
// start : INT -> Int32
// limit : INT* in/out -> Pointer<Int32>
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure utrans_transUChars(
  trans: Pointer;   // void**
  text: Pointer;   // WORD* in/out
  textLength: Pointer;   // INT* in/out
  textCapacity: Integer;   // INT
  start: Integer;   // INT
  limit: Pointer;   // INT* in/out
  status: Pointer   // UErrorCode* in/out
); cdecl;
  external 'icuin.dll' name 'utrans_transUChars';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "utrans_transUChars"
  c_utrans_transUChars :: Ptr () -> Ptr Word16 -> Ptr Int32 -> Int32 -> Int32 -> Ptr Int32 -> Ptr Int32 -> IO ()
-- trans : void** -> Ptr ()
-- text : WORD* in/out -> Ptr Word16
-- textLength : INT* in/out -> Ptr Int32
-- textCapacity : INT -> Int32
-- start : INT -> Int32
-- limit : INT* in/out -> Ptr Int32
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let utrans_transuchars =
  foreign "utrans_transUChars"
    ((ptr void) @-> (ptr uint16_t) @-> (ptr int32_t) @-> int32_t @-> int32_t @-> (ptr int32_t) @-> (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 *)
(* start : INT -> int32_t *)
(* limit : INT* in/out -> (ptr int32_t) *)
(* 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_transUChars" utrans-trans-uchars :convention :cdecl) :void
  (trans :pointer)   ; void**
  (text :pointer)   ; WORD* in/out
  (text-length :pointer)   ; INT* in/out
  (text-capacity :int32)   ; INT
  (start :int32)   ; INT
  (limit :pointer)   ; INT* in/out
  (status :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $utrans_transUChars = Win32::API::More->new('icuin',
    'void utrans_transUChars(LPVOID trans, LPVOID text, LPVOID textLength, int textCapacity, int start, LPVOID limit, LPVOID status)');
# my $ret = $utrans_transUChars->Call($trans, $text, $textLength, $textCapacity, $start, $limit, $status);
# trans : void** -> LPVOID
# text : WORD* in/out -> LPVOID
# textLength : INT* in/out -> LPVOID
# textCapacity : INT -> int
# start : INT -> int
# limit : INT* in/out -> LPVOID
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型