ホーム › Globalization › uset_retain
uset_retain
関数指定範囲のコードポイントのみをUSetに残す。
シグネチャ
// icuuc.dll
#include <windows.h>
void uset_retain(
USet* set,
INT start,
INT end
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| set | USet* | inout | 対象のUnicodeセット。指定範囲外の要素は除去される。 |
| start | INT | in | 保持する範囲の先頭コードポイント(この値を含む)。 |
| end | INT | in | 保持する範囲の末尾コードポイント(この値を含む)。 |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void uset_retain(
USet* set,
INT start,
INT end
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void uset_retain(
ref IntPtr set, // USet* in/out
int start, // INT
int end // INT
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub uset_retain(
ByRef [set] As IntPtr, ' USet* in/out
start As Integer, ' INT
[end] As Integer ' INT
)
End Sub' set : USet* in/out
' start : INT
' end : INT
Declare PtrSafe Sub uset_retain Lib "icuuc" ( _
ByRef set As LongPtr, _
ByVal start As Long, _
ByVal end As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uset_retain = ctypes.cdll.icuuc.uset_retain
uset_retain.restype = None
uset_retain.argtypes = [
ctypes.c_void_p, # set : USet* in/out
ctypes.c_int, # start : INT
ctypes.c_int, # end : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
uset_retain = Fiddle::Function.new(
lib['uset_retain'],
[
Fiddle::TYPE_VOIDP, # set : USet* in/out
Fiddle::TYPE_INT, # start : INT
Fiddle::TYPE_INT, # end : INT
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn uset_retain(
set: *mut isize, // USet* in/out
start: i32, // INT
end: i32 // INT
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void uset_retain(ref IntPtr set, int start, int end);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uset_retain' -Namespace Win32 -PassThru
# $api::uset_retain(set, start, end)#uselib "icuuc.dll"
#func global uset_retain "uset_retain" sptr, sptr, sptr
; uset_retain varptr(set), start, end
; set : USet* in/out -> "sptr"
; start : INT -> "sptr"
; end : INT -> "sptr"出力引数:
#uselib "icuuc.dll" #func global uset_retain "uset_retain" var, int, int ; uset_retain set, start, end ; set : USet* in/out -> "var" ; start : INT -> "int" ; end : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #func global uset_retain "uset_retain" sptr, int, int ; uset_retain varptr(set), start, end ; set : USet* in/out -> "sptr" ; start : INT -> "int" ; end : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void uset_retain(USet* set, INT start, INT end) #uselib "icuuc.dll" #func global uset_retain "uset_retain" var, int, int ; uset_retain set, start, end ; set : USet* in/out -> "var" ; start : INT -> "int" ; end : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void uset_retain(USet* set, INT start, INT end) #uselib "icuuc.dll" #func global uset_retain "uset_retain" intptr, int, int ; uset_retain varptr(set), start, end ; set : USet* in/out -> "intptr" ; start : INT -> "int" ; end : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procuset_retain = icuuc.NewProc("uset_retain")
)
// set (USet* in/out), start (INT), end (INT)
r1, _, err := procuset_retain.Call(
uintptr(set),
uintptr(start),
uintptr(end),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure uset_retain(
set: Pointer; // USet* in/out
start: Integer; // INT
end: Integer // INT
); cdecl;
external 'icuuc.dll' name 'uset_retain';result := DllCall("icuuc\uset_retain"
, "Ptr", set ; USet* in/out
, "Int", start ; INT
, "Int", end ; INT
, "Cdecl Int") ; return: void●uset_retain(set, start, end) = DLL("icuuc.dll", "int uset_retain(void*, int, int)")
# 呼び出し: uset_retain(set, start, end)
# set : USet* in/out -> "void*"
# start : INT -> "int"
# end : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuuc" fn uset_retain(
set: [*c]isize, // USet* in/out
start: i32, // INT
end: i32 // INT
) callconv(.c) void;proc uset_retain(
set: ptr int, # USet* in/out
start: int32, # INT
`end`: int32 # INT
) {.importc: "uset_retain", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
void uset_retain(
ptrdiff_t* set, // USet* in/out
int start, // INT
int end // INT
);ccall((:uset_retain, "icuuc.dll"), Cvoid,
(Ptr{Int}, Int32, Int32),
set, start, end)
# set : USet* in/out -> Ptr{Int}
# start : INT -> Int32
# end : INT -> Int32local ffi = require("ffi")
ffi.cdef[[
void uset_retain(
intptr_t* set,
int32_t start,
int32_t end);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.uset_retain(set, start, end)
-- set : USet* in/out
-- start : INT
-- end : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const uset_retain = lib.func('__cdecl', 'uset_retain', 'void', ['intptr_t *', 'int32_t', 'int32_t']);
// uset_retain(set, start, end)
// set : USet* in/out -> 'intptr_t *'
// start : INT -> 'int32_t'
// end : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
uset_retain: { parameters: ["pointer", "i32", "i32"], result: "void" },
});
// lib.symbols.uset_retain(set, start, end)
// set : USet* in/out -> "pointer"
// start : INT -> "i32"
// end : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void uset_retain(
intptr_t* set,
int32_t start,
int32_t end);
C, "icuuc.dll");
// $ffi->uset_retain(set, start, end);
// set : USet* in/out
// start : INT
// end : 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 Icuuc extends Library {
Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
void uset_retain(
LongByReference set, // USet* in/out
int start, // INT
int end // INT
);
}@[Link("icuuc")]
lib Libicuuc
fun uset_retain = uset_retain(
set : LibC::SSizeT*, # USet* in/out
start : Int32, # INT
end_ : Int32 # INT
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef uset_retainNative = Void Function(Pointer<IntPtr>, Int32, Int32);
typedef uset_retainDart = void Function(Pointer<IntPtr>, int, int);
final uset_retain = DynamicLibrary.open('icuuc.dll')
.lookupFunction<uset_retainNative, uset_retainDart>('uset_retain');
// set : USet* in/out -> Pointer<IntPtr>
// start : INT -> Int32
// end : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure uset_retain(
set: Pointer; // USet* in/out
start: Integer; // INT
end: Integer // INT
); cdecl;
external 'icuuc.dll' name 'uset_retain';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "uset_retain"
c_uset_retain :: Ptr CIntPtr -> Int32 -> Int32 -> IO ()
-- set : USet* in/out -> Ptr CIntPtr
-- start : INT -> Int32
-- end : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let uset_retain =
foreign "uset_retain"
((ptr intptr_t) @-> int32_t @-> int32_t @-> returning void)
(* set : USet* in/out -> (ptr intptr_t) *)
(* start : INT -> int32_t *)
(* end : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("uset_retain" uset-retain :convention :cdecl) :void
(set :pointer) ; USet* in/out
(start :int32) ; INT
(end :int32)) ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $uset_retain = Win32::API::More->new('icuuc',
'void uset_retain(LPVOID set, int start, int end)');
# my $ret = $uset_retain->Call($set, $start, $end);
# set : USet* in/out -> LPVOID
# start : INT -> int
# end : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。