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

UReplaceableCallbacks

構造体
サイズx64: 48 バイト / x86: 24 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
lengthINT_PTR8/4+0+0テキスト長を返すコールバック関数へのポインタ。
charAtINT_PTR8/4+8+4指定位置の16ビットコード単位を返すコールバック。
char32AtINT_PTR8/4+16+8指定位置のコードポイントを返すコールバック。
replaceINT_PTR8/4+24+12テキストの一部を置換するコールバック。
extractINT_PTR8/4+32+16テキストの一部を取り出すコールバック。
copyINT_PTR8/4+40+20テキストの一部を複製するコールバック。

各言語での定義

#include <windows.h>

// UReplaceableCallbacks  (x64 48 / x86 24 バイト)
typedef struct UReplaceableCallbacks {
    INT_PTR length;
    INT_PTR charAt;
    INT_PTR char32At;
    INT_PTR replace;
    INT_PTR extract;
    INT_PTR copy;
} UReplaceableCallbacks;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UReplaceableCallbacks
{
    public IntPtr length;
    public IntPtr charAt;
    public IntPtr char32At;
    public IntPtr replace;
    public IntPtr extract;
    public IntPtr copy;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UReplaceableCallbacks
    Public length As IntPtr
    Public charAt As IntPtr
    Public char32At As IntPtr
    Public replace As IntPtr
    Public extract As IntPtr
    Public copy As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class UReplaceableCallbacks(ctypes.Structure):
    _fields_ = [
        ("length", ctypes.c_ssize_t),
        ("charAt", ctypes.c_ssize_t),
        ("char32At", ctypes.c_ssize_t),
        ("replace", ctypes.c_ssize_t),
        ("extract", ctypes.c_ssize_t),
        ("copy", ctypes.c_ssize_t),
    ]
#[repr(C)]
pub struct UReplaceableCallbacks {
    pub length: isize,
    pub charAt: isize,
    pub char32At: isize,
    pub replace: isize,
    pub extract: isize,
    pub copy: isize,
}
import "golang.org/x/sys/windows"

type UReplaceableCallbacks struct {
	length uintptr
	charAt uintptr
	char32At uintptr
	replace uintptr
	extract uintptr
	copy uintptr
}
type
  UReplaceableCallbacks = record
    length: NativeInt;
    charAt: NativeInt;
    char32At: NativeInt;
    replace: NativeInt;
    extract: NativeInt;
    copy: NativeInt;
  end;
const UReplaceableCallbacks = extern struct {
    length: isize,
    charAt: isize,
    char32At: isize,
    replace: isize,
    extract: isize,
    copy: isize,
};
type
  UReplaceableCallbacks {.bycopy.} = object
    length: int
    charAt: int
    char32At: int
    replace: int
    extract: int
    copy: int
struct UReplaceableCallbacks
{
    ptrdiff_t length;
    ptrdiff_t charAt;
    ptrdiff_t char32At;
    ptrdiff_t replace;
    ptrdiff_t extract;
    ptrdiff_t copy;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; UReplaceableCallbacks サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; length : INT_PTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; charAt : INT_PTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; char32At : INT_PTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; replace : INT_PTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; extract : INT_PTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; copy : INT_PTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UReplaceableCallbacks サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; length : INT_PTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; charAt : INT_PTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; char32At : INT_PTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; replace : INT_PTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; extract : INT_PTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; copy : INT_PTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global UReplaceableCallbacks
    #field intptr length
    #field intptr charAt
    #field intptr char32At
    #field intptr replace
    #field intptr extract
    #field intptr copy
#endstruct

stdim st, UReplaceableCallbacks        ; NSTRUCT 変数を確保
st->length = 100
mes "length=" + st->length