% compiler: GNU Prolog 1.1.6 (Apr 13 2000)
% file    : stream.pl
% date    : 4 17 2000
% time    : 2:15:40


file_name('C:\\GNU-Prolog\\src\\BipsPl\\stream.pl').


predicate('$use_stream'/0,27,static,private,built_in,[
    proceed]).


predicate(current_input/1,30,static,private,built_in,[
    allocate(1),
    put_atom(current_input,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(0),1),
    call('$check_stream_or_var'/2),
    put_unsafe_value(y(0),0),
    call_c_test('Current_Input_1',[0]),
    deallocate,
    proceed]).


predicate(current_output/1,38,static,private,built_in,[
    allocate(1),
    put_atom(current_output,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(0),1),
    call('$check_stream_or_var'/2),
    put_unsafe_value(y(0),0),
    call_c_test('Current_Output_1',[0]),
    deallocate,
    proceed]).


predicate('$check_stream_or_var'/2,46,static,private,built_in,[
    load_cut_level(2),
    try_me_else(2),
    switch_on_term(1,fail,fail,fail,1),

label(1),
    allocate(1),
    get_structure('$stream'/1,0),
    unify_local_value(x(1)),
    get_variable(y(0),2),
    put_value(x(1),0),
    call('$$check_stream_or_var/2_$aux1'/1),
    cut(y(0)),
    deallocate,
    proceed,

label(2),
    trust_me_else_fail,
    put_value(x(0),1),
    put_atom(stream,0),
    execute('$pl_err_domain'/2)]).


predicate('$$check_stream_or_var/2_$aux1'/1,46,static,private,built_in,[
    try_me_else(1),
    call_c_test('Blt_Var',[0]),
    proceed,

label(1),
    trust_me_else_fail,
    call_c_test('Blt_Integer',[0]),
    proceed]).


