ホーム › Globalization › ublock_getCode
ublock_getCode
関数文字が属するUnicodeブロックのコードを取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
UBlockCode ublock_getCode(
INT c
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| c | INT | in | 所属するUnicodeブロックを判定する対象のコードポイント。戻り値はUBlockCode値。 |
戻り値の型: UBlockCode
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
UBlockCode ublock_getCode(
INT c
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ublock_getCode(
int c // INT
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ublock_getCode(
c As Integer ' INT
) As Integer
End Function' c : INT
Declare PtrSafe Function ublock_getCode Lib "icuuc" ( _
ByVal c As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ublock_getCode = ctypes.cdll.icuuc.ublock_getCode
ublock_getCode.restype = ctypes.c_int
ublock_getCode.argtypes = [
ctypes.c_int, # c : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ublock_getCode = Fiddle::Function.new(
lib['ublock_getCode'],
[
Fiddle::TYPE_INT, # c : INT
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ublock_getCode(
c: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ublock_getCode(int c);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ublock_getCode' -Namespace Win32 -PassThru
# $api::ublock_getCode(c)#uselib "icuuc.dll"
#func global ublock_getCode "ublock_getCode" sptr
; ublock_getCode c ; 戻り値は stat
; c : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuuc.dll"
#cfunc global ublock_getCode "ublock_getCode" int
; res = ublock_getCode(c)
; c : INT -> "int"; UBlockCode ublock_getCode(INT c)
#uselib "icuuc.dll"
#cfunc global ublock_getCode "ublock_getCode" int
; res = ublock_getCode(c)
; c : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procublock_getCode = icuuc.NewProc("ublock_getCode")
)
// c (INT)
r1, _, err := procublock_getCode.Call(
uintptr(c),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UBlockCodefunction ublock_getCode(
c: Integer // INT
): Integer; cdecl;
external 'icuuc.dll' name 'ublock_getCode';result := DllCall("icuuc\ublock_getCode"
, "Int", c ; INT
, "Cdecl Int") ; return: UBlockCode●ublock_getCode(c) = DLL("icuuc.dll", "int ublock_getCode(int)")
# 呼び出し: ublock_getCode(c)
# c : 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 ublock_getCode(
c: i32 // INT
) callconv(.c) i32;proc ublock_getCode(
c: int32 # INT
): int32 {.importc: "ublock_getCode", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
int ublock_getCode(
int c // INT
);ccall((:ublock_getCode, "icuuc.dll"), Int32,
(Int32,),
c)
# c : INT -> Int32local ffi = require("ffi")
ffi.cdef[[
int32_t ublock_getCode(
int32_t c);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.ublock_getCode(c)
-- c : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const ublock_getCode = lib.func('__cdecl', 'ublock_getCode', 'int32_t', ['int32_t']);
// ublock_getCode(c)
// c : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
ublock_getCode: { parameters: ["i32"], result: "i32" },
});
// lib.symbols.ublock_getCode(c)
// c : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ublock_getCode(
int32_t c);
C, "icuuc.dll");
// $ffi->ublock_getCode(c);
// c : 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);
int ublock_getCode(
int c // INT
);
}@[Link("icuuc")]
lib Libicuuc
fun ublock_getCode = ublock_getCode(
c : Int32 # INT
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ublock_getCodeNative = Int32 Function(Int32);
typedef ublock_getCodeDart = int Function(int);
final ublock_getCode = DynamicLibrary.open('icuuc.dll')
.lookupFunction<ublock_getCodeNative, ublock_getCodeDart>('ublock_getCode');
// c : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ublock_getCode(
c: Integer // INT
): Integer; cdecl;
external 'icuuc.dll' name 'ublock_getCode';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ublock_getCode"
c_ublock_getCode :: Int32 -> IO Int32
-- c : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ublock_getcode =
foreign "ublock_getCode"
(int32_t @-> returning int32_t)
(* c : 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 ("ublock_getCode" ublock-get-code :convention :cdecl) :int32
(c :int32)) ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ublock_getCode = Win32::API::More->new('icuuc',
'int ublock_getCode(int c)');
# my $ret = $ublock_getCode->Call($c);
# c : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型