ホーム › Globalization › udatpg_getBaseSkeleton
udatpg_getBaseSkeleton
関数日時パターンから基本スケルトンを取得する。
シグネチャ
// icuin.dll
#include <windows.h>
INT udatpg_getBaseSkeleton(
void** unusedDtpg,
const WORD* pattern,
INT length,
WORD* baseSkeleton,
INT capacity,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| unusedDtpg | void** | inout | 互換のため残るジェネレータハンドル。現行では未使用でNULL可。 |
| pattern | WORD* | in | 基本スケルトンを抽出する元の日付パターン文字列。UTF-16配列。 |
| length | INT | in | パターンの長さ(UTF-16単位)。-1でNUL終端として扱う。 |
| baseSkeleton | WORD* | inout | 幅情報を除いた基本スケルトンを受け取る出力バッファ。UTF-16配列。 |
| capacity | INT | in | 出力バッファの容量(UTF-16単位)。0で必要長の照会も可能。 |
| pErrorCode | UErrorCode* | inout | ICUのエラーコード。呼び出し前に成功値で初期化する。 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT udatpg_getBaseSkeleton(
void** unusedDtpg,
const WORD* pattern,
INT length,
WORD* baseSkeleton,
INT capacity,
UErrorCode* pErrorCode
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int udatpg_getBaseSkeleton(
IntPtr unusedDtpg, // void** in/out
ref ushort pattern, // WORD*
int length, // INT
ref ushort baseSkeleton, // WORD* in/out
int capacity, // INT
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function udatpg_getBaseSkeleton(
unusedDtpg As IntPtr, ' void** in/out
ByRef pattern As UShort, ' WORD*
length As Integer, ' INT
ByRef baseSkeleton As UShort, ' WORD* in/out
capacity As Integer, ' INT
ByRef pErrorCode As Integer ' UErrorCode* in/out
) As Integer
End Function' unusedDtpg : void** in/out
' pattern : WORD*
' length : INT
' baseSkeleton : WORD* in/out
' capacity : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function udatpg_getBaseSkeleton Lib "icuin" ( _
ByVal unusedDtpg As LongPtr, _
ByRef pattern As Integer, _
ByVal length As Long, _
ByRef baseSkeleton As Integer, _
ByVal capacity 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_getBaseSkeleton = ctypes.cdll.icuin.udatpg_getBaseSkeleton
udatpg_getBaseSkeleton.restype = ctypes.c_int
udatpg_getBaseSkeleton.argtypes = [
ctypes.c_void_p, # unusedDtpg : void** in/out
ctypes.POINTER(ctypes.c_ushort), # pattern : WORD*
ctypes.c_int, # length : INT
ctypes.POINTER(ctypes.c_ushort), # baseSkeleton : WORD* in/out
ctypes.c_int, # capacity : INT
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
udatpg_getBaseSkeleton = Fiddle::Function.new(
lib['udatpg_getBaseSkeleton'],
[
Fiddle::TYPE_VOIDP, # unusedDtpg : void** in/out
Fiddle::TYPE_VOIDP, # pattern : WORD*
Fiddle::TYPE_INT, # length : INT
Fiddle::TYPE_VOIDP, # baseSkeleton : WORD* in/out
Fiddle::TYPE_INT, # capacity : INT
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn udatpg_getBaseSkeleton(
unusedDtpg: *mut *mut (), // void** in/out
pattern: *const u16, // WORD*
length: i32, // INT
baseSkeleton: *mut u16, // WORD* in/out
capacity: i32, // INT
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_getBaseSkeleton(IntPtr unusedDtpg, ref ushort pattern, int length, ref ushort baseSkeleton, int capacity, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udatpg_getBaseSkeleton' -Namespace Win32 -PassThru
# $api::udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode)#uselib "icuin.dll"
#func global udatpg_getBaseSkeleton "udatpg_getBaseSkeleton" sptr, sptr, sptr, sptr, sptr, sptr
; udatpg_getBaseSkeleton unusedDtpg, varptr(pattern), length, varptr(baseSkeleton), capacity, varptr(pErrorCode) ; 戻り値は stat
; unusedDtpg : void** in/out -> "sptr"
; pattern : WORD* -> "sptr"
; length : INT -> "sptr"
; baseSkeleton : WORD* in/out -> "sptr"
; capacity : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global udatpg_getBaseSkeleton "udatpg_getBaseSkeleton" sptr, var, int, var, int, var ; res = udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode) ; unusedDtpg : void** in/out -> "sptr" ; pattern : WORD* -> "var" ; length : INT -> "int" ; baseSkeleton : WORD* in/out -> "var" ; capacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global udatpg_getBaseSkeleton "udatpg_getBaseSkeleton" sptr, sptr, int, sptr, int, sptr ; res = udatpg_getBaseSkeleton(unusedDtpg, varptr(pattern), length, varptr(baseSkeleton), capacity, varptr(pErrorCode)) ; unusedDtpg : void** in/out -> "sptr" ; pattern : WORD* -> "sptr" ; length : INT -> "int" ; baseSkeleton : WORD* in/out -> "sptr" ; capacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT udatpg_getBaseSkeleton(void** unusedDtpg, WORD* pattern, INT length, WORD* baseSkeleton, INT capacity, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global udatpg_getBaseSkeleton "udatpg_getBaseSkeleton" intptr, var, int, var, int, var ; res = udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode) ; unusedDtpg : void** in/out -> "intptr" ; pattern : WORD* -> "var" ; length : INT -> "int" ; baseSkeleton : WORD* in/out -> "var" ; capacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT udatpg_getBaseSkeleton(void** unusedDtpg, WORD* pattern, INT length, WORD* baseSkeleton, INT capacity, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global udatpg_getBaseSkeleton "udatpg_getBaseSkeleton" intptr, intptr, int, intptr, int, intptr ; res = udatpg_getBaseSkeleton(unusedDtpg, varptr(pattern), length, varptr(baseSkeleton), capacity, varptr(pErrorCode)) ; unusedDtpg : void** in/out -> "intptr" ; pattern : WORD* -> "intptr" ; length : INT -> "int" ; baseSkeleton : WORD* in/out -> "intptr" ; capacity : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procudatpg_getBaseSkeleton = icuin.NewProc("udatpg_getBaseSkeleton")
)
// unusedDtpg (void** in/out), pattern (WORD*), length (INT), baseSkeleton (WORD* in/out), capacity (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := procudatpg_getBaseSkeleton.Call(
uintptr(unusedDtpg),
uintptr(pattern),
uintptr(length),
uintptr(baseSkeleton),
uintptr(capacity),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction udatpg_getBaseSkeleton(
unusedDtpg: Pointer; // void** in/out
pattern: Pointer; // WORD*
length: Integer; // INT
baseSkeleton: Pointer; // WORD* in/out
capacity: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'udatpg_getBaseSkeleton';result := DllCall("icuin\udatpg_getBaseSkeleton"
, "Ptr", unusedDtpg ; void** in/out
, "Ptr", pattern ; WORD*
, "Int", length ; INT
, "Ptr", baseSkeleton ; WORD* in/out
, "Int", capacity ; INT
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode) = DLL("icuin.dll", "int udatpg_getBaseSkeleton(void*, void*, int, void*, int, void*)")
# 呼び出し: udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode)
# unusedDtpg : void** in/out -> "void*"
# pattern : WORD* -> "void*"
# length : INT -> "int"
# baseSkeleton : WORD* in/out -> "void*"
# capacity : INT -> "int"
# 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_getBaseSkeleton(
unusedDtpg: ?*anyopaque, // void** in/out
pattern: [*c]u16, // WORD*
length: i32, // INT
baseSkeleton: [*c]u16, // WORD* in/out
capacity: i32, // INT
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc udatpg_getBaseSkeleton(
unusedDtpg: pointer, # void** in/out
pattern: ptr uint16, # WORD*
length: int32, # INT
baseSkeleton: ptr uint16, # WORD* in/out
capacity: int32, # INT
pErrorCode: ptr int32 # UErrorCode* in/out
): int32 {.importc: "udatpg_getBaseSkeleton", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
int udatpg_getBaseSkeleton(
void** unusedDtpg, // void** in/out
ushort* pattern, // WORD*
int length, // INT
ushort* baseSkeleton, // WORD* in/out
int capacity, // INT
int* pErrorCode // UErrorCode* in/out
);ccall((:udatpg_getBaseSkeleton, "icuin.dll"), Int32,
(Ptr{Cvoid}, Ptr{UInt16}, Int32, Ptr{UInt16}, Int32, Ptr{Int32}),
unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode)
# unusedDtpg : void** in/out -> Ptr{Cvoid}
# pattern : WORD* -> Ptr{UInt16}
# length : INT -> Int32
# baseSkeleton : WORD* in/out -> Ptr{UInt16}
# capacity : INT -> Int32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t udatpg_getBaseSkeleton(
void** unusedDtpg,
uint16_t* pattern,
int32_t length,
uint16_t* baseSkeleton,
int32_t capacity,
int32_t* pErrorCode);
]]
local icuin = ffi.load("icuin")
-- icuin.udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode)
-- unusedDtpg : void** in/out
-- pattern : WORD*
-- length : INT
-- baseSkeleton : WORD* in/out
-- capacity : INT
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const udatpg_getBaseSkeleton = lib.func('__cdecl', 'udatpg_getBaseSkeleton', 'int32_t', ['void *', 'uint16_t *', 'int32_t', 'uint16_t *', 'int32_t', 'int32_t *']);
// udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode)
// unusedDtpg : void** in/out -> 'void *'
// pattern : WORD* -> 'uint16_t *'
// length : INT -> 'int32_t'
// baseSkeleton : WORD* in/out -> 'uint16_t *'
// capacity : INT -> 'int32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
udatpg_getBaseSkeleton: { parameters: ["pointer", "pointer", "i32", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode)
// unusedDtpg : void** in/out -> "pointer"
// pattern : WORD* -> "pointer"
// length : INT -> "i32"
// baseSkeleton : WORD* in/out -> "pointer"
// capacity : INT -> "i32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t udatpg_getBaseSkeleton(
void** unusedDtpg,
uint16_t* pattern,
int32_t length,
uint16_t* baseSkeleton,
int32_t capacity,
int32_t* pErrorCode);
C, "icuin.dll");
// $ffi->udatpg_getBaseSkeleton(unusedDtpg, pattern, length, baseSkeleton, capacity, pErrorCode);
// unusedDtpg : void** in/out
// pattern : WORD*
// length : INT
// baseSkeleton : WORD* in/out
// capacity : INT
// 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_getBaseSkeleton(
Pointer unusedDtpg, // void** in/out
ShortByReference pattern, // WORD*
int length, // INT
ShortByReference baseSkeleton, // WORD* in/out
int capacity, // INT
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun udatpg_getBaseSkeleton = udatpg_getBaseSkeleton(
unusedDtpg : Void**, # void** in/out
pattern : UInt16*, # WORD*
length : Int32, # INT
baseSkeleton : UInt16*, # WORD* in/out
capacity : Int32, # INT
pErrorCode : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef udatpg_getBaseSkeletonNative = Int32 Function(Pointer<Void>, Pointer<Uint16>, Int32, Pointer<Uint16>, Int32, Pointer<Int32>);
typedef udatpg_getBaseSkeletonDart = int Function(Pointer<Void>, Pointer<Uint16>, int, Pointer<Uint16>, int, Pointer<Int32>);
final udatpg_getBaseSkeleton = DynamicLibrary.open('icuin.dll')
.lookupFunction<udatpg_getBaseSkeletonNative, udatpg_getBaseSkeletonDart>('udatpg_getBaseSkeleton');
// unusedDtpg : void** in/out -> Pointer<Void>
// pattern : WORD* -> Pointer<Uint16>
// length : INT -> Int32
// baseSkeleton : WORD* in/out -> Pointer<Uint16>
// capacity : INT -> Int32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function udatpg_getBaseSkeleton(
unusedDtpg: Pointer; // void** in/out
pattern: Pointer; // WORD*
length: Integer; // INT
baseSkeleton: Pointer; // WORD* in/out
capacity: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'udatpg_getBaseSkeleton';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "udatpg_getBaseSkeleton"
c_udatpg_getBaseSkeleton :: Ptr () -> Ptr Word16 -> Int32 -> Ptr Word16 -> Int32 -> Ptr Int32 -> IO Int32
-- unusedDtpg : void** in/out -> Ptr ()
-- pattern : WORD* -> Ptr Word16
-- length : INT -> Int32
-- baseSkeleton : WORD* in/out -> Ptr Word16
-- capacity : INT -> Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let udatpg_getbaseskeleton =
foreign "udatpg_getBaseSkeleton"
((ptr void) @-> (ptr uint16_t) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* unusedDtpg : void** in/out -> (ptr void) *)
(* pattern : WORD* -> (ptr uint16_t) *)
(* length : INT -> int32_t *)
(* baseSkeleton : WORD* in/out -> (ptr uint16_t) *)
(* capacity : INT -> 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_getBaseSkeleton" udatpg-get-base-skeleton :convention :cdecl) :int32
(unused-dtpg :pointer) ; void** in/out
(pattern :pointer) ; WORD*
(length :int32) ; INT
(base-skeleton :pointer) ; WORD* in/out
(capacity :int32) ; INT
(p-error-code :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $udatpg_getBaseSkeleton = Win32::API::More->new('icuin',
'int udatpg_getBaseSkeleton(LPVOID unusedDtpg, LPVOID pattern, int length, LPVOID baseSkeleton, int capacity, LPVOID pErrorCode)');
# my $ret = $udatpg_getBaseSkeleton->Call($unusedDtpg, $pattern, $length, $baseSkeleton, $capacity, $pErrorCode);
# unusedDtpg : void** in/out -> LPVOID
# pattern : WORD* -> LPVOID
# length : INT -> int
# baseSkeleton : WORD* in/out -> LPVOID
# capacity : INT -> int
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型