view anagram/support/port.h @ 11:3aa0f5a02342

Remove unused variable; fix what it was supposed to be doing. (and document it a bit for the next time through here)
author David A. Holland
date Tue, 31 May 2022 00:54:12 -0400
parents 13d2b8934445
children
line wrap: on
line source

/*
 * AnaGram, A System for Syntax Directed Programming
 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
 * Copyright 2006 David A. Holland. All rights reserved.
 * See the file COPYING for license and usage terms.
 *
 * port.h - portability file
 */

#ifndef PORT_H
#define PORT_H

/*
 * OS issues
 * (note that a bunch of file-related issues are handled in file.h)
 */

#ifdef AG_ON_UNIX
#define stricmp strcasecmp
#define strnicmp strncasecmp
#define _MAX_PATH PATH_MAX

char *strlwr(char *string);
#endif

#ifdef AG_ON_WINDOWS
#define PATH_MAX _MAX_PATH
#endif

/*
 * Compiler issues
 */

#ifdef __GNUC__
#define PRINTFFY(a,b) __attribute__((__format__(__printf__, a, b)))
#else
#define PRINTFFY(a,b)
#endif

#ifdef __IBMCPP__
/* obsolete compiler, no snprintf */
int snprintf(char *, unsigned, const char *, ...) PRINTFFY(3,4);
#endif

/* this is some kind of function pointer weirdness, maybe dll-related */
#ifdef __IBMCPP__
#define OPTLINK _Optlink
#else
#define OPTLINK
#endif

/*
 * Nothing currently supported has a useful way to check for stack
 * overflow.
 */

//#define check_stack if (stackavail() < 0x100) bad_stack();
#define check_stack

/*
 * these are used by dict.cpp, stk.cpp, and tsd.cpp and it's not at all
 * clear why they're here, or where they should go. (XXX)
 */

#define MAX_BYTES 10000000U
#define MAX_INTS  10000000U

#endif /* PORT_H */