The R Project SVN R

Rev

Rev 13365 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13365 Rev 26207
Line 1... Line 1...
1
/*
1
/*
2
 *  BDX: Binary Data eXchange format library
2
 *  BDX: Binary Data eXchange format library
3
 *  Copyright (C) 1999--2001 Thomas Baier
3
 *  Copyright (C) 1999--2001 Thomas Baier
4
 * 
4
 *
5
 *  This library is free software; you can redistribute it and/or
5
 *  This library is free software; you can redistribute it and/or
6
 *  modify it under the terms of the GNU Library General Public
6
 *  modify it under the terms of the GNU Library General Public
7
 *  License as published by the Free Software Foundation; either
7
 *  License as published by the Free Software Foundation; either
8
 *  version 2 of the License, or (at your option) any later version.
8
 *  version 2 of the License, or (at your option) any later version.
9
 * 
9
 *
10
 *  This library is distributed in the hope that it will be useful,
10
 *  This library is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 *  Library General Public License for more details.
13
 *  Library General Public License for more details.
14
 * 
14
 *
15
 *  You should have received a copy of the GNU Library General Public
15
 *  You should have received a copy of the GNU Library General Public
16
 *  License along with this library; if not, write to the Free
16
 *  License along with this library; if not, write to the Free
17
 *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17
 *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18
 *  MA 02111-1307, USA
18
 *  MA 02111-1307, USA
19
 *
19
 *
20
 *  $Id: bdx.h,v 1.5 2001/04/05 09:42:35 ripley Exp $
20
 *  $Id: bdx.h,v 1.6 2003/09/13 15:14:09 murdoch Exp $
21
 */
21
 */
22
 
22
 
23
#ifndef _BDX_H_
23
#ifndef _BDX_H_
24
#define _BDX_H_
24
#define _BDX_H_
25
 
25
 
26
// BDX: Binary Data eXchange Format
26
/* BDX: Binary Data eXchange Format */
27
 
27
 
28
/*
28
/*
29
 * BDX version information
29
 * BDX version information
30
 *
30
 *
31
 * 1 ... first version, never set
31
 * 1 ... first version, never set
Line 122... Line 122...
122
 *   single precision floating point, double precision floating point,
122
 *   single precision floating point, double precision floating point,
123
 *   complex and string) or compound types (always reduced to scalars)
123
 *   complex and string) or compound types (always reduced to scalars)
124
 */
124
 */
125
#define BDX_TYPESPEC_SCALAR 0x00000001
125
#define BDX_TYPESPEC_SCALAR 0x00000001
126
#define BDX_TYPESPEC_ARRAY  0x00000002
126
#define BDX_TYPESPEC_ARRAY  0x00000002
127
// more to come
127
/* more to come */
128
 
128
 
129
#define BDX_SCALAR_BOOL     0x00000001
129
#define BDX_SCALAR_BOOL     0x00000001
130
//#define BDX_SCALAR_SHORT    0x00000002
130
/*#define BDX_SCALAR_SHORT    0x00000002 */
131
#define BDX_SCALAR_LONG     0x00000003
131
#define BDX_SCALAR_LONG     0x00000003
132
//#define BDX_SCALAR_FLOAT    0x00000004
132
/*#define BDX_SCALAR_FLOAT    0x00000004 */
133
#define BDX_SCALAR_DOUBLE   0x00000005
133
#define BDX_SCALAR_DOUBLE   0x00000005
134
//#define BDX_SCALAR_COMPLEX  0x00000006
134
/*#define BDX_SCALAR_COMPLEX  0x00000006 */
135
//#define BDX_SCALAR_CHAR     0x00000007
135
/*#define BDX_SCALAR_CHAR     0x00000007 */
136
//#define BDX_SCALAR_STRING   0x00000008
136
/*#define BDX_SCALAR_STRING   0x00000008 */
137
//#define BDX_SCALAR_SIGNED   0x80000000
137
/*#define BDX_SCALAR_SIGNED   0x80000000 */
138
 
138
 
