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

ubidi_writeReverse

関数
文字列を逆順に並べ替えて書き出す。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT ubidi_writeReverse(
    const WORD* src,
    INT srcLength,
    WORD* dest,
    INT destSize,
    WORD options,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
srcWORD*in
srcLengthINTin
destWORD*inout
destSizeINTin
optionsWORDin
pErrorCodeUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

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

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procubidi_writeReverse = icuuc.NewProc("ubidi_writeReverse")
)

// src (WORD*), srcLength (INT), dest (WORD* in/out), destSize (INT), options (WORD), pErrorCode (UErrorCode* in/out)
r1, _, err := procubidi_writeReverse.Call(
	uintptr(src),
	uintptr(srcLength),
	uintptr(dest),
	uintptr(destSize),
	uintptr(options),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function ubidi_writeReverse(
  src: Pointer;   // WORD*
  srcLength: Integer;   // INT
  dest: Pointer;   // WORD* in/out
  destSize: Integer;   // INT
  options: Word;   // WORD
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'ubidi_writeReverse';
result := DllCall("icuuc\ubidi_writeReverse"
    , "Ptr", src   ; WORD*
    , "Int", srcLength   ; INT
    , "Ptr", dest   ; WORD* in/out
    , "Int", destSize   ; INT
    , "UShort", options   ; WORD
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: INT
●ubidi_writeReverse(src, srcLength, dest, destSize, options, pErrorCode) = DLL("icuuc.dll", "int ubidi_writeReverse(void*, int, void*, int, int, void*)")
# 呼び出し: ubidi_writeReverse(src, srcLength, dest, destSize, options, pErrorCode)
# src : WORD* -> "void*"
# srcLength : INT -> "int"
# dest : WORD* in/out -> "void*"
# destSize : INT -> "int"
# options : WORD -> "int"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。