Loading...
Searching...
No Matches
omList.h File Reference

Go to the source code of this file.

## Macros

#define | OM_LIST_OFFSET(ptr, name_of_offset_field)
#define | omListLength(ptr)
#define | omListLast(ptr)
#define | omListHasCycle(ptr)
#define | omIsOnList(ptr, addr)
#define | omRemoveFromList(ptr, addr)
#define | omFindInList(ptr, what, value)
#define | omInsertInSortedList(ptr, what, addr)
#define | omFindInSortedList(ptr, what, value)
#define | omRemoveFromSortedList(ptr, what, addr)
#define | omTestList(ptr, level)
#define | omCheckList(ptr, level, report, OM_FLR_VAL)
#define | omCheckSortedList(ptr, what, level, report, OM_FLR_VAL)
#define | omGListLength(ptr, next)
#define | omGListLast(ptr, next)
#define | omGListHasCycle(ptr, next)
#define | omIsOnGList(ptr, next, addr)
#define | omRemoveFromGList(ptr, next, addr)
#define | omFindInGList(ptr, next, what, value)
#define | omInsertInSortedGList(ptr, next, what, addr)
#define | omFindInSortedGList(ptr, next, what, value)
#define | omRemoveFromSortedGList(ptr, next, what, addr)
#define | omTestGList(ptr, next, level)
#define | omCheckGList(ptr, next, level, report, OM_FLR_VAL)
#define | omCheckSortedGList(ptr, next, what, level, report, OM_FLR_VAL)

## Functions

int | _omListLength (void *list, int next)
void * | _omListLast (void *list, int next)
void * | _omListHasCycle (void *list, int next)
void * | _omIsOnList (void *list, int next, void *addr)
void * | _omRemoveFromList (void *list, int next, void *addr)
void * | _omFindInList (void *list, int next, int long_field, unsigned long what)
void * | _omFindInSortedList (void *list, int next, int long_field, unsigned long what)
void * | _omRemoveFromSortedList (void *list, int next, int long_field, void *addr)
void * | _omInsertInSortedList (void *list, int next, int long_field, void *addr)
omError_t | _omCheckList (void *list, int next, int level, omError_t report, OM_FLR_DECL)
omError_t | _omCheckSortedList (void *list, int next, int long_field, int level, omError_t report, OM_FLR_DECL)

## Macro Definition Documentation

## OM_LIST_OFFSET

#define OM_LIST_OFFSET | ( |  | ptr,
|  |  | name_of_offset_field )

Value:
(ptr != NULL ? ((char*) &(ptr->name_of_offset_field)) - ((char*) ptr) : 0)
NULL
#define NULL
Definition omList.c:12

Definition at line 11 of file omList.h.

#define OM_LIST_OFFSET(ptr, name_of_offset_field) \
(ptr != NULL ? ((char*) &(ptr->name_of_offset_field)) - ((char*) ptr) : 0)

## omCheckGList

#define omCheckGList | ( |  | ptr,
|  |  | next,
|  |  | level,
|  |  | report,
|  |  | OM_FLR_VAL )

Value:
_omCheckList(ptr, OM_LIST_OFFSET(ptr,next), level, report, OM_FLR_VAL)
level
int level(const CanonicalForm &f)
Definition canonicalform.h:331
next
ListNode * next
Definition janet.h:31
_omCheckList
omError_t _omCheckList(void *list, int next, int level, omError_t report, OM_FLR_DECL)
Definition omList.c:178
OM_LIST_OFFSET
#define OM_LIST_OFFSET(ptr, name_of_offset_field)
Definition omList.h:11

Definition at line 115 of file omList.h.

#define omCheckGList(ptr, next, level, report, OM_FLR_VAL) \
_omCheckList(ptr, OM_LIST_OFFSET(ptr,next), level, report, OM_FLR_VAL)

## omCheckList

#define omCheckList | ( |  | ptr,
|  |  | level,
|  |  | report,
|  |  | OM_FLR_VAL )

Value:
_omCheckList(ptr, 0, level, report, OM_FLR_VAL)

Definition at line 83 of file omList.h.

