| 1 | /* Data structure and equates relating to Igor Pro packed files. |
| 2 | See Igor Pro Technical Note PTN003 for details. |
| 3 | */ |
| 4 | |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | /* All structures written to disk are 2 byte-aligned */ |
| 10 | #if GENERATINGPOWERPC |
| 11 | #pragma options align=mac68k |
| 12 | #endif |
| 13 | #ifdef _WINDOWS_ |
| 14 | #pragma pack(2) |
| 15 | #endif |
| 16 | |
| 17 | #define CR_STR "\015" // CR is the line terminator used by Igor. |
| 18 | |
| 19 | #define IGOR_CREATOR_CODE 'IGR0' // Mac file creator code (zero at the end). |
| 20 | #define IGOR_PACKED_FILE_TYPE 'IGsU' // Mac file type code for packed experiment file. |
| 21 | #define IGOR_PACKED_STATIONERY_TYPE 'IGsS' // Mac file type code for packed experiment stationery file. |
| 22 | |
| 23 | |
| 24 | /* *** Packed File Structures *** */ |
| 25 | |
| 26 | /* The Igor Pro packed file consists of a series of records. |
| 27 | Each record starts with a record header followed by the record data. |
| 28 | The record header identifies the type and size of the record data. |
| 29 | |
| 30 | New types may be added in the future. When reading a packed file, |
| 31 | you should skip over records whose types you do not know. |
| 32 | */ |
| 33 | |
| 34 | enum PackedFileRecordType { |
| 35 | kUnusedRecord = 0, |
| 36 | kVariablesRecord, // 1: Contains system numeric variables (e.g., K0) and user numeric and string variables. |
| 37 | kHistoryRecord, // 2: Contains the experiment's history as plain text. |
| 38 | kWaveRecord, // 3: Contains the data for a wave |
| 39 | kRecreationRecord, // 4: Contains the experiment's recreation procedures as plain text. |
| 40 | kProcedureRecord, // 5: Contains the experiment's main procedure window text as plain text. |
| 41 | kUnused2Record, |
| 42 | kGetHistoryRecord, // 6: Not a real record but rather, a message to go back and read the history text. |
| 43 | kPackedFileRecord, // 7: Contains the data for a procedure file or notebook in a packed form. |
| 44 | kDataFolderStartRecord, // 8: Marks the start of a new data folder. |
| 45 | kDataFolderEndRecord // 10: Marks the end of a data folder. |
| 46 | |
| 47 | /* Igor writes other kinds of records in a packed experiment file, for storing |
| 48 | things like pictures, page setup records, and miscellaneous settings. The |
| 49 | format for these records is quite complex and is not described in PTN003. |
| 50 | If you are writing a program to read packed files, you must skip any record |
| 51 | with a record type that is not listed above. |
| 52 | */ |
| 53 | }; |
| 54 | |
| 55 | typedef struct PackedFileRecordHeader { |
| 56 | unsigned short recordType; /* Record type plus superceded flag. */ |
| 57 | short version; /* Version information depends on the type of record. */ |
| 58 | long numDataBytes; /* Number of data bytes in the record following this record header. */ |
| 59 | } PackedFileRecordHeader, *PackedFileRecordHeaderPtr; |
| 60 | |
| 61 | #define PACKEDRECTYPE_MASK 0x7FFF /* Record type = (recordType & PACKEDREC_TYPE_MASK) */ |
| 62 | #define SUPERCEDED_MASK 0x8000 /* Bit is set if the record is superceded by a later record in the packed file. */ |
| 63 | |
| 64 | |
| 65 | |
| 66 | #if GENERATINGPOWERPC |
| 67 | #pragma options align=reset |
| 68 | #endif |
| 69 | #ifdef _WINDOWS_ |
| 70 | #pragma pack() |
| 71 | #endif |
| 72 | /* All structures written to disk are 2 byte-aligned */ |
| 73 | |
| 74 | #ifdef __cplusplus |
| 75 | } |
| 76 | #endif |