desc.h

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002 
00003     BUFR encoding and decoding software and library
00004     Copyright (c) 2007,  Institute of Broadband Communication, TU-Graz
00005     on behalf of EUMETNET OPERA, http://www.knmi.nl/opera
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; version 2.1 
00010     of the License.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00020 
00021 ----------------------------------------------------------------------------
00022 
00023 FILE:          DESC.H
00024 IDENT:         $Id: desc.h,v 1.9 2007/12/18 14:40:58 fuxi Exp $
00025 
00026 AUTHOR:        Konrad Koeck
00027                Institute of Communication and Wave Propagation, 
00028                Technical University Graz, Austria
00029 
00030 VERSION NUMBER:3.0
00031 
00032 DATE CREATED:  18-DEC-2001
00033 
00034 STATUS:        DEVELOPMENT FINISHED
00035 
00036 
00037 FUNCTIONAL DESCRIPTION:
00038 -----------------------
00039 Includefile that defines the data-structures needed to hold the supported
00040 data-descriptors. Function-prototype for READDESC.
00041 
00042 AMENDMENT RECORD:
00043 
00044 ISSUE       DATE            SCNREF      CHANGE DETAILS
00045 -----       ----            ------      --------------
00046 V2.0        18-DEC-2001     Koeck       Initial Issue
00047 
00048 $Log: desc.h,v $
00049 Revision 1.9  2007/12/18 14:40:58  fuxi
00050 added licence header
00051 
00052 Revision 1.8  2007/12/07 08:39:24  fuxi
00053 update to version 3.0
00054 
00055 Revision 1.7  2005/04/04 14:56:09  helmutp
00056 update to version 2.3
00057 
00058 Revision 1.6  2003/06/11 08:43:03  helmutp
00059 added serial number to desc struct (for local table overruling)
00060 
00061 Revision 1.5  2003/06/06 11:58:21  helmutp
00062 changed read_tables
00063 
00064 Revision 1.4  2003/03/27 17:17:39  helmutp
00065 update to version 2.2
00066 
00067 Revision 1.3  2003/03/13 17:03:31  helmutp
00068 define local table names, added search key and optional descriptors
00069 
00070 Revision 1.2  2003/03/06 17:12:32  helmutp
00071 update to version 2.1
00072 
00073 Revision 1.1  2003/02/28 13:41:12  helmutp
00074 Initial revision
00075 
00076 --------------------------------------------------------------------------- */
00077 
00088 #ifndef DESC_H_INCLUDED
00089 #define DESC_H_INCLUDED
00090 
00091 typedef double varfl;    
00108 #define MISSVAL 99999.999999
00109 
00110 /*===========================================================================*/
00111 /* definitions of data-structures                                            */
00112 /*===========================================================================*/
00120 typedef struct sect_1 {   
00121   int mtab;      
00125   int subcent;   
00126   int gencent;   
00127   int updsequ;   
00132   int opsec;     
00137   int dcat;      
00138   int dcatst;    
00142   int idcatst;   
00146   int vmtab;     
00147   int vltab;     
00148   int year;      
00153   int mon;       
00154   int day;       
00155   int hour;      
00156   int min;       
00157   int sec;       
00158 } sect_1_t;
00159 
00162 typedef struct dd {         
00163     int f; 
00164     int x; 
00165     int y; 
00166 } dd;
00167 
00170 typedef struct del {      
00171   dd d;                      
00172   char *unit;                
00173   int scale;                 
00174   varfl refval;              
00175   int dw;                    
00176   char *elname;              
00177 } del;
00178 
00181 typedef struct dseq {        
00182   dd d;                      
00183   int nel;                   
00184   dd *del;                   
00185 } dseq;
00186 
00190 typedef struct _desc {       
00191   int id;                    
00192   del *el;                   
00193   dseq *seq;                 
00194   int key;                   
00195   int nr;                    
00196 } desc;
00197 
00198 
00199 #define SEQDESC 0            
00201 #define ELDESC  1            
00205 /*===========================================================================*/
00206 /* variables needed to hold data descriptors                                 */
00207 /* If READDESC_MAIN is not defined all variables are declared as external.   */
00208 /* So you sould define READDESC_MAIN only in one function. Otherwise you will*/
00209 /* have this symbols multiple defined.                                       */
00210 /*===========================================================================*/
00211 
00212 #define MAXDESC   2000       
00214 #define OPTDESC   5          /* Number of optional descriptors at end */
00215 
00216 #ifdef READDESC_MAIN
00217   int ndes;                 
00218   desc *des[MAXDESC+OPTDESC];
00219   int dw = 128;              
00220   int sc = 128;             
00221   int addfields = 0;        
00222   int ccitt_special = 0;     
00223   int cf_special = 0;       
00224   int add_f_special = 0;     
00225   int _desc_special = 0;     
00226 #else
00227 
00230     extern int ndes; 
00231     
00240     extern desc *des[MAXDESC+OPTDESC];
00241 
00248     extern int dw;
00249 
00256     extern int sc;
00257 
00266     extern int addfields;
00267 
00275     extern int ccitt_special;
00276 
00277     /* \brief Special index for change of reference field.
00278        
00279     \todo implement this
00280     */
00281     extern int cf_special;
00282 
00290     extern int add_f_special;
00291 
00299     extern int _desc_special;
00300 
00301 #endif
00302 
00303 /*===========================================================================*/
00304 /* The following definition will be used to have either                      */
00305 /* function-prototyping in ANSI-C e.g.: void abc (int a, int b);   or        */
00306 /* Kernighan-Ritchie-prototyping link   void abc ();                         */
00307 /*===========================================================================*/
00308 
00309 #if defined (NON_ANSI)
00310 #define P0
00311 #define P1(a)                
00312 #define P2(a,b)              
00313 #define P3(a,b,c)            
00314 #define P4(a,b,c,d)          
00315 #define P5(a,b,c,d,e)        
00316 #define P6(a,b,c,d,e,f)      
00317 #define P7(a,b,c,d,e,f,g)    
00318 #define P8(a,b,c,d,e,f,g,h)  
00319 #else
00320 #define P0                   void
00321 #define P1(a)                a
00322 #define P2(a,b)              a,b
00323 #define P3(a,b,c)            a,b,c
00324 #define P4(a,b,c,d)          a,b,c,d
00325 #define P5(a,b,c,d,e)        a,b,c,d,e
00326 #define P6(a,b,c,d,e,f)      a,b,c,d,e,f
00327 #define P7(a,b,c,d,e,f,g)    a,b,c,d,e,f,g
00328 #define P8(a,b,c,d,e,f,g,h)  a,b,c,d,e,f,g,h
00329 #endif
00330 
00331 /* for compilers having SEEK_CUR and SEEK_SET not defined: */
00332 
00333 #ifndef SEEK_SET
00334 #define SEEK_SET 0
00335 #endif
00336 #ifndef SEEK_END
00337 #define SEEK_END 2
00338 #endif
00339 
00340 /*===========================================================================*/
00341 /* function prototype                                                        */
00342 /*===========================================================================*/
00343 
00344 int read_tab_b (char *fname);
00345 int read_tab_d (char *fname);
00346 char *get_unit (dd *d);
00347 int get_index (int typ, dd *d);
00348 void free_descs (void);
00349 void trim (char *buf);
00350 int read_tables (char *dir, int vm, int vl, int subcenter, int gencenter);
00351 void show_desc (int f, int x, int y);
00352 int desc_is_codetable (int ind);
00353 int desc_is_flagtable (int ind);
00354 
00355 #endif
00356 
00357 /* end of file */

Generated on Tue Dec 18 16:52:45 2007 for OPERA BUFR software by  doxygen 1.5.4