summaryrefslogtreecommitdiff
path: root/src/util/Table.c
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-10-13 18:07:49 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-10-13 18:07:49 +0000
commit4a909d77bb17007cfdd69ad7b991cbbd85555d9f (patch)
tree744767ab6d9fa891f33b8c78fa2e9c8df88321fe /src/util/Table.c
parent456924d5fd062dcc075121903fa0edf604cfc73d (diff)
Introduce the new Cactus variable type CCTK_INT1.
Extend routines to handle the new type. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3431 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/util/Table.c')
-rw-r--r--src/util/Table.c117
1 files changed, 110 insertions, 7 deletions
diff --git a/src/util/Table.c b/src/util/Table.c
index 535dbea9..1b9ab309 100644
--- a/src/util/Table.c
+++ b/src/util/Table.c
@@ -1994,7 +1994,7 @@ void CCTK_FCALL CCTK_FNAME (Util_TableGetGenericArray)
@vtype one of
CCTK_POINTER, CCTK_FPOINTER,
CCTK_CHAR,
- CCTK_INT, CCTK_INT2, CCTK_INT4, CCTK_INT8,
+ CCTK_INT, CCTK_INT1, CCTK_INT2, CCTK_INT4, CCTK_INT8,
CCTK_REAL, CCTK_REAL4, CCTK_REAL8, CCTK_REAL16,
CCTK_COMPLEX, CCTK_COMPLEX8, CCTK_COMPLEX16, CCTK_COMPLEX32
(not all of these may be supported on any given system)
@@ -2142,6 +2142,25 @@ void CCTK_FCALL CCTK_FNAME (Util_TableSetInt)
}
#endif /* !UTIL_TABLE_TEST */
+#ifdef CCTK_INTEGER_PRECISION_1
+int Util_TableSetInt1(int handle, CCTK_INT1 value, const char *key)
+{
+ return Util_TableSetInt1Array(handle, 1, &value, key);
+}
+
+void CCTK_FCALL CCTK_FNAME (Util_TableSetInt1)
+ (int *retval, const int *handle,
+ const CCTK_INT1 *value, ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (Util_TableSetInt1)
+ (int *retval, const int *handle,
+ const CCTK_INT1 *value, ONE_FORTSTRING_ARG)
+{
+ ONE_FORTSTRING_CREATE (key)
+ *retval = Util_TableSetInt1 (*handle, *value, key);
+ free (key);
+}
+#endif
+
#ifdef CCTK_INTEGER_PRECISION_2
int Util_TableSetInt2(int handle, CCTK_INT2 value, const char *key)
{
@@ -2407,7 +2426,7 @@ void CCTK_FCALL CCTK_FNAME (Util_TableSetComplex32)
@vtype const T[], where T is one of
CCTK_POINTER, CCTK_FPOINTER,
CCTK_CHAR,
- CCTK_INT, CCTK_INT2, CCTK_INT4, CCTK_INT8,
+ CCTK_INT, CCTK_INT1, CCTK_INT2, CCTK_INT4, CCTK_INT8,
CCTK_REAL, CCTK_REAL4, CCTK_REAL8, CCTK_REAL16,
CCTK_COMPLEX, CCTK_COMPLEX8, CCTK_COMPLEX16, CCTK_COMPLEX32
(not all of these may be supported on any given system)
@@ -2589,6 +2608,31 @@ void CCTK_FCALL CCTK_FNAME (Util_TableSetIntArray)
}
#endif /* !UTIL_TABLE_TEST */
+#ifdef CCTK_INTEGER_PRECISION_1
+int Util_TableSetInt1Array(int handle,
+ int N_elements, const CCTK_INT1 array[],
+ const char *key)
+{
+ return internal_set(handle,
+ CCTK_VARIABLE_INT1, N_elements, (const void *) array,
+ key);
+}
+
+void CCTK_FCALL CCTK_FNAME (Util_TableSetInt1Array)
+ (int *retval, const int *handle,
+ const int *N_elements,
+ const CCTK_INT1 array[], ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (Util_TableSetInt1Array)
+ (int *retval, const int *handle,
+ const int *N_elements,
+ const CCTK_INT1 array[], ONE_FORTSTRING_ARG)
+{
+ ONE_FORTSTRING_CREATE (key)
+ *retval = Util_TableSetInt1Array (*handle, *N_elements, array, key);
+ free (key);
+}
+#endif
+
#ifdef CCTK_INTEGER_PRECISION_2
int Util_TableSetInt2Array(int handle,
int N_elements, const CCTK_INT2 array[],
@@ -2915,7 +2959,7 @@ void CCTK_FCALL CCTK_FNAME (Util_TableSetComplex32Array)
@vtype T *, where T is one of
CCTK_POINTER, CCTK_FPOINTER,
CCTK_CHAR,
- CCTK_INT, CCTK_INT2, CCTK_INT4, CCTK_INT8,
+ CCTK_INT, CCTK_INT1, CCTK_INT2, CCTK_INT4, CCTK_INT8,
CCTK_REAL, CCTK_REAL4, CCTK_REAL8, CCTK_REAL16,
CCTK_COMPLEX, CCTK_COMPLEX8, CCTK_COMPLEX16, CCTK_COMPLEX32
(not all of these may be supported on any given system)
@@ -3085,6 +3129,28 @@ void CCTK_FCALL CCTK_FNAME (Util_TableGetInt)
}
#endif /* !UTIL_TABLE_TEST */
+#ifdef CCTK_INTEGER_PRECISION_1
+int Util_TableGetInt1(int handle, CCTK_INT1 *value, const char *key)
+{
+ const int status = Util_TableGetInt1Array(handle, 1, value, key);
+ return (status == 0)
+ ? UTIL_ERROR_TABLE_VALUE_IS_EMPTY
+ : status;
+}
+
+void CCTK_FCALL CCTK_FNAME (Util_TableGetInt1)
+ (int *retval, const int *handle,
+ CCTK_INT1 *value, ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (Util_TableGetInt1)
+ (int *retval, const int *handle,
+ CCTK_INT1 *value, ONE_FORTSTRING_ARG)
+{
+ ONE_FORTSTRING_CREATE (key)
+ *retval = Util_TableGetInt1 (*handle, value, key);
+ free (key);
+}
+#endif
+
#ifdef CCTK_INTEGER_PRECISION_2
int Util_TableGetInt2(int handle, CCTK_INT2 *value, const char *key)
{
@@ -3376,7 +3442,7 @@ void CCTK_FCALL CCTK_FNAME (Util_TableGetComplex32)
@vtype T[], where T is one of
CCTK_POINTER, CCTK_FPOINTER,
CCTK_CHAR,
- CCTK_INT, CCTK_INT2, CCTK_INT4, CCTK_INT8,
+ CCTK_INT, CCTK_INT1, CCTK_INT2, CCTK_INT4, CCTK_INT8,
CCTK_REAL, CCTK_REAL4, CCTK_REAL8, CCTK_REAL16,
CCTK_COMPLEX, CCTK_COMPLEX8, CCTK_COMPLEX16, CCTK_COMPLEX32
(not all of these may be supported on any given system)
@@ -3566,6 +3632,31 @@ void CCTK_FCALL CCTK_FNAME (Util_TableGetIntArray)
}
#endif /* !UTIL_TABLE_TEST */
+#ifdef CCTK_INTEGER_PRECISION_1
+int Util_TableGetInt1Array(int handle,
+ int N_elements, CCTK_INT1 array[],
+ const char *key)
+{
+ return internal_get(handle,
+ CCTK_VARIABLE_INT1, N_elements, (void *) array,
+ key);
+}
+
+void CCTK_FCALL CCTK_FNAME (Util_TableGetInt1Array)
+ (int *retval, const int *handle,
+ const int *N_elements, CCTK_INT1 array[],
+ ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (Util_TableGetInt1Array)
+ (int *retval, const int *handle,
+ const int *N_elements, CCTK_INT1 array[],
+ ONE_FORTSTRING_ARG)
+{
+ ONE_FORTSTRING_CREATE (key)
+ *retval = Util_TableGetInt1Array (*handle, *N_elements, array, key);
+ free (key);
+}
+#endif
+
#ifdef CCTK_INTEGER_PRECISION_2
int Util_TableGetInt2Array(int handle,
int N_elements, CCTK_INT2 array[],
@@ -4513,7 +4604,7 @@ int Util_TableItSetToKey(int ihandle, const char *key)
@vtype const T[], where T is one of
CCTK_POINTER, CCTK_FPOINTER,
CCTK_CHAR,
- CCTK_INT, CCTK_INT2, CCTK_INT4, CCTK_INT8,
+ CCTK_INT, CCTK_INT1, CCTK_INT2, CCTK_INT4, CCTK_INT8,
CCTK_REAL, CCTK_REAL4, CCTK_REAL8, CCTK_REAL16,
CCTK_COMPLEX, CCTK_COMPLEX8, CCTK_COMPLEX16, CCTK_COMPLEX32
(not all of these may be supported on any given system)
@@ -4628,7 +4719,7 @@ static
@vtype T[], where T is one of
CCTK_POINTER, CCTK_FPOINTER,
CCTK_CHAR,
- CCTK_INT, CCTK_INT2, CCTK_INT4, CCTK_INT8,
+ CCTK_INT, CCTK_INT1, CCTK_INT2, CCTK_INT4, CCTK_INT8,
CCTK_REAL, CCTK_REAL4, CCTK_REAL8, CCTK_REAL16,
CCTK_COMPLEX, CCTK_COMPLEX8, CCTK_COMPLEX16, CCTK_COMPLEX32
(not all of these may be supported on any given system)
@@ -4853,7 +4944,7 @@ static
@vtype const T[], where T is one of
CCTK_POINTER, CCTK_FPOINTER,
CCTK_CHAR,
- CCTK_INT, CCTK_INT2, CCTK_INT4, CCTK_INT8,
+ CCTK_INT, CCTK_INT1, CCTK_INT2, CCTK_INT4, CCTK_INT8,
CCTK_REAL, CCTK_REAL4, CCTK_REAL8, CCTK_REAL16,
CCTK_COMPLEX, CCTK_COMPLEX8, CCTK_COMPLEX16, CCTK_COMPLEX32
(not all of these may be supported on any given system)
@@ -5607,6 +5698,10 @@ static
/* integers */
CHECK_SET_GET_INT(handle, CCTK_INT, 0, case_insensitive,
Util_TableSetInt, Util_TableGetInt);
+ #ifdef CCTK_INTEGER_PRECISION_1
+ CHECK_SET_GET_INT(handle, CCTK_INT1, 1, case_insensitive,
+ Util_TableSetInt1, Util_TableGetInt1);
+ #endif
#ifdef CCTK_INTEGER_PRECISION_2
CHECK_SET_GET_INT(handle, CCTK_INT2, 1, case_insensitive,
Util_TableSetInt2, Util_TableGetInt2);
@@ -5627,6 +5722,10 @@ static
/* generic scalars which are actually integers */
CHECK_SET_GET_GENERIC_INT(handle, CCTK_VARIABLE_INT, CCTK_INT,
0, case_insensitive);
+ #ifdef CCTK_INTEGER_PRECISION_1
+ CHECK_SET_GET_GENERIC_INT(handle, CCTK_VARIABLE_INT1, CCTK_INT1,
+ 1, case_insensitive);
+ #endif
#ifdef CCTK_INTEGER_PRECISION_2
CHECK_SET_GET_GENERIC_INT(handle, CCTK_VARIABLE_INT2, CCTK_INT2,
1, case_insensitive);
@@ -5726,6 +5825,10 @@ static
Util_TableSetCharArray, Util_TableGetCharArray);
CHECK_SET_GET_INT_ARRAY(handle, CCTK_INT, 1,
Util_TableSetIntArray, Util_TableGetIntArray);
+ #ifdef CCTK_INTEGER_PRECISION_1
+ CHECK_SET_GET_INT_ARRAY(handle, CCTK_INT1, 1,
+ Util_TableSetInt1Array, Util_TableGetInt1Array);
+ #endif
#ifdef CCTK_INTEGER_PRECISION_2
CHECK_SET_GET_INT_ARRAY(handle, CCTK_INT2, 1,
Util_TableSetInt2Array, Util_TableGetInt2Array);