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

USerializedSet

構造体
サイズx64: 32 バイト / x86: 28 バイト

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

フィールド

フィールドサイズx64x86説明
arrayWORD*8/4+0+0シリアライズされたコードポイント集合の16ビット配列。
bmpLengthINT4+8+4配列のうちBMP範囲を表す部分の長さ。
lengthINT4+12+8配列全体の長さ。
staticArrayWORD16+16+12小さな集合をインライン格納する静的配列。

各言語での定義

#include <windows.h>

// USerializedSet  (x64 32 / x86 28 バイト)
typedef struct USerializedSet {
    WORD* array;
    INT bmpLength;
    INT length;
    WORD staticArray[8];
} USerializedSet;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USerializedSet
{
    public IntPtr array;
    public int bmpLength;
    public int length;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public ushort[] staticArray;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USerializedSet
    Public array As IntPtr
    Public bmpLength As Integer
    Public length As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public staticArray() As UShort
End Structure
import ctypes
from ctypes import wintypes

class USerializedSet(ctypes.Structure):
    _fields_ = [
        ("array", ctypes.c_void_p),
        ("bmpLength", ctypes.c_int),
        ("length", ctypes.c_int),
        ("staticArray", ctypes.c_ushort * 8),
    ]
#[repr(C)]
pub struct USerializedSet {
    pub array: *mut core::ffi::c_void,
    pub bmpLength: i32,
    pub length: i32,
    pub staticArray: [u16; 8],
}
import "golang.org/x/sys/windows"

type USerializedSet struct {
	array uintptr
	bmpLength int32
	length int32
	staticArray [8]uint16
}
type
  USerializedSet = record
    array: Pointer;
    bmpLength: Integer;
    length: Integer;
    staticArray: array[0..7] of Word;
  end;
const USerializedSet = extern struct {
    array: ?*anyopaque,
    bmpLength: i32,
    length: i32,
    staticArray: [8]u16,
};
type
  USerializedSet {.bycopy.} = object
    array: pointer
    bmpLength: int32
    length: int32
    staticArray: array[8, uint16]
struct USerializedSet
{
    void* array;
    int bmpLength;
    int length;
    ushort[8] staticArray;
}

HSP用 定義

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

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

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