#define omCheckList(ptr, level, report, OM_FLR_VAL) \
_omCheckList(ptr, 0, level, report, OM_FLR_VAL)

## omCheckSortedGList

#define omCheckSortedGList | ( |  | ptr,
|  |  | next,
|  |  | what,
|  |  | level,
|  |  | report,
|  |  | OM_FLR_VAL )

Value:
_omCheckSortedList(ptr, OM_LIST_OFFSET(ptr,next), OM_LIST_OFFSET(ptr,what), level, report, OM_FLR_VAL)
_omCheckSortedList
omError_t _omCheckSortedList(void *list, int next, int long_field, int level, omError_t report, OM_FLR_DECL)
Definition omList.c:216

Definition at line 117 of file omList.h.

#define omCheckSortedGList(ptr, next, what, level, report, OM_FLR_VAL) \
_omCheckSortedList(ptr, OM_LIST_OFFSET(ptr,next), OM_LIST_OFFSET(ptr,what), level, report, OM_FLR_VAL)

## omCheckSortedList

#define omCheckSortedList | ( |  | ptr,
|  |  | what,
|  |  | level,
|  |  | report,
|  |  | OM_FLR_VAL )

Value:
_omCheckSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), level, report, OM_FLR_VAL)

Definition at line 85 of file omList.h.

#define omCheckSortedList(ptr, what, level, report, OM_FLR_VAL) \
_omCheckSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), level, report, OM_FLR_VAL)

## omFindInGList

#define omFindInGList | ( |  | ptr,
|  |  | next,
|  |  | what,
|  |  | value )

Value:
_omFindInList(ptr, OM_LIST_OFFSET(ptr, next), OM_LIST_OFFSET(ptr, what), (unsigned long) value)
_omFindInList
void * _omFindInList(void *list, int next, int long_field, unsigned long what)
Definition omList.c:100

Definition at line 104 of file omList.h.

#define omFindInGList(ptr, next, what, value) \
_omFindInList(ptr, OM_LIST_OFFSET(ptr, next), OM_LIST_OFFSET(ptr, what), (unsigned long) value)

## omFindInList

#define omFindInList | ( |  | ptr,
|  |  | what,
|  |  | value )

Value:
_omFindInList(ptr, 0, OM_LIST_OFFSET(ptr, what), (unsigned long) value)

Definition at line 72 of file omList.h.

#define omFindInList(ptr, what, value) \
_omFindInList(ptr, 0, OM_LIST_OFFSET(ptr, what), (unsigned long) value)

## omFindInSortedGList

#define omFindInSortedGList | ( |  | ptr,
|  |  | next,
|  |  | what,
|  |  | value )

Value:
_omFindInSortedList(ptr, OM_LIST_OFFSET(ptr, next),OM_LIST_OFFSET(ptr,what),value)
_omFindInSortedList
void * _omFindInSortedList(void *list, int next, int long_field, unsigned long what)
Definition omList.c:110

Definition at line 108 of file omList.h.

#define omFindInSortedGList(ptr, next, what, value) \
_omFindInSortedList(ptr, OM_LIST_OFFSET(ptr, next),OM_LIST_OFFSET(ptr,what),value)

## omFindInSortedList

#define omFindInSortedList | ( |  | ptr,
|  |  | what,
|  |  | value )

Value:
_omFindInSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), value)

Definition at line 76 of file omList.h.

#define omFindInSortedList(ptr, what, value) \
_omFindInSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), value)

## omGListHasCycle

#define omGListHasCycle | ( |  | ptr,
|  |  | next )

Value:
_omListHasCycle(ptr, OM_LIST_OFFSET(ptr, next))
_omListHasCycle
void * _omListHasCycle(void *list, int next)
Definition omList.c:42

Definition at line 98 of file omList.h.

#define omGListHasCycle(ptr, next) \
_omListHasCycle(ptr, OM_LIST_OFFSET(ptr, next))

## omGListLast

#define omGListLast | ( |  | ptr,
|  |  | next )

Value:
_omListLast(ptr, OM_LIST_OFFSET(ptr, next))
_omListLast
void * _omListLast(void *list, int next)
Definition omList.c:32

