003 File Manager
Current Path:
/usr/local/lib/perl5/site_perl/mach/5.32/sys
usr
/
local
/
lib
/
perl5
/
site_perl
/
mach
/
5.32
/
sys
/
📁
..
📄
_atomic64e.ph
(1.7 KB)
📄
_atomic_subword.ph
(5.32 KB)
📄
_bitset.ph
(834 B)
📄
_blockcount.ph
(809 B)
📄
_bus_dma.ph
(324 B)
📄
_callout.ph
(199 B)
📄
_cpuset.ph
(487 B)
📄
_cscan_atomic.ph
(29.03 KB)
📄
_cscan_bus.ph
(13.04 KB)
📄
_domainset.ph
(547 B)
📄
_eventhandler.ph
(738 B)
📄
_ffcounter.ph
(180 B)
📄
_iovec.ph
(316 B)
📄
_lock.ph
(1.19 KB)
📄
_lockmgr.ph
(276 B)
📄
_mutex.ph
(200 B)
📄
_null.ph
(651 B)
📄
_pctrie.ph
(171 B)
📄
_pthreadtypes.ph
(317 B)
📄
_rangeset.ph
(204 B)
📄
_rmlock.ph
(485 B)
📄
_rwlock.ph
(203 B)
📄
_semaphore.ph
(285 B)
📄
_seqc.ph
(165 B)
📄
_sigset.ph
(858 B)
📄
_smr.ph
(908 B)
📄
_sockaddr_storage.ph
(665 B)
📄
_stack.ph
(230 B)
📄
_stdarg.ph
(1.09 KB)
📄
_stdint.ph
(1.62 KB)
📄
_sx.ph
(159 B)
📄
_task.ph
(578 B)
📄
_termios.ph
(7.26 KB)
📄
_timespec.ph
(325 B)
📄
_timeval.ph
(456 B)
📄
_types.ph
(944 B)
📄
_ucontext.ph
(177 B)
📄
_uio.ph
(548 B)
📄
_umtx.ph
(265 B)
📄
_unrhdr.ph
(193 B)
📄
_winsize.ph
(174 B)
📄
aac_ioctl.ph
(7.36 KB)
📄
abi_compat.ph
(1.81 KB)
📄
acct.ph
(859 B)
📄
acl.ph
(6.91 KB)
📄
agpio.ph
(5.3 KB)
📄
aio.ph
(2.17 KB)
📄
alq.ph
(648 B)
📄
apm.ph
(87 B)
📄
arb.ph
(35.53 KB)
📄
assym.ph
(1.5 KB)
📄
ata.ph
(50.51 KB)
📄
atomic_common.ph
(3.28 KB)
📄
auxv.ph
(220 B)
📄
backlight.ph
(903 B)
📄
bio.ph
(2.23 KB)
📄
bitset.ph
(9.24 KB)
📄
bitstring.ph
(1.61 KB)
📄
blist.ph
(552 B)
📄
blockcount.ph
(1.6 KB)
📄
boot.ph
(247 B)
📄
buf.ph
(11.05 KB)
📄
buf_ring.ph
(1.55 KB)
📄
bufobj.ph
(2.18 KB)
📄
bus.ph
(24.54 KB)
📄
bus_dma.ph
(4.55 KB)
📄
bus_dma_internal.ph
(186 B)
📄
busdma_bufalloc.ph
(262 B)
📄
callout.ph
(5.06 KB)
📄
caprights.ph
(534 B)
📄
capsicum.ph
(12.44 KB)
📄
cdefs.ph
(33.03 KB)
📄
cdio.ph
(5.68 KB)
📄
cdrio.ph
(3.6 KB)
📄
cfictl.ph
(741 B)
📄
chio.ph
(6.57 KB)
📄
ck.ph
(503 B)
📄
clock.ph
(990 B)
📄
cnv.ph
(540 B)
📄
compressor.ph
(349 B)
📄
condvar.ph
(1.85 KB)
📄
conf.ph
(4.53 KB)
📄
cons.ph
(1.59 KB)
📄
consio.ph
(17.3 KB)
📄
copyright.ph
(608 B)
📄
counter.ph
(1.61 KB)
📄
coverage.ph
(745 B)
📄
cpu.ph
(2.36 KB)
📄
cpuctl.ph
(1.04 KB)
📄
cpuset.ph
(4.91 KB)
📄
csan.ph
(349 B)
📄
ctf.ph
(8.35 KB)
📄
ctf_api.ph
(1.04 KB)
📄
ctype.ph
(1.51 KB)
📄
devctl.ph
(168 B)
📄
devicestat.ph
(4.25 KB)
📄
devmap.ph
(352 B)
📄
dirent.ph
(1.88 KB)
📄
disk.ph
(2.75 KB)
📄
disk_zone.ph
(4.48 KB)
📄
disklabel.ph
(1.75 KB)
📄
diskmbr.ph
(329 B)
📄
dkstat.ph
(199 B)
📄
dnv.ph
(427 B)
📄
domain.ph
(1.16 KB)
📄
domainset.ph
(5.58 KB)
📄
dtrace.ph
(52.95 KB)
📄
dtrace_bsd.ph
(177 B)
📄
dvdio.ph
(2.61 KB)
📄
efi.ph
(3.33 KB)
📄
efiio.ph
(821 B)
📄
elf.ph
(273 B)
📄
elf32.ph
(1.41 KB)
📄
elf64.ph
(1.91 KB)
📄
elf_common.ph
(85.24 KB)
📄
elf_generic.ph
(2.06 KB)
📄
endian.ph
(5.87 KB)
📄
epoch.ph
(2.43 KB)
📄
errno.ph
(6.93 KB)
📄
eui64.ph
(323 B)
📄
event.ph
(7.54 KB)
📄
eventfd.ph
(458 B)
📄
eventhandler.ph
(4.88 KB)
📄
eventvar.ph
(858 B)
📄
exec.ph
(1.19 KB)
📄
extattr.ph
(1.12 KB)
📄
fail.ph
(5.77 KB)
📄
fbio.ph
(17.58 KB)
📄
fcntl.ph
(9.1 KB)
📄
fdcio.ph
(5.37 KB)
📄
file.ph
(6.54 KB)
📄
filedesc.ph
(6.85 KB)
📄
filio.ph
(1.99 KB)
📄
firmware.ph
(332 B)
📄
fnv_hash.ph
(1.52 KB)
📄
font.ph
(930 B)
📄
gmon.ph
(2.57 KB)
📄
gpio.ph
(3.4 KB)
📄
gpt.ph
(300 B)
📄
gsb_crc32.ph
(744 B)
📄
gtaskqueue.ph
(1.85 KB)
📄
hash.ph
(440 B)
📄
hhook.ph
(1.42 KB)
📄
iconv.ph
(4.33 KB)
📄
imgact.ph
(476 B)
📄
imgact_aout.ph
(4.63 KB)
📄
imgact_binmisc.ph
(1.75 KB)
📄
imgact_elf.ph
(1.45 KB)
📄
interrupt.ph
(1.45 KB)
📄
intr.ph
(1.61 KB)
📄
ioccom.ph
(2.62 KB)
📄
ioctl.ph
(387 B)
📄
ioctl_compat.ph
(5.35 KB)
📄
iov.ph
(1.34 KB)
📄
iov_schema.ph
(358 B)
📄
ipc.ph
(2.21 KB)
📄
ipmi.ph
(6.15 KB)
📄
jail.ph
(7.65 KB)
📄
joystick.ph
(819 B)
📄
kbio.ph
(8.69 KB)
📄
kcov.ph
(1.19 KB)
📄
kdb.ph
(2.3 KB)
📄
kenv.ph
(578 B)
📄
kern_prefetch.ph
(385 B)
📄
kernel.ph
(13.29 KB)
📄
kerneldump.ph
(3.28 KB)
📄
khelp.ph
(325 B)
📄
kobj.ph
(3.16 KB)
📄
kpilite.ph
(860 B)
📄
ksem.ph
(432 B)
📄
kthread.ph
(199 B)
📄
ktls.ph
(1.67 KB)
📄
ktr.ph
(12.26 KB)
📄
ktr_class.ph
(2.53 KB)
📄
ktrace.ph
(4.95 KB)
📄
libkern.ph
(3.61 KB)
📄
limits.ph
(2.99 KB)
📄
link_aout.ph
(4.54 KB)
📄
link_elf.ph
(971 B)
📄
linker.ph
(3.66 KB)
📄
linker_set.ph
(2.81 KB)
📄
lock.ph
(10.56 KB)
📄
lock_profile.ph
(1.31 KB)
📄
lockf.ph
(307 B)
📄
lockmgr.ph
(6.64 KB)
📄
lockstat.ph
(4.38 KB)
📄
loginclass.ph
(180 B)
📄
mac.ph
(740 B)
📄
malloc.ph
(3.64 KB)
📄
mbuf.ph
(33.44 KB)
📄
mchain.ph
(494 B)
📄
md4.ph
(213 B)
📄
md5.ph
(497 B)
📄
mdioctl.ph
(1.7 KB)
📄
memdesc.ph
(2.53 KB)
📄
memrange.ph
(1.99 KB)
📄
mman.ph
(9.09 KB)
📄
module.ph
(4.84 KB)
📄
module_khelp.ph
(1.18 KB)
📄
mount.ph
(22.18 KB)
📄
mouse.ph
(15.1 KB)
📄
mpt_ioctl.ph
(1.95 KB)
📄
mqueue.ph
(202 B)
📄
msg.ph
(1.24 KB)
📄
msgbuf.ph
(993 B)
📄
mtio.ph
(8.56 KB)
📄
mutex.ph
(17.47 KB)
📄
namei.ph
(7.81 KB)
📄
nlist_aout.ph
(1.88 KB)
📄
nv.ph
(2.02 KB)
📄
nvpair.ph
(4.36 KB)
📄
osd.ph
(3.22 KB)
📄
param.ph
(9.24 KB)
📄
pciio.ph
(2.92 KB)
📄
pcpu.ph
(6.97 KB)
📄
pctrie.ph
(2.74 KB)
📄
physmem.ph
(886 B)
📄
pidctrl.ph
(435 B)
📄
pipe.ph
(2.25 KB)
📄
pmc.ph
(22.72 KB)
📄
pmckern.ph
(6.13 KB)
📄
pmclog.ph
(3.2 KB)
📄
poll.ph
(1.58 KB)
📄
posix4.ph
(1.2 KB)
📄
power.ph
(986 B)
📄
priority.ph
(3.44 KB)
📄
priv.ph
(19.61 KB)
📄
prng.ph
(328 B)
📄
proc.ph
(30.83 KB)
📄
procctl.ph
(4.3 KB)
📄
procdesc.ph
(1.48 KB)
📄
procfs.ph
(535 B)
📄
protosw.ph
(4.83 KB)
📄
ptio.ph
(395 B)
📄
ptrace.ph
(4.63 KB)
📄
qmath.ph
(19.54 KB)
📄
queue.ph
(30.6 KB)
📄
racct.ph
(6.48 KB)
📄
random.ph
(4.47 KB)
📄
rangelock.ph
(1.45 KB)
📄
rangeset.ph
(234 B)
📄
rctl.ph
(4.19 KB)
📄
reboot.ph
(1.86 KB)
📄
refcount.ph
(4.03 KB)
📄
regression.ph
(218 B)
📄
resource.ph
(3.04 KB)
📄
resourcevar.ph
(1.14 KB)
📄
rman.ph
(1.89 KB)
📄
rmlock.ph
(4.18 KB)
📄
rtprio.ph
(1.44 KB)
📄
runq.ph
(296 B)
📄
rwlock.ph
(10.78 KB)
📄
sbuf.ph
(1.55 KB)
📄
sched.ph
(3.04 KB)
📄
sdt.ph
(21.91 KB)
📄
select.ph
(2.28 KB)
📄
selinfo.ph
(371 B)
📄
sem.ph
(1.97 KB)
📄
sema.ph
(919 B)
📄
seqc.ph
(2.19 KB)
📄
serial.ph
(2.12 KB)
📄
sf_buf.ph
(2.32 KB)
📄
sglist.ph
(715 B)
📄
shm.ph
(1.8 KB)
📄
sigio.ph
(323 B)
📄
signal.ph
(12.78 KB)
📄
signalvar.ph
(9.63 KB)
📄
sleepqueue.ph
(975 B)
📄
slicer.ph
(1000 B)
📄
smp.ph
(3.05 KB)
📄
smr.ph
(1.49 KB)
📄
smr_types.ph
(2.14 KB)
📄
snoop.ph
(625 B)
📄
sockbuf.ph
(4.14 KB)
📄
socket.ph
(20.01 KB)
📄
socketvar.ph
(7.29 KB)
📄
sockio.ph
(8.23 KB)
📄
sockopt.ph
(375 B)
📄
soundcard.ph
(66.67 KB)
📄
specialfd.ph
(257 B)
📄
spigenio.ph
(1.06 KB)
📄
stack.ph
(845 B)
📄
stat.ph
(9.2 KB)
📄
stats.ph
(30.3 KB)
📄
statvfs.ph
(485 B)
📄
stdatomic.ph
(15.26 KB)
📄
stddef.ph
(518 B)
📄
stdint.ph
(915 B)
📄
sx.ph
(10.75 KB)
📄
syscall.ph
(28.09 KB)
📄
syscallsubr.ph
(521 B)
📄
sysctl.ph
(46.96 KB)
📄
sysent.ph
(6.09 KB)
📄
syslimits.ph
(1.32 KB)
📄
syslog.ph
(4.03 KB)
📄
sysproto.ph
(43.73 KB)
📄
systm.ph
(12.58 KB)
📄
taskqueue.ph
(3.65 KB)
📄
terminal.ph
(5.68 KB)
📄
termios.ph
(223 B)
📄
thr.ph
(691 B)
📄
tiio.ph
(4.04 KB)
📄
tim_filter.ph
(540 B)
📄
time.ph
(12.88 KB)
📄
timeb.ph
(488 B)
📄
timeet.ph
(996 B)
📄
timeffc.ph
(3.86 KB)
📄
timepps.ph
(5.73 KB)
📄
timers.ph
(1.15 KB)
📄
times.ph
(379 B)
📄
timespec.ph
(735 B)
📄
timetc.ph
(444 B)
📄
timex.ph
(3.16 KB)
📄
tree.ph
(29.45 KB)
📄
tslog.ph
(2.24 KB)
📄
tty.ph
(3.84 KB)
📄
ttycom.ph
(5.65 KB)
📄
ttydefaults.ph
(2.62 KB)
📄
ttydevsw.ph
(2.84 KB)
📄
ttydisc.ph
(1.02 KB)
📄
ttyhook.ph
(2.25 KB)
📄
ttyqueue.ph
(2.15 KB)
📄
turnstile.ph
(357 B)
📄
types.ph
(7.97 KB)
📄
ucontext.ph
(695 B)
📄
ucred.ph
(1.19 KB)
📄
uio.ph
(681 B)
📄
umtx.ph
(6.12 KB)
📄
un.ph
(1.07 KB)
📄
unistd.ph
(7.59 KB)
📄
unpcb.ph
(1.19 KB)
📄
user.ph
(8.58 KB)
📄
utsname.ph
(553 B)
📄
uuid.ph
(543 B)
📄
vdso.ph
(1.28 KB)
📄
vmem.ph
(643 B)
📄
vmmeter.ph
(2.21 KB)
📄
vnode.ph
(24.18 KB)
📄
vtoc.ph
(88 B)
📄
wait.ph
(4.11 KB)
📄
watchdog.ph
(2.72 KB)
Editing: tree.ph
require '_h2ph_pre.ph'; no warnings qw(redefine misc); unless(defined(&_SYS_TREE_H_)) { eval 'sub _SYS_TREE_H_ () {1;}' unless defined(&_SYS_TREE_H_); require 'sys/cdefs.ph'; eval 'sub SPLAY_HEAD { my($name, $type) = @_; eval q(\'struct name\' { \'struct type\' * &sph_root; }); }' unless defined(&SPLAY_HEAD); eval 'sub SPLAY_INITIALIZER { my($root) = @_; eval q({ &NULL }); }' unless defined(&SPLAY_INITIALIZER); eval 'sub SPLAY_INIT { my($root) = @_; eval q( &do { ($root)-> &sph_root = &NULL; } &while ( 0)); }' unless defined(&SPLAY_INIT); eval 'sub SPLAY_ENTRY { my($type) = @_; eval q(\'struct struct\' { \'struct type\' * &spe_left; \'struct type\' * &spe_right; }); }' unless defined(&SPLAY_ENTRY); eval 'sub SPLAY_LEFT { my($elm, $field) = @_; eval q(($elm)-> ($field->{spe_left})); }' unless defined(&SPLAY_LEFT); eval 'sub SPLAY_RIGHT { my($elm, $field) = @_; eval q(($elm)-> ($field->{spe_right})); }' unless defined(&SPLAY_RIGHT); eval 'sub SPLAY_ROOT { my($head) = @_; eval q(($head)-> &sph_root); }' unless defined(&SPLAY_ROOT); eval 'sub SPLAY_EMPTY { my($head) = @_; eval q(( &SPLAY_ROOT($head) == &NULL)); }' unless defined(&SPLAY_EMPTY); eval 'sub SPLAY_ROTATE_RIGHT { my($head, $tmp, $field) = @_; eval q( &do { &SPLAY_LEFT(($head)-> &sph_root, $field) = &SPLAY_RIGHT($tmp, $field); &SPLAY_RIGHT($tmp, $field) = ($head)-> &sph_root; ($head)-> &sph_root = $tmp; } &while ( 0)); }' unless defined(&SPLAY_ROTATE_RIGHT); eval 'sub SPLAY_ROTATE_LEFT { my($head, $tmp, $field) = @_; eval q( &do { &SPLAY_RIGHT(($head)-> &sph_root, $field) = &SPLAY_LEFT($tmp, $field); &SPLAY_LEFT($tmp, $field) = ($head)-> &sph_root; ($head)-> &sph_root = $tmp; } &while ( 0)); }' unless defined(&SPLAY_ROTATE_LEFT); eval 'sub SPLAY_LINKLEFT { my($head, $tmp, $field) = @_; eval q( &do { &SPLAY_LEFT($tmp, $field) = ($head)-> &sph_root; $tmp = ($head)-> &sph_root; ($head)-> &sph_root = &SPLAY_LEFT(($head)-> &sph_root, $field); } &while ( 0)); }' unless defined(&SPLAY_LINKLEFT); eval 'sub SPLAY_LINKRIGHT { my($head, $tmp, $field) = @_; eval q( &do { &SPLAY_RIGHT($tmp, $field) = ($head)-> &sph_root; $tmp = ($head)-> &sph_root; ($head)-> &sph_root = &SPLAY_RIGHT(($head)-> &sph_root, $field); } &while ( 0)); }' unless defined(&SPLAY_LINKRIGHT); eval 'sub SPLAY_ASSEMBLE { my($head, $node, $left, $right, $field) = @_; eval q( &do { &SPLAY_RIGHT($left, $field) = &SPLAY_LEFT(($head)-> &sph_root, $field); &SPLAY_LEFT($right, $field) = &SPLAY_RIGHT(($head)-> &sph_root, $field); &SPLAY_LEFT(($head)-> &sph_root, $field) = &SPLAY_RIGHT($node, $field); &SPLAY_RIGHT(($head)-> &sph_root, $field) = &SPLAY_LEFT($node, $field); } &while ( 0)); }' unless defined(&SPLAY_ASSEMBLE); eval 'sub SPLAY_PROTOTYPE { my($name, $type, $field, $cmp) = @_; eval q( &void $name &_SPLAY(\'struct name\' *, \'struct type\' *); &void $name &_SPLAY_MINMAX(\'struct name\' *, \'int\'); \'struct type\' *$name &_SPLAY_INSERT(\'struct name\' *, \'struct type\' *); \'struct type\' *$name &_SPLAY_REMOVE(\'struct name\' *, \'struct type\' *); &static &__unused &__inline \'struct type\' * $name &_SPLAY_FIND(\'struct name\' * &head, \'struct type\' * &elm) { &if ( &SPLAY_EMPTY( &head)) &return( &NULL); $name &_SPLAY( &head, &elm); &if (($cmp)( &elm, ( &head)-> &sph_root) == 0) &return ( ($head->{sph_root})); &return ( &NULL); } &static &__unused &__inline \'struct type\' * $name &_SPLAY_NEXT(\'struct name\' * &head, \'struct type\' * &elm) { $name &_SPLAY( &head, &elm); &if ( &SPLAY_RIGHT( &elm, $field) != &NULL) { &elm = &SPLAY_RIGHT( &elm, $field); &while ( &SPLAY_LEFT( &elm, $field) != &NULL) { &elm = &SPLAY_LEFT( &elm, $field); } } &else &elm = &NULL; &return ( &elm); } &static &__unused &__inline \'struct type\' * $name &_SPLAY_MIN_MAX(\'struct name\' * &head, \'int\' &val) { $name &_SPLAY_MINMAX( &head, &val); &return ( &SPLAY_ROOT( &head)); }); }' unless defined(&SPLAY_PROTOTYPE); eval 'sub SPLAY_GENERATE { my($name, $type, $field, $cmp) = @_; eval q(\'struct type\' * $name &_SPLAY_INSERT(\'struct name\' * &head, \'struct type\' * &elm) { &if ( &SPLAY_EMPTY( &head)) { &SPLAY_LEFT( &elm, $field) = &SPLAY_RIGHT( &elm, $field) = &NULL; } &else { \'int\' &__comp; $name &_SPLAY( &head, &elm); &__comp = ($cmp)( &elm, ( &head)-> &sph_root); &if( &__comp < 0) { &SPLAY_LEFT( &elm, $field) = &SPLAY_LEFT(( &head)-> &sph_root, $field); &SPLAY_RIGHT( &elm, $field) = ( &head)-> &sph_root; &SPLAY_LEFT(( &head)-> &sph_root, $field) = &NULL; } &else &if ( &__comp > 0) { &SPLAY_RIGHT( &elm, $field) = &SPLAY_RIGHT(( &head)-> &sph_root, $field); &SPLAY_LEFT( &elm, $field) = ( &head)-> &sph_root; &SPLAY_RIGHT(( &head)-> &sph_root, $field) = &NULL; } &else &return (( &head)-> &sph_root); } ( &head)-> &sph_root = ( &elm); &return ( &NULL); } \'struct type\' * $name &_SPLAY_REMOVE(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &__tmp; &if ( &SPLAY_EMPTY( &head)) &return ( &NULL); $name &_SPLAY( &head, &elm); &if (($cmp)( &elm, ( &head)-> &sph_root) == 0) { &if ( &SPLAY_LEFT(( &head)-> &sph_root, $field) == &NULL) { ( &head)-> &sph_root = &SPLAY_RIGHT(( &head)-> &sph_root, $field); } &else { &__tmp = &SPLAY_RIGHT(( &head)-> &sph_root, $field); ( &head)-> &sph_root = &SPLAY_LEFT(( &head)-> &sph_root, $field); $name &_SPLAY( &head, &elm); &SPLAY_RIGHT(( &head)-> &sph_root, $field) = &__tmp; } &return ( &elm); } &return ( &NULL); } &void $name &_SPLAY(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' &__node, * &__left, * &__right, * &__tmp; \'int\' &__comp; &SPLAY_LEFT(& &__node, $field) = &SPLAY_RIGHT(& &__node, $field) = &NULL; &__left = &__right = & &__node; &while (( &__comp = ($cmp)( &elm, ( &head)-> &sph_root)) != 0) { &if ( &__comp < 0) { &__tmp = &SPLAY_LEFT(( &head)-> &sph_root, $field); &if ( &__tmp == &NULL) &break; &if (($cmp)( &elm, &__tmp) < 0){ &SPLAY_ROTATE_RIGHT( &head, &__tmp, $field); &if ( &SPLAY_LEFT(( &head)-> &sph_root, $field) == &NULL) &break; } &SPLAY_LINKLEFT( &head, &__right, $field); } &else &if ( &__comp > 0) { &__tmp = &SPLAY_RIGHT(( &head)-> &sph_root, $field); &if ( &__tmp == &NULL) &break; &if (($cmp)( &elm, &__tmp) > 0){ &SPLAY_ROTATE_LEFT( &head, &__tmp, $field); &if ( &SPLAY_RIGHT(( &head)-> &sph_root, $field) == &NULL) &break; } &SPLAY_LINKRIGHT( &head, &__left, $field); } } &SPLAY_ASSEMBLE( &head, & &__node, &__left, &__right, $field); } &void $name &_SPLAY_MINMAX(\'struct name\' * &head, \'int\' &__comp) { \'struct type\' &__node, * &__left, * &__right, * &__tmp; &SPLAY_LEFT(& &__node, $field) = &SPLAY_RIGHT(& &__node, $field) = &NULL; &__left = &__right = & &__node; &while (1) { &if ( &__comp < 0) { &__tmp = &SPLAY_LEFT(( &head)-> &sph_root, $field); &if ( &__tmp == &NULL) &break; &if ( &__comp < 0){ &SPLAY_ROTATE_RIGHT( &head, &__tmp, $field); &if ( &SPLAY_LEFT(( &head)-> &sph_root, $field) == &NULL) &break; } &SPLAY_LINKLEFT( &head, &__right, $field); } &else &if ( &__comp > 0) { &__tmp = &SPLAY_RIGHT(( &head)-> &sph_root, $field); &if ( &__tmp == &NULL) &break; &if ( &__comp > 0) { &SPLAY_ROTATE_LEFT( &head, &__tmp, $field); &if ( &SPLAY_RIGHT(( &head)-> &sph_root, $field) == &NULL) &break; } &SPLAY_LINKRIGHT( &head, &__left, $field); } } &SPLAY_ASSEMBLE( &head, & &__node, &__left, &__right, $field); }); }' unless defined(&SPLAY_GENERATE); eval 'sub SPLAY_NEGINF () {-1;}' unless defined(&SPLAY_NEGINF); eval 'sub SPLAY_INF () {1;}' unless defined(&SPLAY_INF); eval 'sub SPLAY_INSERT { my($name, $x, $y) = @_; eval q($name &_SPLAY_INSERT($x, $y)); }' unless defined(&SPLAY_INSERT); eval 'sub SPLAY_REMOVE { my($name, $x, $y) = @_; eval q($name &_SPLAY_REMOVE($x, $y)); }' unless defined(&SPLAY_REMOVE); eval 'sub SPLAY_FIND { my($name, $x, $y) = @_; eval q($name &_SPLAY_FIND($x, $y)); }' unless defined(&SPLAY_FIND); eval 'sub SPLAY_NEXT { my($name, $x, $y) = @_; eval q($name &_SPLAY_NEXT($x, $y)); }' unless defined(&SPLAY_NEXT); eval 'sub SPLAY_MIN { my($name, $x) = @_; eval q(( &SPLAY_EMPTY($x) ? &NULL : $name &_SPLAY_MIN_MAX($x, &SPLAY_NEGINF))); }' unless defined(&SPLAY_MIN); eval 'sub SPLAY_MAX { my($name, $x) = @_; eval q(( &SPLAY_EMPTY($x) ? &NULL : $name &_SPLAY_MIN_MAX($x, &SPLAY_INF))); }' unless defined(&SPLAY_MAX); eval 'sub SPLAY_FOREACH { my($x, $name, $head) = @_; eval q( &for (($x) = &SPLAY_MIN($name, $head); ($x) != &NULL; ($x) = &SPLAY_NEXT($name, $head, $x))); }' unless defined(&SPLAY_FOREACH); eval 'sub RB_HEAD { my($name, $type) = @_; eval q(\'struct name\' { \'struct type\' * &rbh_root; }); }' unless defined(&RB_HEAD); eval 'sub RB_INITIALIZER { my($root) = @_; eval q({ &NULL }); }' unless defined(&RB_INITIALIZER); eval 'sub RB_INIT { my($root) = @_; eval q( &do { ($root)-> &rbh_root = &NULL; } &while ( 0)); }' unless defined(&RB_INIT); eval 'sub RB_ENTRY { my($type) = @_; eval q(\'struct struct\' { \'struct type\' * &rbe_left; \'struct type\' * &rbe_right; \'struct type\' * &rbe_parent; }); }' unless defined(&RB_ENTRY); eval 'sub RB_LEFT { my($elm, $field) = @_; eval q(($elm)-> ($field->{rbe_left})); }' unless defined(&RB_LEFT); eval 'sub RB_RIGHT { my($elm, $field) = @_; eval q(($elm)-> ($field->{rbe_right})); }' unless defined(&RB_RIGHT); eval 'sub RB_UP { my($elm, $field) = @_; eval q(($elm)-> ($field->{rbe_parent})); }' unless defined(&RB_UP); eval 'sub RB_BITS { my($elm, $field) = @_; eval q((*( &__uintptr_t *) &RB_UP($elm, $field))); }' unless defined(&RB_BITS); eval 'sub RB_RED_L () {(( &__uintptr_t)1);}' unless defined(&RB_RED_L); eval 'sub RB_RED_R () {(( &__uintptr_t)2);}' unless defined(&RB_RED_R); eval 'sub RB_RED_MASK () {(( &__uintptr_t)3);}' unless defined(&RB_RED_MASK); eval 'sub RB_FLIP_LEFT { my($elm, $field) = @_; eval q(( &RB_BITS($elm, $field) ^= &RB_RED_L)); }' unless defined(&RB_FLIP_LEFT); eval 'sub RB_FLIP_RIGHT { my($elm, $field) = @_; eval q(( &RB_BITS($elm, $field) ^= &RB_RED_R)); }' unless defined(&RB_FLIP_RIGHT); eval 'sub RB_RED_LEFT { my($elm, $field) = @_; eval q((( &RB_BITS($elm, $field) & &RB_RED_L) != 0)); }' unless defined(&RB_RED_LEFT); eval 'sub RB_RED_RIGHT { my($elm, $field) = @_; eval q((( &RB_BITS($elm, $field) & &RB_RED_R) != 0)); }' unless defined(&RB_RED_RIGHT); eval 'sub RB_PARENT { my($elm, $field) = @_; eval q((( &__typeof( &RB_UP($elm, $field))) ( &RB_BITS($elm, $field) & ~ &RB_RED_MASK))); }' unless defined(&RB_PARENT); eval 'sub RB_ROOT { my($head) = @_; eval q(($head)-> &rbh_root); }' unless defined(&RB_ROOT); eval 'sub RB_EMPTY { my($head) = @_; eval q(( &RB_ROOT($head) == &NULL)); }' unless defined(&RB_EMPTY); eval 'sub RB_SET_PARENT { my($dst, $src, $field) = @_; eval q( &do { &RB_BITS($dst, $field) &= &RB_RED_MASK; &RB_BITS($dst, $field) |= ( &__uintptr_t)$src; } &while ( 0)); }' unless defined(&RB_SET_PARENT); eval 'sub RB_SET { my($elm, $parent, $field) = @_; eval q( &do { &RB_UP($elm, $field) = $parent; &RB_LEFT($elm, $field) = &RB_RIGHT($elm, $field) = &NULL; } &while ( 0)); }' unless defined(&RB_SET); eval 'sub RB_COLOR { my($elm, $field) = @_; eval q(( &RB_PARENT($elm, $field) == &NULL ? 0: &RB_LEFT( &RB_PARENT($elm, $field), $field) == $elm ? &RB_RED_LEFT( &RB_PARENT($elm, $field), $field) : &RB_RED_RIGHT( &RB_PARENT($elm, $field), $field))); }' unless defined(&RB_COLOR); unless(defined(&RB_AUGMENT)) { eval 'sub RB_AUGMENT { my($x) = @_; eval q( &break); }' unless defined(&RB_AUGMENT); } eval 'sub RB_SWAP_CHILD { my($head, $out, $in, $field) = @_; eval q( &do { &if ( &RB_PARENT($out, $field) == &NULL) &RB_ROOT($head) = ($in); &else &if (($out) == &RB_LEFT( &RB_PARENT($out, $field), $field)) &RB_LEFT( &RB_PARENT($out, $field), $field) = ($in); &else &RB_RIGHT( &RB_PARENT($out, $field), $field) = ($in); } &while ( 0)); }' unless defined(&RB_SWAP_CHILD); eval 'sub RB_ROTATE_LEFT { my($head, $elm, $tmp, $field) = @_; eval q( &do { ($tmp) = &RB_RIGHT($elm, $field); &if (( &RB_RIGHT($elm, $field) = &RB_LEFT($tmp, $field)) != &NULL) { &RB_SET_PARENT( &RB_RIGHT($elm, $field), $elm, $field); } &RB_SET_PARENT($tmp, &RB_PARENT($elm, $field), $field); &RB_SWAP_CHILD($head, $elm, $tmp, $field); &RB_LEFT($tmp, $field) = ($elm); &RB_SET_PARENT($elm, $tmp, $field); &RB_AUGMENT($elm); } &while ( 0)); }' unless defined(&RB_ROTATE_LEFT); eval 'sub RB_ROTATE_RIGHT { my($head, $elm, $tmp, $field) = @_; eval q( &do { ($tmp) = &RB_LEFT($elm, $field); &if (( &RB_LEFT($elm, $field) = &RB_RIGHT($tmp, $field)) != &NULL) { &RB_SET_PARENT( &RB_LEFT($elm, $field), $elm, $field); } &RB_SET_PARENT($tmp, &RB_PARENT($elm, $field), $field); &RB_SWAP_CHILD($head, $elm, $tmp, $field); &RB_RIGHT($tmp, $field) = ($elm); &RB_SET_PARENT($elm, $tmp, $field); &RB_AUGMENT($elm); } &while ( 0)); }' unless defined(&RB_ROTATE_RIGHT); eval 'sub RB_PROTOTYPE { my($name, $type, $field, $cmp) = @_; eval q( &RB_PROTOTYPE_INTERNAL($name, $type, $field, $cmp,)); }' unless defined(&RB_PROTOTYPE); eval 'sub RB_PROTOTYPE_STATIC { my($name, $type, $field, $cmp) = @_; eval q( &RB_PROTOTYPE_INTERNAL($name, $type, $field, $cmp, &__unused &static)); }' unless defined(&RB_PROTOTYPE_STATIC); eval 'sub RB_PROTOTYPE_INTERNAL { my($name, $type, $field, $cmp, $attr) = @_; eval q( &RB_PROTOTYPE_INSERT_COLOR($name, $type, $attr); &RB_PROTOTYPE_REMOVE_COLOR($name, $type, $attr); &RB_PROTOTYPE_INSERT($name, $type, $attr); &RB_PROTOTYPE_REMOVE($name, $type, $attr); &RB_PROTOTYPE_FIND($name, $type, $attr); &RB_PROTOTYPE_NFIND($name, $type, $attr); &RB_PROTOTYPE_NEXT($name, $type, $attr); &RB_PROTOTYPE_PREV($name, $type, $attr); &RB_PROTOTYPE_MINMAX($name, $type, $attr); &RB_PROTOTYPE_REINSERT($name, $type, $attr);); }' unless defined(&RB_PROTOTYPE_INTERNAL); eval 'sub RB_PROTOTYPE_INSERT_COLOR { my($name, $type, $attr) = @_; eval q($attr &void $name &_RB_INSERT_COLOR(\'struct name\' *, \'struct type\' *)); }' unless defined(&RB_PROTOTYPE_INSERT_COLOR); eval 'sub RB_PROTOTYPE_REMOVE_COLOR { my($name, $type, $attr) = @_; eval q($attr &void $name &_RB_REMOVE_COLOR(\'struct name\' *, \'struct type\' *, \'struct type\' *)); }' unless defined(&RB_PROTOTYPE_REMOVE_COLOR); eval 'sub RB_PROTOTYPE_REMOVE { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_RB_REMOVE(\'struct name\' *, \'struct type\' *)); }' unless defined(&RB_PROTOTYPE_REMOVE); eval 'sub RB_PROTOTYPE_INSERT { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_RB_INSERT(\'struct name\' *, \'struct type\' *)); }' unless defined(&RB_PROTOTYPE_INSERT); eval 'sub RB_PROTOTYPE_FIND { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_RB_FIND(\'struct name\' *, \'struct type\' *)); }' unless defined(&RB_PROTOTYPE_FIND); eval 'sub RB_PROTOTYPE_NFIND { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_RB_NFIND(\'struct name\' *, \'struct type\' *)); }' unless defined(&RB_PROTOTYPE_NFIND); eval 'sub RB_PROTOTYPE_NEXT { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_RB_NEXT); }' unless defined(&RB_PROTOTYPE_NEXT); eval 'sub RB_PROTOTYPE_PREV { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_RB_PREV); }' unless defined(&RB_PROTOTYPE_PREV); eval 'sub RB_PROTOTYPE_MINMAX { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_RB_MINMAX(\'struct name\' *, \'int\')); }' unless defined(&RB_PROTOTYPE_MINMAX); eval 'sub RB_PROTOTYPE_REINSERT { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_RB_REINSERT(\'struct name\' *, \'struct type\' *)); }' unless defined(&RB_PROTOTYPE_REINSERT); eval 'sub RB_GENERATE { my($name, $type, $field, $cmp) = @_; eval q( &RB_GENERATE_INTERNAL($name, $type, $field, $cmp,)); }' unless defined(&RB_GENERATE); eval 'sub RB_GENERATE_STATIC { my($name, $type, $field, $cmp) = @_; eval q( &RB_GENERATE_INTERNAL($name, $type, $field, $cmp, &__unused &static)); }' unless defined(&RB_GENERATE_STATIC); eval 'sub RB_GENERATE_INTERNAL { my($name, $type, $field, $cmp, $attr) = @_; eval q( &RB_GENERATE_INSERT_COLOR($name, $type, $field, $attr) &RB_GENERATE_REMOVE_COLOR($name, $type, $field, $attr) &RB_GENERATE_INSERT($name, $type, $field, $cmp, $attr) &RB_GENERATE_REMOVE($name, $type, $field, $attr) &RB_GENERATE_FIND($name, $type, $field, $cmp, $attr) &RB_GENERATE_NFIND($name, $type, $field, $cmp, $attr) &RB_GENERATE_NEXT($name, $type, $field, $attr) &RB_GENERATE_PREV($name, $type, $field, $attr) &RB_GENERATE_MINMAX($name, $type, $field, $attr) &RB_GENERATE_REINSERT($name, $type, $field, $cmp, $attr)); }' unless defined(&RB_GENERATE_INTERNAL); eval 'sub RB_GENERATE_INSERT_COLOR { my($name, $type, $field, $attr) = @_; eval q($attr &void $name &_RB_INSERT_COLOR(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &child, * &parent; &while (( &parent = &RB_PARENT( &elm, $field)) != &NULL) { &if ( &RB_LEFT( &parent, $field) == &elm) { &if ( &RB_RED_LEFT( &parent, $field)) { &RB_FLIP_LEFT( &parent, $field); &return; } &RB_FLIP_RIGHT( &parent, $field); &if ( &RB_RED_RIGHT( &parent, $field)) { &elm = &parent; &continue; } &if (! &RB_RED_RIGHT( &elm, $field)) { &RB_FLIP_LEFT( &elm, $field); &RB_ROTATE_LEFT( &head, &elm, &child, $field); &if ( &RB_RED_LEFT( &child, $field)) &RB_FLIP_RIGHT( &elm, $field); &else &if ( &RB_RED_RIGHT( &child, $field)) &RB_FLIP_LEFT( &parent, $field); &elm = &child; } &RB_ROTATE_RIGHT( &head, &parent, &elm, $field); } &else { &if ( &RB_RED_RIGHT( &parent, $field)) { &RB_FLIP_RIGHT( &parent, $field); &return; } &RB_FLIP_LEFT( &parent, $field); &if ( &RB_RED_LEFT( &parent, $field)) { &elm = &parent; &continue; } &if (! &RB_RED_LEFT( &elm, $field)) { &RB_FLIP_RIGHT( &elm, $field); &RB_ROTATE_RIGHT( &head, &elm, &child, $field); &if ( &RB_RED_RIGHT( &child, $field)) &RB_FLIP_LEFT( &elm, $field); &else &if ( &RB_RED_LEFT( &child, $field)) &RB_FLIP_RIGHT( &parent, $field); &elm = &child; } &RB_ROTATE_LEFT( &head, &parent, &elm, $field); } &RB_BITS( &elm, $field) &= ~ &RB_RED_MASK; &break; } }); }' unless defined(&RB_GENERATE_INSERT_COLOR); eval 'sub RB_GENERATE_REMOVE_COLOR { my($name, $type, $field, $attr) = @_; eval q($attr &void $name &_RB_REMOVE_COLOR(\'struct name\' * &head, \'struct type\' * &parent, \'struct type\' * &elm) { \'struct type\' * &sib; &if ( &RB_LEFT( &parent, $field) == &elm && &RB_RIGHT( &parent, $field) == &elm) { &RB_BITS( &parent, $field) &= ~ &RB_RED_MASK; &elm = &parent; &parent = &RB_PARENT( &elm, $field); &if ( &parent == &NULL) &return; } &do { &if ( &RB_LEFT( &parent, $field) == &elm) { &if (! &RB_RED_LEFT( &parent, $field)) { &RB_FLIP_LEFT( &parent, $field); &return; } &if ( &RB_RED_RIGHT( &parent, $field)) { &RB_FLIP_RIGHT( &parent, $field); &elm = &parent; &continue; } &sib = &RB_RIGHT( &parent, $field); &if ((~ &RB_BITS( &sib, $field) & &RB_RED_MASK) == 0) { &RB_BITS( &sib, $field) &= ~ &RB_RED_MASK; &elm = &parent; &continue; } &RB_FLIP_RIGHT( &sib, $field); &if ( &RB_RED_LEFT( &sib, $field)) &RB_FLIP_LEFT( &parent, $field); &else &if (! &RB_RED_RIGHT( &sib, $field)) { &RB_FLIP_LEFT( &parent, $field); &RB_ROTATE_RIGHT( &head, &sib, &elm, $field); &if ( &RB_RED_RIGHT( &elm, $field)) &RB_FLIP_LEFT( &sib, $field); &if ( &RB_RED_LEFT( &elm, $field)) &RB_FLIP_RIGHT( &parent, $field); &RB_BITS( &elm, $field) |= &RB_RED_MASK; &sib = &elm; } &RB_ROTATE_LEFT( &head, &parent, &sib, $field); } &else { &if (! &RB_RED_RIGHT( &parent, $field)) { &RB_FLIP_RIGHT( &parent, $field); &return; } &if ( &RB_RED_LEFT( &parent, $field)) { &RB_FLIP_LEFT( &parent, $field); &elm = &parent; &continue; } &sib = &RB_LEFT( &parent, $field); &if ((~ &RB_BITS( &sib, $field) & &RB_RED_MASK) == 0) { &RB_BITS( &sib, $field) &= ~ &RB_RED_MASK; &elm = &parent; &continue; } &RB_FLIP_LEFT( &sib, $field); &if ( &RB_RED_RIGHT( &sib, $field)) &RB_FLIP_RIGHT( &parent, $field); &else &if (! &RB_RED_LEFT( &sib, $field)) { &RB_FLIP_RIGHT( &parent, $field); &RB_ROTATE_LEFT( &head, &sib, &elm, $field); &if ( &RB_RED_LEFT( &elm, $field)) &RB_FLIP_RIGHT( &sib, $field); &if ( &RB_RED_RIGHT( &elm, $field)) &RB_FLIP_LEFT( &parent, $field); &RB_BITS( &elm, $field) |= &RB_RED_MASK; &sib = &elm; } &RB_ROTATE_RIGHT( &head, &parent, &sib, $field); } &break; } &while (( &parent = &RB_PARENT( &elm, $field)) != &NULL); }); }' unless defined(&RB_GENERATE_REMOVE_COLOR); eval 'sub RB_GENERATE_REMOVE { my($name, $type, $field, $attr) = @_; eval q($attr \'struct type\' * $name &_RB_REMOVE(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &child, * &old, * &parent, * &right; &old = &elm; &parent = &RB_PARENT( &elm, $field); &right = &RB_RIGHT( &elm, $field); &if ( &RB_LEFT( &elm, $field) == &NULL) &elm = &child = &right; &else &if ( &right == &NULL) &elm = &child = &RB_LEFT( &elm, $field); &else { &if (( &child = &RB_LEFT( &right, $field)) == &NULL) { &child = &RB_RIGHT( &right, $field); &RB_RIGHT( &old, $field) = &child; &parent = &elm = &right; } &else { &do &elm = &child; &while (( &child = &RB_LEFT( &elm, $field)) != &NULL); &child = &RB_RIGHT( &elm, $field); &parent = &RB_PARENT( &elm, $field); &RB_LEFT( &parent, $field) = &child; &RB_SET_PARENT( &RB_RIGHT( &old, $field), &elm, $field); } &RB_SET_PARENT( &RB_LEFT( &old, $field), &elm, $field); ($elm->{field}) = ($old->{field}); } &RB_SWAP_CHILD( &head, &old, &elm, $field); &if ( &child != &NULL) &RB_SET_PARENT( &child, &parent, $field); &if ( &parent != &NULL) $name &_RB_REMOVE_COLOR( &head, &parent, &child); &while ( &parent != &NULL) { &RB_AUGMENT( &parent); &parent = &RB_PARENT( &parent, $field); } &return ( &old); }); }' unless defined(&RB_GENERATE_REMOVE); eval 'sub RB_GENERATE_INSERT { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr \'struct type\' * $name &_RB_INSERT(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &tmp; \'struct type\' * &parent = &NULL; \'int\' &comp = 0; &tmp = &RB_ROOT( &head); &while ( &tmp) { &parent = &tmp; &comp = ($cmp)( &elm, &parent); &if ( &comp < 0) &tmp = &RB_LEFT( &tmp, $field); &else &if ( &comp > 0) &tmp = &RB_RIGHT( &tmp, $field); &else &return ( &tmp); } &RB_SET( &elm, &parent, $field); &if ( &parent == &NULL) &RB_ROOT( &head) = &elm; &else &if ( &comp < 0) &RB_LEFT( &parent, $field) = &elm; &else &RB_RIGHT( &parent, $field) = &elm; $name &_RB_INSERT_COLOR( &head, &elm); &while ( &elm != &NULL) { &RB_AUGMENT( &elm); &elm = &RB_PARENT( &elm, $field); } &return ( &NULL); }); }' unless defined(&RB_GENERATE_INSERT); eval 'sub RB_GENERATE_FIND { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr \'struct type\' * $name &_RB_FIND(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &tmp = &RB_ROOT( &head); \'int\' ∁ &while ( &tmp) { &comp = $cmp( &elm, &tmp); &if ( &comp < 0) &tmp = &RB_LEFT( &tmp, $field); &else &if ( &comp > 0) &tmp = &RB_RIGHT( &tmp, $field); &else &return ( &tmp); } &return ( &NULL); }); }' unless defined(&RB_GENERATE_FIND); eval 'sub RB_GENERATE_NFIND { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr \'struct type\' * $name &_RB_NFIND(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &tmp = &RB_ROOT( &head); \'struct type\' * &res = &NULL; \'int\' ∁ &while ( &tmp) { &comp = $cmp( &elm, &tmp); &if ( &comp < 0) { &res = &tmp; &tmp = &RB_LEFT( &tmp, $field); } &else &if ( &comp > 0) &tmp = &RB_RIGHT( &tmp, $field); &else &return ( &tmp); } &return ( &res); }); }' unless defined(&RB_GENERATE_NFIND); eval 'sub RB_GENERATE_NEXT { my($name, $type, $field, $attr) = @_; eval q($attr \'struct type\' * $name &_RB_NEXT(\'struct type\' * &elm) { &if ( &RB_RIGHT( &elm, $field)) { &elm = &RB_RIGHT( &elm, $field); &while ( &RB_LEFT( &elm, $field)) &elm = &RB_LEFT( &elm, $field); } &else { &if ( &RB_PARENT( &elm, $field) && ( &elm == &RB_LEFT( &RB_PARENT( &elm, $field), $field))) &elm = &RB_PARENT( &elm, $field); &else { &while ( &RB_PARENT( &elm, $field) && ( &elm == &RB_RIGHT( &RB_PARENT( &elm, $field), $field))) &elm = &RB_PARENT( &elm, $field); &elm = &RB_PARENT( &elm, $field); } } &return ( &elm); }); }' unless defined(&RB_GENERATE_NEXT); eval 'sub RB_GENERATE_PREV { my($name, $type, $field, $attr) = @_; eval q($attr \'struct type\' * $name &_RB_PREV(\'struct type\' * &elm) { &if ( &RB_LEFT( &elm, $field)) { &elm = &RB_LEFT( &elm, $field); &while ( &RB_RIGHT( &elm, $field)) &elm = &RB_RIGHT( &elm, $field); } &else { &if ( &RB_PARENT( &elm, $field) && ( &elm == &RB_RIGHT( &RB_PARENT( &elm, $field), $field))) &elm = &RB_PARENT( &elm, $field); &else { &while ( &RB_PARENT( &elm, $field) && ( &elm == &RB_LEFT( &RB_PARENT( &elm, $field), $field))) &elm = &RB_PARENT( &elm, $field); &elm = &RB_PARENT( &elm, $field); } } &return ( &elm); }); }' unless defined(&RB_GENERATE_PREV); eval 'sub RB_GENERATE_MINMAX { my($name, $type, $field, $attr) = @_; eval q($attr \'struct type\' * $name &_RB_MINMAX(\'struct name\' * &head, \'int\' &val) { \'struct type\' * &tmp = &RB_ROOT( &head); \'struct type\' * &parent = &NULL; &while ( &tmp) { &parent = &tmp; &if ( &val < 0) &tmp = &RB_LEFT( &tmp, $field); &else &tmp = &RB_RIGHT( &tmp, $field); } &return ( &parent); }); }' unless defined(&RB_GENERATE_MINMAX); eval 'sub RB_GENERATE_REINSERT { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr \'struct type\' * $name &_RB_REINSERT(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &cmpelm; &if ((( &cmpelm = &RB_PREV($name, &head, &elm)) != &NULL && $cmp( &cmpelm, &elm) >= 0) || (( &cmpelm = &RB_NEXT($name, &head, &elm)) != &NULL && $cmp( &elm, &cmpelm) >= 0)) { &RB_REMOVE($name, &head, &elm); &return ( &RB_INSERT($name, &head, &elm)); } &return ( &NULL); }); }' unless defined(&RB_GENERATE_REINSERT); eval 'sub RB_NEGINF () {-1;}' unless defined(&RB_NEGINF); eval 'sub RB_INF () {1;}' unless defined(&RB_INF); eval 'sub RB_INSERT { my($name, $x, $y) = @_; eval q($name &_RB_INSERT($x, $y)); }' unless defined(&RB_INSERT); eval 'sub RB_REMOVE { my($name, $x, $y) = @_; eval q($name &_RB_REMOVE($x, $y)); }' unless defined(&RB_REMOVE); eval 'sub RB_FIND { my($name, $x, $y) = @_; eval q($name &_RB_FIND($x, $y)); }' unless defined(&RB_FIND); eval 'sub RB_NFIND { my($name, $x, $y) = @_; eval q($name &_RB_NFIND($x, $y)); }' unless defined(&RB_NFIND); eval 'sub RB_NEXT { my($name, $x, $y) = @_; eval q($name &_RB_NEXT($y)); }' unless defined(&RB_NEXT); eval 'sub RB_PREV { my($name, $x, $y) = @_; eval q($name &_RB_PREV($y)); }' unless defined(&RB_PREV); eval 'sub RB_MIN { my($name, $x) = @_; eval q($name &_RB_MINMAX($x, &RB_NEGINF)); }' unless defined(&RB_MIN); eval 'sub RB_MAX { my($name, $x) = @_; eval q($name &_RB_MINMAX($x, &RB_INF)); }' unless defined(&RB_MAX); eval 'sub RB_REINSERT { my($name, $x, $y) = @_; eval q($name &_RB_REINSERT($x, $y)); }' unless defined(&RB_REINSERT); eval 'sub RB_FOREACH { my($x, $name, $head) = @_; eval q( &for (($x) = &RB_MIN($name, $head); ($x) != &NULL; ($x) = $name &_RB_NEXT($x))); }' unless defined(&RB_FOREACH); eval 'sub RB_FOREACH_FROM { my($x, $name, $y) = @_; eval q( &for (($x) = ($y); (($x) != &NULL) && (($y) = $name &_RB_NEXT($x), ($x) != &NULL); ($x) = ($y))); }' unless defined(&RB_FOREACH_FROM); eval 'sub RB_FOREACH_SAFE { my($x, $name, $head, $y) = @_; eval q( &for (($x) = &RB_MIN($name, $head); (($x) != &NULL) && (($y) = $name &_RB_NEXT($x), ($x) != &NULL); ($x) = ($y))); }' unless defined(&RB_FOREACH_SAFE); eval 'sub RB_FOREACH_REVERSE { my($x, $name, $head) = @_; eval q( &for (($x) = &RB_MAX($name, $head); ($x) != &NULL; ($x) = $name &_RB_PREV($x))); }' unless defined(&RB_FOREACH_REVERSE); eval 'sub RB_FOREACH_REVERSE_FROM { my($x, $name, $y) = @_; eval q( &for (($x) = ($y); (($x) != &NULL) && (($y) = $name &_RB_PREV($x), ($x) != &NULL); ($x) = ($y))); }' unless defined(&RB_FOREACH_REVERSE_FROM); eval 'sub RB_FOREACH_REVERSE_SAFE { my($x, $name, $head, $y) = @_; eval q( &for (($x) = &RB_MAX($name, $head); (($x) != &NULL) && (($y) = $name &_RB_PREV($x), ($x) != &NULL); ($x) = ($y))); }' unless defined(&RB_FOREACH_REVERSE_SAFE); } 1;
Upload File
Create Folder