ホーム › Globalization › ucal_getGregorianChange
ucal_getGregorianChange
関数グレゴリオ暦への切替日を取得する。
シグネチャ
// icuin.dll
#include <windows.h>
DOUBLE ucal_getGregorianChange(
const void** cal,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| cal | void** | in | グレゴリオ暦切替日を取得する対象の暦ハンドルを指す。 |
| pErrorCode | UErrorCode* | inout | ICUエラーコードを入出力するポインタ。呼出前に成功値で初期化する。 |
戻り値の型: DOUBLE
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
DOUBLE ucal_getGregorianChange(
const void** cal,
UErrorCode* pErrorCode
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern double ucal_getGregorianChange(
IntPtr cal, // void**
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucal_getGregorianChange(
cal As IntPtr, ' void**
ByRef pErrorCode As Integer ' UErrorCode* in/out
) As Double
End Function' cal : void**
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function ucal_getGregorianChange Lib "icuin" ( _
ByVal cal As LongPtr, _
ByRef pErrorCode As Long) As Double
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucal_getGregorianChange = ctypes.cdll.icuin.ucal_getGregorianChange
ucal_getGregorianChange.restype = ctypes.c_double
ucal_getGregorianChange.argtypes = [
ctypes.c_void_p, # cal : void**
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucal_getGregorianChange = Fiddle::Function.new(
lib['ucal_getGregorianChange'],
[
Fiddle::TYPE_VOIDP, # cal : void**
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_DOUBLE, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucal_getGregorianChange(
cal: *const *const (), // void**
pErrorCode: *mut i32 // UErrorCode* in/out
) -> f64;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern double ucal_getGregorianChange(IntPtr cal, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucal_getGregorianChange' -Namespace Win32 -PassThru
# $api::ucal_getGregorianChange(cal, pErrorCode)#uselib "icuin.dll"
#func global ucal_getGregorianChange "ucal_getGregorianChange" sptr, sptr
; ucal_getGregorianChange cal, varptr(pErrorCode) ; 戻り値は stat
; cal : void** -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global ucal_getGregorianChange "ucal_getGregorianChange" sptr, var ; res = ucal_getGregorianChange(cal, pErrorCode) ; cal : void** -> "sptr" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global ucal_getGregorianChange "ucal_getGregorianChange" sptr, sptr ; res = ucal_getGregorianChange(cal, varptr(pErrorCode)) ; cal : void** -> "sptr" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DOUBLE ucal_getGregorianChange(void** cal, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global ucal_getGregorianChange "ucal_getGregorianChange" intptr, var ; res = ucal_getGregorianChange(cal, pErrorCode) ; cal : void** -> "intptr" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DOUBLE ucal_getGregorianChange(void** cal, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global ucal_getGregorianChange "ucal_getGregorianChange" intptr, intptr ; res = ucal_getGregorianChange(cal, varptr(pErrorCode)) ; cal : void** -> "intptr" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucal_getGregorianChange = icuin.NewProc("ucal_getGregorianChange")
)
// cal (void**), pErrorCode (UErrorCode* in/out)
r1, _, err := procucal_getGregorianChange.Call(
uintptr(cal),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DOUBLEfunction ucal_getGregorianChange(
cal: Pointer; // void**
pErrorCode: Pointer // UErrorCode* in/out
): Double; cdecl;
external 'icuin.dll' name 'ucal_getGregorianChange';result := DllCall("icuin\ucal_getGregorianChange"
, "Ptr", cal ; void**
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Double") ; return: DOUBLE●ucal_getGregorianChange(cal, pErrorCode) = DLL("icuin.dll", "double ucal_getGregorianChange(void*, void*)")
# 呼び出し: ucal_getGregorianChange(cal, pErrorCode)
# cal : void** -> "void*"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuin" fn ucal_getGregorianChange(
cal: ?*anyopaque, // void**
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) f64;proc ucal_getGregorianChange(
cal: pointer, # void**
pErrorCode: ptr int32 # UErrorCode* in/out
): float64 {.importc: "ucal_getGregorianChange", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
double ucal_getGregorianChange(
void** cal, // void**
int* pErrorCode // UErrorCode* in/out
);ccall((:ucal_getGregorianChange, "icuin.dll"), Float64,
(Ptr{Cvoid}, Ptr{Int32}),
cal, pErrorCode)
# cal : void** -> Ptr{Cvoid}
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
double ucal_getGregorianChange(
void** cal,
int32_t* pErrorCode);
]]
local icuin = ffi.load("icuin")
-- icuin.ucal_getGregorianChange(cal, pErrorCode)
-- cal : void**
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const ucal_getGregorianChange = lib.func('__cdecl', 'ucal_getGregorianChange', 'double', ['void *', 'int32_t *']);
// ucal_getGregorianChange(cal, pErrorCode)
// cal : void** -> 'void *'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
ucal_getGregorianChange: { parameters: ["pointer", "pointer"], result: "f64" },
});
// lib.symbols.ucal_getGregorianChange(cal, pErrorCode)
// cal : void** -> "pointer"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
double ucal_getGregorianChange(
void** cal,
int32_t* pErrorCode);
C, "icuin.dll");
// $ffi->ucal_getGregorianChange(cal, pErrorCode);
// cal : void**
// pErrorCode : UErrorCode* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Icuin extends Library {
Icuin INSTANCE = Native.load("icuin", Icuin.class);
double ucal_getGregorianChange(
Pointer cal, // void**
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun ucal_getGregorianChange = ucal_getGregorianChange(
cal : Void**, # void**
pErrorCode : Int32* # UErrorCode* in/out
) : Float64
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucal_getGregorianChangeNative = Double Function(Pointer<Void>, Pointer<Int32>);
typedef ucal_getGregorianChangeDart = double Function(Pointer<Void>, Pointer<Int32>);
final ucal_getGregorianChange = DynamicLibrary.open('icuin.dll')
.lookupFunction<ucal_getGregorianChangeNative, ucal_getGregorianChangeDart>('ucal_getGregorianChange');
// cal : void** -> Pointer<Void>
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ucal_getGregorianChange(
cal: Pointer; // void**
pErrorCode: Pointer // UErrorCode* in/out
): Double; cdecl;
external 'icuin.dll' name 'ucal_getGregorianChange';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucal_getGregorianChange"
c_ucal_getGregorianChange :: Ptr () -> Ptr Int32 -> IO CDouble
-- cal : void** -> Ptr ()
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucal_getgregorianchange =
foreign "ucal_getGregorianChange"
((ptr void) @-> (ptr int32_t) @-> returning double)
(* cal : void** -> (ptr void) *)
(* pErrorCode : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("ucal_getGregorianChange" ucal-get-gregorian-change :convention :cdecl) :double
(cal :pointer) ; void**
(p-error-code :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucal_getGregorianChange = Win32::API::More->new('icuin',
'double ucal_getGregorianChange(LPVOID cal, LPVOID pErrorCode)');
# my $ret = $ucal_getGregorianChange->Call($cal, $pErrorCode);
# cal : void** -> LPVOID
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型