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

unum_getContext

関数
数値フォーマッタの表示コンテキストを取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

UDisplayContext unum_getContext(
    const void** fmt,
    UDisplayContextType type,
    UErrorCode* status
);

パラメーター

名前方向
fmtvoid**in
typeUDisplayContextTypein
statusUErrorCode*inout

戻り値の型: UDisplayContext

各言語での呼び出し定義

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

UDisplayContext unum_getContext(
    const void** fmt,
    UDisplayContextType type,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int unum_getContext(
    IntPtr fmt,   // void**
    int type,   // UDisplayContextType
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function unum_getContext(
    fmt As IntPtr,   ' void**
    type As Integer,   ' UDisplayContextType
    ByRef status As Integer   ' UErrorCode* in/out
) As Integer
End Function
' fmt : void**
' type : UDisplayContextType
' status : UErrorCode* in/out
Declare PtrSafe Function unum_getContext Lib "icuin" ( _
    ByVal fmt As LongPtr, _
    ByVal type As Long, _
    ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

unum_getContext = ctypes.cdll.icuin.unum_getContext
unum_getContext.restype = ctypes.c_int
unum_getContext.argtypes = [
    ctypes.c_void_p,  # fmt : void**
    ctypes.c_int,  # type : UDisplayContextType
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
unum_getContext = Fiddle::Function.new(
  lib['unum_getContext'],
  [
    Fiddle::TYPE_VOIDP,  # fmt : void**
    Fiddle::TYPE_INT,  # type : UDisplayContextType
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn unum_getContext(
        fmt: *const *const (),  // void**
        type: i32,  // UDisplayContextType
        status: *mut i32  // UErrorCode* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int unum_getContext(IntPtr fmt, int type, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_unum_getContext' -Namespace Win32 -PassThru
# $api::unum_getContext(fmt, type, status)
#uselib "icuin.dll"
#func global unum_getContext "unum_getContext" sptr, sptr, sptr
; unum_getContext fmt, type, status   ; 戻り値は stat
; fmt : void** -> "sptr"
; type : UDisplayContextType -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuin.dll"
#cfunc global unum_getContext "unum_getContext" sptr, int, int
; res = unum_getContext(fmt, type, status)
; fmt : void** -> "sptr"
; type : UDisplayContextType -> "int"
; status : UErrorCode* in/out -> "int"
; UDisplayContext unum_getContext(void** fmt, UDisplayContextType type, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global unum_getContext "unum_getContext" intptr, int, int
; res = unum_getContext(fmt, type, status)
; fmt : void** -> "intptr"
; type : UDisplayContextType -> "int"
; status : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procunum_getContext = icuin.NewProc("unum_getContext")
)

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