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