Definition at line 96 of file omList.h.

#define omGListLast(ptr, next) \
_omListLast(ptr, OM_LIST_OFFSET(ptr, next))

## omGListLength

#define omGListLength | ( |  | ptr,
|  |  | next )

Value:
_omListLength(ptr, OM_LIST_OFFSET(ptr, next))
_omListLength
int _omListLength(void *list, int next)
Definition omList.c:20

Definition at line 94 of file omList.h.

#define omGListLength(ptr, next) \
_omListLength(ptr, OM_LIST_OFFSET(ptr, next))

## omInsertInSortedGList

#define omInsertInSortedGList | ( |  | ptr,
|  |  | next,
|  |  | what,
|  |  | addr )

Value:
_omInsertInSortedList(ptr, OM_LIST_OFFSET(ptr, next), OM_LIST_OFFSET(ptr, what), addr)
_omInsertInSortedList
void * _omInsertInSortedList(void *list, int next, int long_field, void *addr)
Definition omList.c:148

Definition at line 106 of file omList.h.

#define omInsertInSortedGList(ptr, next, what, addr) \
_omInsertInSortedList(ptr, OM_LIST_OFFSET(ptr, next), OM_LIST_OFFSET(ptr, what), addr)

## omInsertInSortedList

#define omInsertInSortedList | ( |  | ptr,
|  |  | what,
|  |  | addr )

Value:
_omInsertInSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), addr)

Definition at line 74 of file omList.h.

#define omInsertInSortedList(ptr, what, addr) \
_omInsertInSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), addr)

## omIsOnGList

#define omIsOnGList | ( |  | ptr,
|  |  | next,
|  |  | addr )

Value:
_omIsOnList(ptr, OM_LIST_OFFSET(ptr, next), addr)
_omIsOnList
void * _omIsOnList(void *list, int next, void *addr)
Definition omList.c:66

Definition at line 100 of file omList.h.

#define omIsOnGList(ptr, next, addr) \
_omIsOnList(ptr, OM_LIST_OFFSET(ptr, next), addr)

## omIsOnList

#define omIsOnList | ( |  | ptr,
|  |  | addr )

Value:
_omIsOnList(ptr, 0, addr)

Definition at line 68 of file omList.h.

#define omIsOnList(ptr, addr) \
_omIsOnList(ptr, 0, addr)

## omListHasCycle

#define omListHasCycle | ( |  | ptr | ) |

Value:
_omListHasCycle(ptr, 0)

Definition at line 66 of file omList.h.

#define omListHasCycle(ptr) \
_omListHasCycle(ptr, 0)

## omListLast

#define omListLast | ( |  | ptr | ) |

Value:
_omListLast(ptr, 0)

Definition at line 64 of file omList.h.

#define omListLast(ptr) \
_omListLast(ptr, 0)

## omListLength

#define omListLength | ( |  | ptr | ) |

Value:
_omListLength(ptr, 0)

Definition at line 62 of file omList.h.

#define omListLength(ptr) \
_omListLength(ptr, 0)

## omRemoveFromGList

#define omRemoveFromGList | ( |  | ptr,
|  |  | next,
|  |  | addr )

Value:
_omRemoveFromList(ptr, OM_LIST_OFFSET(ptr, next), addr)
_omRemoveFromList
void * _omRemoveFromList(void *list, int next, void *addr)
Definition omList.c:79

Definition at line 102 of file omList.h.

#define omRemoveFromGList(ptr, next, addr) \
_omRemoveFromList(ptr, OM_LIST_OFFSET(ptr, next), addr)

## omRemoveFromList

#define omRemoveFromList | ( |  | ptr,
|  |  | addr )

Value:
_omRemoveFromList(ptr, 0, addr)

Definition at line 70 of file omList.h.

#define omRemoveFromList(ptr, addr) \
_omRemoveFromList(ptr, 0, addr)

## omRemoveFromSortedGList

#define omRemoveFromSortedGList | ( |  | ptr,
|  |  | next,
|  |  | what,
|  |  | addr )

