Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
niml_private.h
Go to the documentation of this file.00001 #ifndef _NIML_PRIVATE_HEADER_FILE_
00002 #define _NIML_PRIVATE_HEADER_FILE_
00003
00004 #include "niml.h"
00005
00006 #define USE_NEW_IOFUN
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #define NIML_DEBUG
00019
00020 #include <stdarg.h>
00021
00022 extern FILE *dfp ;
00023 extern void NI_dpr( char * , ... ) ;
00024
00025
00026
00027
00028
00029 typedef struct {
00030 int nattr ;
00031 int empty ;
00032 char *name ;
00033 char **lhs ;
00034 char **rhs ;
00035 } header_stuff ;
00036
00037
00038
00039 typedef struct { int i,j ; } intpair ;
00040
00041
00042
00043 typedef struct { int num; int *ar; } int_array ;
00044
00045
00046
00047 extern void NI_stream_close_keep( NI_stream_type * ,int ) ;
00048
00049 extern int string_index( char *targ, int nstr, char *str[] ) ;
00050 extern int unescape_inplace( char *str ) ;
00051 extern char * quotize_string( char *str ) ;
00052 extern char * quotize_string_vector( int num , char **str , char sep ) ;
00053 extern char * quotize_int_vector( int num , int *vec , char sep ) ;
00054 extern char * quotize_float_vector( int num , float *vec , char sep ) ;
00055 extern int NI_is_name( char *str ) ;
00056 extern char * trailname( char *fname , int lev ) ;
00057
00058
00059
00060 extern int dtable_mode ;
00061 extern byte dtable[256] ;
00062 extern int linelen ;
00063 extern int ncrlf ;
00064 extern int nocrlf ;
00065
00066 #define B64_goodchar(c) (dtable[c] != 0x80)
00067
00068 #define B64_EOL1 '\r'
00069 #define B64_EOL2 '\n'
00070
00071
00072
00073 #define B64_encode3(a,b,c,w,x,y,z) \
00074 ( w = dtable[(a)>>2] , \
00075 x = dtable[((a & 3) << 4) | (b >> 4)] , \
00076 y = dtable[((b & 0xF) << 2) | (c >> 6)] , \
00077 z = dtable[c & 0x3F] )
00078
00079
00080
00081 #define B64_encode2(a,b,w,x,y,z) \
00082 ( B64_encode3(a,b,0,w,x,y,z) , z = '=' )
00083
00084
00085
00086 #define B64_encode1(a,w,x,y,z) \
00087 ( B64_encode3(a,0,0,w,x,y,z) , y=z = '=' )
00088
00089
00090
00091 #define B64_decode4(w,x,y,z,a,b,c) \
00092 ( a = (dtable[w] << 2) | (dtable[x] >> 4) , \
00093 b = (dtable[x] << 4) | (dtable[y] >> 2) , \
00094 c = (dtable[y] << 6) | dtable[z] )
00095
00096
00097
00098 #define B64_decode_count(w,x,y,z) \
00099 ( ((w)=='='||(x)=='=') ? 0 \
00100 : ((y)=='=') ? 1 \
00101 : ((z)=='=') ? 2 : 3 )
00102
00103 extern void load_encode_table(void) ;
00104 extern void load_decode_table(void) ;
00105
00106
00107
00108 typedef unsigned char *POINTER;
00109 typedef unsigned short int UINT2;
00110 typedef unsigned long int UINT4;
00111
00112
00113
00114 typedef struct {
00115 UINT4 state[4];
00116 UINT4 count[2];
00117 unsigned char buffer[64];
00118 } MD5_CTX;
00119
00120
00121
00122 extern void MD5Init (MD5_CTX *);
00123 extern void MD5Update (MD5_CTX *, unsigned char *, unsigned int);
00124 extern void MD5Final (unsigned char [16], MD5_CTX *);
00125
00126
00127
00128 extern int typedef_nib ;
00129 extern int typedef_num ;
00130 extern char ** typedef_nam ;
00131 extern char ** typedef_typ ;
00132 extern char ** typedef_dim ;
00133
00134
00135
00136 #define IS_STRING_CHAR(c) ( isgraph(c) && !isspace(c) && \
00137 (c) != '>' && (c) != '/' && \
00138 (c) != '=' && (c) != '<' )
00139
00140
00141
00142 #define IS_QUOTE_CHAR(c) ( (c) == '"' || (c) == '\'' )
00143
00144
00145
00146 #define IS_NAME_CHAR(c) \
00147 (isalnum(c) || (c)=='_' || (c)=='.' || (c)=='-' || (c)==':')
00148
00149 extern void destroy_header_stuff( header_stuff *hs ) ;
00150 extern intpair find_string( int nst, int nch, char *ch ) ;
00151 extern header_stuff * parse_header_stuff( int ndat, char *dat, int *nused ) ;
00152 extern intpair decode_type_field( char *tf ) ;
00153 extern int_array * decode_dimen_string( char *ds ) ;
00154 extern int_array * decode_type_string( char *ts ) ;
00155 extern char NI_type_char( int typ ) ;
00156 extern void enhance_header_stuff( header_stuff *hs ) ;
00157 extern char * get_header_attribute( header_stuff *hs , char *attname ) ;
00158
00159
00160
00161 extern NI_element * make_empty_data_element ( header_stuff *hs ) ;
00162 extern NI_group * make_empty_group_element( header_stuff *hs ) ;
00163 extern void NI_fill_vector_row( NI_element *nel , int row , char *buf ) ;
00164
00165 extern int NI_stream_writestring( NI_stream_type *ns , char *str ) ;
00166 extern int NI_stream_fillbuf( NI_stream_type *ns, int minread, int msec ) ;
00167
00168 extern void NI_reset_buffer( NI_stream_type * ) ;
00169 extern int NI_decode_one_double( NI_stream_type *, double *, int ) ;
00170 extern int NI_decode_one_string( NI_stream_type *, char ** , int ) ;
00171
00172 #endif