# HG changeset patch # User Paul Boddie # Date 1549301636 -3600 # Node ID e1eba49a0d7c630c8df6dca0e40a28c4f9fb38ca # Parent 93b66cd7898506c23582c684d455a431155e269a# Parent 6169eae54bd4b49f3fe16971cb8cdd602a199bfd Merged changes from trailing-data. diff -r 93b66cd78985 -r e1eba49a0d7c templates/progops.c --- a/templates/progops.c Sat Feb 02 17:55:21 2019 +0100 +++ b/templates/progops.c Mon Feb 04 18:33:56 2019 +0100 @@ -314,9 +314,17 @@ int __BOOL(__attr attr) { - /* Invoke the bool function with the object and test against True. */ + __ref value; + + /* Integers can be used directly as truth values. */ - __ref value = __VALUE(attr); + if (__INTEGER(attr)) + return __TOINT(attr); + + /* Test against True and False explicitly. If necessary, invoke the bool + function with the object and test against True. */ + + value = attr.value; return value == (__ref) &__predefined___builtins___boolean_True ? 1 : value == (__ref) &__predefined___builtins___boolean_False ? 0 :