[GB.DATA]
* BUG: Fix possible bugs when updating an invalid Current. * BUG: Really erase old elements instead of just marking them as Null to prevent (potential) information leaks. * OPT: Current and the enumerators (internally) carry list global indices (LGI) which can be used as anchor points together with List.Count to speed up traversals (always taking the shortest way through the list). * OPT: Remove workaround code related to an enumerator bug fixed in #5749. * NEW: Expose List.Current as a virtual object representing the current list element which has Append() and Prepend() methods to manipulate the list not only around its head. This breaks backwards compatibility. * NEW: List.Value is what List.Current has meant formerly. * NEW: Add List.Current.Index and List.Index which are an absolute index of the current element into the list. These are guaranteed to be in bounds of [-List.Count; List.Count - 1]. Note that each non-negative index has an associated negative equivalent and vice versa. They work like the indices given to List._get(). * NEW: Add a List.AutoNormalize property which instructs the list to automatically make indices (like resulting from a calculation) fit into the List bounds preserving the sign of the given index. This effectively prevents any "Out of bounds" errors. * NEW: Add List.MoveTo() to point Current to an index. * NEW: List.Current.Is{First,Last,Valid} can be used to determine if Current is the first or last element of the list or if it is valid, respectively. git-svn-id: svn://localhost/gambas/trunk@5778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
ef1f29700e
commit
b4c71163ee
7 changed files with 685 additions and 175 deletions
|
@ -282,7 +282,7 @@ BEGIN_PROPERTY(Circular_Overwrite)
|
|||
|
||||
END_PROPERTY
|
||||
|
||||
GB_DESC CCircularDesc[] = {
|
||||
GB_DESC CCircular[] = {
|
||||
GB_DECLARE("Circular", sizeof(CCIRCULAR)),
|
||||
|
||||
GB_METHOD("_new", NULL, Circular_new, "(Size)i[(Overwrite)b]"),
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
extern GB_INTERFACE GB;
|
||||
|
||||
#ifndef __C_CIRCULAR_C
|
||||
extern GB_DESC CCircularDesc[];
|
||||
extern GB_DESC CCircular[];
|
||||
#endif
|
||||
|
||||
#endif /* !__C_CIRCULAR_H */
|
||||
|
|
|
@ -227,7 +227,7 @@ END_PROPERTY
|
|||
* Double-ended queue
|
||||
*/
|
||||
|
||||
GB_DESC CDequeDesc[] = {
|
||||
GB_DESC CDeque[] = {
|
||||
GB_DECLARE("Deque", sizeof(CDEQUE)),
|
||||
|
||||
GB_METHOD("_new", NULL, Deque_new, NULL),
|
||||
|
@ -249,10 +249,10 @@ GB_DESC CDequeDesc[] = {
|
|||
};
|
||||
|
||||
/*
|
||||
* FILO
|
||||
* LIFO
|
||||
*/
|
||||
|
||||
GB_DESC CStackDesc[] = {
|
||||
GB_DESC CStack[] = {
|
||||
GB_DECLARE("Stack", sizeof(CDEQUE)),
|
||||
|
||||
GB_METHOD("_new", NULL, Deque_new, NULL),
|
||||
|
@ -274,7 +274,7 @@ GB_DESC CStackDesc[] = {
|
|||
* FIFO
|
||||
*/
|
||||
|
||||
GB_DESC CQueueDesc[] = {
|
||||
GB_DESC CQueue[] = {
|
||||
GB_DECLARE("Queue", sizeof(CDEQUE)),
|
||||
|
||||
GB_METHOD("_new", NULL, Deque_new, NULL),
|
||||
|
@ -329,7 +329,7 @@ END_METHOD
|
|||
* Priority FIFO
|
||||
*/
|
||||
|
||||
GB_DESC CPrioQueueDesc[] = {
|
||||
GB_DESC CPrioQueue[] = {
|
||||
GB_DECLARE("PrioQueue", sizeof(CDEQUE)),
|
||||
|
||||
GB_METHOD("_new", NULL, Deque_new, NULL),
|
||||
|
|
|
@ -27,11 +27,10 @@
|
|||
extern GB_INTERFACE GB;
|
||||
|
||||
#ifndef __C_DEQUE_C
|
||||
extern GB_DESC CDequeDesc[];
|
||||
extern GB_DESC CStackDesc[];
|
||||
extern GB_DESC CQueueDesc[];
|
||||
extern GB_DESC CPrioQueueDesc[];
|
||||
extern GB_DESC CDeque[];
|
||||
extern GB_DESC CStack[];
|
||||
extern GB_DESC CQueue[];
|
||||
extern GB_DESC CPrioQueue[];
|
||||
#endif
|
||||
|
||||
#endif /* !__C_DEQUE_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,10 +28,9 @@
|
|||
extern GB_INTERFACE GB;
|
||||
|
||||
#ifndef __C_LIST_C
|
||||
extern GB_DESC CListDesc[];
|
||||
extern GB_DESC CListBackwardsDesc[];
|
||||
|
||||
extern void CLIST_exit(void);
|
||||
extern GB_DESC CList[];
|
||||
extern GB_DESC CListBackwards[];
|
||||
extern GB_DESC CListItem[];
|
||||
#endif
|
||||
|
||||
#endif /* !__C_LIST_H */
|
||||
|
|
|
@ -24,20 +24,24 @@
|
|||
#include "c_list.h"
|
||||
#include "c_deque.h"
|
||||
#include "c_circular.h"
|
||||
#include "c_avltree.h"
|
||||
#include "main.h"
|
||||
|
||||
GB_INTERFACE GB EXPORT;
|
||||
|
||||
GB_DESC *GB_CLASSES[] EXPORT = {
|
||||
CListDesc,
|
||||
CListBackwardsDesc,
|
||||
CList,
|
||||
CListBackwards,
|
||||
CListItem,
|
||||
|
||||
CDequeDesc,
|
||||
CStackDesc,
|
||||
CQueueDesc,
|
||||
CPrioQueueDesc,
|
||||
CDeque,
|
||||
CStack,
|
||||
CQueue,
|
||||
CPrioQueue,
|
||||
|
||||
CCircularDesc,
|
||||
CCircular,
|
||||
|
||||
// CAvlTree,
|
||||
|
||||
NULL
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue