| 1 | /* |
| 2 | * chunk.h |
| 3 | * |
| 4 | * [Generated from chunk, 25 September 1996] |
| 5 | */ |
| 6 | |
| 7 | #if !defined(__CC_NORCROFT) || !defined(__arm) |
| 8 | #error You must use the Norcroft ARM Compiler for Sapphire programs |
| 9 | #endif |
| 10 | |
| 11 | #pragma include_only_once |
| 12 | #pragma force_top_level |
| 13 | |
| 14 | #ifndef __chunk_h |
| 15 | #define __chunk_h |
| 16 | |
| 17 | #ifndef __sapphire_h |
| 18 | #include "sapphire.h" |
| 19 | #endif |
| 20 | |
| 21 | /*----- Overview ----------------------------------------------------------* |
| 22 | * |
| 23 | * Functions provided: |
| 24 | * |
| 25 | * chunk_create |
| 26 | * chunk_destroy |
| 27 | * chunk_claim |
| 28 | * chunk_makeBinary |
| 29 | * chunk_read |
| 30 | * chunk_enum |
| 31 | * chunk_save |
| 32 | */ |
| 33 | |
| 34 | /* --- chunk_create --- * |
| 35 | * |
| 36 | * On entry: -- |
| 37 | * |
| 38 | * On exit: R0 == chunk file handle |
| 39 | * May return an error |
| 40 | * |
| 41 | * Use: Creates a new chunk file structure and returns a handle to |
| 42 | * it. |
| 43 | */ |
| 44 | |
| 45 | extern routine chunk_create; |
| 46 | |
| 47 | /* --- chunk_destroy --- * |
| 48 | * |
| 49 | * On entry: R0 == chunk file handle |
| 50 | * |
| 51 | * On exit: -- |
| 52 | * |
| 53 | * Use: Removes a chunk file structure from memory. Chunk data in |
| 54 | * flex blocks is freed; chunk claimers who free flex blocks |
| 55 | * should clear the anchors to 0. |
| 56 | */ |
| 57 | |
| 58 | extern routine chunk_destroy; |
| 59 | |
| 60 | /* --- chunk_claim --- * |
| 61 | * |
| 62 | * On entry: R0 == chunk file handle |
| 63 | * R1 == pointer to chunk name |
| 64 | * R2 == pointer to saver routine, or 0 for none, or -1 for no |
| 65 | * change |
| 66 | * R3 == R10 value to pass to saver |
| 67 | * R4 == R12 value to pass to saver |
| 68 | * |
| 69 | * On exit: R1 == chunk handle/anchor |
| 70 | * CS if the chunk already existed |
| 71 | * May return an error |
| 72 | * |
| 73 | * Use: Claims a chunk, installing a save handler for it. The chunk |
| 74 | * handle returned is actually the address of a flex anchor for |
| 75 | * the chunk's data (use flex_size to find the block's size). |
| 76 | * If the save handle is 0, the data in the flex block (which |
| 77 | * may be modified) is saved directly from the block. Otherwise |
| 78 | * the save routine is expected to save its data, using xsave. |
| 79 | * |
| 80 | * The anchor is followed by 3 unused words -- you can use them |
| 81 | * for whatever you want. |
| 82 | * |
| 83 | * Warning: this routine may move flex blocks. |
| 84 | */ |
| 85 | |
| 86 | extern routine chunk_claim; |
| 87 | |
| 88 | /* --- chunk_makeBinary --- * |
| 89 | * |
| 90 | * On entry: R0 == chunk file handle |
| 91 | * R1 == chunk handle |
| 92 | * |
| 93 | * On exit: -- |
| 94 | * |
| 95 | * Use: Marks a given chunk as containing binary data. |
| 96 | */ |
| 97 | |
| 98 | extern routine chunk_makeBinary; |
| 99 | |
| 100 | /* --- chunk_read --- * |
| 101 | * |
| 102 | * On entry: R0 == chunk file handle |
| 103 | * R1 == address of a flex anchor |
| 104 | * |
| 105 | * On exit: May return an error |
| 106 | * |
| 107 | * Use: Merges the data contained in the flex block with that already |
| 108 | * in the chunk file. If the chunk file is empty, this is |
| 109 | * equivalent to a load. Data from the flex block is appended |
| 110 | * to chunks already loaded where appropriate. |
| 111 | * |
| 112 | * Warning: this routine may move flex blocks. |
| 113 | */ |
| 114 | |
| 115 | extern routine chunk_read; |
| 116 | |
| 117 | /* --- chunk_enum --- * |
| 118 | * |
| 119 | * On entry: R0 == chunk file handle |
| 120 | * R1 == 0 for first call or continuation value |
| 121 | * |
| 122 | * On exit: CC if this isn't over yet, and |
| 123 | * R1 == continuation value for next call |
| 124 | * R2 == pointer to chunk name |
| 125 | * else CS and |
| 126 | * R1 == 0 |
| 127 | * R2 preserved |
| 128 | * |
| 129 | * Use: Allows you to enumerate the chunks in a chunk file structure. |
| 130 | */ |
| 131 | |
| 132 | extern routine chunk_enum; |
| 133 | |
| 134 | /* --- chunk_save --- * |
| 135 | * |
| 136 | * On entry: R0 == chunk file handle |
| 137 | * |
| 138 | * On exit: May return an error |
| 139 | * |
| 140 | * Use: Saves a chunk file to xsave's current output. |
| 141 | */ |
| 142 | |
| 143 | extern routine chunk_save; |
| 144 | |
| 145 | /*----- That's all, folks -------------------------------------------------*/ |
| 146 | |
| 147 | #endif |