annotate libcruft/misc/f77-fcn.h @ 9930:1ddc25c3623a

libcruft/misc: untabify sources
author John W. Eaton <jwe@octave.org>
date Mon, 07 Dec 2009 13:17:13 -0500
parents eb63fbe60fab
children ac4b97c6bf8b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
1 /*
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
2
9930
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
3 Copyright (C) 1996, 1997, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4 John W. Eaton
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
5
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
7
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6253
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6253
diff changeset
11 option) any later version.
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
12
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
16 for more details.
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
17
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6253
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6253
diff changeset
20 <http://www.gnu.org/licenses/>.
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
21
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
22 */
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
23
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
24 #if !defined (octave_f77_fcn_h)
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
25 #define octave_f77_fcn_h 1
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
26
4268
363d406ec86c [project @ 2003-01-03 15:55:01 by jwe]
jwe
parents: 4182
diff changeset
27 #include "quit.h"
363d406ec86c [project @ 2003-01-03 15:55:01 by jwe]
jwe
parents: 4182
diff changeset
28
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
29 #ifdef __cplusplus
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
30 extern "C" {
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
31 #endif
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
32
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
33 /* Hack to stringize macro results. */
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents: 2847
diff changeset
34 #define xSTRINGIZE(x) #x
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents: 2847
diff changeset
35 #define STRINGIZE(x) xSTRINGIZE(x)
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
36
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
37 /* How to print an error for the F77_XFCN macro. */
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
38
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
39 #define F77_XFCN_ERROR(f, F) \
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
40 (*current_liboctave_error_handler) \
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents: 2847
diff changeset
41 ("exception encountered in Fortran subroutine %s", \
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents: 2847
diff changeset
42 STRINGIZE (F77_FUNC (f, F)))
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
43
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
44 /* This can be used to call a Fortran subroutine that might call
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
45 XSTOPX. XSTOPX will call lonjmp with current_context. Once back
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
46 here, we'll restore the previous context and return. We may also
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
47 end up here if an interrupt is processed when the Fortran
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
48 subroutine is called. In that case, we resotre the context and go
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
49 to the top level. The error_state should be checked immediately
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
50 after this macro is used. */
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
51
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
52 #define F77_XFCN(f, F, args) \
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
53 do \
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
54 { \
4182
4d1d7c51205c [project @ 2002-11-15 20:33:47 by jwe]
jwe
parents: 4180
diff changeset
55 octave_jmp_buf saved_context; \
5767
26f92fb8ba33 [project @ 2006-04-18 15:28:34 by jwe]
jwe
parents: 5760
diff changeset
56 sig_atomic_t saved_octave_interrupt_immediately = octave_interrupt_immediately; \
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
57 f77_exception_encountered = 0; \
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5701
diff changeset
58 octave_save_current_context (saved_context); \
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
59 if (octave_set_current_context) \
9930
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
60 { \
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
61 octave_interrupt_immediately = saved_octave_interrupt_immediately; \
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5701
diff changeset
62 octave_restore_current_context (saved_context); \
9930
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
63 if (f77_exception_encountered) \
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
64 F77_XFCN_ERROR (f, F); \
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
65 else \
9930
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
66 octave_rethrow_exception (); \
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
67 } \
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
68 else \
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
69 { \
9930
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
70 octave_interrupt_immediately++; \
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
71 F77_FUNC (f, F) args; \
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
72 octave_interrupt_immediately--; \
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5701
diff changeset
73 octave_restore_current_context (saved_context); \
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3950
diff changeset
74 } \
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
75 } \
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
76 while (0)
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
77
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
78 /* So we can check to see if an exception has occurred. */
6107
6465ca8e4f0c [project @ 2006-10-26 22:00:12 by jwe]
jwe
parents: 6072
diff changeset
79 CRUFT_API extern int f77_exception_encountered;
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
80
3938
028eb74026bc [project @ 2002-05-16 16:15:42 by jwe]
jwe
parents: 3887
diff changeset
81 #if !defined (F77_FCN)
028eb74026bc [project @ 2002-05-16 16:15:42 by jwe]
jwe
parents: 3887
diff changeset
82 #define F77_FCN(f, F) F77_FUNC (f, F)
028eb74026bc [project @ 2002-05-16 16:15:42 by jwe]
jwe
parents: 3887
diff changeset
83 #endif
028eb74026bc [project @ 2002-05-16 16:15:42 by jwe]
jwe
parents: 3887
diff changeset
84
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
85 #if defined (F77_USES_CRAY_CALLING_CONVENTION)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
86
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
87 #include <fortran.h>
6072
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
88
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
89 /* Use these macros to pass character strings from C to Fortran. */
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
90 #define F77_CHAR_ARG(x) octave_make_cray_ftn_ch_dsc (x, strlen (x))
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
91 #define F77_CONST_CHAR_ARG(x) \
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
92 octave_make_cray_const_ftn_ch_dsc (x, strlen (x))
4577
233512ebf15d [project @ 2003-10-31 06:31:14 by jwe]
jwe
parents: 4572
diff changeset
93 #define F77_CHAR_ARG2(x, l) octave_make_cray_ftn_ch_dsc (x, l)
233512ebf15d [project @ 2003-10-31 06:31:14 by jwe]
jwe
parents: 4572
diff changeset
94 #define F77_CONST_CHAR_ARG2(x, l) octave_make_cray_const_ftn_ch_dsc (x, l)
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
95 #define F77_CXX_STRING_ARG(x) \
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
96 octave_make_cray_const_ftn_ch_dsc (x.c_str (), x.length ())
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
97 #define F77_CHAR_ARG_LEN(l)
4577
233512ebf15d [project @ 2003-10-31 06:31:14 by jwe]
jwe
parents: 4572
diff changeset
98 #define F77_CHAR_ARG_DECL octave_cray_ftn_ch_dsc
233512ebf15d [project @ 2003-10-31 06:31:14 by jwe]
jwe
parents: 4572
diff changeset
99 #define F77_CONST_CHAR_ARG_DECL octave_cray_ftn_ch_dsc
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
100 #define F77_CHAR_ARG_LEN_DECL
6072
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
101
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
102 /* Use these macros to write C-language functions that accept
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
103 Fortran-style character strings. */
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
104 #define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
105 #define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
106 #define F77_CHAR_ARG_LEN_DEF(len)
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
107 #define F77_CHAR_ARG_USE(s) s.ptr
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
108 #define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len>>3)
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
109
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
110 #define F77_RET_T int
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
111 #define F77_RETURN(retval) return retval;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
112
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5767
diff changeset
113 /* FIXME -- these should work for SV1 or Y-MP systems but will
4572
4623ef02a605 [project @ 2003-10-31 03:07:05 by jwe]
jwe
parents: 4558
diff changeset
114 need to be changed for others. */
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
115
4558
239df9c618ef [project @ 2003-10-28 18:48:07 by jwe]
jwe
parents: 4555
diff changeset
116 typedef union
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
117 {
4558
239df9c618ef [project @ 2003-10-28 18:48:07 by jwe]
jwe
parents: 4555
diff changeset
118 const char *const_ptr;
239df9c618ef [project @ 2003-10-28 18:48:07 by jwe]
jwe
parents: 4555
diff changeset
119 char *ptr;
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
120 struct
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
121 {
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
122 unsigned off : 6;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
123 unsigned len : 26;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
124 unsigned add : 32;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
125 } mask;
4558
239df9c618ef [project @ 2003-10-28 18:48:07 by jwe]
jwe
parents: 4555
diff changeset
126 } octave_cray_descriptor;
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
127
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
128 typedef void *octave_cray_ftn_ch_dsc;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
129
4555
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
130 #ifdef __cplusplus
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
131 #define OCTAVE_F77_FCN_INLINE inline
4558
239df9c618ef [project @ 2003-10-28 18:48:07 by jwe]
jwe
parents: 4555
diff changeset
132 #else
239df9c618ef [project @ 2003-10-28 18:48:07 by jwe]
jwe
parents: 4555
diff changeset
133 #define OCTAVE_F77_FCN_INLINE
4555
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
134 #endif
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
135
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
136 static OCTAVE_F77_FCN_INLINE octave_cray_ftn_ch_dsc
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
137 octave_make_cray_ftn_ch_dsc (char *ptr_arg, unsigned long len_arg)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
138 {
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
139 octave_cray_descriptor desc;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
140 desc.ptr = ptr_arg;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
141 desc.mask.len = len_arg << 3;
4558
239df9c618ef [project @ 2003-10-28 18:48:07 by jwe]
jwe
parents: 4555
diff changeset
142 return *((octave_cray_ftn_ch_dsc *) &desc);
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
143 }
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
144
4555
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
145 static OCTAVE_F77_FCN_INLINE octave_cray_ftn_ch_dsc
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
146 octave_make_cray_const_ftn_ch_dsc (const char *ptr_arg, unsigned long len_arg)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
147 {
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
148 octave_cray_descriptor desc;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
149 desc.const_ptr = ptr_arg;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
150 desc.mask.len = len_arg << 3;
4558
239df9c618ef [project @ 2003-10-28 18:48:07 by jwe]
jwe
parents: 4555
diff changeset
151 return *((octave_cray_ftn_ch_dsc *) &desc);
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
152 }
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
153
4555
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
154 #ifdef __cplusplus
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
155 #undef OCTAVE_F77_FCN_INLINE
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
156 #endif
fe70d8074644 [project @ 2003-10-27 22:17:36 by jwe]
jwe
parents: 4552
diff changeset
157
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
158 #elif defined (F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
159
6072
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
160 /* Use these macros to pass character strings from C to Fortran. */
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
161 #define F77_CHAR_ARG(x) x, strlen (x)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
162 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
163 #define F77_CHAR_ARG2(x, l) x, l
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
164 #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
165 #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ())
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
166 #define F77_CHAR_ARG_LEN(l)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
167 #define F77_CHAR_ARG_DECL char *, int
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
168 #define F77_CONST_CHAR_ARG_DECL const char *, int
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
169 #define F77_CHAR_ARG_LEN_DECL
6072
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
170
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
171 /* Use these macros to write C-language functions that accept
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
172 Fortran-style character strings. */
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
173 #define F77_CHAR_ARG_DEF(s, len) char *s, int len
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
174 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, int len
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
175 #define F77_CHAR_ARG_LEN_DEF(len)
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
176 #define F77_CHAR_ARG_USE(s) s
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
177 #define F77_CHAR_ARG_LEN_USE(s, len) len
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
178
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
179 #define F77_RET_T void
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
180 #define F77_RETURN(retval)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
181
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
182 #else
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
183
4572
4623ef02a605 [project @ 2003-10-31 03:07:05 by jwe]
jwe
parents: 4558
diff changeset
184 /* Assume f2c-compatible calling convention. */
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
185
6072
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
186 /* Use these macros to pass character strings from C to Fortran. */
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
187 #define F77_CHAR_ARG(x) x
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
188 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
189 #define F77_CHAR_ARG2(x, l) x
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
190 #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l)
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
191 #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ())
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5701
diff changeset
192 #define F77_CHAR_ARG_LEN(l) , l
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
193 #define F77_CHAR_ARG_DECL char *
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
194 #define F77_CONST_CHAR_ARG_DECL const char *
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
195 #define F77_CHAR_ARG_LEN_DECL , long
6072
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
196
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
197 /* Use these macros to write C-language functions that accept
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
198 Fortran-style character strings. */
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
199 #define F77_CHAR_ARG_DEF(s, len) char *s
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
200 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
201 #define F77_CHAR_ARG_LEN_DEF(len) , long len
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
202 #define F77_CHAR_ARG_USE(s) s
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
203 #define F77_CHAR_ARG_LEN_USE(s, len) len
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
204
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
205 #define F77_RET_T int
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
206 #define F77_RETURN(retval) return retval;
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
207
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
208 #endif
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
209
6072
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
210
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
211 /* Build a C string local variable CS from the Fortran string parameter S
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
212 declared as F77_CHAR_ARG_DEF(s, len) or F77_CONST_CHAR_ARG_DEF(s, len).
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
213 The string will be cleaned up at the end of the current block.
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
214 Needs to include <cstring> and <vector>. */
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
215
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
216 #define F77_CSTRING(s, len, cs) \
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 6107
diff changeset
217 OCTAVE_LOCAL_BUFFER (char, cs, F77_CHAR_ARG_LEN_USE (s, len) + 1); \
6072
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
218 memcpy (cs, F77_CHAR_ARG_USE (s), F77_CHAR_ARG_LEN_USE (s, len)); \
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
219 cs[F77_CHAR_ARG_LEN_USE(s, len)] = '\0'
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
220
4036e6fca790 [project @ 2006-10-24 01:00:12 by jwe]
jwe
parents: 5775
diff changeset
221
6107
6465ca8e4f0c [project @ 2006-10-26 22:00:12 by jwe]
jwe
parents: 6072
diff changeset
222 extern CRUFT_API F77_RET_T
4801
b022780ac0b4 [project @ 2004-02-25 04:40:54 by jwe]
jwe
parents: 4577
diff changeset
223 F77_FUNC (xstopx, XSTOPX) (F77_CONST_CHAR_ARG_DECL
9930
1ddc25c3623a libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
224 F77_CHAR_ARG_LEN_DECL) GCC_ATTR_NORETURN;
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4268
diff changeset
225
2544
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
226 #ifdef __cplusplus
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
227 }
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
228 #endif
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
229
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
230 #endif
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
231
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
232 /*
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
233 ;;; Local Variables: ***
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
234 ;;; mode: C++ ***
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
235 ;;; End: ***
a33bbd3fadd7 [project @ 1996-11-20 05:09:29 by jwe]
jwe
parents:
diff changeset
236 */