Mercurial > hg > xemacs-beta
comparison src/rangetab.c @ 2952:861a7995b9fe
[xemacs-hg @ 2005-09-26 08:29:27 by ben]
fix range table boundaries
rangetab.c: Fix bug in handling of range endpoints when not start-closed, end-open.
author | ben |
---|---|
date | Mon, 26 Sep 2005 08:29:31 +0000 |
parents | 6fa9919a9a0b |
children | 1e7cc382eb16 |
comparison
equal
deleted
inserted
replaced
2951:b694dfd2f40e | 2952:861a7995b9fe |
---|---|
1 /* XEmacs routines to deal with range tables. | 1 /* XEmacs routines to deal with range tables. |
2 Copyright (C) 1995 Sun Microsystems, Inc. | 2 Copyright (C) 1995 Sun Microsystems, Inc. |
3 Copyright (C) 1995, 2002, 2004 Ben Wing. | 3 Copyright (C) 1995, 2002, 2004, 2005 Ben Wing. |
4 | 4 |
5 This file is part of XEmacs. | 5 This file is part of XEmacs. |
6 | 6 |
7 XEmacs is free software; you can redistribute it and/or modify it | 7 XEmacs is free software; you can redistribute it and/or modify it |
8 under the terms of the GNU General Public License as published by the | 8 under the terms of the GNU General Public License as published by the |
604 again: | 604 again: |
605 first = entry->first; | 605 first = entry->first; |
606 last = entry->last; | 606 last = entry->last; |
607 oldlen = Dynarr_length (rt->entries); | 607 oldlen = Dynarr_length (rt->entries); |
608 args[0] = function; | 608 args[0] = function; |
609 args[1] = make_int (first); | 609 /* Fix up the numbers in accordance with the open/closedness of the |
610 args[2] = make_int (last); | 610 table. */ |
611 { | |
612 EMACS_INT premier = first, dernier = last; | |
613 switch (rt->type) | |
614 { | |
615 case RANGE_START_CLOSED_END_OPEN: break; | |
616 case RANGE_START_CLOSED_END_CLOSED: dernier--; break; | |
617 case RANGE_START_OPEN_END_OPEN: premier--; break; | |
618 case RANGE_START_OPEN_END_CLOSED: premier--, dernier--; break; | |
619 } | |
620 args[1] = make_int (premier); | |
621 args[2] = make_int (dernier); | |
622 } | |
611 args[3] = entry->val; | 623 args[3] = entry->val; |
612 Ffuncall (countof (args), args); | 624 Ffuncall (countof (args), args); |
613 /* Has FUNCTION removed the entry? */ | 625 /* Has FUNCTION removed the entry? */ |
614 if (oldlen > Dynarr_length (rt->entries) | 626 if (oldlen > Dynarr_length (rt->entries) |
615 && i < Dynarr_length (rt->entries) | 627 && i < Dynarr_length (rt->entries) |