google_hash 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. data/README +21 -0
  2. data/Rakefile +11 -0
  3. data/VERSION +1 -0
  4. data/ext/extconf.rb +15 -0
  5. data/ext/go.cpp +109 -0
  6. data/ext/sparsehash-1.5.2/AUTHORS +2 -0
  7. data/ext/sparsehash-1.5.2/COPYING +28 -0
  8. data/ext/sparsehash-1.5.2/ChangeLog +167 -0
  9. data/ext/sparsehash-1.5.2/INSTALL +236 -0
  10. data/ext/sparsehash-1.5.2/Makefile.am +157 -0
  11. data/ext/sparsehash-1.5.2/Makefile.in +1019 -0
  12. data/ext/sparsehash-1.5.2/NEWS +0 -0
  13. data/ext/sparsehash-1.5.2/README +149 -0
  14. data/ext/sparsehash-1.5.2/README.windows +25 -0
  15. data/ext/sparsehash-1.5.2/TODO +28 -0
  16. data/ext/sparsehash-1.5.2/aclocal.m4 +868 -0
  17. data/ext/sparsehash-1.5.2/compile +99 -0
  18. data/ext/sparsehash-1.5.2/config.guess +1516 -0
  19. data/ext/sparsehash-1.5.2/config.sub +1626 -0
  20. data/ext/sparsehash-1.5.2/configure +8054 -0
  21. data/ext/sparsehash-1.5.2/configure.ac +74 -0
  22. data/ext/sparsehash-1.5.2/depcomp +530 -0
  23. data/ext/sparsehash-1.5.2/doc/dense_hash_map.html +1591 -0
  24. data/ext/sparsehash-1.5.2/doc/dense_hash_set.html +1445 -0
  25. data/ext/sparsehash-1.5.2/doc/designstyle.css +115 -0
  26. data/ext/sparsehash-1.5.2/doc/implementation.html +365 -0
  27. data/ext/sparsehash-1.5.2/doc/index.html +69 -0
  28. data/ext/sparsehash-1.5.2/doc/performance.html +96 -0
  29. data/ext/sparsehash-1.5.2/doc/sparse_hash_map.html +1527 -0
  30. data/ext/sparsehash-1.5.2/doc/sparse_hash_set.html +1376 -0
  31. data/ext/sparsehash-1.5.2/doc/sparsetable.html +1393 -0
  32. data/ext/sparsehash-1.5.2/experimental/Makefile +9 -0
  33. data/ext/sparsehash-1.5.2/experimental/README +14 -0
  34. data/ext/sparsehash-1.5.2/experimental/example.c +54 -0
  35. data/ext/sparsehash-1.5.2/experimental/libchash.c +1537 -0
  36. data/ext/sparsehash-1.5.2/experimental/libchash.h +252 -0
  37. data/ext/sparsehash-1.5.2/google-sparsehash.sln +47 -0
  38. data/ext/sparsehash-1.5.2/install-sh +323 -0
  39. data/ext/sparsehash-1.5.2/m4/acx_pthread.m4 +363 -0
  40. data/ext/sparsehash-1.5.2/m4/google_namespace.m4 +42 -0
  41. data/ext/sparsehash-1.5.2/m4/namespaces.m4 +15 -0
  42. data/ext/sparsehash-1.5.2/m4/stl_hash.m4 +70 -0
  43. data/ext/sparsehash-1.5.2/m4/stl_hash_fun.m4 +36 -0
  44. data/ext/sparsehash-1.5.2/m4/stl_namespace.m4 +25 -0
  45. data/ext/sparsehash-1.5.2/missing +360 -0
  46. data/ext/sparsehash-1.5.2/mkinstalldirs +158 -0
  47. data/ext/sparsehash-1.5.2/packages/deb.sh +74 -0
  48. data/ext/sparsehash-1.5.2/packages/deb/README +7 -0
  49. data/ext/sparsehash-1.5.2/packages/deb/changelog +107 -0
  50. data/ext/sparsehash-1.5.2/packages/deb/compat +1 -0
  51. data/ext/sparsehash-1.5.2/packages/deb/control +17 -0
  52. data/ext/sparsehash-1.5.2/packages/deb/copyright +35 -0
  53. data/ext/sparsehash-1.5.2/packages/deb/docs +16 -0
  54. data/ext/sparsehash-1.5.2/packages/deb/rules +117 -0
  55. data/ext/sparsehash-1.5.2/packages/deb/sparsehash.dirs +2 -0
  56. data/ext/sparsehash-1.5.2/packages/deb/sparsehash.install +2 -0
  57. data/ext/sparsehash-1.5.2/packages/rpm.sh +86 -0
  58. data/ext/sparsehash-1.5.2/packages/rpm/rpm.spec +61 -0
  59. data/ext/sparsehash-1.5.2/src/config.h.in +131 -0
  60. data/ext/sparsehash-1.5.2/src/config.h.include +23 -0
  61. data/ext/sparsehash-1.5.2/src/google/dense_hash_map +310 -0
  62. data/ext/sparsehash-1.5.2/src/google/dense_hash_set +287 -0
  63. data/ext/sparsehash-1.5.2/src/google/sparse_hash_map +294 -0
  64. data/ext/sparsehash-1.5.2/src/google/sparse_hash_set +275 -0
  65. data/ext/sparsehash-1.5.2/src/google/sparsehash/densehashtable.h +1062 -0
  66. data/ext/sparsehash-1.5.2/src/google/sparsehash/sparsehashtable.h +1015 -0
  67. data/ext/sparsehash-1.5.2/src/google/sparsetable +1468 -0
  68. data/ext/sparsehash-1.5.2/src/google/type_traits.h +250 -0
  69. data/ext/sparsehash-1.5.2/src/hashtable_unittest.cc +1375 -0
  70. data/ext/sparsehash-1.5.2/src/simple_test.cc +103 -0
  71. data/ext/sparsehash-1.5.2/src/sparsetable_unittest.cc +696 -0
  72. data/ext/sparsehash-1.5.2/src/time_hash_map.cc +488 -0
  73. data/ext/sparsehash-1.5.2/src/type_traits_unittest.cc +492 -0
  74. data/ext/sparsehash-1.5.2/src/windows/config.h +149 -0
  75. data/ext/sparsehash-1.5.2/src/windows/google/sparsehash/sparseconfig.h +32 -0
  76. data/ext/sparsehash-1.5.2/src/windows/port.cc +63 -0
  77. data/ext/sparsehash-1.5.2/src/windows/port.h +81 -0
  78. data/ext/sparsehash-1.5.2/src/words +8944 -0
  79. data/ext/sparsehash-1.5.2/vsprojects/hashtable_unittest/hashtable_unittest.vcproj +187 -0
  80. data/ext/sparsehash-1.5.2/vsprojects/sparsetable_unittest/sparsetable_unittest.vcproj +172 -0
  81. data/ext/sparsehash-1.5.2/vsprojects/time_hash_map/time_hash_map.vcproj +187 -0
  82. data/ext/sparsehash-1.5.2/vsprojects/type_traits_unittest/type_traits_unittest.vcproj +169 -0
  83. data/ext/test.rb +10 -0
  84. data/test/spec.go +70 -0
  85. metadata +147 -0
