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


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


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


predicate('$find_existing_stream'/3,31,static,private,built_in,[
    load_cut_level(3),
    try_me_else(11),
    switch_on_term(3,1,fail,fail,fail),

label(1),
    switch_on_atom([(user,2),(user_input,6),(user_output,10)]),

label(2),
    try(4),
    trust(8),

label(3),
    try_me_else(5),

label(4),
    get_atom(user,0),
    get_structure('$stream'/1,1),
    unify_integer(0),
    get_atom(input,2),
    proceed,

label(5),
    retry_me_else(7),

label(6),
    get_atom(user_input,0),
    get_structure('$stream'/1,1),
    unify_integer(0),
    get_atom(input,2),
    proceed,

label(7),
    retry_me_else(9),

label(8),
    get_atom(user,0),
    get_structure('$stream'/1,1),
    unify_integer(1),
    get_atom(output,2),
    proceed,

label(9),
    trust_me_else_fail,

label(10),
    get_atom(user_output,0),
    get_structure('$stream'/1,1),
    unify_integer(1),
    get_atom(output,2),
    proceed,

label(11),
    retry_me_else(12),
    allocate(4),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    get_variable(y(3),3),
    put_structure('$dec10_stream'/3,0),
    unify_local_value(y(0)),
    unify_local_value(y(1)),
    unify_local_value(y(2)),
    put_void(1),
    call(clause/2),
    cut(y(3)),
    put_value(y(1),0),
    put_value(y(0),1),
    put_value(y(2),2),
    deallocate,
    execute('$$find_existing_stream/3_$aux1'/3),

label(12),
    trust_me_else_fail,
    allocate(2),
    get_variable(y(0),0),
    get_value(y(0),1),
    get_variable(y(1),2),
    put_value(y(0),0),
    get_structure('$stream'/1,0),
    unify_variable(x(0)),
    call_c_test('Blt_Integer',[0]),
    put_value(y(0),0),
    call(current_stream/1),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    execute(stream_property/2)]).


predicate('$$find_existing_stream/3_$aux1'/3,39,static,private,built_in,[
    load_cut_level(3),
    try_me_else(1),
    allocate(4),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    get_variable(y(3),3),
    put_value(y(0),0),
    call(current_stream/1),
    put_value(y(0),0),
    put_structure(file_name/1,1),
    unify_local_value(y(1)),
    call(stream_property/2),
    put_value(y(0),0),
    put_value(y(2),1),
    call(stream_property/2),
    cut(y(3)),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    allocate(0),
    get_variable(x(3),0),
    put_structure('$dec10_stream'/3,0),
    unify_local_value(x(1)),
    unify_local_value(x(3)),
    unify_local_value(x(2)),
    call(retract/1),
    fail]).


predicate(see/1,58,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    allocate(2),
    get_variable(y(0),1),
    put_atom(see,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c_test('Blt_Non_Var',[0]),
    cut(y(0)),
    put_variable(y(1),1),
    call('$see/1_$aux1'/2),
    cut(y(0)),
    put_unsafe_value(y(1),0),
    deallocate,
    execute(set_input/1),

label(1),
    trust_me_else_fail,
    execute('$pl_err_instantiation'/0)]).


