⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib.t

📁 操作系统设计与实现源码
💻 T
📖 第 1 页 / 共 5 页
字号:
02765	                        if (cmp_ext(&m, e) > 0 || cmp_ext(e, &oneminm) > 0) {02766	                                if (e->m1 && e->exp >= -1) *(p-1) += 1;02767	                                e->m1 = 0;02768	                                continue;02769	                        }02770	                        ten_mult(&m);02771	                        ten_mult(e);02772	                }02773	                else *p++ = '0';02774	        }02775	        if (pe >= buf) {02776	                p = pe;02777	                *p += 5;        /* round of at the end */02778	                while (*p > '9') {02779	                        *p = '0';02780	                        if (p > buf) ++*--p;02781	                        else {02782	                                *p = '1';02783	                                ++*decpt;02784	                                if (! ecvtflag) {02785	                                        /* maybe add another digit at the end,02786	                                           because the point was shifted right02787	                                        */02788	                                        if (pe > buf) *pe = '0';02789	                                        pe++;.Op 29 src/lib/ansi/ext_comp.c02790	                                }02791	                        }02792	                }02793	                *pe = '\0';02794	        }02795	        return buf;02796	}	02798	_dbl_ext_cvt(double value, struct EXTEND *e)02799	{02800	        /*      Convert double to extended02801	        */02802	        int exponent;02803	02804	        value = frexp(value, &exponent);02805	        e->sign = value < 0.0;02806	        if (e->sign) value = -value;02807	        e->exp = exponent - 1;02808	        value *= 4294967296.0;02809	        e->m1 = value;02810	        value -= e->m1;02811	        value *= 4294967296.0;02812	        e->m2 = value;02813	}	02815	static struct EXTEND max_d;02816	02817	double02818	_ext_dbl_cvt(struct EXTEND *e)02819	{02820	        /*      Convert extended to double02821	        */02822	        double f;02823	        int sign = e->sign;02824	02825	        e->sign = 0;02826	        if (e->m1 == 0 && e->m2 == 0) {02827	                return 0.0;02828	        }02829	        if (max_d.exp == 0) {02830	                _dbl_ext_cvt(DBL_MAX, &max_d);02831	        }02832	        if (cmp_ext(&max_d, e) < 0) {02833	                f = HUGE_VAL;02834	                errno = ERANGE;02835	        }02836	        else    f = ldexp((double)e->m1*4294967296.0 + (double)e->m2, e->exp-63);02837	        if (sign) f = -f;02838	        if (f == 0.0 && (e->m1 != 0 || e->m2 != 0)) {02839	                errno = ERANGE;02840	        }02841	        return f;02842	}.Ep 30 src/lib/ansi/getenv.c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/getenv.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++02900	/*02901	 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.02902	 * See the copyright notice in the ACK home directory, in the file "Copyright".02903	 */02904	/* $Header: getenv.c,v 1.4 91/04/24 12:18:03 ceriel Exp $ */02905	02906	#include        <stdlib.h>02907	02908	extern const char **_penvp;02909	02910	char *02911	getenv(const char *name)02912	{02913	        register const char **v = _penvp;02914	        register const char *p, *q;02915	02916	        if (v == NULL || name == NULL)02917	                return (char *)NULL;02918	        while ((p = *v++) != NULL) {02919	                q = name;02920	                while (*q && (*q == *p++))02921	                        q++;02922	                if (*q || (*p != '='))02923	                        continue;02924	                return (char *)p + 1;02925	        }02926	        return (char *)NULL;02927	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/gmtime.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03000	/*03001	 * gmtime - convert the calendar time into broken down time03002	 */03003	/* $Header: gmtime.c,v 1.4 91/04/22 13:20:27 ceriel Exp $ */03004	03005	#include        <time.h>03006	#include        <limits.h>03007	#include        "loc_time.h"03008	03009	struct tm *03010	gmtime(register const time_t *timer)03011	{03012	        static struct tm br_time;03013	        register struct tm *timep = &br_time;03014	        time_t time = *timer;03015	        register unsigned long dayclock, dayno;03016	        int year = EPOCH_YR;03017	03018	        dayclock = (unsigned long)time % SECS_DAY;03019	        dayno = (unsigned long)time / SECS_DAY;.Op 31 src/lib/ansi/gmtime.c03020	03021	        timep->tm_sec = dayclock % 60;03022	        timep->tm_min = (dayclock % 3600) / 60;03023	        timep->tm_hour = dayclock / 3600;03024	        timep->tm_wday = (dayno + 4) % 7;       /* day 0 was a thursday */03025	        while (dayno >= YEARSIZE(year)) {03026	                dayno -= YEARSIZE(year);03027	                year++;03028	        }03029	        timep->tm_year = year - YEAR0;03030	        timep->tm_yday = dayno;03031	        timep->tm_mon = 0;03032	        while (dayno >= _ytab[LEAPYEAR(year)][timep->tm_mon]) {03033	                dayno -= _ytab[LEAPYEAR(year)][timep->tm_mon];03034	                timep->tm_mon++;03035	        }03036	        timep->tm_mday = dayno + 1;03037	        timep->tm_isdst = 0;03038	03039	        return timep;03040	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isalnum.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03100	#include        <ctype.h>03101	03102	int (isalnum)(int c) {03103	        return isalnum(c);03104	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isalpha.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03200	#include        <ctype.h>03201	03202	int (isalpha)(int c) {03203	        return isalpha(c);03204	}.Ep 32 src/lib/ansi/isascii.c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isascii.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03300	#include        <ctype.h>03301	03302	int (isascii)(int c) {03303	        return isascii(c);03304	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/iscntrl.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03400	#include        <ctype.h>03401	03402	int (iscntrl)(int c) {03403	        return iscntrl(c);03404	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isdigit.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03500	#include        <ctype.h>03501	03502	int (isdigit)(int c) {03503	        return isdigit(c);03504	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isgraph.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03600	#include        <ctype.h>03601	03602	int (isgraph)(int c) {03603	        return isgraph(c);03604	}.Op 33 src/lib/ansi/islower.c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/islower.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03700	#include        <ctype.h>03701	03702	int (islower)(int c) {03703	        return islower(c);03704	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isprint.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03800	#include        <ctype.h>03801	03802	int (isprint)(int c) {03803	        return isprint(c);03804	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/ispunct.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++03900	#include        <ctype.h>03901	03902	int (ispunct)(int c) {03903	        return ispunct(c);03904	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isspace.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++04000	#include        <ctype.h>04001	04002	int (isspace)(int c) {04003	        return isspace(c);04004	}.Ep 34 src/lib/ansi/isupper.c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isupper.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++04100	#include        <ctype.h>04101	04102	int (isupper)(int c) {04103	        return isupper(c);04104	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/isxdigit.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++04200	#include        <ctype.h>04201	04202	int (isxdigit)(int c) {04203	        return isxdigit(c);04204	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/labs.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++04300	/*04301	 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.04302	 * See the copyright notice in the ACK home directory, in the file "Copyright".04303	 */04304	/* $Header: labs.c,v 1.1 89/05/16 13:08:11 eck Exp $ */04305	04306	#include        <stdlib.h>04307	04308	long04309	labs(register long l)04310	{04311	        return l >= 0 ? l : -l;04312	}.Op 35 src/lib/ansi/ldiv.c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/ldiv.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++04400	/*04401	 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.04402	 * See the copyright notice in the ACK home directory, in the file "Copyright".04403	 */04404	/* $Header: ldiv.c,v 1.3 90/03/05 13:48:03 eck Exp $ */04405	04406	#include        <stdlib.h>04407	04408	static long tmp = -1;04409	04410	ldiv_t04411	ldiv(register long numer, register long denom)04412	{04413	        ldiv_t r;04414	04415	        /* The assignment of tmp should not be optimized !! */04416	        if (tmp == -1) {04417	                tmp = (tmp / 2 == 0);04418	        }04419	        if (numer == 0) {04420	                r.quot = numer / denom;         /* might trap if denom == 0 */04421	                r.rem = numer % denom;04422	        } else if ( !tmp && ((numer < 0) != (denom < 0))) {04423	                r.quot = (numer / denom) + 1;04424	                r.rem = numer - (numer / denom + 1) * denom;04425	        } else {04426	                r.quot = numer / denom;04427	                r.rem = numer % denom;04428	        }04429	        return r;04430	}++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/ansi/localeconv.c	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++04500	/*04501	 * localeconv - set components of a struct according to current locale04502	 */04503	/* $Header: localeconv.c,v 1.2 89/12/18 15:48:58 eck Exp $ */04504	04505	#include        <limits.h>04506	#include        <locale.h>04507	04508	extern struct lconv _lc;04509	04510	struct lconv *04511	localeconv(void)04512	{04513	        register struct lconv *lcp = &_lc;04514	.Ep 36 src/lib/ansi/localeconv.c04515	        lcp->decimal_point = ".";04516	        lcp->thousands_sep = "";04517	        lcp->grouping =

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -