* Defining the constaint = 0 mod 4?
@ 2001-10-04 9:52 Lutz Donnerhacke
0 siblings, 0 replies; only message in thread
From: Lutz Donnerhacke @ 2001-10-04 9:52 UTC (permalink / raw)
subtype dirent_len_t is size_t range 13 .. NAME_MAX + 13;
type dirent_t (d_reclen : dirent_len_t) is record
d_ino : inode_t;
d_off : off_t;
d_name : Interfaces.C.char_array (13 .. d_reclen);
end record;
for dirent_t'Alignment use 4;
-- Kernel enforces this manually by rounding d_reclen to a multiple of 4
-- This prevents d_name : String (14 .. d_reclen); term : Char := NUL;
for dirent_t use record
d_ino at 0 range 0 .. 31;
d_off at 4 range 0 .. 31;
d_reclen at 8 range 0 .. 15;
end record;
pragma Pack (dirent_t);
Any idea to express the comment as a constraint? The following does not work:
subtype dirent_len_t is size_t range 0 .. NAME_MAX / 4;
type dirent_t (d_reclen : dirent_len_t) is record
d_ino : inode_t;
d_off : off_t;
d_name : Interfaces.C.char_array (13 .. 4 * d_reclen);
dummy : array (1..2) of Boolean := False;
end record;
for dirent_t'Alignment use 4;
for dirent_t use record
d_ino at 0 range 0 .. 31;
d_off at 4 range 2 .. 31;
dummy at 7 range 0 .. 1;
d_reclen at 8 range 0 .. 15;
end record;
for dirent_t'Bit_Order use High_Order_First;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-10-04 9:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-04 9:52 Defining the constaint = 0 mod 4? Lutz Donnerhacke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox