ホーム › Globalization › uregex_appendTail
uregex_appendTail
関数最後の一致以降の残りテキストを出力に追記する。
シグネチャ
// icuin.dll
#include <windows.h>
INT uregex_appendTail(
URegularExpression* regexp,
WORD** destBuf,
INT* destCapacity,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| regexp | URegularExpression* | inout | 逐次置換の最後に、最終一致以降の残りテキストを追記する正規表現オブジェクト。 |
| destBuf | WORD** | inout | 出力位置を指すポインタへのポインタ。書き込み後に書き込み末尾へ前進させられる。 |
| destCapacity | INT* | inout | 残り容量(コード単位数)を入出力するポインタ。書き込んだ分だけ減算される。 |
| status | UErrorCode* | inout | ICUエラーコードの入出力ポインタ。事前にU_ZERO_ERRORへ初期化する。 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT uregex_appendTail(
URegularExpression* regexp,
WORD** destBuf,
INT* destCapacity,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uregex_appendTail(
ref IntPtr regexp, // URegularExpression* in/out
IntPtr destBuf, // WORD** in/out
ref int destCapacity, // INT* in/out
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uregex_appendTail(
ByRef regexp As IntPtr, ' URegularExpression* in/out
destBuf As IntPtr, ' WORD** in/out
ByRef destCapacity As Integer, ' INT* in/out
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' regexp : URegularExpression* in/out
' destBuf : WORD** in/out
' destCapacity : INT* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function uregex_appendTail Lib "icuin" ( _
ByRef regexp As LongPtr, _
ByVal destBuf As LongPtr, _
ByRef destCapacity As Long, _
ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uregex_appendTail = ctypes.cdll.icuin.uregex_appendTail
uregex_appendTail.restype = ctypes.c_int
uregex_appendTail.argtypes = [
ctypes.c_void_p, # regexp : URegularExpression* in/out
ctypes.c_void_p, # destBuf : WORD** in/out
ctypes.POINTER(ctypes.c_int), # destCapacity : INT* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
uregex_appendTail = Fiddle::Function.new(
lib['uregex_appendTail'],
[
Fiddle::TYPE_VOIDP, # regexp : URegularExpression* in/out
Fiddle::TYPE_VOIDP, # destBuf : WORD** in/out
Fiddle::TYPE_VOIDP, # destCapacity : INT* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn uregex_appendTail(
regexp: *mut isize, // URegularExpression* in/out
destBuf: *mut *mut u16, // WORD** in/out
destCapacity: *mut i32, // INT* in/out
status: *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 uregex_appendTail(ref IntPtr regexp, IntPtr destBuf, ref int destCapacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uregex_appendTail' -Namespace Win32 -PassThru
# $api::uregex_appendTail(regexp, destBuf, destCapacity, status)#uselib "icuin.dll"
#func global uregex_appendTail "uregex_appendTail" sptr, sptr, sptr, sptr
; uregex_appendTail varptr(regexp), varptr(destBuf), varptr(destCapacity), varptr(status) ; 戻り値は stat
; regexp : URegularExpression* in/out -> "sptr"
; destBuf : WORD** in/out -> "sptr"
; destCapacity : INT* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global uregex_appendTail "uregex_appendTail" var, var, var, var ; res = uregex_appendTail(regexp, destBuf, destCapacity, status) ; regexp : URegularExpression* in/out -> "var" ; destBuf : WORD** in/out -> "var" ; destCapacity : INT* in/out -> "var" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global uregex_appendTail "uregex_appendTail" sptr, sptr, sptr, sptr ; res = uregex_appendTail(varptr(regexp), varptr(destBuf), varptr(destCapacity), varptr(status)) ; regexp : URegularExpression* in/out -> "sptr" ; destBuf : WORD** in/out -> "sptr" ; destCapacity : INT* in/out -> "sptr" ; status : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT uregex_appendTail(URegularExpression* regexp, WORD** destBuf, INT* destCapacity, UErrorCode* status) #uselib "icuin.dll" #cfunc global uregex_appendTail "uregex_appendTail" var, var, var, var ; res = uregex_appendTail(regexp, destBuf, destCapacity, status) ; regexp : URegularExpression* in/out -> "var" ; destBuf : WORD** in/out -> "var" ; destCapacity : INT* in/out -> "var" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT uregex_appendTail(URegularExpression* regexp, WORD** destBuf, INT* destCapacity, UErrorCode* status) #uselib "icuin.dll" #cfunc global uregex_appendTail "uregex_appendTail" intptr, intptr, intptr, intptr ; res = uregex_appendTail(varptr(regexp), varptr(destBuf), varptr(destCapacity), varptr(status)) ; regexp : URegularExpression* in/out -> "intptr" ; destBuf : WORD** in/out -> "intptr" ; destCapacity : INT* in/out -> "intptr" ; status : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procuregex_appendTail = icuin.NewProc("uregex_appendTail")
)
// regexp (URegularExpression* in/out), destBuf (WORD** in/out), destCapacity (INT* in/out), status (UErrorCode* in/out)
r1, _, err := procuregex_appendTail.Call(
uintptr(regexp),
uintptr(destBuf),
uintptr(destCapacity),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction uregex_appendTail(
regexp: Pointer; // URegularExpression* in/out
destBuf: Pointer; // WORD** in/out
destCapacity: Pointer; // INT* in/out
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'uregex_appendTail';result := DllCall("icuin\uregex_appendTail"
, "Ptr", regexp ; URegularExpression* in/out
, "Ptr", destBuf ; WORD** in/out
, "Ptr", destCapacity ; INT* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●uregex_appendTail(regexp, destBuf, destCapacity, status) = DLL("icuin.dll", "int uregex_appendTail(void*, void*, void*, void*)")
# 呼び出し: uregex_appendTail(regexp, destBuf, destCapacity, status)
# regexp : URegularExpression* in/out -> "void*"
# destBuf : WORD** in/out -> "void*"
# destCapacity : INT* in/out -> "void*"
# status : 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 uregex_appendTail(
regexp: [*c]isize, // URegularExpression* in/out
destBuf: [*c][*c]u16, // WORD** in/out
destCapacity: [*c]i32, // INT* in/out
status: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc uregex_appendTail(
regexp: ptr int, # URegularExpression* in/out
destBuf: ptr uint16, # WORD** in/out
destCapacity: ptr int32, # INT* in/out
status: ptr int32 # UErrorCode* in/out
): int32 {.importc: "uregex_appendTail", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
int uregex_appendTail(
ptrdiff_t* regexp, // URegularExpression* in/out
ushort** destBuf, // WORD** in/out
int* destCapacity, // INT* in/out
int* status // UErrorCode* in/out
);ccall((:uregex_appendTail, "icuin.dll"), Int32,
(Ptr{Int}, Ptr{UInt16}, Ptr{Int32}, Ptr{Int32}),
regexp, destBuf, destCapacity, status)
# regexp : URegularExpression* in/out -> Ptr{Int}
# destBuf : WORD** in/out -> Ptr{UInt16}
# destCapacity : INT* in/out -> Ptr{Int32}
# status : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t uregex_appendTail(
intptr_t* regexp,
uint16_t** destBuf,
int32_t* destCapacity,
int32_t* status);
]]
local icuin = ffi.load("icuin")
-- icuin.uregex_appendTail(regexp, destBuf, destCapacity, status)
-- regexp : URegularExpression* in/out
-- destBuf : WORD** in/out
-- destCapacity : INT* in/out
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const uregex_appendTail = lib.func('__cdecl', 'uregex_appendTail', 'int32_t', ['intptr_t *', 'uint16_t *', 'int32_t *', 'int32_t *']);
// uregex_appendTail(regexp, destBuf, destCapacity, status)
// regexp : URegularExpression* in/out -> 'intptr_t *'
// destBuf : WORD** in/out -> 'uint16_t *'
// destCapacity : INT* in/out -> 'int32_t *'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
uregex_appendTail: { parameters: ["pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.uregex_appendTail(regexp, destBuf, destCapacity, status)
// regexp : URegularExpression* in/out -> "pointer"
// destBuf : WORD** in/out -> "pointer"
// destCapacity : INT* in/out -> "pointer"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t uregex_appendTail(
intptr_t* regexp,
uint16_t** destBuf,
int32_t* destCapacity,
int32_t* status);
C, "icuin.dll");
// $ffi->uregex_appendTail(regexp, destBuf, destCapacity, status);
// regexp : URegularExpression* in/out
// destBuf : WORD** in/out
// destCapacity : INT* in/out
// status : 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 uregex_appendTail(
LongByReference regexp, // URegularExpression* in/out
Pointer destBuf, // WORD** in/out
IntByReference destCapacity, // INT* in/out
IntByReference status // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun uregex_appendTail = uregex_appendTail(
regexp : LibC::SSizeT*, # URegularExpression* in/out
destBuf : UInt16**, # WORD** in/out
destCapacity : Int32*, # INT* in/out
status : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef uregex_appendTailNative = Int32 Function(Pointer<IntPtr>, Pointer<Uint16>, Pointer<Int32>, Pointer<Int32>);
typedef uregex_appendTailDart = int Function(Pointer<IntPtr>, Pointer<Uint16>, Pointer<Int32>, Pointer<Int32>);
final uregex_appendTail = DynamicLibrary.open('icuin.dll')
.lookupFunction<uregex_appendTailNative, uregex_appendTailDart>('uregex_appendTail');
// regexp : URegularExpression* in/out -> Pointer<IntPtr>
// destBuf : WORD** in/out -> Pointer<Uint16>
// destCapacity : INT* in/out -> Pointer<Int32>
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function uregex_appendTail(
regexp: Pointer; // URegularExpression* in/out
destBuf: Pointer; // WORD** in/out
destCapacity: Pointer; // INT* in/out
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'uregex_appendTail';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "uregex_appendTail"
c_uregex_appendTail :: Ptr CIntPtr -> Ptr Word16 -> Ptr Int32 -> Ptr Int32 -> IO Int32
-- regexp : URegularExpression* in/out -> Ptr CIntPtr
-- destBuf : WORD** in/out -> Ptr Word16
-- destCapacity : INT* in/out -> Ptr Int32
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let uregex_appendtail =
foreign "uregex_appendTail"
((ptr intptr_t) @-> (ptr uint16_t) @-> (ptr int32_t) @-> (ptr int32_t) @-> returning int32_t)
(* regexp : URegularExpression* in/out -> (ptr intptr_t) *)
(* destBuf : WORD** in/out -> (ptr uint16_t) *)
(* destCapacity : INT* in/out -> (ptr int32_t) *)
(* status : 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 ("uregex_appendTail" uregex-append-tail :convention :cdecl) :int32
(regexp :pointer) ; URegularExpression* in/out
(dest-buf :pointer) ; WORD** in/out
(dest-capacity :pointer) ; INT* in/out
(status :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $uregex_appendTail = Win32::API::More->new('icuin',
'int uregex_appendTail(LPVOID regexp, LPVOID destBuf, LPVOID destCapacity, LPVOID status)');
# my $ret = $uregex_appendTail->Call($regexp, $destBuf, $destCapacity, $status);
# regexp : URegularExpression* in/out -> LPVOID
# destBuf : WORD** in/out -> LPVOID
# destCapacity : INT* in/out -> LPVOID
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型