mirror of
https://github.com/uffejakobsen/acme.git
synced 2024-11-29 04:49:20 +00:00
fixed bug found two commits ago
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@299 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
79e3950760
commit
2a004d8153
29
src/alu.c
29
src/alu.c
@ -1295,8 +1295,26 @@ static boolean number_is_defined(const struct object *self)
|
|||||||
return self->u.number.ntype != NUMTYPE_UNDEFINED;
|
return self->u.number.ntype != NUMTYPE_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// list/string:
|
// list:
|
||||||
// ...are always considered "defined"
|
// return TRUE only if completely defined
|
||||||
|
static boolean list_is_defined(const struct object *self)
|
||||||
|
{
|
||||||
|
struct listitem *item;
|
||||||
|
|
||||||
|
// iterate over items: if an undefined one is found, return FALSE
|
||||||
|
item = self->u.listhead->next;
|
||||||
|
while (item != self->u.listhead) {
|
||||||
|
if (!(item->u.payload.type->is_defined(&item->u.payload)))
|
||||||
|
return FALSE; // we found something undefined
|
||||||
|
|
||||||
|
item = item->next;
|
||||||
|
}
|
||||||
|
// otherwise, list is defined
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string:
|
||||||
|
// ...is always considered "defined"
|
||||||
static boolean object_return_true(const struct object *self)
|
static boolean object_return_true(const struct object *self)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2342,7 +2360,7 @@ struct type type_number = {
|
|||||||
};
|
};
|
||||||
struct type type_list = {
|
struct type type_list = {
|
||||||
"list",
|
"list",
|
||||||
object_return_true, // lists are always considered to be defined (even though they can hold undefined numbers...)
|
list_is_defined,
|
||||||
list_differs,
|
list_differs,
|
||||||
list_assign,
|
list_assign,
|
||||||
list_handle_monadic_operator,
|
list_handle_monadic_operator,
|
||||||
@ -2425,11 +2443,6 @@ static int parse_expression(struct expression *expression)
|
|||||||
if (!(result->type->is_defined(result))) {
|
if (!(result->type->is_defined(result))) {
|
||||||
// then count (in all passes)
|
// then count (in all passes)
|
||||||
++pass.undefined_count;
|
++pass.undefined_count;
|
||||||
// FIXME - this is a bug! lists with undefined elements are seen as "defined":
|
|
||||||
// a user macro iterating over this list will correctly choke on the undefined
|
|
||||||
// item, but the automatic iterators of "!by" and friends will just use a zero
|
|
||||||
// value, because the "undefinedness" should have been counted HERE!
|
|
||||||
// so "!by 1, 2, [three, four]" will just write "01 02 00 00" without complaints!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// do some checks depending on int/float
|
// do some checks depending on int/float
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#define RELEASE "0.97" // update before release FIXME
|
#define RELEASE "0.97" // update before release FIXME
|
||||||
#define CODENAME "Zem" // update before release
|
#define CODENAME "Zem" // update before release
|
||||||
#define CHANGE_DATE "24 Aug" // update before release FIXME
|
#define CHANGE_DATE "18 Oct" // update before release FIXME
|
||||||
#define CHANGE_YEAR "2020" // update before release
|
#define CHANGE_YEAR "2020" // update before release
|
||||||
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
||||||
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
||||||
|
3
testing/errors/valuenotdefined1.a
Normal file
3
testing/errors/valuenotdefined1.a
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
;ACME 0.97
|
||||||
|
* = $200
|
||||||
|
!by example
|
3
testing/errors/valuenotdefined2.a
Normal file
3
testing/errors/valuenotdefined2.a
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
;ACME 0.97
|
||||||
|
* = $200
|
||||||
|
!by [0, 1, example]
|
Loading…
Reference in New Issue
Block a user