require '_h2ph_pre.ph';

unless(defined(&HEADER_SAFESTACK_H)) {
    eval 'sub HEADER_SAFESTACK_H () {1;}' unless defined(&HEADER_SAFESTACK_H);
    require 'ssl/stack.ph';
    eval 'sub STACK_OF {
        local($type) = @_;
	    eval q( &STACK_$type);
    }' unless defined(&STACK_OF);
    eval 'sub DECLARE_STACK_OF {
        local($type) = @_;
	    eval q( &typedef \'struct stack_st_\'$type {  &STACK  &stack; }  &STACK_OF($type);  &STACK_OF($type) * &sk_$type &_new(\'int\' (* &cmp)($type **,$type **));  &STACK_OF($type) * &sk_$type &_new_null( &void);  &void  &sk_$type &_free( &STACK_OF($type) * &sk); \'int\'  &sk_$type &_num( &const  &STACK_OF($type) * &sk); $type * &sk_$type &_value( &const  &STACK_OF($type) * &sk,\'int\'  &n); $type * &sk_$type &_set( &STACK_OF($type) * &sk,\'int\'  &n,$type * &v);  &void  &sk_$type &_zero( &STACK_OF($type) * &sk); \'int\'  &sk_$type &_push( &STACK_OF($type) * &sk,$type * &v); \'int\'  &sk_$type &_unshift( &STACK_OF($type) * &sk,$type * &v); \'int\'  &sk_$type &_find( &STACK_OF($type) * &sk,$type * &v); $type * &sk_$type &_delete( &STACK_OF($type) * &sk,\'int\'  &n);  &void  &sk_$type &_delete_ptr( &STACK_OF($type) * &sk,$type * &v); \'int\'  &sk_$type &_insert( &STACK_OF($type) * &sk,$type * &v,\'int\'  &n); \'int\' (* &sk_$type &_set_cmp_func( &STACK_OF($type) * &sk, \'int\' (* &cmp)($type **,$type **)))($type **,$type **);  &STACK_OF($type) * &sk_$type &_dup( &STACK_OF($type) * &sk);  &void  &sk_$type &_pop_free( &STACK_OF($type) * &sk, &void (* &func)($type *)); $type * &sk_$type &_shift( &STACK_OF($type) * &sk); $type * &sk_$type &_pop( &STACK_OF($type) * &sk);  &void  &sk_$type &_sort( &STACK_OF($type) * &sk););
    }' unless defined(&DECLARE_STACK_OF);
    eval 'sub IMPLEMENT_STACK_OF {
        local($type) = @_;
	    eval q( &STACK_OF * &sk_$type &_new(\'int\' (* &cmp)($type **,$type **)) {  &return  &sk_new; }  &STACK_OF * &sk_$type &_new_null() {  &return  &sk_new_null(); }  &void  &sk_$type &_free( &STACK_OF * &sk) {  &sk_free; } \'int\'  &sk_$type &_num( &const  &STACK_OF * &sk) {  &return  &M_sk_num; } $type * &sk_$type &_value( &const  &STACK_OF * &sk,\'int\'  &n) {  &return  &sk_value( &sk, &n); } $type * &sk_$type &_set( &STACK_OF * &sk,\'int\'  &n,$type * &v) {  &return ( &sk_set( &sk, &n, &v)); }  &void  &sk_$type &_zero( &STACK_OF * &sk) {  &sk_zero; } \'int\'  &sk_$type &_push( &STACK_OF * &sk,$type * &v) {  &return  &sk_push( &sk, &v); } \'int\'  &sk_$type &_unshift( &STACK_OF * &sk,$type * &v) {  &return  &sk_unshift( &sk, &v); } \'int\'  &sk_$type &_find( &STACK_OF * &sk,$type * &v) {  &return  &sk_find( &sk, &v); } $type * &sk_$type &_delete( &STACK_OF * &sk,\'int\'  &n) {  &return  &sk_delete( &sk, &n); }  &void  &sk_$type &_delete_ptr( &STACK_OF * &sk,$type * &v) {  &sk_delete_ptr( &sk, &v); } \'int\'  &sk_$type &_insert( &STACK_OF * &sk,$type * &v,\'int\'  &n) {  &return  &sk_insert( &sk, &v, &n); } \'int\' (* &sk_$type &_set_cmp_func( &STACK_OF * &sk, \'int\' (* &cmp)($type **,$type **)))($type **,$type **) {  &return (\'int\' (*)($type **,$type **)) &sk_set_cmp_func( &sk, &cmp); }  &STACK_OF * &sk_$type &_dup( &STACK_OF * &sk) {  &return  &sk_dup; }  &void  &sk_$type &_pop_free( &STACK_OF * &sk, &void (* &func)) {  &sk_pop_free( &sk, &func); } $type * &sk_$type &_shift( &STACK_OF * &sk) {  &return  &sk_shift; } $type * &sk_$type &_pop( &STACK_OF * &sk) {  &return  &sk_pop; }  &void  &sk_$type &_sort( &STACK_OF * &sk) {  &sk_sort( &sk); });
    }' unless defined(&IMPLEMENT_STACK_OF);
}
1;
