ホーム › Globalization › UParseError
UParseError
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| line | INT | 4 | +0 | +0 | 解析エラーが発生した行番号。不明時は-1。 |
| offset | INT | 4 | +4 | +4 | 行内またはテキスト先頭からのエラー位置オフセット。不明時は-1。 |
| preContext | WORD | 32 | +8 | +8 | エラー位置直前のコンテキスト文字列。 |
| postContext | WORD | 32 | +40 | +40 | エラー位置直後のコンテキスト文字列。 |
各言語での定義
#include <windows.h>
// UParseError (x64 72 / x86 72 バイト)
typedef struct UParseError {
INT line;
INT offset;
WORD preContext[16];
WORD postContext[16];
} UParseError;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UParseError
{
public int line;
public int offset;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public ushort[] preContext;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public ushort[] postContext;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UParseError
Public line As Integer
Public offset As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public preContext() As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public postContext() As UShort
End Structureimport ctypes
from ctypes import wintypes
class UParseError(ctypes.Structure):
_fields_ = [
("line", ctypes.c_int),
("offset", ctypes.c_int),
("preContext", ctypes.c_ushort * 16),
("postContext", ctypes.c_ushort * 16),
]#[repr(C)]
pub struct UParseError {
pub line: i32,
pub offset: i32,
pub preContext: [u16; 16],
pub postContext: [u16; 16],
}import "golang.org/x/sys/windows"
type UParseError struct {
line int32
offset int32
preContext [16]uint16
postContext [16]uint16
}type
UParseError = record
line: Integer;
offset: Integer;
preContext: array[0..15] of Word;
postContext: array[0..15] of Word;
end;const UParseError = extern struct {
line: i32,
offset: i32,
preContext: [16]u16,
postContext: [16]u16,
};type
UParseError {.bycopy.} = object
line: int32
offset: int32
preContext: array[16, uint16]
postContext: array[16, uint16]struct UParseError
{
int line;
int offset;
ushort[16] preContext;
ushort[16] postContext;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UParseError サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; line : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; offset : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; preContext : WORD (+8, 32byte) varptr(st)+8 を基点に操作(32byte:入れ子/配列)
; postContext : WORD (+40, 32byte) varptr(st)+40 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global UParseError
#field int line
#field int offset
#field short preContext 16
#field short postContext 16
#endstruct
stdim st, UParseError ; NSTRUCT 変数を確保
st->line = 100
mes "line=" + st->line