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

ucurr_isAvailable

関数
指定通貨が指定期間に有効かどうかを判定する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

CHAR ucurr_isAvailable(
    const WORD* isoCode,
    DOUBLE from,
    DOUBLE to,
    UErrorCode* errorCode
);

パラメーター

名前方向
isoCodeWORD*in
fromDOUBLEin
toDOUBLEin
errorCodeUErrorCode*inout

戻り値の型: CHAR

各言語での呼び出し定義

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

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

ucurr_isAvailable = ctypes.cdll.icuuc.ucurr_isAvailable
ucurr_isAvailable.restype = ctypes.c_byte
ucurr_isAvailable.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # isoCode : WORD*
    ctypes.c_double,  # from : DOUBLE
    ctypes.c_double,  # to : DOUBLE
    ctypes.c_void_p,  # errorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucurr_isAvailable = icuuc.NewProc("ucurr_isAvailable")
)

// isoCode (WORD*), from (DOUBLE), to (DOUBLE), errorCode (UErrorCode* in/out)
r1, _, err := procucurr_isAvailable.Call(
	uintptr(isoCode),
	uintptr(math.Float64bits(from)),
	uintptr(math.Float64bits(to)),
	uintptr(errorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // CHAR
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。
function ucurr_isAvailable(
  isoCode: Pointer;   // WORD*
  from: Double;   // DOUBLE
  to: Double;   // DOUBLE
  errorCode: Pointer   // UErrorCode* in/out
): Shortint; cdecl;
  external 'icuuc.dll' name 'ucurr_isAvailable';
result := DllCall("icuuc\ucurr_isAvailable"
    , "Ptr", isoCode   ; WORD*
    , "Double", from   ; DOUBLE
    , "Double", to   ; DOUBLE
    , "Ptr", errorCode   ; UErrorCode* in/out
    , "Cdecl Char")   ; return: CHAR
●ucurr_isAvailable(isoCode, from, to, errorCode) = DLL("icuuc.dll", "char ucurr_isAvailable(void*, double, double, void*)")
# 呼び出し: ucurr_isAvailable(isoCode, from, to, errorCode)
# isoCode : WORD* -> "void*"
# from : DOUBLE -> "double"
# to : DOUBLE -> "double"
# errorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。