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

unum_open

関数
スタイルやパターンを指定し数値フォーマッタを開く。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

void** unum_open(
    UNumberFormatStyle style,
    const WORD* pattern,
    INT patternLength,
    LPCSTR locale,
    UParseError* parseErr,
    UErrorCode* status
);

パラメーター

名前方向
styleUNumberFormatStylein
patternWORD*in
patternLengthINTin
localeLPCSTRin
parseErrUParseError*inout
statusUErrorCode*inout

戻り値の型: void**

各言語での呼び出し定義

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

void** unum_open(
    UNumberFormatStyle style,
    const WORD* pattern,
    INT patternLength,
    LPCSTR locale,
    UParseError* parseErr,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr unum_open(
    int style,   // UNumberFormatStyle
    ref ushort pattern,   // WORD*
    int patternLength,   // INT
    [MarshalAs(UnmanagedType.LPStr)] string locale,   // LPCSTR
    IntPtr parseErr,   // UParseError* in/out
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function unum_open(
    style As Integer,   ' UNumberFormatStyle
    ByRef pattern As UShort,   ' WORD*
    patternLength As Integer,   ' INT
    <MarshalAs(UnmanagedType.LPStr)> locale As String,   ' LPCSTR
    parseErr As IntPtr,   ' UParseError* in/out
    ByRef status As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' style : UNumberFormatStyle
' pattern : WORD*
' patternLength : INT
' locale : LPCSTR
' parseErr : UParseError* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function unum_open Lib "icuin" ( _
    ByVal style As Long, _
    ByRef pattern As Integer, _
    ByVal patternLength As Long, _
    ByVal locale As String, _
    ByVal parseErr As LongPtr, _
    ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

unum_open = ctypes.cdll.icuin.unum_open
unum_open.restype = ctypes.c_void_p
unum_open.argtypes = [
    ctypes.c_int,  # style : UNumberFormatStyle
    ctypes.POINTER(ctypes.c_ushort),  # pattern : WORD*
    ctypes.c_int,  # patternLength : INT
    wintypes.LPCSTR,  # locale : LPCSTR
    ctypes.c_void_p,  # parseErr : UParseError* in/out
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
unum_open = Fiddle::Function.new(
  lib['unum_open'],
  [
    Fiddle::TYPE_INT,  # style : UNumberFormatStyle
    Fiddle::TYPE_VOIDP,  # pattern : WORD*
    Fiddle::TYPE_INT,  # patternLength : INT
    Fiddle::TYPE_VOIDP,  # locale : LPCSTR
    Fiddle::TYPE_VOIDP,  # parseErr : UParseError* in/out
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn unum_open(
        style: i32,  // UNumberFormatStyle
        pattern: *const u16,  // WORD*
        patternLength: i32,  // INT
        locale: *const u8,  // LPCSTR
        parseErr: *mut UParseError,  // UParseError* in/out
        status: *mut i32  // UErrorCode* in/out
    ) -> *mut *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr unum_open(int style, ref ushort pattern, int patternLength, [MarshalAs(UnmanagedType.LPStr)] string locale, IntPtr parseErr, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_unum_open' -Namespace Win32 -PassThru
# $api::unum_open(style, pattern, patternLength, locale, parseErr, status)
#uselib "icuin.dll"
#func global unum_open "unum_open" sptr, sptr, sptr, sptr, sptr, sptr
; unum_open style, varptr(pattern), patternLength, locale, varptr(parseErr), status   ; 戻り値は stat
; style : UNumberFormatStyle -> "sptr"
; pattern : WORD* -> "sptr"
; patternLength : INT -> "sptr"
; locale : LPCSTR -> "sptr"
; parseErr : UParseError* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuin.dll"
#cfunc global unum_open "unum_open" int, var, int, str, var, int
; res = unum_open(style, pattern, patternLength, locale, parseErr, status)
; style : UNumberFormatStyle -> "int"
; pattern : WORD* -> "var"
; patternLength : INT -> "int"
; locale : LPCSTR -> "str"
; parseErr : UParseError* in/out -> "var"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void** unum_open(UNumberFormatStyle style, WORD* pattern, INT patternLength, LPCSTR locale, UParseError* parseErr, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global unum_open "unum_open" int, var, int, str, var, int
; res = unum_open(style, pattern, patternLength, locale, parseErr, status)
; style : UNumberFormatStyle -> "int"
; pattern : WORD* -> "var"
; patternLength : INT -> "int"
; locale : LPCSTR -> "str"
; parseErr : UParseError* in/out -> "var"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procunum_open = icuin.NewProc("unum_open")
)

// style (UNumberFormatStyle), pattern (WORD*), patternLength (INT), locale (LPCSTR), parseErr (UParseError* in/out), status (UErrorCode* in/out)
r1, _, err := procunum_open.Call(
	uintptr(style),
	uintptr(pattern),
	uintptr(patternLength),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
	uintptr(parseErr),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void**
function unum_open(
  style: Integer;   // UNumberFormatStyle
  pattern: Pointer;   // WORD*
  patternLength: Integer;   // INT
  locale: PAnsiChar;   // LPCSTR
  parseErr: Pointer;   // UParseError* in/out
  status: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuin.dll' name 'unum_open';
result := DllCall("icuin\unum_open"
    , "Int", style   ; UNumberFormatStyle
    , "Ptr", pattern   ; WORD*
    , "Int", patternLength   ; INT
    , "AStr", locale   ; LPCSTR
    , "Ptr", parseErr   ; UParseError* in/out
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: void**
●unum_open(style, pattern, patternLength, locale, parseErr, status) = DLL("icuin.dll", "void* unum_open(int, void*, int, char*, void*, void*)")
# 呼び出し: unum_open(style, pattern, patternLength, locale, parseErr, status)
# style : UNumberFormatStyle -> "int"
# pattern : WORD* -> "void*"
# patternLength : INT -> "int"
# locale : LPCSTR -> "char*"
# parseErr : UParseError* in/out -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。