predicate(set_input/1,56,static,private,built_in,[
    put_atom(set_input,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c('Set_Input_1',[0]),
    proceed]).


predicate(set_output/1,63,static,private,built_in,[
    put_atom(set_output,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c('Set_Output_1',[0]),
    proceed]).


predicate('$set_top_level_streams'/2,70,static,private,built_in,[
    call_c('Set_Top_Level_Streams_2',[0,1]),
    proceed]).


predicate('$set_debugger_streams'/2,76,static,private,built_in,[
    call_c('Set_Debugger_Streams_2',[0,1]),
    proceed]).


predicate(open/3,95,static,private,built_in,[
    put_atom(open,3),
    put_integer(3,4),
    call_c('Set_Bip_Name_2',[3,4]),
    put_nil(3),
    execute('$open'/4)]).


predicate(open/4,100,static,private,built_in,[
    put_atom(open,4),
    put_integer(4,5),
    call_c('Set_Bip_Name_2',[4,5]),
    execute('$open'/4)]).


predicate('$open'/4,105,static,private,built_in,[
    allocate(6),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    get_variable(y(3),3),
    call('$set_open_defaults'/0),
    put_value(y(2),0),
    put_variable(y(4),1),
    call('$get_open_stm'/2),
    put_value(y(3),0),
    put_variable(y(5),1),
    call('$get_open_options'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    put_unsafe_value(y(4),2),
    call_c('Open_3',[0,1,2]),
    put_unsafe_value(y(5),0),
    put_value(y(2),1),
    deallocate,
    execute('$add_alias_to_stream'/2)]).


predicate('$set_open_defaults'/0,115,static,private,built_in,[
    put_integer(0,0),
    put_integer(1,1),
    execute('$sys_var_write'/2)]).


predicate('$get_open_stm'/2,121,static,private,built_in,[
    execute('$$get_open_stm/2_$aux1'/2)]).


predicate('$$get_open_stm/2_$aux1'/2,121,static,private,built_in,[
    load_cut_level(2),
    try_me_else(1),
    call_c_test('Blt_Non_Var',[0]),
    cut(x(2)),
    put_value(x(0),1),
    put_atom(variable,0),
    execute('$pl_err_type'/2),

label(1),
    trust_me_else_fail,
    switch_on_term(2,fail,fail,fail,2),

label(2),
    get_structure('$stream'/1,0),
    unify_local_value(x(1)),
    proceed]).


predicate('$get_open_options'/2,128,static,private,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_value(y(0),0),
    call('$check_list'/1),
    put_value(y(0),0),
    put_nil(1),
    put_value(y(1),2),
    deallocate,
    execute('$get_open_options1'/3)]).


predicate('$get_open_options1'/3,133,static,private,built_in,[
    load_cut_level(3),
    switch_on_term(1,2,fail,4,fail),

label(1),
    try_me_else(3),

label(2),
    get_nil(0),
    get_value(x(2),1),
    proceed,

label(3),
    trust_me_else_fail,

label(4),
    allocate(4),
    get_variable(y(1),2),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_variable(y(2),3),
    put_variable(y(3),2),
    call('$get_open_options2'/3),
    cut(y(2)),
    put_value(y(0),0),
    put_unsafe_value(y(3),1),
    put_value(y(1),2),
    deallocate,
    execute('$get_open_options1'/3)]).


predicate('$get_open_options2'/3,141,static,private,built_in,[
    load_cut_level(3),
    try_me_else(1),
    call_c_test('Blt_Var',[0]),
    execute('$pl_err_instantiation'/0),

label(1),
    retry_me_else(13),
    switch_on_term(3,fail,fail,fail,2),

label(2),
    switch_on_structure([(type/1,4),(reposition/1,6),(eof_action/1,8),(buffering/1,10),(alias/1,12)]),

label(3),
    try_me_else(5),

label(4),
    get_value(x(2),1),
    get_structure(type/1,0),
    unify_variable(x(0)),
    call_c_test('Blt_Non_Var',[0]),
    execute('$$get_open_options2/3_$aux1'/1),

label(5),
    retry_me_else(7),

label(6),
    allocate(0),
    get_value(x(2),1),
    get_structure(reposition/1,0),
    unify_variable(x(0)),
    call_c_test('Blt_Non_Var',[0]),
    call('$$get_open_options2/3_$aux2'/1),
    put_integer(0,0),
    put_integer(2,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(7),
    retry_me_else(9),

label(8),
    allocate(0),
    get_value(x(2),1),
    get_structure(eof_action/1,0),
    unify_variable(x(0)),
    call_c_test('Blt_Non_Var',[0]),
    call('$$get_open_options2/3_$aux3'/1),
    put_integer(0,0),
    put_integer(5,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(9),
    retry_me_else(11),

label(10),
    allocate(0),
    get_value(x(2),1),
    get_structure(buffering/1,0),
    unify_variable(x(0)),
    call_c_test('Blt_Non_Var',[0]),
    call('$$get_open_options2/3_$aux4'/1),
    put_integer(0,0),
    put_integer(8,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(11),
    trust_me_else_fail,

label(12),
    get_structure(alias/1,0),
    unify_variable(x(0)),
    get_list(2),
    unify_value(x(0)),
    unify_local_value(x(1)),
    call_c_test('Blt_Atom',[0]),
    cut(x(3)),
    execute('$$get_open_options2/3_$aux5'/1),

label(13),
    trust_me_else_fail,
    put_value(x(0),1),
    put_atom(stream_option,0),
    execute('$pl_err_domain'/2)]).


predicate('$$get_open_options2/3_$aux5'/1,176,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    call_c_test('Test_Alias_Not_Assigned_1',[0]),
    cut(x(1)),
    proceed,

label(1),
    trust_me_else_fail,
    put_structure(alias/1,2),
    unify_local_value(x(0)),
    put_atom(open,0),
    put_atom(source_sink,1),
    execute('$pl_err_permission'/3)]).


predicate('$$get_open_options2/3_$aux4'/1,167,static,private,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(none,3),(line,5),(block,7)]),

label(2),
    try_me_else(4),

label(3),
    allocate(0),
    get_atom(none,0),
    put_integer(0,0),
    put_integer(7,1),
    call('$sys_var_reset_bit'/2),
    put_integer(0,0),
    put_integer(6,1),
    deallocate,
    execute('$sys_var_reset_bit'/2),

label(4),
    retry_me_else(6),

label(5),
    allocate(0),
    get_atom(line,0),
    put_integer(0,0),
    put_integer(7,1),
    call('$sys_var_reset_bit'/2),
    put_integer(0,0),
    put_integer(6,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(6),
    trust_me_else_fail,

label(7),
    allocate(0),
    get_atom(block,0),
    put_integer(0,0),
    put_integer(7,1),
    call('$sys_var_set_bit'/2),
    put_integer(0,0),
    put_integer(6,1),
    deallocate,
    execute('$sys_var_reset_bit'/2)]).


predicate('$$get_open_options2/3_$aux3'/1,158,static,private,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(error,3),(eof_code,5),(reset,7)]),

label(2),
    try_me_else(4),

label(3),
    allocate(0),
    get_atom(error,0),
    put_integer(0,0),
    put_integer(4,1),
    call('$sys_var_reset_bit'/2),
    put_integer(0,0),
    put_integer(3,1),
    deallocate,
    execute('$sys_var_reset_bit'/2),

label(4),
    retry_me_else(6),

label(5),
    allocate(0),
    get_atom(eof_code,0),
    put_integer(0,0),
    put_integer(4,1),
    call('$sys_var_reset_bit'/2),
    put_integer(0,0),
    put_integer(3,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(6),
    trust_me_else_fail,

label(7),
    allocate(0),
    get_atom(reset,0),
    put_integer(0,0),
    put_integer(4,1),
    call('$sys_var_set_bit'/2),
    put_integer(0,0),
    put_integer(3,1),
    deallocate,
    execute('$sys_var_reset_bit'/2)]).


