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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tclhash.c

?? tcl源碼詳細資料
?? C
?? 第 1 頁 / 共 2 頁
字號:
#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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情欧美一区二区三区在线观看| 日本成人在线不卡视频| 精品三级在线看| 欧美日韩中文字幕一区二区| 国产在线视视频有精品| 日韩高清不卡在线| 亚洲bt欧美bt精品777| 亚洲欧美另类图片小说| 国产清纯在线一区二区www| 久久久噜噜噜久久中文字幕色伊伊 | 国产69精品久久99不卡| 秋霞成人午夜伦在线观看| 婷婷国产在线综合| 亚洲一区二区三区精品在线| 一区二区三区在线视频免费| 中文字幕在线不卡一区二区三区| 国产精品久久久久一区二区三区 | 激情综合色丁香一区二区| 日韩中文字幕麻豆| 五月激情丁香一区二区三区| 蜜桃视频一区二区三区 | 91福利在线看| 2020国产精品| 2020国产成人综合网| 在线成人午夜影院| 91精品国产综合久久精品麻豆| 欧美日韩日日摸| 精品国产百合女同互慰| 色综合视频在线观看| 色婷婷精品久久二区二区蜜臂av | 激情文学综合网| 成人午夜短视频| 99久久99久久精品免费看蜜桃| 99精品视频中文字幕| 国产精品1区二区.| 99精品欧美一区二区三区小说| 99久久99精品久久久久久| 在线影视一区二区三区| 99久久er热在这里只有精品66| 91国产免费观看| 制服丝袜国产精品| 久久久久国产精品麻豆ai换脸| 久久综合九色综合久久久精品综合| 国产亚洲欧美在线| 日韩美女啊v在线免费观看| 一级做a爱片久久| 亚洲综合免费观看高清完整版在线| 另类欧美日韩国产在线| 国产麻豆精品95视频| 成人一区二区三区中文字幕| 91丝袜国产在线播放| 欧美日韩卡一卡二| 香蕉久久一区二区不卡无毒影院 | 欧美性猛交一区二区三区精品| 欧美日韩午夜精品| 久久一夜天堂av一区二区三区| 亚洲视频中文字幕| 久久精品国产亚洲一区二区三区| 国产69精品久久久久毛片| 欧美亚洲图片小说| 日韩美女天天操| 亚洲欧美怡红院| 首页国产丝袜综合| 成人av电影在线播放| 色综合久久综合网97色综合| 精品国免费一区二区三区| 伊人婷婷欧美激情| 激情文学综合网| 91麻豆国产福利在线观看| 久久久99精品免费观看| 亚洲夂夂婷婷色拍ww47| 国产一本一道久久香蕉| 欧美视频日韩视频| 18欧美亚洲精品| 久久91精品国产91久久小草 | 欧美激情一区在线| 亚洲国产中文字幕在线视频综合 | 国产999精品久久久久久绿帽| 日本精品一区二区三区高清| 亚洲精品在线电影| 亚洲日本青草视频在线怡红院 | 99久久精品久久久久久清纯| 日韩欧美资源站| 亚洲欧美一区二区三区国产精品 | 日韩一区在线看| 蜜臀av国产精品久久久久| 色欧美乱欧美15图片| 久久久久久免费网| 奇米亚洲午夜久久精品| 51精品视频一区二区三区| 一区二区在线观看免费视频播放| 99久久99久久精品国产片果冻| 国产日韩精品一区二区三区| 国产在线麻豆精品观看| 欧美va亚洲va在线观看蝴蝶网| 视频在线在亚洲| 在线不卡免费av| 日韩中文字幕区一区有砖一区| 欧美另类z0zxhd电影| 视频一区欧美日韩| 69堂精品视频| 免费看日韩精品| 日韩欧美国产综合| 久久国产精品无码网站| 久久夜色精品国产噜噜av| 国产老妇另类xxxxx| 国产亚洲一区二区三区| 国产成人亚洲综合a∨婷婷 | 日本中文在线一区| 日韩欧美亚洲一区二区| 久久99精品国产91久久来源| 久久综合99re88久久爱| 成人综合婷婷国产精品久久蜜臀 | 亚洲国产精品人人做人人爽| 欧美性一区二区| 日韩精品久久久久久| 91精品国产91久久久久久一区二区| 轻轻草成人在线| 久久亚洲综合色一区二区三区| 国产99一区视频免费| 一区二区三区在线视频免费| 欧美美女喷水视频| 久久国产精品99精品国产| 国产欧美精品一区二区三区四区| kk眼镜猥琐国模调教系列一区二区| 亚洲精品高清在线观看| 欧美日韩精品一区二区三区| 久久成人免费网| 欧美激情一区二区三区蜜桃视频| 色婷婷亚洲一区二区三区| 午夜视频在线观看一区二区三区| 日韩欧美卡一卡二| 不卡一区二区三区四区| 亚洲高清久久久| 久久久久久久久久电影| 日本韩国欧美一区| 免费观看一级欧美片| 国产欧美视频一区二区| 欧美中文字幕久久| 国产一区视频在线看| 亚洲女与黑人做爰| 欧美一区二区精美| 成人网男人的天堂| 首页亚洲欧美制服丝腿| 欧美国产日本韩| 91超碰这里只有精品国产| 成人综合在线观看| 日韩avvvv在线播放| 国产精品电影一区二区三区| 欧美高清性hdvideosex| 国产成人精品亚洲日本在线桃色 | 成人黄色软件下载| 舔着乳尖日韩一区| 国产精品麻豆一区二区| 欧美一区二区三区喷汁尤物| 国产一区欧美一区| 久久免费偷拍视频| 在线看国产日韩| 国产一区二区美女| 亚洲国产精品嫩草影院| 国产日韩高清在线| 日韩欧美一区二区三区在线| 91麻豆精品在线观看| 精品系列免费在线观看| 亚洲精品免费视频| 国产亚洲自拍一区| 日韩欧美国产系列| 欧美日韩午夜精品| 91色.com| 国产a精品视频| 狠狠色综合日日| 亚洲国产视频一区二区| 亚洲欧洲国产专区| 国产欧美日韩另类视频免费观看 | 一级女性全黄久久生活片免费| 国产亚洲综合av| 在线播放91灌醉迷j高跟美女 | 国产欧美日韩综合精品一区二区| 欧美一区二区三区四区久久| 色婷婷精品大在线视频| 不卡影院免费观看| 国产成人午夜99999| 毛片基地黄久久久久久天堂| 亚洲线精品一区二区三区 | 国产精品一卡二卡在线观看| 蜜臀av一区二区在线观看| 亚洲精品第一国产综合野| 中文字幕的久久| 久久无码av三级| 日韩欧美一区二区在线视频| 精品视频一区 二区 三区| 91免费视频观看| 一本色道亚洲精品aⅴ| 成人av小说网| 成人免费视频网站在线观看| 国产成人午夜高潮毛片| 国产成人av电影免费在线观看| 激情六月婷婷久久| 精品亚洲porn| 国内一区二区视频|