aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2001-06-15 11:00:34 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2001-06-15 11:00:34 +0000
commit68d60d17cd97a0ad65943dbe4c4b9c7874635a4b (patch)
treefc415c1682289ad7266d375ca278ce3b16ca0ded /src/include
parent3507a744892ad991dd098f61cd534dd9f9954682 (diff)
Cactus standard include directory is src/include/
--> move these files here git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@18 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile10
-rw-r--r--src/include/stdc.h127
2 files changed, 137 insertions, 0 deletions
diff --git a/src/include/Makefile b/src/include/Makefile
new file mode 100644
index 0000000..6c5f2e8
--- /dev/null
+++ b/src/include/Makefile
@@ -0,0 +1,10 @@
+# Makefile to make symlinks to header files in other directories
+# $Id: Makefile,v 1.1 2001-06-15 11:00:34 jthorn Exp $
+
+.PHONY : default
+default :
+ test -e util++.hh || ln -s ../libutil/util++.hh .
+
+.PHONY : clean
+clean :
+ -rm util++.hh
diff --git a/src/include/stdc.h b/src/include/stdc.h
new file mode 100644
index 0000000..5505716
--- /dev/null
+++ b/src/include/stdc.h
@@ -0,0 +1,127 @@
+/* stdc.h -- JT standard C/C++ header file, cut-down for modern code only */
+/* $Id$ */
+
+/*
+ * ***** THIS VERSION IS FOR ANSI/ISO C AND C++ *****
+ */
+
+/* this header file is idempotent */
+#ifndef STDC_H_SEEN
+#define STDC_H_SEEN
+
+/******************************************************************************/
+
+/*
+ * C/C++ compatability:
+ */
+
+/* use this in prototypes like this: extern C_FUNCTION void foo(...) */
+#ifdef __cplusplus
+ #define C_FUNCTION "C"
+#else
+ #define C_FUNCTION /* empty */
+#endif
+
+/******************************************************************************/
+
+/*
+ * New C/C++ "keywords" and types:
+ */
+
+#define then /* empty */ /* usage: if (foo) then bar; else baz; */
+ /* this makes "then" and "else" symmetrical */
+
+/******************************************************************************/
+
+/*
+ * *** KLUDGE ***
+ *
+ * These macros suffer form the same "redefinition in system headers"
+ * as my MIN/MAX macros (below). The fix here is the same as for MIN/MAX,
+ * but this time conditional on linux:
+ */
+#ifndef FILENAME_MAX
+ #if defined(LINUX)
+ #define FILENAME_MAX 4095
+ #elif defined(ALPHA)
+ /* gcc already defines this */
+ #else /* other systems */
+ #define FILENAME_MAX BUFSIZ
+ #endif /* LINUX */
+#endif
+
+/* printf(3) and scanf(3) formats and cast-types to print/read a pointer */
+/* unfortunately, the ANSI/ISO C "%p" format isn't universal yet :-( */
+/* even more unfortunately, ANSI/ISO printf() need not support length, */
+/* precision, or indeed _any_ modifiers for the %p conversion */
+#ifdef HAS_ISO_C_LIBRARY
+#define PRINTF_POINTER_FORMAT "%p"
+#define PRINTF_POINTER_TYPE void *
+#define SCANF_POINTER_FORMAT "%p"
+#define PRINTF_POINTER_TYPE void *
+#else
+#define PRINTF_POINTER_FORMAT "0x%08x" /* for 32-bit pointers */
+#define PRINTF_POINTER_TYPE unsigned long
+#define SCANF_POINTER_FORMAT "0x%08x" /* for 32-bit pointers */
+#define PRINTF_POINTER_TYPE unsigned long
+#endif
+
+/******************************************************************************/
+
+#ifdef __cplusplus
+namespace jtutil {
+#endif
+
+/*
+ * All my error handling is done with my error_exit() routine. It
+ * prints an error message to stderr, then does an exit() or abort().
+ * It does *not* return to its caller. It's declared to return an
+ * int , however, so it may be easily used in conditional expressions
+ * like
+ * foo = bar_ok ? baz(bar) : error_exit(...);
+ */
+extern C_FUNCTION int error_exit(int exit_code, const char *format, ...)
+ #ifdef __GNUC__
+ __attribute__ ((noreturn))
+ __attribute__ ((format(printf,2,3)))
+ #endif
+;
+
+/*
+ * error_exit() uses the following exit() codes:
+ * OK_EXIT ==> everything's under control
+ * ERROR_EXIT ==> something bad has happened
+ * PANIC_EXIT ==> diasaster ==> force (eg) core dump, stack trace
+ */
+
+#ifdef VMS
+#define OK_EXIT 1
+#define ERROR_EXIT 3
+#define PANIC_EXIT (-1)
+#else
+#define OK_EXIT 0
+#define ERROR_EXIT 1
+#define PANIC_EXIT (-1)
+#endif
+
+#ifdef __cplusplus
+} /* close namespace jtutil */
+using jtutil::error_exit; /* bring error_exit() into global namespace */
+#endif
+
+/******************************************************************************/
+
+#define iabs abs /* C library uses abs() for integer absolute value */
+
+#define INT_SENTINAL_VALUE (~ INT_MAX) /* from <limits.h> */
+ /* usually 10...0 binary for */
+ /* a 2's complement system */
+#define FLOAT_SENTINAL_VALUE (- FLT_MAX) /* from <float.h> */
+#define DOUBLE_SENTINAL_VALUE (- DBL_MAX) /* from <float.h> */
+
+/* misc integer sentinal value */
+#define SENTINAL_VALUE INT_SENTINAL_VALUE
+
+/******************************************************************************/
+
+#endif /* STDC_H_SEEN */