package YAML::Syck;
use strict;
use vars qw( @ISA @EXPORT $VERSION );

use 5.004;
use DynaLoader;
use YAML::Dumper::Syck;
use YAML::Loader::Syck;

$VERSION = '0.01';
@EXPORT  = qw(Dump Load);
@ISA     = qw( Exporter DynaLoader );

__PACKAGE__->bootstrap;

sub new { $_[0] }

sub Dump { YAML::Dumper::Syck->new->dump(@_) }

sub Load { YAML::Loader::Syck->new->load(@_) }

use constant XS_SYMS => qw( syck_perl_set_parser_handler syck_perl_parser_handler syck_perl_set_emitter_handler syck_perl_set_output_handler syck_perl_mark_emitter syck_perl_lookup_sym $syck_map_kind $syck_seq_kind $syck_str_kind $map_key $map_value $map_none $map_inline $seq_none $seq_inline $scalar_none $scalar_1quote $scalar_2quote $scalar_fold $scalar_literal $scalar_plain _syck_node_id_set _syck_node_id_get _syck_node_kind_set _syck_node_kind_get _syck_node_type_id_set _syck_node_type_id_get _syck_node_anchor_set _syck_node_anchor_get _syck_node_shortcut_set _syck_node_shortcut_get _syck_node_data_get new__syck_node delete__syck_node _syck_node_data_str_get _syck_node_data_list_get _syck_node_data_pairs_get new__syck_node_data delete__syck_node_data _syck_node_data_str_style_set _syck_node_data_str_style_get _syck_node_data_str_ptr_set _syck_node_data_str_ptr_get _syck_node_data_str_len_set _syck_node_data_str_len_get new__syck_node_data_str delete__syck_node_data_str _syck_node_data_list_style_set _syck_node_data_list_style_get _syck_node_data_list_items_set _syck_node_data_list_items_get _syck_node_data_list_capa_set _syck_node_data_list_capa_get _syck_node_data_list_idx_set _syck_node_data_list_idx_get new__syck_node_data_list delete__syck_node_data_list _syck_node_data_pairs_style_set _syck_node_data_pairs_style_get _syck_node_data_pairs_keys_set _syck_node_data_pairs_keys_get _syck_node_data_pairs_values_set _syck_node_data_pairs_values_get _syck_node_data_pairs_capa_set _syck_node_data_pairs_capa_get _syck_node_data_pairs_idx_set _syck_node_data_pairs_idx_get new__syck_node_data_pairs delete__syck_node_data_pairs $syck_io_str $syck_io_file $syck_yaml_utf8 $syck_yaml_utf16 $syck_yaml_utf32 $syck_bytecode_utf8 $syck_lvl_header $syck_lvl_doc $syck_lvl_open $syck_lvl_seq $syck_lvl_map $syck_lvl_block $syck_lvl_str $syck_lvl_iseq $syck_lvl_imap $syck_lvl_end $syck_lvl_pause $syck_lvl_anctag $syck_lvl_mapx $syck_lvl_seqx _syck_file_ptr_set _syck_file_ptr_get _syck_file_read_set _syck_file_read_get new__syck_file delete__syck_file _syck_str_beg_set _syck_str_beg_get _syck_str_ptr_set _syck_str_ptr_get _syck_str_end_set _syck_str_end_get _syck_str_read_set _syck_str_read_get new__syck_str delete__syck_str _syck_level_spaces_set _syck_level_spaces_get _syck_level_ncount_set _syck_level_ncount_get _syck_level_anctag_set _syck_level_anctag_get _syck_level_domain_set _syck_level_domain_get _syck_level_status_set _syck_level_status_get new__syck_level delete__syck_level _syck_parser_root_set _syck_parser_root_get _syck_parser_root_on_error_set _syck_parser_root_on_error_get _syck_parser_implicit_typing_set _syck_parser_implicit_typing_get _syck_parser_taguri_expansion_set _syck_parser_taguri_expansion_get _syck_parser_handler_set _syck_parser_handler_get _syck_parser_error_handler_set _syck_parser_error_handler_get _syck_parser_bad_anchor_handler_set _syck_parser_bad_anchor_handler_get _syck_parser_input_type_set _syck_parser_input_type_get _syck_parser_io_type_set _syck_parser_io_type_get _syck_parser_bufsize_set _syck_parser_bufsize_get _syck_parser_buffer_set _syck_parser_buffer_get _syck_parser_linectptr_set _syck_parser_linectptr_get _syck_parser_lineptr_set _syck_parser_lineptr_get _syck_parser_toktmp_set _syck_parser_toktmp_get _syck_parser_token_set _syck_parser_token_get _syck_parser_cursor_set _syck_parser_cursor_get _syck_parser_marker_set _syck_parser_marker_get _syck_parser_limit_set _syck_parser_limit_get _syck_parser_linect_set _syck_parser_linect_get _syck_parser_last_token_set _syck_parser_last_token_get _syck_parser_force_token_set _syck_parser_force_token_get _syck_parser_eof_set _syck_parser_eof_get _syck_parser_anchors_set _syck_parser_anchors_get _syck_parser_bad_anchors_set _syck_parser_bad_anchors_get _syck_parser_syms_set _syck_parser_syms_get _syck_parser_levels_set _syck_parser_levels_get _syck_parser_lvl_idx_set _syck_parser_lvl_idx_get _syck_parser_lvl_capa_set _syck_parser_lvl_capa_get _syck_parser_bonus_set _syck_parser_bonus_get _syck_parser_io_get new__syck_parser delete__syck_parser _syck_parser_io_file_set _syck_parser_io_file_get _syck_parser_io_str_set _syck_parser_io_str_get new__syck_parser_io delete__syck_parser_io $doc_open $doc_processing _syck_emitter_headless_set _syck_emitter_headless_get _syck_emitter_use_header_set _syck_emitter_use_header_get _syck_emitter_use_version_set _syck_emitter_use_version_get _syck_emitter_sort_keys_set _syck_emitter_sort_keys_get _syck_emitter_anchor_format_set _syck_emitter_anchor_format_get _syck_emitter_explicit_typing_set _syck_emitter_explicit_typing_get _syck_emitter_best_width_set _syck_emitter_best_width_get _syck_emitter_style_set _syck_emitter_style_get _syck_emitter_stage_set _syck_emitter_stage_get _syck_emitter_level_set _syck_emitter_level_get _syck_emitter_indent_set _syck_emitter_indent_get _syck_emitter_ignore_id_set _syck_emitter_ignore_id_get _syck_emitter_markers_set _syck_emitter_markers_get _syck_emitter_anchors_set _syck_emitter_anchors_get _syck_emitter_anchored_set _syck_emitter_anchored_get _syck_emitter_bufsize_set _syck_emitter_bufsize_get _syck_emitter_buffer_set _syck_emitter_buffer_get _syck_emitter_marker_set _syck_emitter_marker_get _syck_emitter_bufpos_set _syck_emitter_bufpos_get _syck_emitter_emitter_handler_set _syck_emitter_emitter_handler_get _syck_emitter_output_handler_set _syck_emitter_output_handler_get _syck_emitter_levels_set _syck_emitter_levels_get _syck_emitter_lvl_idx_set _syck_emitter_lvl_idx_get _syck_emitter_lvl_capa_set _syck_emitter_lvl_capa_get _syck_emitter_bonus_set _syck_emitter_bonus_get new__syck_emitter delete__syck_emitter _syck_emitter_node_pos_set _syck_emitter_node_pos_get _syck_emitter_node_indent_set _syck_emitter_node_indent_get _syck_emitter_node_is_shortcut_set _syck_emitter_node_is_shortcut_get new__syck_emitter_node delete__syck_emitter_node syck_hdlr_add_node syck_hdlr_add_anchor syck_hdlr_remove_anchor syck_hdlr_get_anchor syck_add_transfer syck_xprivate syck_taguri syck_tagcmp syck_add_sym syck_lookup_sym syck_try_implicit syck_type_id_to_uri try_tag_implicit syck_match_implicit syck_strndup syck_io_file_read syck_io_str_read syck_base64enc syck_base64dec syck_new_emitter syck_emitter_mark_node syck_output_handler syck_emitter_handler syck_free_emitter syck_emitter_clear syck_emitter_write syck_emitter_escape syck_emitter_flush syck_emit syck_emit_scalar syck_emit_1quoted syck_emit_2quoted syck_emit_folded syck_emit_literal syck_emit_seq syck_emit_item syck_emit_map syck_emit_end syck_emit_tag syck_emit_indent syck_emitter_current_level syck_emitter_parent_level syck_emitter_pop_level syck_emitter_add_level syck_emitter_reset_levels syck_new_parser syck_free_parser syck_parser_set_root_on_error syck_parser_implicit_typing syck_parser_taguri_expansion syck_scan_scalar syck_parser_handler syck_parser_error_handler syck_parser_bad_anchor_handler syck_parser_file syck_parser_str syck_parser_str_auto syck_parser_current_level syck_parser_add_level syck_parser_pop_level free_any_io syck_parser_read syck_parser_readlen syck_parse syck_default_error_handler syck_yaml2byte_handler syck_yaml2byte syck_alloc_map syck_alloc_seq syck_alloc_str syck_free_node syck_free_members syck_new_str syck_new_str2 syck_replace_str syck_replace_str2 syck_str_blow_away_commas syck_str_read syck_new_map syck_map_empty syck_map_add syck_map_read syck_map_assign syck_map_count syck_map_update syck_new_seq syck_seq_empty syck_seq_add syck_seq_assign syck_seq_read syck_seq_count syckerror syckparse );

no strict 'refs';
foreach my $func (XS_SYMS) {
    $func =~ /^(\$)?syck_(.+)/ or next;
    my ($sigil, $sym) = ($1, $2);
    if ($sigil) {
        my $name = substr($func, 1);
        *$sym = sub { shift; $$name };
    }
    else {
        my $code = __PACKAGE__->can($func) or die $func;
        *$sym = sub { shift; goto &$code };
    }
}

1;