Value:
_omRemoveFromSortedList(ptr, OM_LIST_OFFSET(addr,next),OM_LIST_OFFSET(addr,what),addr)
_omRemoveFromSortedList
void * _omRemoveFromSortedList(void *list, int next, int long_field, void *addr)
Definition omList.c:125

Definition at line 110 of file omList.h.

#define omRemoveFromSortedGList(ptr, next, what, addr) \
_omRemoveFromSortedList(ptr, OM_LIST_OFFSET(addr,next),OM_LIST_OFFSET(addr,what),addr)

## omRemoveFromSortedList

#define omRemoveFromSortedList | ( |  | ptr,
|  |  | what,
|  |  | addr )

Value:
_omRemoveFromSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), addr)

Definition at line 78 of file omList.h.

#define omRemoveFromSortedList(ptr, what, addr) \
_omRemoveFromSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), addr)

## omTestGList

#define omTestGList | ( |  | ptr,
|  |  | next,
|  |  | level )

Value:
omCheckGList(ptr, next, level, omError_NoError, OM_FLR)
omError_NoError
@ omError_NoError
Definition omError.h:18
omCheckGList
#define omCheckGList(ptr, next, level, report, OM_FLR_VAL)
Definition omList.h:115

Definition at line 113 of file omList.h.

#define omTestGList(ptr, next, level) \
omCheckGList(ptr, next, level, omError_NoError, OM_FLR)

## omTestList

#define omTestList | ( |  | ptr,
|  |  | level )

Value:
_omCheckList(ptr, 0, level, omError_NoError, OM_FLR)

Definition at line 81 of file omList.h.

#define omTestList(ptr, level) \
_omCheckList(ptr, 0, level, omError_NoError, OM_FLR)

## Function Documentation

## _omCheckList()

