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
offsetINT*inout
lengthINTin
contextvoid*inout

戻り値の型: 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`,…) を使用。