[m-rev.] for review: negation in trace goals conditions

Ondrej Bojar bojar at csse.unimelb.edu.au
Tue Feb 20 12:45:00 AEDT 2007


For review by anyone.

Estimated hours taken: 1

Added support for negating literals in conditions (run_time and 
compile_time) for trace goals.

NEWS:
     Announced negation in trace goal conditions literals.

compiler/mercury_to_mercury.m:
     Output of negated conditions.

compiler/ml_code_gen.m:
     Test for negated conditions at run time.

compiler/pragma_c_gen.m:
     Test for negated conditions at run time.

compiler/prog_data.m:
     Modified type definition for trace_expr/1 to include negation of 
literals.

compiler/prog_io_goal.m:
     Parsing of negated literals.

compiler/simplify.m:
     Compile-time evaluation of conditions with negated literals.

doc/reference_manual.texi:
     Announced negation of literals. Fixed a copy-paste typo in 
description of
     run-time conditions.

tests/hard_coded/trace_goal_env_3.m:
     Added a simple test for negation on literals.

tests/hard_coded/trace_goal_env_3.exp:
     Expected result if env-vars are not set.


Index: NEWS
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/NEWS,v
retrieving revision 1.447
diff -r1.447 NEWS
18a19,20
> * Conditions (run_time and compile_time) in trace goals allow negation of
>   literals.
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: 
/home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.314
diff -r1.314 mercury_to_mercury.m
2944a2945,2949
>         TraceExpr = trace_not_base(Base),
>         io.write_string("not(", !IO),
>         PrintBase(Base, !IO),
>         io.write_string(")", !IO)
>     ;
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.196
diff -r1.196 ml_code_gen.m
2478a2479,2484
>         Expr = trace_not_base(trace_envvar(EnvVar)),
>         ml_gen_info_add_env_var_name(EnvVar, !Info),
>         EnvVarRval = lval(global_var_ref(env_var_ref(EnvVar))),
>         ZeroRval = const(mlconst_int(0)),
>         CondRval = binop(eq, EnvVarRval, ZeroRval)
>     ;
Index: compiler/pragma_c_gen.m
===================================================================
RCS file: 
/home/mercury/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.103
diff -r1.103 pragma_c_gen.m
434a435,442
>         Expr = trace_not_base(trace_envvar(EnvVar)),
>         get_used_env_vars(!.CI, UsedEnvVars0),
>         set.insert(UsedEnvVars0, EnvVar, UsedEnvVars),
>         set_used_env_vars(UsedEnvVars, !CI),
>         EnvVarRval = lval(global_var_ref(env_var_ref(EnvVar))),
>         ZeroRval = const(llconst_int(0)),
>         CondRval = binop(eq, EnvVarRval, ZeroRval)
>     ;
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.187
diff -r1.187 prog_data.m
918a919
>     ;       trace_not_base(Base)
Index: compiler/prog_io_goal.m
===================================================================
RCS file: 
/home/mercury/mercury1/repository/mercury/compiler/prog_io_goal.m,v
retrieving revision 1.50
diff -r1.50 prog_io_goal.m
820a821,832
>         Term = term.functor(term.atom("not"), [SubTerm], _)
>     ->
>         BaseParser(SubTerm, MaybeSubExpr),
>         (
>             MaybeSubExpr = ok1(SubExpr)
>         ->
>             MaybeTree = ok1(trace_not_base(SubExpr))
>         ;
>             SubErrors = get_any_errors1(MaybeSubExpr),
>             MaybeTree = error1(SubErrors)
>         )
>     ;
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.206
diff -r1.206 simplify.m
1677a1678,1679
> evaluate_compile_time_condition(trace_not_base(Base), Info) =
>     not(evaluate_compile_time_condition(trace_base(Base), Info)).
Index: doc/reference_manual.texi
===================================================================
RCS file: 
/home/mercury/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.383
diff -r1.383 reference_manual.texi
9344c9344,9345
< to connect one or more primitive compile-time conditions.
---
> to connect one or more primitive compile-time conditions. The primitive
> conditions can be negated with @samp{not}.
9366c9367,9368
< to connect one or more primitive compile-time conditions.
---
> to connect one or more primitive run-time conditions. The primitive
> conditions can be negated with @samp{not}.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list