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