]> pd.if.org Git - pdclib/blob - Readme.txt
Added v0.4 release date.
[pdclib] / Readme.txt
1 PDCLib - Public Domain C Library
2 ================================
3
4 License
5 -------
6
7 Permission is granted to use, modify, and / or redistribute at will.
8
9 This includes removing authorship notices, re-use of code parts in
10 other software (with or without giving credit), and / or creating a
11 commercial product based on it.
12
13 This software is provided as-is. Use it at your own risk. There is
14 no warranty whatsoever, neither expressed nor implied, and by using
15 this software you accept that the author(s) shall not be held liable
16 for any loss of data, loss of service, or other damages, be they
17 incidental or consequential. Your only option other than accepting
18 this is not to use the software at all.
19
20 A case for Public Domain
21 ------------------------
22
23 There was a time when you could just post a piece of code to usenet
24 and say, "I give it away for free; perhaps it's useful for you."
25
26 Then came the lawyers.
27
28 There are building blocks in software engineering that are so basic
29 that everyone should have free access to them without having to
30 employ a complete legal department for advice. They should be FREE.
31 Available for free, free of licensing implications, free of attached
32 propaganda, free of everything but their useful self.
33
34 Today, even the term "free" has to be defined by several paragraphs
35 of legal blah-blah.
36
37 Sick and tired of it, the author brought you this piece of software
38 under a "license" that should not be neccessary in the first place:
39 "Free" should have been enough.
40
41 What is it
42 ----------
43
44 This is a C Standard Library. Nothing more, nothing less. No POSIX
45 or other extensions, just what's defined in ISO/IEC 9899.
46
47 (Well, this is what it will be when the 1.0 release comes out. See
48 the "Development Status" section to see what's implemented so far.)
49
50 Internals
51 ---------
52
53 As a namespace convention, everything (files, typedefs, functions,
54 macros) not defined in ISO/IEC 9899 is prefixed with _PDCLIB_*.
55 As identifiers starting with '_' and a capital letter are reserved
56 for the implementation, and the chances of you compiler using an
57 identifier in the _PDCLIB_* range are slim, any strictly conforming
58 application should work with PDCLib.
59
60 PDCLib consists of several parts:
61
62 1) standard headers;
63 2) implementation files for standard functions;
64 3) internal header files keeping complex stuff out of the standard
65    headers;
66 4) the central, platform-specific file _PDCLIB_config.h;
67 5) optimization overlay implementation files (optional).
68
69 The standard headers only contain what they are defined to contain.
70 Where additional logic or macro magic is necessary, that is deferred
71 to the internal files. This has been done so that the headers are
72 actually educational as to what they provide (as opposed to how the
73 library does it).
74
75 There is a seperate implementation file for every function defined
76 by the standard, named {function}.c. Not only does this avoid linking
77 in huge amounts of unused code when you use but a single function,
78 it also allows the optimization overlay to work (see below).
79
80 Then there are internal header files, which contain all the "black
81 magic" and "code fu" that were kept out of the standard headers. You
82 should not have to touch them if you want to adapt PDCLib to a new
83 platform. If you do, note that the PDCLib author would consider it
84 a serious design flaw, and would be happy to fix it in the next PDCLib
85 release. Any adaption work should be covered by the config header
86 (and, possibly, the optimization overlay).
87
88 For adapting PDCLib to a new platform (the trinity of CPU, operating
89 system, and compiler), open _PDCLIB_config.h in your favourite text
90 editor, have a look at the comments, and modify it as appropriate for
91 your platform. That should be all that is actually required for such
92 an adaption (see previous paragraph).
93
94 Of course, your platform might provide more efficient replacements
95 for the generic implementations offered by PDCLib. The math functions
96 are an especially "juicy" target for optimization - while PDCLib does
97 provide generic implementations for each of them, there are usually
98 FPU opcodes that do the same job, only orders of magnitude faster. For
99 this, you might want to create an "optimization overlay" for PDCLib.
100
101 Optimization Overlay
102 --------------------
103
104 The idea is to provide a generic implementation that is useable even
105 on platforms the author never heard of - for example, the OS and/or
106 compiler *you* just wrote and now need a C library for. That is
107 actually what PDCLib was written for: To provide a C library for
108 compiler and OS builders that do not want the usual baggage of POSIX
109 and GNU extensions, licensing considerations etc. etc.
110
111 Thus, PDCLib provides generic implementations. They do work, and do
112 so correctly, but they are not very efficient when compared to hand-
113 crafted assembler or compiler build-ins. So the author wanted to
114 provide a means to modify PDCLib to run more efficiently on a given
115 platform, without cluttering the main branch with tons of #ifdef
116 statements and "featureset defines" that grow stale quickly.
117
118 The solution is the "optimization overlay". Every function has its
119 own implementation file, and _PDCLIB_config.h should be the only
120 header that must be modified. So, a platform-specific overlay is
121 copied over the main PDCLib branch - replacing _PDCLIB_config.h and
122 any number of implementation files - to create a PDCLib adapted /
123 optimized for the platform in question. That overlay could be part
124 of the PDCLib source tree (for established platforms where maintainers
125 won't bother with PDCLib), or part of that platform's source tree
126 (for under-development platforms PDCLib maintainers won't bother with).
127
128 So, to use PDCLib on your given platform, you unpack PDCLib (as you
129 obviously have done already since you are reading this), and copy
130 the overlay for your platform over the PDCLib source tree structure.
131
132 Development Status
133 ------------------
134
135 v0.1 - 2004-12-12
136 Freestanding-only C99 implementation without any overlay, and missing
137 the INTN_C() / UINTN_C() macros. <float.h> still has the enquire.c
138 values hardcoded into it; not sure whether to include enquire.c in the
139 package, to leave <float.h> to the overlay, or devise some parameterized
140 macro magic as for <limits.h> / <stdint.h>. Not thoroughly tested, but
141 I had to make the 0.1 release sometime so why not now.
142
143 v0.2 - 2005-01-12
144 Adds implementations for <string.h> (excluding strerror()), INTN_C() /
145 UINTN_C() macros, and some improvements in the internal headers.
146 Test drivers still missing, but added warnings about that.
147
148 v0.3 - 2005-11-21
149 Adds test drivers, fixes some bugs in <string.h>.
150
151 v0.4 - 2005-02-06
152 Implementations for parts of <stdlib.h>. Still missing are the floating
153 point conversions, and the wide-/multibyte-character functions.