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

udatpg_getPatternForSkeleton

関数
指定スケルトンに対応する登録済みパターンを取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

WORD* udatpg_getPatternForSkeleton(
    const void** dtpg,
    const WORD* skeleton,
    INT skeletonLength,
    INT* pLength
);

パラメーター

名前方向説明
dtpgvoid**in対象のUDateTimePatternGeneratorハンドル。
skeletonWORD*in対応パターンを引くスケルトン文字列。UTF-16配列で指定する。
skeletonLengthINTinスケルトンの長さ(UTF-16単位)。-1でNUL終端として扱う。
pLengthINT*inout返されるパターン文字列の長さを受け取る出力先。

戻り値の型: WORD*

各言語での呼び出し定義

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

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

udatpg_getPatternForSkeleton = ctypes.cdll.icuin.udatpg_getPatternForSkeleton
udatpg_getPatternForSkeleton.restype = ctypes.c_void_p
udatpg_getPatternForSkeleton.argtypes = [
    ctypes.c_void_p,  # dtpg : void**
    ctypes.POINTER(ctypes.c_ushort),  # skeleton : WORD*
    ctypes.c_int,  # skeletonLength : INT
    ctypes.POINTER(ctypes.c_int),  # pLength : INT* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
udatpg_getPatternForSkeleton = Fiddle::Function.new(
  lib['udatpg_getPatternForSkeleton'],
  [
    Fiddle::TYPE_VOIDP,  # dtpg : void**
    Fiddle::TYPE_VOIDP,  # skeleton : WORD*
    Fiddle::TYPE_INT,  # skeletonLength : INT
    Fiddle::TYPE_VOIDP,  # pLength : INT* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn udatpg_getPatternForSkeleton(
        dtpg: *const *const (),  // void**
        skeleton: *const u16,  // WORD*
        skeletonLength: i32,  // INT
        pLength: *mut i32  // INT* in/out
    ) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr udatpg_getPatternForSkeleton(IntPtr dtpg, ref ushort skeleton, int skeletonLength, ref int pLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udatpg_getPatternForSkeleton' -Namespace Win32 -PassThru
# $api::udatpg_getPatternForSkeleton(dtpg, skeleton, skeletonLength, pLength)
#uselib "icuin.dll"
#func global udatpg_getPatternForSkeleton "udatpg_getPatternForSkeleton" sptr, sptr, sptr, sptr
; udatpg_getPatternForSkeleton dtpg, varptr(skeleton), skeletonLength, varptr(pLength)   ; 戻り値は stat
; dtpg : void** -> "sptr"
; skeleton : WORD* -> "sptr"
; skeletonLength : INT -> "sptr"
; pLength : INT* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuin.dll"
#cfunc global udatpg_getPatternForSkeleton "udatpg_getPatternForSkeleton" sptr, var, int, var
; res = udatpg_getPatternForSkeleton(dtpg, skeleton, skeletonLength, pLength)
; dtpg : void** -> "sptr"
; skeleton : WORD* -> "var"
; skeletonLength : INT -> "int"
; pLength : INT* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; WORD* udatpg_getPatternForSkeleton(void** dtpg, WORD* skeleton, INT skeletonLength, INT* pLength)
#uselib "icuin.dll"
#cfunc global udatpg_getPatternForSkeleton "udatpg_getPatternForSkeleton" intptr, var, int, var
; res = udatpg_getPatternForSkeleton(dtpg, skeleton, skeletonLength, pLength)
; dtpg : void** -> "intptr"
; skeleton : WORD* -> "var"
; skeletonLength : INT -> "int"
; pLength : INT* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procudatpg_getPatternForSkeleton = icuin.NewProc("udatpg_getPatternForSkeleton")
)

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

typedef udatpg_getPatternForSkeletonNative = Pointer<Uint16> Function(Pointer<Void>, Pointer<Uint16>, Int32, Pointer<Int32>);
typedef udatpg_getPatternForSkeletonDart = Pointer<Uint16> Function(Pointer<Void>, Pointer<Uint16>, int, Pointer<Int32>);
final udatpg_getPatternForSkeleton = DynamicLibrary.open('icuin.dll')
    .lookupFunction<udatpg_getPatternForSkeletonNative, udatpg_getPatternForSkeletonDart>('udatpg_getPatternForSkeleton');
// dtpg : void** -> Pointer<Void>
// skeleton : WORD* -> Pointer<Uint16>
// skeletonLength : INT -> Int32
// pLength : INT* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function udatpg_getPatternForSkeleton(
  dtpg: Pointer;   // void**
  skeleton: Pointer;   // WORD*
  skeletonLength: Integer;   // INT
  pLength: Pointer   // INT* in/out
): Pointer; cdecl;
  external 'icuin.dll' name 'udatpg_getPatternForSkeleton';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "udatpg_getPatternForSkeleton"
  c_udatpg_getPatternForSkeleton :: Ptr () -> Ptr Word16 -> Int32 -> Ptr Int32 -> IO (Ptr Word16)
-- dtpg : void** -> Ptr ()
-- skeleton : WORD* -> Ptr Word16
-- skeletonLength : INT -> Int32
-- pLength : INT* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let udatpg_getpatternforskeleton =
  foreign "udatpg_getPatternForSkeleton"
    ((ptr void) @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning (ptr uint16_t))
(* dtpg : void** -> (ptr void) *)
(* skeleton : WORD* -> (ptr uint16_t) *)
(* skeletonLength : INT -> int32_t *)
(* pLength : INT* 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_getPatternForSkeleton" udatpg-get-pattern-for-skeleton :convention :cdecl) :pointer
  (dtpg :pointer)   ; void**
  (skeleton :pointer)   ; WORD*
  (skeleton-length :int32)   ; INT
  (p-length :pointer))   ; INT* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $udatpg_getPatternForSkeleton = Win32::API::More->new('icuin',
    'LPVOID udatpg_getPatternForSkeleton(LPVOID dtpg, LPVOID skeleton, int skeletonLength, LPVOID pLength)');
# my $ret = $udatpg_getPatternForSkeleton->Call($dtpg, $skeleton, $skeletonLength, $pLength);
# dtpg : void** -> LPVOID
# skeleton : WORD* -> LPVOID
# skeletonLength : INT -> int
# pLength : INT* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。