diff anagram/support/port.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anagram/support/port.h	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,68 @@
+/*
+ * 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 */