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
textLengthINT*inout
textCapacityINTin
startINTin
limitINT*inout
statusUErrorCode*inout

戻り値の型: 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), 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, int
; 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 -> "int"
; ※出力/バッファ引数は 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, int
; 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 -> "int"
; ※出力/バッファ引数は 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`,…) を使用。