/usr/include/sidlfortran.h is in libsidl-dev 1.4.0.dfsg-8build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | /*
* File: sidlfortran.h
* Revision: @(#) $Revision: 6482 $
* Date: $Date: 2008-08-21 15:50:53 -0700 (Thu, 21 Aug 2008) $
* Description: Macros for FORTRAN interoperability
*
* Copyright (c) 2000-2006, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory.
* Written by the Components Team <components@llnl.gov>
* UCRL-CODE-2002-054
* All rights reserved.
*
* This file is part of Babel. For more information, see
* http://www.llnl.gov/CASC/components/. Please read the COPYRIGHT file
* for Our Notice and the LICENSE file for the GNU Lesser General Public
* License.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License (as published by
* the Free Software Foundation) version 2.1 dated February 1999.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
* conditions of the GNU Lesser General Public License for more details.
*
* You should have recieved a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef included_sidlfortran_h
#define included_sidlfortran_h
#ifndef included_babel_config_h
#include "babel_config.h"
#endif
#ifdef FORTRAN77_DISABLED
#ifdef FORTRAN90_DISABLED
#error This installation of Babel Runtime was configured without any Fortran support.
#endif
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <sys/types.h>
#endif
#include <stddef.h>
#ifndef FORTRAN77_DISABLED
/*
* The SIDLFortran77Ending macro should be defined to add the appropriate
* characters to the end of a symbol. Normally, this means adding zero,
* one or two underscores.
*/
#ifdef SIDL_F77_ZERO_UNDERSCORE
#define SIDLFortran77Ending(sym) sym
#else
#ifdef SIDL_F77_ONE_UNDERSCORE
#define SIDLFortran77Ending(sym) sym ## _
#else
#ifdef SIDL_F77_TWO_UNDERSCORE
#define SIDLFortran77Ending(sym) sym ## __
#else
#error one of SIDL_F77_(ZERO,ONE,TWO)_UNDERSCORE must be defined
#endif
#endif
#endif
/*
* The SIDLFortran77Symbol macro should be defined to choose between
* a lower case form of the symbol, an upper case form of the symbol and
* a mixed case form of the symbol. It should apply SIDLFortran77Ending
* to its choice.
*/
#ifdef SIDL_F77_LOWER_CASE
#define SIDLFortran77Symbol(lcase,ucase,mcase) SIDLFortran77Ending(lcase)
#else
#ifdef SIDL_F77_UPPER_CASE
#define SIDLFortran77Symbol(lcase,ucase,mcase) SIDLFortran77Ending(ucase)
#else
#ifdef SIDL_F77_MIXED_CASE
#define SIDLFortran77Symbol(lcase,ucase,mcase) SIDLFortran77Ending(mcase)
#else
#error one of SIDL_F77_(LOWER,UPPER,MIXED)_CASE must be defined
#endif
#endif
#endif
/*
* String handling
*/
typedef SIDL_F77_STR_INT_SIZE SIDL_F77_String_Len;
#if defined(SIDL_F77_STR_LEN_NEAR) || defined(SIDL_F77_STR_LEN_FAR)
typedef char *SIDL_F77_String;
#define SIDL_F77_STR(strvar) (strvar)
#define SIDL_F77_STR_LOCAL_ARG(strvar) strvar
#define SIDL_F77_STR_LOCAL_STR(strvar) strvar
#define SIDL_F77_STR_LOCAL_LEN(strvar) strvar ## _len
#define SIDL_F77_STR_LEN(strvar) strvar ## _len
#define SIDL_F77_STR_LOCAL(strvar) \
SIDL_F77_String strvar = NULL;\
SIDL_F77_String_Len SIDL_F77_STR_LOCAL_LEN(strvar) = 0
#ifdef SIDL_F77_STR_LEN_NEAR
#define SIDL_F77_STR_NEAR_LEN_DECL(strvar) , SIDL_F77_String_Len SIDL_F77_STR_LEN(strvar)
#define SIDL_F77_STR_NEAR_LEN(strvar) , SIDL_F77_STR_LOCAL_LEN(strvar)
#define SIDL_F77_STR_FAR_LEN_DECL(strvar)
#define SIDL_F77_STR_FAR_LEN(strvar)
#else
#define SIDL_F77_STR_NEAR_LEN_DECL(strvar)
#define SIDL_F77_STR_NEAR_LEN(strvar)
#define SIDL_F77_STR_FAR_LEN_DECL(strvar) , SIDL_F77_String_Len SIDL_F77_STR_LEN(strvar)
#define SIDL_F77_STR_FAR_LEN(strvar) , SIDL_F77_STR_LOCAL_LEN(strvar)
#endif
#else
#if defined(SIDL_F77_STR_STRUCT_STR_LEN) || defined(SIDL_F77_STR_STRUCT_LEN_STR)
struct SIDL_F77_String_t;
typedef struct SIDL_F77_String_t *SIDL_F77_String;
#define SIDL_F77_STR(strvar) ((*strvar).str)
#define SIDL_F77_STR_LOCAL(strvar) struct SIDL_F77_String_t strvar = \
{ NULL, 0 }
#define SIDL_F77_STR_LOCAL_ARG(strvar) &strvar
#define SIDL_F77_STR_LOCAL_STR(strvar) ((strvar).str)
#define SIDL_F77_STR_LOCAL_LEN(strvar) ((strvar).len)
#define SIDL_F77_STR_LEN(strvar) ((*strvar).len)
#define SIDL_F77_STR_NEAR_LEN_DECL(strvar)
#define SIDL_F77_STR_FAR_LEN_DECL(strvar)
#else
#ifdef SIDL_F77_STR_STRUCT_STR_LEN
struct SIDL_F77_String_t {
char *str;
SIDL_F77_String_Len len;
};
#else
struct SIDL_F77_String_t {
SIDL_F77_String_Len len;
char *str;
};
#endif
#endif
#endif
#define SIDL_F77_STR_COPY(localvar,argvar,minsize) \
sidl_f77_copy_ior_str(&(SIDL_F77_STR_LOCAL_STR(localvar)), \
&(SIDL_F77_STR_LOCAL_LEN(localvar)), \
(argvar), (minsize))
#ifndef SIDL_F77_STR_MINSIZE
#define SIDL_F77_STR_MINSIZE 512
#endif
#ifdef SIDL_F77_LOGICAL_SIZE
#if SIDL_F77_LOGICAL_SIZE == 1
typedef int8_t SIDL_F77_Bool;
#elif SIDL_F77_LOGICAL_SIZE == 2
typedef int16_t SIDL_F77_Bool;
#elif SIDL_F77_LOGICAL_SIZE == 4
typedef int32_t SIDL_F77_Bool;
#elif SIDL_F77_LOGICAL_SIZE == 8
typedef int64_t SIDL_F77_Bool;
#else
typedef int SIDL_F77_Bool;
#endif
#else
typedef int SIDL_F77_Bool;
#endif
#ifndef SIDL_F77_TRUE
#define SIDL_F77_TRUE 1
#endif
#ifndef SIDL_F77_FALSE
#define SIDL_F77_FALSE 0
#endif
#endif /* not FORTRAN77_DISABLED */
#ifndef FORTRAN90_DISABLED
/*
* The SIDLFortran90Ending macro should be defined to add the appropriate
* characters to the end of a symbol. Normally, this means adding zero,
* one or two underscores.
*/
#ifdef SIDL_F90_ZERO_UNDERSCORE
#define SIDLFortran90Ending(sym) sym
#else
#ifdef SIDL_F90_ONE_UNDERSCORE
#define SIDLFortran90Ending(sym) sym ## _
#else
#ifdef SIDL_F90_TWO_UNDERSCORE
#define SIDLFortran90Ending(sym) sym ## __
#else
#error one of SIDL_F90_(ZERO,ONE,TWO)_UNDERSCORE must be defined
#endif
#endif
#endif
/*
* The SIDLFortran90Symbol macro should be defined to choose between
* a lower case form of the symbol, an upper case form of the symbol and
* a mixed case form of the symbol. It should apply SIDLFortran90Ending
* to its choice.
*/
#ifdef SIDL_F90_LOWER_CASE
#define SIDLFortran90Symbol(lcase,ucase,mcase) SIDLFortran90Ending(lcase)
#else
#ifdef SIDL_F90_UPPER_CASE
#define SIDLFortran90Symbol(lcase,ucase,mcase) SIDLFortran90Ending(ucase)
#else
#ifdef SIDL_F90_MIXED_CASE
#define SIDLFortran90Symbol(lcase,ucase,mcase) SIDLFortran90Ending(mcase)
#else
#error one of SIDL_F90_(LOWER,UPPER,MIXED)_CASE must be defined
#endif
#endif
#endif
/*
* String handling
*/
typedef SIDL_F90_STR_INT_SIZE SIDL_F90_String_Len;
#if defined(SIDL_F90_STR_LEN_NEAR) || defined(SIDL_F90_STR_LEN_FAR)
typedef char *SIDL_F90_String;
#define SIDL_F90_STR(strvar) (strvar)
#define SIDL_F90_STR_LOCAL_ARG(strvar) strvar
#define SIDL_F90_STR_LOCAL_STR(strvar) strvar
#define SIDL_F90_STR_LOCAL_LEN(strvar) strvar ## _len
#define SIDL_F90_STR_LEN(strvar) strvar ## _len
#define SIDL_F90_STR_LOCAL(strvar) \
SIDL_F90_String strvar = NULL;\
SIDL_F90_String_Len SIDL_F90_STR_LOCAL_LEN(strvar) = 0
#ifdef SIDL_F90_STR_LEN_NEAR
#define SIDL_F90_STR_NEAR_LEN_DECL(strvar) , SIDL_F90_String_Len SIDL_F90_STR_LEN(strvar)
#define SIDL_F90_STR_NEAR_LEN(strvar) , SIDL_F90_STR_LOCAL_LEN(strvar)
#define SIDL_F90_STR_FAR_LEN_DECL(strvar)
#define SIDL_F90_STR_FAR_LEN(strvar)
#else
#define SIDL_F90_STR_NEAR_LEN_DECL(strvar)
#define SIDL_F90_STR_NEAR_LEN(strvar)
#define SIDL_F90_STR_FAR_LEN_DECL(strvar) , SIDL_F90_String_Len SIDL_F90_STR_LEN(strvar)
#define SIDL_F90_STR_FAR_LEN(strvar) , SIDL_F90_STR_LOCAL_LEN(strvar)
#endif
#else
#if defined(SIDL_F90_STR_STRUCT_STR_LEN) || defined(SIDL_F90_STR_STRUCT_LEN_STR)
struct SIDL_F90_String_t;
typdef struct SIDL_F90_String_t *SIDL_F90_String;
#define SIDL_F90_STR(strvar) ((*strvar).str)
#define SIDL_F90_STR_LOCAL(strvar) struct SIDL_F90_String_t strvar = \
{ NULL, 0 }
#define SIDL_F90_STR_LOCAL_ARG(strvar) &strvar
#define SIDL_F90_STR_LOCAL_STR(strvar) ((strvar).str)
#define SIDL_F90_STR_LOCAL_LEN(strvar) ((strvar).len)
#define SIDL_F90_STR_LEN(strvar) ((*strvar).len)
#define SIDL_F90_STR_NEAR_LEN_DECL(strvar)
#define SIDL_F90_STR_FAR_LEN_DECL(strvar)
#else
#ifdef SIDL_F90_STR_STRUCT_STR_LEN
struct SIDL_F90_String_t {
char *str;
SIDL_F90_String_Len len;
};
#else
struct SIDL_F90_String_t {
SIDL_F90_String_Len len;
char *str;
};
#endif
#endif
#endif
#define SIDL_F90_STR_COPY(localvar,argvar,minsize) \
sidl_f90_copy_ior_str(&(SIDL_F90_STR_LOCAL_STR(localvar)), \
&(SIDL_F90_STR_LOCAL_LEN(localvar)), \
(argvar), (minsize))
#ifndef SIDL_F90_STR_MINSIZE
#define SIDL_F90_STR_MINSIZE 512
#endif
#ifdef SIDL_F90_LOGICAL_SIZE
#if SIDL_F90_LOGICAL_SIZE == 1
typedef int8_t SIDL_F90_Bool;
#elif SIDL_F90_LOGICAL_SIZE == 2
typedef int16_t SIDL_F90_Bool;
#elif SIDL_F90_LOGICAL_SIZE == 4
typedef int32_t SIDL_F90_Bool;
#elif SIDL_F90_LOGICAL_SIZE == 8
typedef int64_t SIDL_F90_Bool;
#else
typedef int SIDL_F90_Bool;
#endif
#else
typedef int SIDL_F90_Bool;
#endif
#ifndef SIDL_F90_TRUE
#define SIDL_F90_TRUE 1
#endif
#ifndef SIDL_F90_FALSE
#define SIDL_F90_FALSE 0
#endif
#endif /* not FORTRAN90_DISABLED */
#ifdef __cplusplus
extern "C" { /*}*/
#endif
/*
* Convert a FORTRAN string to a nul terminated C string. The
* returned pointer is a dynamically allocated copy of fstr. Any
* trailing space characters in fstr are left out of the copy.
*/
char *
sidl_copy_fortran_str(const char *fstr,
ptrdiff_t flen);
/*
* Convert a C string into a FORTRAN string. If the C string is
* shorter than the fstr, fstr will be padded with space characters.
* If the C string is longer than fstr, the first flen characters of
* the C string are copied.
*/
void
sidl_copy_c_str(char *fstr,
size_t flen,
const char *cstr);
#ifndef FORTRAN77_DISABLED
/*
* Provide a block of memory and the length for a FORTRAN 77 string.
* This will dynamically allocate a string with max(strlen(iorstr),
* minsize)+1 characters. The last character in the buffer is
* initialized to '\0'.
*
* The pointer to the allocated space is stored in *newfstr, and the length
* of the space is stored in *newflen. If iorstr is not null, the contents
* are copied into the allocated space. Any uninitialized characters in
* *newfstr are initialized to space characters.
*
* The intent is that the FORTRAN 77 client will only use characters 0 through
* minsize - 1 leaving the nul character untouched.
*/
void
sidl_f77_copy_ior_str(char **newfstr,
SIDL_F77_String_Len *newflen,
const char *iorstr,
const size_t minsize);
#endif
#ifndef FORTRAN90_DISABLED
/*
* Provide a block of memory and the length for a Fortran 90 string.
* This will dynamically allocate a string with max(strlen(iorstr),
* minsize)+1 characters. The last character in the buffer is
* initialized to '\0'.
*
* The pointer to the allocated space is stored in *newfstr, and the length
* of the space is stored in *newflen. If iorstr is not null, the contents
* are copied into the allocated space. Any uninitialized characters in
* *newfstr are initialized to space characters.
*
* The intent is that the Fortran 90 client will only use characters 0 through
* minsize - 1 leaving the nul character untouched.
*/
void
sidl_f90_copy_ior_str(char **newfstr,
SIDL_F90_String_Len *newflen,
const char *iorstr,
const size_t minsize);
#endif
/*
* Remove trailing space characters. This
* routine will store a nul character in index 0 to
* buflen (inclusive) (i.e. a full string causes
* the assignment buffer[buflen] = '\0'). This means
* that buffer is actually buflen + 1 bytes long.
* It returns buffer.
*/
char *
sidl_trim_trailing_space(char *buffer,
ptrdiff_t buflen);
#ifdef __cplusplus
}
#endif
#endif /* included_sidlfortran_h */
|