require '_h2ph_pre.ph';

unless(defined(&HEADER_E_OS_H)) {
    eval 'sub HEADER_E_OS_H () {1;}' unless defined(&HEADER_E_OS_H);
    require 'ssl/opensslconf.ph';
    require 'ssl/e_os2.ph';
    if(defined(&__cplusplus)) {
    }
    if(defined(&REF_PRINT)) {
	undef(&REF_PRINT) if defined(&REF_PRINT);
	eval 'sub REF_PRINT {
	    local($a,$b) = @_;
    	    eval q( &fprintf( &stderr,\\"%08X:%4d:%s\\\\n\\",$b, ($b->{references}),$a));
	}' unless defined(&REF_PRINT);
    }
    unless(defined(&DEVRANDOM)) {
	eval 'sub DEVRANDOM () {"/dev/arandom";}' unless defined(&DEVRANDOM);
    }
    if(defined( &__MWERKS__)  && defined( &macintosh)) {
	if((defined(&macintosh) ? &macintosh : 0)==1) {
	    unless(defined(&MAC_OS_GUSI_SOURCE)) {
		eval 'sub MAC_OS_pre_X () {1;}' unless defined(&MAC_OS_pre_X);
		eval 'sub NO_SYS_TYPES_H () {1;}' unless defined(&NO_SYS_TYPES_H);
	    }
	    eval 'sub NO_SYS_PARAM_H () {1;}' unless defined(&NO_SYS_PARAM_H);
	    eval 'sub NO_CHMOD () {1;}' unless defined(&NO_CHMOD);
	    eval 'sub NO_SYSLOG () {1;}' unless defined(&NO_SYSLOG);
	    undef(&DEVRANDOM) if defined(&DEVRANDOM);
	    eval 'sub GETPID_IS_MEANINGLESS () {1;}' unless defined(&GETPID_IS_MEANINGLESS);
	}
    }
    if(defined( &WIN16) || defined( &MSDOS)) {
	eval 'sub MS_STATIC () { &static;}' unless defined(&MS_STATIC);
    } else {
	eval 'sub MS_STATIC () {1;}' unless defined(&MS_STATIC);
    }
    if(defined( &_WIN32)  && !defined( &WIN32)  && !defined( &__CYGWIN32__)) {
	eval 'sub WIN32 () {1;}' unless defined(&WIN32);
    }
    if((defined( &WIN32) || defined( &WIN16))  && !defined( &__CYGWIN32__)) {
	unless(defined(&WINDOWS)) {
	    eval 'sub WINDOWS () {1;}' unless defined(&WINDOWS);
	}
	unless(defined(&MSDOS)) {
	    eval 'sub MSDOS () {1;}' unless defined(&MSDOS);
	}
    }
    if(defined( &MSDOS)  && !defined( &GETPID_IS_MEANINGLESS)) {
	eval 'sub GETPID_IS_MEANINGLESS () {1;}' unless defined(&GETPID_IS_MEANINGLESS);
    }
    if(defined(&WIN32)) {
	eval 'sub get_last_sys_error () {
	    eval q( &GetLastError());
	}' unless defined(&get_last_sys_error);
	eval 'sub clear_sys_error () {
	    eval q( &SetLastError(0));
	}' unless defined(&clear_sys_error);
	if(!defined( &WINNT)) {
	    eval 'sub WIN_CONSOLE_BUG () {1;}' unless defined(&WIN_CONSOLE_BUG);
	}
    } else {
	eval 'sub get_last_sys_error () {
	    eval q( &errno);
	}' unless defined(&get_last_sys_error);
	eval 'sub clear_sys_error () {
	    eval q( &errno=0);
	}' unless defined(&clear_sys_error);
    }
    if(defined( &WINDOWS)  && !defined( &__CYGWIN32__)) {
	eval 'sub get_last_socket_error () {
	    eval q( &WSAGetLastError());
	}' unless defined(&get_last_socket_error);
	eval 'sub clear_socket_error () {
	    eval q( &WSASetLastError(0));
	}' unless defined(&clear_socket_error);
	eval 'sub readsocket {
	    local($s,$b,$n) = @_;
    	    eval q( &recv(($s),($b),($n),0));
	}' unless defined(&readsocket);
	eval 'sub writesocket {
	    local($s,$b,$n) = @_;
    	    eval q( &send(($s),($b),($n),0));
	}' unless defined(&writesocket);
	eval 'sub EADDRINUSE () { &WSAEADDRINUSE;}' unless defined(&EADDRINUSE);
    }
 elsif(defined( &MAC_OS_pre_X)) {
	eval 'sub get_last_socket_error () {
	    eval q( &errno);
	}' unless defined(&get_last_socket_error);
	eval 'sub clear_socket_error () {
	    eval q( &errno=0);
	}' unless defined(&clear_socket_error);
	eval 'sub closesocket {
	    local($s) = @_;
    	    eval q( &MacSocket_close($s));
	}' unless defined(&closesocket);
	eval 'sub readsocket {
	    local($s,$b,$n) = @_;
    	    eval q( &MacSocket_recv(($s),($b),($n), &true));
	}' unless defined(&readsocket);
	eval 'sub writesocket {
	    local($s,$b,$n) = @_;
    	    eval q( &MacSocket_send(($s),($b),($n)));
	}' unless defined(&writesocket);
    } else {
	eval 'sub get_last_socket_error () {
	    eval q( &errno);
	}' unless defined(&get_last_socket_error);
	eval 'sub clear_socket_error () {
	    eval q( &errno=0);
	}' unless defined(&clear_socket_error);
	eval 'sub ioctlsocket {
	    local($a,$b,$c) = @_;
    	    eval q( &ioctl($a,$b,$c));
	}' unless defined(&ioctlsocket);
	eval 'sub closesocket {
	    local($s) = @_;
    	    eval q( &close($s));
	}' unless defined(&closesocket);
	eval 'sub readsocket {
	    local($s,$b,$n) = @_;
    	    eval q( &read(($s),($b),($n)));
	}' unless defined(&readsocket);
	eval 'sub writesocket {
	    local($s,$b,$n) = @_;
    	    eval q( &write(($s),($b),($n)));
	}' unless defined(&writesocket);
    }
    if(defined(&WIN16)) {
	eval 'sub NO_FP_API () {1;}' unless defined(&NO_FP_API);
	eval 'sub MS_CALLBACK () { &_far  &_loadds;}' unless defined(&MS_CALLBACK);
	eval 'sub MS_FAR () { &_far;}' unless defined(&MS_FAR);
    } else {
	eval 'sub MS_CALLBACK () {1;}' unless defined(&MS_CALLBACK);
	eval 'sub MS_FAR () {1;}' unless defined(&MS_FAR);
    }
    if(defined(&NO_STDIO)) {
	eval 'sub NO_FP_API () {1;}' unless defined(&NO_FP_API);
    }
    if((defined( &WINDOWS) || defined( &MSDOS))  && !defined( &__CYGWIN32__)) {
	unless(defined(&S_IFDIR)) {
	    eval 'sub S_IFDIR () { &_S_IFDIR;}' unless defined(&S_IFDIR);
	}
	unless(defined(&S_IFMT)) {
	    eval 'sub S_IFMT () { &_S_IFMT;}' unless defined(&S_IFMT);
	    if(!defined( &WINNT)) {
		eval 'sub NO_SYSLOG () {1;}' unless defined(&NO_SYSLOG);
	    }
	    eval 'sub NO_DIRENT () {1;}' unless defined(&NO_DIRENT);
	}
	if(defined(&WINDOWS)) {
	    require 'windows.ph';
	    require 'stddef.ph';
	    require 'errno.ph';
	    require 'string.ph';
	    require 'malloc.ph';
	}
	require 'io.ph';
	require 'fcntl.ph';
	if(defined ( &__BORLANDC__)) {
	    eval 'sub _setmode () { &setmode;}' unless defined(&_setmode);
	    eval 'sub _O_TEXT () { &O_TEXT;}' unless defined(&_O_TEXT);
	    eval 'sub _O_BINARY () { &O_BINARY;}' unless defined(&_O_BINARY);
	    eval 'sub _int64 () { &__int64;}' unless defined(&_int64);
	    eval 'sub _kbhit () { &kbhit;}' unless defined(&_kbhit);
	}
	if(defined( &WIN16)  && !defined( &MONOLITH)  && defined( &SSLEAY)  && defined( &_WINEXITNOPERSIST)) {
	    eval 'sub EXIT {
	        local($n) = @_;
    		eval q({  &if ($n == 0)  &_wsetexit( &_WINEXITNOPERSIST);  &return($n); });
	    }' unless defined(&EXIT);
	} else {
	    eval 'sub EXIT {
	        local($n) = @_;
    		eval q( &return($n););
	    }' unless defined(&EXIT);
	}
	eval 'sub LIST_SEPARATOR_CHAR () {ord(\';\');}' unless defined(&LIST_SEPARATOR_CHAR);
	unless(defined(&X_OK)) {
	    eval 'sub X_OK () {0;}' unless defined(&X_OK);
	}
	unless(defined(&W_OK)) {
	    eval 'sub W_OK () {2;}' unless defined(&W_OK);
	}
	unless(defined(&R_OK)) {
	    eval 'sub R_OK () {4;}' unless defined(&R_OK);
	}
	eval 'sub OPENSSL_CONF () {"openssl.cnf";}' unless defined(&OPENSSL_CONF);
	eval 'sub SSLEAY_CONF () { &OPENSSL_CONF;}' unless defined(&SSLEAY_CONF);
	eval 'sub NUL_DEV () {"nul";}' unless defined(&NUL_DEV);
	eval 'sub RFILE () {".rnd";}' unless defined(&RFILE);
    } else {
	if(defined( &__VMS)  && !defined( &VMS)) {
	    eval 'sub VMS () {1;}' unless defined(&VMS);
	}
	if(defined(&VMS)) {
	    require 'stdlib.ph';
	    if(defined( &__DECC)) {
		require 'unistd.ph';
	    } else {
		require 'unixlib.ph';
	    }
	    eval 'sub OPENSSL_CONF () {"openssl.cnf";}' unless defined(&OPENSSL_CONF);
	    eval 'sub SSLEAY_CONF () { &OPENSSL_CONF;}' unless defined(&SSLEAY_CONF);
	    eval 'sub RFILE () {".rnd";}' unless defined(&RFILE);
	    eval 'sub LIST_SEPARATOR_CHAR () {ord(\',\');}' unless defined(&LIST_SEPARATOR_CHAR);
	    eval 'sub NUL_DEV () {"NLA0:";}' unless defined(&NUL_DEV);
	    unless(defined(&MONOLITH)) {
		eval 'sub EXIT {
		    local($n) = @_;
    		    eval q( &do { \'int\'  &__VMS_EXIT = $n;  &if ( &__VMS_EXIT == 1)  &__VMS_EXIT = 3;  &__VMS_EXIT |= 0x10000000;  &exit($n);  &return($n); }  &while(0));
		}' unless defined(&EXIT);
	    } else {
		eval 'sub EXIT {
		    local($n) = @_;
    		    eval q( &do { \'int\'  &__VMS_EXIT = $n;  &if ( &__VMS_EXIT == 1)  &__VMS_EXIT = 3;  &__VMS_EXIT |= 0x10000000;  &return($n); }  &while(0));
		}' unless defined(&EXIT);
	    }
	    eval 'sub NO_SYS_PARAM_H () {1;}' unless defined(&NO_SYS_PARAM_H);
	} else {
	    if(defined(&MPE)) {
		eval 'sub NO_SYS_PARAM_H () {1;}' unless defined(&NO_SYS_PARAM_H);
	    }
	    if(defined(&OPENSSL_UNISTD)) {
	    } else {
		require 'unistd.ph';
	    }
	    unless(defined(&NO_SYS_TYPES_H)) {
		require 'sys/types.ph';
	    }
	    if(defined( &NeXT) || defined( &NEWS4)) {
		eval 'sub pid_t () {\'int\';}' unless defined(&pid_t);
		eval 'sub ssize_t () {\'int\';}' unless defined(&ssize_t);
	    }
	    if(defined(&NEWS4)) {
		eval 'sub setvbuf {
		    local($a, $b, $c, $d) = @_;
    		    eval q( &setbuffer(($a), ($b), ($d)));
		}' unless defined(&setvbuf);
	    }
	    eval 'sub OPENSSL_CONF () {"openssl.cnf";}' unless defined(&OPENSSL_CONF);
	    eval 'sub SSLEAY_CONF () { &OPENSSL_CONF;}' unless defined(&SSLEAY_CONF);
	    eval 'sub RFILE () {".rnd";}' unless defined(&RFILE);
	    eval 'sub LIST_SEPARATOR_CHAR () {ord(\':\');}' unless defined(&LIST_SEPARATOR_CHAR);
	    eval 'sub NUL_DEV () {"/dev/null";}' unless defined(&NUL_DEV);
	    unless(defined(&MONOLITH)) {
		eval 'sub EXIT {
		    local($n) = @_;
    		    eval q( &exit($n);  &return($n));
		}' unless defined(&EXIT);
	    } else {
		eval 'sub EXIT {
		    local($n) = @_;
    		    eval q( &return($n));
		}' unless defined(&EXIT);
	    }
	}
	eval 'sub SSLeay_getpid () {
	    eval q( &getpid());
	}' unless defined(&SSLeay_getpid);
    }
    if(defined(&USE_SOCKETS)) {
	if(defined( &WINDOWS) || defined( &MSDOS)) {
	    if(defined(&NO_SOCK)) {
		eval 'sub SSLeay_Write {
		    local($a,$b,$c) = @_;
    		    eval q((-1));
		}' unless defined(&SSLeay_Write);
		eval 'sub SSLeay_Read {
		    local($a,$b,$c) = @_;
    		    eval q((-1));
		}' unless defined(&SSLeay_Read);
		eval 'sub SHUTDOWN {
		    local($fd) = @_;
    		    eval q( &close($fd));
		}' unless defined(&SHUTDOWN);
		eval 'sub SHUTDOWN2 {
		    local($fd) = @_;
    		    eval q( &close($fd));
		}' unless defined(&SHUTDOWN2);
	    } else {
		require 'winsock.ph';
		eval 'sub SSLeay_Write {
		    local($a,$b,$c) = @_;
    		    eval q( &send(($a),($b),($c),0));
		}' unless defined(&SSLeay_Write);
		eval 'sub SSLeay_Read {
		    local($a,$b,$c) = @_;
    		    eval q( &recv(($a),($b),($c),0));
		}' unless defined(&SSLeay_Read);
		eval 'sub SHUTDOWN {
		    local($fd) = @_;
    		    eval q({  &shutdown(($fd),0);  &closesocket($fd); });
		}' unless defined(&SHUTDOWN);
		eval 'sub SHUTDOWN2 {
		    local($fd) = @_;
    		    eval q({  &shutdown(($fd),2);  &closesocket($fd); });
		}' unless defined(&SHUTDOWN2);
	    }
	}
 elsif(defined( &MAC_OS_pre_X)) {
	    require 'MacSocket.ph';
	    eval 'sub SSLeay_Write {
	        local($a,$b,$c) = @_;
    		eval q( &MacSocket_send(($a),($b),($c)));
	    }' unless defined(&SSLeay_Write);
	    eval 'sub SSLeay_Read {
	        local($a,$b,$c) = @_;
    		eval q( &MacSocket_recv(($a),($b),($c), &true));
	    }' unless defined(&SSLeay_Read);
	    eval 'sub SHUTDOWN {
	        local($fd) = @_;
    		eval q( &MacSocket_close($fd));
	    }' unless defined(&SHUTDOWN);
	    eval 'sub SHUTDOWN2 {
	        local($fd) = @_;
    		eval q( &MacSocket_close($fd));
	    }' unless defined(&SHUTDOWN2);
	} else {
	    unless(defined(&NO_SYS_PARAM_H)) {
		require 'sys/param.ph';
	    }
	    unless(defined(&MPE)) {
		require 'sys/time.ph';
	    }
	    require 'netdb.ph';
	    if(defined( &VMS)  && !defined( &__DECC)) {
		require 'socket.ph';
		require 'in.ph';
	    } else {
		require 'sys/socket.ph';
		if(defined(&FILIO_H)) {
		    require 'sys/filio.ph';
		}
		require 'netinet/in.ph';
	    }
	    if(defined( &NeXT) || defined( &_NEXT_SOURCE)) {
		require 'sys/fcntl.ph';
		require 'sys/types.ph';
	    }
	    if(defined(&AIX)) {
		require 'sys/select.ph';
	    }
	    if(defined(&__QNX__)) {
		require 'sys/select.ph';
	    }
	    if(defined( &sun)) {
		require 'sys/filio.ph';
	    } else {
		unless(defined(&VMS)) {
		    require 'sys/ioctl.ph';
		} else {
		    if(!defined( &TCPIP_TYPE_SOCKETSHR)  && defined( &__VMS_VER)  && ((defined(&__VMS_VER) ? &__VMS_VER : 0) > 70000000)) {
			require 'sys/ioctl.ph';
		    }
		}
	    }
	    if(defined(&VMS)) {
		require 'unixio.ph';
		if(defined( &TCPIP_TYPE_SOCKETSHR)) {
		    require 'socketshr.ph';
		}
	    }
	    eval 'sub SSLeay_Read {
	        local($a,$b,$c) = @_;
    		eval q( &read(($a),($b),($c)));
	    }' unless defined(&SSLeay_Read);
	    eval 'sub SSLeay_Write {
	        local($a,$b,$c) = @_;
    		eval q( &write(($a),($b),($c)));
	    }' unless defined(&SSLeay_Write);
	    eval 'sub SHUTDOWN {
	        local($fd) = @_;
    		eval q({  &shutdown(($fd),0);  &closesocket(($fd)); });
	    }' unless defined(&SHUTDOWN);
	    eval 'sub SHUTDOWN2 {
	        local($fd) = @_;
    		eval q({  &shutdown(($fd),2);  &closesocket(($fd)); });
	    }' unless defined(&SHUTDOWN2);
	    eval 'sub INVALID_SOCKET () {(-1);}' unless defined(&INVALID_SOCKET);
	}
    }
    if(defined( &THREADS) || defined( &sun)) {
	unless(defined(&_REENTRANT)) {
	    eval 'sub _REENTRANT () {1;}' unless defined(&_REENTRANT);
	}
    }
    if(defined( &sun)  && !defined( &__svr4__)  && !defined( &__SVR4)) {
	eval 'sub memmove {
	    local($s1,$s2,$n) = @_;
    	    eval q( &bcopy(($s2),($s1),($n)));
	}' unless defined(&memmove);
	eval 'sub strtoul {
	    local($s,$e,$b) = @_;
    	    eval q(( &strtol(($s),($e),($b))));
	}' unless defined(&strtoul);
	eval 'sub strerror {
	    local($errnum) = @_;
    	    eval q(((($errnum)<0|| ($errnum)>= &sys_nerr) ?  &NULL :  $sys_errlist[$errnum]));
	}' unless defined(&strerror);
    }
    if(defined(&WIN16)) {
	eval 'sub Getenv () { &getenv;}' unless defined(&Getenv);
    } else {
	eval 'sub Getenv () { &getenv;}' unless defined(&Getenv);
    }
    eval 'sub DG_GCC_BUG () {1;}' unless defined(&DG_GCC_BUG);
    if(defined(&sgi)) {
	eval 'sub IRIX_CC_BUG () {1;}' unless defined(&IRIX_CC_BUG);
    }
    if(defined(&SNI)) {
	eval 'sub IRIX_CC_BUG () {1;}' unless defined(&IRIX_CC_BUG);
    }
    if(defined(&NO_MD2)) {
	eval 'sub MD2_Init () { &MD2Init;}' unless defined(&MD2_Init);
	eval 'sub MD2_Update () { &MD2Update;}' unless defined(&MD2_Update);
	eval 'sub MD2_Final () { &MD2Final;}' unless defined(&MD2_Final);
	eval 'sub MD2_DIGEST_LENGTH () {16;}' unless defined(&MD2_DIGEST_LENGTH);
    }
    if(defined(&NO_MD5)) {
	eval 'sub MD5_Init () { &MD5Init;}' unless defined(&MD5_Init);
	eval 'sub MD5_Update () { &MD5Update;}' unless defined(&MD5_Update);
	eval 'sub MD5_Final () { &MD5Final;}' unless defined(&MD5_Final);
	eval 'sub MD5_DIGEST_LENGTH () {16;}' unless defined(&MD5_DIGEST_LENGTH);
    }
    if(defined(&__cplusplus)) {
    }
}
1;
