require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_SPINLOCK_H_)) {
    eval 'sub _SPINLOCK_H_ () {1;}' unless defined(&_SPINLOCK_H_);
    require 'sys/cdefs.ph';
    require 'sys/types.ph';
    require 'machine/spinlock.ph';
    eval 'sub _SPINLOCK_INITIALIZER () {{  &_SPINLOCK_UNLOCKED, 0, 0, 0};}' unless defined(&_SPINLOCK_INITIALIZER);
    eval 'sub _SPINUNLOCK {
        my($_lck) = @_;
	    eval q(($_lck)-> &access_lock =  &_SPINLOCK_UNLOCKED);
    }' unless defined(&_SPINUNLOCK);
    if(defined(&_LOCK_DEBUG)) {
	eval 'sub _SPINLOCK {
	    my($_lck) = @_;
    	    eval q( &_spinlock_debug($_lck,  &__FILE__,  &__LINE__));
	}' unless defined(&_SPINLOCK);
    } else {
	eval 'sub _SPINLOCK {
	    my($_lck) = @_;
    	    eval q( &_spinlock($_lck));
	}' unless defined(&_SPINLOCK);
    }
    eval 'sub _SPINLOCK_INIT {
        my($_lck) = @_;
	    eval q( &_SPINUNLOCK($_lck));
    }' unless defined(&_SPINLOCK_INIT);
}
1;
