Mercurial > octave
annotate liboctave/util/f77-fcn.h @ 25364:bbc47fb89973 stable
use size_t for f77 char arg length params with GCC 8 (bug #53872)
* f77-fcn.h (F77_CHAR_ARG_LEN_TYPE): Define to size_t if using GCC 8
or later.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 10 May 2018 16:16:25 -0400 |
parents | 078b795c5219 |
children | f23f27e78aa2 00f796120a6d |
rev | line source |
---|---|
2544 | 1 /* |
2 | |
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24558
diff
changeset
|
3 Copyright (C) 1996-2018 John W. Eaton |
2544 | 4 |
5 This file is part of Octave. | |
6 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24520
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22410
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24520
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22410
diff
changeset
|
10 (at your option) any later version. |
2544 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22410
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22410
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22410
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22410
diff
changeset
|
15 GNU General Public License for more details. |
2544 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24520
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
2544 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20545
diff
changeset
|
23 #if ! defined (octave_f77_fcn_h) |
2544 | 24 #define octave_f77_fcn_h 1 |
25 | |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21229
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21229
diff
changeset
|
27 |
22843
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
28 #include "lo-error.h" |
4268 | 29 #include "quit.h" |
30 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21662
diff
changeset
|
31 #if defined (__cplusplus) |
22843
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
32 # include <limits> |
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
33 #endif |
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
34 |
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
35 #if defined (__cplusplus) |
2544 | 36 extern "C" { |
37 #endif | |
38 | |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23426
diff
changeset
|
39 /* This macro is obsolete. */ |
2544 | 40 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23426
diff
changeset
|
41 #define F77_XFCN(f, F, args) \ |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23426
diff
changeset
|
42 F77_FUNC (f, F) args |
2544 | 43 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20545
diff
changeset
|
44 #if ! defined (F77_FCN) |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23426
diff
changeset
|
45 # define F77_FCN(f, F) F77_FUNC (f, F) |
3938 | 46 #endif |
47 | |
24558
e721ca8bb801
restore f77_exception_encountered, but deprecate and always define as 0
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
48 OCTAVE_DEPRECATED (4.4, "this variable is obsolete and should not be needed") |
e721ca8bb801
restore f77_exception_encountered, but deprecate and always define as 0
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
49 static const int f77_exception_encountered = 0; |
e721ca8bb801
restore f77_exception_encountered, but deprecate and always define as 0
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
50 |
15128
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
51 /* |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
52 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
53 The following macros are used for handling Fortran <-> C calling |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
54 conventions. They are defined below for three different types of |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
55 systems, Cray (possibly now obsolete), Visual Fortran, and gfortran. |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
56 Note that we don't attempt to handle Fortran functions, we always use |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
57 subroutine wrappers for them and pass the return value as an extra |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
58 argument. |
15128
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
59 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
60 Use these macros to pass character strings from C to Fortran: |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
61 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
62 F77_CHAR_ARG(x) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
63 F77_CONST_CHAR_ARG(x) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
64 F77_CXX_STRING_ARG(x) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
65 F77_CHAR_ARG_LEN(l) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
66 F77_CHAR_ARG_DECL |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
67 F77_CONST_CHAR_ARG_DECL |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
68 F77_CHAR_ARG_LEN_DECL |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
69 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
70 Use these macros to write C-language functions that accept |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
71 Fortran-style character strings: |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
72 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
73 F77_CHAR_ARG_DEF(s, len) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
74 F77_CONST_CHAR_ARG_DEF(s, len) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
75 F77_CHAR_ARG_LEN_DEF(len) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
76 F77_CHAR_ARG_USE(s) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
77 F77_CHAR_ARG_LEN_USE(s, len) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
78 |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
79 Use these macros for C++ code |
15128
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
80 |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
81 F77_INT Equivalent to Fortran INTEGER type |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
82 F77_INT4 Equivalent to Fortran INTEGER*4 type |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
83 F77_DBLE Equivalent to Fortran DOUBLE PRECISION type |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
84 F77_REAL Equivalent to Fortran REAL type |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
85 F77_CMPLX Equivalent to Fortran COMPLEX type |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
86 F77_DBLE_CMPLX Equivalent to Fortran DOUBLE COMPLEX type |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
87 F77_LOGICAL Equivalent to Fortran LOGICAL type |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
88 F77_RET_T Return type of a C++ function that acts like a |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
89 Fortran subroutine. |
15128
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
90 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
91 Use these macros to return from C-language functions that are supposed |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
92 to act like Fortran subroutines. F77_NORETURN is intended to be used |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
93 as the last statement of such a function that has been tagged with a |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
94 "noreturn" attribute. If the compiler supports the "noreturn" |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
95 attribute or if F77_RET_T is void, then it should expand to nothing so |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
96 that we avoid warnings about functions tagged as "noreturn" |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
97 containing a return statement. Otherwise, it should expand to a |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
98 statement that returns the given value so that we avoid warnings about |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
99 not returning a value from a function declared to return something. |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
100 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
101 F77_RETURN(retval) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
102 F77_NORETURN(retval) |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
103 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
104 */ |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
105 |
4552 | 106 #if defined (F77_USES_CRAY_CALLING_CONVENTION) |
107 | |
108 #include <fortran.h> | |
6072 | 109 |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
110 /* Use these macros to pass character strings from C to Fortran. Cray |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
111 Fortran uses a descriptor structure to pass a pointer to the string |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
112 and the length in a single argument. */ |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
113 |
4552 | 114 #define F77_CHAR_ARG(x) octave_make_cray_ftn_ch_dsc (x, strlen (x)) |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
115 #define F77_CONST_CHAR_ARG(x) \ |
4552 | 116 octave_make_cray_const_ftn_ch_dsc (x, strlen (x)) |
4577 | 117 #define F77_CHAR_ARG2(x, l) octave_make_cray_ftn_ch_dsc (x, l) |
118 #define F77_CONST_CHAR_ARG2(x, l) octave_make_cray_const_ftn_ch_dsc (x, l) | |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
119 #define F77_CXX_STRING_ARG(x) \ |
4552 | 120 octave_make_cray_const_ftn_ch_dsc (x.c_str (), x.length ()) |
121 #define F77_CHAR_ARG_LEN(l) | |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
122 #define F77_CHAR_ARG_LEN_TYPE |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
123 #define F77_CHAR_ARG_LEN_DECL |
4577 | 124 #define F77_CHAR_ARG_DECL octave_cray_ftn_ch_dsc |
125 #define F77_CONST_CHAR_ARG_DECL octave_cray_ftn_ch_dsc | |
6072 | 126 |
127 /* Use these macros to write C-language functions that accept | |
128 Fortran-style character strings. */ | |
129 #define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s | |
130 #define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
131 #define F77_CHAR_ARG_LEN_DEF(len) |
6072 | 132 #define F77_CHAR_ARG_USE(s) s.ptr |
21662
5b9868c2e212
maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents:
21244
diff
changeset
|
133 #define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len >> 3) |
6072 | 134 |
4552 | 135 #define F77_RET_T int |
15128
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
136 |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
137 /* Use these macros to return from C-language functions that are |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
138 supposed to act like Fortran subroutines. F77_NORETURN is intended |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
139 to be used as the last statement of such a function that has been |
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
140 tagged with a "noreturn" attribute. */ |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
141 |
4552 | 142 #define F77_RETURN(retval) return retval; |
21229
a83e7a384ee0
create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents:
21227
diff
changeset
|
143 #if defined (HAVE_OCTAVE_NORETURN_ATTR) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21076
diff
changeset
|
144 # define F77_NORETURN(retval) |
15127
87411930d6c4
avoid "function declared 'noreturn' has a return statement" warning.
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
145 #else |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21076
diff
changeset
|
146 # define F77_NORETURN(retval) return retval; |
15127
87411930d6c4
avoid "function declared 'noreturn' has a return statement" warning.
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
147 #endif |
4552 | 148 |
21066
258c787cd9ce
maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
149 /* FIXME: These should work for SV1 or Y-MP systems but will |
258c787cd9ce
maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
150 need to be changed for others. */ |
4552 | 151 |
4558 | 152 typedef union |
4552 | 153 { |
4558 | 154 const char *const_ptr; |
155 char *ptr; | |
4552 | 156 struct |
157 { | |
158 unsigned off : 6; | |
159 unsigned len : 26; | |
160 unsigned add : 32; | |
161 } mask; | |
4558 | 162 } octave_cray_descriptor; |
4552 | 163 |
164 typedef void *octave_cray_ftn_ch_dsc; | |
165 | |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
166 #if defined (__cplusplus) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21076
diff
changeset
|
167 # define OCTAVE_F77_FCN_INLINE inline |
4558 | 168 #else |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21076
diff
changeset
|
169 # define OCTAVE_F77_FCN_INLINE |
4555 | 170 #endif |
171 | |
172 static OCTAVE_F77_FCN_INLINE octave_cray_ftn_ch_dsc | |
4552 | 173 octave_make_cray_ftn_ch_dsc (char *ptr_arg, unsigned long len_arg) |
174 { | |
175 octave_cray_descriptor desc; | |
176 desc.ptr = ptr_arg; | |
177 desc.mask.len = len_arg << 3; | |
4558 | 178 return *((octave_cray_ftn_ch_dsc *) &desc); |
4552 | 179 } |
180 | |
4555 | 181 static OCTAVE_F77_FCN_INLINE octave_cray_ftn_ch_dsc |
4552 | 182 octave_make_cray_const_ftn_ch_dsc (const char *ptr_arg, unsigned long len_arg) |
183 { | |
184 octave_cray_descriptor desc; | |
185 desc.const_ptr = ptr_arg; | |
186 desc.mask.len = len_arg << 3; | |
4558 | 187 return *((octave_cray_ftn_ch_dsc *) &desc); |
4552 | 188 } |
189 | |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
190 #undef OCTAVE_F77_FCN_INLINE |
22157
c5842206aaea
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22135
diff
changeset
|
191 |
4552 | 192 #elif defined (F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION) |
193 | |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
194 /* Use these macros to pass character strings from C to Fortran. |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
195 Visual Fortran inserts the length after each character string |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
196 argument. */ |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
197 |
4552 | 198 #define F77_CHAR_ARG(x) x, strlen (x) |
199 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x) | |
200 #define F77_CHAR_ARG2(x, l) x, l | |
201 #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l) | |
202 #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ()) | |
203 #define F77_CHAR_ARG_LEN(l) | |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
204 #define F77_CHAR_ARG_LEN_TYPE int |
4552 | 205 #define F77_CHAR_ARG_LEN_DECL |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
206 #define F77_CHAR_ARG_DECL char *, F77_CHAR_ARG_LEN_TYPE |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
207 #define F77_CONST_CHAR_ARG_DECL const char *, F77_CHAR_ARG_LEN_TYPE |
6072 | 208 |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
209 #define F77_CHAR_ARG_DEF(s, len) char *s, F77_CHAR_ARG_LEN_TYPE len |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
210 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, F77_CHAR_ARG_LEN_TYPE len |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
211 #define F77_CHAR_ARG_LEN_DEF(len) |
6072 | 212 #define F77_CHAR_ARG_USE(s) s |
213 #define F77_CHAR_ARG_LEN_USE(s, len) len | |
214 | |
4552 | 215 #define F77_RET_T void |
15128
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
216 |
15127
87411930d6c4
avoid "function declared 'noreturn' has a return statement" warning.
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
217 #define F77_RETURN(retval) return; |
87411930d6c4
avoid "function declared 'noreturn' has a return statement" warning.
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
218 #define F77_NORETURN(retval) |
4552 | 219 |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
220 #elif defined (F77_USES_GFORTRAN_CALLING_CONVENTION) |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
221 |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
222 /* Use these macros to pass character strings from C to Fortran. |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
223 gfortran appends length arguments for assumed size character |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
224 strings to the and ignores others. |
4552 | 225 |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
226 FIXME: I don't think we correctly handle the case of mixing some |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
227 fixed-length and some assumed-length character string arguments as |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
228 we don't handle each case separately, so it seems there could be |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
229 mismatch? However, I don't think we currently have to handle this |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
230 case in Octave. */ |
4552 | 231 |
232 #define F77_CHAR_ARG(x) x | |
233 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x) | |
234 #define F77_CHAR_ARG2(x, l) x | |
235 #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l) | |
236 #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ()) | |
5760 | 237 #define F77_CHAR_ARG_LEN(l) , l |
25364
bbc47fb89973
use size_t for f77 char arg length params with GCC 8 (bug #53872)
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
238 #if defined (__GNUC__) && __GNUC__ >= 8 |
bbc47fb89973
use size_t for f77 char arg length params with GCC 8 (bug #53872)
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
239 # define F77_CHAR_ARG_LEN_TYPE size_t |
bbc47fb89973
use size_t for f77 char arg length params with GCC 8 (bug #53872)
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
240 #else |
bbc47fb89973
use size_t for f77 char arg length params with GCC 8 (bug #53872)
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
241 # define F77_CHAR_ARG_LEN_TYPE int |
bbc47fb89973
use size_t for f77 char arg length params with GCC 8 (bug #53872)
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
242 #endif |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
243 #define F77_CHAR_ARG_LEN_DECL , F77_CHAR_ARG_LEN_TYPE |
4552 | 244 #define F77_CHAR_ARG_DECL char * |
245 #define F77_CONST_CHAR_ARG_DECL const char * | |
6072 | 246 |
247 #define F77_CHAR_ARG_DEF(s, len) char *s | |
248 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s | |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
249 #define F77_CHAR_ARG_LEN_DEF(len) , F77_CHAR_ARG_LEN_TYPE len |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
250 #define F77_CHAR_ARG_USE(s) s |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
251 #define F77_CHAR_ARG_LEN_USE(s, len) len |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
252 |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
253 #define F77_RET_T void |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
254 |
22410
bc38c1ff6698
fix definition of F77_RETURN for gfortran
John W. Eaton <jwe@octave.org>
parents:
22402
diff
changeset
|
255 #define F77_RETURN(retval) return; |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
256 #if defined (HAVE_OCTAVE_NORETURN_ATTR) |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
257 # define F77_NORETURN(retval) |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
258 #else |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
259 # define F77_NORETURN(retval) return retval; |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
260 #endif |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
261 |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
262 #elif defined (F77_USES_F2C_CALLING_CONVENTION) |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
263 |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
264 /* Assume f2c-compatible calling convention. */ |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
265 |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
266 /* Use these macros to pass character strings from C to Fortran. f2c |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
267 appends all length arguments at the end of the parameter list. */ |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
268 |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
269 #define F77_CHAR_ARG(x) x |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
270 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x) |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
271 #define F77_CHAR_ARG2(x, l) x |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
272 #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l) |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
273 #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ()) |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
274 #define F77_CHAR_ARG_LEN(l) , l |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
275 #define F77_CHAR_ARG_LEN_TYPE long |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
276 #define F77_CHAR_ARG_LEN_DECL , F77_CHAR_ARG_LEN_TYPE |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
277 #define F77_CHAR_ARG_DECL char * |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
278 #define F77_CONST_CHAR_ARG_DECL const char * |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
279 |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
280 #define F77_CHAR_ARG_DEF(s, len) char *s |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
281 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
282 #define F77_CHAR_ARG_LEN_DEF(len) , F77_CHAR_ARG_LEN_TYPE len |
6072 | 283 #define F77_CHAR_ARG_USE(s) s |
284 #define F77_CHAR_ARG_LEN_USE(s, len) len | |
285 | |
4552 | 286 #define F77_RET_T int |
15128
4d52239daef5
improve internal documentation of F77_ macros.
John W. Eaton <jwe@octave.org>
parents:
15127
diff
changeset
|
287 |
4552 | 288 #define F77_RETURN(retval) return retval; |
21229
a83e7a384ee0
create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents:
21227
diff
changeset
|
289 #if defined (HAVE_OCTAVE_NORETURN_ATTR) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21076
diff
changeset
|
290 # define F77_NORETURN(retval) |
15127
87411930d6c4
avoid "function declared 'noreturn' has a return statement" warning.
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
291 #else |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21076
diff
changeset
|
292 # define F77_NORETURN(retval) return retval; |
15127
87411930d6c4
avoid "function declared 'noreturn' has a return statement" warning.
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
293 #endif |
4552 | 294 |
22134
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
295 #else |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
296 |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
297 #error "unknown C++ to Fortran calling convention" |
a51d5c5c71e6
handle gfortran and f2c calling conventions separately
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
298 |
4552 | 299 #endif |
300 | |
22841
5605a786086d
use typedefs instead of macros for F77 types
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
301 typedef double F77_DBLE; |
5605a786086d
use typedefs instead of macros for F77 types
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
302 typedef float F77_REAL; |
5605a786086d
use typedefs instead of macros for F77 types
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
303 typedef double _Complex F77_DBLE_CMPLX; |
5605a786086d
use typedefs instead of macros for F77 types
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
304 typedef float _Complex F77_CMPLX; |
22842
60405b73e439
provide separate typedefs for octave_idx_type and octave_f77_int_type
John W. Eaton <jwe@octave.org>
parents:
22841
diff
changeset
|
305 typedef octave_f77_int_type F77_INT; |
22841
5605a786086d
use typedefs instead of macros for F77 types
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
306 typedef int32_t F77_INT4; |
22842
60405b73e439
provide separate typedefs for octave_idx_type and octave_f77_int_type
John W. Eaton <jwe@octave.org>
parents:
22841
diff
changeset
|
307 typedef octave_f77_int_type F77_LOGICAL; |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
308 |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
309 #define F77_CMPLX_ARG(x) \ |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22134
diff
changeset
|
310 reinterpret_cast<float _Complex *> (x) |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22134
diff
changeset
|
311 |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
312 #define F77_CONST_CMPLX_ARG(x) \ |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22134
diff
changeset
|
313 reinterpret_cast<const float _Complex *> (x) |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22134
diff
changeset
|
314 |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
315 #define F77_DBLE_CMPLX_ARG(x) \ |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22134
diff
changeset
|
316 reinterpret_cast<double _Complex *> (x) |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22134
diff
changeset
|
317 |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
318 #define F77_CONST_DBLE_CMPLX_ARG(x) \ |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22134
diff
changeset
|
319 reinterpret_cast<const double _Complex *> (x) |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22134
diff
changeset
|
320 |
6072 | 321 /* Build a C string local variable CS from the Fortran string parameter S |
322 declared as F77_CHAR_ARG_DEF(s, len) or F77_CONST_CHAR_ARG_DEF(s, len). | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
323 The string will be cleaned up at the end of the current block. |
6072 | 324 Needs to include <cstring> and <vector>. */ |
325 | |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
326 #define F77_CSTRING(s, len, cs) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
327 OCTAVE_LOCAL_BUFFER (char, cs, F77_CHAR_ARG_LEN_USE (s, len) + 1); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
328 memcpy (cs, F77_CHAR_ARG_USE (s), F77_CHAR_ARG_LEN_USE (s, len)); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
329 cs[F77_CHAR_ARG_LEN_USE(s, len)] = '\0' |
6072 | 330 |
21227 | 331 OCTAVE_NORETURN OCTAVE_API extern |
21076
b433f9990452
strip trailing whitespace from files
John W. Eaton <jwe@octave.org>
parents:
21066
diff
changeset
|
332 F77_RET_T |
4801 | 333 F77_FUNC (xstopx, XSTOPX) (F77_CONST_CHAR_ARG_DECL |
21029
e3b3bb522d62
maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
334 F77_CHAR_ARG_LEN_DECL); |
4552 | 335 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21662
diff
changeset
|
336 #if defined (__cplusplus) |
22843
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
337 |
22988
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
338 namespace octave |
22843
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
339 { |
22988
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
340 inline F77_INT |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
341 to_f77_int (octave_idx_type x) |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
342 { |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
343 if (x < std::numeric_limits<F77_INT>::min () |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
344 || x > std::numeric_limits<F77_INT>::max ()) |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
345 (*current_liboctave_error_handler) |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
346 ("integer dimension or index out of range for Fortran INTEGER type"); |
22843
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
347 |
22988
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
348 return static_cast<F77_INT> (x); |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
349 } |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
350 } |
22843
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
351 |
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
352 #endif |
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
353 |
a2809b2938d6
* f77-fcn.h (to_f77_int): New inline function.
John W. Eaton <jwe@octave.org>
parents:
22842
diff
changeset
|
354 #if defined (__cplusplus) |
2544 | 355 } |
356 #endif | |
357 | |
358 #endif |