ホーム › Globalization › ucal_getAttribute
ucal_getAttribute
関数カレンダーの属性値を取得する。
シグネチャ
// icuin.dll
#include <windows.h>
INT ucal_getAttribute(
const void** cal,
UCalendarAttribute attr
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| cal | void** | in | 属性値を取得する対象の暦ハンドルを指す。 |
| attr | UCalendarAttribute | in | 取得する属性を示すUCalendarAttribute列挙値。 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT ucal_getAttribute(
const void** cal,
UCalendarAttribute attr
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucal_getAttribute(
IntPtr cal, // void**
int attr // UCalendarAttribute
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucal_getAttribute(
cal As IntPtr, ' void**
attr As Integer ' UCalendarAttribute
) As Integer
End Function' cal : void**
' attr : UCalendarAttribute
Declare PtrSafe Function ucal_getAttribute Lib "icuin" ( _
ByVal cal As LongPtr, _
ByVal attr As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucal_getAttribute = ctypes.cdll.icuin.ucal_getAttribute
ucal_getAttribute.restype = ctypes.c_int
ucal_getAttribute.argtypes = [
ctypes.c_void_p, # cal : void**
ctypes.c_int, # attr : UCalendarAttribute
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucal_getAttribute = Fiddle::Function.new(
lib['ucal_getAttribute'],
[
Fiddle::TYPE_VOIDP, # cal : void**
Fiddle::TYPE_INT, # attr : UCalendarAttribute
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucal_getAttribute(
cal: *const *const (), // void**
attr: i32 // UCalendarAttribute
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ucal_getAttribute(IntPtr cal, int attr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucal_getAttribute' -Namespace Win32 -PassThru
# $api::ucal_getAttribute(cal, attr)#uselib "icuin.dll"
#func global ucal_getAttribute "ucal_getAttribute" sptr, sptr
; ucal_getAttribute cal, attr ; 戻り値は stat
; cal : void** -> "sptr"
; attr : UCalendarAttribute -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuin.dll"
#cfunc global ucal_getAttribute "ucal_getAttribute" sptr, int
; res = ucal_getAttribute(cal, attr)
; cal : void** -> "sptr"
; attr : UCalendarAttribute -> "int"; INT ucal_getAttribute(void** cal, UCalendarAttribute attr)
#uselib "icuin.dll"
#cfunc global ucal_getAttribute "ucal_getAttribute" intptr, int
; res = ucal_getAttribute(cal, attr)
; cal : void** -> "intptr"
; attr : UCalendarAttribute -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucal_getAttribute = icuin.NewProc("ucal_getAttribute")
)
// cal (void**), attr (UCalendarAttribute)
r1, _, err := procucal_getAttribute.Call(
uintptr(cal),
uintptr(attr),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ucal_getAttribute(
cal: Pointer; // void**
attr: Integer // UCalendarAttribute
): Integer; cdecl;
external 'icuin.dll' name 'ucal_getAttribute';result := DllCall("icuin\ucal_getAttribute"
, "Ptr", cal ; void**
, "Int", attr ; UCalendarAttribute
, "Cdecl Int") ; return: INT●ucal_getAttribute(cal, attr) = DLL("icuin.dll", "int ucal_getAttribute(void*, int)")
# 呼び出し: ucal_getAttribute(cal, attr)
# cal : void** -> "void*"
# attr : UCalendarAttribute -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuin" fn ucal_getAttribute(
cal: ?*anyopaque, // void**
attr: i32 // UCalendarAttribute
) callconv(.c) i32;proc ucal_getAttribute(
cal: pointer, # void**
attr: int32 # UCalendarAttribute
): int32 {.importc: "ucal_getAttribute", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
int ucal_getAttribute(
void** cal, // void**
int attr // UCalendarAttribute
);ccall((:ucal_getAttribute, "icuin.dll"), Int32,
(Ptr{Cvoid}, Int32),
cal, attr)
# cal : void** -> Ptr{Cvoid}
# attr : UCalendarAttribute -> Int32local ffi = require("ffi")
ffi.cdef[[
int32_t ucal_getAttribute(
void** cal,
int32_t attr);
]]
local icuin = ffi.load("icuin")
-- icuin.ucal_getAttribute(cal, attr)
-- cal : void**
-- attr : UCalendarAttribute
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const ucal_getAttribute = lib.func('__cdecl', 'ucal_getAttribute', 'int32_t', ['void *', 'int32_t']);
// ucal_getAttribute(cal, attr)
// cal : void** -> 'void *'
// attr : UCalendarAttribute -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
ucal_getAttribute: { parameters: ["pointer", "i32"], result: "i32" },
});
// lib.symbols.ucal_getAttribute(cal, attr)
// cal : void** -> "pointer"
// attr : UCalendarAttribute -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ucal_getAttribute(
void** cal,
int32_t attr);
C, "icuin.dll");
// $ffi->ucal_getAttribute(cal, attr);
// cal : void**
// attr : UCalendarAttribute
// 構造体/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);
int ucal_getAttribute(
Pointer cal, // void**
int attr // UCalendarAttribute
);
}@[Link("icuin")]
lib Libicuin
fun ucal_getAttribute = ucal_getAttribute(
cal : Void**, # void**
attr : Int32 # UCalendarAttribute
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucal_getAttributeNative = Int32 Function(Pointer<Void>, Int32);
typedef ucal_getAttributeDart = int Function(Pointer<Void>, int);
final ucal_getAttribute = DynamicLibrary.open('icuin.dll')
.lookupFunction<ucal_getAttributeNative, ucal_getAttributeDart>('ucal_getAttribute');
// cal : void** -> Pointer<Void>
// attr : UCalendarAttribute -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ucal_getAttribute(
cal: Pointer; // void**
attr: Integer // UCalendarAttribute
): Integer; cdecl;
external 'icuin.dll' name 'ucal_getAttribute';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucal_getAttribute"
c_ucal_getAttribute :: Ptr () -> Int32 -> IO Int32
-- cal : void** -> Ptr ()
-- attr : UCalendarAttribute -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucal_getattribute =
foreign "ucal_getAttribute"
((ptr void) @-> int32_t @-> returning int32_t)
(* cal : void** -> (ptr void) *)
(* attr : UCalendarAttribute -> 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_getAttribute" ucal-get-attribute :convention :cdecl) :int32
(cal :pointer) ; void**
(attr :int32)) ; UCalendarAttribute
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucal_getAttribute = Win32::API::More->new('icuin',
'int ucal_getAttribute(LPVOID cal, int attr)');
# my $ret = $ucal_getAttribute->Call($cal, $attr);
# cal : void** -> LPVOID
# attr : UCalendarAttribute -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型