| 1 | #ifndef FSVCACHE_H_SEEN
 | 
|---|
| 2 | #define  FSVCACHE_H_SEEN
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #include <stdio.h>
 | 
|---|
| 5 | #include "machdefs.h"
 | 
|---|
| 6 | 
 | 
|---|
| 7 | #include "filecache.h"
 | 
|---|
| 8 | 
 | 
|---|
| 9 | #ifdef __cplusplus
 | 
|---|
| 10 | extern "C" {
 | 
|---|
| 11 | #endif
 | 
|---|
| 12 | 
 | 
|---|
| 13 |  
 | 
|---|
| 14 | /*    Structure du fichier de suivi :                             */
 | 
|---|
| 15 | /*           1) Entete : Structure entetesuivi                    */
 | 
|---|
| 16 | /*           2) Zone commentaire   (1 * Rec0 )                    */
 | 
|---|
| 17 | /*           3) Enregistrement Info generale fichier  (1 * Rec1)  */
 | 
|---|
| 18 | /*           4) Enregistrements info etoiles  (NbStars * Rec2)    */
 | 
|---|
| 19 | /*           5) Enregistrements mesures                           */
 | 
|---|
| 20 | /*                1 * Rec3 + NbStars * Rec4                       */
 | 
|---|
| 21 | /*                Rec3 contient le temps des mesures,             */
 | 
|---|
| 22 | /*                Rec4 contient l'info mesures                    */
 | 
|---|
| 23 | /*                Rec3 et Rec4 correspondent a un ensemble de     */
 | 
|---|
| 24 | /*                NItem mesures.                                  */
 | 
|---|
| 25 | /*           le groupe (5) peut etre repete plusieurs fois        */
 | 
|---|
| 26 |  
 | 
|---|
| 27 |  
 | 
|---|
| 28 |  
 | 
|---|
| 29 | struct entetesuivi
 | 
|---|
| 30 |   {
 | 
|---|
| 31 |   int_4 FileSize;             /*  Taille totale fichier  */
 | 
|---|
| 32 |   int_4 HSize;                /*  Taille entete          */
 | 
|---|
| 33 |   uint_2 RecSize[5];          /*  Tailles Rec 0/1/2/3    */
 | 
|---|
| 34 |   uint_2 NItem;               /*  Nb de mesures / Record */
 | 
|---|
| 35 |   int_4 NbStars;              /*  Nb. total d'etoiles    */
 | 
|---|
| 36 |   int_4 NbMesTot;             /*  Nb. total de mesures   */
 | 
|---|
| 37 |   uint_2 FmtSize[5];          /*  Longueur des formats   */
 | 
|---|
| 38 |   uint_2 Swap;                /*  Sens de byte-swap      */
 | 
|---|
| 39 |   uint_2 Type;                /*  Type de suivi          */
 | 
|---|
| 40 |   int_4  FgCorrupt;           /*  test fichier corrompu  */
 | 
|---|
| 41 |   };
 | 
|---|
| 42 |  
 | 
|---|
| 43 | typedef  struct entetesuivi  ENTETESUIVI;
 | 
|---|
| 44 |  
 | 
|---|
| 45 | struct suivifip
 | 
|---|
| 46 |   {
 | 
|---|
| 47 |   FILE *fip;
 | 
|---|
| 48 |   FILECACHE *fcp;
 | 
|---|
| 49 |   ENTETESUIVI Head;
 | 
|---|
| 50 |   char *Nom;
 | 
|---|
| 51 |   int_4 OffsetMes;
 | 
|---|
| 52 |   int FgRW;
 | 
|---|
| 53 |   int FgSwap;
 | 
|---|
| 54 |   char* RecFmt[5];
 | 
|---|
| 55 |   };
 | 
|---|
| 56 |  
 | 
|---|
| 57 | typedef  struct suivifip  SUIVIFIP;
 | 
|---|
| 58 |  
 | 
|---|
| 59 |  
 | 
|---|
| 60 | /*    Pour l'IBMVM, Je redefinis les noms  (Pb = Max 8 car)   */
 | 
|---|
| 61 | #ifdef IBMVM
 | 
|---|
| 62 |  
 | 
|---|
| 63 | #define   SuiviCreate           SuvCreat
 | 
|---|
| 64 | #define   SuiviOpen             SuvOpen
 | 
|---|
| 65 | #define   SuiviClose            SuvClos
 | 
|---|
| 66 | #define   SuiviGetNbStars       SuvGNbSt
 | 
|---|
| 67 | #define   SuiviGetNbMesures     SuvGNMes
 | 
|---|
| 68 | #define   SuiviGetNbytstars     SuvGNByt
 | 
|---|
| 69 | #define   SuiviGetType          SuvGTyp
 | 
|---|
| 70 | #define   SuiviWriteComment     SuvWrCom
 | 
|---|
| 71 | #define   SuiviReadComment      SuvRdCom
 | 
|---|
| 72 | #define   SuiviWriteGlobInfo    SuvWrGlI
 | 
|---|
| 73 | #define   SuiviReadGlobInfo     SuvRdGlI
 | 
|---|
| 74 | #define   SuiviWriteStarInfo    SuvWrStI
 | 
|---|
| 75 | #define   SuiviReadStarInfo     SuvRdStI
 | 
|---|
| 76 | #define   SuiviAddMesure        SuvAdMes
 | 
|---|
| 77 | #define   SuiviWriteTimeInfo    SuvWrTmI
 | 
|---|
| 78 | #define   SuiviWriteMesure      SuvWrMes
 | 
|---|
| 79 | #define   SuiviReadTimeInfo     SuvRdTmI
 | 
|---|
| 80 | #define   SuiviReadMesures      SuvRdMes
 | 
|---|
| 81 |  
 | 
|---|
| 82 | #endif
 | 
|---|
| 83 |  
 | 
|---|
| 84 |  
 | 
|---|
| 85 | /*     Flag d'ouverture fichier  Lecture / Lecture-Ecriture    */
 | 
|---|
| 86 |  
 | 
|---|
| 87 | #define    SUOF_RO     0
 | 
|---|
| 88 | #define    SUOF_RW     1
 | 
|---|
| 89 | #define    SUOF_RO_MEM     10
 | 
|---|
| 90 | #define    SUOF_RW_MEM     11
 | 
|---|
| 91 | #define    SUOF_RO_MEM2    20
 | 
|---|
| 92 | #define    SUOF_RW_MEM2    21
 | 
|---|
| 93 | #define    SUOF_RO_MEM3    30
 | 
|---|
| 94 | #define    SUOF_RW_MEM3    31
 | 
|---|
| 95 | #define    SUOF_RO_MEM4    40
 | 
|---|
| 96 | #define    SUOF_RW_MEM4    41
 | 
|---|
| 97 |  
 | 
|---|
| 98 |  
 | 
|---|
| 99 | int SuiviCreate(char *filename, int typ, int rec0size, char *rec1fmt,
 | 
|---|
| 100 |                 char *rec2fmt, char *rec3fmt, char *rec4fmt, int nitem);
 | 
|---|
| 101 |  
 | 
|---|
| 102 | SUIVIFIP *SuiviOpen(char *filename, int rw);
 | 
|---|
| 103 |  
 | 
|---|
| 104 | int SuiviClose(SUIVIFIP *suivfip);
 | 
|---|
| 105 |  
 | 
|---|
| 106 | int_4 SuiviGetNbStars(SUIVIFIP *suivfip);
 | 
|---|
| 107 |  
 | 
|---|
| 108 | int_4 SuiviGetNbMesures(SUIVIFIP *suivfip);
 | 
|---|
| 109 |  
 | 
|---|
| 110 | int_4 SuiviGetNbytStars(SUIVIFIP *suivfip);
 | 
|---|
| 111 |  
 | 
|---|
| 112 | int_4 SuiviGetType(SUIVIFIP *suivfip);
 | 
|---|
| 113 | 
 | 
|---|
| 114 | int_4 SuiviGetSize(SUIVIFIP *suivfip);
 | 
|---|
| 115 | 
 | 
|---|
| 116 | int_4 SuiviPredictSize(SUIVIFIP *sfip, int nbst, int nbmes);
 | 
|---|
| 117 | 
 | 
|---|
| 118 | void  SuiviSetPrtLevel(int lev);
 | 
|---|
| 119 |  
 | 
|---|
| 120 | int SuiviWriteComment(SUIVIFIP *suivfip, char *buff);
 | 
|---|
| 121 |  
 | 
|---|
| 122 | int SuiviReadComment(SUIVIFIP *suivfip, char *buff);
 | 
|---|
| 123 |  
 | 
|---|
| 124 | int SuiviWriteGlobInfo(SUIVIFIP *suivfip, char *buff);
 | 
|---|
| 125 |  
 | 
|---|
| 126 | int SuiviReadGlobInfo(SUIVIFIP *suivfip, char *buff);
 | 
|---|
| 127 |  
 | 
|---|
| 128 | int SuiviWriteStarInfo(SUIVIFIP *suivfip, int_4 num, char *buff);
 | 
|---|
| 129 |  
 | 
|---|
| 130 | int SuiviReadStarInfo(SUIVIFIP *suivfip, int_4 num, char *buff);
 | 
|---|
| 131 |  
 | 
|---|
| 132 | int SuiviAddMesure(SUIVIFIP *suivfip, char *buff);
 | 
|---|
| 133 |  
 | 
|---|
| 134 | int SuiviWriteTimeInfo(SUIVIFIP *suivfip, int_4 numes, char *buff);
 | 
|---|
| 135 |  
 | 
|---|
| 136 | int SuiviWriteMesure(SUIVIFIP *suivfip, int_4 numet,
 | 
|---|
| 137 |                      int_4 nummes, char *buff);
 | 
|---|
| 138 |  
 | 
|---|
| 139 | int SuiviReadTimeInfo(SUIVIFIP *suivfip, int_4 debut,
 | 
|---|
| 140 |                       int_4 fin, char *buff);
 | 
|---|
| 141 |  
 | 
|---|
| 142 | int SuiviReadMesures(SUIVIFIP *suivfip, int_4 numet,
 | 
|---|
| 143 |                      int_4 debut, int_4 fin, char *buff);
 | 
|---|
| 144 | #ifdef __cplusplus
 | 
|---|
| 145 | }
 | 
|---|
| 146 | #endif
 | 
|---|
| 147 |  
 | 
|---|
| 148 | #endif
 | 
|---|
| 149 | 
 | 
|---|