predicate('$see/1_$aux1'/2,58,static,private,built_in,[
    try_me_else(1),
    put_atom(input,2),
    execute('$find_existing_stream'/3),

label(1),
    trust_me_else_fail,
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(see,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_value(y(0),0),
    put_atom(read,1),
    put_value(y(1),2),
    put_nil(3),
    call('$open'/4),
    put_structure('$dec10_stream'/3,0),
    unify_local_value(y(0)),
    unify_local_value(y(1)),
    unify_atom(input),
    deallocate,
    execute(assertz/1)]).


predicate(seeing/1,76,static,private,built_in,[
    load_cut_level(1),
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(seeing,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_variable(y(2),0),
    call(current_input/1),
    put_value(y(0),0),
    put_value(y(2),1),
    put_atom(input,2),
    call('$find_existing_stream'/3),
    cut(y(1)),
    deallocate,
    proceed]).


predicate(seen/0,85,static,private,built_in,[
    load_cut_level(0),
    allocate(2),
    get_variable(y(0),0),
    put_atom(seen,0),
    put_integer(0,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_variable(y(1),0),
    call(current_input/1),
    put_value(y(1),0),
    call(close/1),
    put_value(y(1),0),
    call('$seen/0_$aux1'/1),
    cut(y(0)),
    deallocate,
    proceed]).


predicate('$seen/0_$aux1'/1,85,static,private,built_in,[
    try_me_else(1),
    put_value(x(0),1),
    put_void(0),
    put_atom(input,2),
    execute('$find_existing_stream'/3),

label(1),
    trust_me_else_fail,
    proceed]).


predicate(tell/1,96,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    allocate(2),
    get_variable(y(0),1),
    put_atom(tell,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c_test('Blt_Non_Var',[0]),
    cut(y(0)),
    put_variable(y(1),1),
    call('$tell/1_$aux1'/2),
    cut(y(0)),
    put_unsafe_value(y(1),0),
    deallocate,
    execute(set_output/1),

label(1),
    trust_me_else_fail,
    execute('$pl_err_instantiation'/0)]).


predicate('$tell/1_$aux1'/2,96,static,private,built_in,[
    try_me_else(1),
    put_atom(output,2),
    execute('$find_existing_stream'/3),

label(1),
    trust_me_else_fail,
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(tell,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_value(y(0),0),
    put_atom(write,1),
    put_value(y(1),2),
    put_nil(3),
    call('$open'/4),
    put_structure('$dec10_stream'/3,0),
    unify_local_value(y(0)),
    unify_local_value(y(1)),
    unify_atom(output),
    deallocate,
    execute(assertz/1)]).


predicate(telling/1,114,static,private,built_in,[
    load_cut_level(1),
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(telling,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_variable(y(2),0),
    call(current_output/1),
    put_value(y(0),0),
    put_value(y(2),1),
    put_atom(output,2),
    call('$find_existing_stream'/3),
    cut(y(1)),
    deallocate,
    proceed]).


predicate(told/0,123,static,private,built_in,[
    load_cut_level(0),
    allocate(2),
    get_variable(y(0),0),
    put_atom(told,0),
    put_integer(0,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_variable(y(1),0),
    call(current_output/1),
    put_value(y(1),0),
    call(close/1),
    put_value(y(1),0),
    call('$told/0_$aux1'/1),
    cut(y(0)),
    deallocate,
    proceed]).


predicate('$told/0_$aux1'/1,123,static,private,built_in,[
    try_me_else(1),
    put_value(x(0),1),
    put_void(0),
    put_atom(output,2),
    execute('$find_existing_stream'/3),

label(1),
    trust_me_else_fail,
    proceed]).


predicate(append/1,133,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    allocate(2),
    get_variable(y(0),1),
    put_atom(append,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c_test('Blt_Non_Var',[0]),
    cut(y(0)),
    put_variable(y(1),1),
    call('$append/1_$aux1'/2),
    cut(y(0)),
    put_unsafe_value(y(1),0),
    deallocate,
    execute(set_output/1),

label(1),
    trust_me_else_fail,
    execute('$pl_err_instantiation'/0)]).


predicate('$append/1_$aux1'/2,133,static,private,built_in,[
    try_me_else(1),
    put_atom(output,2),
    execute('$find_existing_stream'/3),

label(1),
    trust_me_else_fail,
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(append,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_value(y(0),0),
    put_atom(append,1),
    put_value(y(1),2),
    put_nil(3),
    call('$open'/4),
    put_structure('$dec10_stream'/3,0),
    unify_local_value(y(0)),
    unify_local_value(y(1)),
    unify_atom(output),
    deallocate,
    execute(assertz/1)]).


predicate(get0/1,151,static,private,built_in,[
    put_atom(get0,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c_test('Get_Code_1',[0]),
    proceed]).


predicate(get/1,157,static,private,built_in,[
    allocate(1),
    get_variable(y(0),0),
    put_atom(get,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_value(y(0),0),
    call('$check_in_character_code'/1),
    put_variable(x(0),1),
    call_c_test('Get_Code_1',[1]),
    put_value(y(0),1),
    deallocate,
    execute('$get/1_$aux1'/2)]).


predicate('$get/1_$aux1'/2,157,static,private,built_in,[
    load_cut_level(2),
    try_me_else(1),
    put_atom(=<,3),
    put_integer(2,4),
    call_c('Set_Bip_Name_2',[3,4]),
    math_load_value(x(0),0),
    put_integer(32,3),
    call_c_test('Blt_Lte',[0,3]),
    cut(x(2)),
    put_value(x(1),0),
    execute(get/1),

label(1),
    trust_me_else_fail,
    get_value(x(0),1),
    proceed]).


predicate(put/1,164,static,private,built_in,[
    put_atom(put,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    call_c('Put_Code_1',[0]),
    proceed]).


predicate(skip/1,169,static,private,built_in,[
    load_cut_level(1),
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom(skip,0),
    put_integer(1,1),
    call_c('Set_Bip_Name_2',[0,1]),
    put_value(y(0),0),
    call('$check_in_character_code'/1),
    call(repeat/0),
    put_variable(x(0),1),
    call_c_test('Get_Code_1',[1]),
    get_value(y(0),0),
    cut(y(1)),
    deallocate,
    proceed]).


predicate('$check_in_character_code'/1,180,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    call_c_test('Blt_Var',[0]),
    cut(x(1)),
    proceed,

label(1),
    retry_me_else(2),
    call_c_test('Blt_Integer',[0]),
    cut(x(1)),
    execute('$$check_in_character_code/1_$aux1'/1),

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


predicate('$$check_in_character_code/1_$aux1'/1,184,static,private,built_in,[
    load_cut_level(1),
    try_me_else(1),
    put_atom(>=,2),
    put_integer(2,3),
    call_c('Set_Bip_Name_2',[2,3]),
    math_load_value(x(0),2),
    put_integer(-1,3),
    call_c_test('Blt_Gte',[2,3]),
    put_atom(=<,2),
    put_integer(2,3),
    call_c('Set_Bip_Name_2',[2,3]),
    math_load_value(x(0),0),
    put_integer(255,2),
    call_c_test('Blt_Lte',[0,2]),
    cut(x(1)),
    proceed,

label(1),
    trust_me_else_fail,
    put_atom(in_character_code,0),
    execute('$pl_err_representation'/1)]).


predicate(tab/1,194,static,private,built_in,[
    try_me_else(1),
    allocate(1),
    put_atom(tab,1),
    put_integer(1,2),
    call_c('Set_Bip_Name_2',[1,2]),
    put_variable(y(0),1),
    call('$arith_eval'/2),
    put_void(0),
    put_integer(1,1),
    put_value(y(0),2),
    call(for/3),
    put_atom(' ',0),
    call(put_char/1),
    fail,

label(1),
    trust_me_else_fail,
    proceed]).
