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

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

?? value.c

?? 開發(fā)板bios源碼 開發(fā)板bios源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * value.c -- Generic type (holds all types)
 *
 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved.
 *
 * $Id: value.c,v 1.2 2001/12/06 16:28:24 bporter Exp $
 */

/******************************** Description *********************************/

/*
 *	This module provides a generic type that can hold all possible types.
 *	It is designed to provide maximum effeciency.
 */

/********************************* Includes ***********************************/

#ifdef UEMF
	#include	"uemf.h"
#else
	#include	"basic/basicInternal.h"
#endif

/*********************************** Locals ***********************************/
#ifndef UEMF
static value_t value_null;					/* All zeros */

/***************************** Forward Declarations ***************************/

static void	coerce_types(value_t* v1, value_t* v2);
static int	value_to_integer(value_t* vp);
#endif /*!UEMF*/
/*********************************** Code *************************************/
/*
 *	Initialize a integer value.
 */

value_t valueInteger(long value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = integer;
	v.value.integer = value;
	return v;
}

/******************************************************************************/
/*
 *	Initialize a string value.
 */

value_t valueString(char_t* value, int flags)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = string;
	if (flags & VALUE_ALLOCATE) {
		v.allocated = 1;
		v.value.string = gstrdup(B_L, value);
	} else {
		v.allocated = 0;
		v.value.string = value;
	}
	return v;
}

/******************************************************************************/
/*
 *	Free any storage allocated for a value.
 */

void valueFree(value_t* v)
{
	if (v->valid && v->allocated && v->type == string &&
			v->value.string != NULL) {
		bfree(B_L, v->value.string);
	}
#ifndef UEMF
	if (v->valid && v->type == symbol && v->value.symbol.data != NULL &&
			v->value.symbol.freeCb !=NULL) {
		v->value.symbol.freeCb(v->value.symbol.data);
	}
#endif
	v->type = undefined;
	v->valid = 0;
	v->allocated = 0;
}

#ifndef UEMF

/******************************************************************************/
/*
 *	Initialize an invalid value.
 */

value_t valueInvalid()
{
	value_t	v;
	v.valid = 0;
	v.type = undefined;
	return v;
}

/******************************************************************************/
/*
 *	Initialize a flag value.
 */

value_t valueBool(int value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.type = flag;
	v.valid = 1;
	v.value.flag = (char) value;
	return v;
}

/******************************************************************************/
/*
 *	Initialize a byteint value.
 */

value_t valueByteint(char value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = byteint;
	v.value.byteint = value;
	return v;
}

/******************************************************************************/
/*
 *	Initialize a shortint value.
 */

value_t valueShortint(short value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = shortint;
	v.value.shortint = value;
	return v;
}

#ifdef FLOATING_POINT_SUPPORT
/******************************************************************************/
/*
 *	Initialize a floating value.
 */

value_t valueFloating(double value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = floating;
	v.value.floating = value;
	return v;
}
#endif /* FLOATING_POINT_SUPPORT */

/******************************************************************************/
/*
 *	Initialize a big value.
 */

value_t valueBig(long high_word, long low_word)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = big;
	v.value.big[BLOW] = low_word;
	v.value.big[BHIGH] = high_word;
	return v;
}

/******************************************************************************/
/*
 *	Initialize a hex value.
 */

value_t valueHex(int value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = hex;
	v.value.integer = value;
	return v;
}

/******************************************************************************/
/*
 *	Initialize a octal value.
 */

value_t valueOctal(int value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = octal;
	v.value.integer = value;
	return v;
}

/******************************************************************************/
/*
 *	Initialize a percent value.
 */

value_t valuePercent(int value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = percent;
	v.value.percent = (char) value;
	return v;
}

/******************************************************************************/
/*
 *	Initialize an byte array. Note: no allocation, just store the ptr
 */

value_t valueBytes(char* value, int flags)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = bytes;
	if (flags & VALUE_ALLOCATE) {
		v.allocated = 1;
		v.value.bytes = bstrdupA(B_L, value);
	} else {
		v.allocated = 0;
		v.value.bytes = value;
	}
	return v;
}

/******************************************************************************/
/*
 *	Initialize a symbol value.
 *	Value parameter can hold a pointer to any type of value
 *	Free parameter can be NULL, or a function pointer to a function that will
 *		free the value
 */

