geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

trashbox.h
Go to the documentation of this file.
1/*
2*
3* Copyright (c) 2017, Red Hat, Inc.
4* Copyright (c) 2017, Masatake YAMATO
5*
6* This source code is released for free distribution under the terms of the
7* GNU General Public License version 2 or (at your option) any later version.
8*
9* Facility for delayed memory releasing, inspired from AutoreleasePool
10* of OpenStep.
11*/
12
13#ifndef CTAGS_MAIN_TRASH_H
14#define CTAGS_MAIN_TRASH_H
15
16/*
17* INCLUDE FILES
18*/
19
20#include "general.h" /* must always come first */
21
22
23/*
24* DATA DECLARATIONS
25*/
26
27typedef void (* TrashBoxDestroyItemProc) (void *);
28typedef struct sTrashBox TrashBox;
29
30/*
31* MACROS
32*/
33
34#define DEFAULT_TRASH_BOX(PTR,PROC) trashBoxPut(NULL,PTR,(TrashBoxDestroyItemProc)PROC)
35#define DEFAULT_TRASH_BOX_TAKE_BACK(PTR) trashBoxTakeBack(NULL,PTR)
36
37#define PARSER_TRASH_BOX(PTR,PROC) parserTrashBoxPut(PTR,(TrashBoxDestroyItemProc)PROC)
38#define PARSER_TRASH_BOX_TAKE_BACK(PTR) parserTrashBoxTakeBack(PTR)
39
40
41/*
42* FUNCTION PROTOTYPES
43*/
44
45extern TrashBox* trashBoxNew (void);
46extern TrashBox* trashBoxStack (TrashBox* trash_box);
47extern void trashBoxDelete (TrashBox* trash_box);
48extern void* trashBoxPut (TrashBox* trash_box, void* item, TrashBoxDestroyItemProc destroy);
49extern TrashBoxDestroyItemProc trashBoxTakeBack (TrashBox* trash_box, void* item);
50extern void trashBoxFree (TrashBox* trash_box, void* item);
51extern void trashBoxMakeEmpty (TrashBox* trash_box);
52
53/* A parser trash box is prepared when `parser' method of a parser is called.
54 * The parser can register a pair of a memory object and destructor for the object to
55 * the trash box with parserTrashBoxPut ().
56 *
57 * The registered memory objects are destructed after `parser' method is finished in
58 * the main side. You can delay the destruction with parserTrashBoxPut ().
59 *
60 * You can unregister the pair in the `parser' method with parserTrashBoxTakeBack ().
61 * In that case, specify the memory object of the pair as the argument.
62 */
63extern void* parserTrashBoxPut (void* item, TrashBoxDestroyItemProc destroy);
65
66#endif /* CTAGS_MAIN_TRASH_H */
TrashBoxDestroyItemProc parserTrashBoxTakeBack(void *item)
Definition: trashbox.c:196
void trashBoxFree(TrashBox *trash_box, void *item)
Definition: trashbox.c:94
void trashBoxDelete(TrashBox *trash_box)
Definition: trashbox.c:55
void * parserTrashBoxPut(void *item, TrashBoxDestroyItemProc destroy)
Definition: trashbox.c:191
TrashBox * trashBoxNew(void)
Definition: trashbox.c:36
void(* TrashBoxDestroyItemProc)(void *)
Definition: trashbox.h:27
void trashBoxMakeEmpty(TrashBox *trash_box)
Definition: trashbox.c:85
TrashBox * trashBoxStack(TrashBox *trash_box)
Definition: trashbox.c:43
TrashBoxDestroyItemProc trashBoxTakeBack(TrashBox *trash_box, void *item)
Definition: trashbox.c:74
void * trashBoxPut(TrashBox *trash_box, void *item, TrashBoxDestroyItemProc destroy)
Definition: trashbox.c:65