1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/*** funlist.h - Definitions for Function List Manager
*
* Microsoft Confidential
* Copyright (C) Microsoft Corporation 1994
* All Rights Reserved.
*
* Author:
* Benjamin W. Slivka
*
* History:
* 05-Apr-1994 bens Initial version
*
* Exported Functions:
*/
#ifndef INCLUDED_FUNLIST
#define INCLUDED_FUNLIST 1
#include "types.h"
#include "asrt.h"
#include "error.h"
typedef void * HFUNLIST; /* hfunlist - list of functions */
typedef void * HFUNCTION; /* hfun - FUNCTION handle */
/*** PFNFUNCTION - function pointer for function list
*
* This is just a generic function declaraion. The client that uses the
* function list will cast the function pointer to the correct type before
* actually calling the function.
*/
typedef void (*PFNFUNCTION)(void); /* pfnfun */
/*** FunAdd - Add a function to a function list
*
* Entry:
* hfunlist - Function list to check
* pszKey - Key value for function lookup
* pfnfun - Function pointer
* perr - ERROR structure
*
* Exit-Success:
* Returns hfun, function is added to list
*
* Exit-Failure:
* Returns NULL, cannot add function to list
* ERROR structure filled in with details of error.
*/
HFUNCTION FunAdd(HFUNLIST hfunlist,
char *pszKey,
PFNFUNCTION pfnfun,
PERROR perr);
/*** FunCreateList - Create a list of functions
*
* Entry:
* pfnfun - Function pointer for *default* function (NULL if not supplied)
* perr - ERROR structure
*
* Exit-Success:
* Returns HFUNLIST; list is created.
*
* Exit-Failure:
* Returns NULL, cannot create list; perror filled in with error.
*/
HFUNLIST FunCreateList(PERROR perr);
/*** FunDestroyList - Destroy a list of functions
*
* Entry:
* hfunlist - function list to destroy
* perr - ERROR structure
*
* Exit-Success:
* Returns TRUE; list was destroyed.
*
* Exit-Failure:
* Returns FALSE, cannot destroy list; perror filled in with error.
*/
BOOL FunDestroyList(HFUNLIST hfunlist, PERROR perr);
/*** FunFind - See if function exists
*
* Entry:
* hfunlist - Function list
* pszKey - Function key to look for (case-insensitive search)
* Pass NULL to find the default function.
* perr - ERROR structure
*
* Exit-Success:
* Returns hfun, if function exists. If key was not found, but a default
* function was supplied on the FunCreateList() call, then that default
* function is returned.
*
* Exit-Failure:
* Returns NULL, function does not exist (key not found and no default
* function was supplied on the FunCreateList() call).
* ERROR structure filled in with details of error.
*/
HFUNCTION FunFind(HFUNLIST hfunlist,
char *pszKey,
PERROR perr);
/*** FunRemove - Remove function from a function list
*
* Entry:
* hfun - function handle
*
* Exit-Success:
* Always works, since hfun is assumed to be valid.
*/
void FunRemove(HFUNCTION hfun);
/*** FunGetFunction - Get the function pointer for a particular key value
*
* Entry:
* hfunlist - Function list
* pszKey - Function key to look for (case-insensitive search)
* perr - ERROR structure
*
* Exit-Success:
* Returns hfun, if function exists. If key was not found, but a default
* function was supplied on the FunCreateList() call, then that default
* function is returned.
*
* Exit-Failure:
* Returns NULL, function does not exist (key not found and no default
* function was supplied on the FunCreateList() call).
* If an error occured, perr is filled in.
*/
PFNFUNCTION FunGetFunction(HFUNLIST hfunlist, char *pszKey);
#endif // INCLUDED_FUNLIST
|