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

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

?? cash.c

?? postgresql8.3.4源碼,開(kāi)源數(shù)據(jù)庫(kù)
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* * cash.c * Written by D'Arcy J.M. Cain * darcy@druid.net * http://www.druid.net/darcy/ * * Functions to allow input and output of money normally but store * and handle it as 64 bit ints * * A slightly modified version of this file and a discussion of the * workings can be found in the book "Software Solutions in C" by * Dale Schumacher, Academic Press, ISBN: 0-12-632360-7 except that * this version handles 64 bit numbers and so can hold values up to * $92,233,720,368,547,758.07. * * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.77.2.1 2008/06/09 19:58:46 tgl Exp $ */#include "postgres.h"#include <limits.h>#include <ctype.h>#include <math.h>#include <locale.h>#include "libpq/pqformat.h"#include "utils/cash.h"#include "utils/pg_locale.h"#define CASH_BUFSZ		36#define TERMINATOR		(CASH_BUFSZ - 1)#define LAST_PAREN		(TERMINATOR - 1)#define LAST_DIGIT		(LAST_PAREN - 1)/* * Cash is a pass-by-ref SQL type, so we must pass and return pointers. * These macros and support routine hide the pass-by-refness. */#define PG_GETARG_CASH(n)  (* ((Cash *) PG_GETARG_POINTER(n)))#define PG_RETURN_CASH(x)  return CashGetDatum(x)/************************************************************************* * Private routines ************************************************************************/static const char *num_word(Cash value){	static char buf[128];	static const char *small[] = {		"zero", "one", "two", "three", "four", "five", "six", "seven",		"eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen",		"fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty",		"thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"	};	const char **big = small + 18;	int			tu = value % 100;	/* deal with the simple cases first */	if (value <= 20)		return small[value];	/* is it an even multiple of 100? */	if (!tu)	{		sprintf(buf, "%s hundred", small[value / 100]);		return buf;	}	/* more than 99? */	if (value > 99)	{		/* is it an even multiple of 10 other than 10? */		if (value % 10 == 0 && tu > 10)			sprintf(buf, "%s hundred %s",					small[value / 100], big[tu / 10]);		else if (tu < 20)			sprintf(buf, "%s hundred and %s",					small[value / 100], small[tu]);		else			sprintf(buf, "%s hundred %s %s",					small[value / 100], big[tu / 10], small[tu % 10]);	}	else	{		/* is it an even multiple of 10 other than 10? */		if (value % 10 == 0 && tu > 10)			sprintf(buf, "%s", big[tu / 10]);		else if (tu < 20)			sprintf(buf, "%s", small[tu]);		else			sprintf(buf, "%s %s", big[tu / 10], small[tu % 10]);	}	return buf;}	/* num_word() */static DatumCashGetDatum(Cash value){	Cash	   *result = (Cash *) palloc(sizeof(Cash));	*result = value;	return PointerGetDatum(result);}/* cash_in() * Convert a string to a cash data type. * Format is [$]###[,]###[.##] * Examples: 123.45 $123.45 $123,456.78 * */Datumcash_in(PG_FUNCTION_ARGS){	char	   *str = PG_GETARG_CSTRING(0);	Cash		result;	Cash		value = 0;	Cash		dec = 0;	Cash		sgn = 1;	int			seen_dot = 0;	const char *s = str;	int			fpoint;	char		dsymbol,				ssymbol,				psymbol;	const char *nsymbol,			   *csymbol;	struct lconv *lconvert = PGLC_localeconv();	/*	 * frac_digits will be CHAR_MAX in some locales, notably C.  However, just	 * testing for == CHAR_MAX is risky, because of compilers like gcc that	 * "helpfully" let you alter the platform-standard definition of whether	 * char is signed or not.  If we are so unfortunate as to get compiled	 * with a nonstandard -fsigned-char or -funsigned-char switch, then our	 * idea of CHAR_MAX will not agree with libc's. The safest course is not	 * to test for CHAR_MAX at all, but to impose a range check for plausible	 * frac_digits values.	 */	fpoint = lconvert->frac_digits;	if (fpoint < 0 || fpoint > 10)		fpoint = 2;				/* best guess in this case, I think */	dsymbol = ((*lconvert->mon_decimal_point != '\0') ? *lconvert->mon_decimal_point : '.');	if (*lconvert->mon_thousands_sep != '\0')		ssymbol = *lconvert->mon_thousands_sep;	else		/* ssymbol should not equal dsymbol */		ssymbol = (dsymbol != ',') ? ',' : '.';	csymbol = ((*lconvert->currency_symbol != '\0') ? lconvert->currency_symbol : "$");	psymbol = ((*lconvert->positive_sign != '\0') ? *lconvert->positive_sign : '+');	nsymbol = ((*lconvert->negative_sign != '\0') ? lconvert->negative_sign : "-");#ifdef CASHDEBUG	printf("cashin- precision '%d'; decimal '%c'; thousands '%c'; currency '%s'; positive '%c'; negative '%s'\n",		   fpoint, dsymbol, ssymbol, csymbol, psymbol, nsymbol);#endif	/* we need to add all sorts of checking here.  For now just */	/* strip all leading whitespace and any leading currency symbol */	while (isspace((unsigned char) *s))		s++;	if (strncmp(s, csymbol, strlen(csymbol)) == 0)		s += strlen(csymbol);#ifdef CASHDEBUG	printf("cashin- string is '%s'\n", s);#endif	/* a leading minus or paren signifies a negative number */	/* again, better heuristics needed */	/* XXX - doesn't properly check for balanced parens - djmc */	if (strncmp(s, nsymbol, strlen(nsymbol)) == 0)	{		sgn = -1;		s += strlen(nsymbol);#ifdef CASHDEBUG		printf("cashin- negative symbol; string is '%s'\n", s);#endif	}	else if (*s == '(')	{		sgn = -1;		s++;	}	else if (*s == psymbol)		s++;#ifdef CASHDEBUG	printf("cashin- string is '%s'\n", s);#endif	while (isspace((unsigned char) *s))		s++;	if (strncmp(s, csymbol, strlen(csymbol)) == 0)		s += strlen(csymbol);#ifdef CASHDEBUG	printf("cashin- string is '%s'\n", s);#endif	for (;; s++)	{		/* we look for digits as int8 as we have less */		/* than the required number of decimal places */		if (isdigit((unsigned char) *s) && dec < fpoint)		{			value = (value * 10) + *s - '0';			if (seen_dot)				dec++;		}		/* decimal point? then start counting fractions... */		else if (*s == dsymbol && !seen_dot)		{			seen_dot = 1;		}		/* not "thousands" separator? */		else if (*s != ssymbol)		{			/* round off */			if (isdigit((unsigned char) *s) && *s >= '5')				value++;			/* adjust for less than required decimal places */			for (; dec < fpoint; dec++)				value *= 10;			break;		}	}	/* should only be trailing digits followed by whitespace or right paren */	while (isdigit((unsigned char) *s))		s++;	while (isspace((unsigned char) *s) || *s == ')')		s++;	if (*s != '\0')		ereport(ERROR,				(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),				 errmsg("invalid input syntax for type money: \"%s\"", str)));	result = value * sgn;#ifdef CASHDEBUG	printf("cashin- result is %d\n", result);#endif	PG_RETURN_CASH(result);}/* cash_out() * Function to convert cash to a dollars and cents representation. * XXX HACK This code appears to assume US conventions for *	positive-valued amounts. - tgl 97/04/14 */Datumcash_out(PG_FUNCTION_ARGS){	Cash		value = PG_GETARG_CASH(0);	char	   *result;	char		buf[CASH_BUFSZ];	int			minus = 0;	int			count = LAST_DIGIT;	int			point_pos;	int			ssymbol_position = 0;	int			points,				mon_group;	char		ssymbol;	const char *csymbol,			   *nsymbol;	char		dsymbol;	char		convention;	struct lconv *lconvert = PGLC_localeconv();	/* see comments about frac_digits in cash_in() */	points = lconvert->frac_digits;	if (points < 0 || points > 10)		points = 2;				/* best guess in this case, I think */	/*	 * As with frac_digits, must apply a range check to mon_grouping to avoid	 * being fooled by variant CHAR_MAX values.	 */	mon_group = *lconvert->mon_grouping;	if (mon_group <= 0 || mon_group > 6)		mon_group = 3;	convention = lconvert->n_sign_posn;	dsymbol = ((*lconvert->mon_decimal_point != '\0') ? *lconvert->mon_decimal_point : '.');	if (*lconvert->mon_thousands_sep != '\0')		ssymbol = *lconvert->mon_thousands_sep;	else		/* ssymbol should not equal dsymbol */		ssymbol = (dsymbol != ',') ? ',' : '.';	csymbol = ((*lconvert->currency_symbol != '\0') ? lconvert->currency_symbol : "$");	nsymbol = ((*lconvert->negative_sign != '\0') ? lconvert->negative_sign : "-");	point_pos = LAST_DIGIT - points;	point_pos -= (points - 1) / mon_group;	ssymbol_position = point_pos % (mon_group + 1);	/* we work with positive amounts and add the minus sign at the end */	if (value < 0)	{		minus = 1;		value = -value;	}	/* allow for trailing negative strings */	MemSet(buf, ' ', CASH_BUFSZ);	buf[TERMINATOR] = buf[LAST_PAREN] = '\0';	while (value || count > (point_pos - 2))	{		if (points && count == point_pos)			buf[count--] = dsymbol;		else if (ssymbol && count % (mon_group + 1) == ssymbol_position)			buf[count--] = ssymbol;		buf[count--] = ((uint64) value % 10) + '0';		value = ((uint64) value) / 10;	}	strncpy((buf + count - strlen(csymbol) + 1), csymbol, strlen(csymbol));	count -= strlen(csymbol) - 1;	/*	 *	If points == 0 and the number of digits % mon_group == 0,	 *	the code above adds a trailing ssymbol on the far right,	 *	so remove it.	 */	if (buf[LAST_DIGIT] == ssymbol)		buf[LAST_DIGIT] = '\0';	/* see if we need to signify negative amount */	if (minus)	{		result = palloc(CASH_BUFSZ + 2 - count + strlen(nsymbol));		/* Position code of 0 means use parens */		if (convention == 0)			sprintf(result, "(%s)", buf + count);		else if (convention == 2)			sprintf(result, "%s%s", buf + count, nsymbol);		else			sprintf(result, "%s%s", nsymbol, buf + count);	}	else	{		result = palloc(CASH_BUFSZ + 2 - count);		strcpy(result, buf + count);	}	PG_RETURN_CSTRING(result);}/* *		cash_recv			- converts external binary format to cash */Datumcash_recv(PG_FUNCTION_ARGS){	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);	PG_RETURN_CASH((Cash) pq_getmsgint64(buf));}/* *		cash_send			- converts cash to binary format */Datumcash_send(PG_FUNCTION_ARGS){	Cash		arg1 = PG_GETARG_CASH(0);	StringInfoData buf;	pq_begintypsend(&buf);	pq_sendint64(&buf, arg1);	PG_RETURN_BYTEA_P(pq_endtypsend(&buf));}/* * Comparison functions */Datumcash_eq(PG_FUNCTION_ARGS){	Cash		c1 = PG_GETARG_CASH(0);	Cash		c2 = PG_GETARG_CASH(1);	PG_RETURN_BOOL(c1 == c2);}Datumcash_ne(PG_FUNCTION_ARGS){	Cash		c1 = PG_GETARG_CASH(0);	Cash		c2 = PG_GETARG_CASH(1);	PG_RETURN_BOOL(c1 != c2);}Datumcash_lt(PG_FUNCTION_ARGS){	Cash		c1 = PG_GETARG_CASH(0);	Cash		c2 = PG_GETARG_CASH(1);	PG_RETURN_BOOL(c1 < c2);}Datumcash_le(PG_FUNCTION_ARGS){	Cash		c1 = PG_GETARG_CASH(0);	Cash		c2 = PG_GETARG_CASH(1);	PG_RETURN_BOOL(c1 <= c2);}Datumcash_gt(PG_FUNCTION_ARGS)

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲综合在线| 亚洲午夜精品在线| 91精品综合久久久久久| 久久99精品国产麻豆婷婷洗澡| 亚洲国产日韩精品| 1区2区3区国产精品| 国产欧美日韩三区| 欧美一区二区在线免费播放| 成人app软件下载大全免费| 国内精品写真在线观看| 日韩精品一卡二卡三卡四卡无卡| 中文字幕一区二区三区在线播放| 久久久蜜臀国产一区二区| 日韩欧美在线1卡| 91丝袜美腿高跟国产极品老师| 国产成人av电影在线观看| 久久99精品久久久久久动态图| 免费成人av在线| 免费在线成人网| 蜜桃视频一区二区三区在线观看 | 国产91精品精华液一区二区三区| 青娱乐精品在线视频| 亚洲一区二区免费视频| 亚洲九九爱视频| 亚洲精品乱码久久久久久久久 | 91精品国产综合久久香蕉的特点| 欧美性感一区二区三区| 国产成人免费av在线| 丁香婷婷综合色啪| 成人午夜伦理影院| 99精品视频在线观看免费| 99久久精品国产一区二区三区| 国产99久久久国产精品免费看| 国产成人精品免费在线| 福利一区二区在线观看| av高清久久久| 欧美吞精做爰啪啪高潮| 欧美色手机在线观看| 日本韩国一区二区三区| 欧美日韩一区二区三区视频| 6080午夜不卡| 久久亚洲一级片| 中文字幕一区二| 国产欧美一区二区精品仙草咪| 一区视频在线播放| 一区二区欧美视频| 日韩av在线发布| 国产福利一区二区| 91视频免费观看| 欧美丝袜自拍制服另类| 91精品国产入口在线| 久久免费偷拍视频| 亚洲天堂免费看| 日韩精品电影一区亚洲| 国产精品一线二线三线精华| thepron国产精品| 欧美人动与zoxxxx乱| 欧美成人福利视频| 中日韩免费视频中文字幕| 亚洲一二三四久久| 老司机午夜精品99久久| 成人激情免费视频| 欧美三级日韩在线| 26uuu精品一区二区三区四区在线| 亚洲欧洲精品天堂一级| 午夜久久电影网| 国产精品综合网| 在线欧美日韩精品| 久久久亚洲国产美女国产盗摄| 亚洲黄色录像片| 国精品**一区二区三区在线蜜桃| 成人中文字幕在线| 制服丝袜激情欧洲亚洲| 国产精品日日摸夜夜摸av| 一区二区三区av电影| 国产一区二区三区在线观看精品 | 欧美三级资源在线| 国产视频不卡一区| 日韩高清不卡在线| 91一区二区三区在线观看| 7777精品伊人久久久大香线蕉经典版下载| 26uuu成人网一区二区三区| 一区二区三区丝袜| 国产精品一区二区三区乱码| 欧美中文字幕一二三区视频| 日本一区二区高清| 美女视频免费一区| 欧美天堂一区二区三区| 国产精品久久久一本精品| 亚欧色一区w666天堂| 91视频www| 国产午夜精品一区二区三区视频 | 懂色av一区二区在线播放| 久久嫩草精品久久久精品| 视频在线观看一区| 91国产免费观看| 国产精品久久久久久久久免费丝袜| 免费在线观看精品| 欧美日本在线观看| 亚洲一二三级电影| www.欧美日韩国产在线| 7777女厕盗摄久久久| 亚洲高清免费观看| 91女厕偷拍女厕偷拍高清| 久久久久久久综合色一本| 久久国产精品露脸对白| 色狠狠一区二区三区香蕉| 国产精品乱码妇女bbbb| 国产乱码一区二区三区| 精品国产伦一区二区三区观看体验 | 4438x成人网最大色成网站| 一区二区三区欧美日韩| 色婷婷亚洲一区二区三区| 亚洲女同ⅹxx女同tv| 在线视频你懂得一区| 亚洲国产精品视频| 91麻豆精品国产91久久久久| 精品一区二区在线视频| 国产亚洲制服色| 99这里都是精品| 亚洲综合色成人| 欧美一区二区日韩| 国内精品不卡在线| 国产日韩欧美a| 一本色道久久综合亚洲91| 一区二区三区在线视频播放| 欧美裸体一区二区三区| 麻豆一区二区三| 国产欧美中文在线| 91极品视觉盛宴| 日韩成人免费在线| 久久精品亚洲乱码伦伦中文| bt欧美亚洲午夜电影天堂| 亚洲第一狼人社区| 久久综合999| 色综合久久中文综合久久97| 日韩不卡一二三区| 久久久不卡网国产精品二区| 色悠悠亚洲一区二区| 奇米一区二区三区av| 欧美激情一区二区三区不卡| 欧洲中文字幕精品| 精品一区二区三区视频| 亚洲图片你懂的| 久久这里只精品最新地址| 欧美精品黑人性xxxx| 精品免费日韩av| 麻豆视频一区二区| 日本一区二区三区国色天香| 欧洲另类一二三四区| 久久99精品国产麻豆婷婷洗澡| 国产精品国产三级国产普通话99| 在线观看亚洲成人| 国产精品一区二区男女羞羞无遮挡| **欧美大码日韩| 欧美成人一区二区三区在线观看| av在线不卡观看免费观看| 琪琪久久久久日韩精品| 最新国产精品久久精品| 精品国产一区久久| 色综合久久88色综合天天 | 国产激情精品久久久第一区二区 | 国产精品2024| 午夜精品一区二区三区三上悠亚 | 国产成人8x视频一区二区| 亚洲高清中文字幕| 国产亚洲精品aa午夜观看| 欧美人与性动xxxx| 99精品一区二区三区| 国产精品99久久久久久有的能看 | 国产高清久久久久| 亚洲一级二级在线| 亚洲欧洲精品一区二区精品久久久 | 国模无码大尺度一区二区三区| 亚洲在线免费播放| 欧美国产在线观看| 欧美电影免费提供在线观看| 欧美性极品少妇| 色综合一个色综合| 高清在线成人网| 精品无码三级在线观看视频| 亚洲国产wwwccc36天堂| **欧美大码日韩| 国产精品美女一区二区三区| 精品国产乱码久久| 欧美猛男gaygay网站| 日本久久一区二区三区| av午夜精品一区二区三区| 国产成人亚洲综合a∨猫咪 | 欧美v日韩v国产v| 7777精品伊人久久久大香线蕉| 一本一道久久a久久精品| 成人毛片老司机大片| 国产麻豆精品theporn| 蜜臀久久99精品久久久久久9 | 精品制服美女丁香| 人妖欧美一区二区| 日本aⅴ精品一区二区三区| 亚欧色一区w666天堂| 亚洲一区二区三区四区五区中文|