@@ -0,0 +1,252 @@
1
+ /* Copyright (c) 1998 - 2005, Google Inc.
2
+ * All rights reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions are
6
+ * met:
7
+ *
8
+ * * Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ * * Redistributions in binary form must reproduce the above
11
+ * copyright notice, this list of conditions and the following disclaimer
12
+ * in the documentation and/or other materials provided with the
13
+ * distribution.
14
+ * * Neither the name of Google Inc. nor the names of its
15
+ * contributors may be used to endorse or promote products derived from
16
+ * this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ * ---
31
+ * Author: Craig Silverstein
32
+ *
33
+ * This library is intended to be used for in-memory hash tables,
34
+ * though it provides rudimentary permanent-storage capabilities.
35
+ * It attempts to be fast, portable, and small. The best algorithm
36
+ * to fulfill these goals is an internal probing hashing algorithm,
37
+ * as in Knuth, _Art of Computer Programming_, vol III. Unlike
38
+ * chained (open) hashing, it doesn't require a pointer for every
39
+ * item, yet it is still constant time lookup in practice.
40
+ *
41
+ * Also to save space, we let the contents (both data and key) that
42
+ * you insert be a union: if the key/data is small, we store it
43
+ * directly in the hashtable, otherwise we store a pointer to it.
44
+ * To keep you from having to figure out which, use KEY_PTR and
45
+ * PTR_KEY to convert between the arguments to these functions and
46
+ * a pointer to the real data. For instance:
47
+ * char key[] = "ab", *key2;
48
+ * HTItem *bck; HashTable *ht;
49
+ * HashInsert(ht, PTR_KEY(ht, key), 0);
50
+ * bck = HashFind(ht, PTR_KEY(ht, "ab"));
51
+ * key2 = KEY_PTR(ht, bck->key);
52
+ *
53
+ * There are a rich set of operations supported:
54
+ * AllocateHashTable() -- Allocates a hashtable structure and
55
+ * returns it.
56
+ * cchKey: if it's a positive number, then each key is a
57
+ * fixed-length record of that length. If it's 0,
58
+ * the key is assumed to be a \0-terminated string.
59
+ * fSaveKey: normally, you are responsible for allocating
60
+ * space for the key. If this is 1, we make a
61
+ * copy of the key for you.
62
+ * ClearHashTable() -- Removes everything from a hashtable
63
+ * FreeHashTable() -- Frees memory used by a hashtable
64
+ *
65
+ * HashFind() -- takes a key (use PTR_KEY) and returns the
66
+ * HTItem containing that key, or NULL if the
67
+ * key is not in the hashtable.
68
+ * HashFindLast() -- returns the item found by last HashFind()
69
+ * HashFindOrInsert() -- inserts the key/data pair if the key
70
+ * is not already in the hashtable, or
71
+ * returns the appropraite HTItem if it is.
72
+ * HashFindOrInsertItem() -- takes key/data as an HTItem.
73
+ * HashInsert() -- adds a key/data pair to the hashtable. What
74
+ * it does if the key is already in the table
75
+ * depends on the value of SAMEKEY_OVERWRITE.
76
+ * HashInsertItem() -- takes key/data as an HTItem.
77
+ * HashDelete() -- removes a key/data pair from the hashtable,
78
+ * if it's there. RETURNS 1 if it was there,
79
+ * 0 else.
80
+ * If you use sparse tables and never delete, the full data
81
+ * space is available. Otherwise we steal -2 (maybe -3),
82
+ * so you can't have data fields with those values.
83
+ * HashDeleteLast() -- deletes the item returned by the last Find().
84
+ *
85
+ * HashFirstBucket() -- used to iterate over the buckets in a
86
+ * hashtable. DON'T INSERT OR DELETE WHILE
87
+ * ITERATING! You can't nest iterations.
88
+ * HashNextBucket() -- RETURNS NULL at the end of iterating.
89
+ *
90
+ * HashSetDeltaGoalSize() -- if you're going to insert 1000 items
91
+ * at once, call this fn with arg 1000.
92
+ * It grows the table more intelligently.
93
+ *
94
+ * HashSave() -- saves the hashtable to a file. It saves keys ok,
95
+ * but it doesn't know how to interpret the data field,
96
+ * so if the data field is a pointer to some complex
97
+ * structure, you must send a function that takes a
98
+ * file pointer and a pointer to the structure, and
99
+ * write whatever you want to write. It should return
100
+ * the number of bytes written. If the file is NULL,
101
+ * it should just return the number of bytes it would
102
+ * write, without writing anything.
103
+ * If your data field is just an integer, not a
104
+ * pointer, just send NULL for the function.
105
+ * HashLoad() -- loads a hashtable. It needs a function that takes
106
+ * a file and the size of the structure, and expects
107
+ * you to read in the structure and return a pointer
108
+ * to it. You must do memory allocation, etc. If
109
+ * the data is just a number, send NULL.
110
+ * HashLoadKeys() -- unlike HashLoad(), doesn't load the data off disk
111
+ * until needed. This saves memory, but if you look
112
+ * up the same key a lot, it does a disk access each
113
+ * time.
114
+ * You can't do Insert() or Delete() on hashtables that were loaded
115
+ * from disk.
116
+ */
117
+
118
+ #include <sys/types.h> /* includes definition of "ulong", we hope */
119
+ #define ulong u_long
120
+
121
+ #define MAGIC_KEY "CHsh" /* when we save the file */
122
+
123
+ #ifndef LOG_WORD_SIZE /* 5 for 32 bit words, 6 for 64 */
124
+ #if defined (__LP64__) || defined (_LP64)
125
+ #define LOG_WORD_SIZE 6 /* log_2(sizeof(ulong)) [in bits] */
126
+ #else
127
+ #define LOG_WORD_SIZE 5 /* log_2(sizeof(ulong)) [in bits] */
128
+ #endif
129
+ #endif
130
+
131
+ /* The following gives a speed/time tradeoff: how many buckets are *
132
+ * in each bin. 0 gives 32 buckets/bin, which is a good number. */
133
+ #ifndef LOG_BM_WORDS
134
+ #define LOG_BM_WORDS 0 /* each group has 2^L_B_W * 32 buckets */
135
+ #endif
136
+
137
+ /* The following are all parameters that affect performance. */
138
+ #ifndef JUMP
139
+ #define JUMP(key, offset) ( ++(offset) ) /* ( 1 ) for linear hashing */
140
+ #endif
141
+ #ifndef Table
142
+ #define Table(x) Sparse##x /* Dense##x for dense tables */
143
+ #endif
144
+ #ifndef FAST_DELETE
145
+ #define FAST_DELETE 0 /* if it's 1, we never shrink the ht */
146
+ #endif
147
+ #ifndef SAMEKEY_OVERWRITE
148
+ #define SAMEKEY_OVERWRITE 1 /* overwrite item with our key on insert? */
149
+ #endif
150
+ #ifndef OCCUPANCY_PCT
151
+ #define OCCUPANCY_PCT 0.5 /* large PCT means smaller and slower */
152
+ #endif
153
+ #ifndef MIN_HASH_SIZE
154
+ #define MIN_HASH_SIZE 512 /* ht size when first created */
155
+ #endif
156
+ /* When deleting a bucket, we can't just empty it (future hashes *
157
+ * may fail); instead we set the data field to DELETED. Thus you *
158
+ * should set DELETED to a data value you never use. Better yet, *
159
+ * if you don't need to delete, define INSERT_ONLY. */
160
+ #ifndef INSERT_ONLY
161
+ #define DELETED -2UL
162
+ #define IS_BCK_DELETED(bck) ( (bck) && (bck)->data == DELETED )
163
+ #define SET_BCK_DELETED(ht, bck) do { (bck)->data = DELETED; \
164
+ FREE_KEY(ht, (bck)->key); } while ( 0 )
165
+ #else
166
+ #define IS_BCK_DELETED(bck) 0
167
+ #define SET_BCK_DELETED(ht, bck) \
168
+ do { fprintf(stderr, "Deletion not supported for insert-only hashtable\n");\
169
+ exit(2); } while ( 0 )
170
+ #endif
171
+
172
+ /* We need the following only for dense buckets (Dense##x above). *
173
+ * If you need to, set this to a value you'll never use for data. */
174
+ #define EMPTY -3UL /* steal more of the bck->data space */
175
+
176
+
177
+ /* This is what an item is. Either can be cast to a pointer. */
178
+ typedef struct {
179
+ ulong data; /* 4 bytes for data: either a pointer or an integer */
180
+ ulong key; /* 4 bytes for the key: either a pointer or an int */
181
+ } HTItem;
182
+
183
+ struct Table(Bin); /* defined in chash.c, I hope */
184
+ struct Table(Iterator);
185
+ typedef struct Table(Bin) Table; /* Expands to SparseBin, etc */
186
+ typedef struct Table(Iterator) TableIterator;
187
+
188
+ /* for STORES_PTR to work ok, cchKey MUST BE DEFINED 1st, cItems 2nd! */
189
+ typedef struct HashTable {
190
+ ulong cchKey; /* the length of the key, or if it's \0 terminated */
191
+ ulong cItems; /* number of items currently in the hashtable */
192
+ ulong cDeletedItems; /* # of buckets holding DELETE in the hashtable */
193
+ ulong cBuckets; /* size of the table */
194
+ Table *table; /* The actual contents of the hashtable */
195
+ int fSaveKeys; /* 1 if we copy keys locally; 2 if keys in one block */
196
+ int cDeltaGoalSize; /* # of coming inserts (or deletes, if <0) we expect */
197
+ HTItem *posLastFind; /* position of last Find() command */
198
+ TableIterator *iter; /* used in First/NextBucket */
199
+
200
+ FILE *fpData; /* if non-NULL, what item->data points into */
201
+ char * (*dataRead)(FILE *, int); /* how to load data from disk */
202
+ HTItem bckData; /* holds data after being loaded from disk */
203
+ } HashTable;
204
+
205
+ /* Small keys are stored and passed directly, but large keys are
206
+ * stored and passed as pointers. To make it easier to remember
207
+ * what to pass, we provide two functions:
208
+ * PTR_KEY: give it a pointer to your data, and it returns
209
+ * something appropriate to send to Hash() functions or
210
+ * be stored in a data field.
211
+ * KEY_PTR: give it something returned by a Hash() routine, and
212
+ * it returns a (char *) pointer to the actual data.
213
+ */
214
+ #define HashKeySize(ht) ( ((ulong *)(ht))[0] ) /* this is how we inline */
215
+ #define HashSize(ht) ( ((ulong *)(ht))[1] ) /* ...a la C++ :-) */
216
+
217
+ #define STORES_PTR(ht) ( HashKeySize(ht) == 0 || \
218
+ HashKeySize(ht) > sizeof(ulong) )
219
+ #define KEY_PTR(ht, key) ( STORES_PTR(ht) ? (char *)(key) : (char *)&(key) )
220
+ #ifdef DONT_HAVE_TO_WORRY_ABOUT_BUS_ERRORS
221
+ #define PTR_KEY(ht, ptr) ( STORES_PTR(ht) ? (ulong)(ptr) : *(ulong *)(ptr) )
222
+ #else
223
+ #define PTR_KEY(ht, ptr) ( STORES_PTR(ht) ? (ulong)(ptr) : HTcopy((char *)ptr))
224
+ #endif
225
+
226
+
227
+ /* Function prototypes */
228
+ unsigned long HTcopy(char *pul); /* for PTR_KEY, not for users */
229
+
230
+ struct HashTable *AllocateHashTable(int cchKey, int fSaveKeys);
231
+ void ClearHashTable(struct HashTable *ht);
232
+ void FreeHashTable(struct HashTable *ht);
233
+
234
+ HTItem *HashFind(struct HashTable *ht, ulong key);
235
+ HTItem *HashFindLast(struct HashTable *ht);
236
+ HTItem *HashFindOrInsert(struct HashTable *ht, ulong key, ulong dataInsert);
237
+ HTItem *HashFindOrInsertItem(struct HashTable *ht, HTItem *pItem);
238
+
239
+ HTItem *HashInsert(struct HashTable *ht, ulong key, ulong data);
240
+ HTItem *HashInsertItem(struct HashTable *ht, HTItem *pItem);
241
+
242
+ int HashDelete(struct HashTable *ht, ulong key);
243
+ int HashDeleteLast(struct HashTable *ht);
244
+
245
+ HTItem *HashFirstBucket(struct HashTable *ht);
246
+ HTItem *HashNextBucket(struct HashTable *ht);
247
+
248
+ int HashSetDeltaGoalSize(struct HashTable *ht, int delta);
249
+
250
+ void HashSave(FILE *fp, struct HashTable *ht, int (*write)(FILE *, char *));
251
+ struct HashTable *HashLoad(FILE *fp, char * (*read)(FILE *, int));
252
+ struct HashTable *HashLoadKeys(FILE *fp, char * (*read)(FILE *, int));
@@ -0,0 +1,47 @@
1
+ Microsoft Visual Studio Solution File, Format Version 8.00
2
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "type_traits_unittest", "vsprojects\type_traits_unittest\type_traits_unittest.vcproj", "{008CCFED-7D7B-46F8-8E13-03837A2258B3}"
3
+ ProjectSection(ProjectDependencies) = postProject
4
+ EndProjectSection
5
+ EndProject
6
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sparsetable_unittest", "vsprojects\sparsetable_unittest\sparsetable_unittest.vcproj", "{E420867B-8BFA-4739-99EC-E008AB762FF9}"
7
+ ProjectSection(ProjectDependencies) = postProject
8
+ EndProjectSection
9
+ EndProject
10
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hashtable_unittest", "vsprojects\hashtable_unittest\hashtable_unittest.vcproj", "{FCDB3718-F01C-4DE4-B9F5-E10F2C5C0535}"
11
+ ProjectSection(ProjectDependencies) = postProject
12
+ EndProjectSection
13
+ EndProject
14
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "time_hash_map", "vsprojects\time_hash_map\time_hash_map.vcproj", "{A74E5DB8-5295-487A-AB1D-23859F536F45}"
15
+ ProjectSection(ProjectDependencies) = postProject
16
+ EndProjectSection
17
+ EndProject
18
+ Global
19
+ GlobalSection(SolutionConfiguration) = preSolution
20
+ Debug = Debug
21
+ Release = Release
22
+ EndGlobalSection
23
+ GlobalSection(ProjectDependencies) = postSolution
24
+ EndGlobalSection
25
+ GlobalSection(ProjectConfiguration) = postSolution
26
+ {008CCFED-7D7B-46F8-8E13-03837A2258B3}.Debug.ActiveCfg = Debug|Win32
27
+ {008CCFED-7D7B-46F8-8E13-03837A2258B3}.Debug.Build.0 = Debug|Win32
28
+ {008CCFED-7D7B-46F8-8E13-03837A2258B3}.Release.ActiveCfg = Release|Win32
29
+ {008CCFED-7D7B-46F8-8E13-03837A2258B3}.Release.Build.0 = Release|Win32
30
+ {E420867B-8BFA-4739-99EC-E008AB762FF9}.Debug.ActiveCfg = Debug|Win32
31
+ {E420867B-8BFA-4739-99EC-E008AB762FF9}.Debug.Build.0 = Debug|Win32
32
+ {E420867B-8BFA-4739-99EC-E008AB762FF9}.Release.ActiveCfg = Release|Win32
33
+ {E420867B-8BFA-4739-99EC-E008AB762FF9}.Release.Build.0 = Release|Win32
34
+ {FCDB3718-F01C-4DE4-B9F5-E10F2C5C0535}.Debug.ActiveCfg = Debug|Win32
35
+ {FCDB3718-F01C-4DE4-B9F5-E10F2C5C0535}.Debug.Build.0 = Debug|Win32
36
+ {FCDB3718-F01C-4DE4-B9F5-E10F2C5C0535}.Release.ActiveCfg = Release|Win32
37
+ {FCDB3718-F01C-4DE4-B9F5-E10F2C5C0535}.Release.Build.0 = Release|Win32
38
+ {A74E5DB8-5295-487A-AB1D-23859F536F45}.Debug.ActiveCfg = Debug|Win32
39
+ {A74E5DB8-5295-487A-AB1D-23859F536F45}.Debug.Build.0 = Debug|Win32
40
+ {A74E5DB8-5295-487A-AB1D-23859F536F45}.Release.ActiveCfg = Release|Win32
41
+ {A74E5DB8-5295-487A-AB1D-23859F536F45}.Release.Build.0 = Release|Win32
42
+ EndGlobalSection
43
+ GlobalSection(ExtensibilityGlobals) = postSolution
44
+ EndGlobalSection
45
+ GlobalSection(ExtensibilityAddIns) = postSolution
46
+ EndGlobalSection
47
+ EndGlobal
@@ -0,0 +1,323 @@
1
+ #!/bin/sh
2
+ # install - install a program, script, or datafile
3
+
4
+ scriptversion=2005-05-14.22
5
+
6
+ # This originates from X11R5 (mit/util/scripts/install.sh), which was
7
+ # later released in X11R6 (xc/config/util/install.sh) with the
8
+ # following copyright and license.
9
+ #
10
+ # Copyright (C) 1994 X Consortium
11
+ #
12
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ # of this software and associated documentation files (the "Software"), to
14
+ # deal in the Software without restriction, including without limitation the
15
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16
+ # sell copies of the Software, and to permit persons to whom the Software is
17
+ # furnished to do so, subject to the following conditions:
18
+ #
19
+ # The above copyright notice and this permission notice shall be included in
20
+ # all copies or substantial portions of the Software.
21
+ #
22
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26
+ # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
27
+ # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ #
29
+ # Except as contained in this notice, the name of the X Consortium shall not
30
+ # be used in advertising or otherwise to promote the sale, use or other deal-
31
+ # ings in this Software without prior written authorization from the X Consor-
32
+ # tium.
33
+ #
34
+ #
35
+ # FSF changes to this file are in the public domain.
36
+ #
37
+ # Calling this script install-sh is preferred over install.sh, to prevent
38
+ # `make' implicit rules from creating a file called install from it
39
+ # when there is no Makefile.
40
+ #
41
+ # This script is compatible with the BSD install script, but was written
42
+ # from scratch. It can only install one file at a time, a restriction
43
+ # shared with many OS's install programs.
44
+
45
+ # set DOITPROG to echo to test this script
46
+
47
+ # Don't use :- since 4.3BSD and earlier shells don't like it.
48
+ doit="${DOITPROG-}"
49
+
50
+ # put in absolute paths if you don't have them in your path; or use env. vars.
51
+
52
+ mvprog="${MVPROG-mv}"
53
+ cpprog="${CPPROG-cp}"
54
+ chmodprog="${CHMODPROG-chmod}"
55
+ chownprog="${CHOWNPROG-chown}"
56
+ chgrpprog="${CHGRPPROG-chgrp}"
57
+ stripprog="${STRIPPROG-strip}"
58
+ rmprog="${RMPROG-rm}"
59
+ mkdirprog="${MKDIRPROG-mkdir}"
60
+
61
+ chmodcmd="$chmodprog 0755"
62
+ chowncmd=
63
+ chgrpcmd=
64
+ stripcmd=
65
+ rmcmd="$rmprog -f"
66
+ mvcmd="$mvprog"
67
+ src=
68
+ dst=
69
+ dir_arg=
70
+ dstarg=
71
+ no_target_directory=
72
+
73
+ usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
74
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
75
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
76
+ or: $0 [OPTION]... -d DIRECTORIES...
77
+
78
+ In the 1st form, copy SRCFILE to DSTFILE.
79
+ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
80
+ In the 4th, create DIRECTORIES.
81
+
82
+ Options:
83
+ -c (ignored)
84
+ -d create directories instead of installing files.
85
+ -g GROUP $chgrpprog installed files to GROUP.
86
+ -m MODE $chmodprog installed files to MODE.
87
+ -o USER $chownprog installed files to USER.
88
+ -s $stripprog installed files.
89
+ -t DIRECTORY install into DIRECTORY.
90
+ -T report an error if DSTFILE is a directory.
91
+ --help display this help and exit.
92
+ --version display version info and exit.
93
+
94
+ Environment variables override the default commands:
95
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
96
+ "
97
+
98
+ while test -n "$1"; do
99
+ case $1 in
100
+ -c) shift
101
+ continue;;
102
+
103
+ -d) dir_arg=true
104
+ shift
105
+ continue;;
106
+
107
+ -g) chgrpcmd="$chgrpprog $2"
108
+ shift
109
+ shift
110
+ continue;;
111
+
112
+ --help) echo "$usage"; exit $?;;
113
+
114
+ -m) chmodcmd="$chmodprog $2"
115
+ shift
116
+ shift
117
+ continue;;
118
+
119
+ -o) chowncmd="$chownprog $2"
120
+ shift
121
+ shift
122
+ continue;;
123
+
124
+ -s) stripcmd=$stripprog
125
+ shift
126
+ continue;;
127
+
128
+ -t) dstarg=$2
129
+ shift
130
+ shift
131
+ continue;;
132
+
133
+ -T) no_target_directory=true
134
+ shift
135
+ continue;;
136
+
137
+ --version) echo "$0 $scriptversion"; exit $?;;
138
+
139
+ *) # When -d is used, all remaining arguments are directories to create.
140
+ # When -t is used, the destination is already specified.
141
+ test -n "$dir_arg$dstarg" && break
142
+ # Otherwise, the last argument is the destination. Remove it from $@.
143
+ for arg
144
+ do
145
+ if test -n "$dstarg"; then
146
+ # $@ is not empty: it contains at least $arg.
147
+ set fnord "$@" "$dstarg"
148
+ shift # fnord
149
+ fi
150
+ shift # arg
151
+ dstarg=$arg
152
+ done
153
+ break;;
154
+ esac
155
+ done
156
+
157
+ if test -z "$1"; then
158
+ if test -z "$dir_arg"; then
159
+ echo "$0: no input file specified." >&2
160
+ exit 1
161
+ fi
162
+ # It's OK to call `install-sh -d' without argument.
163
+ # This can happen when creating conditional directories.
164
+ exit 0
165
+ fi
166
+
167
+ for src
168
+ do
169
+ # Protect names starting with `-'.
170
+ case $src in
171
+ -*) src=./$src ;;
172
+ esac
173
+
174
+ if test -n "$dir_arg"; then
175
+ dst=$src
176
+ src=
177
+
178
+ if test -d "$dst"; then
179
+ mkdircmd=:
180
+ chmodcmd=
181
+ else
182
+ mkdircmd=$mkdirprog
183
+ fi
184
+ else
185
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
186
+ # might cause directories to be created, which would be especially bad
187
+ # if $src (and thus $dsttmp) contains '*'.
188
+ if test ! -f "$src" && test ! -d "$src"; then
189
+ echo "$0: $src does not exist." >&2
190
+ exit 1
191
+ fi
192
+
193
+ if test -z "$dstarg"; then
194
+ echo "$0: no destination specified." >&2
195
+ exit 1
196
+ fi
197
+
198
+ dst=$dstarg
199
+ # Protect names starting with `-'.
200
+ case $dst in
201
+ -*) dst=./$dst ;;
202
+ esac
203
+
204
+ # If destination is a directory, append the input filename; won't work
205
+ # if double slashes aren't ignored.
206
+ if test -d "$dst"; then
207
+ if test -n "$no_target_directory"; then
208
+ echo "$0: $dstarg: Is a directory" >&2
209
+ exit 1
210
+ fi
211
+ dst=$dst/`basename "$src"`
212
+ fi
213
+ fi
214
+
215
+ # This sed command emulates the dirname command.
216
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
217
+
218
+ # Make sure that the destination directory exists.
219
+
220
+ # Skip lots of stat calls in the usual case.
221
+ if test ! -d "$dstdir"; then
222
+ defaultIFS='
223
+ '
224
+ IFS="${IFS-$defaultIFS}"
225
+
226
+ oIFS=$IFS
227
+ # Some sh's can't handle IFS=/ for some reason.
228
+ IFS='%'
229
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
230
+ shift
231
+ IFS=$oIFS
232
+
233
+ pathcomp=
234
+
235
+ while test $# -ne 0 ; do
236
+ pathcomp=$pathcomp$1
237
+ shift
238
+ if test ! -d "$pathcomp"; then
239
+ $mkdirprog "$pathcomp"
240
+ # mkdir can fail with a `File exist' error in case several
241
+ # install-sh are creating the directory concurrently. This
242
+ # is OK.
243
+ test -d "$pathcomp" || exit
244
+ fi
245
+ pathcomp=$pathcomp/
246
+ done
247
+ fi
248
+
249
+ if test -n "$dir_arg"; then
250
+ $doit $mkdircmd "$dst" \
251
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
252
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
253
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
254
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
255
+
256
+ else
257
+ dstfile=`basename "$dst"`
258
+
259
+ # Make a couple of temp file names in the proper directory.
260
+ dsttmp=$dstdir/_inst.$$_
261
+ rmtmp=$dstdir/_rm.$$_
262
+
263
+ # Trap to clean up those temp files at exit.
264
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
265
+ trap '(exit $?); exit' 1 2 13 15
266
+
267
+ # Copy the file name to the temp name.
268
+ $doit $cpprog "$src" "$dsttmp" &&
269
+
270
+ # and set any options; do chmod last to preserve setuid bits.
271
+ #
272
+ # If any of these fail, we abort the whole thing. If we want to
273
+ # ignore errors from any of these, just make sure not to ignore
274
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
275
+ #
276
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
277
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
278
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
279
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
280
+
281
+ # Now rename the file to the real destination.
282
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
283
+ || {
284
+ # The rename failed, perhaps because mv can't rename something else
285
+ # to itself, or perhaps because mv is so ancient that it does not
286
+ # support -f.
287
+
288
+ # Now remove or move aside any old file at destination location.
289
+ # We try this two ways since rm can't unlink itself on some
290
+ # systems and the destination file might be busy for other
291
+ # reasons. In this case, the final cleanup might fail but the new
292
+ # file should still install successfully.
293
+ {
294
+ if test -f "$dstdir/$dstfile"; then
295
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
296
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
297
+ || {
298
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
299
+ (exit 1); exit 1
300
+ }
301
+ else
302
+ :
303
+ fi
304
+ } &&
305
+
306
+ # Now rename the file to the real destination.
307
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
308
+ }
309
+ }
310
+ fi || { (exit 1); exit 1; }
311
+ done
312
+
313
+ # The final little trick to "correctly" pass the exit status to the exit trap.
314
+ {
315
+ (exit 0); exit 0
316
+ }
317
+
318
+ # Local variables:
319
+ # eval: (add-hook 'write-file-hooks 'time-stamp)
320
+ # time-stamp-start: "scriptversion="
321
+ # time-stamp-format: "%:y-%02m-%02d.%02H"
322
+ # time-stamp-end: "$"
323
+ # End: