diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-05-09 15:44:04 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-05-09 15:44:04 +0000 |
commit | ef886df4c94e38d9fb62948e55928119931d8036 (patch) | |
tree | d49ac7933582aacc38e03ad2382a363c3ef1ab33 /src | |
parent | 4ca51b677a89a2f167ff55e1f7d72de8877dfa1d (diff) |
Added treatment for 3 fortran strings, just in case it is ever needed.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@522 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r-- | src/include/FortranString.h | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/src/include/FortranString.h b/src/include/FortranString.h index f401e981..a9081234 100644 --- a/src/include/FortranString.h +++ b/src/include/FortranString.h @@ -5,6 +5,12 @@ @desc Macros for dealing with strings passed from fortran to C. The memory for the new arguments created should be freed after use + + To ensure that passing strings from fortran to C has a chance of + working with all compilers, we assume that + + ** Strings are always at the end of the argument list ** + @enddesc @version $Header$ @@*/ @@ -12,6 +18,7 @@ #include "Misc.h" #if defined T3E + #include <fortran.h> #define ONE_FORTSTRING_ARG\ _fcd fcdarg @@ -25,7 +32,9 @@ int wl = _fcdlen(fcd_w);\ char *argn = CCTK_NullTerminateString(_fcdtocp(fcd_n),nl);\ char *argw = CCTK_NullTerminateString(_fcdtocp(fcd_w),wl); + #elif defined WIN32 + #define ONE_FORTSTRING_ARG\ char *n, unsigned int nl #define TWO_FORTSTRINGS_ARGS\ @@ -35,15 +44,39 @@ #define TWO_FORTSTRINGS_CREATE(argn,argw)\ char *argn = CCTK_NullTerminateString(n,nl);\ char *argw = CCTK_NullTerminateString(w,wl); + #else + #define ONE_FORTSTRING_ARG\ - char *n, unsigned int nl + const char *CCTK_str1,\ + unsigned int CCTK_len1 #define TWO_FORTSTRINGS_ARGS\ - const char *n, const char *w, int nl, int wl -#define ONE_FORTSTRING_CREATE(argn)\ - char *argn = CCTK_NullTerminateString(n,nl); -#define TWO_FORTSTRINGS_CREATE(argn,argw)\ - char *argn = CCTK_NullTerminateString(n,nl);\ - char *argw = CCTK_NullTerminateString(w,wl); + const char *CCTK_str1,\ + const char *CCTK_str2,\ + unsigned int CCTK_len1,\ + unsigned int CCTK_len2 +#define THREE_FORTSTRINGS_ARGS\ + const char *CCTK_str1,\ + const char *CCTK_str2,\ + const char *CCTK_str3,\ + unsigned int CCTK_len1,\ + unsigned int CCTK_len2,\ + unsigned int CCTK_len3 +#define ONE_FORTSTRING_CREATE(arg1)\ + char *arg1 = CCTK_NullTerminateString(CCTK_str1,CCTK_len1); +#define TWO_FORTSTRINGS_CREATE(arg1,arg2)\ + char *arg1 = CCTK_NullTerminateString(CCTK_str1,CCTK_len1);\ + char *arg2 = CCTK_NullTerminateString(CCTK_str2,CCTK_len2); +#define THREE_FORTSTRINGS_CREATE(arg1,arg2,arg3)\ + char *arg1 = CCTK_NullTerminateString(CCTK_str1,CCTK_len1);\ + char *arg2 = CCTK_NullTerminateString(CCTK_str2,CCTK_len2);\ + char *arg3 = CCTK_NullTerminateString(CCTK_str3,CCTK_len3); + #endif + + + + + + |