设为首页 加入收藏

TOP

C语言学习趣事_MSCRT_IO_SourceFile (二)
2014-11-24 00:40:18 来源: 作者: 【 】 浏览:250
Tags:语言学习 趣事 _MSCRT_IO_SourceFile

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

/* inline keyword is non-ANSI C7 extension */
/* CONSIDER: move to cruntime.h! */
#if !defined(_MSC_VER) || defined(__STDC__)
#define __inline static
#else
/* UNDONE: compiler is broken */
#define __inline static
#endif

#if defined(WPRFLAG) && !defined(_UNICODE)
#define _UNICODE 1
#endif
#ifdef _MBCS /* always want either Unicode or SBCS for tchar.h */
#undef _MBCS
#endif
#include

/* this macro defines a function which is private and as fast as possible: */
/* for example, in C 6.0, it might be static _fastcall near. */
#define LOCAL(x) static x _CALLTYPE4

/* 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

#ifndef WPRFLAG
#if SHORT_IS_INT
#define get_short_arg(x) (short)get_int_arg(x)
#endif
#endif

#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
#error Size of pointer must be same as size of int or long
#endif



/* 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

/* flag definitions */
#define FL_SIGN 0x0001 /* put plus or minus in front */
#define FL_SIGNSP 0x0002 /* put space or minus in front */
#define FL_LEFT 0x0004 /* left justify */
#define FL_LEADZERO 0x0008 /* pad with leading zeros */
#define FL_LONG 0x0010 /* long value given */
#define FL_SHORT 0x0020 /* short value given */
#define FL_SIGNED 0x0040 /* signed data given */
#define FL_ALTERNATE 0x0080 /* alternate form requested */
#define FL_NEGATIVE 0x0100 /* value is negative */
#define FL_FORCEOCTAL 0x0200 /* force leading '0' for octals */
#define FL_LONGDOUBLE 0x0400 /* long double value given */
#define FL_WIDECHAR 0x0800 /* wide characters */

/* 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(WPRFLAG) || defined(CPRFLAG)
extern ch
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/12/12
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇STL 应用之set 下一篇快速计算32位数中1的位数

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: