サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
コピー #include <windows.h>
// DWRITE_PANOSE (x64 10 / x86 10 バイト)
typedef struct DWRITE_PANOSE {
BYTE values[10];
BYTE familyKind;
_text_e__Struct text;
_script_e__Struct script;
_decorative_e__Struct decorative;
_symbol_e__Struct symbol;
} DWRITE_PANOSE;コピー using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_PANOSE
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] values;
public byte familyKind;
public _text_e__Struct text;
public _script_e__Struct script;
public _decorative_e__Struct decorative;
public _symbol_e__Struct symbol;
}コピー Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_PANOSE
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public values() As Byte
Public familyKind As Byte
Public text As _text_e__Struct
Public script As _script_e__Struct
Public decorative As _decorative_e__Struct
Public symbol As _symbol_e__Struct
End Structureコピー import ctypes
from ctypes import wintypes
class DWRITE_PANOSE(ctypes.Structure):
_fields_ = [
("values", ctypes.c_ubyte * 10),
("familyKind", ctypes.c_ubyte),
("text", _text_e__Struct),
("script", _script_e__Struct),
("decorative", _decorative_e__Struct),
("symbol", _symbol_e__Struct),
]コピー #[repr(C)]
pub struct DWRITE_PANOSE {
pub values: [u8; 10],
pub familyKind: u8,
pub text: _text_e__Struct,
pub script: _script_e__Struct,
pub decorative: _decorative_e__Struct,
pub symbol: _symbol_e__Struct,
}コピー import "golang.org/x/sys/windows"
type DWRITE_PANOSE struct {
values [10]byte
familyKind byte
text _text_e__Struct
script _script_e__Struct
decorative _decorative_e__Struct
symbol _symbol_e__Struct
}コピー type
DWRITE_PANOSE = record
values: array[0..9] of Byte;
familyKind: Byte;
text: _text_e__Struct;
script: _script_e__Struct;
decorative: _decorative_e__Struct;
symbol: _symbol_e__Struct;
end;コピー const DWRITE_PANOSE = extern struct {
values: [10]u8,
familyKind: u8,
text: _text_e__Struct,
script: _script_e__Struct,
decorative: _decorative_e__Struct,
symbol: _symbol_e__Struct,
};コピー type
DWRITE_PANOSE {.bycopy.} = object
values: array[10, uint8]
familyKind: uint8
text: _text_e__Struct
script: _script_e__Struct
decorative: _decorative_e__Struct
symbol: _symbol_e__Structコピー struct DWRITE_PANOSE
{
ubyte[10] values;
ubyte familyKind;
_text_e__Struct text;
_script_e__Struct script;
_decorative_e__Struct decorative;
_symbol_e__Struct symbol;
}HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT (#defstruct/stdim/->)で32/64bit共通。
コピー ; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DWRITE_PANOSE サイズ: 10 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 10 / 4 切り上げ)
; values : BYTE (+0, 10byte) varptr(st)+0 を基点に操作(10byte:入れ子/配列)
; familyKind : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; text : _text_e__Struct (+0, 10byte) varptr(st)+0 を基点に操作(10byte:入れ子/配列)
; script : _script_e__Struct (+0, 10byte) varptr(st)+0 を基点に操作(10byte:入れ子/配列)
; decorative : _decorative_e__Struct (+0, 10byte) varptr(st)+0 を基点に操作(10byte:入れ子/配列)
; symbol : _symbol_e__Struct (+0, 10byte) varptr(st)+0 を基点に操作(10byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。コピー ; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DWRITE_PANOSE
#field byte values 10
#field byte familyKind
#field _text_e__Struct text
#field _script_e__Struct script
#field _decorative_e__Struct decorative
#field _symbol_e__Struct symbol
#endstruct
stdim st, DWRITE_PANOSE ; NSTRUCT 変数を確保
st->familyKind = 100
mes "familyKind=" + st->familyKind