Change license to ASLv2
Group files and include headers in Xcode project

Tell CMake to place the source files in groups when generating an Xcode
project (this should also apply to visual studio projects as well).
Also, include the header files in the project, so they can be seen in
the file list within the IDE.
Report error if image size width fails

On non-Apple platforms, we don't currently have a way of determining the
width and height of an image, as we have not yet integrated a suitable
library. Add a parameter to DFPlatformGetImageDimensions which, where
this is not implemented, reports an error indicating the function is not
supported on the current platform.
dfutil: Move files out of scripting directory

The "scripting" directory was only there for historical reasons. In
older versions of the code, the first part of a .test file (up until the
first item) was interpreted as JavaScript code, using Apple's
JavascriptCore API. This was removed when porting to Linux, and now the
tests are identified by action name only. There's no longer any
scripting actually involved within individual .test files. so the
directory no longer makes sense.
Move string code from DFFilesytem.c to DFString.c

Move the following functions, which have nothing to do with filesystem
access, into DFString.c

DFFormatDouble
DFFormatDoublePct
DFFormatDoublePt
DFNormalizeWhitespace (now DFStringNormalizeWhitespace)

Background: DFFilesystem.c used to be called DFUtil.c and was a
catch-all places for functions that didn't fit anywhere else. When
renaming what used to be called "convertdoc" to "dfutil", the file was
renamed to avoid confusion between the two. The above functions were
still left in the file, but really belong in DFString.c.
Remove unnecessary DFFilesystem.h includes
Fix incorrect use of va_end

There were two cases in which we were calling va_end with a va_list
variable that was an original, not a copy. When two such calls were made
in succession on Windows, the second would fail as the pointer would no
longer be valid. This was not happening under OS X or Linux due to the
different way in which these platforms implement the stdarg macros.
Win32: Avoid __attribute__ in VC++

Visual C++ doesn't seem to support the __attribute__ declarations on
struct members or functions - at least not when compiling in C99 mode.

Define macros for the two that we use (struct member alignment and
function format string handling) and have these expand to nothing when
compiling with VC++.
Win32: Add macros for common functions like strdup

For some reason, Microsoft have an aversion to including functions like
strdup, open, read, write, and close that are part of the POSIX
standard, but still keep them present with a _ prefix.

This commit adds #defines for some of these functions so that we can
keep using the existing code without having to add all lots of ugly
underscores everywhere.
Win32: Work around bug in C99 parser

Visual Studio has a rather unfortunate bug in its parser which prevents
you from having variable declarations where the type name is a typedef
directly after an if statement without braces. For example, the
following will cause a parse error:

typedef struct Foo Foo;

...

if (x == 0)
    x = 1;

Foo *foo = ...

The solution to add braces around the if statement body, or (in the case
of a struct) to use 'struct Foo' instead of just 'Foo'.

There's quite a lot of code that will need to be changed to avoid this
bug; this commit just addresses the core functions in lib/*.c.
Win32: Adjust type casting to meet VC++ reqs

VC++ doesn't allow pointer arithmetic on void*. Instead, we cast to
char* so it does the arithmetic in terms of byte units.

This commit also fixes a few other places where char* needs to be cast
to void*, or vice-versa, as well as the integer types use for some
loops.
Win32: Don't use ({ ... }) in macros

This is a GCC/LLVM extension which VC++ doesn't support. Instead, for
the macros that compute a hash code, just omit the outer parentheses.
Win32: Disable warnings about insecure functions

Set the _CRT_SECURE_NO_WARNINGS macro so that VC++ doesn't complain
about commonly-used functions like open and vsnprintf that it considers
"unsafe". The alternatives it suggests are not available on Unix-based
platforms, and they're used extensively throughout the codebase.
Win32: Include windows.h (indirectly) in all files
Win32: Add DFErrorSetWin32

This should ultimately go in a platform-specific file, but has been put
in DFError.c for now as an easy temporary measure.
DFHashTableAddInt: Don't return a value

This function's return type is void; we shouldn't be trying to return a
value from it, and attempting to do so generates warnings from VC++.
Win32: DFContentsOfDirectory
Avoid xmlChar outside of DFXML.c

libxml2 defines the xmlChar type to be an unsigned char. It uses UTF-8
encoding for all strings, which is what we also use, but defines this
separate type to force the programmer to treat "normal" C strings
differently from UTF-8 strings.

For DocFormats, we work on the assumption that anything stored in a
char* is UTF-8. This is safe, because of the backwards-compatible design
of UTF-8, which encodes all non-ASCII characters using multi-byte
sequences with the top bit set. For all purposes other than accessing
specific non-ASCII characters, you can treat a UTF-8 string in the same
way as you would treat strings in a single-byte encoding. Thus there's
no need to make a distinction between "C strings" and UTF-8 strings.

The only circumstances in which this assumption would break if someone
were to use an encoding other than UTF-8 as input, e.g. from an XML
file. Any conversion from other character encodings to and from UTF-8
should be handled at the point of entry/exit of the data, so we can just
rely on one standard encoding in all other code (as libxml2 does).
Use DFCharIsHex in place of isHexChar

These two functions did exactly the same thing, so there is no need for
the latter.
Remove libxml include from DFDOM.h

Now the only file that uses libxml is DFXML.c; all the rest of the code
is entirely independent of it.