require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_STDIO_H_)) {
    eval 'sub _STDIO_H_ () {1;}' unless defined(&_STDIO_H_);
    require 'sys/cdefs.ph';
    require 'sys/_types.ph';
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0) || (defined(&__POSIX_VISIBLE) ? &__POSIX_VISIBLE : 0) || (defined(&__XPG_VISIBLE) ? &__XPG_VISIBLE : 0)) {
	require 'sys/types.ph';
    }
    unless(defined(&_SIZE_T_DEFINED_)) {
	eval 'sub _SIZE_T_DEFINED_ () {1;}' unless defined(&_SIZE_T_DEFINED_);
    }
    unless(defined(&_OFF_T_DEFINED_)) {
	eval 'sub _OFF_T_DEFINED_ () {1;}' unless defined(&_OFF_T_DEFINED_);
    }
    unless(defined(&NULL)) {
	if(defined(&__GNUG__)) {
	    eval 'sub NULL () { &__null;}' unless defined(&NULL);
	} else {
	    eval 'sub NULL () {0;}' unless defined(&NULL);
	}
    }
    eval 'sub _FSTDIO () {1;}' unless defined(&_FSTDIO);
    eval 'sub __SLBF () {0x1;}' unless defined(&__SLBF);
    eval 'sub __SNBF () {0x2;}' unless defined(&__SNBF);
    eval 'sub __SRD () {0x4;}' unless defined(&__SRD);
    eval 'sub __SWR () {0x8;}' unless defined(&__SWR);
    eval 'sub __SRW () {0x10;}' unless defined(&__SRW);
    eval 'sub __SEOF () {0x20;}' unless defined(&__SEOF);
    eval 'sub __SERR () {0x40;}' unless defined(&__SERR);
    eval 'sub __SMBF () {0x80;}' unless defined(&__SMBF);
    eval 'sub __SAPP () {0x100;}' unless defined(&__SAPP);
    eval 'sub __SSTR () {0x200;}' unless defined(&__SSTR);
    eval 'sub __SOPT () {0x400;}' unless defined(&__SOPT);
    eval 'sub __SNPT () {0x800;}' unless defined(&__SNPT);
    eval 'sub __SOFF () {0x1000;}' unless defined(&__SOFF);
    eval 'sub __SMOD () {0x2000;}' unless defined(&__SMOD);
    eval 'sub __SALC () {0x4000;}' unless defined(&__SALC);
    eval 'sub _IOFBF () {0;}' unless defined(&_IOFBF);
    eval 'sub _IOLBF () {1;}' unless defined(&_IOLBF);
    eval 'sub _IONBF () {2;}' unless defined(&_IONBF);
    eval 'sub BUFSIZ () {1024;}' unless defined(&BUFSIZ);
    eval 'sub EOF () {(-1);}' unless defined(&EOF);
    eval 'sub FOPEN_MAX () {20;}' unless defined(&FOPEN_MAX);
    eval 'sub FILENAME_MAX () {1024;}' unless defined(&FILENAME_MAX);
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0) || (defined(&__XPG_VISIBLE) ? &__XPG_VISIBLE : 0)) {
	eval 'sub P_tmpdir () {"/tmp/";}' unless defined(&P_tmpdir);
    }
    eval 'sub L_tmpnam () {1024;}' unless defined(&L_tmpnam);
    eval 'sub TMP_MAX () {308915776;}' unless defined(&TMP_MAX);
    unless(defined(&SEEK_SET)) {
	eval 'sub SEEK_SET () {0;}' unless defined(&SEEK_SET);
    }
    unless(defined(&SEEK_CUR)) {
	eval 'sub SEEK_CUR () {1;}' unless defined(&SEEK_CUR);
    }
    unless(defined(&SEEK_END)) {
	eval 'sub SEEK_END () {2;}' unless defined(&SEEK_END);
    }
    eval 'sub stdin () {(& $__sF[0]);}' unless defined(&stdin);
    eval 'sub stdout () {(& $__sF[1]);}' unless defined(&stdout);
    eval 'sub stderr () {(& $__sF[2]);}' unless defined(&stderr);
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)  && !defined( &__SYS_ERRLIST)) {
	eval 'sub __SYS_ERRLIST () {1;}' unless defined(&__SYS_ERRLIST);
    }
    if((defined(&__ISO_C_VISIBLE) ? &__ISO_C_VISIBLE : 0) >= 1999|| (defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
    }
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0) || (defined(&__POSIX_VISIBLE) ? &__POSIX_VISIBLE : 0) || (defined(&__XPG_VISIBLE) ? &__XPG_VISIBLE : 0)) {
	eval 'sub L_ctermid () {1024;}' unless defined(&L_ctermid);
	eval 'sub L_cuserid () {9;}' unless defined(&L_cuserid);
	if((defined(&__POSIX_VISIBLE) ? &__POSIX_VISIBLE : 0) >= 199209) {
	}
	if((defined(&__POSIX_VISIBLE) ? &__POSIX_VISIBLE : 0) >= 199506) {
	}
	if((defined(&__XPG_VISIBLE) ? &__XPG_VISIBLE : 0)) {
	}
	unless(defined(&_POSIX_THREADS)) {
	    eval 'sub flockfile {
	        my($fp) = @_;
    		eval q();
	    }' unless defined(&flockfile);
	    eval 'sub ftrylockfile {
	        my($fp) = @_;
    		eval q((0));
	    }' unless defined(&ftrylockfile);
	    eval 'sub funlockfile {
	        my($fp) = @_;
    		eval q();
	    }' unless defined(&funlockfile);
	}
    }
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub fropen {
	    my($cookie, $fn) = @_;
    	    eval q( &funopen($cookie, $fn, 0, 0, 0));
	}' unless defined(&fropen);
	eval 'sub fwopen {
	    my($cookie, $fn) = @_;
    	    eval q( &funopen($cookie, 0, $fn, 0, 0));
	}' unless defined(&fwopen);
    }
    eval 'sub __sgetc {
        my($p) = @_;
	    eval q((---> &_r < 0?  &__srget : (*($p)-> &_p++)));
    }' unless defined(&__sgetc);
    if(defined( &__GNUC__)) {
	eval 'sub __sputc {
	    my($_c,$_p) = @_;
    	    eval q({  &if (-- ($_p->{_w}) >= 0|| ( ($_p->{_w}) >=  ($_p->{_lbfsize})  && $_c != ord(\'\\\\n\'))) (* ($_p->{_p})++ = $_c);  &else ( &__swbuf($_c, $_p)); });
	}' unless defined(&__sputc);
    } else {
	eval 'sub __sputc {
	    my($c, $p) = @_;
    	    eval q((---> &_w < 0? -> &_w >= -> &_lbfsize ? (*-> &_p = ), *-> &_p != ord(\'\\\\n\' ? 				*->_p++ : 				__swbuf(\'\\\\n\'), $p) :  &__swbuf(($c), $p) : (*($p)-> &_p = ($c), *($p)-> &_p++)));
	}' unless defined(&__sputc);
    }
    eval 'sub __sfeof {
        my($p) = @_;
	    eval q(((($p)-> &_flags &  &__SEOF) != 0));
    }' unless defined(&__sfeof);
    eval 'sub __sferror {
        my($p) = @_;
	    eval q(((($p)-> &_flags &  &__SERR) != 0));
    }' unless defined(&__sferror);
    eval 'sub __sclearerr {
        my($p) = @_;
	    eval q((( &void)(($p)-> &_flags &= ~( &__SERR| &__SEOF))));
    }' unless defined(&__sclearerr);
    eval 'sub __sfileno {
        my($p) = @_;
	    eval q((($p)-> &_file));
    }' unless defined(&__sfileno);
    eval 'sub feof {
        my($p) = @_;
	    eval q( &__sfeof($p));
    }' unless defined(&feof);
    eval 'sub ferror {
        my($p) = @_;
	    eval q( &__sferror($p));
    }' unless defined(&ferror);
    unless(defined(&_POSIX_THREADS)) {
	eval 'sub clearerr {
	    my($p) = @_;
    	    eval q( &__sclearerr($p));
	}' unless defined(&clearerr);
    }
    if((defined(&__POSIX_VISIBLE) ? &__POSIX_VISIBLE : 0)) {
	eval 'sub fileno {
	    my($p) = @_;
    	    eval q( &__sfileno($p));
	}' unless defined(&fileno);
    }
    unless(defined(&lint)) {
	unless(defined(&_POSIX_THREADS)) {
	    eval 'sub getc {
	        my($fp) = @_;
    		eval q( &__sgetc($fp));
	    }' unless defined(&getc);
	}
	eval 'sub getc_unlocked {
	    my($fp) = @_;
    	    eval q( &__sgetc($fp));
	}' unless defined(&getc_unlocked);
	if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	    unless(defined(&_POSIX_THREADS)) {
		eval 'sub putc {
		    my($x, $fp) = @_;
    		    eval q( &__sputc($x, $fp));
		}' unless defined(&putc);
	    }
	    eval 'sub putc_unlocked {
	        my($x, $fp) = @_;
    		eval q( &__sputc($x, $fp));
	    }' unless defined(&putc_unlocked);
	}
    }
    eval 'sub getchar () {
        eval q( &getc( &stdin));
    }' unless defined(&getchar);
    eval 'sub putchar {
        my($x) = @_;
	    eval q( &putc($x,  &stdout));
    }' unless defined(&putchar);
    eval 'sub getchar_unlocked () {
        eval q( &getc_unlocked( &stdin));
    }' unless defined(&getchar_unlocked);
    eval 'sub putchar_unlocked {
        my($c) = @_;
	    eval q( &putc_unlocked($c,  &stdout));
    }' unless defined(&putchar_unlocked);
}
1;
