require '_h2ph_pre.ph';

no warnings qw(redefine misc);

if(!defined(&ATF_C_MACROS_H)) {
    eval 'sub ATF_C_MACROS_H () {1;}' unless defined(&ATF_C_MACROS_H);
    require 'string.ph';
    require 'atf-c/defs.ph';
    require 'atf-c/error.ph';
    require 'atf-c/tc.ph';
    require 'atf-c/tp.ph';
    require 'atf-c/utils.ph';
    eval 'sub ATF_TC_NAME {
        my($tc) = @_;
	    eval q(( &atfu_  $tc   &_tc));
    }' unless defined(&ATF_TC_NAME);
    eval 'sub ATF_TC_PACK_NAME {
        my($tc) = @_;
	    eval q(( &atfu_  $tc   &_tc_pack));
    }' unless defined(&ATF_TC_PACK_NAME);
    eval 'sub ATF_TC_WITHOUT_HEAD {
        my($tc) = @_;
	    eval q( &static  &void  &atfu_  $tc   &_body( &const  &atf_tc_t *);  &static  &atf_tc_t  &atfu_  $tc   &_tc;  &static  &atf_tc_pack_t  &atfu_  $tc   &_tc_pack = { . &m_ident = $tc, . &m_head =  &NULL, . &m_body =  &atfu_  $tc   &_body, . &m_cleanup =  &NULL, });
    }' unless defined(&ATF_TC_WITHOUT_HEAD);
    eval 'sub ATF_TC {
        my($tc) = @_;
	    eval q( &static  &void  &atfu_  $tc   &_head( &atf_tc_t *);  &static  &void  &atfu_  $tc   &_body( &const  &atf_tc_t *);  &static  &atf_tc_t  &atfu_  $tc   &_tc;  &static  &atf_tc_pack_t  &atfu_  $tc   &_tc_pack = { . &m_ident = $tc, . &m_head =  &atfu_  $tc   &_head, . &m_body =  &atfu_  $tc   &_body, . &m_cleanup =  &NULL, });
    }' unless defined(&ATF_TC);
    eval 'sub ATF_TC_WITH_CLEANUP {
        my($tc) = @_;
	    eval q( &static  &void  &atfu_  $tc   &_head( &atf_tc_t *);  &static  &void  &atfu_  $tc   &_body( &const  &atf_tc_t *);  &static  &void  &atfu_  $tc   &_cleanup( &const  &atf_tc_t *);  &static  &atf_tc_t  &atfu_  $tc   &_tc;  &static  &atf_tc_pack_t  &atfu_  $tc   &_tc_pack = { . &m_ident = $tc, . &m_head =  &atfu_  $tc   &_head, . &m_body =  &atfu_  $tc   &_body, . &m_cleanup =  &atfu_  $tc   &_cleanup, });
    }' unless defined(&ATF_TC_WITH_CLEANUP);
    eval 'sub ATF_TC_HEAD {
        my($tc, $tcptr) = @_;
	    eval q( &static  &void  &atfu_  $tc   &_head( &atf_tc_t *$tcptr  &ATF_DEFS_ATTRIBUTE_UNUSED));
    }' unless defined(&ATF_TC_HEAD);
    eval 'sub ATF_TC_HEAD_NAME {
        my($tc) = @_;
	    eval q(( &atfu_  $tc   &_head));
    }' unless defined(&ATF_TC_HEAD_NAME);
    eval 'sub ATF_TC_BODY {
        my($tc, $tcptr) = @_;
	    eval q( &static  &void  &atfu_  $tc   &_body( &const  &atf_tc_t *$tcptr  &ATF_DEFS_ATTRIBUTE_UNUSED));
    }' unless defined(&ATF_TC_BODY);
    eval 'sub ATF_TC_BODY_NAME {
        my($tc) = @_;
	    eval q(( &atfu_  $tc   &_body));
    }' unless defined(&ATF_TC_BODY_NAME);
    eval 'sub ATF_TC_CLEANUP {
        my($tc, $tcptr) = @_;
	    eval q( &static  &void  &atfu_  $tc   &_cleanup( &const  &atf_tc_t *$tcptr  &ATF_DEFS_ATTRIBUTE_UNUSED));
    }' unless defined(&ATF_TC_CLEANUP);
    eval 'sub ATF_TC_CLEANUP_NAME {
        my($tc) = @_;
	    eval q(( &atfu_  $tc   &_cleanup));
    }' unless defined(&ATF_TC_CLEANUP_NAME);
    eval 'sub ATF_TP_ADD_TCS {
        my($tps) = @_;
	    eval q( &static  &atf_error_t  &atfu_tp_add_tcs( &atf_tp_t *); \'int\'  &atf_tp_main(\'int\', \'char\' **,  &atf_error_t (*)( &atf_tp_t *)); \'int\'  &main(\'int\'  &argc, \'char\' ** &argv) {  &return  &atf_tp_main( &argc,  &argv,  &atfu_tp_add_tcs); }  &static  &atf_error_t  &atfu_tp_add_tcs( &atf_tp_t *$tps));
    }' unless defined(&ATF_TP_ADD_TCS);
    eval 'sub ATF_TP_ADD_TC {
        my($tp, $tc) = @_;
	    eval q( &do {  &atf_error_t  &atfu_err; \'char\' ** &atfu_config =  &atf_tp_get_config($tp);  &if ( &atfu_config ==  &NULL)  &return  &atf_no_memory_error();  &atfu_err =  &atf_tc_init_pack( &atfu_  $tc   &_tc,  &atfu_  $tc   &_tc_pack, ( &const \'char\' * &const *) &atfu_config);  &atf_utils_free_charpp( &atfu_config);  &if ( &atf_is_error( &atfu_err))  &return  &atfu_err;  &atfu_err =  &atf_tp_add_tc($tp,  &atfu_  $tc   &_tc);  &if ( &atf_is_error( &atfu_err))  &return  &atfu_err; }  &while (0));
    }' unless defined(&ATF_TP_ADD_TC);
    eval 'sub ATF_REQUIRE_MSG () {( &x,  &fmt, ...)  &do {  &if (!( &x))  &atf_tc_fail_requirement( &__FILE__,  &__LINE__,  &fmt,  &__VA_ARGS__); }  &while(0);}' unless defined(&ATF_REQUIRE_MSG);
    eval 'sub ATF_CHECK_MSG () {( &x,  &fmt, ...)  &do {  &if (!( &x))  &atf_tc_fail_check( &__FILE__,  &__LINE__,  &fmt,  &__VA_ARGS__); }  &while(0);}' unless defined(&ATF_CHECK_MSG);
    eval 'sub ATF_REQUIRE {
        my($x) = @_;
	    eval q( &do {  &if (!($x))  &atf_tc_fail_requirement( &__FILE__,  &__LINE__, \\"%s\\", $x \\" not met\\"); }  &while(0));
    }' unless defined(&ATF_REQUIRE);
    eval 'sub ATF_CHECK {
        my($x) = @_;
	    eval q( &do {  &if (!($x))  &atf_tc_fail_check( &__FILE__,  &__LINE__, \\"%s\\", $x \\" not met\\"); }  &while(0));
    }' unless defined(&ATF_CHECK);
    eval 'sub ATF_REQUIRE_EQ {
        my($x, $y) = @_;
	    eval q( &ATF_REQUIRE_MSG(($x) == ($y), \\"%s != %s\\", $x, $y));
    }' unless defined(&ATF_REQUIRE_EQ);
    eval 'sub ATF_CHECK_EQ {
        my($x, $y) = @_;
	    eval q( &ATF_CHECK_MSG(($x) == ($y), \\"%s != %s\\", $x, $y));
    }' unless defined(&ATF_CHECK_EQ);
    eval 'sub ATF_REQUIRE_EQ_MSG () {( &x,  &y,  &fmt, ...)  &ATF_REQUIRE_MSG(( &x) == ( &y), "%s != %s: "  &fmt,  &x,  &y,  &__VA_ARGS__);}' unless defined(&ATF_REQUIRE_EQ_MSG);
    eval 'sub ATF_CHECK_EQ_MSG () {( &x,  &y,  &fmt, ...)  &ATF_CHECK_MSG(( &x) == ( &y), "%s != %s: "  &fmt,  &x,  &y,  &__VA_ARGS__);}' unless defined(&ATF_CHECK_EQ_MSG);
    eval 'sub ATF_REQUIRE_STREQ {
        my($x, $y) = @_;
	    eval q( &ATF_REQUIRE_MSG( &strcmp($x, $y) == 0, \\"%s != %s (%s != %s)\\", $x, $y, $x, $y));
    }' unless defined(&ATF_REQUIRE_STREQ);
    eval 'sub ATF_CHECK_STREQ {
        my($x, $y) = @_;
	    eval q( &ATF_CHECK_MSG( &strcmp($x, $y) == 0, \\"%s != %s (%s != %s)\\", $x, $y, $x, $y));
    }' unless defined(&ATF_CHECK_STREQ);
    eval 'sub ATF_REQUIRE_STREQ_MSG () {( &x,  &y,  &fmt, ...)  &ATF_REQUIRE_MSG( &strcmp( &x,  &y) == 0, "%s != %s (%s != %s): "  &fmt,  &x,  &y,  &x,  &y,  &__VA_ARGS__);}' unless defined(&ATF_REQUIRE_STREQ_MSG);
    eval 'sub ATF_CHECK_STREQ_MSG () {( &x,  &y,  &fmt, ...)  &ATF_CHECK_MSG( &strcmp( &x,  &y) == 0, "%s != %s (%s != %s): "  &fmt,  &x,  &y,  &x,  &y,  &__VA_ARGS__);}' unless defined(&ATF_CHECK_STREQ_MSG);
    eval 'sub ATF_REQUIRE_MATCH {
        my($regexp, $string) = @_;
	    eval q( &ATF_REQUIRE_MSG( &atf_utils_grep_string(\\"%s\\", $string, $regexp), \\"\'%s\' not matched in \'%s\'\\", $regexp, $string););
    }' unless defined(&ATF_REQUIRE_MATCH);
    eval 'sub ATF_CHECK_MATCH {
        my($regexp, $string) = @_;
	    eval q( &ATF_CHECK_MSG( &atf_utils_grep_string(\\"%s\\", $string, $regexp), \\"\'%s\' not matched in \'%s\'\\", $regexp, $string););
    }' unless defined(&ATF_CHECK_MATCH);
    eval 'sub ATF_REQUIRE_MATCH_MSG () {( &regexp,  &string,  &fmt, ...)  &ATF_REQUIRE_MSG( &atf_utils_grep_string("%s",  &string,  &regexp), "\'%s\' not matched in \'%s\': "  &fmt,  &regexp,  &string,  &__VA_ARGS__);;}' unless defined(&ATF_REQUIRE_MATCH_MSG);
    eval 'sub ATF_CHECK_MATCH_MSG () {( &regexp,  &string,  &fmt, ...)  &ATF_CHECK_MSG( &atf_utils_grep_string("%s",  &string,  &regexp), "\'%s\' not matched in \'%s\': "  &fmt,  &regexp,  &string,  &__VA_ARGS__);;}' unless defined(&ATF_CHECK_MATCH_MSG);
    eval 'sub ATF_CHECK_ERRNO {
        my($exp_errno, $bool_expr) = @_;
	    eval q( &atf_tc_check_errno( &__FILE__,  &__LINE__, $exp_errno, $bool_expr, $bool_expr));
    }' unless defined(&ATF_CHECK_ERRNO);
    eval 'sub ATF_REQUIRE_ERRNO {
        my($exp_errno, $bool_expr) = @_;
	    eval q( &atf_tc_require_errno( &__FILE__,  &__LINE__, $exp_errno, $bool_expr, $bool_expr));
    }' unless defined(&ATF_REQUIRE_ERRNO);
}
1;