139
// mapping from BDX_SCALAR_* to C types
139
/* mapping from BDX_SCALAR_* to C types */
140
typedef unsigned long BDX_Scalar_BOOL;
140
typedef unsigned long BDX_Scalar_BOOL;
141
typedef long BDX_Scalar_LONG;
141
typedef long BDX_Scalar_LONG;
142
typedef double BDX_Scalar_DOUBLE;
142
typedef double BDX_Scalar_DOUBLE;
143
 
143
 
144
// some typedefs for commonly used types
144
/* some typedefs for commonly used types */
145
typedef unsigned long BDX_Length;
145
typedef unsigned long BDX_Length;
146
typedef unsigned long BDX_Offset;
146
typedef unsigned long BDX_Offset;
147
typedef unsigned long BDX_Compound_Type;
147
typedef unsigned long BDX_Compound_Type;
148
typedef unsigned long BDX_Scalar_Specification;
148
typedef unsigned long BDX_Scalar_Specification;
149
typedef long BDX_Dimension;
149
typedef long BDX_Dimension;
150
typedef unsigned long BDX_Count;
150
typedef unsigned long BDX_Count;
151
typedef unsigned long BDX_Magic;
151
typedef unsigned long BDX_Magic;
152
 
152
 
153
// a type specification
153
/* a type specification */
154
typedef struct _BDX_Type_Specification
154
typedef struct _BDX_Type_Specification
155
{
155
{
156
  BDX_Compound_Type type;
156
  BDX_Compound_Type type;
157
  //  BDX_Offset        type_declaration;
157
  /*  BDX_Offset        type_declaration; */
158
} BDX_Type_Specification;
158
} BDX_Type_Specification;
159
 
159
 
160
// basic structure
160
/* basic structure */
161
typedef struct _BDX_Data
161
typedef struct _BDX_Data
162
{
162
{
163
  BDX_Magic              magic;
163
  BDX_Magic              magic;
164
  BDX_Length             length;
164
  BDX_Length             length;
165
  BDX_Type_Specification type_specification;
165
  BDX_Type_Specification type_specification;
166
  // depending on type_specification, either BDX_Array_Specificaton or 
166
  /* depending on type_specification, either BDX_Array_Specificaton or */
167
  // BDX_Scalar_Specification follows. After all type specifications, the
167
  /* BDX_Scalar_Specification follows. After all type specifications, the */
168
  // data follows
168
  /* data follows */
169
} BDX_Data;
169
} BDX_Data;
170
 
170
 
171
 
171
 
172
// bounds for an array type specification
172
/* bounds for an array type specification */
173
typedef struct _BDX_Array_Bounds
173
typedef struct _BDX_Array_Bounds
174
{
174
{
175
  BDX_Dimension lower;
175
  BDX_Dimension lower;
176
  BDX_Dimension upper;
176
  BDX_Dimension upper;
177
} BDX_Array_Bounds;
177
} BDX_Array_Bounds;
178
 
178
 
179
// the array type specification itself
179
/* the array type specification itself */
180
typedef struct _BDX_Array_Specification
180
typedef struct _BDX_Array_Specification
181
{
181
{
182
  BDX_Count                dimensions;
182
  BDX_Count                dimensions;
183
  //  BDX_Type_Specification base_type_specification;
183
  /*  BDX_Type_Specification base_type_specification; */
184
  // simplificaton: the base type is a scalar type at the moment
184
  /* simplificaton: the base type is a scalar type at the moment */
185
  BDX_Scalar_Specification base_type;
185
  BDX_Scalar_Specification base_type;
186
  BDX_Array_Bounds         bounds[1];
186
  BDX_Array_Bounds         bounds[1];
187
  // after dimensions bounds array members, the rest of the type specification
187
  /* after dimensions bounds array members, the rest of the type specification */
188
  // follows. The the data...
188
  /* follows. The the data... */
189
} BDX_Array_Specification;
189
} BDX_Array_Specification;
190
 
190
 
191
 
191
 
192
/*
192
/*
193
 * examples:
193
 * examples: