Current Path : /usr/local/lib/perl5/site_perl/5.8.9/mach/sys/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/local/lib/perl5/site_perl/5.8.9/mach/sys/queue.ph |
require '_h2ph_pre.ph'; no warnings 'redefine'; unless(defined(&_SYS_QUEUE_H_)) { eval 'sub _SYS_QUEUE_H_ () {1;}' unless defined(&_SYS_QUEUE_H_); require 'sys/cdefs.ph'; if(defined(&QUEUE_MACRO_DEBUG)) { eval 'sub TRACEBUF () {\'struct qm_trace\' &trace;;}' unless defined(&TRACEBUF); eval 'sub TRASHIT { my($x) = @_; eval q( &do {($x) = ( &void *)-1;} &while (0)); }' unless defined(&TRASHIT); eval 'sub QMD_SAVELINK { my($name, $link) = @_; eval q( &void **$name = ( &void *)($link)); }' unless defined(&QMD_SAVELINK); eval 'sub QMD_TRACE_HEAD { my($head) = @_; eval q( &do { ($head)-> ($trace->{prevline}) = ($head)-> ($trace->{lastline}); ($head)-> ($trace->{prevfile}) = ($head)-> ($trace->{lastfile}); ($head)-> ($trace->{lastline}) = &__LINE__; ($head)-> ($trace->{lastfile}) = &__FILE__; } &while (0)); }' unless defined(&QMD_TRACE_HEAD); eval 'sub QMD_TRACE_ELEM { my($elem) = @_; eval q( &do { ($elem)-> ($trace->{prevline}) = ($elem)-> ($trace->{lastline}); ($elem)-> ($trace->{prevfile}) = ($elem)-> ($trace->{lastfile}); ($elem)-> ($trace->{lastline}) = &__LINE__; ($elem)-> ($trace->{lastfile}) = &__FILE__; } &while (0)); }' unless defined(&QMD_TRACE_ELEM); } else { eval 'sub QMD_TRACE_ELEM { my($elem) = @_; eval q(); }' unless defined(&QMD_TRACE_ELEM); eval 'sub QMD_TRACE_HEAD { my($head) = @_; eval q(); }' unless defined(&QMD_TRACE_HEAD); eval 'sub QMD_SAVELINK { my($name, $link) = @_; eval q(); }' unless defined(&QMD_SAVELINK); eval 'sub TRACEBUF () {1;}' unless defined(&TRACEBUF); eval 'sub TRASHIT { my($x) = @_; eval q(); }' unless defined(&TRASHIT); } eval 'sub SLIST_HEAD { my($name, $type) = @_; eval q(\'struct name\' { \'struct type\' * &slh_first; }); }' unless defined(&SLIST_HEAD); eval 'sub SLIST_HEAD_INITIALIZER { my($head) = @_; eval q({ &NULL }); }' unless defined(&SLIST_HEAD_INITIALIZER); eval 'sub SLIST_ENTRY { my($type) = @_; eval q(\'struct struct\' { \'struct type\' * &sle_next; }); }' unless defined(&SLIST_ENTRY); eval 'sub SLIST_EMPTY { my($head) = @_; eval q((($head)-> &slh_first == &NULL)); }' unless defined(&SLIST_EMPTY); eval 'sub SLIST_FIRST { my($head) = @_; eval q((($head)-> &slh_first)); }' unless defined(&SLIST_FIRST); eval 'sub SLIST_FOREACH { my($var, $head, $field) = @_; eval q( &for (($var) = &SLIST_FIRST(($head)); ($var); ($var) = &SLIST_NEXT(($var), $field))); }' unless defined(&SLIST_FOREACH); eval 'sub SLIST_FOREACH_SAFE { my($var, $head, $field, $tvar) = @_; eval q( &for (($var) = &SLIST_FIRST(($head)); ($var) && (($tvar) = &SLIST_NEXT(($var), $field), 1); ($var) = ($tvar))); }' unless defined(&SLIST_FOREACH_SAFE); eval 'sub SLIST_FOREACH_PREVPTR { my($var, $varp, $head, $field) = @_; eval q( &for (($varp) = &SLIST_FIRST(($head)); (($var) = *($varp)) != &NULL; ($varp) = &SLIST_NEXT(($var), $field))); }' unless defined(&SLIST_FOREACH_PREVPTR); eval 'sub SLIST_INIT { my($head) = @_; eval q( &do { &SLIST_FIRST(($head)) = &NULL; } &while (0)); }' unless defined(&SLIST_INIT); eval 'sub SLIST_INSERT_AFTER { my($slistelm, $elm, $field) = @_; eval q( &do { &SLIST_NEXT(($elm), $field) = &SLIST_NEXT(($slistelm), $field); &SLIST_NEXT(($slistelm), $field) = ($elm); } &while (0)); }' unless defined(&SLIST_INSERT_AFTER); eval 'sub SLIST_INSERT_HEAD { my($head, $elm, $field) = @_; eval q( &do { &SLIST_NEXT(($elm), $field) = &SLIST_FIRST(($head)); &SLIST_FIRST(($head)) = ($elm); } &while (0)); }' unless defined(&SLIST_INSERT_HEAD); eval 'sub SLIST_NEXT { my($elm, $field) = @_; eval q((($elm)-> ($field->{sle_next}))); }' unless defined(&SLIST_NEXT); eval 'sub SLIST_REMOVE { my($head, $elm, $type, $field) = @_; eval q( &do { &QMD_SAVELINK( &oldnext, ($elm)-> ($field->{sle_next})); &if ( &SLIST_FIRST(($head)) == ($elm)) { &SLIST_REMOVE_HEAD(($head), $field); } &else { \'struct type\' * &curelm = &SLIST_FIRST(($head)); &while ( &SLIST_NEXT( &curelm, $field) != ($elm)) &curelm = &SLIST_NEXT( &curelm, $field); &SLIST_REMOVE_AFTER( &curelm, $field); } &TRASHIT(* &oldnext); } &while (0)); }' unless defined(&SLIST_REMOVE); eval 'sub SLIST_REMOVE_AFTER { my($elm, $field) = @_; eval q( &do { &SLIST_NEXT($elm, $field) = &SLIST_NEXT( &SLIST_NEXT($elm, $field), $field); } &while (0)); }' unless defined(&SLIST_REMOVE_AFTER); eval 'sub SLIST_REMOVE_HEAD { my($head, $field) = @_; eval q( &do { &SLIST_FIRST(($head)) = &SLIST_NEXT( &SLIST_FIRST(($head)), $field); } &while (0)); }' unless defined(&SLIST_REMOVE_HEAD); eval 'sub SLIST_SWAP { my($head1, $head2, $type) = @_; eval q( &do { \'struct type\' * &swap_first = &SLIST_FIRST($head1); &SLIST_FIRST($head1) = &SLIST_FIRST($head2); &SLIST_FIRST($head2) = &swap_first; } &while (0)); }' unless defined(&SLIST_SWAP); eval 'sub STAILQ_HEAD { my($name, $type) = @_; eval q(\'struct name\' { \'struct type\' * &stqh_first; \'struct type\' ** &stqh_last; }); }' unless defined(&STAILQ_HEAD); eval 'sub STAILQ_HEAD_INITIALIZER { my($head) = @_; eval q({ &NULL, ($head). &stqh_first }); }' unless defined(&STAILQ_HEAD_INITIALIZER); eval 'sub STAILQ_ENTRY { my($type) = @_; eval q(\'struct struct\' { \'struct type\' * &stqe_next; }); }' unless defined(&STAILQ_ENTRY); eval 'sub STAILQ_CONCAT { my($head1, $head2) = @_; eval q( &do { &if (! &STAILQ_EMPTY(($head2))) { *($head1)-> &stqh_last = ($head2)-> &stqh_first; ($head1)-> &stqh_last = ($head2)-> &stqh_last; &STAILQ_INIT(($head2)); } } &while (0)); }' unless defined(&STAILQ_CONCAT); eval 'sub STAILQ_EMPTY { my($head) = @_; eval q((($head)-> &stqh_first == &NULL)); }' unless defined(&STAILQ_EMPTY); eval 'sub STAILQ_FIRST { my($head) = @_; eval q((($head)-> &stqh_first)); }' unless defined(&STAILQ_FIRST); eval 'sub STAILQ_FOREACH { my($var, $head, $field) = @_; eval q( &for(($var) = &STAILQ_FIRST(($head)); ($var); ($var) = &STAILQ_NEXT(($var), $field))); }' unless defined(&STAILQ_FOREACH); eval 'sub STAILQ_FOREACH_SAFE { my($var, $head, $field, $tvar) = @_; eval q( &for (($var) = &STAILQ_FIRST(($head)); ($var) && (($tvar) = &STAILQ_NEXT(($var), $field), 1); ($var) = ($tvar))); }' unless defined(&STAILQ_FOREACH_SAFE); eval 'sub STAILQ_INIT { my($head) = @_; eval q( &do { &STAILQ_FIRST(($head)) = &NULL; ($head)-> &stqh_last = &STAILQ_FIRST(($head)); } &while (0)); }' unless defined(&STAILQ_INIT); eval 'sub STAILQ_INSERT_AFTER { my($head, $tqelm, $elm, $field) = @_; eval q( &do { &if (( &STAILQ_NEXT(($elm), $field) = &STAILQ_NEXT(($tqelm), $field)) == &NULL) ($head)-> &stqh_last = &STAILQ_NEXT(($elm), $field); &STAILQ_NEXT(($tqelm), $field) = ($elm); } &while (0)); }' unless defined(&STAILQ_INSERT_AFTER); eval 'sub STAILQ_INSERT_HEAD { my($head, $elm, $field) = @_; eval q( &do { &if (( &STAILQ_NEXT(($elm), $field) = &STAILQ_FIRST(($head))) == &NULL) ($head)-> &stqh_last = &STAILQ_NEXT(($elm), $field); &STAILQ_FIRST(($head)) = ($elm); } &while (0)); }' unless defined(&STAILQ_INSERT_HEAD); eval 'sub STAILQ_INSERT_TAIL { my($head, $elm, $field) = @_; eval q( &do { &STAILQ_NEXT(($elm), $field) = &NULL; *($head)-> &stqh_last = ($elm); ($head)-> &stqh_last = &STAILQ_NEXT(($elm), $field); } &while (0)); }' unless defined(&STAILQ_INSERT_TAIL); eval 'sub STAILQ_LAST { my($head, $type, $field) = @_; eval q(( &STAILQ_EMPTY(($head)) ? &NULL : (( &void *) ((($head)-> &stqh_last) - &__offsetof(\'struct type\', $field))))); }' unless defined(&STAILQ_LAST); eval 'sub STAILQ_NEXT { my($elm, $field) = @_; eval q((($elm)-> ($field->{stqe_next}))); }' unless defined(&STAILQ_NEXT); eval 'sub STAILQ_REMOVE { my($head, $elm, $type, $field) = @_; eval q( &do { &QMD_SAVELINK( &oldnext, ($elm)-> ($field->{stqe_next})); &if ( &STAILQ_FIRST(($head)) == ($elm)) { &STAILQ_REMOVE_HEAD(($head), $field); } &else { \'struct type\' * &curelm = &STAILQ_FIRST(($head)); &while ( &STAILQ_NEXT( &curelm, $field) != ($elm)) &curelm = &STAILQ_NEXT( &curelm, $field); &STAILQ_REMOVE_AFTER($head, &curelm, $field); } &TRASHIT(* &oldnext); } &while (0)); }' unless defined(&STAILQ_REMOVE); eval 'sub STAILQ_REMOVE_AFTER { my($head, $elm, $field) = @_; eval q( &do { &if (( &STAILQ_NEXT($elm, $field) = &STAILQ_NEXT( &STAILQ_NEXT($elm, $field), $field)) == &NULL) ($head)-> &stqh_last = &STAILQ_NEXT(($elm), $field); } &while (0)); }' unless defined(&STAILQ_REMOVE_AFTER); eval 'sub STAILQ_REMOVE_HEAD { my($head, $field) = @_; eval q( &do { &if (( &STAILQ_FIRST(($head)) = &STAILQ_NEXT( &STAILQ_FIRST(($head)), $field)) == &NULL) ($head)-> &stqh_last = &STAILQ_FIRST(($head)); } &while (0)); }' unless defined(&STAILQ_REMOVE_HEAD); eval 'sub STAILQ_SWAP { my($head1, $head2, $type) = @_; eval q( &do { \'struct type\' * &swap_first = &STAILQ_FIRST($head1); \'struct type\' ** &swap_last = ($head1)-> &stqh_last; &STAILQ_FIRST($head1) = &STAILQ_FIRST($head2); ($head1)-> &stqh_last = ($head2)-> &stqh_last; &STAILQ_FIRST($head2) = &swap_first; ($head2)-> &stqh_last = &swap_last; &if ( &STAILQ_EMPTY($head1)) ($head1)-> &stqh_last = &STAILQ_FIRST($head1); &if ( &STAILQ_EMPTY($head2)) ($head2)-> &stqh_last = &STAILQ_FIRST($head2); } &while (0)); }' unless defined(&STAILQ_SWAP); eval 'sub LIST_HEAD { my($name, $type) = @_; eval q(\'struct name\' { \'struct type\' * &lh_first; }); }' unless defined(&LIST_HEAD); eval 'sub LIST_HEAD_INITIALIZER { my($head) = @_; eval q({ &NULL }); }' unless defined(&LIST_HEAD_INITIALIZER); eval 'sub LIST_ENTRY { my($type) = @_; eval q(\'struct struct\' { \'struct type\' * &le_next; \'struct type\' ** &le_prev; }); }' unless defined(&LIST_ENTRY); if((defined( &_KERNEL) && defined( &INVARIANTS))) { eval 'sub QMD_LIST_CHECK_HEAD { my($head, $field) = @_; eval q( &do { &if ( &LIST_FIRST(($head)) != &NULL && &LIST_FIRST(($head))-> ($field->{le_prev}) != &LIST_FIRST(($head))) &panic(\\"Bad list head %p first->prev != head\\", ($head)); } &while (0)); }' unless defined(&QMD_LIST_CHECK_HEAD); eval 'sub QMD_LIST_CHECK_NEXT { my($elm, $field) = @_; eval q( &do { &if ( &LIST_NEXT(($elm), $field) != &NULL && &LIST_NEXT(($elm), $field)-> ($field->{le_prev}) != (($elm)-> ($field->{le_next}))) &panic(\\"Bad link elm %p next->prev != elm\\", ($elm)); } &while (0)); }' unless defined(&QMD_LIST_CHECK_NEXT); eval 'sub QMD_LIST_CHECK_PREV { my($elm, $field) = @_; eval q( &do { &if (*($elm)-> ($field->{le_prev}) != ($elm)) &panic(\\"Bad link elm %p prev->next != elm\\", ($elm)); } &while (0)); }' unless defined(&QMD_LIST_CHECK_PREV); } else { eval 'sub QMD_LIST_CHECK_HEAD { my($head, $field) = @_; eval q(); }' unless defined(&QMD_LIST_CHECK_HEAD); eval 'sub QMD_LIST_CHECK_NEXT { my($elm, $field) = @_; eval q(); }' unless defined(&QMD_LIST_CHECK_NEXT); eval 'sub QMD_LIST_CHECK_PREV { my($elm, $field) = @_; eval q(); }' unless defined(&QMD_LIST_CHECK_PREV); } eval 'sub LIST_EMPTY { my($head) = @_; eval q((($head)-> &lh_first == &NULL)); }' unless defined(&LIST_EMPTY); eval 'sub LIST_FIRST { my($head) = @_; eval q((($head)-> &lh_first)); }' unless defined(&LIST_FIRST); eval 'sub LIST_FOREACH { my($var, $head, $field) = @_; eval q( &for (($var) = &LIST_FIRST(($head)); ($var); ($var) = &LIST_NEXT(($var), $field))); }' unless defined(&LIST_FOREACH); eval 'sub LIST_FOREACH_SAFE { my($var, $head, $field, $tvar) = @_; eval q( &for (($var) = &LIST_FIRST(($head)); ($var) && (($tvar) = &LIST_NEXT(($var), $field), 1); ($var) = ($tvar))); }' unless defined(&LIST_FOREACH_SAFE); eval 'sub LIST_INIT { my($head) = @_; eval q( &do { &LIST_FIRST(($head)) = &NULL; } &while (0)); }' unless defined(&LIST_INIT); eval 'sub LIST_INSERT_AFTER { my($listelm, $elm, $field) = @_; eval q( &do { &QMD_LIST_CHECK_NEXT($listelm, $field); &if (( &LIST_NEXT(($elm), $field) = &LIST_NEXT(($listelm), $field)) != &NULL) &LIST_NEXT(($listelm), $field)-> ($field->{le_prev}) = &LIST_NEXT(($elm), $field); &LIST_NEXT(($listelm), $field) = ($elm); ($elm)-> ($field->{le_prev}) = &LIST_NEXT(($listelm), $field); } &while (0)); }' unless defined(&LIST_INSERT_AFTER); eval 'sub LIST_INSERT_BEFORE { my($listelm, $elm, $field) = @_; eval q( &do { &QMD_LIST_CHECK_PREV($listelm, $field); ($elm)-> ($field->{le_prev}) = ($listelm)-> ($field->{le_prev}); &LIST_NEXT(($elm), $field) = ($listelm); *($listelm)-> ($field->{le_prev}) = ($elm); ($listelm)-> ($field->{le_prev}) = &LIST_NEXT(($elm), $field); } &while (0)); }' unless defined(&LIST_INSERT_BEFORE); eval 'sub LIST_INSERT_HEAD { my($head, $elm, $field) = @_; eval q( &do { &QMD_LIST_CHECK_HEAD(($head), $field); &if (( &LIST_NEXT(($elm), $field) = &LIST_FIRST(($head))) != &NULL) &LIST_FIRST(($head))-> ($field->{le_prev}) = &LIST_NEXT(($elm), $field); &LIST_FIRST(($head)) = ($elm); ($elm)-> ($field->{le_prev}) = &LIST_FIRST(($head)); } &while (0)); }' unless defined(&LIST_INSERT_HEAD); eval 'sub LIST_NEXT { my($elm, $field) = @_; eval q((($elm)-> ($field->{le_next}))); }' unless defined(&LIST_NEXT); eval 'sub LIST_REMOVE { my($elm, $field) = @_; eval q( &do { &QMD_SAVELINK( &oldnext, ($elm)-> ($field->{le_next})); &QMD_SAVELINK( &oldprev, ($elm)-> ($field->{le_prev})); &QMD_LIST_CHECK_NEXT($elm, $field); &QMD_LIST_CHECK_PREV($elm, $field); &if ( &LIST_NEXT(($elm), $field) != &NULL) &LIST_NEXT(($elm), $field)-> ($field->{le_prev}) = ($elm)-> ($field->{le_prev}); *($elm)-> ($field->{le_prev}) = &LIST_NEXT(($elm), $field); &TRASHIT(* &oldnext); &TRASHIT(* &oldprev); } &while (0)); }' unless defined(&LIST_REMOVE); eval 'sub LIST_SWAP { my($head1, $head2, $type, $field) = @_; eval q( &do { \'struct type\' * &swap_tmp = &LIST_FIRST(($head1)); &LIST_FIRST(($head1)) = &LIST_FIRST(($head2)); &LIST_FIRST(($head2)) = &swap_tmp; &if (( &swap_tmp = &LIST_FIRST(($head1))) != &NULL) ($swap_tmp->{field}->{le_prev}) = &LIST_FIRST(($head1)); &if (( &swap_tmp = &LIST_FIRST(($head2))) != &NULL) ($swap_tmp->{field}->{le_prev}) = &LIST_FIRST(($head2)); } &while (0)); }' unless defined(&LIST_SWAP); eval 'sub TAILQ_HEAD { my($name, $type) = @_; eval q(\'struct name\' { \'struct type\' * &tqh_first; \'struct type\' ** &tqh_last; &TRACEBUF }); }' unless defined(&TAILQ_HEAD); eval 'sub TAILQ_HEAD_INITIALIZER { my($head) = @_; eval q({ &NULL, ($head). &tqh_first }); }' unless defined(&TAILQ_HEAD_INITIALIZER); eval 'sub TAILQ_ENTRY { my($type) = @_; eval q(\'struct struct\' { \'struct type\' * &tqe_next; \'struct type\' ** &tqe_prev; &TRACEBUF }); }' unless defined(&TAILQ_ENTRY); if((defined( &_KERNEL) && defined( &INVARIANTS))) { eval 'sub QMD_TAILQ_CHECK_HEAD { my($head, $field) = @_; eval q( &do { &if (! &TAILQ_EMPTY($head) && &TAILQ_FIRST(($head))-> ($field->{tqe_prev}) != &TAILQ_FIRST(($head))) &panic(\\"Bad tailq head %p first->prev != head\\", ($head)); } &while (0)); }' unless defined(&QMD_TAILQ_CHECK_HEAD); eval 'sub QMD_TAILQ_CHECK_TAIL { my($head, $field) = @_; eval q( &do { &if (*($head)-> &tqh_last != &NULL) &panic(\\"Bad tailq NEXT(%p->tqh_last) != NULL\\", ($head)); } &while (0)); }' unless defined(&QMD_TAILQ_CHECK_TAIL); eval 'sub QMD_TAILQ_CHECK_NEXT { my($elm, $field) = @_; eval q( &do { &if ( &TAILQ_NEXT(($elm), $field) != &NULL && &TAILQ_NEXT(($elm), $field)-> ($field->{tqe_prev}) != (($elm)-> ($field->{tqe_next}))) &panic(\\"Bad link elm %p next->prev != elm\\", ($elm)); } &while (0)); }' unless defined(&QMD_TAILQ_CHECK_NEXT); eval 'sub QMD_TAILQ_CHECK_PREV { my($elm, $field) = @_; eval q( &do { &if (*($elm)-> ($field->{tqe_prev}) != ($elm)) &panic(\\"Bad link elm %p prev->next != elm\\", ($elm)); } &while (0)); }' unless defined(&QMD_TAILQ_CHECK_PREV); } else { eval 'sub QMD_TAILQ_CHECK_HEAD { my($head, $field) = @_; eval q(); }' unless defined(&QMD_TAILQ_CHECK_HEAD); eval 'sub QMD_TAILQ_CHECK_TAIL { my($head, $headname) = @_; eval q(); }' unless defined(&QMD_TAILQ_CHECK_TAIL); eval 'sub QMD_TAILQ_CHECK_NEXT { my($elm, $field) = @_; eval q(); }' unless defined(&QMD_TAILQ_CHECK_NEXT); eval 'sub QMD_TAILQ_CHECK_PREV { my($elm, $field) = @_; eval q(); }' unless defined(&QMD_TAILQ_CHECK_PREV); } eval 'sub TAILQ_CONCAT { my($head1, $head2, $field) = @_; eval q( &do { &if (! &TAILQ_EMPTY($head2)) { *($head1)-> &tqh_last = ($head2)-> &tqh_first; ($head2)-> ($tqh_first->{field}->{tqe_prev}) = ($head1)-> &tqh_last; ($head1)-> &tqh_last = ($head2)-> &tqh_last; &TAILQ_INIT(($head2)); &QMD_TRACE_HEAD($head1); &QMD_TRACE_HEAD($head2); } } &while (0)); }' unless defined(&TAILQ_CONCAT); eval 'sub TAILQ_EMPTY { my($head) = @_; eval q((($head)-> &tqh_first == &NULL)); }' unless defined(&TAILQ_EMPTY); eval 'sub TAILQ_FIRST { my($head) = @_; eval q((($head)-> &tqh_first)); }' unless defined(&TAILQ_FIRST); eval 'sub TAILQ_FOREACH { my($var, $head, $field) = @_; eval q( &for (($var) = &TAILQ_FIRST(($head)); ($var); ($var) = &TAILQ_NEXT(($var), $field))); }' unless defined(&TAILQ_FOREACH); eval 'sub TAILQ_FOREACH_SAFE { my($var, $head, $field, $tvar) = @_; eval q( &for (($var) = &TAILQ_FIRST(($head)); ($var) && (($tvar) = &TAILQ_NEXT(($var), $field), 1); ($var) = ($tvar))); }' unless defined(&TAILQ_FOREACH_SAFE); eval 'sub TAILQ_FOREACH_REVERSE { my($var, $head, $headname, $field) = @_; eval q( &for (($var) = &TAILQ_LAST(($head), $headname); ($var); ($var) = &TAILQ_PREV(($var), $headname, $field))); }' unless defined(&TAILQ_FOREACH_REVERSE); eval 'sub TAILQ_FOREACH_REVERSE_SAFE { my($var, $head, $headname, $field, $tvar) = @_; eval q( &for (($var) = &TAILQ_LAST(($head), $headname); ($var) && (($tvar) = &TAILQ_PREV(($var), $headname, $field), 1); ($var) = ($tvar))); }' unless defined(&TAILQ_FOREACH_REVERSE_SAFE); eval 'sub TAILQ_INIT { my($head) = @_; eval q( &do { &TAILQ_FIRST(($head)) = &NULL; ($head)-> &tqh_last = &TAILQ_FIRST(($head)); &QMD_TRACE_HEAD($head); } &while (0)); }' unless defined(&TAILQ_INIT); eval 'sub TAILQ_INSERT_AFTER { my($head, $listelm, $elm, $field) = @_; eval q( &do { &QMD_TAILQ_CHECK_NEXT($listelm, $field); &if (( &TAILQ_NEXT(($elm), $field) = &TAILQ_NEXT(($listelm), $field)) != &NULL) &TAILQ_NEXT(($elm), $field)-> ($field->{tqe_prev}) = &TAILQ_NEXT(($elm), $field); &else { ($head)-> &tqh_last = &TAILQ_NEXT(($elm), $field); &QMD_TRACE_HEAD($head); } &TAILQ_NEXT(($listelm), $field) = ($elm); ($elm)-> ($field->{tqe_prev}) = &TAILQ_NEXT(($listelm), $field); &QMD_TRACE_ELEM(($elm)->$field); &QMD_TRACE_ELEM( ($listelm->{field})); } &while (0)); }' unless defined(&TAILQ_INSERT_AFTER); eval 'sub TAILQ_INSERT_BEFORE { my($listelm, $elm, $field) = @_; eval q( &do { &QMD_TAILQ_CHECK_PREV($listelm, $field); ($elm)-> ($field->{tqe_prev}) = ($listelm)-> ($field->{tqe_prev}); &TAILQ_NEXT(($elm), $field) = ($listelm); *($listelm)-> ($field->{tqe_prev}) = ($elm); ($listelm)-> ($field->{tqe_prev}) = &TAILQ_NEXT(($elm), $field); &QMD_TRACE_ELEM(($elm)->$field); &QMD_TRACE_ELEM( ($listelm->{field})); } &while (0)); }' unless defined(&TAILQ_INSERT_BEFORE); eval 'sub TAILQ_INSERT_HEAD { my($head, $elm, $field) = @_; eval q( &do { &QMD_TAILQ_CHECK_HEAD($head, $field); &if (( &TAILQ_NEXT(($elm), $field) = &TAILQ_FIRST(($head))) != &NULL) &TAILQ_FIRST(($head))-> ($field->{tqe_prev}) = &TAILQ_NEXT(($elm), $field); &else ($head)-> &tqh_last = &TAILQ_NEXT(($elm), $field); &TAILQ_FIRST(($head)) = ($elm); ($elm)-> ($field->{tqe_prev}) = &TAILQ_FIRST(($head)); &QMD_TRACE_HEAD($head); &QMD_TRACE_ELEM(($elm)->$field); } &while (0)); }' unless defined(&TAILQ_INSERT_HEAD); eval 'sub TAILQ_INSERT_TAIL { my($head, $elm, $field) = @_; eval q( &do { &QMD_TAILQ_CHECK_TAIL($head, $field); &TAILQ_NEXT(($elm), $field) = &NULL; ($elm)-> ($field->{tqe_prev}) = ($head)-> &tqh_last; *($head)-> &tqh_last = ($elm); ($head)-> &tqh_last = &TAILQ_NEXT(($elm), $field); &QMD_TRACE_HEAD($head); &QMD_TRACE_ELEM(($elm)->$field); } &while (0)); }' unless defined(&TAILQ_INSERT_TAIL); eval 'sub TAILQ_LAST { my($head, $headname) = @_; eval q((*(((($head)-> &tqh_last))-> &tqh_last))); }' unless defined(&TAILQ_LAST); eval 'sub TAILQ_NEXT { my($elm, $field) = @_; eval q((($elm)-> ($field->{tqe_next}))); }' unless defined(&TAILQ_NEXT); eval 'sub TAILQ_PREV { my($elm, $headname, $field) = @_; eval q((*(((($elm)-> ($field->{tqe_prev})))-> &tqh_last))); }' unless defined(&TAILQ_PREV); eval 'sub TAILQ_REMOVE { my($head, $elm, $field) = @_; eval q( &do { &QMD_SAVELINK( &oldnext, ($elm)-> ($field->{tqe_next})); &QMD_SAVELINK( &oldprev, ($elm)-> ($field->{tqe_prev})); &QMD_TAILQ_CHECK_NEXT($elm, $field); &QMD_TAILQ_CHECK_PREV($elm, $field); &if (( &TAILQ_NEXT(($elm), $field)) != &NULL) &TAILQ_NEXT(($elm), $field)-> ($field->{tqe_prev}) = ($elm)-> ($field->{tqe_prev}); &else { ($head)-> &tqh_last = ($elm)-> ($field->{tqe_prev}); &QMD_TRACE_HEAD($head); } *($elm)-> ($field->{tqe_prev}) = &TAILQ_NEXT(($elm), $field); &TRASHIT(* &oldnext); &TRASHIT(* &oldprev); &QMD_TRACE_ELEM(($elm)->$field); } &while (0)); }' unless defined(&TAILQ_REMOVE); eval 'sub TAILQ_SWAP { my($head1, $head2, $type, $field) = @_; eval q( &do { \'struct type\' * &swap_first = ($head1)-> &tqh_first; \'struct type\' ** &swap_last = ($head1)-> &tqh_last; ($head1)-> &tqh_first = ($head2)-> &tqh_first; ($head1)-> &tqh_last = ($head2)-> &tqh_last; ($head2)-> &tqh_first = &swap_first; ($head2)-> &tqh_last = &swap_last; &if (( &swap_first = ($head1)-> &tqh_first) != &NULL) ($swap_first->{field}->{tqe_prev}) = ($head1)-> &tqh_first; &else ($head1)-> &tqh_last = ($head1)-> &tqh_first; &if (( &swap_first = ($head2)-> &tqh_first) != &NULL) ($swap_first->{field}->{tqe_prev}) = ($head2)-> &tqh_first; &else ($head2)-> &tqh_last = ($head2)-> &tqh_first; } &while (0)); }' unless defined(&TAILQ_SWAP); } 1;