ホーム › Globalization › ucnv_getSubstChars
ucnv_getSubstChars
関数変換器に設定された代替文字を取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
void ucnv_getSubstChars(
const UConverter* converter,
LPSTR subChars,
CHAR* len,
UErrorCode* err
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| converter | UConverter* | in |
| subChars | LPSTR | in |
| len | CHAR* | inout |
| err | UErrorCode* | inout |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void ucnv_getSubstChars(
const UConverter* converter,
LPSTR subChars,
CHAR* len,
UErrorCode* err
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ucnv_getSubstChars(
ref IntPtr converter, // UConverter*
[MarshalAs(UnmanagedType.LPStr)] string subChars, // LPSTR
IntPtr len, // CHAR* in/out
ref int err // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ucnv_getSubstChars(
ByRef converter As IntPtr, ' UConverter*
<MarshalAs(UnmanagedType.LPStr)> subChars As String, ' LPSTR
len As IntPtr, ' CHAR* in/out
ByRef err As Integer ' UErrorCode* in/out
)
End Sub' converter : UConverter*
' subChars : LPSTR
' len : CHAR* in/out
' err : UErrorCode* in/out
Declare PtrSafe Sub ucnv_getSubstChars Lib "icuuc" ( _
ByRef converter As LongPtr, _
ByVal subChars As String, _
ByVal len As LongPtr, _
ByRef err As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucnv_getSubstChars = ctypes.cdll.icuuc.ucnv_getSubstChars
ucnv_getSubstChars.restype = None
ucnv_getSubstChars.argtypes = [
ctypes.c_void_p, # converter : UConverter*
wintypes.LPCSTR, # subChars : LPSTR
ctypes.POINTER(ctypes.c_byte), # len : CHAR* in/out
ctypes.c_void_p, # err : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucnv_getSubstChars = Fiddle::Function.new(
lib['ucnv_getSubstChars'],
[
Fiddle::TYPE_VOIDP, # converter : UConverter*
Fiddle::TYPE_VOIDP, # subChars : LPSTR
Fiddle::TYPE_VOIDP, # len : CHAR* in/out
Fiddle::TYPE_VOIDP, # err : UErrorCode* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucnv_getSubstChars(
converter: *const isize, // UConverter*
subChars: *mut u8, // LPSTR
len: *mut i8, // CHAR* in/out
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_getSubstChars(ref IntPtr converter, [MarshalAs(UnmanagedType.LPStr)] string subChars, IntPtr len, ref int err);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_getSubstChars' -Namespace Win32 -PassThru
# $api::ucnv_getSubstChars(converter, subChars, len, err)#uselib "icuuc.dll"
#func global ucnv_getSubstChars "ucnv_getSubstChars" sptr, sptr, sptr, sptr
; ucnv_getSubstChars converter, subChars, varptr(len), err
; converter : UConverter* -> "sptr"
; subChars : LPSTR -> "sptr"
; len : CHAR* in/out -> "sptr"
; err : UErrorCode* in/out -> "sptr"出力引数:
#uselib "icuuc.dll" #func global ucnv_getSubstChars "ucnv_getSubstChars" int, str, var, int ; ucnv_getSubstChars converter, subChars, len, err ; converter : UConverter* -> "int" ; subChars : LPSTR -> "str" ; len : CHAR* in/out -> "var" ; err : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #func global ucnv_getSubstChars "ucnv_getSubstChars" int, str, sptr, int ; ucnv_getSubstChars converter, subChars, varptr(len), err ; converter : UConverter* -> "int" ; subChars : LPSTR -> "str" ; len : CHAR* in/out -> "sptr" ; err : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void ucnv_getSubstChars(UConverter* converter, LPSTR subChars, CHAR* len, UErrorCode* err) #uselib "icuuc.dll" #func global ucnv_getSubstChars "ucnv_getSubstChars" int, str, var, int ; ucnv_getSubstChars converter, subChars, len, err ; converter : UConverter* -> "int" ; subChars : LPSTR -> "str" ; len : CHAR* in/out -> "var" ; err : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void ucnv_getSubstChars(UConverter* converter, LPSTR subChars, CHAR* len, UErrorCode* err) #uselib "icuuc.dll" #func global ucnv_getSubstChars "ucnv_getSubstChars" int, str, intptr, int ; ucnv_getSubstChars converter, subChars, varptr(len), err ; converter : UConverter* -> "int" ; subChars : LPSTR -> "str" ; len : CHAR* in/out -> "intptr" ; err : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucnv_getSubstChars = icuuc.NewProc("ucnv_getSubstChars")
)
// converter (UConverter*), subChars (LPSTR), len (CHAR* in/out), err (UErrorCode* in/out)
r1, _, err := procucnv_getSubstChars.Call(
uintptr(converter),
uintptr(unsafe.Pointer(windows.BytePtrFromString(subChars))),
uintptr(len),
uintptr(err),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ucnv_getSubstChars(
converter: Pointer; // UConverter*
subChars: PAnsiChar; // LPSTR
len: Pointer; // CHAR* in/out
err: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'ucnv_getSubstChars';result := DllCall("icuuc\ucnv_getSubstChars"
, "Ptr", converter ; UConverter*
, "AStr", subChars ; LPSTR
, "Ptr", len ; CHAR* in/out
, "Ptr", err ; UErrorCode* in/out
, "Cdecl Int") ; return: void●ucnv_getSubstChars(converter, subChars, len, err) = DLL("icuuc.dll", "int ucnv_getSubstChars(void*, char*, void*, void*)")
# 呼び出し: ucnv_getSubstChars(converter, subChars, len, err)
# converter : UConverter* -> "void*"
# subChars : LPSTR -> "char*"
# len : CHAR* in/out -> "void*"
# err : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。