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