nulib2/nufxlib/Version.c

42 lines
1.1 KiB
C
Raw Normal View History

2000-05-23 01:55:31 +00:00
/*
* NuFX archive manipulation library
2007-02-19 23:12:22 +00:00
* Copyright (C) 2000-2007 by Andy McFadden, All Rights Reserved.
2000-05-23 01:55:31 +00:00
* This is free software; you can redistribute it and/or modify it under the
2007-02-19 23:12:22 +00:00
* terms of the BSD License, see the file COPYING-LIB.
2000-05-23 01:55:31 +00:00
*/
#include "NufxLibPriv.h"
2014-10-29 16:24:47 +00:00
/* executable was build on or after this date */
#ifdef __DATE__
static const char gNuBuildDate[] = __DATE__;
#else
2014-10-29 16:24:47 +00:00
static const char gNuBuildDate[] = "??? ?? ????";
#endif
2014-10-29 21:01:33 +00:00
#ifdef OPTFLAGSTR
2014-10-29 16:24:47 +00:00
static const char gNuBuildFlags[] = OPTFLAGSTR;
2014-10-29 21:01:33 +00:00
#else
static const char gNuBuildFlags[] = "-";
#endif
2000-05-23 01:55:31 +00:00
/*
* Return the version number, date built, and build flags.
*/
Distinguish Unicode and Mac OS Roman strings NufxLib has historically made no effort to distinguish between the character set used for filenames on the local disk, and for filenames stored within the archive. Now all Unicode filename strings use the UNICHAR type and have "UNI" in the name, and all Mac OS Roman strings have "MOR" in the name. (The naming convention makes it obvious when you're assigning the wrong thing; on Linux both formats are char*, so the compiler won't tell you if you get it wrong.) The distinction is necessary because filesystems generally support Unicode these days, but on Windows you need to use a separate set of wide-character file I/O functions. (On Linux it all works with "narrow" strings, and the UTF-8 encoding is interpreted by applications.) The character set used for NuFX archive filenames is MOR, matching what GS/OS + HFS supported, and we want to be able to convert back and forth between MOR and a Unicode representation. This change updates the various character types and string names, adds conversion functions, and updates NuLib2 for proper execution on Linux. It does not include the (probably extensive) changes required for Windows UTF-16 support. Instead, the conversion functions are no-ops, which should result in NuLib2 for Windows continuing to behave in the same slightly broken way. This adds "test-names", which exercises Unicode filenames a bit. It will not pass on Win32. Also, tweaked the Linux makefiles to have explicit dependencies, rather than empty space and an expectation that "makedepend" exists. Also, minor source code cleanups. While this probably doesn't affect binary compatibility -- it's mainly a matter of naming and string interpretation -- there's enough going on that it should be considered an API revision, so this updates the version to 3.0.0.
2014-12-24 19:14:32 +00:00
NuError Nu_GetVersion(int32_t* pMajorVersion, int32_t* pMinorVersion,
int32_t* pBugVersion, const char** ppBuildDate, const char** ppBuildFlags)
2000-05-23 01:55:31 +00:00
{
2014-12-22 02:17:23 +00:00
if (pMajorVersion != NULL)
*pMajorVersion = kNuVersionMajor;
2014-12-22 02:17:23 +00:00
if (pMinorVersion != NULL)
*pMinorVersion = kNuVersionMinor;
2014-12-22 02:17:23 +00:00
if (pBugVersion != NULL)
*pBugVersion = kNuVersionBug;
2014-12-22 02:17:23 +00:00
if (ppBuildDate != NULL)
*ppBuildDate = gNuBuildDate;
2014-12-22 02:17:23 +00:00
if (ppBuildFlags != NULL)
*ppBuildFlags = gNuBuildFlags;
return kNuErrNone;
2000-05-23 01:55:31 +00:00
}