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

UTextFuncs

構造体
サイズx64: 112 バイト / x86: 64 バイト

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

フィールド

フィールドサイズx64x86説明
tableSizeINT4+0+0この関数テーブル構造体のサイズ。
reserved1INT4+4+4予約フィールド1。
reserved2INT4+8+8予約フィールド2。
reserved3INT4+12+12予約フィールド3。
cloneUTextClone8/4+16+16UTextを複製する関数ポインタ。
nativeLengthUTextNativeLength8/4+24+20ネイティブ単位でのテキスト長を返す関数ポインタ。
accessUTextAccess8/4+32+24指定ネイティブ位置のテキストチャンクへアクセスする関数ポインタ。
extractUTextExtract8/4+40+28テキストの一部をUTF-16へ取り出す関数ポインタ。
replaceUTextReplace8/4+48+32テキストの一部を置換する関数ポインタ。
copyUTextCopy8/4+56+36テキストの一部を複製または移動する関数ポインタ。
mapOffsetToNativeUTextMapOffsetToNative8/4+64+40チャンクオフセットをネイティブ位置へ写像する関数ポインタ。
mapNativeIndexToUTF16UTextMapNativeIndexToUTF168/4+72+44ネイティブ位置をUTF-16オフセットへ写像する関数ポインタ。
closeUTextClose8/4+80+48UTextを閉じて資源を解放する関数ポインタ。
spare1UTextClose8/4+88+52将来拡張用の予備関数ポインタ1。
spare2UTextClose8/4+96+56将来拡張用の予備関数ポインタ2。
spare3UTextClose8/4+104+60将来拡張用の予備関数ポインタ3。

各言語での定義

#include <windows.h>

