Mercurial > hg > xemacs-beta
comparison lisp/gtk-marshal.el @ 2523:f981d2fdd880
[xemacs-hg @ 2005-01-28 00:32:17 by ben]
Propagate hash changes to gtk-marshal.el
gtk-marshal.el: Propagate hash changes to gtk-marshal.el.
author | ben |
---|---|
date | Fri, 28 Jan 2005 00:32:20 +0000 |
parents | 91d4c8c65a0f |
children | db7068430402 |
comparison
equal
deleted
inserted
replaced
2522:52dc9b940348 | 2523:f981d2fdd880 |
---|---|
259 ) | 259 ) |
260 (mapc (lambda (x) (apply 'define-marshaller x)) todo) | 260 (mapc (lambda (x) (apply 'define-marshaller x)) todo) |
261 | 261 |
262 (insert "\n | 262 (insert "\n |
263 #include \"hash.h\" | 263 #include \"hash.h\" |
264 static int | |
265 our_string_eq (const void *st1, const void *st2) | |
266 { | |
267 if (!st1) | |
268 return st2 ? 0 : 1; | |
269 else if (!st2) | |
270 return 0; | |
271 else | |
272 return !strcmp ( (const char *) st1, (const char *) st2); | |
273 } | |
274 | |
275 static unsigned long | |
276 our_string_hash (const void *xv) | |
277 { | |
278 unsigned int h = 0; | |
279 unsigned const char *x = (unsigned const char *) xv; | |
280 | |
281 if (!x) return 0; | |
282 | |
283 while (*x) | |
284 { | |
285 unsigned int g; | |
286 h = (h << 4) + *x++; | |
287 if ((g = h & 0xf0000000) != 0) | |
288 h = (h ^ (g >> 24)) ^ g; | |
289 } | |
290 | |
291 return h; | |
292 } | |
293 | 264 |
294 static struct hash_table *marshaller_hashtable; | 265 static struct hash_table *marshaller_hashtable; |
295 | 266 |
296 static void initialize_marshaller_storage (void) | 267 static void initialize_marshaller_storage (void) |
297 { | 268 { |
298 if (!marshaller_hashtable) | 269 if (!marshaller_hashtable) |
299 { | 270 { |
300 marshaller_hashtable = make_general_hash_table (100, our_string_hash, our_string_eq); | 271 marshaller_hashtable = make_string_hash_table (100); |
301 ") | 272 ") |
302 | 273 |
303 (mapc (lambda (x) | 274 (mapc (lambda (x) |
304 (let ((name (get-marshaller-name (car x) (cdr x)))) | 275 (let ((name (get-marshaller-name (car x) (cdr x)))) |
305 (insert (format "\t\tputhash (\"%s\", (void *) %s, marshaller_hashtable);\n" name name)))) | 276 (insert (format "\t\tputhash (\"%s\", (void *) %s, marshaller_hashtable);\n" name name)))) |