comparison libcruft/misc/f77-fcn.h @ 11586:12df7854fa7c

strip trailing whitespace from source files
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:24:59 -0500
parents fd0a3ac60b0e
children 72c96de7a403
comparison
equal deleted inserted replaced
11585:1473d0cf86d2 11586:12df7854fa7c
100 100
101 /* Use these macros to write C-language functions that accept 101 /* Use these macros to write C-language functions that accept
102 Fortran-style character strings. */ 102 Fortran-style character strings. */
103 #define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s 103 #define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
104 #define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s 104 #define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
105 #define F77_CHAR_ARG_LEN_DEF(len) 105 #define F77_CHAR_ARG_LEN_DEF(len)
106 #define F77_CHAR_ARG_USE(s) s.ptr 106 #define F77_CHAR_ARG_USE(s) s.ptr
107 #define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len>>3) 107 #define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len>>3)
108 108
109 #define F77_RET_T int 109 #define F77_RET_T int
110 #define F77_RETURN(retval) return retval; 110 #define F77_RETURN(retval) return retval;
169 169
170 /* Use these macros to write C-language functions that accept 170 /* Use these macros to write C-language functions that accept
171 Fortran-style character strings. */ 171 Fortran-style character strings. */
172 #define F77_CHAR_ARG_DEF(s, len) char *s, int len 172 #define F77_CHAR_ARG_DEF(s, len) char *s, int len
173 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, int len 173 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, int len
174 #define F77_CHAR_ARG_LEN_DEF(len) 174 #define F77_CHAR_ARG_LEN_DEF(len)
175 #define F77_CHAR_ARG_USE(s) s 175 #define F77_CHAR_ARG_USE(s) s
176 #define F77_CHAR_ARG_LEN_USE(s, len) len 176 #define F77_CHAR_ARG_LEN_USE(s, len) len
177 177
178 #define F77_RET_T void 178 #define F77_RET_T void
179 #define F77_RETURN(retval) 179 #define F77_RETURN(retval)
207 #endif 207 #endif
208 208
209 209
210 /* Build a C string local variable CS from the Fortran string parameter S 210 /* Build a C string local variable CS from the Fortran string parameter S
211 declared as F77_CHAR_ARG_DEF(s, len) or F77_CONST_CHAR_ARG_DEF(s, len). 211 declared as F77_CHAR_ARG_DEF(s, len) or F77_CONST_CHAR_ARG_DEF(s, len).
212 The string will be cleaned up at the end of the current block. 212 The string will be cleaned up at the end of the current block.
213 Needs to include <cstring> and <vector>. */ 213 Needs to include <cstring> and <vector>. */
214 214
215 #define F77_CSTRING(s, len, cs) \ 215 #define F77_CSTRING(s, len, cs) \
216 OCTAVE_LOCAL_BUFFER (char, cs, F77_CHAR_ARG_LEN_USE (s, len) + 1); \ 216 OCTAVE_LOCAL_BUFFER (char, cs, F77_CHAR_ARG_LEN_USE (s, len) + 1); \
217 memcpy (cs, F77_CHAR_ARG_USE (s), F77_CHAR_ARG_LEN_USE (s, len)); \ 217 memcpy (cs, F77_CHAR_ARG_USE (s), F77_CHAR_ARG_LEN_USE (s, len)); \
218 cs[F77_CHAR_ARG_LEN_USE(s, len)] = '\0' 218 cs[F77_CHAR_ARG_LEN_USE(s, len)] = '\0'
219 219
220 220
221 extern CRUFT_API F77_RET_T 221 extern CRUFT_API F77_RET_T
222 F77_FUNC (xstopx, XSTOPX) (F77_CONST_CHAR_ARG_DECL 222 F77_FUNC (xstopx, XSTOPX) (F77_CONST_CHAR_ARG_DECL
223 F77_CHAR_ARG_LEN_DECL) GCC_ATTR_NORETURN; 223 F77_CHAR_ARG_LEN_DECL) GCC_ATTR_NORETURN;