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