ホーム › Globalization › udat_formatCalendar
udat_formatCalendar
関数暦オブジェクトの日付を文字列に整形する。
シグネチャ
// icuin.dll
#include <windows.h>
INT udat_formatCalendar(
const void** format,
void** calendar,
WORD* result,
INT capacity,
UFieldPosition* position,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| format | void** | in |
| calendar | void** | inout |
| result | WORD* | inout |
| capacity | INT | in |
| position | UFieldPosition* | inout |
| status | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT udat_formatCalendar(
const void** format,
void** calendar,
WORD* result,
INT capacity,
UFieldPosition* position,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int udat_formatCalendar(
IntPtr format, // void**
IntPtr calendar, // void** in/out
ref ushort result, // WORD* in/out
int capacity, // INT
IntPtr position, // UFieldPosition* in/out
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function udat_formatCalendar(
format As IntPtr, ' void**
calendar As IntPtr, ' void** in/out
ByRef result As UShort, ' WORD* in/out
capacity As Integer, ' INT
position As IntPtr, ' UFieldPosition* in/out
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' format : void**
' calendar : void** in/out
' result : WORD* in/out
' capacity : INT
' position : UFieldPosition* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function udat_formatCalendar Lib "icuin" ( _
ByVal format As LongPtr, _
ByVal calendar As LongPtr, _
ByRef result As Integer, _
ByVal capacity As Long, _
ByVal position As LongPtr, _
ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
udat_formatCalendar = ctypes.cdll.icuin.udat_formatCalendar
udat_formatCalendar.restype = ctypes.c_int
udat_formatCalendar.argtypes = [
ctypes.c_void_p, # format : void**
ctypes.c_void_p, # calendar : void** in/out
ctypes.POINTER(ctypes.c_ushort), # result : WORD* in/out
ctypes.c_int, # capacity : INT
ctypes.c_void_p, # position : UFieldPosition* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
udat_formatCalendar = Fiddle::Function.new(
lib['udat_formatCalendar'],
[
Fiddle::TYPE_VOIDP, # format : void**
Fiddle::TYPE_VOIDP, # calendar : void** in/out
Fiddle::TYPE_VOIDP, # result : WORD* in/out
Fiddle::TYPE_INT, # capacity : INT
Fiddle::TYPE_VOIDP, # position : UFieldPosition* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn udat_formatCalendar(
format: *const *const (), // void**
calendar: *mut *mut (), // void** in/out
result: *mut u16, // WORD* in/out
capacity: i32, // INT
position: *mut UFieldPosition, // UFieldPosition* in/out
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 udat_formatCalendar(IntPtr format, IntPtr calendar, ref ushort result, int capacity, IntPtr position, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udat_formatCalendar' -Namespace Win32 -PassThru
# $api::udat_formatCalendar(format, calendar, result, capacity, position, status)#uselib "icuin.dll"
#func global udat_formatCalendar "udat_formatCalendar" sptr, sptr, sptr, sptr, sptr, sptr
; udat_formatCalendar format, calendar, varptr(result), capacity, varptr(position), status ; 戻り値は stat
; format : void** -> "sptr"
; calendar : void** in/out -> "sptr"
; result : WORD* in/out -> "sptr"
; capacity : INT -> "sptr"
; position : UFieldPosition* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global udat_formatCalendar "udat_formatCalendar" sptr, sptr, var, int, var, int ; res = udat_formatCalendar(format, calendar, result, capacity, position, status) ; format : void** -> "sptr" ; calendar : void** in/out -> "sptr" ; result : WORD* in/out -> "var" ; capacity : INT -> "int" ; position : UFieldPosition* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global udat_formatCalendar "udat_formatCalendar" sptr, sptr, sptr, int, sptr, int ; res = udat_formatCalendar(format, calendar, varptr(result), capacity, varptr(position), status) ; format : void** -> "sptr" ; calendar : void** in/out -> "sptr" ; result : WORD* in/out -> "sptr" ; capacity : INT -> "int" ; position : UFieldPosition* in/out -> "sptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT udat_formatCalendar(void** format, void** calendar, WORD* result, INT capacity, UFieldPosition* position, UErrorCode* status) #uselib "icuin.dll" #cfunc global udat_formatCalendar "udat_formatCalendar" intptr, intptr, var, int, var, int ; res = udat_formatCalendar(format, calendar, result, capacity, position, status) ; format : void** -> "intptr" ; calendar : void** in/out -> "intptr" ; result : WORD* in/out -> "var" ; capacity : INT -> "int" ; position : UFieldPosition* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT udat_formatCalendar(void** format, void** calendar, WORD* result, INT capacity, UFieldPosition* position, UErrorCode* status) #uselib "icuin.dll" #cfunc global udat_formatCalendar "udat_formatCalendar" intptr, intptr, intptr, int, intptr, int ; res = udat_formatCalendar(format, calendar, varptr(result), capacity, varptr(position), status) ; format : void** -> "intptr" ; calendar : void** in/out -> "intptr" ; result : WORD* in/out -> "intptr" ; capacity : INT -> "int" ; position : UFieldPosition* in/out -> "intptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procudat_formatCalendar = icuin.NewProc("udat_formatCalendar")
)
// format (void**), calendar (void** in/out), result (WORD* in/out), capacity (INT), position (UFieldPosition* in/out), status (UErrorCode* in/out)
r1, _, err := procudat_formatCalendar.Call(
uintptr(format),
uintptr(calendar),
uintptr(result),
uintptr(capacity),
uintptr(position),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction udat_formatCalendar(
format: Pointer; // void**
calendar: Pointer; // void** in/out
result: Pointer; // WORD* in/out
capacity: Integer; // INT
position: Pointer; // UFieldPosition* in/out
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'udat_formatCalendar';result := DllCall("icuin\udat_formatCalendar"
, "Ptr", format ; void**
, "Ptr", calendar ; void** in/out
, "Ptr", result ; WORD* in/out
, "Int", capacity ; INT
, "Ptr", position ; UFieldPosition* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●udat_formatCalendar(format, calendar, result, capacity, position, status) = DLL("icuin.dll", "int udat_formatCalendar(void*, void*, void*, int, void*, void*)")
# 呼び出し: udat_formatCalendar(format, calendar, result, capacity, position, status)
# format : void** -> "void*"
# calendar : void** in/out -> "void*"
# result : WORD* in/out -> "void*"
# capacity : INT -> "int"
# position : UFieldPosition* in/out -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。