require '_h2ph_pre.ph';

unless(defined(&_SYS_PARAM_H)) {
    eval 'sub _SYS_PARAM_H () {1;}' unless defined(&_SYS_PARAM_H);
    require 'limits.ph';
    require 'linux/limits.ph';
    require 'linux/param.ph';
    eval 'sub NBBY () { &CHAR_BIT;}' unless defined(&NBBY);
    unless(defined(&NGROUPS)) {
	eval 'sub NGROUPS () { &NGROUPS_MAX;}' unless defined(&NGROUPS);
    }
    eval 'sub MAXSYMLINKS () {20;}' unless defined(&MAXSYMLINKS);
    eval 'sub CANBSIZ () { &MAX_CANON;}' unless defined(&CANBSIZ);
    eval 'sub NCARGS () { &ARG_MAX;}' unless defined(&NCARGS);
    eval 'sub MAXPATHLEN () { &PATH_MAX;}' unless defined(&MAXPATHLEN);
    eval 'sub NOFILE () {256;}' unless defined(&NOFILE);
    require 'sys/types.ph';
    eval 'sub setbit {
        local($a,$i) = @_;
	    eval q((($a)[($i)/ &NBBY] |= 1<<(($i)% &NBBY)));
    }' unless defined(&setbit);
    eval 'sub clrbit {
        local($a,$i) = @_;
	    eval q((($a)[($i)/ &NBBY] &= ~(1<<(($i)% &NBBY))));
    }' unless defined(&clrbit);
    eval 'sub isset {
        local($a,$i) = @_;
	    eval q((($a)[($i)/ &NBBY] & (1<<(($i)% &NBBY))));
    }' unless defined(&isset);
    eval 'sub isclr {
        local($a,$i) = @_;
	    eval q(((($a)[($i)/ &NBBY] & (1<<(($i)% &NBBY))) == 0));
    }' unless defined(&isclr);
    unless(defined(&howmany)) {
	eval 'sub howmany {
	    local($x, $y) = @_;
    	    eval q(((($x)+(($y)-1))/($y)));
	}' unless defined(&howmany);
    }
    eval 'sub roundup {
        local($x, $y) = @_;
	    eval q((((($x)+(($y)-1))/($y))*($y)));
    }' unless defined(&roundup);
    eval 'sub powerof2 {
        local($x) = @_;
	    eval q((((($x)-1)($x))==0));
    }' unless defined(&powerof2);
    eval 'sub MIN {
        local($a,$b) = @_;
	    eval q(((($a)<($b))?($a):($b)));
    }' unless defined(&MIN);
    eval 'sub MAX {
        local($a,$b) = @_;
	    eval q(((($a)>($b))?($a):($b)));
    }' unless defined(&MAX);
    eval 'sub DEV_BSIZE () {512;}' unless defined(&DEV_BSIZE);
}
1;