predicate('$$get_open_options2/3_$aux2'/1,151,static,private,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(false,3),(true,5)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(false,0),
    put_integer(0,0),
    put_integer(1,1),
    execute('$sys_var_reset_bit'/2),

label(4),
    trust_me_else_fail,

label(5),
    get_atom(true,0),
    put_integer(0,0),
    put_integer(1,1),
    execute('$sys_var_set_bit'/2)]).


predicate('$$get_open_options2/3_$aux1'/1,145,static,private,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(text,3),(binary,5)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(text,0),
    put_integer(0,0),
    put_integer(0,1),
    execute('$sys_var_set_bit'/2),

label(4),
    trust_me_else_fail,

label(5),
    get_atom(binary,0),
    put_integer(0,0),
    put_integer(0,1),
    execute('$sys_var_reset_bit'/2)]).


predicate('$add_alias_to_stream'/2,189,static,private,built_in,[
    switch_on_term(1,2,fail,4,fail),

label(1),
    try_me_else(3),

label(2),
    get_nil(0),
    proceed,

label(3),
    trust_me_else_fail,

label(4),
    get_list(0),
    unify_variable(x(2)),
    unify_variable(x(0)),
    call_c('Add_Stream_Alias_2',[1,2]),
    execute('$add_alias_to_stream'/2)]).


predicate(close/1,207,static,private,built_in,[
    put_atom(close,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_nil(1),
    execute('$close'/2)]).


predicate(close/2,211,static,private,built_in,[
    put_atom(close,2),
    put_integer(2,3),
    call_c('Set_Bip_Name_2',[2,3]),
    execute('$close'/2)]).


predicate('$close'/2,216,static,private,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_integer(0,0),
    put_integer(0,1),
    call('$sys_var_write'/2),
    put_value(y(1),0),
    call('$get_close_options'/1),
    put_value(y(0),0),
    call_c('Close_1',[0]),
    deallocate,
    proceed]).


predicate('$get_close_options'/1,224,static,private,built_in,[
    allocate(1),
    get_variable(y(0),0),
    put_value(y(0),0),
    call('$check_list'/1),
    put_value(y(0),0),
    deallocate,
    execute('$get_close_options1'/1)]).


