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

udatpg_addPattern

関数
生成器に日時パターンを追加し競合を返す。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

UDateTimePatternConflict udatpg_addPattern(
    void** dtpg,
    const WORD* pattern,
    INT patternLength,
    CHAR override,
    WORD* conflictingPattern,
    INT capacity,
    INT* pLength,
    UErrorCode* pErrorCode
);

パラメーター

名前方向説明
dtpgvoid**inout対象のUDateTimePatternGeneratorハンドル。
patternWORD*inジェネレータに追加登録する日付パターン文字列。UTF-16配列。
patternLengthINTinパターンの長さ(UTF-16単位)。-1でNUL終端として扱う。
overrideCHARin既存スケルトンと衝突した際に上書きするか示すブール値。
conflictingPatternWORD*inout衝突したパターンを受け取る出力バッファ。UTF-16配列。
capacityINTin衝突パターンバッファの容量(UTF-16単位)。
pLengthINT*inout衝突パターンの長さを受け取る出力先。
pErrorCodeUErrorCode*inoutICUのエラーコード。呼び出し前に成功値で初期化する。

戻り値の型: UDateTimePatternConflict

各言語での呼び出し定義

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

UDateTimePatternConflict udatpg_addPattern(
    void** dtpg,
    const WORD* pattern,
    INT patternLength,
    CHAR override,
    WORD* conflictingPattern,
    INT capacity,
    INT* pLength,
    UErrorCode* pErrorCode
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int udatpg_addPattern(
    IntPtr dtpg,   // void** in/out
    ref ushort pattern,   // WORD*
    int patternLength,   // INT
    sbyte override,   // CHAR
    ref ushort conflictingPattern,   // WORD* in/out
    int capacity,   // INT
    ref int pLength,   // INT* in/out
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function udatpg_addPattern(
    dtpg As IntPtr,   ' void** in/out
    ByRef pattern As UShort,   ' WORD*
    patternLength As Integer,   ' INT
    override As SByte,   ' CHAR
    ByRef conflictingPattern As UShort,   ' WORD* in/out
    capacity As Integer,   ' INT
    ByRef pLength As Integer,   ' INT* in/out
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Integer
End Function
' dtpg : void** in/out
' pattern : WORD*
' patternLength : INT
' override : CHAR
' conflictingPattern : WORD* in/out
' capacity : INT
' pLength : INT* in/out
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function udatpg_addPattern Lib "icuin" ( _
    ByVal dtpg As LongPtr, _
    ByRef pattern As Integer, _
    ByVal patternLength As Long, _
    ByVal override As Byte, _
    ByRef conflictingPattern As Integer, _
    ByVal capacity As Long, _
    ByRef pLength As Long, _
    ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

udatpg_addPattern = ctypes.cdll.icuin.udatpg_addPattern
udatpg_addPattern.restype = ctypes.c_int
udatpg_addPattern.argtypes = [
    ctypes.c_void_p,  # dtpg : void** in/out
    ctypes.POINTER(ctypes.c_ushort),  # pattern : WORD*
    ctypes.c_int,  # patternLength : INT
    ctypes.c_byte,  # override : CHAR
    ctypes.POINTER(ctypes.c_ushort),  # conflictingPattern : WORD* in/out
    ctypes.c_int,  # capacity : INT
    ctypes.POINTER(ctypes.c_int),  # pLength : INT* in/out
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
udatpg_addPattern = Fiddle::Function.new(
  lib['udatpg_addPattern'],
  [
    Fiddle::TYPE_VOIDP,  # dtpg : void** in/out
    Fiddle::TYPE_VOIDP,  # pattern : WORD*
    Fiddle::TYPE_INT,  # patternLength : INT
    Fiddle::TYPE_CHAR,  # override : CHAR
    Fiddle::TYPE_VOIDP,  # conflictingPattern : WORD* in/out
    Fiddle::TYPE_INT,  # capacity : INT
    Fiddle::TYPE_VOIDP,  # pLength : INT* in/out
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn udatpg_addPattern(
        dtpg: *mut *mut (),  // void** in/out
        pattern: *const u16,  // WORD*
        patternLength: i32,  // INT
        override: i8,  // CHAR
        conflictingPattern: *mut u16,  // WORD* in/out
        capacity: i32,  // INT
        pLength: *mut i32,  // INT* in/out
        pErrorCode: *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 udatpg_addPattern(IntPtr dtpg, ref ushort pattern, int patternLength, sbyte override, ref ushort conflictingPattern, int capacity, ref int pLength, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udatpg_addPattern' -Namespace Win32 -PassThru
# $api::udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode)
#uselib "icuin.dll"
#func global udatpg_addPattern "udatpg_addPattern" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; udatpg_addPattern dtpg, varptr(pattern), patternLength, override, varptr(conflictingPattern), capacity, varptr(pLength), varptr(pErrorCode)   ; 戻り値は stat
; dtpg : void** in/out -> "sptr"
; pattern : WORD* -> "sptr"
; patternLength : INT -> "sptr"
; override : CHAR -> "sptr"
; conflictingPattern : WORD* in/out -> "sptr"
; capacity : INT -> "sptr"
; pLength : INT* in/out -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuin.dll"
#cfunc global udatpg_addPattern "udatpg_addPattern" sptr, var, int, int, var, int, var, var
; res = udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode)
; dtpg : void** in/out -> "sptr"
; pattern : WORD* -> "var"
; patternLength : INT -> "int"
; override : CHAR -> "int"
; conflictingPattern : WORD* in/out -> "var"
; capacity : INT -> "int"
; pLength : INT* in/out -> "var"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; UDateTimePatternConflict udatpg_addPattern(void** dtpg, WORD* pattern, INT patternLength, CHAR override, WORD* conflictingPattern, INT capacity, INT* pLength, UErrorCode* pErrorCode)
#uselib "icuin.dll"
#cfunc global udatpg_addPattern "udatpg_addPattern" intptr, var, int, int, var, int, var, var
; res = udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode)
; dtpg : void** in/out -> "intptr"
; pattern : WORD* -> "var"
; patternLength : INT -> "int"
; override : CHAR -> "int"
; conflictingPattern : WORD* in/out -> "var"
; capacity : INT -> "int"
; pLength : INT* in/out -> "var"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procudatpg_addPattern = icuin.NewProc("udatpg_addPattern")
)

// dtpg (void** in/out), pattern (WORD*), patternLength (INT), override (CHAR), conflictingPattern (WORD* in/out), capacity (INT), pLength (INT* in/out), pErrorCode (UErrorCode* in/out)
r1, _, err := procudatpg_addPattern.Call(
	uintptr(dtpg),
	uintptr(pattern),
	uintptr(patternLength),
	uintptr(override),
	uintptr(conflictingPattern),
	uintptr(capacity),
	uintptr(pLength),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UDateTimePatternConflict
function udatpg_addPattern(
  dtpg: Pointer;   // void** in/out
  pattern: Pointer;   // WORD*
  patternLength: Integer;   // INT
  override: Shortint;   // CHAR
  conflictingPattern: Pointer;   // WORD* in/out
  capacity: Integer;   // INT
  pLength: Pointer;   // INT* in/out
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuin.dll' name 'udatpg_addPattern';
result := DllCall("icuin\udatpg_addPattern"
    , "Ptr", dtpg   ; void** in/out
    , "Ptr", pattern   ; WORD*
    , "Int", patternLength   ; INT
    , "Char", override   ; CHAR
    , "Ptr", conflictingPattern   ; WORD* in/out
    , "Int", capacity   ; INT
    , "Ptr", pLength   ; INT* in/out
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: UDateTimePatternConflict
●udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode) = DLL("icuin.dll", "int udatpg_addPattern(void*, void*, int, char, void*, int, void*, void*)")
# 呼び出し: udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode)
# dtpg : void** in/out -> "void*"
# pattern : WORD* -> "void*"
# patternLength : INT -> "int"
# override : CHAR -> "char"
# conflictingPattern : WORD* in/out -> "void*"
# capacity : INT -> "int"
# pLength : INT* in/out -> "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 udatpg_addPattern(
    dtpg: ?*anyopaque, // void** in/out
    pattern: [*c]u16, // WORD*
    patternLength: i32, // INT
    override: i8, // CHAR
    conflictingPattern: [*c]u16, // WORD* in/out
    capacity: i32, // INT
    pLength: [*c]i32, // INT* in/out
    pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;
proc udatpg_addPattern(
    dtpg: pointer,  # void** in/out
    pattern: ptr uint16,  # WORD*
    patternLength: int32,  # INT
    override: int8,  # CHAR
    conflictingPattern: ptr uint16,  # WORD* in/out
    capacity: int32,  # INT
    pLength: ptr int32,  # INT* in/out
    pErrorCode: ptr int32  # UErrorCode* in/out
): int32 {.importc: "udatpg_addPattern", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
int udatpg_addPattern(
    void** dtpg,   // void** in/out
    ushort* pattern,   // WORD*
    int patternLength,   // INT
    byte override,   // CHAR
    ushort* conflictingPattern,   // WORD* in/out
    int capacity,   // INT
    int* pLength,   // INT* in/out
    int* pErrorCode   // UErrorCode* in/out
);
ccall((:udatpg_addPattern, "icuin.dll"), Int32,
      (Ptr{Cvoid}, Ptr{UInt16}, Int32, Int8, Ptr{UInt16}, Int32, Ptr{Int32}, Ptr{Int32}),
      dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode)
# dtpg : void** in/out -> Ptr{Cvoid}
# pattern : WORD* -> Ptr{UInt16}
# patternLength : INT -> Int32
# override : CHAR -> Int8
# conflictingPattern : WORD* in/out -> Ptr{UInt16}
# capacity : INT -> Int32
# pLength : INT* in/out -> Ptr{Int32}
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
int32_t udatpg_addPattern(
    void** dtpg,
    uint16_t* pattern,
    int32_t patternLength,
    int8_t override,
    uint16_t* conflictingPattern,
    int32_t capacity,
    int32_t* pLength,
    int32_t* pErrorCode);
]]
local icuin = ffi.load("icuin")
-- icuin.udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode)
-- dtpg : void** in/out
-- pattern : WORD*
-- patternLength : INT
-- override : CHAR
-- conflictingPattern : WORD* in/out
-- capacity : INT
-- pLength : INT* in/out
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const udatpg_addPattern = lib.func('__cdecl', 'udatpg_addPattern', 'int32_t', ['void *', 'uint16_t *', 'int32_t', 'int8_t', 'uint16_t *', 'int32_t', 'int32_t *', 'int32_t *']);
// udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode)
// dtpg : void** in/out -> 'void *'
// pattern : WORD* -> 'uint16_t *'
// patternLength : INT -> 'int32_t'
// override : CHAR -> 'int8_t'
// conflictingPattern : WORD* in/out -> 'uint16_t *'
// capacity : INT -> 'int32_t'
// pLength : INT* in/out -> 'int32_t *'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  udatpg_addPattern: { parameters: ["pointer", "pointer", "i32", "i8", "pointer", "i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode)
// dtpg : void** in/out -> "pointer"
// pattern : WORD* -> "pointer"
// patternLength : INT -> "i32"
// override : CHAR -> "i8"
// conflictingPattern : WORD* in/out -> "pointer"
// capacity : INT -> "i32"
// pLength : INT* in/out -> "pointer"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t udatpg_addPattern(
    void** dtpg,
    uint16_t* pattern,
    int32_t patternLength,
    int8_t override,
    uint16_t* conflictingPattern,
    int32_t capacity,
    int32_t* pLength,
    int32_t* pErrorCode);
C, "icuin.dll");
// $ffi->udatpg_addPattern(dtpg, pattern, patternLength, override, conflictingPattern, capacity, pLength, pErrorCode);
// dtpg : void** in/out
// pattern : WORD*
// patternLength : INT
// override : CHAR
// conflictingPattern : WORD* in/out
// capacity : INT
// pLength : INT* in/out
// 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);
    int udatpg_addPattern(
        Pointer dtpg,   // void** in/out
        ShortByReference pattern,   // WORD*
        int patternLength,   // INT
        byte override,   // CHAR
        ShortByReference conflictingPattern,   // WORD* in/out
        int capacity,   // INT
        IntByReference pLength,   // INT* in/out
        IntByReference pErrorCode   // UErrorCode* in/out
    );
}
@[Link("icuin")]
lib Libicuin
  fun udatpg_addPattern = udatpg_addPattern(
    dtpg : Void**,   # void** in/out
    pattern : UInt16*,   # WORD*
    patternLength : Int32,   # INT
    override : Int8,   # CHAR
    conflictingPattern : UInt16*,   # WORD* in/out
    capacity : Int32,   # INT
    pLength : Int32*,   # INT* in/out
    pErrorCode : Int32*   # UErrorCode* in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef udatpg_addPatternNative = Int32 Function(Pointer<Void>, Pointer<Uint16>, Int32, Int8, Pointer<Uint16>, Int32, Pointer<Int32>, Pointer<Int32>);
typedef udatpg_addPatternDart = int Function(Pointer<Void>, Pointer<Uint16>, int, int, Pointer<Uint16>, int, Pointer<Int32>, Pointer<Int32>);
final udatpg_addPattern = DynamicLibrary.open('icuin.dll')
    .lookupFunction<udatpg_addPatternNative, udatpg_addPatternDart>('udatpg_addPattern');
// dtpg : void** in/out -> Pointer<Void>
// pattern : WORD* -> Pointer<Uint16>
// patternLength : INT -> Int32
// override : CHAR -> Int8
// conflictingPattern : WORD* in/out -> Pointer<Uint16>
// capacity : INT -> Int32
// pLength : INT* in/out -> Pointer<Int32>
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function udatpg_addPattern(
  dtpg: Pointer;   // void** in/out
  pattern: Pointer;   // WORD*
  patternLength: Integer;   // INT
  override: Shortint;   // CHAR
  conflictingPattern: Pointer;   // WORD* in/out
  capacity: Integer;   // INT
  pLength: Pointer;   // INT* in/out
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuin.dll' name 'udatpg_addPattern';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "udatpg_addPattern"
  c_udatpg_addPattern :: Ptr () -> Ptr Word16 -> Int32 -> Int8 -> Ptr Word16 -> Int32 -> Ptr Int32 -> Ptr Int32 -> IO Int32
-- dtpg : void** in/out -> Ptr ()
-- pattern : WORD* -> Ptr Word16
-- patternLength : INT -> Int32
-- override : CHAR -> Int8
-- conflictingPattern : WORD* in/out -> Ptr Word16
-- capacity : INT -> Int32
-- pLength : INT* in/out -> Ptr Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let udatpg_addpattern =
  foreign "udatpg_addPattern"
    ((ptr void) @-> (ptr uint16_t) @-> int32_t @-> int8_t @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> (ptr int32_t) @-> returning int32_t)
(* dtpg : void** in/out -> (ptr void) *)
(* pattern : WORD* -> (ptr uint16_t) *)
(* patternLength : INT -> int32_t *)
(* override : CHAR -> int8_t *)
(* conflictingPattern : WORD* in/out -> (ptr uint16_t) *)
(* capacity : INT -> int32_t *)
(* pLength : INT* in/out -> (ptr int32_t) *)
(* 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 ("udatpg_addPattern" udatpg-add-pattern :convention :cdecl) :int32
  (dtpg :pointer)   ; void** in/out
  (pattern :pointer)   ; WORD*
  (pattern-length :int32)   ; INT
  (override :int8)   ; CHAR
  (conflicting-pattern :pointer)   ; WORD* in/out
  (capacity :int32)   ; INT
  (p-length :pointer)   ; INT* in/out
  (p-error-code :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $udatpg_addPattern = Win32::API::More->new('icuin',
    'int udatpg_addPattern(LPVOID dtpg, LPVOID pattern, int patternLength, char override, LPVOID conflictingPattern, int capacity, LPVOID pLength, LPVOID pErrorCode)');
# my $ret = $udatpg_addPattern->Call($dtpg, $pattern, $patternLength, $override, $conflictingPattern, $capacity, $pLength, $pErrorCode);
# dtpg : void** in/out -> LPVOID
# pattern : WORD* -> LPVOID
# patternLength : INT -> int
# override : CHAR -> char
# conflictingPattern : WORD* in/out -> LPVOID
# capacity : INT -> int
# pLength : INT* in/out -> LPVOID
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型