// UTextFuncs  (x64 112 / x86 64 バイト)
typedef struct UTextFuncs {
    INT tableSize;
    INT reserved1;
    INT reserved2;
    INT reserved3;
    UTextClone clone;
    UTextNativeLength nativeLength;
    UTextAccess access;
    UTextExtract extract;
    UTextReplace replace;
    UTextCopy copy;
    UTextMapOffsetToNative mapOffsetToNative;
    UTextMapNativeIndexToUTF16 mapNativeIndexToUTF16;
    UTextClose close;
    UTextClose spare1;
    UTextClose spare2;
    UTextClose spare3;
} UTextFuncs;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UTextFuncs
{
    public int tableSize;
    public int reserved1;
    public int reserved2;
    public int reserved3;
    public IntPtr clone;
    public IntPtr nativeLength;
    public IntPtr access;
    public IntPtr extract;
    public IntPtr replace;
    public IntPtr copy;
    public IntPtr mapOffsetToNative;
    public IntPtr mapNativeIndexToUTF16;
    public IntPtr close;
    public IntPtr spare1;
    public IntPtr spare2;
    public IntPtr spare3;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UTextFuncs
    Public tableSize As Integer
    Public reserved1 As Integer
    Public reserved2 As Integer
    Public reserved3 As Integer
    Public clone As IntPtr
    Public nativeLength As IntPtr
    Public access As IntPtr
    Public extract As IntPtr
    Public replace As IntPtr
    Public copy As IntPtr
    Public mapOffsetToNative As IntPtr
    Public mapNativeIndexToUTF16 As IntPtr
    Public close As IntPtr
    Public spare1 As IntPtr
    Public spare2 As IntPtr
    Public spare3 As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class UTextFuncs(ctypes.Structure):
    _fields_ = [
        ("tableSize", ctypes.c_int),
        ("reserved1", ctypes.c_int),
        ("reserved2", ctypes.c_int),
        ("reserved3", ctypes.c_int),
        ("clone", ctypes.c_void_p),
        ("nativeLength", ctypes.c_void_p),
        ("access", ctypes.c_void_p),
        ("extract", ctypes.c_void_p),
        ("replace", ctypes.c_void_p),
        ("copy", ctypes.c_void_p),
        ("mapOffsetToNative", ctypes.c_void_p),
        ("mapNativeIndexToUTF16", ctypes.c_void_p),
        ("close", ctypes.c_void_p),
        ("spare1", ctypes.c_void_p),
        ("spare2", ctypes.c_void_p),
        ("spare3", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct UTextFuncs {
    pub tableSize: i32,
    pub reserved1: i32,
    pub reserved2: i32,
    pub reserved3: i32,
    pub clone: *mut core::ffi::c_void,
    pub nativeLength: *mut core::ffi::c_void,
    pub access: *mut core::ffi::c_void,
    pub extract: *mut core::ffi::c_void,
    pub replace: *mut core::ffi::c_void,
    pub copy: *mut core::ffi::c_void,
    pub mapOffsetToNative: *mut core::ffi::c_void,
    pub mapNativeIndexToUTF16: *mut core::ffi::c_void,
    pub close: *mut core::ffi::c_void,
    pub spare1: *mut core::ffi::c_void,
    pub spare2: *mut core::ffi::c_void,
    pub spare3: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type UTextFuncs struct {
	tableSize int32
	reserved1 int32
	reserved2 int32
	reserved3 int32
	clone uintptr
	nativeLength uintptr
	access uintptr
	extract uintptr
	replace uintptr
	copy uintptr
	mapOffsetToNative uintptr
	mapNativeIndexToUTF16 uintptr
	close uintptr
	spare1 uintptr
	spare2 uintptr
	spare3 uintptr
}
type
  UTextFuncs = record
    tableSize: Integer;
    reserved1: Integer;
    reserved2: Integer;
    reserved3: Integer;
    clone: Pointer;
    nativeLength: Pointer;
    access: Pointer;
    extract: Pointer;
    replace: Pointer;
    copy: Pointer;
    mapOffsetToNative: Pointer;
    mapNativeIndexToUTF16: Pointer;
    close: Pointer;
    spare1: Pointer;
    spare2: Pointer;
    spare3: Pointer;
  end;
const UTextFuncs = extern struct {
    tableSize: i32,
    reserved1: i32,
    reserved2: i32,
    reserved3: i32,
    clone: ?*anyopaque,
    nativeLength: ?*anyopaque,
    access: ?*anyopaque,
    extract: ?*anyopaque,
    replace: ?*anyopaque,
    copy: ?*anyopaque,
    mapOffsetToNative: ?*anyopaque,
    mapNativeIndexToUTF16: ?*anyopaque,
    close: ?*anyopaque,
    spare1: ?*anyopaque,
    spare2: ?*anyopaque,
    spare3: ?*anyopaque,
};
type
  UTextFuncs {.bycopy.} = object
    tableSize: int32
    reserved1: int32
    reserved2: int32
    reserved3: int32
    clone: pointer
    nativeLength: pointer
    access: pointer
    extract: pointer
    replace: pointer
    copy: pointer
    mapOffsetToNative: pointer
    mapNativeIndexToUTF16: pointer
    close: pointer
    spare1: pointer
    spare2: pointer
    spare3: pointer
struct UTextFuncs
{
    int tableSize;
    int reserved1;
    int reserved2;
    int reserved3;
    void* clone;
    void* nativeLength;
    void* access;
    void* extract;
    void* replace;
    void* copy;
    void* mapOffsetToNative;
    void* mapNativeIndexToUTF16;
    void* close;
    void* spare1;
    void* spare2;
    void* spare3;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; UTextFuncs サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; tableSize : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; reserved1 : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; reserved2 : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; reserved3 : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; clone : UTextClone (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; nativeLength : UTextNativeLength (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; access : UTextAccess (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; extract : UTextExtract (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; replace : UTextReplace (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; copy : UTextCopy (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; mapOffsetToNative : UTextMapOffsetToNative (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; mapNativeIndexToUTF16 : UTextMapNativeIndexToUTF16 (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; close : UTextClose (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; spare1 : UTextClose (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; spare2 : UTextClose (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; spare3 : UTextClose (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UTextFuncs サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; tableSize : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; reserved1 : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; reserved2 : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; reserved3 : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; clone : UTextClone (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; nativeLength : UTextNativeLength (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; access : UTextAccess (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; extract : UTextExtract (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; replace : UTextReplace (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; copy : UTextCopy (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; mapOffsetToNative : UTextMapOffsetToNative (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; mapNativeIndexToUTF16 : UTextMapNativeIndexToUTF16 (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; close : UTextClose (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; spare1 : UTextClose (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; spare2 : UTextClose (+96, 8byte)  qpoke st,96,値 / qpeek(st,96)  ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; spare3 : UTextClose (+104, 8byte)  qpoke st,104,値 / qpeek(st,104)  ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global UTextFuncs
    #field int tableSize
    #field int reserved1
    #field int reserved2
    #field int reserved3
    #field intptr clone
    #field intptr nativeLength
    #field intptr access
    #field intptr extract
    #field intptr replace
    #field intptr copy
    #field intptr mapOffsetToNative
    #field intptr mapNativeIndexToUTF16
    #field intptr close
    #field intptr spare1
    #field intptr spare2
    #field intptr spare3
#endstruct

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