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: arb.ph
require '_h2ph_pre.ph'; no warnings qw(redefine misc); unless(defined(&_SYS_ARB_H_)) { eval 'sub _SYS_ARB_H_ () {1;}' unless defined(&_SYS_ARB_H_); require 'sys/cdefs.ph'; eval 'sub ARB_NULLIDX () {-1;}' unless defined(&ARB_NULLIDX); eval 'sub ARB_NULLCOL () {-1;}' unless defined(&ARB_NULLCOL); eval 'sub ARB_BLACK () {0;}' unless defined(&ARB_BLACK); eval 'sub ARB_RED () {1;}' unless defined(&ARB_RED); eval 'sub ARB_NEGINF () {-1;}' unless defined(&ARB_NEGINF); eval 'sub ARB_INF () {1;}' unless defined(&ARB_INF); eval 'sub ARB_HEAD { my($name, $type, $idxbits) = @_; eval q(\'struct name\' { \'int\'$idxbits &_t &arb_curnodes; \'int\'$idxbits &_t &arb_maxnodes; \'int\'$idxbits &_t &arb_root_idx; \'int\'$idxbits &_t &arb_free_idx; \'int\'$idxbits &_t &arb_min_idx; \'int\'$idxbits &_t &arb_max_idx; \'struct type\' $arb_nodes[]; }); }' unless defined(&ARB_HEAD); eval 'sub ARB8_HEAD { my($name, $type) = @_; eval q( &ARB_HEAD($name, $type, 8)); }' unless defined(&ARB8_HEAD); eval 'sub ARB16_HEAD { my($name, $type) = @_; eval q( &ARB_HEAD($name, $type, 16)); }' unless defined(&ARB16_HEAD); eval 'sub ARB32_HEAD { my($name, $type) = @_; eval q( &ARB_HEAD($name, $type, 32)); }' unless defined(&ARB32_HEAD); eval 'sub ARB_ALLOCSIZE { my($head, $maxn, $x) = @_; eval q(($sizeof{$head} + ($maxn) * $sizeof{$x})); }' unless defined(&ARB_ALLOCSIZE); eval 'sub ARB_INITIALIZER { my($name, $maxn) = @_; eval q(({ 0, $maxn, &ARB_NULLIDX, &ARB_NULLIDX, &ARB_NULLIDX, &ARB_NULLIDX })); }' unless defined(&ARB_INITIALIZER); eval 'sub ARB_INIT { my($x, $field, $head, $maxn) = @_; eval q(($head)-> &arb_curnodes = 0; ($head)-> &arb_maxnodes = ($maxn); ($head)-> &arb_root_idx = ($head)-> &arb_free_idx = ($head)-> &arb_min_idx = ($head)-> &arb_max_idx = &ARB_NULLIDX; &ARB_ARRFOREACH_REVWCOND($x, $field, $head, &ARB_RETURNFREE($head, $x, $field))); }' unless defined(&ARB_INIT); eval 'sub ARB_ENTRY { my($idxbits) = @_; eval q(\'struct struct\' { \'int\'$idxbits &_t &arbe_parent_idx; \'int\'$idxbits &_t &arbe_left_idx; \'int\'$idxbits &_t &arbe_right_idx; &int8_t &arbe_color; }); }' unless defined(&ARB_ENTRY); eval 'sub ARB8_ENTRY () { eval q( &ARB_ENTRY(8)); }' unless defined(&ARB8_ENTRY); eval 'sub ARB16_ENTRY () { eval q( &ARB_ENTRY(16)); }' unless defined(&ARB16_ENTRY); eval 'sub ARB32_ENTRY () { eval q( &ARB_ENTRY(32)); }' unless defined(&ARB32_ENTRY); eval 'sub ARB_ENTRYINIT { my($elm, $field) = @_; eval q( &do { ($elm)-> ($field->{arbe_parent_idx}) = ($elm)-> ($field->{arbe_left_idx}) = ($elm)-> ($field->{arbe_right_idx}) = &ARB_NULLIDX; ($elm)-> ($field->{arbe_color}) = &ARB_NULLCOL; } &while ( 0)); }' unless defined(&ARB_ENTRYINIT); eval 'sub ARB_ELMTYPE { my($head) = @_; eval q( &__typeof(($head)-> $arb_nodes[0])); }' unless defined(&ARB_ELMTYPE); eval 'sub ARB_NODES { my($head) = @_; eval q(($head)-> &arb_nodes); }' unless defined(&ARB_NODES); eval 'sub ARB_MAXNODES { my($head) = @_; eval q(($head)-> &arb_maxnodes); }' unless defined(&ARB_MAXNODES); eval 'sub ARB_CURNODES { my($head) = @_; eval q(($head)-> &arb_curnodes); }' unless defined(&ARB_CURNODES); eval 'sub ARB_EMPTY { my($head) = @_; eval q((($head)-> &arb_curnodes == 0)); }' unless defined(&ARB_EMPTY); eval 'sub ARB_FULL { my($head) = @_; eval q((($head)-> &arb_curnodes >= ($head)-> &arb_maxnodes)); }' unless defined(&ARB_FULL); eval 'sub ARB_CNODE { my($head, $idx) = @_; eval q((((( &intptr_t)($idx) <= &ARB_NULLIDX) || (($idx) >= &ARB_MAXNODES($head))) ? &NULL : (( &const &ARB_ELMTYPE($head))( &ARB_NODES($head) + ($idx))))); }' unless defined(&ARB_CNODE); eval 'sub ARB_NODE { my($head, $idx) = @_; eval q(( &__DECONST( &ARB_ELMTYPE($head), &ARB_CNODE($head, $idx)))); }' unless defined(&ARB_NODE); eval 'sub ARB_ROOT { my($head) = @_; eval q( &ARB_NODE($head, &ARB_ROOTIDX($head))); }' unless defined(&ARB_ROOT); eval 'sub ARB_LEFT { my($head, $elm, $field) = @_; eval q( &ARB_NODE($head, &ARB_LEFTIDX($elm, $field))); }' unless defined(&ARB_LEFT); eval 'sub ARB_RIGHT { my($head, $elm, $field) = @_; eval q( &ARB_NODE($head, &ARB_RIGHTIDX($elm, $field))); }' unless defined(&ARB_RIGHT); eval 'sub ARB_PARENT { my($head, $elm, $field) = @_; eval q( &ARB_NODE($head, &ARB_PARENTIDX($elm, $field))); }' unless defined(&ARB_PARENT); eval 'sub ARB_FREEIDX { my($head) = @_; eval q(($head)-> &arb_free_idx); }' unless defined(&ARB_FREEIDX); eval 'sub ARB_ROOTIDX { my($head) = @_; eval q(($head)-> &arb_root_idx); }' unless defined(&ARB_ROOTIDX); eval 'sub ARB_MINIDX { my($head) = @_; eval q(($head)-> &arb_min_idx); }' unless defined(&ARB_MINIDX); eval 'sub ARB_MAXIDX { my($head) = @_; eval q(($head)-> &arb_max_idx); }' unless defined(&ARB_MAXIDX); eval 'sub ARB_SELFIDX { my($head, $elm) = @_; eval q((($elm) ? (( &intptr_t)(((( &const &uint8_t *)($elm)) - (( &const &uint8_t *) &ARB_NODES($head))) / $sizeof{($elm)})) : ( &intptr_t) &ARB_NULLIDX)); }' unless defined(&ARB_SELFIDX); eval 'sub ARB_LEFTIDX { my($elm, $field) = @_; eval q(($elm)-> ($field->{arbe_left_idx})); }' unless defined(&ARB_LEFTIDX); eval 'sub ARB_RIGHTIDX { my($elm, $field) = @_; eval q(($elm)-> ($field->{arbe_right_idx})); }' unless defined(&ARB_RIGHTIDX); eval 'sub ARB_PARENTIDX { my($elm, $field) = @_; eval q(($elm)-> ($field->{arbe_parent_idx})); }' unless defined(&ARB_PARENTIDX); eval 'sub ARB_COLOR { my($elm, $field) = @_; eval q(($elm)-> ($field->{arbe_color})); }' unless defined(&ARB_COLOR); eval 'sub ARB_PREVFREE { my($head, $elm, $field) = @_; eval q( &ARB_NODE($head, &ARB_PREVFREEIDX($elm, $field))); }' unless defined(&ARB_PREVFREE); eval 'sub ARB_PREVFREEIDX { my($elm, $field) = @_; eval q( &ARB_LEFTIDX($elm, $field)); }' unless defined(&ARB_PREVFREEIDX); eval 'sub ARB_NEXTFREE { my($head, $elm, $field) = @_; eval q( &ARB_NODE($head, &ARB_NEXTFREEIDX($elm, $field))); }' unless defined(&ARB_NEXTFREE); eval 'sub ARB_NEXTFREEIDX { my($elm, $field) = @_; eval q( &ARB_RIGHTIDX($elm, $field)); }' unless defined(&ARB_NEXTFREEIDX); eval 'sub ARB_ISFREE { my($elm, $field) = @_; eval q(( &ARB_COLOR($elm, $field) == &ARB_NULLCOL)); }' unless defined(&ARB_ISFREE); eval 'sub ARB_SET { my($head, $elm, $parent, $field) = @_; eval q( &do { &ARB_PARENTIDX($elm, $field) = $parent ? &ARB_SELFIDX($head, $parent) : &ARB_NULLIDX; &ARB_LEFTIDX($elm, $field) = &ARB_RIGHTIDX($elm, $field) = &ARB_NULLIDX; &ARB_COLOR($elm, $field) = &ARB_RED; } &while ( 0)); }' unless defined(&ARB_SET); eval 'sub ARB_SET_BLACKRED { my($black, $red, $field) = @_; eval q( &do { &ARB_COLOR($black, $field) = &ARB_BLACK; &ARB_COLOR($red, $field) = &ARB_RED; } &while ( 0)); }' unless defined(&ARB_SET_BLACKRED); unless(defined(&ARB_AUGMENT)) { eval 'sub ARB_AUGMENT { my($x) = @_; eval q( &do {} &while (0)); }' unless defined(&ARB_AUGMENT); } eval 'sub ARB_ROTATE_LEFT { my($head, $elm, $tmp, $field) = @_; eval q( &do { &__typeof( &ARB_RIGHTIDX($elm, $field)) &_tmpidx; ($tmp) = &ARB_RIGHT($head, $elm, $field); &_tmpidx = &ARB_RIGHTIDX($elm, $field); &ARB_RIGHTIDX($elm, $field) = &ARB_LEFTIDX($tmp, $field); &if ( &ARB_RIGHTIDX($elm, $field) != &ARB_NULLIDX) { &ARB_PARENTIDX( &ARB_LEFT($head, $tmp, $field), $field) = &ARB_SELFIDX($head, $elm); } &ARB_AUGMENT($elm); &ARB_PARENTIDX($tmp, $field) = &ARB_PARENTIDX($elm, $field); &if ( &ARB_PARENTIDX($tmp, $field) != &ARB_NULLIDX) { &if ( &ARB_SELFIDX($head, $elm) == &ARB_LEFTIDX( &ARB_PARENT($head, $elm, $field), $field)) &ARB_LEFTIDX( &ARB_PARENT($head, $elm, $field), $field) = &_tmpidx; &else &ARB_RIGHTIDX( &ARB_PARENT($head, $elm, $field), $field) = &_tmpidx; } &else &ARB_ROOTIDX($head) = &_tmpidx; &ARB_LEFTIDX($tmp, $field) = &ARB_SELFIDX($head, $elm); &ARB_PARENTIDX($elm, $field) = &_tmpidx; &ARB_AUGMENT($tmp); &if ( &ARB_PARENTIDX($tmp, $field) != &ARB_NULLIDX) &ARB_AUGMENT( &ARB_PARENT($head, $tmp, $field)); } &while ( 0)); }' unless defined(&ARB_ROTATE_LEFT); eval 'sub ARB_ROTATE_RIGHT { my($head, $elm, $tmp, $field) = @_; eval q( &do { &__typeof( &ARB_LEFTIDX($elm, $field)) &_tmpidx; ($tmp) = &ARB_LEFT($head, $elm, $field); &_tmpidx = &ARB_LEFTIDX($elm, $field); &ARB_LEFTIDX($elm, $field) = &ARB_RIGHTIDX($tmp, $field); &if ( &ARB_LEFTIDX($elm, $field) != &ARB_NULLIDX) { &ARB_PARENTIDX( &ARB_RIGHT($head, $tmp, $field), $field) = &ARB_SELFIDX($head, $elm); } &ARB_AUGMENT($elm); &ARB_PARENTIDX($tmp, $field) = &ARB_PARENTIDX($elm, $field); &if ( &ARB_PARENTIDX($tmp, $field) != &ARB_NULLIDX) { &if ( &ARB_SELFIDX($head, $elm) == &ARB_LEFTIDX( &ARB_PARENT($head, $elm, $field), $field)) &ARB_LEFTIDX( &ARB_PARENT($head, $elm, $field), $field) = &_tmpidx; &else &ARB_RIGHTIDX( &ARB_PARENT($head, $elm, $field), $field) = &_tmpidx; } &else &ARB_ROOTIDX($head) = &_tmpidx; &ARB_RIGHTIDX($tmp, $field) = &ARB_SELFIDX($head, $elm); &ARB_PARENTIDX($elm, $field) = &_tmpidx; &ARB_AUGMENT($tmp); &if ( &ARB_PARENTIDX($tmp, $field) != &ARB_NULLIDX) &ARB_AUGMENT( &ARB_PARENT($head, $tmp, $field)); } &while ( 0)); }' unless defined(&ARB_ROTATE_RIGHT); eval 'sub ARB_RETURNFREE { my($head, $elm, $field) = @_; eval q(({ &ARB_COLOR($elm, $field) = &ARB_NULLCOL; &ARB_NEXTFREEIDX($elm, $field) = &ARB_FREEIDX($head); &ARB_FREEIDX($head) = &ARB_SELFIDX($head, $elm); $elm; })); }' unless defined(&ARB_RETURNFREE); eval 'sub ARB_GETFREEAT { my($head, $field, $fidx) = @_; eval q(({ &__typeof( &ARB_NODE($head, 0)) &_elm, &_prevelm; \'int\' &_idx = $fidx; &if ( &ARB_FREEIDX($head) == &ARB_NULLIDX && ! &ARB_FULL($head)) { &ARB_ARRFOREACH_REVERSE( &_elm, $field, $head) { &if ( &ARB_ISFREE( &_elm, $field)) &ARB_RETURNFREE($head, &_elm, $field); } } &_elm = &_prevelm = &ARB_NODE($head, &ARB_FREEIDX($head)); &for (; &_idx > 0 && &_elm != &NULL; &_idx--, &_prevelm = &_elm) &_elm = &ARB_NODE($head, &ARB_NEXTFREEIDX( &_elm, $field)); &if ( &_elm) { &if ($fidx == 0) &ARB_FREEIDX($head) = &ARB_NEXTFREEIDX( &_elm, $field); &else &ARB_NEXTFREEIDX( &_prevelm, $field) = &ARB_NEXTFREEIDX( &_elm, $field); } &_elm; })); }' unless defined(&ARB_GETFREEAT); eval 'sub ARB_GETFREE { my($head, $field) = @_; eval q( &ARB_GETFREEAT($head, $field, 0)); }' unless defined(&ARB_GETFREE); eval 'sub ARB_PROTOTYPE { my($name, $type, $field, $cmp) = @_; eval q( &ARB_PROTOTYPE_INTERNAL($name, $type, $field, $cmp,)); }' unless defined(&ARB_PROTOTYPE); eval 'sub ARB_PROTOTYPE_STATIC { my($name, $type, $field, $cmp) = @_; eval q( &ARB_PROTOTYPE_INTERNAL($name, $type, $field, $cmp, &__unused &static)); }' unless defined(&ARB_PROTOTYPE_STATIC); eval 'sub ARB_PROTOTYPE_INTERNAL { my($name, $type, $field, $cmp, $attr) = @_; eval q( &ARB_PROTOTYPE_INSERT_COLOR($name, $type, $attr); &ARB_PROTOTYPE_REMOVE_COLOR($name, $type, $attr); &ARB_PROTOTYPE_INSERT($name, $type, $attr); &ARB_PROTOTYPE_REMOVE($name, $type, $attr); &ARB_PROTOTYPE_CFIND($name, $type, $attr); &ARB_PROTOTYPE_FIND($name, $type, $attr); &ARB_PROTOTYPE_NFIND($name, $type, $attr); &ARB_PROTOTYPE_CNEXT($name, $type, $attr); &ARB_PROTOTYPE_NEXT($name, $type, $attr); &ARB_PROTOTYPE_CPREV($name, $type, $attr); &ARB_PROTOTYPE_PREV($name, $type, $attr); &ARB_PROTOTYPE_CMINMAX($name, $type, $attr); &ARB_PROTOTYPE_MINMAX($name, $type, $attr); &ARB_PROTOTYPE_REINSERT($name, $type, $attr);); }' unless defined(&ARB_PROTOTYPE_INTERNAL); eval 'sub ARB_PROTOTYPE_INSERT_COLOR { my($name, $type, $attr) = @_; eval q($attr &void $name &_ARB_INSERT_COLOR(\'struct name\' *, \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_INSERT_COLOR); eval 'sub ARB_PROTOTYPE_REMOVE_COLOR { my($name, $type, $attr) = @_; eval q($attr &void $name &_ARB_REMOVE_COLOR(\'struct name\' *, \'struct type\' *, \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_REMOVE_COLOR); eval 'sub ARB_PROTOTYPE_REMOVE { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_ARB_REMOVE(\'struct name\' *, \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_REMOVE); eval 'sub ARB_PROTOTYPE_INSERT { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_ARB_INSERT(\'struct name\' *, \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_INSERT); eval 'sub ARB_PROTOTYPE_CFIND { my($name, $type, $attr) = @_; eval q($attr &const \'struct type\' *$name &_ARB_CFIND( &const \'struct name\' *, &const \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_CFIND); eval 'sub ARB_PROTOTYPE_FIND { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_ARB_FIND( &const \'struct name\' *, &const \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_FIND); eval 'sub ARB_PROTOTYPE_NFIND { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_ARB_NFIND(\'struct name\' *, \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_NFIND); eval 'sub ARB_PROTOTYPE_CNFIND { my($name, $type, $attr) = @_; eval q($attr &const \'struct type\' *$name &_ARB_CNFIND( &const \'struct name\' *, &const \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_CNFIND); eval 'sub ARB_PROTOTYPE_CNEXT { my($name, $type, $attr) = @_; eval q($attr &const \'struct type\' *$name &_ARB_CNEXT( &const \'struct name\' * &head, &const \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_CNEXT); eval 'sub ARB_PROTOTYPE_NEXT { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_ARB_NEXT( &const \'struct name\' *, &const \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_NEXT); eval 'sub ARB_PROTOTYPE_CPREV { my($name, $type, $attr) = @_; eval q($attr &const \'struct type\' *$name &_ARB_CPREV( &const \'struct name\' *, &const \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_CPREV); eval 'sub ARB_PROTOTYPE_PREV { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_ARB_PREV( &const \'struct name\' *, &const \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_PREV); eval 'sub ARB_PROTOTYPE_CMINMAX { my($name, $type, $attr) = @_; eval q($attr &const \'struct type\' *$name &_ARB_CMINMAX( &const \'struct name\' *, \'int\')); }' unless defined(&ARB_PROTOTYPE_CMINMAX); eval 'sub ARB_PROTOTYPE_MINMAX { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_ARB_MINMAX( &const \'struct name\' *, \'int\')); }' unless defined(&ARB_PROTOTYPE_MINMAX); eval 'sub ARB_PROTOTYPE_REINSERT { my($name, $type, $attr) = @_; eval q($attr \'struct type\' *$name &_ARB_REINSERT(\'struct name\' *, \'struct type\' *)); }' unless defined(&ARB_PROTOTYPE_REINSERT); eval 'sub ARB_GENERATE { my($name, $type, $field, $cmp) = @_; eval q( &ARB_GENERATE_INTERNAL($name, $type, $field, $cmp,)); }' unless defined(&ARB_GENERATE); eval 'sub ARB_GENERATE_STATIC { my($name, $type, $field, $cmp) = @_; eval q( &ARB_GENERATE_INTERNAL($name, $type, $field, $cmp, &__unused &static)); }' unless defined(&ARB_GENERATE_STATIC); eval 'sub ARB_GENERATE_INTERNAL { my($name, $type, $field, $cmp, $attr) = @_; eval q( &ARB_GENERATE_INSERT_COLOR($name, $type, $field, $attr) &ARB_GENERATE_REMOVE_COLOR($name, $type, $field, $attr) &ARB_GENERATE_INSERT($name, $type, $field, $cmp, $attr) &ARB_GENERATE_REMOVE($name, $type, $field, $attr) &ARB_GENERATE_CFIND($name, $type, $field, $cmp, $attr) &ARB_GENERATE_FIND($name, $type, $field, $cmp, $attr) &ARB_GENERATE_CNEXT($name, $type, $field, $attr) &ARB_GENERATE_NEXT($name, $type, $field, $attr) &ARB_GENERATE_CPREV($name, $type, $field, $attr) &ARB_GENERATE_PREV($name, $type, $field, $attr) &ARB_GENERATE_CMINMAX($name, $type, $field, $attr) &ARB_GENERATE_MINMAX($name, $type, $field, $attr) &ARB_GENERATE_REINSERT($name, $type, $field, $cmp, $attr)); }' unless defined(&ARB_GENERATE_INTERNAL); eval 'sub ARB_GENERATE_INSERT_COLOR { my($name, $type, $field, $attr) = @_; eval q($attr &void $name &_ARB_INSERT_COLOR(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &parent, * &gparent, * &tmp; &while (( &parent = &ARB_PARENT( &head, &elm, $field)) != &NULL && &ARB_COLOR( &parent, $field) == &ARB_RED) { &gparent = &ARB_PARENT( &head, &parent, $field); &if ( &parent == &ARB_LEFT( &head, &gparent, $field)) { &tmp = &ARB_RIGHT( &head, &gparent, $field); &if ( &tmp && &ARB_COLOR( &tmp, $field) == &ARB_RED) { &ARB_COLOR( &tmp, $field) = &ARB_BLACK; &ARB_SET_BLACKRED( &parent, &gparent, $field); &elm = &gparent; &continue; } &if ( &ARB_RIGHT( &head, &parent, $field) == &elm) { &ARB_ROTATE_LEFT( &head, &parent, &tmp, $field); &tmp = &parent; &parent = &elm; &elm = &tmp; } &ARB_SET_BLACKRED( &parent, &gparent, $field); &ARB_ROTATE_RIGHT( &head, &gparent, &tmp, $field); } &else { &tmp = &ARB_LEFT( &head, &gparent, $field); &if ( &tmp && &ARB_COLOR( &tmp, $field) == &ARB_RED) { &ARB_COLOR( &tmp, $field) = &ARB_BLACK; &ARB_SET_BLACKRED( &parent, &gparent, $field); &elm = &gparent; &continue; } &if ( &ARB_LEFT( &head, &parent, $field) == &elm) { &ARB_ROTATE_RIGHT( &head, &parent, &tmp, $field); &tmp = &parent; &parent = &elm; &elm = &tmp; } &ARB_SET_BLACKRED( &parent, &gparent, $field); &ARB_ROTATE_LEFT( &head, &gparent, &tmp, $field); } } &ARB_COLOR( &ARB_ROOT( &head), $field) = &ARB_BLACK; }); }' unless defined(&ARB_GENERATE_INSERT_COLOR); eval 'sub ARB_GENERATE_REMOVE_COLOR { my($name, $type, $field, $attr) = @_; eval q($attr &void $name &_ARB_REMOVE_COLOR(\'struct name\' * &head, \'struct type\' * &parent, \'struct type\' * &elm) { \'struct type\' * &tmp; &while (( &elm == &NULL || &ARB_COLOR( &elm, $field) == &ARB_BLACK) && &elm != &ARB_ROOT( &head)) { &if ( &ARB_LEFT( &head, &parent, $field) == &elm) { &tmp = &ARB_RIGHT( &head, &parent, $field); &if ( &ARB_COLOR( &tmp, $field) == &ARB_RED) { &ARB_SET_BLACKRED( &tmp, &parent, $field); &ARB_ROTATE_LEFT( &head, &parent, &tmp, $field); &tmp = &ARB_RIGHT( &head, &parent, $field); } &if (( &ARB_LEFT( &head, &tmp, $field) == &NULL || &ARB_COLOR( &ARB_LEFT( &head, &tmp, $field), $field) == &ARB_BLACK) && ( &ARB_RIGHT( &head, &tmp, $field) == &NULL || &ARB_COLOR( &ARB_RIGHT( &head, &tmp, $field), $field) == &ARB_BLACK)) { &ARB_COLOR( &tmp, $field) = &ARB_RED; &elm = &parent; &parent = &ARB_PARENT( &head, &elm, $field); } &else { &if ( &ARB_RIGHT( &head, &tmp, $field) == &NULL || &ARB_COLOR( &ARB_RIGHT( &head, &tmp, $field), $field) == &ARB_BLACK) { \'struct type\' * &oleft; &if (( &oleft = &ARB_LEFT( &head, &tmp, $field)) != &NULL) &ARB_COLOR( &oleft, $field) = &ARB_BLACK; &ARB_COLOR( &tmp, $field) = &ARB_RED; &ARB_ROTATE_RIGHT( &head, &tmp, &oleft, $field); &tmp = &ARB_RIGHT( &head, &parent, $field); } &ARB_COLOR( &tmp, $field) = &ARB_COLOR( &parent, $field); &ARB_COLOR( &parent, $field) = &ARB_BLACK; &if ( &ARB_RIGHT( &head, &tmp, $field)) &ARB_COLOR( &ARB_RIGHT( &head, &tmp, $field), $field) = &ARB_BLACK; &ARB_ROTATE_LEFT( &head, &parent, &tmp, $field); &elm = &ARB_ROOT( &head); &break; } } &else { &tmp = &ARB_LEFT( &head, &parent, $field); &if ( &ARB_COLOR( &tmp, $field) == &ARB_RED) { &ARB_SET_BLACKRED( &tmp, &parent, $field); &ARB_ROTATE_RIGHT( &head, &parent, &tmp, $field); &tmp = &ARB_LEFT( &head, &parent, $field); } &if (( &ARB_LEFT( &head, &tmp, $field) == &NULL || &ARB_COLOR( &ARB_LEFT( &head, &tmp, $field), $field) == &ARB_BLACK) && ( &ARB_RIGHT( &head, &tmp, $field) == &NULL || &ARB_COLOR( &ARB_RIGHT( &head, &tmp, $field), $field) == &ARB_BLACK)) { &ARB_COLOR( &tmp, $field) = &ARB_RED; &elm = &parent; &parent = &ARB_PARENT( &head, &elm, $field); } &else { &if ( &ARB_LEFT( &head, &tmp, $field) == &NULL || &ARB_COLOR( &ARB_LEFT( &head, &tmp, $field), $field) == &ARB_BLACK) { \'struct type\' * &oright; &if (( &oright = &ARB_RIGHT( &head, &tmp, $field)) != &NULL) &ARB_COLOR( &oright, $field) = &ARB_BLACK; &ARB_COLOR( &tmp, $field) = &ARB_RED; &ARB_ROTATE_LEFT( &head, &tmp, &oright, $field); &tmp = &ARB_LEFT( &head, &parent, $field); } &ARB_COLOR( &tmp, $field) = &ARB_COLOR( &parent, $field); &ARB_COLOR( &parent, $field) = &ARB_BLACK; &if ( &ARB_LEFT( &head, &tmp, $field)) &ARB_COLOR( &ARB_LEFT( &head, &tmp, $field), $field) = &ARB_BLACK; &ARB_ROTATE_RIGHT( &head, &parent, &tmp, $field); &elm = &ARB_ROOT( &head); &break; } } } &if ( &elm) &ARB_COLOR( &elm, $field) = &ARB_BLACK; }); }' unless defined(&ARB_GENERATE_REMOVE_COLOR); eval 'sub ARB_GENERATE_REMOVE { my($name, $type, $field, $attr) = @_; eval q($attr \'struct type\' * $name &_ARB_REMOVE(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &child, * &parent, * &old = &elm; \'int\' &color; &if ( &ARB_LEFT( &head, &elm, $field) == &NULL) &child = &ARB_RIGHT( &head, &elm, $field); &else &if ( &ARB_RIGHT( &head, &elm, $field) == &NULL) &child = &ARB_LEFT( &head, &elm, $field); &else { \'struct type\' * &left; &elm = &ARB_RIGHT( &head, &elm, $field); &while (( &left = &ARB_LEFT( &head, &elm, $field)) != &NULL) &elm = &left; &child = &ARB_RIGHT( &head, &elm, $field); &parent = &ARB_PARENT( &head, &elm, $field); &color = &ARB_COLOR( &elm, $field); &if ( &child) &ARB_PARENTIDX( &child, $field) = &ARB_SELFIDX( &head, &parent); &if ( &parent) { &if ( &ARB_LEFT( &head, &parent, $field) == &elm) &ARB_LEFTIDX( &parent, $field) = &ARB_SELFIDX( &head, &child); &else &ARB_RIGHTIDX( &parent, $field) = &ARB_SELFIDX( &head, &child); &ARB_AUGMENT( &parent); } &else &ARB_ROOTIDX( &head) = &ARB_SELFIDX( &head, &child); &if ( &ARB_PARENT( &head, &elm, $field) == &old) &parent = &elm; ( &elm)->$field = ( &old)->$field; &if ( &ARB_PARENT( &head, &old, $field)) { &if ( &ARB_LEFT( &head, &ARB_PARENT( &head, &old, $field), $field) == &old) &ARB_LEFTIDX( &ARB_PARENT( &head, &old, $field), $field) = &ARB_SELFIDX( &head, &elm); &else &ARB_RIGHTIDX( &ARB_PARENT( &head, &old, $field), $field) = &ARB_SELFIDX( &head, &elm); &ARB_AUGMENT( &ARB_PARENT( &head, &old, $field)); } &else &ARB_ROOTIDX( &head) = &ARB_SELFIDX( &head, &elm); &ARB_PARENTIDX( &ARB_LEFT( &head, &old, $field), $field) = &ARB_SELFIDX( &head, &elm); &if ( &ARB_RIGHT( &head, &old, $field)) &ARB_PARENTIDX( &ARB_RIGHT( &head, &old, $field), $field) = &ARB_SELFIDX( &head, &elm); &if ( &parent) { &left = &parent; &do { &ARB_AUGMENT( &left); } &while (( &left = &ARB_PARENT( &head, &left, $field)) != &NULL); } &goto &color; } &parent = &ARB_PARENT( &head, &elm, $field); &color = &ARB_COLOR( &elm, $field); &if ( &child) &ARB_PARENTIDX( &child, $field) = &ARB_SELFIDX( &head, &parent); &if ( &parent) { &if ( &ARB_LEFT( &head, &parent, $field) == &elm) &ARB_LEFTIDX( &parent, $field) = &ARB_SELFIDX( &head, &child); &else &ARB_RIGHTIDX( &parent, $field) = &ARB_SELFIDX( &head, &child); &ARB_AUGMENT( &parent); } &else &ARB_ROOTIDX( &head) = &ARB_SELFIDX( &head, &child); &color: &if ( &color == &ARB_BLACK) $name &_ARB_REMOVE_COLOR( &head, &parent, &child); &ARB_CURNODES( &head) -= 1; &if ( &ARB_MINIDX( &head) == &ARB_SELFIDX( &head, &old)) &ARB_MINIDX( &head) = &ARB_PARENTIDX( &old, $field); &if ( &ARB_MAXIDX( &head) == &ARB_SELFIDX( &head, &old)) &ARB_MAXIDX( &head) = &ARB_PARENTIDX( &old, $field); &ARB_RETURNFREE( &head, &old, $field); &return ( &old); }); }' unless defined(&ARB_GENERATE_REMOVE); eval 'sub ARB_GENERATE_INSERT { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr \'struct type\' * $name &_ARB_INSERT(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &tmp; \'struct type\' * &parent = &NULL; \'int\' &comp = 0; &tmp = &ARB_ROOT( &head); &while ( &tmp) { &parent = &tmp; &comp = ($cmp)( &elm, &parent); &if ( &comp < 0) &tmp = &ARB_LEFT( &head, &tmp, $field); &else &if ( &comp > 0) &tmp = &ARB_RIGHT( &head, &tmp, $field); &else &return ( &tmp); } &ARB_SET( &head, &elm, &parent, $field); &if ( &parent != &NULL) { &if ( &comp < 0) &ARB_LEFTIDX( &parent, $field) = &ARB_SELFIDX( &head, &elm); &else &ARB_RIGHTIDX( &parent, $field) = &ARB_SELFIDX( &head, &elm); &ARB_AUGMENT( &parent); } &else &ARB_ROOTIDX( &head) = &ARB_SELFIDX( &head, &elm); $name &_ARB_INSERT_COLOR( &head, &elm); &ARB_CURNODES( &head) += 1; &if ( &ARB_MINIDX( &head) == &ARB_NULLIDX || ( &ARB_PARENTIDX( &elm, $field) == &ARB_MINIDX( &head) && &ARB_LEFTIDX( &parent, $field) == &ARB_SELFIDX( &head, &elm))) &ARB_MINIDX( &head) = &ARB_SELFIDX( &head, &elm); &if ( &ARB_MAXIDX( &head) == &ARB_NULLIDX || ( &ARB_PARENTIDX( &elm, $field) == &ARB_MAXIDX( &head) && &ARB_RIGHTIDX( &parent, $field) == &ARB_SELFIDX( &head, &elm))) &ARB_MAXIDX( &head) = &ARB_SELFIDX( &head, &elm); &return ( &NULL); }); }' unless defined(&ARB_GENERATE_INSERT); eval 'sub ARB_GENERATE_CFIND { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr &const \'struct type\' * $name &_ARB_CFIND( &const \'struct name\' * &head, &const \'struct type\' * &elm) { &const \'struct type\' * &tmp = &ARB_ROOT( &head); \'int\' ∁ &while ( &tmp) { &comp = $cmp( &elm, &tmp); &if ( &comp < 0) &tmp = &ARB_LEFT( &head, &tmp, $field); &else &if ( &comp > 0) &tmp = &ARB_RIGHT( &head, &tmp, $field); &else &return ( &tmp); } &return ( &NULL); }); }' unless defined(&ARB_GENERATE_CFIND); eval 'sub ARB_GENERATE_FIND { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr \'struct type\' * $name &_ARB_FIND( &const \'struct name\' * &head, &const \'struct type\' * &elm) { &return ( &__DECONST(\'struct type\' *, $name &_ARB_CFIND( &head, &elm))); }); }' unless defined(&ARB_GENERATE_FIND); eval 'sub ARB_GENERATE_CNFIND { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr &const \'struct type\' * $name &_ARB_CNFIND( &const \'struct name\' * &head, &const \'struct type\' * &elm) { &const \'struct type\' * &tmp = &ARB_ROOT( &head); &const \'struct type\' * &res = &NULL; \'int\' ∁ &while ( &tmp) { &comp = $cmp( &elm, &tmp); &if ( &comp < 0) { &res = &tmp; &tmp = &ARB_LEFT( &head, &tmp, $field); } &else &if ( &comp > 0) &tmp = &ARB_RIGHT( &head, &tmp, $field); &else &return ( &tmp); } &return ( &res); }); }' unless defined(&ARB_GENERATE_CNFIND); eval 'sub ARB_GENERATE_NFIND { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr \'struct type\' * $name &_ARB_NFIND( &const \'struct name\' * &head, &const \'struct type\' * &elm) { &return ( &__DECONST(\'struct type\' *, $name &_ARB_CNFIND( &head, &elm))); }); }' unless defined(&ARB_GENERATE_NFIND); eval 'sub ARB_GENERATE_CNEXT { my($name, $type, $field, $attr) = @_; eval q($attr &const \'struct type\' * $name &_ARB_CNEXT( &const \'struct name\' * &head, &const \'struct type\' * &elm) { &if ( &ARB_RIGHT( &head, &elm, $field)) { &elm = &ARB_RIGHT( &head, &elm, $field); &while ( &ARB_LEFT( &head, &elm, $field)) &elm = &ARB_LEFT( &head, &elm, $field); } &else { &if ( &ARB_PARENT( &head, &elm, $field) && ( &elm == &ARB_LEFT( &head, &ARB_PARENT( &head, &elm, $field), $field))) &elm = &ARB_PARENT( &head, &elm, $field); &else { &while ( &ARB_PARENT( &head, &elm, $field) && ( &elm == &ARB_RIGHT( &head, &ARB_PARENT( &head, &elm, $field), $field))) &elm = &ARB_PARENT( &head, &elm, $field); &elm = &ARB_PARENT( &head, &elm, $field); } } &return ( &elm); }); }' unless defined(&ARB_GENERATE_CNEXT); eval 'sub ARB_GENERATE_NEXT { my($name, $type, $field, $attr) = @_; eval q($attr \'struct type\' * $name &_ARB_NEXT( &const \'struct name\' * &head, &const \'struct type\' * &elm) { &return ( &__DECONST(\'struct type\' *, $name &_ARB_CNEXT( &head, &elm))); }); }' unless defined(&ARB_GENERATE_NEXT); eval 'sub ARB_GENERATE_CPREV { my($name, $type, $field, $attr) = @_; eval q($attr &const \'struct type\' * $name &_ARB_CPREV( &const \'struct name\' * &head, &const \'struct type\' * &elm) { &if ( &ARB_LEFT( &head, &elm, $field)) { &elm = &ARB_LEFT( &head, &elm, $field); &while ( &ARB_RIGHT( &head, &elm, $field)) &elm = &ARB_RIGHT( &head, &elm, $field); } &else { &if ( &ARB_PARENT( &head, &elm, $field) && ( &elm == &ARB_RIGHT( &head, &ARB_PARENT( &head, &elm, $field), $field))) &elm = &ARB_PARENT( &head, &elm, $field); &else { &while ( &ARB_PARENT( &head, &elm, $field) && ( &elm == &ARB_LEFT( &head, &ARB_PARENT( &head, &elm, $field), $field))) &elm = &ARB_PARENT( &head, &elm, $field); &elm = &ARB_PARENT( &head, &elm, $field); } } &return ( &elm); }); }' unless defined(&ARB_GENERATE_CPREV); eval 'sub ARB_GENERATE_PREV { my($name, $type, $field, $attr) = @_; eval q($attr \'struct type\' * $name &_ARB_PREV( &const \'struct name\' * &head, &const \'struct type\' * &elm) { &return ( &__DECONST(\'struct type\' *, $name &_ARB_CPREV( &head, &elm))); }); }' unless defined(&ARB_GENERATE_PREV); eval 'sub ARB_GENERATE_CMINMAX { my($name, $type, $field, $attr) = @_; eval q($attr &const \'struct type\' * $name &_ARB_CMINMAX( &const \'struct name\' * &head, \'int\' &val) { &const \'struct type\' * &tmp = &ARB_EMPTY( &head) ? &NULL : &ARB_ROOT( &head); &const \'struct type\' * &parent = &NULL; &while ( &tmp) { &parent = &tmp; &if ( &val < 0) &tmp = &ARB_LEFT( &head, &tmp, $field); &else &tmp = &ARB_RIGHT( &head, &tmp, $field); } &return ( &__DECONST(\'struct type\' *, &parent)); }); }' unless defined(&ARB_GENERATE_CMINMAX); eval 'sub ARB_GENERATE_MINMAX { my($name, $type, $field, $attr) = @_; eval q($attr \'struct type\' * $name &_ARB_MINMAX( &const \'struct name\' * &head, \'int\' &val) { &return ( &__DECONST(\'struct type\' *, $name &_ARB_CMINMAX( &head, &val))); }); }' unless defined(&ARB_GENERATE_MINMAX); eval 'sub ARB_GENERATE_REINSERT { my($name, $type, $field, $cmp, $attr) = @_; eval q($attr \'struct type\' * $name &_ARB_REINSERT(\'struct name\' * &head, \'struct type\' * &elm) { \'struct type\' * &cmpelm; &if ((( &cmpelm = &ARB_PREV($name, &head, &elm)) != &NULL && ($cmp)( &cmpelm, &elm) >= 0) || (( &cmpelm = &ARB_NEXT($name, &head, &elm)) != &NULL && ($cmp)( &elm, &cmpelm) >= 0)) { &ARB_REMOVE($name, &head, &elm); &elm = &ARB_GETFREE( &head, $field); &return ( &ARB_INSERT($name, &head, &elm)); } &return ( &NULL); }); }' unless defined(&ARB_GENERATE_REINSERT); eval 'sub ARB_INSERT { my($name, $x, $y) = @_; eval q($name &_ARB_INSERT($x, $y)); }' unless defined(&ARB_INSERT); eval 'sub ARB_REMOVE { my($name, $x, $y) = @_; eval q($name &_ARB_REMOVE($x, $y)); }' unless defined(&ARB_REMOVE); eval 'sub ARB_CFIND { my($name, $x, $y) = @_; eval q($name &_ARB_CFIND($x, $y)); }' unless defined(&ARB_CFIND); eval 'sub ARB_FIND { my($name, $x, $y) = @_; eval q($name &_ARB_FIND($x, $y)); }' unless defined(&ARB_FIND); eval 'sub ARB_CNFIND { my($name, $x, $y) = @_; eval q($name &_ARB_CNFIND($x, $y)); }' unless defined(&ARB_CNFIND); eval 'sub ARB_NFIND { my($name, $x, $y) = @_; eval q($name &_ARB_NFIND($x, $y)); }' unless defined(&ARB_NFIND); eval 'sub ARB_CNEXT { my($name, $x, $y) = @_; eval q($name &_ARB_CNEXT($x, $y)); }' unless defined(&ARB_CNEXT); eval 'sub ARB_NEXT { my($name, $x, $y) = @_; eval q($name &_ARB_NEXT($x, $y)); }' unless defined(&ARB_NEXT); eval 'sub ARB_CPREV { my($name, $x, $y) = @_; eval q($name &_ARB_CPREV($x, $y)); }' unless defined(&ARB_CPREV); eval 'sub ARB_PREV { my($name, $x, $y) = @_; eval q($name &_ARB_PREV($x, $y)); }' unless defined(&ARB_PREV); eval 'sub ARB_CMIN { my($name, $x) = @_; eval q(( &ARB_MINIDX($x) == &ARB_NULLIDX ? $name &_ARB_CMINMAX($x, &ARB_NEGINF) : &ARB_CNODE($x, &ARB_MINIDX($x)))); }' unless defined(&ARB_CMIN); eval 'sub ARB_MIN { my($name, $x) = @_; eval q(( &ARB_MINIDX($x) == &ARB_NULLIDX ? $name &_ARB_MINMAX($x, &ARB_NEGINF) : &ARB_NODE($x, &ARB_MINIDX($x)))); }' unless defined(&ARB_MIN); eval 'sub ARB_CMAX { my($name, $x) = @_; eval q(( &ARB_MAXIDX($x) == &ARB_NULLIDX ? $name &_ARB_CMINMAX($x, &ARB_INF) : &ARB_CNODE($x, &ARB_MAXIDX($x)))); }' unless defined(&ARB_CMAX); eval 'sub ARB_MAX { my($name, $x) = @_; eval q(( &ARB_MAXIDX($x) == &ARB_NULLIDX ? $name &_ARB_MINMAX($x, &ARB_INF) : &ARB_NODE($x, &ARB_MAXIDX($x)))); }' unless defined(&ARB_MAX); eval 'sub ARB_REINSERT { my($name, $x, $y) = @_; eval q($name &_ARB_REINSERT($x, $y)); }' unless defined(&ARB_REINSERT); eval 'sub ARB_FOREACH { my($x, $name, $head) = @_; eval q( &for (($x) = &ARB_MIN($name, $head); ($x) != &NULL; ($x) = $name &_ARB_NEXT($head, $x))); }' unless defined(&ARB_FOREACH); eval 'sub ARB_FOREACH_FROM { my($x, $name, $y) = @_; eval q( &for (($x) = ($y); (($x) != &NULL) && (($y) = $name &_ARB_NEXT($x), ($x) != &NULL); ($x) = ($y))); }' unless defined(&ARB_FOREACH_FROM); eval 'sub ARB_FOREACH_SAFE { my($x, $name, $head, $y) = @_; eval q( &for (($x) = &ARB_MIN($name, $head); (($x) != &NULL) && (($y) = $name &_ARB_NEXT($x), ($x) != &NULL); ($x) = ($y))); }' unless defined(&ARB_FOREACH_SAFE); eval 'sub ARB_FOREACH_REVERSE { my($x, $name, $head) = @_; eval q( &for (($x) = &ARB_MAX($name, $head); ($x) != &NULL; ($x) = $name &_ARB_PREV($x))); }' unless defined(&ARB_FOREACH_REVERSE); eval 'sub ARB_FOREACH_REVERSE_FROM { my($x, $name, $y) = @_; eval q( &for (($x) = ($y); (($x) != &NULL) && (($y) = $name &_ARB_PREV($x), ($x) != &NULL); ($x) = ($y))); }' unless defined(&ARB_FOREACH_REVERSE_FROM); eval 'sub ARB_FOREACH_REVERSE_SAFE { my($x, $name, $head, $y) = @_; eval q( &for (($x) = &ARB_MAX($name, $head); (($x) != &NULL) && (($y) = $name &_ARB_PREV($x), ($x) != &NULL); ($x) = ($y))); }' unless defined(&ARB_FOREACH_REVERSE_SAFE); eval 'sub ARB_ARRFOREACH { my($x, $field, $head) = @_; eval q( &for (($x) = &ARB_NODES($head); &ARB_SELFIDX($head, $x) < &ARB_MAXNODES($head); ($x)++)); }' unless defined(&ARB_ARRFOREACH); eval 'sub ARB_ARRFOREACH_REVWCOND { my($x, $field, $head, $extracond) = @_; eval q( &for (($x) = &ARB_NODES($head) + ( &ARB_MAXNODES($head) - 1); ($x) >= &ARB_NODES($head) && ($extracond); ($x)--)); }' unless defined(&ARB_ARRFOREACH_REVWCOND); eval 'sub ARB_ARRFOREACH_REVERSE { my($x, $field, $head) = @_; eval q( &ARB_ARRFOREACH_REVWCOND($x, $field, $head, 1)); }' unless defined(&ARB_ARRFOREACH_REVERSE); eval 'sub ARB_RESET_TREE { my($head, $name, $maxn) = @_; eval q(*($head) = &ARB_INITIALIZER($name, $maxn)); }' unless defined(&ARB_RESET_TREE); } 1;
Upload File
Create Folder