mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
Data Structures | Macros | Typedefs | Functions
mdblist.h File Reference

Go to the source code of this file.

Data Structures

struct  list_head
 The structure of double linked list. More...
 

Macros

#define list_entry(ptr, type, member)   ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
 Get the struct for this entry. More...
 
#define list_for_each(pos, head)   for (pos = (head)->next; pos != (head); pos = pos->next)
 Iterate over a list. More...
 
#define list_for_each_safe(pos, n, head)
 Iterate over a list safe against removal of list entry. More...
 
#define list_for_each_ex(pos, head, begin)   for (pos = (begin)->next; pos != (head); pos = (pos)->next)
 Iterate over a list. More...
 
#define list_for_index(pos, i, head, index)   for (pos = (head)->next, i=0; (pos != (head) && i < index); pos = pos->next,i++)
 Iterate over a list for index. More...
 

Typedefs

typedef struct list_head list_t
 The structure of double linked list. More...
 

Functions

static void list_add (struct list_head *_new, struct list_head *head)
 Add a _new entry, insert a _new entry after the specified head. This is good for implementing stacks. More...
 
static void list_add_tail (struct list_head *_new, struct list_head *head)
 Add a _new entry, insert a _new entry before the specified head. This is useful for implementing queues. More...
 
static void list_del (struct list_head *entry)
 Deletes entry from list. Note: list_empty on entry does not return true after this, the entry is in an undefined state. More...
 
static void list_del_init (struct list_head *entry)
 Deletes entry from list and reinitialize it. More...
 
static int list_empty (struct list_head *head)
 Tests whether a list is empty. More...
 

Detailed Description

Author
Date

This file includes the list operations.

   This file is part of mGNCS, a component for MiniGUI.

   Copyright (C) 2008~2018, Beijing FMSoft Technologies Co., Ltd.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.

   Or,

   As this program is a library, any link to this program must follow
   GNU General Public License version 3 (GPLv3). If you cannot accept
   GPLv3, you need to be licensed from FMSoft.

   If you have got a commercial license of this program, please use it
   under the terms and conditions of the commercial license.

   For more information about the commercial license, please refer to
   <http://www.minigui.com/blog/minigui-licensing-policy/>.

Definition in file mdblist.h.

Macro Definition Documentation

◆ list_entry

#define list_entry (   ptr,
  type,
  member 
)    ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))

Get the struct for this entry.

Parameters
ptrThe &struct list_head pointer.
typeThe type of the struct this is embedded in.
memberThe name of the list_struct within the struct.

Definition at line 198 of file mdblist.h.

◆ list_for_each

#define list_for_each (   pos,
  head 
)    for (pos = (head)->next; pos != (head); pos = pos->next)

Iterate over a list.

Parameters
posThe &struct list_head to use as a loop counter.
headThe head for your list.

Definition at line 207 of file mdblist.h.

◆ list_for_each_ex

#define list_for_each_ex (   pos,
  head,
  begin 
)    for (pos = (begin)->next; pos != (head); pos = (pos)->next)

Iterate over a list.

Parameters
posThe &struct list_head to use as a loop counter.
headThe head for your list.
beginThe previous item of the begining item

Definition at line 228 of file mdblist.h.

◆ list_for_each_safe

#define list_for_each_safe (   pos,
  n,
  head 
)
Value:
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)

Iterate over a list safe against removal of list entry.


Parameters
posThe &struct list_head to use as a loop counter.
nAnother &struct list_head to use as temporary storage
headThe head for your list.

Definition at line 217 of file mdblist.h.

◆ list_for_index

#define list_for_index (   pos,
  i,
  head,
  index 
)    for (pos = (head)->next, i=0; (pos != (head) && i < index); pos = pos->next,i++)

Iterate over a list for index.


Parameters
posThe &struct list_head to use as a loop counter.
iThe index used to record current position.
headThe head for your list.
indexThe maximum index for your list.

Definition at line 240 of file mdblist.h.

Typedef Documentation

◆ list_t

The structure of double linked list.

Definition at line 79 of file mdblist.h.

Function Documentation

◆ list_add()

void list_add ( struct list_head _new,
struct list_head head 
)
inlinestatic

Add a _new entry, insert a _new entry after the specified head. This is good for implementing stacks.

Parameters
_new_new entry to be added
headlist head to add it after

Insert a _new entry after the specified head. This is good for implementing stacks.

Definition at line 121 of file mdblist.h.

◆ list_add_tail()

void list_add_tail ( struct list_head _new,
struct list_head head 
)
inlinestatic

Add a _new entry, insert a _new entry before the specified head. This is useful for implementing queues.

Parameters
_new_new entry to be added
headlist head to add it before

Insert a _new entry before the specified head. This is useful for implementing queues.

Definition at line 136 of file mdblist.h.

◆ list_del()

void list_del ( struct list_head entry)
inlinestatic

Deletes entry from list. Note: list_empty on entry does not return true after this, the entry is in an undefined state.

Definition at line 162 of file mdblist.h.

◆ list_del_init()

void list_del_init ( struct list_head entry)
inlinestatic

Deletes entry from list and reinitialize it.

Parameters
entryThe element to delete from the list.

Definition at line 173 of file mdblist.h.

◆ list_empty()

int list_empty ( struct list_head head)
inlinestatic

Tests whether a list is empty.

Parameters
headThe list to test.

Definition at line 185 of file mdblist.h.