PageRenderTime 18ms CodeModel.GetById 16ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/glib/library/data_types/glib_trash_stacks.e

http://github.com/tybor/Liberty
Specman e | 70 lines | 7 code | 20 blank | 43 comment | 0 complexity | 1bc5637675c5998d1427c87f4e772c88 MD5 | raw file
 1indexing
 2	copyright: "(C) 2005 Paolo Redaelli "
 3	license: "LGPL v2 or later"
 4	date: "$Date:$"
 5	revision: "$REvision:$"
 6
 7class GLIB_TRASH_STACKS
 8	-- Prev 	Up 	Home 	GLib Reference Manual 	Next
 9-- Top  |  Description
10-- Trash Stacks
11
12-- Trash Stacks %G รข€”%@ maintain a stack of unused allocated memory chunks.
13	
14-- Synopsis
15
16-- #include <glib.h>
17
18
19--             GTrashStack;
20-- void        g_trash_stack_push              (GTrashStack **stack_p,
21--                                              gpointer data_p);
22-- gpointer    g_trash_stack_pop               (GTrashStack **stack_p);
23-- gpointer    g_trash_stack_peek              (GTrashStack **stack_p);
24-- guint       g_trash_stack_height            (GTrashStack **stack_p);
25
26-- Description
27
28-- A GTrashStack is an efficient way to keep a stack of unused allocated memory chunks. Each memory chunk is required to be large enough to hold a gpointer. This allows the stack to be maintained without any space overhead, since the stack pointers can be stored inside the memory chunks.
29
30-- There is no function to create a GTrashStack. A NULL GTrashStack* is a perfectly valid empty stack.
31-- Details
32-- GTrashStack
33
34-- typedef struct {
35--   GTrashStack *next;
36-- } GTrashStack;
37
38-- Each piece of memory that is pushed onto the stack is cast to a GTrashStack*.
39-- GTrashStack *next; 	pointer to the previous element of the stack, gets stored in the first sizeof (gpointer) bytes of the element.
40-- g_trash_stack_push ()
41
42-- void        g_trash_stack_push              (GTrashStack **stack_p,
43--                                              gpointer data_p);
44
45-- Pushes a piece of memory onto a GTrashStack.
46-- stack_p : 	a pointer to a GTrashStack.
47-- data_p : 	the piece of memory to push on the stack.
48-- g_trash_stack_pop ()
49
50-- gpointer    g_trash_stack_pop               (GTrashStack **stack_p);
51
52-- Pops a piece of memory off a GTrashStack.
53-- stack_p : 	a pointer to a GTrashStack.
54-- Returns : 	the element at the top of the stack.
55-- g_trash_stack_peek ()
56
57-- gpointer    g_trash_stack_peek              (GTrashStack **stack_p);
58
59-- Returns the element at the top of a GTrashStack.
60-- stack_p : 	a pointer to a GTrashStack.
61-- Returns : 	the element at the top of the stack.
62-- g_trash_stack_height ()
63
64-- guint       g_trash_stack_height            (GTrashStack **stack_p);
65
66-- Returns the height of a GTrashStack.
67-- stack_p : 	a pointer to a GTrashStack.
68-- Returns : 	the height of the stack.
69end
70