1 |
dashley |
71 |
//$Header$ |
2 |
|
|
//------------------------------------------------------------------------------------------------- |
3 |
|
|
//This file is part of "David T. Ashley's Shared Source Code", a set of shared components |
4 |
|
|
//integrated into many of David T. Ashley's projects. |
5 |
|
|
//------------------------------------------------------------------------------------------------- |
6 |
|
|
//This source code and any program in which it is compiled/used is provided under the MIT License, |
7 |
|
|
//reproduced below. |
8 |
|
|
//------------------------------------------------------------------------------------------------- |
9 |
|
|
//Permission is hereby granted, free of charge, to any person obtaining a copy of |
10 |
|
|
//this software and associated documentation files(the "Software"), to deal in the |
11 |
|
|
//Software without restriction, including without limitation the rights to use, |
12 |
|
|
//copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the |
13 |
|
|
//Software, and to permit persons to whom the Software is furnished to do so, |
14 |
|
|
//subject to the following conditions : |
15 |
|
|
// |
16 |
|
|
//The above copyright notice and this permission notice shall be included in all |
17 |
|
|
//copies or substantial portions of the Software. |
18 |
|
|
// |
19 |
|
|
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20 |
|
|
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21 |
|
|
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE |
22 |
|
|
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23 |
|
|
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24 |
|
|
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
25 |
|
|
//SOFTWARE. |
26 |
|
|
//------------------------------------------------------------------------------------------------- |
27 |
|
|
#ifndef EXTNINIT_H_INCLUDED |
28 |
|
|
#define EXTNINIT_H_INCLUDED |
29 |
|
|
|
30 |
|
|
#ifdef MODULE_EXTNINIT |
31 |
|
|
#define DECMOD_EXTNINIT |
32 |
|
|
#else |
33 |
|
|
#define DECMOD_EXTNINIT extern |
34 |
|
|
#endif |
35 |
|
|
|
36 |
|
|
//This is the structure type used to hold |
37 |
|
|
//a record for a binary search operation to locate |
38 |
|
|
//Tcl sub-extensions. Each record is the subextension |
39 |
|
|
//name, and then a pointer to the function which |
40 |
|
|
//handles that type of sub-extension. An array of this |
41 |
|
|
//type of record is binary searched. |
42 |
|
|
struct EXTNINIT_subextn_bsearch_record_struct |
43 |
|
|
{ |
44 |
|
|
char *name; |
45 |
|
|
//The name of the subextension. |
46 |
|
|
int (*fptr)(ClientData dummy, Tcl_Interp *interp, |
47 |
|
|
int objc, Tcl_Obj *objv[]); |
48 |
|
|
//Function pointer to the subextension handler. |
49 |
|
|
}; |
50 |
|
|
|
51 |
|
|
|
52 |
|
|
DECMOD_EXTNINIT void ExtninitInit(Tcl_Interp *interp); |
53 |
|
|
|
54 |
|
|
//Searches for the record having the name as a key. |
55 |
|
|
//Returns the index of the record or -1 if not found. |
56 |
|
|
//Used for processing Tcl subextensions. Algorithm |
57 |
|
|
//is binary search. |
58 |
|
|
DECMOD_EXTNINIT int EXTNINIT_subextension_bsearch( |
59 |
|
|
struct EXTNINIT_subextn_bsearch_record_struct *tbl, |
60 |
|
|
int nelem, |
61 |
|
|
const char *key); |
62 |
|
|
|
63 |
|
|
DECMOD_EXTNINIT const char *ExtninitCversion(void); |
64 |
|
|
DECMOD_EXTNINIT const char *ExtninitHversion(void); |
65 |
|
|
|
66 |
|
|
#define EXTNINIT_H_VERSION ("$Header$") |
67 |
|
|
|
68 |
|
|
#endif |
69 |
|
|
|
70 |
|
|
//End of extninit.h. |