资源简介
操作系统 课程设计 geekos project0 内含使用说明,希望对大家有帮助。
代码片段和文件信息
/*
* This code was originally part of klibc-0.103.
* It was adapted by David Hovemeyer
* for use in GeekOS (http://geekos.sourceforge.net).
*
* For information/source for klibc visit
* http://www.kernel.org/pub/linux/libs/klibc/
* http://www.zytor.com/mailman/listinfo/klibc/
* http://www.zytor.com/cvsweb.cgi/klibc/
*
* Modifications are marked with “DHH“.
* Summary of modifications:
*
* 1. Use struct Output_Sink to emit formatted output rather than a
* character buffer to allow output polymorphism.
*
* 2. Buffer generated numbers so that all output is generated in order.
*
* 3. Don‘t use long long types: unsigned long is largest
* supported type. Arithmetic on 64 bit types requires runtime support
* (at least on x86).
*
* See the file LICENSE-klibc for license information.
*/
/*
* vsnprintf.c
*
* vsnprintf() from which the rest of the printf()
* family is built
*/
#include
#include
#include
#include
#include /* DHH: for struct Output_Sink */
/*
* DHH: Hack long long arithmetic requires runtime support.
* Use unsigned long as greatest unsigned integer supported.
*/
typedef long intmax_t;
typedef unsigned long uintmax_t;
typedef unsigned long uintptr_t;
/* DHH */
#define ASSERT(exp) \
do { if (!(exp)) while(1); } while (0)
enum flags {
FL_ZERO = 0x01 /* Zero modifier */
FL_MINUS = 0x02 /* Minus modifier */
FL_PLUS = 0x04 /* Plus modifier */
FL_TICK = 0x08 /* ‘ modifier */
FL_SPACE = 0x10 /* Space modifier */
FL_HASH = 0x20 /* # modifier */
FL_SIGNED = 0x40 /* Number is signed */
FL_UPPER = 0x80 /* Upper case digits */
};
/* These may have to be adjusted on certain implementations */
enum ranks {
rank_char = -2
rank_short = -1
rank_int = 0
rank_long = 1
#if 0
rank_longlong = 2
#endif
};
#define MIN_RANK rank_char
#define MAX_RANK rank_long
#define INTMAX_RANK rank_long
#define SIZE_T_RANK rank_long
#define PTRDIFF_T_RANK rank_long
/* DHH */
#define EMIT(x) do { (q)->Emit((q) (x)); } while (0)
/*
* DHH - As a hack we buffer this many digits when generating
* a number. Because this code originally was an implementation
* of vnsprintf() it generated some digits backwards in a buffer.
* Obviously we can‘t do this when emitting output directly
* to the console or a file. So we buffer the generated digits
* and then emit them in order.
*
* This value should be adequate to emit values up to 2^32-1 in
* bases 2 or greater including tick marks.
*/
#define NDIGITS_MAX 43
static size_t
format_int(struct Output_Sink *q uintmax_t val enum flags flags
int base int width int prec)
{
char *qq;
size_t o = 0 oo;
static const char lcdigits[] = “0123456789abcdef“;
static const char ucdigits[] = “0123456789ABCDEF“;
const char *digits;
uintmax_t tmpval;
int minus = 0;
int ndigits = 0 nchars;
int tickskip b4tick;
char
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-05 15:02 project0\
目录 0 2018-01-05 14:57 project0\project0\
文件 1159 2005-04-13 00:00 project0\project0\COPYING
文件 3745 2005-04-13 00:00 project0\project0\LICENSE-klibc
目录 0 2018-01-05 14:57 project0\project0\build\
文件 873 2017-12-02 09:11 project0\project0\build\.bochsrc
文件 871 2017-11-16 22:13 project0\project0\build\.bochsrc~
文件 7870 2005-04-13 00:00 project0\project0\build\Makefile
文件 11481 2018-01-02 20:33 project0\project0\build\bochs.out
目录 0 2018-01-05 14:57 project0\project0\build\common\
文件 60 2005-04-13 00:00 project0\project0\build\common\.ignore
文件 4416 2017-11-16 22:23 project0\project0\build\common\fmtout.o
文件 852 2017-11-16 22:23 project0\project0\build\common\memmove.o
文件 2156 2017-11-16 22:23 project0\project0\build\common\string.o
文件 7143 2017-11-14 12:50 project0\project0\build\depend.mak
文件 44544 2017-11-16 22:23 project0\project0\build\fd.img
目录 0 2018-01-05 14:57 project0\project0\build\geekos\
文件 60 2005-04-13 00:00 project0\project0\build\geekos\.ignore
文件 9400 2017-11-16 22:23 project0\project0\build\geekos\bget.o
文件 3724 2017-11-16 22:23 project0\project0\build\geekos\crc32.o
文件 512 2017-11-16 22:23 project0\project0\build\geekos\fd_boot.bin
文件 7852 2017-11-16 22:23 project0\project0\build\geekos\gdt.o
文件 6172 2017-11-16 22:23 project0\project0\build\geekos\idt.o
文件 5840 2017-11-16 22:23 project0\project0\build\geekos\int.o
文件 3060 2017-11-16 22:23 project0\project0\build\geekos\io.o
文件 7660 2017-11-16 22:23 project0\project0\build\geekos\irq.o
文件 43520 2017-11-16 22:23 project0\project0\build\geekos\kernel.bin
文件 105963 2017-11-16 22:23 project0\project0\build\geekos\kernel.exe
文件 7140 2017-11-16 22:23 project0\project0\build\geekos\kernel.syms
文件 10476 2017-11-16 22:23 project0\project0\build\geekos\keyboard.o
文件 31052 2017-11-16 22:23 project0\project0\build\geekos\kthread.o
............此处省略102个文件信息
评论
共有 条评论