require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_CTYPE_INLINE_H_)) {
    eval 'sub _CTYPE_INLINE_H_ () {1;}' unless defined(&_CTYPE_INLINE_H_);
    require 'sys/cdefs.ph';
    require 'sys/featuretest.ph';
    require 'sys/ctype_bits.ph';
    eval 'sub isalnum {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] & ( &_CTYPE_A| &_CTYPE_D))));
    }' unless defined(&isalnum);
    eval 'sub isalpha {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_A)));
    }' unless defined(&isalpha);
    eval 'sub iscntrl {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_C)));
    }' unless defined(&iscntrl);
    eval 'sub isdigit {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_D)));
    }' unless defined(&isdigit);
    eval 'sub isgraph {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_G)));
    }' unless defined(&isgraph);
    eval 'sub islower {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_L)));
    }' unless defined(&islower);
    eval 'sub isprint {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_R)));
    }' unless defined(&isprint);
    eval 'sub ispunct {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_P)));
    }' unless defined(&ispunct);
    eval 'sub isspace {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_S)));
    }' unless defined(&isspace);
    eval 'sub isupper {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_U)));
    }' unless defined(&isupper);
    eval 'sub isxdigit {
        my($c) = @_;
	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_X)));
    }' unless defined(&isxdigit);
    eval 'sub tolower {
        my($c) = @_;
	    eval q(((( &_tolower_tab_ + 1)[($c)])));
    }' unless defined(&tolower);
    eval 'sub toupper {
        my($c) = @_;
	    eval q(((( &_toupper_tab_ + 1)[($c)])));
    }' unless defined(&toupper);
    if(defined(&_XOPEN_SOURCE) || defined(&_NETBSD_SOURCE)) {
	eval 'sub isascii {
	    my($c) = @_;
    	    eval q((($c) <= 0177));
	}' unless defined(&isascii);
	eval 'sub toascii {
	    my($c) = @_;
    	    eval q((($c) & 0177));
	}' unless defined(&toascii);
	eval 'sub _tolower {
	    my($c) = @_;
    	    eval q((($c) - ord(\'A\' + \'a\')));
	}' unless defined(&_tolower);
	eval 'sub _toupper {
	    my($c) = @_;
    	    eval q((($c) - ord(\'a\' + \'A\')));
	}' unless defined(&_toupper);
    }
    if(defined(&_ISOC99_SOURCE) || ((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) > 200112 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) > 600|| defined(&_NETBSD_SOURCE)) {
	eval 'sub isblank {
	    my($c) = @_;
    	    eval q(((( &_ctype_tab_ + 1)[($c)] &  &_CTYPE_BL)));
	}' unless defined(&isblank);
    }
}
1;
