ホーム › Globalization › ucnv_cbToUWriteUChars
ucnv_cbToUWriteUChars
関数Unicodeへの変換コールバックからUChar列を書き込む。
シグネチャ
// icuuc.dll
#include <windows.h>
void ucnv_cbToUWriteUChars(
UConverterToUnicodeArgs* args,
const WORD* source,
INT length,
INT offsetIndex,
UErrorCode* err
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| args | UConverterToUnicodeArgs* | inout |
| source | WORD* | in |
| length | INT | in |
| offsetIndex | INT | in |
| err | UErrorCode* | inout |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void ucnv_cbToUWriteUChars(
UConverterToUnicodeArgs* args,
const WORD* source,
INT length,
INT offsetIndex,
UErrorCode* err
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ucnv_cbToUWriteUChars(
IntPtr args, // UConverterToUnicodeArgs* in/out
ref ushort source, // WORD*
int length, // INT
int offsetIndex, // INT
ref int err // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ucnv_cbToUWriteUChars(
args As IntPtr, ' UConverterToUnicodeArgs* in/out
ByRef source As UShort, ' WORD*
length As Integer, ' INT
offsetIndex As Integer, ' INT
ByRef err As Integer ' UErrorCode* in/out
)
End Sub' args : UConverterToUnicodeArgs* in/out
' source : WORD*
' length : INT
' offsetIndex : INT
' err : UErrorCode* in/out
Declare PtrSafe Sub ucnv_cbToUWriteUChars Lib "icuuc" ( _
ByVal args As LongPtr, _
ByRef source As Integer, _
ByVal length As Long, _
ByVal offsetIndex As Long, _
ByRef err As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucnv_cbToUWriteUChars = ctypes.cdll.icuuc.ucnv_cbToUWriteUChars
ucnv_cbToUWriteUChars.restype = None
ucnv_cbToUWriteUChars.argtypes = [
ctypes.c_void_p, # args : UConverterToUnicodeArgs* in/out
ctypes.POINTER(ctypes.c_ushort), # source : WORD*
ctypes.c_int, # length : INT
ctypes.c_int, # offsetIndex : INT
ctypes.c_void_p, # err : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucnv_cbToUWriteUChars = Fiddle::Function.new(
lib['ucnv_cbToUWriteUChars'],
[
Fiddle::TYPE_VOIDP, # args : UConverterToUnicodeArgs* in/out
Fiddle::TYPE_VOIDP, # source : WORD*
Fiddle::TYPE_INT, # length : INT
Fiddle::TYPE_INT, # offsetIndex : INT
Fiddle::TYPE_VOIDP, # err : UErrorCode* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucnv_cbToUWriteUChars(
args: *mut UConverterToUnicodeArgs, // UConverterToUnicodeArgs* in/out
source: *const u16, // WORD*
length: i32, // INT
offsetIndex: i32, // INT
err: *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 ucnv_cbToUWriteUChars(IntPtr args, ref ushort source, int length, int offsetIndex, ref int err);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_cbToUWriteUChars' -Namespace Win32 -PassThru
# $api::ucnv_cbToUWriteUChars(args, source, length, offsetIndex, err)#uselib "icuuc.dll"
#func global ucnv_cbToUWriteUChars "ucnv_cbToUWriteUChars" sptr, sptr, sptr, sptr, sptr
; ucnv_cbToUWriteUChars varptr(args), varptr(source), length, offsetIndex, err
; args : UConverterToUnicodeArgs* in/out -> "sptr"
; source : WORD* -> "sptr"
; length : INT -> "sptr"
; offsetIndex : INT -> "sptr"
; err : UErrorCode* in/out -> "sptr"出力引数:
#uselib "icuuc.dll" #func global ucnv_cbToUWriteUChars "ucnv_cbToUWriteUChars" var, var, int, int, int ; ucnv_cbToUWriteUChars args, source, length, offsetIndex, err ; args : UConverterToUnicodeArgs* in/out -> "var" ; source : WORD* -> "var" ; length : INT -> "int" ; offsetIndex : INT -> "int" ; err : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #func global ucnv_cbToUWriteUChars "ucnv_cbToUWriteUChars" sptr, sptr, int, int, int ; ucnv_cbToUWriteUChars varptr(args), varptr(source), length, offsetIndex, err ; args : UConverterToUnicodeArgs* in/out -> "sptr" ; source : WORD* -> "sptr" ; length : INT -> "int" ; offsetIndex : INT -> "int" ; err : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void ucnv_cbToUWriteUChars(UConverterToUnicodeArgs* args, WORD* source, INT length, INT offsetIndex, UErrorCode* err) #uselib "icuuc.dll" #func global ucnv_cbToUWriteUChars "ucnv_cbToUWriteUChars" var, var, int, int, int ; ucnv_cbToUWriteUChars args, source, length, offsetIndex, err ; args : UConverterToUnicodeArgs* in/out -> "var" ; source : WORD* -> "var" ; length : INT -> "int" ; offsetIndex : INT -> "int" ; err : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void ucnv_cbToUWriteUChars(UConverterToUnicodeArgs* args, WORD* source, INT length, INT offsetIndex, UErrorCode* err) #uselib "icuuc.dll" #func global ucnv_cbToUWriteUChars "ucnv_cbToUWriteUChars" intptr, intptr, int, int, int ; ucnv_cbToUWriteUChars varptr(args), varptr(source), length, offsetIndex, err ; args : UConverterToUnicodeArgs* in/out -> "intptr" ; source : WORD* -> "intptr" ; length : INT -> "int" ; offsetIndex : INT -> "int" ; err : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucnv_cbToUWriteUChars = icuuc.NewProc("ucnv_cbToUWriteUChars")
)
// args (UConverterToUnicodeArgs* in/out), source (WORD*), length (INT), offsetIndex (INT), err (UErrorCode* in/out)
r1, _, err := procucnv_cbToUWriteUChars.Call(
uintptr(args),
uintptr(source),
uintptr(length),
uintptr(offsetIndex),
uintptr(err),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ucnv_cbToUWriteUChars(
args: Pointer; // UConverterToUnicodeArgs* in/out
source: Pointer; // WORD*
length: Integer; // INT
offsetIndex: Integer; // INT
err: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'ucnv_cbToUWriteUChars';result := DllCall("icuuc\ucnv_cbToUWriteUChars"
, "Ptr", args ; UConverterToUnicodeArgs* in/out
, "Ptr", source ; WORD*
, "Int", length ; INT
, "Int", offsetIndex ; INT
, "Ptr", err ; UErrorCode* in/out
, "Cdecl Int") ; return: void●ucnv_cbToUWriteUChars(args, source, length, offsetIndex, err) = DLL("icuuc.dll", "int ucnv_cbToUWriteUChars(void*, void*, int, int, void*)")
# 呼び出し: ucnv_cbToUWriteUChars(args, source, length, offsetIndex, err)
# args : UConverterToUnicodeArgs* in/out -> "void*"
# source : WORD* -> "void*"
# length : INT -> "int"
# offsetIndex : INT -> "int"
# err : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。