nulib2/nufxlib/samples/Common.h

67 lines
1.3 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
*
2003-02-23 23:46:47 +00:00
* Common functions for NuLib tests.
2000-05-23 01:55:31 +00:00
*/
#ifndef __Common__
#define __Common__
#include "SysDefs.h" /* might as well draft off the autoconf */
2000-05-23 01:55:31 +00:00
#include "NufxLib.h"
#ifdef USE_DMALLOC
# include "dmalloc.h"
#endif
#define NELEM(x) (sizeof(x) / sizeof((x)[0]))
#ifndef __cplusplus
#define false 0
#define true (!false)
2000-05-23 01:55:31 +00:00
#endif
#ifdef FOPEN_WANTS_B
# define kNuFileOpenReadOnly "rb"
# define kNuFileOpenReadWrite "r+b"
# define kNuFileOpenWriteTrunc "wb"
# define kNuFileOpenReadWriteCreat "w+b"
2000-05-23 01:55:31 +00:00
#else
# define kNuFileOpenReadOnly "r"
# define kNuFileOpenReadWrite "r+"
# define kNuFileOpenWriteTrunc "w"
# define kNuFileOpenReadWriteCreat "w+"
2000-05-23 01:55:31 +00:00
#endif
/*
* Figure out what path separator to use.
2003-02-08 22:43:24 +00:00
*
* NOTE: recent versions of Win32 will also accept '/'.
2000-05-23 01:55:31 +00:00
*/
#ifdef MSDOS
# define PATH_SEP '\\'
2000-05-23 01:55:31 +00:00
#endif
#ifdef WIN32
# define PATH_SEP '\\'
2000-05-23 01:55:31 +00:00
#endif
#ifdef MACOS
# define PATH_SEP ':'
2000-05-23 01:55:31 +00:00
#endif
#if defined(APW) || defined(__ORCAC__)
# define PATH_SEP ':'
2000-05-23 01:55:31 +00:00
#endif
#ifndef PATH_SEP
# define PATH_SEP '/'
2000-05-23 01:55:31 +00:00
#endif
#endif /*__Common__*/