require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_DIR_H_)) {
    eval 'sub _DIR_H_ () {1;}' unless defined(&_DIR_H_);
    eval 'sub doff_t () { &int32_t;}' unless defined(&doff_t);
    eval 'sub MAXDIRSIZE () {(0x7fffffff);}' unless defined(&MAXDIRSIZE);
    eval 'sub DIRBLKSIZ () { &DEV_BSIZE;}' unless defined(&DIRBLKSIZ);
    eval 'sub MAXNAMLEN () {255;}' unless defined(&MAXNAMLEN);
    eval 'sub DT_UNKNOWN () {0;}' unless defined(&DT_UNKNOWN);
    eval 'sub DT_FIFO () {1;}' unless defined(&DT_FIFO);
    eval 'sub DT_CHR () {2;}' unless defined(&DT_CHR);
    eval 'sub DT_DIR () {4;}' unless defined(&DT_DIR);
    eval 'sub DT_BLK () {6;}' unless defined(&DT_BLK);
    eval 'sub DT_REG () {8;}' unless defined(&DT_REG);
    eval 'sub DT_LNK () {10;}' unless defined(&DT_LNK);
    eval 'sub DT_SOCK () {12;}' unless defined(&DT_SOCK);
    eval 'sub IFTODT {
        my($mode) = @_;
	    eval q(((($mode) & 0170000) >> 12));
    }' unless defined(&IFTODT);
    eval 'sub DTTOIF {
        my($dirtype) = @_;
	    eval q((($dirtype) << 12));
    }' unless defined(&DTTOIF);
    eval 'sub DIRECTSIZ {
        my($namlen) = @_;
	    eval q((((0)-> &d_name + (($namlen)+1)*$sizeof{(0)-> $d_name[0]} + 3) & ~3));
    }' unless defined(&DIRECTSIZ);
    if(((defined(&BYTE_ORDER) ? &BYTE_ORDER : 0) == (defined(&LITTLE_ENDIAN) ? &LITTLE_ENDIAN : 0))) {
	eval 'sub DIRSIZ {
	    my($oldfmt, $dp) = @_;
    	    eval q((($oldfmt) ? (($sizeof{\'struct direct\'} - ( &MAXNAMLEN+1)) + ((($dp)-> &d_type+1+ 3) &~ 3)) : (($sizeof{\'struct direct\'} - ( &MAXNAMLEN+1)) + ((($dp)-> &d_namlen+1+ 3) &~ 3))));
	}' unless defined(&DIRSIZ);
    } else {
	eval 'sub DIRSIZ {
	    my($oldfmt, $dp) = @_;
    	    eval q((($sizeof{\'struct direct\'} - ( &MAXNAMLEN+1)) + ((($dp)-> &d_namlen+1+ 3) &~ 3)));
	}' unless defined(&DIRSIZ);
    }
    eval 'sub OLDDIRFMT () {1;}' unless defined(&OLDDIRFMT);
    eval 'sub NEWDIRFMT () {0;}' unless defined(&NEWDIRFMT);
}
1;
