% compiler: GNU Prolog 1.4.2
% file    : write.pl


file_name('/home/diaz/GP/src/src/BipsPl/write.pl').


predicate('$use_write'/0,42,static,private,monofile,built_in,[
    proceed]).


predicate(write/1,50,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[write,1]),
    call_c('Pl_Write_1',[],[x(0)]),
    proceed]).


predicate(write/2,54,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[write,2]),
    call_c('Pl_Write_2',[],[x(0),x(1)]),
    proceed]).


predicate(writeq/1,61,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[writeq,1]),
    call_c('Pl_Writeq_1',[],[x(0)]),
    proceed]).


predicate(writeq/2,65,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[writeq,2]),
    call_c('Pl_Writeq_2',[],[x(0),x(1)]),
    proceed]).


predicate(write_canonical/1,72,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[write_canonical,1]),
    call_c('Pl_Write_Canonical_1',[],[x(0)]),
    proceed]).


predicate(write_canonical/2,76,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[write_canonical,2]),
    call_c('Pl_Write_Canonical_2',[],[x(0),x(1)]),
    proceed]).


predicate(display/1,83,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[display,1]),
    call_c('Pl_Display_1',[],[x(0)]),
    proceed]).


predicate(display/2,87,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[display,2]),
    call_c('Pl_Display_2',[],[x(0),x(1)]),
    proceed]).


predicate(write_term/2,111,static,private,monofile,built_in,[
    try_me_else(1),
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[write_term,2]),
    call('$set_write_defaults'/0),
    put_value(y(1),0),
    call('$get_write_options'/1),
    put_value(y(0),0),
    call_c('Pl_Write_Term_1',[],[x(0)]),
    fail,

label(1),
    trust_me_else_fail,
    proceed]).


predicate(write_term/3,121,static,private,monofile,built_in,[
    try_me_else(1),
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[write_term,3]),
    call('$set_write_defaults'/0),
    put_value(y(2),0),
    call('$get_write_options'/1),
    put_value(y(0),0),
    put_value(y(1),1),
    call_c('Pl_Write_Term_2',[],[x(0),x(1)]),
    fail,

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$set_write_defaults'/0,132,static,private,monofile,built_in,[
    allocate(0),
    put_integer(0,0),
    put_integer(0,1),
    call('$sys_var_write'/2),
    put_integer(1,0),
    put_integer(-1,1),
    call('$sys_var_write'/2),
    put_integer(2,0),
    put_integer(1200,1),
    call('$sys_var_write'/2),
    put_integer(3,0),
    put_integer(0,1),
    deallocate,
    execute('$sys_var_write'/2)]).


predicate('$get_write_options'/1,141,static,private,monofile,built_in,[
    allocate(1),
    get_variable(y(0),0),
    put_value(y(0),0),
    call('$check_list'/1),
    put_value(y(0),0),
    call('$get_write_options1'/1),
    deallocate,
    execute('$$get_write_options/1_$aux1'/0)]).


predicate('$$get_write_options/1_$aux1'/0,141,static,private,monofile,local,[
    pragma_arity(1),
    get_current_choice(x(0)),
    try_me_else(1),
    allocate(1),
    get_variable(y(0),0),
    put_integer(0,0),
    put_integer(6,1),
    put_integer(1,2),
    call('$sys_var_get_bit'/3),
    cut(y(0)),
    put_integer(0,0),
    put_integer(3,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$get_write_options1'/1,152,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(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_write_options2'/1),
    cut(y(1)),
    put_value(y(0),0),
    deallocate,
    execute('$get_write_options1'/1)]).


