/***
*output.c - printf style output to a FILE
*
* Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the code that does all the work for the
* printf family of functions. It should not be called directly, only
* by the *printf functions. We don't make any assumtions about the
* sizes of ints, longs, shorts, or long doubles, but if types do overlap,
* we also try to be efficient. We do assume that pointers are the same
* size as either ints or longs.
* If CPRFLAG is defined, defines _cprintf instead.
* **** DOESN'T CURRENTLY DO MTHREAD LOCKING ****
*
*******************************************************************************/
#ifdef _WIN32
#if defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC)
#define DOUBLE double
#endif /* defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC) */
/* temporary work-around for compiler without 64-bit support */
#ifndef _INTEGRAL_MAX_BITS
#define _INTEGRAL_MAX_BITS 64
#endif /* _INTEGRAL_MAX_BITS */
#include <cruntime.h>
#include <limits.h>
#include <string.h>
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
#include <cvt.h>
#include <conio.h>
#include <internal.h>
#include <fltintrn.h>
#include <stdlib.h>
#include <ctype.h>
#include <dbgint.h>
/* inline keyword is non-ANSI C7 extension */
#if !defined (_MSC_VER) || defined (__STDC__)
#define __inline static
#else /* !defined (_MSC_VER) || defined (__STDC__) */
/* UNDONE: compiler is broken */
#define __inline static
#endif /* !defined (_MSC_VER) || defined (__STDC__) */
#ifdef _MBCS
#undef _MBCS
#endif /* _MBCS */
#include <tchar.h>
/* this macro defines a function which is private and as fast as possible: */
/* for example, in C 6.0, it might be static _fastcall <type> near. */
#define LOCAL(x) static x __cdecl
/* int/long/short/pointer sizes */
/* the following should be set depending on the sizes of various types */
#define LONG_IS_INT 1 /* 1 means long is same size as int */
#define SHORT_IS_INT 0 /* 1 means short is same size as int */
#define LONGDOUBLE_IS_DOUBLE 1 /* 1 means long double is same as double */
#define PTR_IS_INT 1 /* 1 means ptr is same size as int */
#define PTR_IS_LONG 1 /* 1 means ptr is same size as long */
#if LONG_IS_INT
#define get_long_arg(x) (long)get_int_arg(x)
#endif /* LONG_IS_INT */
#ifndef _UNICODE
#if SHORT_IS_INT
#define get_short_arg(x) (short)get_int_arg(x)
#endif /* SHORT_IS_INT */
#endif /* _UNICODE */
#if PTR_IS_INT
#define get_ptr_arg(x) (void *)get_int_arg(x)
#elif PTR_IS_LONG
#define get_ptr_arg(x) (void *)get_long_arg(x)
#else /* PTR_IS_LONG */
#error Size of pointer must be same as size of int or long
#endif /* PTR_IS_LONG */
/* CONSTANTS */
/* size of conversion buffer (ANSI-specified minimum is 509) */
#define BUFFERSIZE 512
#if BUFFERSIZE < CVTBUFSIZE
#error Conversion buffer too small for max double.
#endif /* BUFFERSIZE < CVTBUFSIZE */
/* flag definitions */
#define FL_SIGN 0x00001 /* put plus or minus in front */
#define FL_SIGNSP 0x00002 /* put space or minus in front */
#define FL_LEFT 0x00004 /* left justify */
#define FL_LEADZERO 0x00008 /* pad with leading zeros */
#define FL_LONG 0x00010 /* long value given */
#define FL_SHORT 0x00020 /* short value given */
#define FL_SIGNED 0x00040 /* signed data given */
#define FL_ALTERNATE 0x00080 /* alternate form requested */
#define FL_NEGATIVE 0x00100 /* value is negative */
#define FL_FORCEOCTAL 0x00200 /* force leading '0' for octals */
#define FL_LONGDOUBLE 0x00400 /* long double value given */
#define FL_WIDECHAR 0x00800 /* wide characters */
#define FL_I64 0x08000 /* __int64 value given */
/* state definitions */
enum STATE {
ST_NORMAL, /* normal state; outputting literal chars */
ST_PERCENT, /* just read '%' */
ST_FLAG, /* just read flag character */
ST_WIDTH, /* just read width specifier */
ST_DOT, /* just read '.' */
ST_PRECIS, /* just read precision specifier */
ST_SIZE, /* just read size specifier */
ST_TYPE /* just read type specifier */
};
#define NUMSTATES (ST_TYPE + 1)
/* character type values */
enum CHARTYPE {
CH_OTHER, /* character with no special meaning */
CH_PERCENT, /* '%' */
CH_DOT, /* '.' */
CH_STAR, /* '*' */
CH_ZERO, /* '0' */
CH_DIGIT, /* '1'..'9' */
CH_FLAG, /* ' ', '+', '-', '#' */
CH_SIZE, /* 'h', 'l', 'L', 'N', 'F', 'w' */
CH_TYPE /* type specifying character */
};
/* static data (read only, since we are re-entrant) */
#if defined (_UNICODE) || defined (CPRFLAG)
extern char *__nullstring; /* string to print on null ptr */
extern wchar_t *__wnullstring; /* string to print on null ptr */
#else /* defined (_UNICODE) || defined (CPRFLAG) */
char *__nullstring = "(null)"; /* string to print on null ptr */
wchar_t *__wnullstring = L"(null)";/* string to print on null ptr */
#endif /* defined (_UNICODE) || defined (CPRFLAG) */
/* The state table. This table is actually two tables combined into one. */
/* The lower nybble of each byte gives the character class of any */
/* character; while the uper nybble of the byte gives the next state */
/* to enter. See the macros below the table for details. */
/* */
/* The table is generated by maketabc.c -- use this program to make */
/* changes. */
#if defined (_UNICODE) || defined (CPRFLAG)
extern const char __lookuptable[];
#else /* defined (_UNICODE) || defined (CPRFLAG) */
/* Table generated by maketabc.c built with -D_WIN32_. Defines additional */
/* format code %Z for counted string. */
const char __lookuptable[] = {
0x06, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00,
0x10, 0x00, 0x03, 0x06, 0x00, 0x06, 0x02, 0x10,
0x04, 0x45, 0x45, 0x45, 0x05, 0x05, 0x05, 0x05,
0x05, 0x35, 0x30, 0x00, 0x50, 0x00, 0x00, 0x00,
0x00, 0x20, 0x28, 0x38, 0x50, 0x58, 0x07, 0x08,
0x00, 0x37, 0x30, 0x30, 0x57, 0x50, 0x07, 0x00,
0x00, 0x20, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00,
0x08, 0x60,
0x68, /* 'Z' (extension for NT development) */
0x60, 0x60, 0x60, 0x60, 0x00,
0x00, 0x70, 0x70, 0x78, 0x78, 0x78, 0x78, 0x08,
0x07, 0x08, 0x00, 0x00, 0x07, 0x00, 0x08, 0x08,
0x08, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00,
0x07, /* 'w' (extension for NT development) */
0x08
};
#endif /* defined (_UNICODE) || defined (CPRFLAG) */
#define find_char_class(c) \
((c) < _T(' ') || (c) > _T('x') ? \
CH_OTHER \
: \
__lookuptable[(c)-_T(' ')] & 0xF)
#define find_next_state(class, state) \
(__lookuptable[(class) * NUMSTATES + (state)] >> 4)
/*
* Note: CPRFLAG and _UNICODE cases are currently mutually exclusive.
*/
/* prototypes */
#ifdef CPRFLAG
#define WRITE_CHAR(ch, pnw) write_char(ch, pnw)
#define WRITE_MULTI_CHAR(ch, num, pnw) write_multi_char(ch, num, pnw)
#define WRITE_STRING(s, len, pnw) write_string(s, len, pnw)
#define WRITE_WSTRING(s, len, pnw) write_wstring(s, len, pnw)
LOCAL(void) write_char(int ch, int *pnumwritten);
LOCAL(void) write_multi_char(int ch, int num, int *pnumwritten);
LOCAL(void) write_string(char *string, int len
没有合适的资源?快使用搜索试试~ 我知道了~
C语言标准库函数的源代码
共1266个文件
c:559个
obj:412个
h:85个
需积分: 30 83 下载量 75 浏览量
2008-06-01
18:49:16
上传
评论
收藏 1.67MB RAR 举报
温馨提示
收录了大多数库函数源代码
资源推荐
资源详情
资源评论
收起资源包目录
C语言标准库函数的源代码 (1266个子文件)
ALGRITHM 46KB
MEMCPY.ASM 22KB
STRNCPY.ASM 7KB
STRNCAT.ASM 7KB
STRSPN.ASM 7KB
STRNICMP.ASM 7KB
LLREM.ASM 7KB
MEMICMP.ASM 7KB
LLDIV.ASM 7KB
STRCAT.ASM 6KB
STRCHR.ASM 6KB
STRICMP.ASM 6KB
MEMCMP.ASM 5KB
ULLREM.ASM 5KB
ULLDIV.ASM 5KB
MEMCHR.ASM 5KB
STRSTR.ASM 5KB
MEMCCPY.ASM 4KB
STRCMP.ASM 4KB
MEMSET.ASM 4KB
CHKSTK.ASM 3KB
STRREV.ASM 3KB
STRNCMP.ASM 3KB
STRLEN.ASM 3KB
STRRCHR.ASM 3KB
LLMUL.ASM 2KB
STRNSET.ASM 2KB
STRSET.ASM 2KB
LLSHR.ASM 2KB
ULLSHR.ASM 1KB
OUTP.ASM 1KB
LLSHL.ASM 1KB
INP.ASM 1KB
DLLSUPP.ASM 1KB
ENABLE.ASM 978B
MBSCAT.ASM 527B
STRCSPN.ASM 488B
MEMMOVE.ASM 486B
STRPBRK.ASM 458B
BLDWIN95.BAT 1KB
BITSET 7KB
OUTPUT.C 85KB
INPUT.C 71KB
DBGHEAP.C 57KB
SBHEAP.C 50KB
GETQLOC.C 36KB
STRFTIME.C 32KB
TZSET.C 29KB
DBGRPT.C 29KB
CRT0DAT.C 27KB
MBCTYPE.C 27KB
OPEN.C 26KB
WINSIG.C 22KB
GETCH.C 22KB
HEAPGROW.C 19KB
OSFINFO.C 18KB
POPEN.C 18KB
REALLOC.C 17KB
SETLOCAL.C 17KB
HEAPINIT.C 16KB
TMPFILE.C 16KB
STAT.C 16KB
ONEXIT.C 15KB
FFLUSH.C 15KB
TEMPNAM.C 14KB
WINXFLTR.C 14KB
MTLOCK.C 14KB
CRTEXE.C 13KB
PUTENV.C 13KB
CRTLIB.C 13KB
FSTAT.C 12KB
CRTDLL.C 12KB
HEAPMIN.C 12KB
STDARGV.C 12KB
HEAPADD.C 12KB
TOMBBMBC.C 12KB
READ.C 12KB
CRT0.C 12KB
_OPEN.C 12KB
DOSMAP.C 11KB
IOINIT.C 11KB
ASSERT.C 11KB
SETENV.C 11KB
_FLSBUF.C 11KB
DLLCRT0.C 10KB
WILD.C 10KB
SPAWNVE.C 10KB
WRITE.C 10KB
INITTIME.C 10KB
CENVARG.C 10KB
XMBTOWC.C 10KB
GETCWD.C 10KB
QSORT.C 10KB
A_MAP.C 10KB
RENAME.C 9KB
W_MAP.C 9KB
A_CMP.C 9KB
MKTIME.C 9KB
_FILE.C 9KB
UTIME.C 9KB
共 1266 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
ayboy_lp
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功