Win32 API 日本語リファレンス
ホームGlobalization › u_unescapeAt

u_unescapeAt

関数
コールバック経由で指定位置の文字をアンエスケープする。
DLLicuuc.dll呼出規約cdecl

シグネチャ

// icuuc.dll
#include <windows.h>

INT u_unescapeAt(
    UNESCAPE_CHAR_AT charAt,
    INT* offset,
    INT length,
    void* context
);

パラメーター

名前方向説明
charAtUNESCAPE_CHAR_ATin指定オフセット位置の文字を返すコールバック関数(UNESCAPE_CHAR_AT)。
offsetINT*inoutアンエスケープ開始オフセットを受け取り、処理後の位置に更新する入出力ポインタ。
lengthINTin入力の総文字数。
contextvoid*inoutcharAtコールバックへ渡されるユーザー定義のコンテキストポインタ。

戻り値の型: INT

各言語での呼び出し定義

// icuuc.dll
#include <windows.h>

INT u_unescapeAt(
    UNESCAPE_CHAR_AT charAt,
    INT* offset,
    INT length,
    void* context
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int u_unescapeAt(
    IntPtr charAt,   // UNESCAPE_CHAR_AT
    ref int offset,   // INT* in/out
    int length,   // INT
    IntPtr context   // void* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_unescapeAt(
    charAt As IntPtr,   ' UNESCAPE_CHAR_AT
    ByRef offset As Integer,   ' INT* in/out
    length As Integer,   ' INT
    context As IntPtr   ' void* in/out
) As Integer
End Function
' charAt : UNESCAPE_CHAR_AT
' offset : INT* in/out
' length : INT
' context : void* in/out
Declare PtrSafe Function u_unescapeAt Lib "icuuc" ( _
    ByVal charAt As LongPtr, _
    ByRef offset As Long, _
    ByVal length As Long, _
    ByVal context As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

u_unescapeAt = ctypes.cdll.icuuc.u_unescapeAt
u_unescapeAt.restype = ctypes.c_int
u_unescapeAt.argtypes = [
    ctypes.c_void_p,  # charAt : UNESCAPE_CHAR_AT
    ctypes.POINTER(ctypes.c_int),  # offset : INT* in/out
    ctypes.c_int,  # length : INT
    ctypes.POINTER(None),  # context : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
u_unescapeAt = Fiddle::Function.new(
  lib['u_unescapeAt'],
  [
    Fiddle::TYPE_VOIDP,  # charAt : UNESCAPE_CHAR_AT
    Fiddle::TYPE_VOIDP,  # offset : INT* in/out
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_VOIDP,  # context : void* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn u_unescapeAt(
        charAt: *const core::ffi::c_void,  // UNESCAPE_CHAR_AT
        offset: *mut i32,  // INT* in/out
        length: i32,  // INT
        context: *mut ()  // void* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int u_unescapeAt(IntPtr charAt, ref int offset, int length, IntPtr context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_unescapeAt' -Namespace Win32 -PassThru
# $api::u_unescapeAt(charAt, offset, length, context)
#uselib "icuuc.dll"
#func global u_unescapeAt "u_unescapeAt" sptr, sptr, sptr, sptr
; u_unescapeAt charAt, varptr(offset), length, context   ; 戻り値は stat
; charAt : UNESCAPE_CHAR_AT -> "sptr"
; offset : INT* in/out -> "sptr"
; length : INT -> "sptr"
; context : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global u_unescapeAt "u_unescapeAt" sptr, var, int, sptr
; res = u_unescapeAt(charAt, offset, length, context)
; charAt : UNESCAPE_CHAR_AT -> "sptr"
; offset : INT* in/out -> "var"
; length : INT -> "int"
; context : void* in/out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT u_unescapeAt(UNESCAPE_CHAR_AT charAt, INT* offset, INT length, void* context)
#uselib "icuuc.dll"
#cfunc global u_unescapeAt "u_unescapeAt" intptr, var, int, intptr
; res = u_unescapeAt(charAt, offset, length, context)
; charAt : UNESCAPE_CHAR_AT -> "intptr"
; offset : INT* in/out -> "var"
; length : INT -> "int"
; context : void* in/out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procu_unescapeAt = icuuc.NewProc("u_unescapeAt")
)

// charAt (UNESCAPE_CHAR_AT), offset (INT* in/out), length (INT), context (void* in/out)
r1, _, err := procu_unescapeAt.Call(
	uintptr(charAt),
	uintptr(offset),
	uintptr(length),
	uintptr(context),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function u_unescapeAt(
  charAt: Pointer;   // UNESCAPE_CHAR_AT
  offset: Pointer;   // INT* in/out
  length: Integer;   // INT
  context: Pointer   // void* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'u_unescapeAt';
result := DllCall("icuuc\u_unescapeAt"
    , "Ptr", charAt   ; UNESCAPE_CHAR_AT
    , "Ptr", offset   ; INT* in/out
    , "Int", length   ; INT
    , "Ptr", context   ; void* in/out
    , "Cdecl Int")   ; return: INT
●u_unescapeAt(charAt, offset, length, context) = DLL("icuuc.dll", "int u_unescapeAt(void*, void*, int, void*)")
# 呼び出し: u_unescapeAt(charAt, offset, length, context)
# charAt : UNESCAPE_CHAR_AT -> "void*"
# offset : INT* in/out -> "void*"
# length : INT -> "int"
# context : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "icuuc" fn u_unescapeAt(
    charAt: ?*anyopaque, // UNESCAPE_CHAR_AT
    offset: [*c]i32, // INT* in/out
    length: i32, // INT
    context: ?*anyopaque // void* in/out
) callconv(.c) i32;
proc u_unescapeAt(
    charAt: pointer,  # UNESCAPE_CHAR_AT
    offset: ptr int32,  # INT* in/out
    length: int32,  # INT
    context: pointer  # void* in/out
): int32 {.importc: "u_unescapeAt", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
int u_unescapeAt(
    void* charAt,   // UNESCAPE_CHAR_AT
    int* offset,   // INT* in/out
    int length,   // INT
    void* context   // void* in/out
);
ccall((:u_unescapeAt, "icuuc.dll"), Int32,
      (Ptr{Cvoid}, Ptr{Int32}, Int32, Ptr{Cvoid}),
      charAt, offset, length, context)
# charAt : UNESCAPE_CHAR_AT -> Ptr{Cvoid}
# offset : INT* in/out -> Ptr{Int32}
# length : INT -> Int32
# context : void* in/out -> Ptr{Cvoid}
local ffi = require("ffi")
ffi.cdef[[
int32_t u_unescapeAt(
    void* charAt,
    int32_t* offset,
    int32_t length,
    void* context);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.u_unescapeAt(charAt, offset, length, context)
-- charAt : UNESCAPE_CHAR_AT
-- offset : INT* in/out
-- length : INT
-- context : void* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const u_unescapeAt = lib.func('__cdecl', 'u_unescapeAt', 'int32_t', ['void *', 'int32_t *', 'int32_t', 'void *']);
// u_unescapeAt(charAt, offset, length, context)
// charAt : UNESCAPE_CHAR_AT -> 'void *'
// offset : INT* in/out -> 'int32_t *'
// length : INT -> 'int32_t'
// context : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。
const lib = Deno.dlopen("icuuc.dll", {
  u_unescapeAt: { parameters: ["pointer", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.u_unescapeAt(charAt, offset, length, context)
// charAt : UNESCAPE_CHAR_AT -> "pointer"
// offset : INT* in/out -> "pointer"
// length : INT -> "i32"
// context : void* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t u_unescapeAt(
    void* charAt,
    int32_t* offset,
    int32_t length,
    void* context);
C, "icuuc.dll");
// $ffi->u_unescapeAt(charAt, offset, length, context);
// charAt : UNESCAPE_CHAR_AT
// offset : INT* in/out
// length : INT
// context : void* 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 Icuuc extends Library {
    Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
    int u_unescapeAt(
        Callback charAt,   // UNESCAPE_CHAR_AT
        IntByReference offset,   // INT* in/out
        int length,   // INT
        Pointer context   // void* in/out
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun u_unescapeAt = u_unescapeAt(
    charAt : Void*,   # UNESCAPE_CHAR_AT
    offset : Int32*,   # INT* in/out
    length : Int32,   # INT
    context : Void*   # void* in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef u_unescapeAtNative = Int32 Function(Pointer<Void>, Pointer<Int32>, Int32, Pointer<Void>);
typedef u_unescapeAtDart = int Function(Pointer<Void>, Pointer<Int32>, int, Pointer<Void>);
final u_unescapeAt = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<u_unescapeAtNative, u_unescapeAtDart>('u_unescapeAt');
// charAt : UNESCAPE_CHAR_AT -> Pointer<Void>
// offset : INT* in/out -> Pointer<Int32>
// length : INT -> Int32
// context : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function u_unescapeAt(
  charAt: Pointer;   // UNESCAPE_CHAR_AT
  offset: Pointer;   // INT* in/out
  length: Integer;   // INT
  context: Pointer   // void* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'u_unescapeAt';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "u_unescapeAt"
  c_u_unescapeAt :: Ptr () -> Ptr Int32 -> Int32 -> Ptr () -> IO Int32
-- charAt : UNESCAPE_CHAR_AT -> Ptr ()
-- offset : INT* in/out -> Ptr Int32
-- length : INT -> Int32
-- context : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let u_unescapeat =
  foreign "u_unescapeAt"
    ((ptr void) @-> (ptr int32_t) @-> int32_t @-> (ptr void) @-> returning int32_t)
(* charAt : UNESCAPE_CHAR_AT -> (ptr void) *)
(* offset : INT* in/out -> (ptr int32_t) *)
(* length : INT -> int32_t *)
(* context : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)

(cffi:defcfun ("u_unescapeAt" u-unescape-at :convention :cdecl) :int32
  (char-at :pointer)   ; UNESCAPE_CHAR_AT
  (offset :pointer)   ; INT* in/out
  (length :int32)   ; INT
  (context :pointer))   ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $u_unescapeAt = Win32::API::More->new('icuuc',
    'int u_unescapeAt(LPVOID charAt, LPVOID offset, int length, LPVOID context)');
# my $ret = $u_unescapeAt->Call($charAt, $offset, $length, $context);
# charAt : UNESCAPE_CHAR_AT -> LPVOID
# offset : INT* in/out -> LPVOID
# length : INT -> int
# context : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。

関連項目

使用する型