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

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

?? except.c

?? 一些常用的數(shù)據(jù)結(jié)構(gòu)庫
?? C
字號:
/* * Portable Exception Handling for ANSI C. * Copyright (C) 1999 Kaz Kylheku <kaz@ashi.footprints.net> * * Free Software License: * * All rights are reserved by the author, with the following exceptions: * Permission is granted to freely reproduce and distribute this software, * possibly in exchange for a fee, provided that this copyright notice appears * intact. Permission is also granted to adapt this software to produce * derivative works, as long as the modified versions carry this copyright * notice and additional notices stating that the work has been modified. * This source code may be translated into executable form and incorporated * into proprietary software; there is no requirement for such software to * contain a copyright notice related to this source. * $Id: except.c,v 1.27.2.2 2001/07/27 01:20:34 kaz Exp $ * $Name: kazlib_1_20 $ */#include <assert.h>#include <stdlib.h>#include <stdio.h>#include <stdarg.h>#include <limits.h>#include "except.h"#define XCEPT_BUFFER_SIZE	1024#ifdef KAZLIB_RCSIDstatic const char rcsid[] = "$Id: except.c,v 1.27.2.2 2001/07/27 01:20:34 kaz Exp $";#endif#define group except_group#define code except_code#define id except_id#define message except_message#define dyndata except_dyndata#define func except_func#define context except_context#define id except_id#define size except_size#define obj except_obj#define jmp except_jmp#define down except_down#define type except_type#define catcher except_catcher#define cleanup except_cleanup#define info except_info#ifdef KAZLIB_POSIX_THREADS#include <pthread.h>static pthread_mutex_t init_mtx = PTHREAD_MUTEX_INITIALIZER;static int init_counter;static pthread_key_t top_key;static pthread_key_t uh_key;static pthread_key_t alloc_key;static pthread_key_t dealloc_key;static void unhandled_catcher(except_t *);#define get_top() ((struct except_stacknode *) pthread_getspecific(top_key))#define set_top(T) (pthread_setspecific(top_key, (T)), (void)((T) == (struct except_stacknode *) 0))#define set_catcher(C) (pthread_setspecific(uh_key, (void *) (C)), (void)((C) == (void (*)(except_t *)) 0))#define set_alloc(A) (pthread_setspecific(alloc_key, (void *) (A)), (void)((A) == (void *(*)(size_t)) 0))#define set_dealloc(D) (pthread_setspecific(dealloc_key, (void *) (D)), (void)((D) == (void (*)(void *)) 0))static void (*get_catcher(void))(except_t *){    void (*catcher)(except_t *) = (void (*)(except_t *)) pthread_getspecific(uh_key);    return (catcher == 0) ? unhandled_catcher : catcher;}static void *(*get_alloc(void))(size_t){    void *(*alloc)(size_t) = (void *(*)(size_t)) pthread_getspecific(alloc_key);    return (alloc == 0) ? malloc : alloc;}static void (*get_dealloc(void))(void *){    void (*dealloc)(void *) = (void (*)(void *)) pthread_getspecific(dealloc_key);    return (dealloc == 0) ? free : dealloc;}int except_init(void){    int retval = 1;    pthread_mutex_lock(&init_mtx);    assert (init_counter < INT_MAX);    if (init_counter++ == 0) {	int top_ok = (pthread_key_create(&top_key, 0) == 0);	int uh_ok = (pthread_key_create(&uh_key, 0) == 0);	int alloc_ok = (pthread_key_create(&alloc_key, 0) == 0);	int dealloc_ok = (pthread_key_create(&dealloc_key, 0) == 0);       	if (!top_ok || !uh_ok || !alloc_ok || !dealloc_ok) {	    retval = 0;	    init_counter = 0;	    if (top_ok)		pthread_key_delete(top_key);	    if (uh_ok)		pthread_key_delete(uh_key);	    if (alloc_ok)		pthread_key_delete(alloc_key);	    if (dealloc_ok)		pthread_key_delete(dealloc_key);	}    }    pthread_mutex_unlock(&init_mtx);    return retval;}void except_deinit(void){    pthread_mutex_lock(&init_mtx);    assert (init_counter > 0);    if (--init_counter == 0) {	pthread_key_delete(top_key);	pthread_key_delete(uh_key);	pthread_key_delete(alloc_key);	pthread_key_delete(dealloc_key);    }    pthread_mutex_unlock(&init_mtx);}#else	/* no thread support */static int init_counter;static void unhandled_catcher(except_t *);static void (*uh_catcher_ptr)(except_t *) = unhandled_catcher;static void *(*allocator)(size_t) = malloc;static void (*deallocator)(void *) = free;static struct except_stacknode *stack_top;#define get_top() (stack_top)#define set_top(T) (stack_top = (T))#define get_catcher() (uh_catcher_ptr)#define set_catcher(C) (uh_catcher_ptr = (C))#define get_alloc() (allocator)#define set_alloc(A) (allocator = (A))#define get_dealloc() (deallocator)#define set_dealloc(D) (deallocator = (D))int except_init(void){    assert (init_counter < INT_MAX);    init_counter++;    return 1;}void except_deinit(void){    assert (init_counter > 0);    init_counter--;}#endifstatic int match(const volatile except_id_t *thrown, const except_id_t *caught){    int group_match = (caught->group == XCEPT_GROUP_ANY || caught->group == thrown->group);    int code_match = (caught->code == XCEPT_CODE_ANY || caught->code == thrown->code);    return group_match && code_match;}static void do_throw(except_t *except){    struct except_stacknode *top;    assert (except->id.group != 0 && except->id.code != 0);    for (top = get_top(); top != 0; top = top->down) {	if (top->type == XCEPT_CLEANUP) {	    top->info.cleanup->func(top->info.cleanup->context);	} else {	    struct except_catch *catcher = top->info.catcher;	    const except_id_t *pi = catcher->id;	    size_t i;		    assert (top->type == XCEPT_CATCHER);	    except_free(catcher->obj.dyndata);	    for (i = 0; i < catcher->size; pi++, i++) {		if (match(&except->id, pi)) {		    catcher->obj = *except;		    set_top(top);		    longjmp(catcher->jmp, 1);		}	    }	}    }    set_top(top);    get_catcher()(except);	/* unhandled exception */    abort();}static void unhandled_catcher(except_t *except){    fprintf(stderr, "Unhandled exception (\"%s\", group=%ld, code=%ld)\n",	    except->message, except->id.group, except->id.code);    abort();}static void stack_push(struct except_stacknode *node){    node->down = get_top();    set_top(node);}void except_setup_clean(struct except_stacknode *esn,	struct except_cleanup *ecl, void (*cleanf)(void *), void *context){    esn->type = XCEPT_CLEANUP;    ecl->func = cleanf;    ecl->context = context;    esn->info.cleanup = ecl;    stack_push(esn);}void except_setup_try(struct except_stacknode *esn,	struct except_catch *ech, const except_id_t id[], size_t size){   ech->id = id;   ech->size = size;   ech->obj.dyndata = 0;   esn->type = XCEPT_CATCHER;   esn->info.catcher = ech;   stack_push(esn);}struct except_stacknode *except_pop(void){    struct except_stacknode *top = get_top();    set_top(top->down);    return top;}void except_rethrow(except_t *except){    struct except_stacknode *top = get_top();    assert (top != 0);    assert (top->type == XCEPT_CATCHER);    assert (&top->info.catcher->obj == except);    set_top(top->down);    do_throw(except);}void except_throw(long group, long code, const char *msg){    except_t except;    except.id.group = group;    except.id.code = code;    except.message = msg;    except.dyndata = 0;    do_throw(&except);}void except_throwd(long group, long code, const char *msg, void *data){    except_t except;    except.id.group = group;    except.id.code = code;    except.message = msg;    except.dyndata = data;    do_throw(&except);}void except_throwf(long group, long code, const char *fmt, ...){    char *buf = except_alloc(XCEPT_BUFFER_SIZE);    va_list vl;    va_start (vl, fmt);    vsprintf(buf, fmt, vl);    va_end (vl);    except_throwd(group, code, buf, buf);}void (*except_unhandled_catcher(void (*new_catcher)(except_t *)))(except_t *){    void (*old_catcher)(except_t *) = get_catcher();    set_catcher(new_catcher);    return old_catcher;}#undef except_code#undef except_group#undef except_message#undef except_dataunsigned long except_code(except_t *ex){    return ex->id.code;}unsigned long except_group(except_t *ex){    return ex->id.group;}const char *except_message(except_t *ex){    return ex->message;}void *except_data(except_t *ex){    return ex->dyndata;}void *except_take_data(except_t *ex){    void *data = ex->dyndata;    ex->dyndata = 0;    return data;}void except_set_allocator(void *(*alloc)(size_t), void (*dealloc)(void *)){    set_alloc(alloc);    set_dealloc(dealloc);}void *except_alloc(size_t size){    void *ptr = get_alloc()(size);    if (ptr == 0)	except_throw(XCEPT_BAD_ALLOC, 0, "out of memory");    return ptr;}void except_free(void *ptr){    get_dealloc()(ptr);}#ifdef KAZLIB_TEST_MAIN#include <stdio.h>#include <ctype.h>static void cleanup(void *arg){    printf("cleanup(\"%s\") called\n", (char *) arg);}static void bottom_level(void){    char buf[256];    printf("throw exception? "); fflush(stdout);    fgets(buf, sizeof buf, stdin);    if (buf[0] >= 0 && toupper(buf[0]) == 'Y')	except_throw(1, 1, "nasty exception");}static void top_level(void){    except_cleanup_push(cleanup, "argument");    bottom_level();    except_cleanup_pop(0);}int main(int argc, char **argv){    static const except_id_t catch[] = { { 1, 1 }, { 1, 2 } };    except_t *ex;    /*     * Nested exception ``try blocks''     */    /* outer */    except_try_push(catch, 2, &ex);    if (!ex) {	/* inner */	except_try_push(catch, 2, &ex);	if (!ex) {	    top_level();	} else {	    /* inner catch */	    printf("caught exception (inner): \"%s\", s=%ld, c=%ld\n",		    except_message(ex), except_group(ex), except_code(ex));	    except_rethrow(ex);	}	except_try_pop();    } else {	/* outer catch */	printf("caught exception (outer): \"%s\", s=%ld, c=%ld\n",		except_message(ex), except_group(ex), except_code(ex));    }    except_try_pop();    except_throw(99, 99, "exception in main");    return 0;}#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国模无码大尺度一区二区三区| 国产欧美精品国产国产专区| 亚洲精品视频免费观看| 99久久久国产精品| 自拍偷拍亚洲激情| 国产精品一卡二| 欧美国产日本韩| 成人黄色在线看| 亚洲日本欧美天堂| 97精品久久久午夜一区二区三区| 国产精品福利影院| av福利精品导航| 欧美国产日韩一二三区| 99久久亚洲一区二区三区青草| 国产女人aaa级久久久级| 91在线免费视频观看| 亚洲国产乱码最新视频| 欧美一区二区三区四区视频| 国内精品不卡在线| 国产精品久久久久婷婷二区次| 成人免费视频视频| 夜夜嗨av一区二区三区中文字幕| 91精品欧美久久久久久动漫| 极品少妇一区二区三区精品视频| 国产蜜臀av在线一区二区三区| 97久久超碰精品国产| 亚洲成人福利片| 欧美精品一区二区三区蜜桃视频| www.亚洲色图.com| 日本亚洲最大的色成网站www| 精品国产制服丝袜高跟| 91免费国产在线观看| 日本伊人色综合网| 国产精品国产三级国产专播品爱网 | www.久久久久久久久| 一区二区三区精密机械公司| 欧美v国产在线一区二区三区| 成人午夜私人影院| 日本欧美大码aⅴ在线播放| 亚洲国产精品传媒在线观看| 欧美精品久久天天躁| 国产iv一区二区三区| 亚洲123区在线观看| 国产欧美视频一区二区| 欧美久久久久久蜜桃| 99热国产精品| 久久99久久精品| 天堂影院一区二区| 亚洲私人黄色宅男| 精品福利一区二区三区免费视频| 色综合久久精品| 韩国一区二区三区| 亚洲电影激情视频网站| √…a在线天堂一区| 精品国产青草久久久久福利| 欧美日精品一区视频| 成人午夜电影久久影院| 六月婷婷色综合| 午夜视频一区二区三区| 中文字幕制服丝袜一区二区三区| 337p日本欧洲亚洲大胆色噜噜| 色成人在线视频| 成人免费看视频| 国产美女av一区二区三区| 秋霞电影网一区二区| 午夜久久久久久| 一区二区三区久久| 亚洲欧洲色图综合| 久久久久国产精品厨房| 欧美成人精品3d动漫h| 欧美日韩成人综合天天影院| 在线观看av一区二区| 91影视在线播放| 成人午夜视频在线| 国产精品18久久久久久久久久久久| 日韩av一区二区在线影视| 亚洲第一综合色| 亚洲自拍偷拍九九九| 洋洋成人永久网站入口| 亚洲综合色网站| 一区二区三区免费| 亚洲综合色视频| 亚洲国产精品自拍| 亚洲va天堂va国产va久| 亚洲一二三区视频在线观看| 亚洲线精品一区二区三区八戒| 一区二区三区在线免费观看| 一区二区理论电影在线观看| 一区二区三区免费在线观看| 亚洲一区二区在线视频| 亚洲综合在线免费观看| 亚洲午夜精品网| 丝瓜av网站精品一区二区| 免费人成精品欧美精品| 久久99国产精品久久99| 国产一区不卡精品| 成人午夜在线免费| 色综合久久久久综合| 一本一道波多野结衣一区二区| 欧洲在线/亚洲| 日韩亚洲电影在线| 国产午夜精品久久久久久久| 亚洲国产精品成人综合色在线婷婷| 亚洲国产高清在线| 夜夜嗨av一区二区三区中文字幕| 偷拍自拍另类欧美| 极品瑜伽女神91| 99re这里只有精品视频首页| 色老汉一区二区三区| 欧美日韩成人综合在线一区二区| 欧美va天堂va视频va在线| 国产色爱av资源综合区| 国产精品国产三级国产aⅴ原创 | 欧美日韩国产精品成人| 欧美久久久久中文字幕| 久久久久成人黄色影片| 亚洲免费色视频| 青青草国产成人av片免费| 国产制服丝袜一区| 成人不卡免费av| 6080日韩午夜伦伦午夜伦| 久久久久久9999| 亚洲精品视频在线观看网站| 日本vs亚洲vs韩国一区三区二区 | 一区二区三区在线看| 五月天激情小说综合| 狠狠网亚洲精品| 不卡的电影网站| 制服丝袜中文字幕一区| 国产欧美日本一区二区三区| 亚洲va欧美va天堂v国产综合| 久久成人免费网| 91免费观看国产| 精品欧美一区二区三区精品久久| 亚洲免费在线电影| 精品一区二区在线观看| 91香蕉视频污在线| 精品久久久久久久人人人人传媒| 亚洲精品免费播放| 免费观看在线色综合| 91麻豆精东视频| 亚洲精品一区二区三区四区高清| 中文字幕在线不卡视频| 亚洲www啪成人一区二区麻豆| 亚洲黄色小说网站| 看片网站欧美日韩| 99久久国产综合精品色伊| 日韩一区二区免费电影| 伊人婷婷欧美激情| 九一九一国产精品| 色婷婷激情一区二区三区| 欧美大度的电影原声| 午夜精品福利一区二区三区蜜桃| 国产毛片精品一区| 欧美精品一卡两卡| 国产精品入口麻豆九色| 亚洲综合小说图片| 91网上在线视频| 久久这里只有精品6| 视频一区二区三区入口| 国产在线精品不卡| 欧美高清hd18日本| 一区二区久久久| 99视频一区二区| 国产欧美va欧美不卡在线| 亚洲电影第三页| 成人黄色网址在线观看| 在线成人小视频| 久久亚洲精华国产精华液 | 国产成人av一区二区三区在线| 欧美一区二区二区| 亚洲国产综合在线| 一本一道久久a久久精品| 国产精品久久三| 色综合一个色综合亚洲| 国产精品网友自拍| 国产成人在线网站| 国产欧美一区二区精品忘忧草| 久久aⅴ国产欧美74aaa| 欧美精品自拍偷拍| 亚洲一区二区不卡免费| 欧美中文一区二区三区| 亚洲免费电影在线| 99久久夜色精品国产网站| 国产精品三级av| 日本乱码高清不卡字幕| 日韩伦理av电影| 99精品国产99久久久久久白柏| 国产精品天天摸av网| 97久久超碰国产精品| 亚洲欧洲日韩女同| 99久久国产免费看| 成人欧美一区二区三区黑人麻豆| 成+人+亚洲+综合天堂| 欧美国产日韩一二三区| 成人黄色在线看| 亚洲动漫第一页| 欧美一级一区二区| 精品影院一区二区久久久| 在线精品视频一区二区三四|