predicate('$get_write_options2'/1,159,static,private,monofile,built_in,[
    try_me_else(1),
    call_c('Pl_Blt_Var',[fast_call,boolean],[x(0)]),
    execute('$pl_err_instantiation'/0),

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

label(2),
    switch_on_structure([(quoted/1,4),(ignore_ops/1,6),(numbervars/1,8),(namevars/1,10),('$above'/1,12),(space_args/1,14),(portrayed/1,16),(variable_names/1,18),(max_depth/1,20),(priority/1,22)]),

label(3),
    try_me_else(5),

label(4),
    get_structure(quoted/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    execute('$$get_write_options2/1_$aux1'/1),

label(5),
    retry_me_else(7),

label(6),
    get_structure(ignore_ops/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    execute('$$get_write_options2/1_$aux2'/1),

label(7),
    retry_me_else(9),

label(8),
    get_structure(numbervars/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    execute('$$get_write_options2/1_$aux3'/1),

label(9),
    retry_me_else(11),

label(10),
    get_structure(namevars/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    execute('$$get_write_options2/1_$aux4'/1),

label(11),
    retry_me_else(13),

label(12),
    get_structure('$above'/1,0),
    unify_variable(x(1)),
    call_c('Pl_Blt_Integer',[fast_call,boolean],[x(1)]),
    put_integer(3,0),
    execute('$sys_var_write'/2),

label(13),
    retry_me_else(15),

label(14),
    get_structure(space_args/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    execute('$$get_write_options2/1_$aux5'/1),

label(15),
    retry_me_else(17),

label(16),
    get_structure(portrayed/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    execute('$$get_write_options2/1_$aux6'/1),

label(17),
    retry_me_else(19),

label(18),
    allocate(1),
    get_structure(variable_names/1,0),
    unify_variable(y(0)),
    put_integer(0,0),
    put_integer(6,1),
    call('$sys_var_set_bit'/2),
    put_value(y(0),0),
    deallocate,
    execute('$name_variables'/1),

label(19),
    retry_me_else(21),

label(20),
    get_structure(max_depth/1,0),
    unify_variable(x(1)),
    call_c('Pl_Blt_Integer',[fast_call,boolean],[x(1)]),
    put_integer(1,0),
    execute('$sys_var_write'/2),

label(21),
    trust_me_else_fail,

label(22),
    get_structure(priority/1,0),
    unify_variable(x(1)),
    call_c('Pl_Blt_Integer',[fast_call,boolean],[x(1)]),
    put_integer(2,0),
    execute('$sys_var_write'/2),

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


predicate('$$get_write_options2/1_$aux6'/1,207,static,private,monofile,local,[
    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(5,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(5,1),
    execute('$sys_var_set_bit'/2)]).


predicate('$$get_write_options2/1_$aux5'/1,199,static,private,monofile,local,[
    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(4,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(4,1),
    execute('$sys_var_set_bit'/2)]).


predicate('$$get_write_options2/1_$aux4'/1,187,static,private,monofile,local,[
    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(3,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(3,1),
    execute('$sys_var_set_bit'/2)]).


predicate('$$get_write_options2/1_$aux3'/1,179,static,private,monofile,local,[
    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(2,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(2,1),
    execute('$sys_var_set_bit'/2)]).


predicate('$$get_write_options2/1_$aux2'/1,171,static,private,monofile,local,[
    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_write_options2/1_$aux1'/1,163,static,private,monofile,local,[
    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('$name_variables'/1,232,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(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(1),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_structure((=)/2,0),
    unify_variable(x(0)),
    unify_variable(x(3)),
    get_variable(x(2),1),
    put_value(x(3),1),
    call('$$name_variables/1_$aux1'/3),
    put_value(y(0),0),
    deallocate,
    execute('$name_variables'/1)]).


predicate('$$name_variables/1_$aux1'/3,234,static,private,monofile,local,[
    try_me_else(1),
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_value(y(0),0),
    call('$is_valid_var_name'/1),
    put_value(y(1),0),
    get_structure('$VARNAME'/1,0),
    unify_local_value(y(0)),
    cut(y(2)),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$is_valid_var_name'/1,240,static,private,monofile,built_in,[
    call_c('Pl_Is_Valid_Var_Name_1',[boolean],[x(0)]),
    proceed]).


predicate(nl/0,245,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[nl,0]),
    call_c('Pl_Nl_0',[],[]),
    proceed]).


predicate(nl/1,249,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[nl,1]),
    call_c('Pl_Nl_1',[],[x(0)]),
    proceed]).
