Win32 API 日本語リファレンス
ホームGlobalization › unorm2_isNormalized

unorm2_isNormalized

関数
文字列が正規化済みかどうかを判定する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

// icuuc.dll
#include <windows.h>

CHAR unorm2_isNormalized(
    const UNormalizer2* norm2,
    const WORD* s,
    INT length,
    UErrorCode* pErrorCode
);

パラメーター

名前方向説明
norm2UNormalizer2*in使用する正規化器インスタンス。
sWORD*in検査するUTF-16文字列へのポインタ。
lengthINTinsの長さ(UChar単位)。-1の場合はNUL終端文字列として扱う。
pErrorCodeUErrorCode*inoutエラーコードを受け取るUErrorCodeポインタ。正規化済みならTRUEを返す。

戻り値の型: CHAR

各言語での呼び出し定義

// icuuc.dll
#include <windows.h>

CHAR unorm2_isNormalized(
    const UNormalizer2* norm2,
    const WORD* s,
    INT length,
    UErrorCode* pErrorCode
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern sbyte unorm2_isNormalized(
    ref IntPtr norm2,   // UNormalizer2*
    ref ushort s,   // WORD*
    int length,   // INT
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function unorm2_isNormalized(
    ByRef norm2 As IntPtr,   ' UNormalizer2*
    ByRef s As UShort,   ' WORD*
    length As Integer,   ' INT
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As SByte
End Function
' norm2 : UNormalizer2*
' s : WORD*
' length : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function unorm2_isNormalized Lib "icuuc" ( _
    ByRef norm2 As LongPtr, _
    ByRef s As Integer, _
    ByVal length As Long, _
    ByRef pErrorCode As Long) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

unorm2_isNormalized = ctypes.cdll.icuuc.unorm2_isNormalized
unorm2_isNormalized.restype = ctypes.c_byte
unorm2_isNormalized.argtypes = [
    ctypes.c_void_p,  # norm2 : UNormalizer2*
    ctypes.POINTER(ctypes.c_ushort),  # s : WORD*
    ctypes.c_int,  # length : INT
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
unorm2_isNormalized = Fiddle::Function.new(
  lib['unorm2_isNormalized'],
  [
    Fiddle::TYPE_VOIDP,  # norm2 : UNormalizer2*
    Fiddle::TYPE_VOIDP,  # s : WORD*
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_CHAR, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn unorm2_isNormalized(
        norm2: *const isize,  // UNormalizer2*
        s: *const u16,  // WORD*
        length: i32,  // INT
        pErrorCode: *mut i32  // UErrorCode* in/out
    ) -> i8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte unorm2_isNormalized(ref IntPtr norm2, ref ushort s, int length, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_unorm2_isNormalized' -Namespace Win32 -PassThru
# $api::unorm2_isNormalized(norm2, s, length, pErrorCode)
#uselib "icuuc.dll"
#func global unorm2_isNormalized "unorm2_isNormalized" sptr, sptr, sptr, sptr
; unorm2_isNormalized varptr(norm2), varptr(s), length, varptr(pErrorCode)   ; 戻り値は stat
; norm2 : UNormalizer2* -> "sptr"
; s : WORD* -> "sptr"
; length : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global unorm2_isNormalized "unorm2_isNormalized" var, var, int, var
; res = unorm2_isNormalized(norm2, s, length, pErrorCode)
; norm2 : UNormalizer2* -> "var"
; s : WORD* -> "var"
; length : INT -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; CHAR unorm2_isNormalized(UNormalizer2* norm2, WORD* s, INT length, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#cfunc global unorm2_isNormalized "unorm2_isNormalized" var, var, int, var
; res = unorm2_isNormalized(norm2, s, length, pErrorCode)
; norm2 : UNormalizer2* -> "var"
; s : WORD* -> "var"
; length : INT -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procunorm2_isNormalized = icuuc.NewProc("unorm2_isNormalized")
)

// norm2 (UNormalizer2*), s (WORD*), length (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := procunorm2_isNormalized.Call(
	uintptr(norm2),
	uintptr(s),
	uintptr(length),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // CHAR
function unorm2_isNormalized(
  norm2: Pointer;   // UNormalizer2*
  s: Pointer;   // WORD*
  length: Integer;   // INT
  pErrorCode: Pointer   // UErrorCode* in/out
): Shortint; cdecl;
  external 'icuuc.dll' name 'unorm2_isNormalized';
result := DllCall("icuuc\unorm2_isNormalized"
    , "Ptr", norm2   ; UNormalizer2*
    , "Ptr", s   ; WORD*
    , "Int", length   ; INT
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Char")   ; return: CHAR
●unorm2_isNormalized(norm2, s, length, pErrorCode) = DLL("icuuc.dll", "char unorm2_isNormalized(void*, void*, int, void*)")
# 呼び出し: unorm2_isNormalized(norm2, s, length, pErrorCode)
# norm2 : UNormalizer2* -> "void*"
# s : WORD* -> "void*"
# length : 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_isNormalized(
    norm2: [*c]isize, // UNormalizer2*
    s: [*c]u16, // WORD*
    length: i32, // INT
    pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) i8;
proc unorm2_isNormalized(
    norm2: ptr int,  # UNormalizer2*
    s: ptr uint16,  # WORD*
    length: int32,  # INT
    pErrorCode: ptr int32  # UErrorCode* in/out
): int8 {.importc: "unorm2_isNormalized", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
byte unorm2_isNormalized(
    ptrdiff_t* norm2,   // UNormalizer2*
    ushort* s,   // WORD*
    int length,   // INT
    int* pErrorCode   // UErrorCode* in/out
);
ccall((:unorm2_isNormalized, "icuuc.dll"), Int8,
      (Ptr{Int}, Ptr{UInt16}, Int32, Ptr{Int32}),
      norm2, s, length, pErrorCode)
# norm2 : UNormalizer2* -> Ptr{Int}
# s : WORD* -> Ptr{UInt16}
# length : INT -> Int32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
int8_t unorm2_isNormalized(
    intptr_t* norm2,
    uint16_t* s,
    int32_t length,
    int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.unorm2_isNormalized(norm2, s, length, pErrorCode)
-- norm2 : UNormalizer2*
-- s : WORD*
-- length : INT
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const unorm2_isNormalized = lib.func('__cdecl', 'unorm2_isNormalized', 'int8_t', ['intptr_t *', 'uint16_t *', 'int32_t', 'int32_t *']);
// unorm2_isNormalized(norm2, s, length, pErrorCode)
// norm2 : UNormalizer2* -> 'intptr_t *'
// s : WORD* -> 'uint16_t *'
// length : INT -> 'int32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  unorm2_isNormalized: { parameters: ["pointer", "pointer", "i32", "pointer"], result: "i8" },
});
// lib.symbols.unorm2_isNormalized(norm2, s, length, pErrorCode)
// norm2 : UNormalizer2* -> "pointer"
// s : WORD* -> "pointer"
// length : INT -> "i32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int8_t unorm2_isNormalized(
    intptr_t* norm2,
    uint16_t* s,
    int32_t length,
    int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->unorm2_isNormalized(norm2, s, length, pErrorCode);
// norm2 : UNormalizer2*
// s : WORD*
// length : 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);
    byte unorm2_isNormalized(
        LongByReference norm2,   // UNormalizer2*
        ShortByReference s,   // WORD*
        int length,   // INT
        IntByReference pErrorCode   // UErrorCode* in/out
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun unorm2_isNormalized = unorm2_isNormalized(
    norm2 : LibC::SSizeT*,   # UNormalizer2*
    s : UInt16*,   # WORD*
    length : Int32,   # INT
    pErrorCode : Int32*   # UErrorCode* in/out
  ) : Int8
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef unorm2_isNormalizedNative = Int8 Function(Pointer<IntPtr>, Pointer<Uint16>, Int32, Pointer<Int32>);
typedef unorm2_isNormalizedDart = int Function(Pointer<IntPtr>, Pointer<Uint16>, int, Pointer<Int32>);
final unorm2_isNormalized = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<unorm2_isNormalizedNative, unorm2_isNormalizedDart>('unorm2_isNormalized');
// norm2 : UNormalizer2* -> Pointer<IntPtr>
// s : WORD* -> Pointer<Uint16>
// length : INT -> Int32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function unorm2_isNormalized(
  norm2: Pointer;   // UNormalizer2*
  s: Pointer;   // WORD*
  length: Integer;   // INT
  pErrorCode: Pointer   // UErrorCode* in/out
): Shortint; cdecl;
  external 'icuuc.dll' name 'unorm2_isNormalized';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "unorm2_isNormalized"
  c_unorm2_isNormalized :: Ptr CIntPtr -> Ptr Word16 -> Int32 -> Ptr Int32 -> IO Int8
-- norm2 : UNormalizer2* -> Ptr CIntPtr
-- s : WORD* -> Ptr Word16
-- length : INT -> Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let unorm2_isnormalized =
  foreign "unorm2_isNormalized"
    ((ptr intptr_t) @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning int8_t)
(* norm2 : UNormalizer2* -> (ptr intptr_t) *)
(* s : WORD* -> (ptr uint16_t) *)
(* length : 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_isNormalized" unorm2-is-normalized :convention :cdecl) :int8
  (norm2 :pointer)   ; UNormalizer2*
  (s :pointer)   ; WORD*
  (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_isNormalized = Win32::API::More->new('icuuc',
    'char unorm2_isNormalized(LPVOID norm2, LPVOID s, int length, LPVOID pErrorCode)');
# my $ret = $unorm2_isNormalized->Call($norm2, $s, $length, $pErrorCode);
# norm2 : UNormalizer2* -> LPVOID
# s : WORD* -> LPVOID
# length : INT -> int
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型