ホーム › Globalization › unorm2_normalizeSecondAndAppend
unorm2_normalizeSecondAndAppend
関数第二文字列を正規化して第一文字列に連結する。
シグネチャ
// icuuc.dll
#include <windows.h>
INT unorm2_normalizeSecondAndAppend(
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 | firstの現在の長さ(UChar単位)。-1の場合はNUL終端として扱う。 |
| firstCapacity | INT | in | firstバッファの総容量(UChar単位)。 |
| second | WORD* | in | 正規化して連結する第二文字列へのポインタ。 |
| secondLength | INT | in | secondの長さ(UChar単位)。-1の場合はNUL終端として扱う。 |
| pErrorCode | UErrorCode* | inout | エラーコードを受け取るUErrorCodeポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
INT unorm2_normalizeSecondAndAppend(
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_normalizeSecondAndAppend(
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_normalizeSecondAndAppend(
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_normalizeSecondAndAppend 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_normalizeSecondAndAppend = ctypes.cdll.icuuc.unorm2_normalizeSecondAndAppend
unorm2_normalizeSecondAndAppend.restype = ctypes.c_int
unorm2_normalizeSecondAndAppend.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_normalizeSecondAndAppend = Fiddle::Function.new(
lib['unorm2_normalizeSecondAndAppend'],
[
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_normalizeSecondAndAppend(
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_normalizeSecondAndAppend(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_normalizeSecondAndAppend' -Namespace Win32 -PassThru
# $api::unorm2_normalizeSecondAndAppend(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode)#uselib "icuuc.dll"
#func global unorm2_normalizeSecondAndAppend "unorm2_normalizeSecondAndAppend" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; unorm2_normalizeSecondAndAppend varptr(norm2), varptr(first), firstLength, firstCapacity, varptr(second), secondLength, varptr(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_normalizeSecondAndAppend "unorm2_normalizeSecondAndAppend" var, var, int, int, var, int, var ; res = unorm2_normalizeSecondAndAppend(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode) ; norm2 : UNormalizer2* -> "var" ; first : WORD* in/out -> "var" ; firstLength : INT -> "int" ; firstCapacity : INT -> "int" ; second : WORD* -> "var" ; secondLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global unorm2_normalizeSecondAndAppend "unorm2_normalizeSecondAndAppend" sptr, sptr, int, int, sptr, int, sptr ; res = unorm2_normalizeSecondAndAppend(varptr(norm2), varptr(first), firstLength, firstCapacity, varptr(second), secondLength, varptr(pErrorCode)) ; norm2 : UNormalizer2* -> "sptr" ; first : WORD* in/out -> "sptr" ; firstLength : INT -> "int" ; firstCapacity : INT -> "int" ; second : WORD* -> "sptr" ; secondLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT unorm2_normalizeSecondAndAppend(UNormalizer2* norm2, WORD* first, INT firstLength, INT firstCapacity, WORD* second, INT secondLength, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global unorm2_normalizeSecondAndAppend "unorm2_normalizeSecondAndAppend" var, var, int, int, var, int, var ; res = unorm2_normalizeSecondAndAppend(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode) ; norm2 : UNormalizer2* -> "var" ; first : WORD* in/out -> "var" ; firstLength : INT -> "int" ; firstCapacity : INT -> "int" ; second : WORD* -> "var" ; secondLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT unorm2_normalizeSecondAndAppend(UNormalizer2* norm2, WORD* first, INT firstLength, INT firstCapacity, WORD* second, INT secondLength, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global unorm2_normalizeSecondAndAppend "unorm2_normalizeSecondAndAppend" intptr, intptr, int, int, intptr, int, intptr ; res = unorm2_normalizeSecondAndAppend(varptr(norm2), varptr(first), firstLength, firstCapacity, varptr(second), secondLength, varptr(pErrorCode)) ; norm2 : UNormalizer2* -> "intptr" ; first : WORD* in/out -> "intptr" ; firstLength : INT -> "int" ; firstCapacity : INT -> "int" ; second : WORD* -> "intptr" ; secondLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procunorm2_normalizeSecondAndAppend = icuuc.NewProc("unorm2_normalizeSecondAndAppend")
)
// norm2 (UNormalizer2*), first (WORD* in/out), firstLength (INT), firstCapacity (INT), second (WORD*), secondLength (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := procunorm2_normalizeSecondAndAppend.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_normalizeSecondAndAppend(
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_normalizeSecondAndAppend';result := DllCall("icuuc\unorm2_normalizeSecondAndAppend"
, "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_normalizeSecondAndAppend(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode) = DLL("icuuc.dll", "int unorm2_normalizeSecondAndAppend(void*, void*, int, int, void*, int, void*)")
# 呼び出し: unorm2_normalizeSecondAndAppend(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`,…) を使用。const std = @import("std");
extern "icuuc" fn unorm2_normalizeSecondAndAppend(
norm2: [*c]isize, // UNormalizer2*
first: [*c]u16, // WORD* in/out
firstLength: i32, // INT
firstCapacity: i32, // INT
second: [*c]u16, // WORD*
secondLength: i32, // INT
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc unorm2_normalizeSecondAndAppend(
norm2: ptr int, # UNormalizer2*
first: ptr uint16, # WORD* in/out
firstLength: int32, # INT
firstCapacity: int32, # INT
second: ptr uint16, # WORD*
secondLength: int32, # INT
pErrorCode: ptr int32 # UErrorCode* in/out
): int32 {.importc: "unorm2_normalizeSecondAndAppend", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
int unorm2_normalizeSecondAndAppend(
ptrdiff_t* norm2, // UNormalizer2*
ushort* first, // WORD* in/out
int firstLength, // INT
int firstCapacity, // INT
ushort* second, // WORD*
int secondLength, // INT
int* pErrorCode // UErrorCode* in/out
);ccall((:unorm2_normalizeSecondAndAppend, "icuuc.dll"), Int32,
(Ptr{Int}, Ptr{UInt16}, Int32, Int32, Ptr{UInt16}, Int32, Ptr{Int32}),
norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode)
# norm2 : UNormalizer2* -> Ptr{Int}
# first : WORD* in/out -> Ptr{UInt16}
# firstLength : INT -> Int32
# firstCapacity : INT -> Int32
# second : WORD* -> Ptr{UInt16}
# secondLength : INT -> Int32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t unorm2_normalizeSecondAndAppend(
intptr_t* norm2,
uint16_t* first,
int32_t firstLength,
int32_t firstCapacity,
uint16_t* second,
int32_t secondLength,
int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.unorm2_normalizeSecondAndAppend(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode)
-- norm2 : UNormalizer2*
-- first : WORD* in/out
-- firstLength : INT
-- firstCapacity : INT
-- second : WORD*
-- secondLength : INT
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const unorm2_normalizeSecondAndAppend = lib.func('__cdecl', 'unorm2_normalizeSecondAndAppend', 'int32_t', ['intptr_t *', 'uint16_t *', 'int32_t', 'int32_t', 'uint16_t *', 'int32_t', 'int32_t *']);
// unorm2_normalizeSecondAndAppend(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode)
// norm2 : UNormalizer2* -> 'intptr_t *'
// first : WORD* in/out -> 'uint16_t *'
// firstLength : INT -> 'int32_t'
// firstCapacity : INT -> 'int32_t'
// second : WORD* -> 'uint16_t *'
// secondLength : INT -> 'int32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
unorm2_normalizeSecondAndAppend: { parameters: ["pointer", "pointer", "i32", "i32", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.unorm2_normalizeSecondAndAppend(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode)
// norm2 : UNormalizer2* -> "pointer"
// first : WORD* in/out -> "pointer"
// firstLength : INT -> "i32"
// firstCapacity : INT -> "i32"
// second : WORD* -> "pointer"
// secondLength : INT -> "i32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t unorm2_normalizeSecondAndAppend(
intptr_t* norm2,
uint16_t* first,
int32_t firstLength,
int32_t firstCapacity,
uint16_t* second,
int32_t secondLength,
int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->unorm2_normalizeSecondAndAppend(norm2, first, firstLength, firstCapacity, second, secondLength, pErrorCode);
// norm2 : UNormalizer2*
// first : WORD* in/out
// firstLength : INT
// firstCapacity : INT
// second : WORD*
// secondLength : INT
// pErrorCode : UErrorCode* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Icuuc extends Library {
Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
int unorm2_normalizeSecondAndAppend(
LongByReference norm2, // UNormalizer2*
ShortByReference first, // WORD* in/out
int firstLength, // INT
int firstCapacity, // INT
ShortByReference second, // WORD*
int secondLength, // INT
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuuc")]
lib Libicuuc
fun unorm2_normalizeSecondAndAppend = unorm2_normalizeSecondAndAppend(
norm2 : LibC::SSizeT*, # UNormalizer2*
first : UInt16*, # WORD* in/out
firstLength : Int32, # INT
firstCapacity : Int32, # INT
second : UInt16*, # WORD*
secondLength : Int32, # INT
pErrorCode : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef unorm2_normalizeSecondAndAppendNative = Int32 Function(Pointer<IntPtr>, Pointer<Uint16>, Int32, Int32, Pointer<Uint16>, Int32, Pointer<Int32>);
typedef unorm2_normalizeSecondAndAppendDart = int Function(Pointer<IntPtr>, Pointer<Uint16>, int, int, Pointer<Uint16>, int, Pointer<Int32>);
final unorm2_normalizeSecondAndAppend = DynamicLibrary.open('icuuc.dll')
.lookupFunction<unorm2_normalizeSecondAndAppendNative, unorm2_normalizeSecondAndAppendDart>('unorm2_normalizeSecondAndAppend');
// norm2 : UNormalizer2* -> Pointer<IntPtr>
// first : WORD* in/out -> Pointer<Uint16>
// firstLength : INT -> Int32
// firstCapacity : INT -> Int32
// second : WORD* -> Pointer<Uint16>
// secondLength : INT -> Int32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function unorm2_normalizeSecondAndAppend(
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_normalizeSecondAndAppend';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "unorm2_normalizeSecondAndAppend"
c_unorm2_normalizeSecondAndAppend :: Ptr CIntPtr -> Ptr Word16 -> Int32 -> Int32 -> Ptr Word16 -> Int32 -> Ptr Int32 -> IO Int32
-- norm2 : UNormalizer2* -> Ptr CIntPtr
-- first : WORD* in/out -> Ptr Word16
-- firstLength : INT -> Int32
-- firstCapacity : INT -> Int32
-- second : WORD* -> Ptr Word16
-- secondLength : INT -> Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let unorm2_normalizesecondandappend =
foreign "unorm2_normalizeSecondAndAppend"
((ptr intptr_t) @-> (ptr uint16_t) @-> int32_t @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* norm2 : UNormalizer2* -> (ptr intptr_t) *)
(* first : WORD* in/out -> (ptr uint16_t) *)
(* firstLength : INT -> int32_t *)
(* firstCapacity : INT -> int32_t *)
(* second : WORD* -> (ptr uint16_t) *)
(* secondLength : INT -> int32_t *)
(* pErrorCode : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("unorm2_normalizeSecondAndAppend" unorm2-normalize-second-and-append :convention :cdecl) :int32
(norm2 :pointer) ; UNormalizer2*
(first :pointer) ; WORD* in/out
(first-length :int32) ; INT
(first-capacity :int32) ; INT
(second :pointer) ; WORD*
(second-length :int32) ; INT
(p-error-code :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $unorm2_normalizeSecondAndAppend = Win32::API::More->new('icuuc',
'int unorm2_normalizeSecondAndAppend(LPVOID norm2, LPVOID first, int firstLength, int firstCapacity, LPVOID second, int secondLength, LPVOID pErrorCode)');
# my $ret = $unorm2_normalizeSecondAndAppend->Call($norm2, $first, $firstLength, $firstCapacity, $second, $secondLength, $pErrorCode);
# norm2 : UNormalizer2* -> LPVOID
# first : WORD* in/out -> LPVOID
# firstLength : INT -> int
# firstCapacity : INT -> int
# second : WORD* -> LPVOID
# secondLength : INT -> int
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型