value_t valueSymbol(void *value, freeCallback freeCb)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = symbol;
	v.value.symbol.data = value;
	v.value.symbol.freeCb = freeCb;
	return v;
}

/******************************************************************************/
/*
 *	Initialize an error message value.
 */

value_t valueErrmsg(char_t* value)
{
	value_t	v;

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;
	v.type = errmsg;
	v.value.errmsg = value;
	return v;
}

/******************************************************************************/
/*
 *	Copy a value. If the type is 'string' then allocate another string.
 *	Note: we allow the copy of a null value.
 */

value_t valueCopy(value_t v2)
{
	value_t		v1;

	v1 = v2;
	if (v2.valid && v2.type == string && v2.value.string != NULL) {
		v1.value.string = gstrdup(B_L, v2.value.string);
		v1.allocated = 1;
	}
	return v1;
}


/******************************************************************************/
/*
 *	Add a value.
 */

value_t valueAdd(value_t v1, value_t v2)
{
	value_t	v;

	a_assert(v1.valid);
	a_assert(v2.valid);

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;

	if (v1.type != v2.type)
		coerce_types(&v1, &v2);

	switch (v1.type) {
	default:
	case string:
	case bytes:
		a_assert(0);
		break;

#ifdef FLOATING_POINT_SUPPORT
	case floating:
		v1.value.floating += v2.value.floating;
		return v1;
#endif

	case flag:
		v1.value.bool |= v2.value.flag;
		return v1;

	case byteint:
	case percent:
		v1.value.byteint += v2.value.byteint;
		return v1;

	case shortint:
		v1.value.shortint += v2.value.shortint;
		return v1;

	case hex:
	case integer:
	case octal:
		v1.value.integer += v2.value.integer;
		return v1;

	case big:
		v.type = big;
		badd(v.value.big, v1.value.big, v2.value.big);
		return v;
	}

	return v1;
}


/******************************************************************************/
/*
 *	Subtract a value.
 */

value_t valueSub(value_t v1, value_t v2)
{
	value_t	v;

	a_assert(v1.valid);
	a_assert(v2.valid);

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;

	if (v1.type != v2.type)
		coerce_types(&v1, &v2);
	switch (v1.type) {
	default:
		a_assert(0);
		break;

#ifdef FLOATING_POINT_SUPPORT
	case floating:
		v1.value.floating -= v2.value.floating;
		return v1;
#endif

	case flag:
		v1.value.flag &= v2.value.flag;
		return v1;

	case byteint:
	case percent:
		v1.value.byteint -= v2.value.byteint;
		return v1;

	case shortint:
		v1.value.shortint -= v2.value.shortint;
		return v1;

	case hex:
	case integer:
	case octal:
		v1.value.integer -= v2.value.integer;
		return v1;

	case big:
		v.type = big;
		bsub(v.value.big, v1.value.big, v2.value.big);
		return v;
	}

	return v1;
}


/******************************************************************************/
/*
 *	Multiply a value.
 */

value_t valueMul(value_t v1, value_t v2)
{
	value_t	v;

	a_assert(v1.valid);
	a_assert(v2.valid);

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;

	if (v1.type != v2.type)
		coerce_types(&v1, &v2);
	switch (v1.type) {
	default:
		a_assert(0);
		break;

	case flag:
		a_assert(v1.type != flag);
		break;

#ifdef FLOATING_POINT_SUPPORT
	case floating:
		v1.value.floating *= v2.value.floating;
		return v1;
#endif

	case byteint:
	case percent:
		v1.value.byteint *= v2.value.byteint;
		return v1;

	case shortint:
		v1.value.shortint *= v2.value.shortint;
		return v1;

	case hex:
	case integer:
	case octal:
		v1.value.integer *= v2.value.integer;
		return v1;

	case big:
		v.type = big;
		bmul(v.value.big, v1.value.big, v2.value.big);
		return v;
	}

	return v1;
}


/******************************************************************************/
/*
 *	Divide a value.
 */

value_t valueDiv(value_t v1, value_t v2)
{
	value_t	v;

	a_assert(v1.valid);
	a_assert(v2.valid);

	memset(&v, 0x0, sizeof(v));
	v.valid = 1;

	if (v1.type != v2.type)
		coerce_types(&v1, &v2);
	switch (v1.type) {
	default:
		a_assert(0);
		break;

	case flag:
		a_assert(v1.type != flag);
		break;

#ifdef FLOATING_POINT_SUPPORT
	case floating:
		v1.value.floating /= v2.value.floating;
		return v1;
#endif

	case byteint:
	case percent:
		v1.value.byteint /= v2.value.byteint;
		return v1;

	case shortint:
		v1.value.shortint /= v2.value.shortint;
		return v1;

	case hex:
	case integer:
	case octal:
		v1.value.integer /= v2.value.integer;
		return v1;

	case big:
		v.type = big;
		bdiv(v.value.big, v1.value.big, v2.value.big);
		return v;
	}

	return v1;
}