predicate('$get_close_options1'/1,229,static,private,built_in,[
    load_cut_level(1),
    switch_on_term(1,2,fail,4,fail),

label(1),
    try_me_else(3),

label(2),
    get_nil(0),
    proceed,

label(3),
    trust_me_else_fail,

label(4),
    allocate(2),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_variable(y(1),1),
    call('$get_close_options2'/1),
    cut(y(1)),
    put_value(y(0),0),
    deallocate,
    execute('$get_close_options1'/1)]).


predicate('$get_close_options2'/1,237,static,private,built_in,[
    try_me_else(1),
    call_c_test('Blt_Var',[0]),
    execute('$pl_err_instantiation'/0),

label(1),
    retry_me_else(3),
    switch_on_term(2,fail,fail,fail,2),

label(2),
    get_structure(force/1,0),
    unify_variable(x(0)),
    call_c_test('Blt_Non_Var',[0]),
    execute('$$get_close_options2/1_$aux1'/1),

label(3),
    trust_me_else_fail,
    put_value(x(0),1),
    put_atom(close_option,0),
    execute('$pl_err_domain'/2)]).


predicate('$$get_close_options2/1_$aux1'/1,241,static,private,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(false,3),(true,5)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(false,0),
    put_integer(0,0),
    put_integer(0,1),
    execute('$sys_var_reset_bit'/2),

label(4),
    trust_me_else_fail,

label(5),
    get_atom(true,0),
    put_integer(0,0),
    put_integer(0,1),
    execute('$sys_var_set_bit'/2)]).


predicate(add_stream_alias/2,253,static,private,built_in,[
    load_cut_level(2),
    try_me_else(1),
    put_atom(add_stream_alias,3),
    put_integer(2,4),
    call_c('Set_Bip_Name_2',[3,4]),
    call_c_test('Add_Stream_Alias_2',[0,1]),
    cut(x(2)),
    proceed,

label(1),
    trust_me_else_fail,
    put_structure(alias/1,2),
    unify_local_value(x(1)),
    put_atom(add_alias,0),
    put_atom(source_sink,1),
    execute('$pl_err_permission'/3)]).


predicate(set_stream_type/2,264,static,private,built_in,[
    load_cut_level(2),
    try_me_else(1),
    allocate(4),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_atom(set_stream_type,0),
    put_integer(2,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_value(y(1),0),
    call('$set_stream_type/2_$aux1'/1),
    put_value(y(1),0),
    put_variable(y(3),1),
    call('$set_stream_type/2_$aux2'/2),
    cut(y(2)),
    put_value(y(0),0),
    put_unsafe_value(y(3),1),
    call_c('Set_Stream_Type_2',[0,1]),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    put_atom(stream_type,0),
    execute('$pl_err_domain'/2)]).


predicate('$set_stream_type/2_$aux2'/2,264,static,private,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(text,3),(binary,5)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(text,0),
    get_integer(1,1),
    proceed,

label(4),
    trust_me_else_fail,

label(5),
    get_atom(binary,0),
    get_integer(0,1),
    proceed]).


predicate('$set_stream_type/2_$aux1'/1,264,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    call_c_test('Blt_Var',[0]),
    cut(x(1)),
    execute('$pl_err_instantiation'/0),

label(1),
    trust_me_else_fail,
    proceed]).


predicate(set_stream_eof_action/2,280,static,private,built_in,[
    load_cut_level(2),
    try_me_else(1),
    allocate(4),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_atom(set_stream_eof_action,0),
    put_integer(2,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_value(y(1),0),
    call('$set_stream_eof_action/2_$aux1'/1),
    put_value(y(1),0),
    put_variable(y(3),1),
    call('$set_stream_eof_action/2_$aux2'/2),
    cut(y(2)),
    put_value(y(0),0),
    put_unsafe_value(y(3),1),
    call_c('Set_Stream_Eof_Action_2',[0,1]),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    put_atom(eof_action,0),
    execute('$pl_err_domain'/2)]).


predicate('$set_stream_eof_action/2_$aux2'/2,280,static,private,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(error,3),(eof_code,5),(reset,7)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(error,0),
    get_integer(0,1),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_atom(eof_code,0),
    get_integer(1,1),
    proceed,

label(6),
    trust_me_else_fail,

label(7),
    get_atom(reset,0),
    get_integer(2,1),
    proceed]).


