ホーム › Globalization › UConverterToUnicodeArgs
UConverterToUnicodeArgs
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| size | WORD | 2 | +0 | +0 | この構造体のバイトサイズ。 |
| flush | CHAR | 1 | +2 | +2 | 最終データを排出するフラッシュ要求フラグ。 |
| converter | UConverter* | 8/4 | +8 | +4 | 使用中のUConverterへのポインタ。 |
| source | LPSTR | 8/4 | +16 | +8 | 変換元のバイト入力バッファの現在位置。 |
| sourceLimit | LPSTR | 8/4 | +24 | +12 | 変換元入力バッファの終端。 |
| target | WORD* | 8/4 | +32 | +16 | 変換先のUTF-16出力バッファの現在位置。 |
| targetLimit | WORD* | 8/4 | +40 | +20 | 変換先出力バッファの終端。 |
| offsets | INT* | 8/4 | +48 | +24 | 各出力コード単位に対応する入力オフセット配列。NULL可。 |
各言語での定義
#include <windows.h>
// UConverterToUnicodeArgs (x64 56 / x86 28 バイト)
typedef struct UConverterToUnicodeArgs {
WORD size;
CHAR flush;
UConverter* converter;
LPSTR source;
LPSTR sourceLimit;
WORD* target;
WORD* targetLimit;
INT* offsets;
} UConverterToUnicodeArgs;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UConverterToUnicodeArgs
{
public ushort size;
public sbyte flush;
public IntPtr converter;
public IntPtr source;
public IntPtr sourceLimit;
public IntPtr target;
public IntPtr targetLimit;
public IntPtr offsets;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UConverterToUnicodeArgs
Public size As UShort
Public flush As SByte
Public converter As IntPtr
Public source As IntPtr
Public sourceLimit As IntPtr
Public target As IntPtr
Public targetLimit As IntPtr
Public offsets As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class UConverterToUnicodeArgs(ctypes.Structure):
_fields_ = [
("size", ctypes.c_ushort),
("flush", ctypes.c_byte),
("converter", ctypes.c_void_p),
("source", ctypes.c_void_p),
("sourceLimit", ctypes.c_void_p),
("target", ctypes.c_void_p),
("targetLimit", ctypes.c_void_p),
("offsets", ctypes.c_void_p),
]#[repr(C)]
pub struct UConverterToUnicodeArgs {
pub size: u16,
pub flush: i8,
pub converter: *mut core::ffi::c_void,
pub source: *mut core::ffi::c_void,
pub sourceLimit: *mut core::ffi::c_void,
pub target: *mut core::ffi::c_void,
pub targetLimit: *mut core::ffi::c_void,
pub offsets: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type UConverterToUnicodeArgs struct {
size uint16
flush int8
converter uintptr
source uintptr
sourceLimit uintptr
target uintptr
targetLimit uintptr
offsets uintptr
}type
UConverterToUnicodeArgs = record
size: Word;
flush: Shortint;
converter: Pointer;
source: Pointer;
sourceLimit: Pointer;
target: Pointer;
targetLimit: Pointer;
offsets: Pointer;
end;const UConverterToUnicodeArgs = extern struct {
size: u16,
flush: i8,
converter: ?*anyopaque,
source: ?*anyopaque,
sourceLimit: ?*anyopaque,
target: ?*anyopaque,
targetLimit: ?*anyopaque,
offsets: ?*anyopaque,
};type
UConverterToUnicodeArgs {.bycopy.} = object
size: uint16
flush: int8
converter: pointer
source: pointer
sourceLimit: pointer
target: pointer
targetLimit: pointer
offsets: pointerstruct UConverterToUnicodeArgs
{
ushort size;
byte flush;
void* converter;
void* source;
void* sourceLimit;
void* target;
void* targetLimit;
void* offsets;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; UConverterToUnicodeArgs サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; size : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; flush : CHAR (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; converter : UConverter* (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; source : LPSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; sourceLimit : LPSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; target : WORD* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; targetLimit : WORD* (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; offsets : INT* (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UConverterToUnicodeArgs サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; size : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; flush : CHAR (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; converter : UConverter* (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; source : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; sourceLimit : LPSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; target : WORD* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; targetLimit : WORD* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; offsets : INT* (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global UConverterToUnicodeArgs
#field short size
#field byte flush
#field intptr converter
#field intptr source
#field intptr sourceLimit
#field intptr target
#field intptr targetLimit
#field intptr offsets
#endstruct
stdim st, UConverterToUnicodeArgs ; NSTRUCT 変数を確保
st->size = 100
mes "size=" + st->size