• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

include/bio.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
00002 /* ====================================================================
00003  * Copyright (c) 1999-2004 Carnegie Mellon University.  All rights
00004  * reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer. 
00012  *
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in
00015  *    the documentation and/or other materials provided with the
00016  *    distribution.
00017  *
00018  * This work was supported in part by funding from the Defense Advanced 
00019  * Research Projects Agency and the National Science Foundation of the 
00020  * United States of America, and the CMU Sphinx Speech Consortium.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
00023  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00024  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00025  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
00026  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00028  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
00030  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00032  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * ====================================================================
00035  *
00036  */
00037 /*
00038  * bio.h -- Sphinx-3 binary file I/O functions.
00039  * 
00040  * **********************************************
00041  * CMU ARPA Speech Project
00042  *
00043  * Copyright (c) 1996 Carnegie Mellon University.
00044  * ALL RIGHTS RESERVED.
00045  * **********************************************
00046  * 
00047  * HISTORY
00048  * $Log: bio.h,v $
00049  * Revision 1.8  2005/06/21 20:40:46  arthchan2003
00050  * 1, Fixed doxygen documentation, 2, Add the $ keyword.
00051  *
00052  * Revision 1.5  2005/06/13 04:02:57  archan
00053  * Fixed most doxygen-style documentation under libs3decoder.
00054  *
00055  * Revision 1.4  2005/05/10 21:21:52  archan
00056  * Three functionalities added but not tested. Code on 1) addition/deletion of LM in mode 4. 2) reading text-based LM 3) Converting txt-based LM to dmp-based LM.
00057  *
00058  * Revision 1.3  2005/03/30 01:22:46  archan
00059  * Fixed mistakes in last updates. Add
00060  *
00061  * 
00062  * 28-Apr-1999  M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00063  *              Created.
00064  */
00065 
00066 
00067 #ifndef _S3_BIO_H_
00068 #define _S3_BIO_H_
00069 
00070 #include <stdio.h>
00071 
00072 /* Win32/WinCE DLL gunk */
00073 #include <sphinxbase_export.h>
00074 #include <prim_type.h>
00075 #include <byteorder.h>
00076 
00083 #ifdef __cplusplus
00084 extern "C" {
00085 #endif
00086 #if 0
00087 /* Fool Emacs. */
00088 }
00089 #endif
00090 
00091 #define BYTE_ORDER_MAGIC        (0x11223344)
00092 
00097 #if (__BIG_ENDIAN__)
00098 #define REVERSE_SENSE_SWAP_INT16(x)  x = ( (((x)<<8)&0x0000ff00) | (((x)>>8)&0x00ff) )
00099 #define REVERSE_SENSE_SWAP_INT32(x)  x = ( (((x)<<24)&0xff000000) | (((x)<<8)&0x00ff0000) | \
00100                          (((x)>>8)&0x0000ff00) | (((x)>>24)&0x000000ff) )
00101 #else
00102 #define REVERSE_SENSE_SWAP_INT16(x)
00103 #define REVERSE_SENSE_SWAP_INT32(x)
00104 
00105 #endif
00106 
00107 
00108 
00123 SPHINXBASE_EXPORT
00124 int32 bio_readhdr (FILE *fp,            
00125                    char ***name,        
00126                    char ***val,         
00127                    int32 *swap  
00128                    );
00134 SPHINXBASE_EXPORT
00135 int32 bio_writehdr_version (FILE *fp,  
00136                             char *version 
00137         );
00138 
00139 
00143 SPHINXBASE_EXPORT
00144 void bio_hdrarg_free (char **name,      
00145                       char **val        
00146                       );
00147 
00153 SPHINXBASE_EXPORT
00154 int32 bio_fread (void *buf,
00155                  int32 el_sz,
00156                  int32 n_el,
00157                  FILE *fp,              
00158                  int32 swap,            
00159                  uint32 *chksum 
00160                  );
00161 
00166 SPHINXBASE_EXPORT
00167 int32 bio_fwrite(void *buf,
00168                  int32 el_sz,
00169                  int32 n_el,
00170                  FILE *fp,              
00171                  int32 swap,            
00172                  uint32 *chksum 
00173                  );
00174 
00185 SPHINXBASE_EXPORT
00186 int32 bio_fread_1d (void **buf,         
00188                     size_t el_sz,       
00189                     uint32 *n_el,       
00190                     FILE *fp,           
00191                     int32 sw,           
00192                     uint32 *ck  
00193                     );
00194 
00205 SPHINXBASE_EXPORT
00206 int32 bio_fread_2d(void ***arr,
00207                    size_t e_sz,
00208                    uint32 *d1,
00209                    uint32 *d2,
00210                    FILE *fp,
00211                    uint32 swap,
00212                    uint32 *chksum);
00213 
00224 SPHINXBASE_EXPORT
00225 int32 bio_fread_3d(void ****arr,
00226                    size_t e_sz,
00227                    uint32 *d1,
00228                    uint32 *d2,
00229                    uint32 *d3,
00230                    FILE *fp,
00231                    uint32 swap,
00232                    uint32 *chksum);
00233 
00238 SPHINXBASE_EXPORT
00239 void bio_verify_chksum (FILE *fp,       
00240                         int32 byteswap, 
00241                         uint32 chksum   
00242                         );
00243 
00244 #ifdef __cplusplus
00245 }
00246 #endif
00247 
00248 #endif

Generated on Tue Aug 17 2010 for SphinxBase by  doxygen 1.7.1