ホーム › Globalization › unorm2_append
unorm2_append
関数正規化境界を保ったまま二つの文字列を連結する。
シグネチャ
// icuuc.dll
#include <windows.h>
INT unorm2_append(
const UNormalizer2* norm2,
WORD* first,
INT firstLength,
INT firstCapacity,
const WORD* second,
INT secondLength,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| norm2 | UNormalizer2* | in |
| first | WORD* | inout |
| firstLength | INT | in |
| firstCapacity | INT | in |
| second | WORD* | in |
| secondLength | INT | in |
| pErrorCode | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
INT unorm2_append(
const UNormalizer2* norm2,
WORD* first,
INT firstLength,
INT firstCapacity,
const WORD* second,
INT secondLength,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int unorm2_append(
ref IntPtr norm2, // UNormalizer2*
ref ushort first, // WORD* in/out
int firstLength, // INT
int firstCapacity, // INT
ref ushort second, // WORD*
int secondLength, // INT
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function unorm2_append(
ByRef norm2 As IntPtr, ' UNormalizer2*
ByRef first As UShort, ' WORD* in/out
firstLength As Integer, ' INT
firstCapacity As Integer, ' INT
ByRef second As UShort, ' WORD*
secondLength As Integer, ' INT
ByRef pErrorCode As Integer ' UErrorCode* in/out
) As Integer
End Function' norm2 : UNormalizer2*
' first : WORD* in/out
' firstLength : INT
' firstCapacity : INT
' second : WORD*
' secondLength : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function unorm2_append Lib "icuuc" ( _
ByRef norm2 As LongPtr, _
ByRef first As Integer, _
ByVal firstLength As Long, _
ByVal firstCapacity As Long, _
ByRef second As Integer, _
ByVal secondLength As Long, _
ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
unorm2_append = ctypes.cdll.icuuc.unorm2_append
unorm2_append.restype = ctypes.c_int
unorm2_append.argtypes = [
ctypes.c_void_p, # norm2 : UNormalizer2*
ctypes.POINTER(ctypes.c_ushort), # first : WORD* in/out
ctypes.c_int, # firstLength : INT
ctypes.c_int, # firstCapacity : INT
ctypes.POINTER(ctypes.c_ushort), # second : WORD*
ctypes.c_int, # secondLength : INT
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
unorm2_append = Fiddle::Function.new(
lib['unorm2_append'],
[
Fiddle::TYPE_VOIDP, # norm2 : UNormalizer2*
Fiddle::TYPE_VOIDP, # first : WORD* in/out
Fiddle::TYPE_INT, # firstLength : INT
Fiddle::TYPE_INT, # firstCapacity : INT
Fiddle::TYPE_VOIDP, # second : WORD*
Fiddle::TYPE_INT, # secondLength : INT
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn unorm2_append(
norm2: *const isize, // UNormalizer2*
first: *mut u16, // WORD* in/out
firstLength: i32, // INT
firstCapacity: i32, // INT
second: *const u16, // WORD*
secondLength: i32, // INT
pErrorCode: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int unorm2_append(ref IntPtr norm2, ref ushort first, int firstLength, int firstCapacity, ref ushort second, int secondLength, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_unorm2_append' -Namespace Win32 -PassThru
# $api::unorm2_append(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode)#uselib "icuuc.dll"
#func global unorm2_append "unorm2_append" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; unorm2_append norm2, varptr(first), firstLength, firstCapacity, varptr(second), secondLength, pErrorCode ; 戻り値は stat
; norm2 : UNormalizer2* -> "sptr"
; first : WORD* in/out -> "sptr"
; firstLength : INT -> "sptr"
; firstCapacity : INT -> "sptr"
; second : WORD* -> "sptr"
; secondLength : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global unorm2_append "unorm2_append" int, var, int, int, var, int, int ; res = unorm2_append(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode) ; norm2 : UNormalizer2* -> "int" ; first : WORD* in/out -> "var" ; firstLength : INT -> "int" ; firstCapacity : INT -> "int" ; second : WORD* -> "var" ; secondLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global unorm2_append "unorm2_append" int, sptr, int, int, sptr, int, int ; res = unorm2_append(norm2, varptr(first), firstLength, firstCapacity, varptr(second), secondLength, pErrorCode) ; norm2 : UNormalizer2* -> "int" ; first : WORD* in/out -> "sptr" ; firstLength : INT -> "int" ; firstCapacity : INT -> "int" ; second : WORD* -> "sptr" ; secondLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT unorm2_append(UNormalizer2* norm2, WORD* first, INT firstLength, INT firstCapacity, WORD* second, INT secondLength, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global unorm2_append "unorm2_append" int, var, int, int, var, int, int ; res = unorm2_append(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode) ; norm2 : UNormalizer2* -> "int" ; first : WORD* in/out -> "var" ; firstLength : INT -> "int" ; firstCapacity : INT -> "int" ; second : WORD* -> "var" ; secondLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT unorm2_append(UNormalizer2* norm2, WORD* first, INT firstLength, INT firstCapacity, WORD* second, INT secondLength, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global unorm2_append "unorm2_append" int, intptr, int, int, intptr, int, int ; res = unorm2_append(norm2, varptr(first), firstLength, firstCapacity, varptr(second), secondLength, pErrorCode) ; norm2 : UNormalizer2* -> "int" ; first : WORD* in/out -> "intptr" ; firstLength : INT -> "int" ; firstCapacity : INT -> "int" ; second : WORD* -> "intptr" ; secondLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procunorm2_append = icuuc.NewProc("unorm2_append")
)
// norm2 (UNormalizer2*), first (WORD* in/out), firstLength (INT), firstCapacity (INT), second (WORD*), secondLength (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := procunorm2_append.Call(
uintptr(norm2),
uintptr(first),
uintptr(firstLength),
uintptr(firstCapacity),
uintptr(second),
uintptr(secondLength),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction unorm2_append(
norm2: Pointer; // UNormalizer2*
first: Pointer; // WORD* in/out
firstLength: Integer; // INT
firstCapacity: Integer; // INT
second: Pointer; // WORD*
secondLength: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuuc.dll' name 'unorm2_append';result := DllCall("icuuc\unorm2_append"
, "Ptr", norm2 ; UNormalizer2*
, "Ptr", first ; WORD* in/out
, "Int", firstLength ; INT
, "Int", firstCapacity ; INT
, "Ptr", second ; WORD*
, "Int", secondLength ; INT
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●unorm2_append(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode) = DLL("icuuc.dll", "int unorm2_append(void*, void*, int, int, void*, int, void*)")
# 呼び出し: unorm2_append(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode)
# norm2 : UNormalizer2* -> "void*"
# first : WORD* in/out -> "void*"
# firstLength : INT -> "int"
# firstCapacity : INT -> "int"
# second : WORD* -> "void*"
# secondLength : INT -> "int"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。