namespace PhpEmbed {
    /*
     * Named PHP function zval wrappers are generated during the Meson build
     * from libphp get_defined_functions(). Keep hand-written zval code out of
     * this file unless it cannot be represented by the generated ABI:
     *
     *   PhpEmbed.<php_function>_zval (php_file, php_line, args...)
     */

    public Php.zval preg_match_zval (Php.zval pattern, Php.zval value, out Php.zval matches, string php_file, int php_line) throws Error {
        int result = preg_match_static (Php.zval_to_string (pattern), Php.zval_to_string (value), out matches, php_file, php_line);
        return Php.zval.integer (result);
    }

    public Php.zval preg_match_bool_zval (Php.zval pattern, Php.zval value, string php_file, int php_line) throws Error {
        return Php.zval.integer (preg_match_bool_static (Php.zval_to_string (pattern), Php.zval_to_string (value), php_file, php_line) ? 1 : 0);
    }

    public Php.zval preg_match_all_zval (Php.zval pattern, Php.zval value, out Php.zval matches, Php.zval flags, string php_file, int php_line) throws Error {
        int result = preg_match_all_static (Php.zval_to_string (pattern), Php.zval_to_string (value), out matches, Php.zval_to_int (flags), php_file, php_line);
        return Php.zval.integer (result);
    }
}
