亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? tclhash.c

?? tcl源碼詳細(xì)資料
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
#ifndef EXCLUDE_TCL/*  * tclHash.c -- * *	Implementation of in-memory hash tables for Tcl and Tcl-based *	applications. * * Copyright 1991 Regents of the University of California * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that this copyright * notice appears in all copies.  The University of California * makes no representations about the suitability of this * software for any purpose.  It is provided "as is" without * express or implied warranty. */#include "tclInt.h"/* * Imported library procedures for which there are no header files: */extern void panic();/* * When there are this many entries per bucket, on average, rebuild * the hash table to make it larger. */#define REBUILD_MULTIPLIER	3/* * The following macro takes a preliminary integer hash value and * produces an index into a hash tables bucket list.  The idea is * to make it so that preliminary values that are arbitrarily similar * will end up in different buckets.  The hash function was taken * from a random-number generator. */#define RANDOM_INDEX(tablePtr, i) \    (((((long) (i))*1103515245) >> (tablePtr)->downShift) & (tablePtr)->mask)/* * Procedure prototypes for static procedures in this file: */static Tcl_HashEntry *	ArrayFind _ANSI_ARGS_((Tcl_HashTable *tablePtr,			    char *key));static Tcl_HashEntry *	ArrayCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr,			    char *key, int *newPtr));static Tcl_HashEntry *	BogusFind _ANSI_ARGS_((Tcl_HashTable *tablePtr,			    char *key));static Tcl_HashEntry *	BogusCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr,			    char *key, int *newPtr));static unsigned int	HashString _ANSI_ARGS_((char *string));static void		RebuildTable _ANSI_ARGS_((Tcl_HashTable *tablePtr));static Tcl_HashEntry *	StringFind _ANSI_ARGS_((Tcl_HashTable *tablePtr,			    char *key));static Tcl_HashEntry *	StringCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr,			    char *key, int *newPtr));static Tcl_HashEntry *	OneWordFind _ANSI_ARGS_((Tcl_HashTable *tablePtr,			    char *key));static Tcl_HashEntry *	OneWordCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr,			    char *key, int *newPtr));/* *---------------------------------------------------------------------- * * Tcl_InitHashTable -- * *	Given storage for a hash table, set up the fields to prepare *	the hash table for use. * * Results: *	None. * * Side effects: *	TablePtr is now ready to be passed to Tcl_FindHashEntry and *	Tcl_CreateHashEntry. * *---------------------------------------------------------------------- */voidTcl_InitHashTable(tablePtr, keyType)    register Tcl_HashTable *tablePtr;	/* Pointer to table record, which					 * is supplied by the caller. */    int keyType;			/* Type of keys to use in table:					 * TCL_STRING_KEYS, TCL_ONE_WORD_KEYS,					 * or an integer >= 2. */{    tablePtr->buckets = tablePtr->staticBuckets;    tablePtr->staticBuckets[0] = tablePtr->staticBuckets[1] = 0;    tablePtr->staticBuckets[2] = tablePtr->staticBuckets[3] = 0;    tablePtr->numBuckets = TCL_SMALL_HASH_TABLE;    tablePtr->numEntries = 0;    tablePtr->rebuildSize = TCL_SMALL_HASH_TABLE*REBUILD_MULTIPLIER;    tablePtr->downShift = 28;    tablePtr->mask = 3;    tablePtr->keyType = keyType;    if (keyType == TCL_STRING_KEYS) {	tablePtr->findProc = StringFind;	tablePtr->createProc = StringCreate;    } else if (keyType == TCL_ONE_WORD_KEYS) {	tablePtr->findProc = OneWordFind;	tablePtr->createProc = OneWordCreate;    } else {	tablePtr->findProc = ArrayFind;	tablePtr->createProc = ArrayCreate;    };}/* *---------------------------------------------------------------------- * * Tcl_DeleteHashEntry -- * *	Remove a single entry from a hash table. * * Results: *	None. * * Side effects: *	The entry given by entryPtr is deleted from its table and *	should never again be used by the caller.  It is up to the *	caller to free the clientData field of the entry, if that *	is relevant. * *---------------------------------------------------------------------- */voidTcl_DeleteHashEntry(entryPtr)    Tcl_HashEntry *entryPtr;{    register Tcl_HashEntry *prevPtr;    if (*entryPtr->bucketPtr == entryPtr) {	*entryPtr->bucketPtr = entryPtr->nextPtr;    } else {	for (prevPtr = *entryPtr->bucketPtr; ; prevPtr = prevPtr->nextPtr) {	    if (prevPtr == NULL) {		panic("malformed bucket chain in Tcl_DeleteHashEntry");	    }	    if (prevPtr->nextPtr == entryPtr) {		prevPtr->nextPtr = entryPtr->nextPtr;		break;	    }	}    }    entryPtr->tablePtr->numEntries--;    ckfree((char *) entryPtr);}/* *---------------------------------------------------------------------- * * Tcl_DeleteHashTable -- * *	Free up everything associated with a hash table except for *	the record for the table itself. * * Results: *	None. * * Side effects: *	The hash table is no longer useable. * *---------------------------------------------------------------------- */voidTcl_DeleteHashTable(tablePtr)    register Tcl_HashTable *tablePtr;		/* Table to delete. */{    register Tcl_HashEntry *hPtr, *nextPtr;    int i;    /*     * Free up all the entries in the table.     */    for (i = 0; i < tablePtr->numBuckets; i++) {	hPtr = tablePtr->buckets[i];	while (hPtr != NULL) {	    nextPtr = hPtr->nextPtr;	    ckfree((char *) hPtr);	    hPtr = nextPtr;	}    }    /*     * Free up the bucket array, if it was dynamically allocated.     */    if (tablePtr->buckets != tablePtr->staticBuckets) {	ckfree((char *) tablePtr->buckets);    }    /*     * Arrange for panics if the table is used again without     * re-initialization.     */    tablePtr->findProc = BogusFind;    tablePtr->createProc = BogusCreate;}/* *---------------------------------------------------------------------- * * Tcl_FirstHashEntry -- * *	Locate the first entry in a hash table and set up a record *	that can be used to step through all the remaining entries *	of the table. * * Results: *	The return value is a pointer to the first entry in tablePtr, *	or NULL if tablePtr has no entries in it.  The memory at *	*searchPtr is initialized so that subsequent calls to *	Tcl_NextHashEntry will return all of the entries in the table, *	one at a time. * * Side effects: *	None. * *---------------------------------------------------------------------- */Tcl_HashEntry *Tcl_FirstHashEntry(tablePtr, searchPtr)    Tcl_HashTable *tablePtr;		/* Table to search. */    Tcl_HashSearch *searchPtr;		/* Place to store information about					 * progress through the table. */{    searchPtr->tablePtr = tablePtr;    searchPtr->nextIndex = 0;    searchPtr->nextEntryPtr = NULL;    return Tcl_NextHashEntry(searchPtr);}/* *---------------------------------------------------------------------- * * Tcl_NextHashEntry -- * *	Once a hash table enumeration has been initiated by calling *	Tcl_FirstHashEntry, this procedure may be called to return *	successive elements of the table. * * Results: *	The return value is the next entry in the hash table being *	enumerated, or NULL if the end of the table is reached. * * Side effects: *	None. * *---------------------------------------------------------------------- */Tcl_HashEntry *Tcl_NextHashEntry(searchPtr)    register Tcl_HashSearch *searchPtr;	/* Place to store information about					 * progress through the table.  Must					 * have been initialized by calling					 * Tcl_FirstHashEntry. */{    Tcl_HashEntry *hPtr;    while (searchPtr->nextEntryPtr == NULL) {	if (searchPtr->nextIndex >= searchPtr->tablePtr->numBuckets) {	    return NULL;	}	searchPtr->nextEntryPtr =		searchPtr->tablePtr->buckets[searchPtr->nextIndex];	searchPtr->nextIndex++;    }    hPtr = searchPtr->nextEntryPtr;    searchPtr->nextEntryPtr = hPtr->nextPtr;    return hPtr;}/* *---------------------------------------------------------------------- * * Tcl_HashStats -- * *	Return statistics describing the layout of the hash table *	in its hash buckets. * * Results: *	The return value is a malloc-ed string containing information *	about tablePtr.  It is the caller's responsibility to free *	this string. * * Side effects: *	None. * *---------------------------------------------------------------------- */char *Tcl_HashStats(tablePtr)    Tcl_HashTable *tablePtr;		/* Table for which to produce stats. */{#define NUM_COUNTERS 10    int count[NUM_COUNTERS], overflow, i, j;    double average, tmp;    register Tcl_HashEntry *hPtr;    char *result, *p;    /*     * Compute a histogram of bucket usage.     */    for (i = 0; i < NUM_COUNTERS; i++) {	count[i] = 0;    }    overflow = 0;    average = 0.0;    for (i = 0; i < tablePtr->numBuckets; i++) {	j = 0;	for (hPtr = tablePtr->buckets[i]; hPtr != NULL; hPtr = hPtr->nextPtr) {	    j++;	}	if (j < NUM_COUNTERS) {	    count[j]++;	} else {	    overflow++;	}	tmp = j;	average += (tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;    }    /*     * Print out the histogram and a few other pieces of information.     */    result = (char *) ckalloc((unsigned) ((NUM_COUNTERS*60) + 300));    sprintf(result, "%d entries in table, %d buckets\n",	    tablePtr->numEntries, tablePtr->numBuckets);    p = result + strlen(result);    for (i = 0; i < NUM_COUNTERS; i++) {	sprintf(p, "number of buckets with %d entries: %d\n",		i, count[i]);	p += strlen(p);    }    sprintf(p, "number of buckets with more %d or more entries: %d\n",	    NUM_COUNTERS, overflow);    p += strlen(p);    sprintf(p, "average search distance for entry: %.1f", average);    return result;}/* *---------------------------------------------------------------------- * * HashString -- * *	Compute a one-word summary of a text string, which can be *	used to generate a hash index. * * Results: *	The return value is a one-word summary of the information in *	string. * * Side effects: *	None. * *---------------------------------------------------------------------- */static unsigned intHashString(string)    register char *string;	/* String from which to compute hash value. */{    register unsigned int result;    register int c;    /*     * I tried a zillion different hash functions and asked many other     * people for advice.  Many people had their own favorite functions,     * all different, but no-one had much idea why they were good ones.     * I chose the one below (multiply by 9 and add new character)     * because of the following reasons:     *     * 1. Multiplying by 10 is perfect for keys that are decimal strings,     *    and multiplying by 9 is just about as good.     * 2. Times-9 is (shift-left-3) plus (old).  This means that each     *    character's bits hang around in the low-order bits of the     *    hash value for ever, plus they spread fairly rapidly up to     *    the high-order bits to fill out the hash value.  This seems     *    works well both for decimal and non-decimal strings.     */    result = 0;    while (1) {	c = *string;	string++;	if (c == 0) {	    break;	}	result += (result<<3) + c;    }    return result;}/* *---------------------------------------------------------------------- * * StringFind -- * *	Given a hash table with string keys, and a string key, find *	the entry with a matching key. * * Results: *	The return value is a token for the matching entry in the *	hash table, or NULL if there was no matching entry. * * Side effects: *	None. * *---------------------------------------------------------------------- */static Tcl_HashEntry *StringFind(tablePtr, key)    Tcl_HashTable *tablePtr;	/* Table in which to lookup entry. */    char *key;			/* Key to use to find matching entry. */{    register Tcl_HashEntry *hPtr;    register char *p1, *p2;    int index;    index = HashString(key) & tablePtr->mask;    /*     * Search all of the entries in the appropriate bucket.     */    for (hPtr = tablePtr->buckets[index]; hPtr != NULL;	    hPtr = hPtr->nextPtr) {	for (p1 = key, p2 = hPtr->key.string; ; p1++, p2++) {	    if (*p1 != *p2) {		break;	    }	    if (*p1 == '\0') {		return hPtr;	    }	}    }    return NULL;}/* *---------------------------------------------------------------------- * * StringCreate -- * *	Given a hash table with string keys, and a string key, find *	the entry with a matching key.  If there is no matching entry, *	then create a new entry that does match. * * Results: *	The return value is a pointer to the matching entry.  If this

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区在线不卡| 欧美日韩精品一区二区在线播放| 成人性生交大片免费看在线播放| 国产乱码字幕精品高清av| 亚洲色图欧美激情| 亚洲免费观看视频| 亚洲v中文字幕| 久久精品国产网站| 高清视频一区二区| 欧美日韩日日夜夜| 久久亚洲影视婷婷| 亚洲精品成人悠悠色影视| 日韩国产在线观看| 成人精品视频一区二区三区| 欧洲视频一区二区| 9i在线看片成人免费| 67194成人在线观看| 中文字幕不卡一区| 日韩激情一二三区| 国产jizzjizz一区二区| 欧美日韩一区二区在线观看| 久久久久久亚洲综合| 亚洲日本电影在线| 裸体一区二区三区| 色噜噜狠狠成人中文综合| 精品日韩欧美在线| 日韩亚洲欧美高清| 亚洲免费毛片网站| 国产激情一区二区三区四区| 精品视频在线免费看| 国产精品毛片大码女人| 日韩电影免费在线看| 99久精品国产| 精品精品国产高清a毛片牛牛 | 偷拍日韩校园综合在线| 国产精品夜夜爽| 国产激情91久久精品导航| 欧美亚洲高清一区二区三区不卡| 蜜臀国产一区二区三区在线播放| 国产日韩欧美制服另类| 青草av.久久免费一区| 一本久道久久综合中文字幕| 国产午夜亚洲精品不卡| 五月天激情小说综合| 99re热视频精品| 久久免费看少妇高潮| 视频一区二区三区中文字幕| 色素色在线综合| 国产精品久久久久久一区二区三区| 久久国产欧美日韩精品| 在线观看视频91| 亚洲国产激情av| 国产精品99久久久久久久vr| 日韩精品资源二区在线| 视频一区二区三区在线| 欧美三级日韩三级国产三级| 亚洲精品成人在线| 色综合中文字幕国产| 国产精品毛片高清在线完整版| 一区二区三区四区视频精品免费 | 精品久久人人做人人爱| 亚洲国产精品尤物yw在线观看| 成人黄色国产精品网站大全在线免费观看 | 日韩三级免费观看| 亚洲一二三四区| 97se亚洲国产综合自在线不卡| 日本一区二区高清| 69成人精品免费视频| 91精品国产高清一区二区三区| 午夜视频在线观看一区| 欧美网站一区二区| 亚洲国产一二三| 欧美性色aⅴ视频一区日韩精品| 一区二区三区四区在线播放| 色播五月激情综合网| 一区二区三区日韩精品| 91天堂素人约啪| 亚洲精品一二三| 91国偷自产一区二区三区观看| 中文在线一区二区| 97精品电影院| 一区二区高清免费观看影视大全 | 最近日韩中文字幕| av欧美精品.com| 亚洲图片另类小说| 色综合一个色综合| 一区二区理论电影在线观看| 欧美亚洲自拍偷拍| 亚洲成a天堂v人片| 日韩亚洲欧美一区| 国产精品一卡二| 国产精品国模大尺度视频| www.av亚洲| 亚洲自拍都市欧美小说| 狠狠色丁香久久婷婷综合_中| 久久综合色婷婷| 成人激情免费视频| 亚洲毛片av在线| 欧美精品在线观看播放| 久久国产精品99久久久久久老狼| 欧美变态口味重另类| 国产精品白丝jk白祙喷水网站| 国产精品久久夜| 欧美日韩日日夜夜| 亚洲视频精选在线| 欧美日韩大陆在线| 久久99蜜桃精品| 国产精品久久久久aaaa| av一区二区三区四区| 亚洲成人激情综合网| 日韩欧美成人一区二区| 国产最新精品精品你懂的| 亚洲天堂成人在线观看| 欧美美女bb生活片| 国产高清亚洲一区| 亚洲美女免费在线| 欧美日韩国产精品自在自线| 国内不卡的二区三区中文字幕 | 日韩美女视频一区二区| 欧美日韩精品免费| 国产一区二区网址| 亚洲欧美一区二区三区孕妇| 91精品蜜臀在线一区尤物| 国产精品一二一区| 亚洲精选一二三| 日韩一区二区免费在线观看| 成人午夜短视频| 日韩电影一区二区三区| 中文字幕中文字幕在线一区| 777亚洲妇女| 99久久国产综合精品女不卡| 日本中文在线一区| 亚洲人成网站精品片在线观看| 日韩精品专区在线| 色视频成人在线观看免| 激情都市一区二区| 亚洲国产一二三| 国产精品美女久久久久久2018 | 国产美女精品在线| 亚瑟在线精品视频| 国产精品狼人久久影院观看方式| 欧美福利电影网| 色综合久久久久久久| 国产伦精品一区二区三区视频青涩 | 亚洲精品亚洲人成人网在线播放| 欧美电影免费观看高清完整版在线| 91在线观看一区二区| 麻豆视频观看网址久久| 亚洲免费观看高清完整版在线观看| 精品欧美一区二区久久| 欧美亚洲一区三区| www.爱久久.com| 国产成人aaa| 热久久免费视频| 亚洲综合在线第一页| 日本一区二区成人| 久久亚洲一区二区三区四区| 欧美日本一区二区| 色视频欧美一区二区三区| 国产成人精品免费视频网站| 蜜臀av一区二区| 午夜精品久久久久| 亚洲伦在线观看| 国产精品成人网| 中文字幕免费不卡在线| 久久影院电视剧免费观看| 91精品国产综合久久精品app| 欧洲中文字幕精品| 色综合久久中文字幕综合网| 夜夜嗨av一区二区三区中文字幕| 国产精品卡一卡二| 国产午夜精品一区二区三区视频| 欧美电视剧免费全集观看| 欧美一区三区二区| 在线观看91av| 欧美日韩国产经典色站一区二区三区| 99综合影院在线| 成人av网址在线| 丰满少妇在线播放bd日韩电影| 久久精品国产一区二区| 亚洲国产中文字幕| 亚洲小说春色综合另类电影| 亚洲一区二区五区| 尤物视频一区二区| 亚洲永久免费av| 夜夜嗨av一区二区三区中文字幕 | www.欧美亚洲| 懂色av中文一区二区三区| 国产剧情一区二区| 国产精品456| 懂色一区二区三区免费观看| av激情综合网| 在线这里只有精品| 欧美亚洲综合在线| 在线成人av网站| 日韩一级成人av| 精品国产乱码91久久久久久网站| 久久这里只有精品视频网| 国产欧美精品一区二区三区四区 | 91黄色激情网站|