| 1 | // IgorBin.h -- structures and #defines for dealing with Igor binary data. |
| 2 | |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
| 8 | // All structures written to disk are 2-byte-aligned. |
| 9 | #if GENERATINGPOWERPC |
| 10 | #pragma options align=mac68k |
| 11 | #endif |
| 12 | #ifdef WIN32 |
| 13 | #pragma pack(2) |
| 14 | #endif |
| 15 | |
| 16 | #ifdef WIN32 |
| 17 | typedef void** Handle; |
| 18 | #endif |
| 19 | |
| 20 | |
| 21 | // From IgorMath.h |
| 22 | #define NT_CMPLX 1 // Complex numbers. |
| 23 | #define NT_FP32 2 // 32 bit fp numbers. |
| 24 | #define NT_FP64 4 // 64 bit fp numbers. |
| 25 | #define NT_I8 8 // 8 bit signed integer. Requires Igor Pro 2.0 or later. |
| 26 | #define NT_I16 0x10 // 16 bit integer numbers. Requires Igor Pro 2.0 or later. |
| 27 | #define NT_I32 0x20 // 32 bit integer numbers. Requires Igor Pro 2.0 or later. |
| 28 | #define NT_UNSIGNED 0x40 // Makes above signed integers unsigned. Requires Igor Pro 3.0 or later. |
| 29 | |
| 30 | |
| 31 | // From wave.h |
| 32 | #define MAXDIMS 4 |
| 33 | |
| 34 | |
| 35 | // From binary.h |
| 36 | |
| 37 | typedef struct BinHeader1 { |
| 38 | short version; // Version number for backwards compatibility. |
| 39 | long wfmSize; // The size of the WaveHeader2 data structure plus the wave data plus 16 bytes of padding. |
| 40 | short checksum; // Checksum over this header and the wave header. |
| 41 | } BinHeader1; |
| 42 | |
| 43 | typedef struct BinHeader2 { |
| 44 | short version; // Version number for backwards compatibility. |
| 45 | long wfmSize; // The size of the WaveHeader2 data structure plus the wave data plus 16 bytes of padding. |
| 46 | long noteSize; // The size of the note text. |
| 47 | long pictSize; // Reserved. Write zero. Ignore on read. |
| 48 | short checksum; // Checksum over this header and the wave header. |
| 49 | } BinHeader2; |
| 50 | |
| 51 | typedef struct BinHeader3 { |
| 52 | short version; // Version number for backwards compatibility. |
| 53 | long wfmSize; // The size of the WaveHeader2 data structure plus the wave data plus 16 bytes of padding. |
| 54 | long noteSize; // The size of the note text. |
| 55 | long formulaSize; // The size of the dependency formula, if any. |
| 56 | long pictSize; // Reserved. Write zero. Ignore on read. |
| 57 | short checksum; // Checksum over this header and the wave header. |
| 58 | } BinHeader3; |
| 59 | |
| 60 | typedef struct BinHeader5 { |
| 61 | short version; // Version number for backwards compatibility. |
| 62 | short checksum; // Checksum over this header and the wave header. |
| 63 | long wfmSize; // The size of the WaveHeader5 data structure plus the wave data. |
| 64 | long formulaSize; // The size of the dependency formula, if any. |
| 65 | long noteSize; // The size of the note text. |
| 66 | long dataEUnitsSize; // The size of optional extended data units. |
| 67 | long dimEUnitsSize[MAXDIMS]; // The size of optional extended dimension units. |
| 68 | long dimLabelsSize[MAXDIMS]; // The size of optional dimension labels. |
| 69 | long sIndicesSize; // The size of string indicies if this is a text wave. |
| 70 | long optionsSize1; // Reserved. Write zero. Ignore on read. |
| 71 | long optionsSize2; // Reserved. Write zero. Ignore on read. |
| 72 | } BinHeader5; |
| 73 | |
| 74 | |
| 75 | // From wave.h |
| 76 | |
| 77 | #define MAX_WAVE_NAME2 18 // Maximum length of wave name in version 1 and 2 files. Does not include the trailing null. |
| 78 | #define MAX_WAVE_NAME5 31 // Maximum length of wave name in version 5 files. Does not include the trailing null. |
| 79 | #define MAX_UNIT_CHARS 3 |
| 80 | |
| 81 | // Header to an array of waveform data. |
| 82 | |
| 83 | struct WaveHeader2 { |
| 84 | short type; // See types (e.g. NT_FP64) above. Zero for text waves. |
| 85 | struct WaveHeader2 **next; // Used in memory only. Write zero. Ignore on read. |
| 86 | |
| 87 | char bname[MAX_WAVE_NAME2+2]; // Name of wave plus trailing null. |
| 88 | short whVersion; // Write 0. Ignore on read. |
| 89 | short srcFldr; // Used in memory only. Write zero. Ignore on read. |
| 90 | Handle fileName; // Used in memory only. Write zero. Ignore on read. |
| 91 | |
| 92 | char dataUnits[MAX_UNIT_CHARS+1]; // Natural data units go here - null if none. |
| 93 | char xUnits[MAX_UNIT_CHARS+1]; // Natural x-axis units go here - null if none. |
| 94 | |
| 95 | long npnts; // Number of data points in wave. |
| 96 | |
| 97 | short aModified; // Used in memory only. Write zero. Ignore on read. |
| 98 | double hsA,hsB; // X value for point p = hsA*p + hsB |
| 99 | |
| 100 | short wModified; // Used in memory only. Write zero. Ignore on read. |
| 101 | short swModified; // Used in memory only. Write zero. Ignore on read. |
| 102 | short fsValid; // True if full scale values have meaning. |
| 103 | double topFullScale,botFullScale; // The min full scale value for wave. |
| 104 | |
| 105 | char useBits; // Used in memory only. Write zero. Ignore on read. |
| 106 | char kindBits; // Reserved. Write zero. Ignore on read. |
| 107 | void **formula; // Used in memory only. Write zero. Ignore on read. |
| 108 | long depID; // Used in memory only. Write zero. Ignore on read. |
| 109 | unsigned long creationDate; // DateTime of creation. Not used in version 1 files. |
| 110 | char wUnused[2]; // Reserved. Write zero. Ignore on read. |
| 111 | |
| 112 | unsigned long modDate; // DateTime of last modification. |
| 113 | Handle waveNoteH; // Used in memory only. Write zero. Ignore on read. |
| 114 | |
| 115 | float wData[4]; // The start of the array of waveform data. |
| 116 | }; |
| 117 | typedef struct WaveHeader2 WaveHeader2; |
| 118 | typedef WaveHeader2 *WavePtr2; |
| 119 | typedef WavePtr2 *waveHandle2; |
| 120 | |
| 121 | |
| 122 | struct WaveHeader5 { |
| 123 | struct WaveHeader5 **next; // link to next wave in linked list. |
| 124 | |
| 125 | unsigned long creationDate; // DateTime of creation. |
| 126 | unsigned long modDate; // DateTime of last modification. |
| 127 | |
| 128 | long npnts; // Total number of points (multiply dimensions up to first zero). |
| 129 | short type; // See types (e.g. NT_FP64) above. Zero for text waves. |
| 130 | short dLock; // Reserved. Write zero. Ignore on read. |
| 131 | |
| 132 | char whpad1[6]; // Reserved. Write zero. Ignore on read. |
| 133 | short whVersion; // Write 1. Ignore on read. |
| 134 | char bname[MAX_WAVE_NAME5+1]; // Name of wave plus trailing null. |
| 135 | long whpad2; // Reserved. Write zero. Ignore on read. |
| 136 | struct DataFolder **dFolder; // Used in memory only. Write zero. Ignore on read. |
| 137 | |
| 138 | // Dimensioning info. [0] == rows, [1] == cols etc |
| 139 | long nDim[MAXDIMS]; // Number of of items in a dimension -- 0 means no data. |
| 140 | double sfA[MAXDIMS]; // Index value for element e of dimension d = sfA[d]*e + sfB[d]. |
| 141 | double sfB[MAXDIMS]; |
| 142 | |
| 143 | // SI units |
| 144 | char dataUnits[MAX_UNIT_CHARS+1]; // Natural data units go here - null if none. |
| 145 | char dimUnits[MAXDIMS][MAX_UNIT_CHARS+1]; // Natural dimension units go here - null if none. |
| 146 | |
| 147 | short fsValid; // TRUE if full scale values have meaning. |
| 148 | short whpad3; // Reserved. Write zero. Ignore on read. |
| 149 | double topFullScale,botFullScale; // The max and max full scale value for wave. |
| 150 | |
| 151 | Handle dataEUnits; // Used in memory only. Write zero. Ignore on read. |
| 152 | Handle dimEUnits[MAXDIMS]; // Used in memory only. Write zero. Ignore on read. |
| 153 | Handle dimLabels[MAXDIMS]; // Used in memory only. Write zero. Ignore on read. |
| 154 | |
| 155 | Handle waveNoteH; // Used in memory only. Write zero. Ignore on read. |
| 156 | long whUnused[16]; // Reserved. Write zero. Ignore on read. |
| 157 | |
| 158 | // The following stuff is considered private to Igor. |
| 159 | |
| 160 | short aModified; // Used in memory only. Write zero. Ignore on read. |
| 161 | short wModified; // Used in memory only. Write zero. Ignore on read. |
| 162 | short swModified; // Used in memory only. Write zero. Ignore on read. |
| 163 | |
| 164 | char useBits; // Used in memory only. Write zero. Ignore on read. |
| 165 | char kindBits; // Reserved. Write zero. Ignore on read. |
| 166 | void **formula; // Used in memory only. Write zero. Ignore on read. |
| 167 | long depID; // Used in memory only. Write zero. Ignore on read. |
| 168 | |
| 169 | short whpad4; // Reserved. Write zero. Ignore on read. |
| 170 | short srcFldr; // Used in memory only. Write zero. Ignore on read. |
| 171 | Handle fileName; // Used in memory only. Write zero. Ignore on read. |
| 172 | |
| 173 | long **sIndices; // Used in memory only. Write zero. Ignore on read. |
| 174 | |
| 175 | float wData[1]; // The start of the array of data. Must be 64 bit aligned. |
| 176 | }; |
| 177 | typedef struct WaveHeader5 WaveHeader5; |
| 178 | typedef WaveHeader5 *WavePtr5; |
| 179 | typedef WavePtr5 *WaveHandle5; |
| 180 | |
| 181 | |
| 182 | #if GENERATINGPOWERPC |
| 183 | #pragma options align=reset |
| 184 | #endif |
| 185 | #ifdef WIN32 |
| 186 | #pragma pack() |
| 187 | #endif |
| 188 | // All structures written to disk are 2-byte-aligned. |
| 189 | |
| 190 | #ifdef __cplusplus |
| 191 | } |
| 192 | #endif |