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

ucal_getLimit

関数
カレンダーフィールドの最小値や最大値などの限界を取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

INT ucal_getLimit(
    const void** cal,
    UCalendarDateFields field,
    UCalendarLimitType type,
    UErrorCode* status
);

パラメーター

名前方向
calvoid**in
fieldUCalendarDateFieldsin
typeUCalendarLimitTypein
statusUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT ucal_getLimit(
    const void** cal,
    UCalendarDateFields field,
    UCalendarLimitType type,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucal_getLimit(
    IntPtr cal,   // void**
    int field,   // UCalendarDateFields
    int type,   // UCalendarLimitType
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucal_getLimit(
    cal As IntPtr,   ' void**
    field As Integer,   ' UCalendarDateFields
    type As Integer,   ' UCalendarLimitType
    ByRef status As Integer   ' UErrorCode* in/out
) As Integer
End Function
' cal : void**
' field : UCalendarDateFields
' type : UCalendarLimitType
' status : UErrorCode* in/out
Declare PtrSafe Function ucal_getLimit Lib "icuin" ( _
    ByVal cal As LongPtr, _
    ByVal field As Long, _
    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

ucal_getLimit = ctypes.cdll.icuin.ucal_getLimit
ucal_getLimit.restype = ctypes.c_int
ucal_getLimit.argtypes = [
    ctypes.c_void_p,  # cal : void**
    ctypes.c_int,  # field : UCalendarDateFields
    ctypes.c_int,  # type : UCalendarLimitType
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
ucal_getLimit = Fiddle::Function.new(
  lib['ucal_getLimit'],
  [
    Fiddle::TYPE_VOIDP,  # cal : void**
    Fiddle::TYPE_INT,  # field : UCalendarDateFields
    Fiddle::TYPE_INT,  # type : UCalendarLimitType
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn ucal_getLimit(
        cal: *const *const (),  // void**
        field: i32,  // UCalendarDateFields
        type: i32,  // UCalendarLimitType
        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 ucal_getLimit(IntPtr cal, int field, int type, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucal_getLimit' -Namespace Win32 -PassThru
# $api::ucal_getLimit(cal, field, type, status)
#uselib "icuin.dll"
#func global ucal_getLimit "ucal_getLimit" sptr, sptr, sptr, sptr
; ucal_getLimit cal, field, type, status   ; 戻り値は stat
; cal : void** -> "sptr"
; field : UCalendarDateFields -> "sptr"
; type : UCalendarLimitType -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuin.dll"
#cfunc global ucal_getLimit "ucal_getLimit" sptr, int, int, int
; res = ucal_getLimit(cal, field, type, status)
; cal : void** -> "sptr"
; field : UCalendarDateFields -> "int"
; type : UCalendarLimitType -> "int"
; status : UErrorCode* in/out -> "int"
; INT ucal_getLimit(void** cal, UCalendarDateFields field, UCalendarLimitType type, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global ucal_getLimit "ucal_getLimit" intptr, int, int, int
; res = ucal_getLimit(cal, field, type, status)
; cal : void** -> "intptr"
; field : UCalendarDateFields -> "int"
; type : UCalendarLimitType -> "int"
; status : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucal_getLimit = icuin.NewProc("ucal_getLimit")
)

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