predicate('$set_stream_eof_action/2_$aux1'/1,280,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    call_c_test('Blt_Var',[0]),
    cut(x(1)),
    execute('$pl_err_instantiation'/0),

label(1),
    trust_me_else_fail,
    proceed]).


predicate(set_stream_buffering/2,298,static,private,built_in,[
    load_cut_level(2),
    try_me_else(1),
    allocate(4),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_atom(set_stream_buffering,0),
    put_integer(2,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_value(y(1),0),
    call('$set_stream_buffering/2_$aux1'/1),
    put_value(y(1),0),
    put_variable(y(3),1),
    call('$set_stream_buffering/2_$aux2'/2),
    cut(y(2)),
    put_value(y(0),0),
    put_unsafe_value(y(3),1),
    call_c('Set_Stream_Buffering_2',[0,1]),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    put_atom(buffering_mode,0),
    execute('$pl_err_domain'/2)]).


predicate('$set_stream_buffering/2_$aux2'/2,298,static,private,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(none,3),(line,5),(block,7)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(none,0),
    get_integer(0,1),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_atom(line,0),
    get_integer(1,1),
    proceed,

label(6),
    trust_me_else_fail,

label(7),
    get_atom(block,0),
    get_integer(2,1),
    proceed]).


predicate('$set_stream_buffering/2_$aux1'/1,298,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    call_c_test('Blt_Var',[0]),
    cut(x(1)),
    execute('$pl_err_instantiation'/0),

label(1),
    trust_me_else_fail,
    proceed]).


predicate(flush_output/0,316,static,private,built_in,[
    put_atom(flush_output,0),
    put_integer(0,1),
    call_c('Set_Bip_Name_2',[0,1]),
    call_c('Flush_Output_0',[]),
    proceed]).


