[REBOL] Re: char arrays in structs
From: petr::krenzelok::trz::cz at: 4-Sep-2003 20:04
Gregg Irwin wrote:
>Does anyone have a better way to map char arrays in structs than
>creating separate elements that take up the correct total amount of
>space? e.g.
>
>RASDIALPARAMSA
>{
> DWORD dwSize;
> CHAR szEntryName[ RAS_MaxEntryName + 1 ];
> ...
>
>RASDIALPARAMSA: make struct! [
> dwSize [integer!]
> szEntryName1 [char!]
> szEntryName2 [char!]
> szEntryName3 [char!]
> szEntryName4 [char!]
> ...
>
>-- Gregg
>
gen-chars: func [word-name to-number /local buff i][
buff: copy ""
insert buff newline
for i 1 to-number 1 [append buff join word-name [i " [char!]"
newline]]
load buff
]
gen-blk-chars: func [to-number /local buff i][
buff: copy []
for i 1 to-number 1 [append buff #"^@"]
buff
]
GFL_COLORMAP: make struct! compose/deep [
(gen-chars "Red" 256)
(gen-chars "Green" 256)
(gen-chars "Blue" 256)
] none
-pekr-