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

u_shapeArabic

関数
アラビア文字列に対し表示形整形(シェイピング)を行う。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT u_shapeArabic(
    const WORD* source,
    INT sourceLength,
    WORD* dest,
    INT destSize,
    DWORD options,
    UErrorCode* pErrorCode
);

パラメーター

名前方向説明
sourceWORD*in整形処理を行う変換元のUTF-16(UChar)文字列。
sourceLengthINTinsourceの文字数。-1指定でNULL終端まで処理する。
destWORD*inout整形結果のUTF-16文字列を受け取るバッファ。
destSizeINTindestバッファのサイズを文字数で指定する。0指定で必要サイズを取得する。
optionsDWORDinアラビア文字整形オプションを指定するビットフラグ(LETTERS/DIGITS等)。
pErrorCodeUErrorCode*inoutICUエラーコードを受け取るUErrorCodeへのポインタ。事前にU_ZERO_ERROR初期化が必要。

戻り値の型: INT

各言語での呼び出し定義

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

INT u_shapeArabic(
    const WORD* source,
    INT sourceLength,
    WORD* dest,
    INT destSize,
    DWORD options,
    UErrorCode* pErrorCode
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int u_shapeArabic(
    ref ushort source,   // WORD*
    int sourceLength,   // INT
    ref ushort dest,   // WORD* in/out
    int destSize,   // INT
    uint options,   // DWORD
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_shapeArabic(
    ByRef source As UShort,   ' WORD*
    sourceLength As Integer,   ' INT
    ByRef dest As UShort,   ' WORD* in/out
    destSize As Integer,   ' INT
    options As UInteger,   ' DWORD
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Integer
End Function
' source : WORD*
' sourceLength : INT
' dest : WORD* in/out
' destSize : INT
' options : DWORD
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function u_shapeArabic Lib "icuuc" ( _
    ByRef source As Integer, _
    ByVal sourceLength As Long, _
    ByRef dest As Integer, _
    ByVal destSize As Long, _
    ByVal options 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

u_shapeArabic = ctypes.cdll.icuuc.u_shapeArabic
u_shapeArabic.restype = ctypes.c_int
u_shapeArabic.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # source : WORD*
    ctypes.c_int,  # sourceLength : INT
    ctypes.POINTER(ctypes.c_ushort),  # dest : WORD* in/out
    ctypes.c_int,  # destSize : INT
    wintypes.DWORD,  # options : DWORD
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
u_shapeArabic = Fiddle::Function.new(
  lib['u_shapeArabic'],
  [
    Fiddle::TYPE_VOIDP,  # source : WORD*
    Fiddle::TYPE_INT,  # sourceLength : INT
    Fiddle::TYPE_VOIDP,  # dest : WORD* in/out
    Fiddle::TYPE_INT,  # destSize : INT
    -Fiddle::TYPE_INT,  # options : DWORD
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn u_shapeArabic(
        source: *const u16,  // WORD*
        sourceLength: i32,  // INT
        dest: *mut u16,  // WORD* in/out
        destSize: i32,  // INT
        options: u32,  // DWORD
        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 u_shapeArabic(ref ushort source, int sourceLength, ref ushort dest, int destSize, uint options, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_shapeArabic' -Namespace Win32 -PassThru
# $api::u_shapeArabic(source, sourceLength, dest, destSize, options, pErrorCode)
#uselib "icuuc.dll"
#func global u_shapeArabic "u_shapeArabic" sptr, sptr, sptr, sptr, sptr, sptr
; u_shapeArabic varptr(source), sourceLength, varptr(dest), destSize, options, varptr(pErrorCode)   ; 戻り値は stat
; source : WORD* -> "sptr"
; sourceLength : INT -> "sptr"
; dest : WORD* in/out -> "sptr"
; destSize : INT -> "sptr"
; options : DWORD -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global u_shapeArabic "u_shapeArabic" var, int, var, int, int, var
; res = u_shapeArabic(source, sourceLength, dest, destSize, options, pErrorCode)
; source : WORD* -> "var"
; sourceLength : INT -> "int"
; dest : WORD* in/out -> "var"
; destSize : INT -> "int"
; options : DWORD -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT u_shapeArabic(WORD* source, INT sourceLength, WORD* dest, INT destSize, DWORD options, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#cfunc global u_shapeArabic "u_shapeArabic" var, int, var, int, int, var
; res = u_shapeArabic(source, sourceLength, dest, destSize, options, pErrorCode)
; source : WORD* -> "var"
; sourceLength : INT -> "int"
; dest : WORD* in/out -> "var"
; destSize : INT -> "int"
; options : DWORD -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procu_shapeArabic = icuuc.NewProc("u_shapeArabic")
)

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

typedef u_shapeArabicNative = Int32 Function(Pointer<Uint16>, Int32, Pointer<Uint16>, Int32, Uint32, Pointer<Int32>);
typedef u_shapeArabicDart = int Function(Pointer<Uint16>, int, Pointer<Uint16>, int, int, Pointer<Int32>);
final u_shapeArabic = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<u_shapeArabicNative, u_shapeArabicDart>('u_shapeArabic');
// source : WORD* -> Pointer<Uint16>
// sourceLength : INT -> Int32
// dest : WORD* in/out -> Pointer<Uint16>
// destSize : INT -> Int32
// options : DWORD -> Uint32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function u_shapeArabic(
  source: Pointer;   // WORD*
  sourceLength: Integer;   // INT
  dest: Pointer;   // WORD* in/out
  destSize: Integer;   // INT
  options: DWORD;   // DWORD
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'u_shapeArabic';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "u_shapeArabic"
  c_u_shapeArabic :: Ptr Word16 -> Int32 -> Ptr Word16 -> Int32 -> Word32 -> Ptr Int32 -> IO Int32
-- source : WORD* -> Ptr Word16
-- sourceLength : INT -> Int32
-- dest : WORD* in/out -> Ptr Word16
-- destSize : INT -> Int32
-- options : DWORD -> Word32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let u_shapearabic =
  foreign "u_shapeArabic"
    ((ptr uint16_t) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> uint32_t @-> (ptr int32_t) @-> returning int32_t)
(* source : WORD* -> (ptr uint16_t) *)
(* sourceLength : INT -> int32_t *)
(* dest : WORD* in/out -> (ptr uint16_t) *)
(* destSize : INT -> int32_t *)
(* options : DWORD -> uint32_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 ("u_shapeArabic" u-shape-arabic :convention :cdecl) :int32
  (source :pointer)   ; WORD*
  (source-length :int32)   ; INT
  (dest :pointer)   ; WORD* in/out
  (dest-size :int32)   ; INT
  (options :uint32)   ; DWORD
  (p-error-code :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $u_shapeArabic = Win32::API::More->new('icuuc',
    'int u_shapeArabic(LPVOID source, int sourceLength, LPVOID dest, int destSize, DWORD options, LPVOID pErrorCode)');
# my $ret = $u_shapeArabic->Call($source, $sourceLength, $dest, $destSize, $options, $pErrorCode);
# source : WORD* -> LPVOID
# sourceLength : INT -> int
# dest : WORD* in/out -> LPVOID
# destSize : INT -> int
# options : DWORD -> DWORD
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型