omError_t _omCheckList | ( | void * | list,
|  | int | next,
|  | int | level,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 178 of file omList.c.

{
if (level < 1) return omError_NoError;
if (level == 1)
{
while (list != NULL)
{
omCheckReturn(omCheckPtr(list, report, OM_FLR_VAL));
ITER(list);
}
}
else
{
void* l1 = list;
void* l2;
int l = 0, i;
l1 = list;
while (l1 != NULL)
{
omCheckReturn(omCheckPtr(l1, report, OM_FLR_VAL));
i = 0;
l2 = list;
while (l1 != l2)
{
i++;
ITER(l2);
}
if (i != l)
return omReportError(omError_ListCycleError, report, OM_FLR_VAL, "");
ITER(l1);
l++;
}
}
return omError_NoError;
}
l
int l
Definition cfEzgcd.cc:100
i
int i
Definition cfEzgcd.cc:132
omCheckPtr
omError_t omCheckPtr(const void *ptr, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:136
omCheckReturn
#define omCheckReturn(cond)
Definition omDebug.h:170
omReportError
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
Definition omError.c:80
omError_ListCycleError
@ omError_ListCycleError
Definition omError.h:34
ITER
#define ITER(list)
Definition omList.c:18

## _omCheckSortedList()

omError_t _omCheckSortedList | ( | void * | list,
|  | int | next,
|  | int | long_field,
|  | int | level,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 216 of file omList.c.

{
void* prev = NULL;
if (level <= 1) return omError_NoError;
if (level == 1)
{
while (list != NULL)
{
omCheckReturn(omCheckPtr(list, report, OM_FLR_VAL));
if (prev != NULL && VALUE(prev, long_field) > VALUE(list, long_field))
return omReportError(omError_SortedListError, report, OM_FLR_VAL,
"%d > %d", VALUE(prev, long_field), VALUE(list, long_field));
prev = list;
ITER(list);
}
}
else
{
void* l1 = list;
void* l2;
int l = 0, i;
while (l1 != NULL)
{
omCheckReturn(omCheckPtr(l1, report, OM_FLR_VAL));
if (prev != NULL && VALUE(prev, long_field) > VALUE(l1, long_field))
return omReportError(omError_SortedListError, report, OM_FLR_VAL,
"%d > %d", VALUE(prev, long_field), VALUE(l1, long_field));
i = 0;
l2 = list;
while (l1 != l2)
{
i++;
ITER(l2);
}
omCheckReturnError(i != l, omError_ListCycleError);
prev = l1;
ITER(l1);
l++;
}
}
return omError_NoError;
}
omCheckReturnError
#define omCheckReturnError(cond, error)
Definition omDebug.h:172
omError_SortedListError
@ omError_SortedListError
Definition omError.h:35
VALUE
#define VALUE(list, offset)
Definition omList.c:16

## _omFindInList()

void * _omFindInList | ( | void * | list,
|  | int | next,
|  | int | long_field,
|  | unsigned long | what )

Definition at line 100 of file omList.c.

{
while (list != NULL)
{
if (VALUE(list, long_field) == what) return list;
ITER(list);
}
return NULL;
}

## _omFindInSortedList()

void * _omFindInSortedList | ( | void * | list,
|  | int | next,
|  | int | long_field,
|  | unsigned long | what )

Definition at line 110 of file omList.c.

{
while (list != NULL)
{
if (VALUE(list, long_field) >= what)
{
if (VALUE(list, long_field) == what) return list;
return NULL;
}
ITER(list);
}
return NULL;
}

## _omInsertInSortedList()

void * _omInsertInSortedList | ( | void * | list,
|  | int | next,
|  | int | long_field,
|  | void * | addr )

Definition at line 148 of file omList.c.

{
unsigned long what = VALUE(addr, long_field);
if (list == NULL || what <= VALUE(list, long_field))
{
NEXT(addr) = list;
return addr;
}
else
{
void* prev = list;
void* curr = NEXT(list);
while (curr != NULL && VALUE(curr, long_field) < what)
{
prev = curr;
ITER(curr);
}
NEXT(prev) = addr;
NEXT(addr) = curr;
return list;
}
}
NEXT
#define NEXT(list)
Definition omList.c:17

## _omIsOnList()

void * _omIsOnList | ( | void * | list,
|  | int | next,
|  | void * | addr )

Definition at line 66 of file omList.c.

{
if (addr == NULL)
return (NULL);
while (list != NULL)
{
if (addr == list) return addr;
ITER(list);
}
return 0;
}

## _omListHasCycle()

void * _omListHasCycle | ( | void * | list,
|  | int | next )

Definition at line 42 of file omList.c.

{
void* l1 = list;
void* l2;
int l = 0, i;
while (l1 != NULL)
{
i = 0;
l2 = list;
while (l1 != l2)
{
i++;
ITER(l2);
}
if (i != l) return l1;
ITER(l1);
l++;
}
return NULL;
}

## _omListLast()

void * _omListLast | ( | void * | list,
|  | int | next )

Definition at line 32 of file omList.c.

{
if (list == NULL) return NULL;
while (NEXT(list) != NULL) ITER(list);
return list;
}

## _omListLength()

int _omListLength | ( | void * | list,
|  | int | next )

Definition at line 20 of file omList.c.

{
int l = 0;
while (list != NULL)
{
l++;
ITER(list);
}
return l;
}

## _omRemoveFromList()

void * _omRemoveFromList | ( | void * | list,
|  | int | next,
|  | void * | addr )

Definition at line 79 of file omList.c.

{
void* nlist;
void* olist;
if (list == NULL) return NULL;
nlist = NEXT(list);
if (list == addr) return nlist;
olist = list;
while (nlist != NULL && nlist != addr)
{
list = nlist;
ITER(nlist);
}
if (nlist != NULL) NEXT(list) = NEXT(nlist);
return olist;
}

## _omRemoveFromSortedList()

void * _omRemoveFromSortedList | ( | void * | list,
|  | int | next,
|  | int | long_field,
|  | void * | addr )

Definition at line 125 of file omList.c.

{
void* nlist;
void* olist;
unsigned long what = VALUE(addr, long_field);
if (list == NULL) return NULL;
nlist = NEXT(list);
if (list == addr) return nlist;
if (VALUE(list, long_field) > what) return list;
olist = list;
while (nlist != NULL && nlist != addr)
{
if (VALUE(list, long_field) > what) return olist;
list = nlist;
ITER(nlist);
}
if (nlist != NULL) NEXT(list) = NEXT(nlist);
return olist;
}