predicate(flush_output/1,320,static,private,built_in,[
    put_atom(flush_output,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c('Flush_Output_1',[0]),
    proceed]).


predicate(current_stream/1,327,static,private,built_in,[
    allocate(1),
    put_atom(current_stream,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(0),1),
    call('$check_stream_or_var'/2),
    put_unsafe_value(y(0),0),
    deallocate,
    execute('$current_stream'/1)]).


predicate('$current_stream'/1,335,static,private,built_in,[
    call_c_test('Current_Stream_1',[0]),
    proceed]).


predicate('$current_stream_alt'/0,339,static,private,built_in,[
    call_c_test('Current_Stream_Alt_0',[]),
    proceed]).


predicate(stream_property/2,345,static,private,built_in,[
    load_cut_level(2),
    allocate(3),
    get_variable(y(0),1),
    get_variable(y(1),2),
    put_atom(stream_property,1),
    put_integer(2,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(2),1),
    call('$check_stream_or_var'/2),
    put_value(y(0),0),
    put_unsafe_value(y(2),1),
    put_value(y(1),2),
    deallocate,
    execute('$stream_property/2_$aux1'/3)]).


predicate('$stream_property/2_$aux1'/3,345,static,private,built_in,[
    load_cut_level(3),
    try_me_else(1),
    call_c_test('Blt_Non_Var',[0]),
    get_structure(alias/1,0),
    unify_variable(x(0)),
    call_c_test('Blt_Atom',[0]),
    cut(x(3)),
    call_c_test('From_Alias_To_Stream_2',[0,1]),
    proceed,

label(1),
    trust_me_else_fail,
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_value(y(0),0),
    call('$check_stream_prop'/1),
    cut(y(2)),
    put_value(y(1),0),
    call('$current_stream'/1),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    execute('$stream_property1'/2)]).


predicate('$check_stream_prop'/1,359,static,private,built_in,[
    try_me_else(1),
    call_c_test('Blt_Var',[0]),
    proceed,

label(1),
    retry_me_else(26),
    switch_on_term(4,2,fail,fail,3),

label(2),
    switch_on_atom([(input,9),(output,11)]),

label(3),
    switch_on_structure([(file_name/1,5),(mode/1,7),(alias/1,13),(type/1,15),(reposition/1,17),(eof_action/1,19),(buffering/1,21),(end_of_stream/1,23),(position/1,25)]),

label(4),
    try_me_else(6),

label(5),
    get_structure(file_name/1,0),
    unify_void(1),
    proceed,

label(6),
    retry_me_else(8),

label(7),
    get_structure(mode/1,0),
    unify_void(1),
    proceed,

label(8),
    retry_me_else(10),

label(9),
    get_atom(input,0),
    proceed,

label(10),
    retry_me_else(12),

label(11),
    get_atom(output,0),
    proceed,

label(12),
    retry_me_else(14),

label(13),
    get_structure(alias/1,0),
    unify_void(1),
    proceed,

label(14),
    retry_me_else(16),

label(15),
    get_structure(type/1,0),
    unify_void(1),
    proceed,

label(16),
    retry_me_else(18),

label(17),
    get_structure(reposition/1,0),
    unify_void(1),
    proceed,

label(18),
    retry_me_else(20),

label(19),
    get_structure(eof_action/1,0),
    unify_void(1),
    proceed,

label(20),
    retry_me_else(22),

label(21),
    get_structure(buffering/1,0),
    unify_void(1),
    proceed,

label(22),
    retry_me_else(24),

label(23),
    get_structure(end_of_stream/1,0),
    unify_void(1),
    proceed,

label(24),
    trust_me_else_fail,

label(25),
    get_structure(position/1,0),
    unify_void(1),
    proceed,

label(26),
    trust_me_else_fail,
    put_value(x(0),1),
    put_atom(stream_property,0),
    execute('$pl_err_domain'/2)]).


predicate('$stream_property1'/2,390,static,private,built_in,[
    switch_on_term(3,1,fail,fail,2),

label(1),
    switch_on_atom([(input,8),(output,10)]),

label(2),
    switch_on_structure([(file_name/1,4),(mode/1,6),(alias/1,12),(type/1,14),(reposition/1,16),(eof_action/1,18),(buffering/1,20),(position/1,22),(end_of_stream/1,24)]),

label(3),
    try_me_else(5),

label(4),
    get_structure(file_name/1,0),
    unify_variable(x(0)),
    call_c_test('Stream_Prop_File_Name_2',[0,1]),
    proceed,

label(5),
    retry_me_else(7),

label(6),
    get_structure(mode/1,0),
    unify_variable(x(0)),
    call_c_test('Stream_Prop_Mode_2',[0,1]),
    proceed,

label(7),
    retry_me_else(9),

label(8),
    get_atom(input,0),
    call_c_test('Stream_Prop_Input_1',[1]),
    proceed,

label(9),
    retry_me_else(11),

label(10),
    get_atom(output,0),
    call_c_test('Stream_Prop_Output_1',[1]),
    proceed,

label(11),
    retry_me_else(13),

label(12),
    get_variable(x(2),1),
    get_structure(alias/1,0),
    unify_variable(x(1)),
    put_value(x(2),0),
    execute('$current_alias'/2),

label(13),
    retry_me_else(15),

label(14),
    get_structure(type/1,0),
    unify_variable(x(0)),
    call_c_test('Stream_Prop_Type_2',[0,1]),
    proceed,

label(15),
    retry_me_else(17),

label(16),
    get_structure(reposition/1,0),
    unify_variable(x(0)),
    call_c_test('Stream_Prop_Reposition_2',[0,1]),
    proceed,

label(17),
    retry_me_else(19),

label(18),
    get_structure(eof_action/1,0),
    unify_variable(x(0)),
    call_c_test('Stream_Prop_Eof_Action_2',[0,1]),
    proceed,

label(19),
    retry_me_else(21),

label(20),
    get_structure(buffering/1,0),
    unify_variable(x(0)),
    call_c_test('Stream_Prop_Buffering_2',[0,1]),
    proceed,

label(21),
    retry_me_else(23),

label(22),
    get_variable(x(2),1),
    get_structure(position/1,0),
    unify_variable(x(1)),
    put_structure('$stream'/1,0),
    unify_local_value(x(2)),
    execute('$stream_position'/2),

label(23),
    trust_me_else_fail,

label(24),
    get_structure(end_of_stream/1,0),
    unify_variable(x(0)),
    call_c_test('Stream_Prop_End_Of_Stream_2',[0,1]),
    proceed]).


predicate(at_end_of_stream/0,427,static,private,built_in,[
    put_atom(at_end_of_stream,0),
    put_integer(0,1),
    call_c('Set_Bip_Name_2',[0,1]),
    call_c_test('At_End_Of_Stream_0',[]),
    proceed]).


predicate(at_end_of_stream/1,431,static,private,built_in,[
    put_atom(at_end_of_stream,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c_test('At_End_Of_Stream_1',[0]),
    proceed]).


predicate(current_alias/2,438,static,private,built_in,[
    allocate(2),
    get_variable(y(0),1),
    put_atom(current_alias,1),
    put_integer(2,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(1),1),
    call('$check_stream_or_var'/2),
    put_value(y(0),0),
    put_unsafe_value(y(1),1),
    deallocate,
    execute('$current_alias/2_$aux1'/2)]).


predicate('$current_alias/2_$aux1'/2,438,static,private,built_in,[
    load_cut_level(2),
    try_me_else(1),
    call_c_test('Blt_Atom',[0]),
    cut(x(2)),
    call_c_test('From_Alias_To_Stream_2',[0,1]),
    proceed,

label(1),
    trust_me_else_fail,
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_value(y(1),0),
    call('$current_stream'/1),
    put_value(y(1),0),
    put_value(y(0),1),
    deallocate,
    execute('$current_alias'/2)]).


predicate('$current_alias'/2,449,static,private,built_in,[
    call_c_test('Current_Alias_2',[0,1]),
    proceed]).


predicate('$current_alias_alt'/0,452,static,private,built_in,[
    call_c_test('Current_Alias_Alt_0',[]),
    proceed]).


predicate(stream_position/2,458,static,private,built_in,[
    put_atom(stream_position,2),
    put_integer(2,3),
    call_c('Set_Bip_Name_2',[2,3]),
    execute('$stream_position'/2)]).


predicate('$stream_position'/2,463,static,private,built_in,[
    call_c_test('Stream_Position_2',[0,1]),
    proceed]).


predicate(set_stream_position/2,469,static,private,built_in,[
    put_atom(set_stream_position,2),
    put_integer(2,3),
    call_c('Set_Bip_Name_2',[2,3]),
    call_c_test('Set_Stream_Position_2',[0,1]),
    proceed]).


predicate(seek/4,476,static,private,built_in,[
    put_atom(seek,4),
    put_integer(4,5),
    call_c('Set_Bip_Name_2',[4,5]),
    call_c_test('Seek_4',[0,1,2,3]),
    proceed]).


predicate(character_count/2,483,static,private,built_in,[
    put_atom(character_count,2),
    put_integer(2,3),
    call_c('Set_Bip_Name_2',[2,3]),
    call_c_test('Character_Count_2',[0,1]),
    proceed]).


predicate(line_count/2,490,static,private,built_in,[
    put_atom(line_count,2),
    put_integer(2,3),
    call_c('Set_Bip_Name_2',[2,3]),
    call_c_test('Line_Count_2',[0,1]),
    proceed]).


predicate(line_position/2,497,static,private,built_in,[
    put_atom(line_position,2),
    put_integer(2,3),
    call_c('Set_Bip_Name_2',[2,3]),
    call_c_test('Line_Position_2',[0,1]),
    proceed]).


predicate(stream_line_column/3,504,static,private,built_in,[
    put_atom(stream_line_column,3),
    put_integer(3,4),
    call_c('Set_Bip_Name_2',[3,4]),
    call_c_test('Stream_Line_Column_3',[0,1,2]),
    proceed]).


predicate(set_stream_line_column/3,511,static,private,built_in,[
    put_atom(set_stream_line_column,3),
    put_integer(3,4),
    call_c('Set_Bip_Name_2',[3,4]),
    call_c_test('Set_Stream_Line_Column_3',[0,1,2]),
    proceed]).


predicate(open_input_atom_stream/2,527,static,private,built_in,[
    allocate(2),
    get_variable(y(0),0),
    put_atom(open_input_atom_stream,0),
    put_integer(2,2),
    call_c('Set_Bip_Name_2',[0,2]),
    put_value(x(1),0),
    put_variable(y(1),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(0,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_unsafe_value(y(1),1),
    call_c('Open_Input_Term_Stream_2',[0,1]),
    deallocate,
    proceed]).


predicate(open_input_chars_stream/2,536,static,private,built_in,[
    allocate(2),
    get_variable(y(0),0),
    put_atom(open_input_chars_stream,0),
    put_integer(2,2),
    call_c('Set_Bip_Name_2',[0,2]),
    put_value(x(1),0),
    put_variable(y(1),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(1,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_unsafe_value(y(1),1),
    call_c('Open_Input_Term_Stream_2',[0,1]),
    deallocate,
    proceed]).


predicate(open_input_codes_stream/2,545,static,private,built_in,[
    allocate(2),
    get_variable(y(0),0),
    put_atom(open_input_codes_stream,0),
    put_integer(2,2),
    call_c('Set_Bip_Name_2',[0,2]),
    put_value(x(1),0),
    put_variable(y(1),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(2,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_unsafe_value(y(1),1),
    call_c('Open_Input_Term_Stream_2',[0,1]),
    deallocate,
    proceed]).


predicate(close_input_atom_stream/1,554,static,private,built_in,[
    allocate(1),
    get_variable(y(0),0),
    put_atom(close_input_atom_stream,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_integer(0,0),
    put_integer(0,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    call_c('Close_Input_Term_Stream_1',[0]),
    deallocate,
    proceed]).


predicate(close_input_chars_stream/1,562,static,private,built_in,[
    allocate(1),
    get_variable(y(0),0),
    put_atom(close_input_chars_stream,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_integer(0,0),
    put_integer(1,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    call_c('Close_Input_Term_Stream_1',[0]),
    deallocate,
    proceed]).


predicate(close_input_codes_stream/1,570,static,private,built_in,[
    allocate(1),
    get_variable(y(0),0),
    put_atom(close_input_codes_stream,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_integer(0,0),
    put_integer(2,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    call_c('Close_Input_Term_Stream_1',[0]),
    deallocate,
    proceed]).


predicate(open_output_atom_stream/1,578,static,private,built_in,[
    allocate(1),
    put_atom(open_output_atom_stream,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(0),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(0,1),
    call('$sys_var_write'/2),
    put_unsafe_value(y(0),0),
    call_c('Open_Output_Term_Stream_1',[0]),
    deallocate,
    proceed]).


predicate(open_output_chars_stream/1,587,static,private,built_in,[
    allocate(1),
    put_atom(open_output_chars_stream,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(0),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(1,1),
    call('$sys_var_write'/2),
    put_unsafe_value(y(0),0),
    call_c('Open_Output_Term_Stream_1',[0]),
    deallocate,
    proceed]).


predicate(open_output_codes_stream/1,596,static,private,built_in,[
    allocate(1),
    put_atom(open_output_codes_stream,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(0),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(2,1),
    call('$sys_var_write'/2),
    put_unsafe_value(y(0),0),
    call_c('Open_Output_Term_Stream_1',[0]),
    deallocate,
    proceed]).


predicate(close_output_atom_stream/2,605,static,private,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(close_output_atom_stream,0),
    put_integer(2,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_integer(0,0),
    put_integer(0,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    call_c_test('Close_Output_Term_Stream_2',[0,1]),
    deallocate,
    proceed]).


predicate(close_output_chars_stream/2,613,static,private,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(close_output_chars_stream,0),
    put_integer(2,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_integer(0,0),
    put_integer(1,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    call_c_test('Close_Output_Term_Stream_2',[0,1]),
    deallocate,
    proceed]).


predicate(close_output_codes_stream/2,621,static,private,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(close_output_codes_stream,0),
    put_integer(2,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_integer(0,0),
    put_integer(2,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    call_c_test('Close_Output_Term_Stream_2',[0,1]),
    deallocate,
    proceed]).
