COS0.0.1

所属分类:操作系统开发
开发工具:C/C++
文件大小:107KB
下载次数:410
上传日期:2006-08-06 18:32:14
上 传 者高扬
说明:  COS 0.0.1.rar Cos操作系统源代码
(0.0.1.rar Cos COS operating system source code)

文件列表:
license-psnprintf-0.4 (684, 2004-11-07)
Makefile (302, 2004-11-07)
News (93, 2004-11-15)
version.h (407, 2004-11-15)
doc\bget (17528, 2004-11-07)
doc\components (1658, 2004-11-07)
doc\file-system (1287, 2004-11-07)
doc\multiboot.tar.gz (18703, 2004-11-06)
doc (0, 2005-03-10)
include\ascii.h (5157, 2004-11-07)
include\bget.h (1016, 2004-11-07)
include\cos\block_dev.h (1810, 2004-11-07)
include\cos\debug.h (1511, 2004-11-07)
include\cos\gdt.h (2715, 2004-11-07)
include\cos\heap.h (1467, 2004-11-07)
include\cos\init.h (1280, 2004-11-07)
include\cos\int.h (2217, 2004-11-07)
include\cos\mem.h (1562, 2004-11-07)
include\cos\page.h (3179, 2004-11-07)
include\cos\string.h (2079, 2004-11-07)
include\cos\symbols.h (1149, 2004-11-07)
include\cos\sysinfo.h (2337, 2004-11-07)
include\cos\thread.h (2672, 2004-11-07)
include\cos\tss.h (2222, 2004-11-07)
include\cos\vtext.h (1286, 2004-11-07)
include\cos (0, 2005-03-10)
include\cosbase.h (2114, 2004-11-07)
include\multiboot.h (2662, 2004-11-07)
include\psnprintf.h (1478, 2004-11-07)
include\x86-asm.h (1639, 2004-11-07)
include (0, 2005-03-10)
kernel\bget.c (23587, 2004-11-07)
kernel\blockio.c (2221, 2004-11-07)
kernel\boot.s (4508, 2004-11-07)
kernel\debug.c (2416, 2004-11-07)
kernel\defs.inc (1817, 2004-11-07)
kernel\gdt.c (5289, 2004-11-07)
kernel\heap.c (4825, 2004-11-07)
kernel\idt.c (2662, 2004-11-07)
... ...

psnprintf A portable snprintf function ---------------------------- Contents of this file: 1. License 2. Brief Documentation 3. Unit tests 4. Benchmarking program 5. Known problems / TODO 6. Contact Details 7. Use of psnprintf in COS (Added by Paul Barker) 1. License ---------- This work free for commercial and non-commercial use alike. See license.txt for details. 2. Documentation ---------------- Copy psnprintf.cpp into your source directory and psnprintf into your header directory. In your source files: #include "psnprintf.h" The psnprintf function is defined as: int psnprintf(char *str, size_t n, const char *format, ...) str is your buffer n is the size of your buffer (including NULL) format is a printf style format string Return value is number of characters that would have been printed your buffer was large enough. If the size of your buffer >= the return value, the string was completely formatted into the buffer. Otherwise the buffer was completely filled, and the last byte is a terminating NULL. psnprintf does not quite conform to C99 specification as it ALWAYS terminates your buffer with a NULL, unless n is given as 0 (zero buffer size). 3. Unit tests ------------- The function is extensively tested with the unit test program provided in the test/ directory. See "test/build.txt" for information on how to build and run these unit tests on your platform. 4. Benchmarking --------------- A simple benchmarking program is provided in the test/ directory. It compares psnprintf's performance to your system's native sprintf and snprintf. In my experiences psnprintf almost always comes out equal or faster. See "test/build.txt" for information on how to build and run the benchmarking program on your platform. 5. Known Problems / TODO ------------------------ - Unit tests currently fail on Windows due to inconsitency in printf. On UNIX sprintf(buf, "%.0f", 0.0) gives "0.0", whereas on Windows it gives "0" (which is probably more correct). Currently psnpritnf follows the UNIX convention, though this might change. - Some unit tests fail on Linux due to inconsistency in printf. - Some unit tests fail on Solaris due to insconsistency in printf. - Floating point support not fully implemented. Format character 'f' is available but 'e', 'E', 'g' and 'G' will give no output unless the value is special (NaN or Infinity). - Both the numerical functions (double and integer) are quite messy due to various padding/alignment/precision options. Should look into this to clean it up a bit. - Unit testing code is UGLY and was written in a big hurry. Consists of way too many macros and is probably unnecessarily complicated. Demands a complete rewrite (perhaps not relying on system's sprintf?) 6. Contact Details ------------------ The author of the function is Alex Holkner. He can be reached at: alex@partiallydisassembled.net or aholkner@cs.rmit.edu.au 7. Use of psnprintf in COS (Added by Paul Barker) ------------------------------------------------- I have made some changes in order to use the psnprintf library in the COS kernel. See the source and header files for information: kernel/psnprintf.c include/psnprintf.h Also see the license at: license-psnprintf-0.4 This code is used as the backend to my TRACE(...) and *printk(...) functions. Many thanks to Alex Holkner! - Paul Barker (16/10/04)

近期下载者

相关文件


收藏者