/* EXTRAITS DE LA LICENCE
Copyright CEA, contributeurs : Luc BILLARD, Damien
CALISTE, Olivier D'Astier, laboratoire L_Sim, (2001-2005)
Adresses mèl :
BILLARD, non joignable par mèl ;
CALISTE, damien P caliste AT cea P fr.
D'ASTIER, dastier AT iie P cnam P fr.
Ce logiciel est un programme informatique servant à visualiser des
structures atomiques dans un rendu pseudo-3D.
Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes (cf. le fichier Documentation/licence.fr.txt fourni avec ce logiciel).
*/
/* LICENCE SUM UP
Copyright CEA, contributors : Luc BILLARD and Damien
CALISTE and Olivier D'Astier, laboratoire L_Sim, (2001-2005)
E-mail addresses :
BILLARD, not reachable any more ;
CALISTE, damien P caliste AT cea P fr.
D'ASTIER, dastier AT iie P cnam P fr.
This software is a computer program whose purpose is to visualize atomic
configurations in 3D.
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms. You can
find a copy of this licence shipped with this software at Documentation/licence.en.txt.
*/
#ifndef TOOLFORTRAN_H
#define TOOLFORTRAN_H
#include <stdio.h>
#include <glib.h>
/**
* EndianId:
* @KEEP_ENDIANNESS: read a file without inverting records.
* @CHANGE_ENDIANNESS: read a file inverting records.
*
* Thiese ids are used when reading a multi-bytes information from a binary file.
*/
typedef enum
{
KEEP_ENDIANNESS,
CHANGE_ENDIANNESS
} EndianId;
/**
* toolFortranRead_character:
* @var: an allocated array of char ;
* @nb: the size of the array @var ;
* @flux: a pointer on an opened file ;
* @error: a pointer to an error location ;
* @endianness: reverse or not the order of multi-bytes ;
* @testFlag: if TRUE, read start and stop flags and test their values.
*
* Read an array of characters from a fortran record. The endianness is required
* to read the Fortran flag.
*
* Returns: TRUE if everything went right.
*/
gboolean toolFortranRead_character(char *var, unsigned int nb, FILE *flux,
GError **error, EndianId endianness,
gboolean testFlag);
/**
* toolFortranRead_integer:
* @var: an allocated array of int ;
* @nb: the size of the array @var ;
* @flux: a pointer on an opened file ;
* @error: a pointer to an error location ;
* @endianness: reverse or not the order of multi-bytes ;
* @testFlag: if TRUE, read start and stop flags and test their values.
*
* Read an array of integers from a fortran record.
*
* Returns: TRUE if everything went right.
*/
gboolean toolFortranRead_integer(unsigned int *var, unsigned int nb, FILE *flux,
GError **error, EndianId endianness,
gboolean testFlag);
/**
* toolFortranRead_real:
* @var: an allocated array of float ;
* @nb: the size of the array @var ;
* @flux: a pointer on an opened file ;
* @error: a pointer to an error location ;
* @endianness: reverse or not the order of multi-bytes ;
* @testFlag: if TRUE, read start and stop flags and test their values.
*
* Read an array of reals from a fortran record.
*
* Returns: TRUE if everything went right.
*/
gboolean toolFortranRead_real(float *var, unsigned int nb, FILE *flux,
GError **error, EndianId endianness,
gboolean testFlag);
/**
* toolFortranRead_double:
* @var: an allocated array of double ;
* @nb: the size of the array @var ;
* @flux: a pointer on an opened file ;
* @error: a pointer to an error location ;
* @endianness: reverse or not the order of multi-bytes ;
* @testFlag: if TRUE, read start and stop flags and test their values.
*
* Read an array of doubles from a fortran record.
*
* Returns: TRUE if everything went right.
*/
gboolean toolFortranRead_double(double *var, unsigned int nb, FILE *flux,
GError **error, EndianId endianness,
gboolean testFlag);
/**
* toolFortranRead_flag:
* @nb: a location t store the value of the flag ;
* @flux: a pointer on an opened file ;
* @error: a pointer to an error location ;
* @endianness: reverse or not the order of multi-bytes.
*
* Read the flag of a record (a 32bits integer).
*
* Returns: TRUE if everything went right.
*/
gboolean toolFortranRead_flag(unsigned int *nb, FILE *flux,
GError **error, EndianId endianness);
/**
* toolFortranTest_endianness:
* @nb: the value of the flag to read ;
* @flux: a pointer on an opened file ;
* @error: a pointer to an error location ;
* @endianness: a location to store the endianness.
*
* Read a flag and compare the value with @nb for little and big endian.
* It return the value of endianness to be used after. The file is rewind after the
* call.
*
* Returns: TRUE if everything went right.
*/
gboolean toolFortranTest_endianness(unsigned int nb, FILE *flux,
GError **error, EndianId *endianness);
#endif
syntax highlighted by Code2HTML, v. 0.9.1