/******************************************************************************/
/*
 *	Compare a value.
 */

int valueCmp(value_t v1, value_t v2)
{
	a_assert(v1.valid);
	a_assert(v2.valid);

	if (v1.type != v2.type)
		coerce_types(&v1, &v2);
	if (v1.type != v2.type) {
/*
 *		Make v2 == v1
 */
		a_assert(v1.type == v2.type);
		v2 = v1;
		return 0;
	}
	switch (v1.type) {
	case string:
		if (v1.value.string == NULL && v2.value.string == NULL) {
			return 0;
		} else if (v1.value.string == NULL) {
			return -1;
		} else if (v2.value.string == NULL) {
			return 1;
		} else {
			return gstrcmp(v1.value.string, v2.value.string);
		}
		/* Nobody here */

	case flag:
		if (v1.value.flag < v2.value.flag)
			return -1;
		else if (v1.value.flag == v2.value.flag)
			return 0;
		else return 1;

#ifdef FLOATING_POINT_SUPPORT
	case floating:
		if (v1.value.floating < v2.value.floating)
			return -1;
		else if (v1.value.floating == v2.value.floating)
			return 0;
		else return 1;
#endif

	case byteint:
	case percent:
		if (v1.value.byteint < v2.value.byteint)
			return -1;
		else if (v1.value.byteint == v2.value.byteint)
			return 0;
		else return 1;

	case shortint:
		if (v1.value.shortint < v2.value.shortint)
			return -1;
		else if (v1.value.shortint == v2.value.shortint)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人三级电影在线| 欧美视频三区在线播放| 2014亚洲片线观看视频免费| 精品无人区卡一卡二卡三乱码免费卡 | 日韩精品色哟哟| 欧美日韩另类一区| 免费一级欧美片在线观看| 日韩你懂的在线播放| 久88久久88久久久| 国产精品色眯眯| 91亚洲精品久久久蜜桃网站 | 久久久激情视频| 国产成人精品影视| 亚洲免费观看高清| 欧美精品tushy高清| 精品一区二区三区蜜桃| 国产精品久久久久毛片软件| 91色porny在线视频| 亚洲成人精品在线观看| 日韩美女一区二区三区| 成人av网站在线观看| 亚洲国产另类av| 久久精品一区二区三区不卡| 99在线精品一区二区三区| 婷婷中文字幕综合| 国产欧美日韩视频在线观看| 欧美性大战xxxxx久久久| 免费成人在线影院| 1024成人网| 正在播放亚洲一区| 成人午夜激情视频| 日韩精品成人一区二区在线| 国产欧美久久久精品影院| 欧美日韩精品欧美日韩精品一综合| 久久精品二区亚洲w码| 国产精品国产三级国产a| 91精品国产色综合久久不卡蜜臀| 成人一级片网址| 免费的国产精品| 亚洲美女免费视频| 国产午夜精品一区二区| 欧美电影一区二区三区| 国产不卡视频在线播放| 日韩有码一区二区三区| 亚洲免费在线观看| 国产亚洲精品bt天堂精选| 欧美疯狂性受xxxxx喷水图片| 成人18视频在线播放| 韩国av一区二区三区四区| 午夜影视日本亚洲欧洲精品| 亚洲色图.com| 国产精品免费久久久久| 精品黑人一区二区三区久久| 国产女人18毛片水真多成人如厕| 51午夜精品国产| 在线视频亚洲一区| 91一区一区三区| 国产91清纯白嫩初高中在线观看| 久久超碰97人人做人人爱| 三级亚洲高清视频| 亚洲一区在线观看网站| 日韩一区在线播放| 国产精品久久久久影院老司 | 日韩毛片一二三区| 久久精品人人做人人爽人人| 日韩一级精品视频在线观看| 欧美人与禽zozo性伦| 在线观看成人免费视频| 91丨porny丨在线| 91在线观看污| 一本色道久久加勒比精品 | 国产女人18毛片水真多成人如厕| 日韩精品一区二区三区三区免费| 91精品国产色综合久久ai换脸 | 一区二区三区色| 亚洲少妇最新在线视频| 亚洲人成网站影音先锋播放| 亚洲天堂中文字幕| 亚洲欧美区自拍先锋| 一区二区三区精品在线| 一区二区免费看| 亚洲综合丝袜美腿| 亚洲第一久久影院| 日本不卡一区二区三区| 美女视频黄 久久| 美国一区二区三区在线播放| 黄网站免费久久| 国产在线精品一区二区不卡了| 极品少妇xxxx偷拍精品少妇| 激情图片小说一区| 国产suv精品一区二区6| 99精品视频在线观看免费| 色天使色偷偷av一区二区| 欧美偷拍一区二区| 日韩一区二区三区高清免费看看| 日韩免费性生活视频播放| 久久久久99精品一区| 亚洲欧洲av色图| 亚洲一区二区三区精品在线| 日韩国产精品久久久| 国产一区欧美二区| 成人av综合在线| 91成人看片片| 日韩亚洲欧美成人一区| 欧美韩国一区二区| 亚洲国产精品一区二区www| 日本不卡视频在线| 国产91精品露脸国语对白| 色哟哟国产精品| 欧美一区二区久久久| 国产欧美精品在线观看| 亚洲高清免费一级二级三级| 久久不见久久见中文字幕免费| 99久久久国产精品免费蜜臀| 欧美一区二区三区在线视频| 欧美极品aⅴ影院| 成人av资源在线| 91精品国产综合久久精品app| 久久久99免费| 亚洲成精国产精品女| 国产伦精品一区二区三区免费| 91免费观看视频| 91 com成人网| 亚洲免费观看高清完整版在线 | 91麻豆免费观看| 日韩美一区二区三区| 一区二区三区日韩| 国产一区二区精品久久| 欧美三级蜜桃2在线观看| 欧美国产日韩精品免费观看| 亚欧色一区w666天堂| 91亚洲精品久久久蜜桃网站| 精品久久人人做人人爱| 亚洲不卡在线观看| av综合在线播放| 久久色.com| 日本成人超碰在线观看| 欧美在线一区二区三区| 国产精品视频第一区| 男女性色大片免费观看一区二区 | 韩国av一区二区三区在线观看| 91免费观看视频在线| 中文字幕免费观看一区| 日韩高清在线观看| 欧美一a一片一级一片| 国产精品每日更新| 国产精品系列在线播放| 日韩精品一区二区在线| 三级一区在线视频先锋 | 韩国精品主播一区二区在线观看| 欧美精品自拍偷拍动漫精品| 一区二区三区四区在线播放 | 久久久久久久久久久黄色| 青青草成人在线观看| 911精品产国品一二三产区| 亚洲宅男天堂在线观看无病毒| 成人免费黄色在线| 久久精品视频免费观看| 国模无码大尺度一区二区三区| 日韩一区二区影院| 三级亚洲高清视频| 欧美一区二区在线观看| 日韩av在线播放中文字幕| 欧美亚洲综合久久| 亚洲制服丝袜av| 欧美日韩二区三区| 婷婷开心激情综合| 制服丝袜日韩国产| 日本伊人色综合网| 91精品国产91久久久久久一区二区 | 久久夜色精品一区| 国产电影一区在线| 国产精品久久久久久久蜜臀| 成人涩涩免费视频| 国产精品国产三级国产普通话99| 99精品桃花视频在线观看| 中文字幕人成不卡一区| 91麻豆精品视频| 亚洲一区二区三区四区的| 亚洲激情自拍偷拍| 欧美最猛黑人xxxxx猛交| 午夜电影网一区| 91精品国产综合久久香蕉的特点| 欧美aⅴ一区二区三区视频| 欧美精品一区二区三区在线播放| 国产精品影视在线观看| 国产精品嫩草影院com| 日本高清不卡在线观看| 日韩中文欧美在线| 久久久噜噜噜久噜久久综合| 成人av在线一区二区| 亚洲午夜国产一区99re久久| 欧美一区二区三区日韩视频| 国产一区二区免费视频| 亚洲私人影院在线观看| 制服丝袜激情欧洲亚洲| 国产成人亚洲精品青草天美| 亚洲激情av在线| 日韩亚洲国产中文字幕欧美| 处破女av一区二区|