Changeset 4309 for trunk/archive/scripts/src/pmFPAFromHeader.c
- Timestamp:
- Jun 17, 2005, 2:48:18 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/src/pmFPAFromHeader.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/pmFPAFromHeader.c
r4092 r4309 80 80 } 81 81 82 bool extIsChips; // Are the extensions chips (true) or cells (false)?83 82 if (strcmp(extType, "CHIP") == 0) { 84 extIsChips = true; // Extensions are chips 85 } else if (strcmp(extType, "CELL") == 0) { 86 extIsChips = false; // Extensions are cells 87 } else { 88 psError(PS_ERR_IO, false, "EXTENSIONS in camera definition is neither CHIP or CELL.\n"); 89 psFree(fpa); 90 return NULL; 91 } 92 93 // Iterate through the contents 94 psMetadataIterator *contentsIter = psMetadataIteratorAlloc(contents, PS_LIST_HEAD, NULL); 95 psMetadataItem *contentItem = NULL; // Item from the metadata 96 while (contentItem = psMetadataGetAndIncrement(contentsIter)) { 97 const char *extName = contentItem->name; // The name of the extension 98 99 if (extIsChips) { 100 // Content contains a list of cells 83 // Extensions are chips; Content contains a list of cells 84 psMetadataIterator *contentsIter = psMetadataIteratorAlloc(contents, PS_LIST_HEAD, NULL); 85 psMetadataItem *contentItem = NULL; // Item from the metadata 86 while (contentItem = psMetadataGetAndIncrement(contentsIter)) { 87 const char *extName = contentItem->name; // The name of the extension 88 101 89 if (contentItem->type != PS_META_STR) { 102 90 psLogMsg(__func__, PS_LOG_WARN, "Type of content item (%x) is not string: ignored\n", … … 120 108 psMetadataAdd(fpa, PS_LIST_TAIL, extName, PS_META_META, "", chip); 121 109 } 122 } else { 123 // Content contains a chip name and cell type 110 } 111 psFree(contentsIter); 112 113 } else if (strcmp(extType, "CELL") == 0) { 114 // Extensions are cells; Content contains a chip name and cell type 115 psMetadataIterator *contentsIter = psMetadataIteratorAlloc(contents, PS_LIST_HEAD, NULL); 116 psMetadataItem *contentItem = NULL; // Item from the metadata 117 while (contentItem = psMetadataGetAndIncrement(contentsIter)) { 118 const char *extName = contentItem->name; // The name of the extension 119 124 120 if (contentItem->type != PS_META_STR) { 125 121 psLogMsg(__func__, PS_LOG_WARN, "Type of content item (%x) is not string: ignored\n", … … 148 144 } 149 145 } 150 151 } // Type of extension 152 } // Iterating through contents 153 psFree(contentsIter); 146 } 147 psFree(contentsIter); 148 } else if (strcmp(extType, "NONE") == 0) { 149 // No extensions; Content contains metadata, each entry is a chip with its component cells 150 psMetadataIterator *contentsIter = psMetadataIteratorAlloc(contents, PS_LIST_HEAD, NULL); 151 psMetadataItem *contentItem = NULL; // Item from the metadata 152 while (contentItem = psMetadataGetAndIncrement(contentsIter)) { 153 const char *chipName = contentItem->name; // The name of the chip 154 155 if (contentItem->type != PS_META_STR) { 156 psLogMsg(__func__, PS_LOG_WARN, "Type of content item (%x) is not string: ignored\n", 157 contentItem->type); 158 } else { 159 const char *content = contentItem->data.V; // The content of the extension 160 psMetadata *chip = psMetadataAlloc(); // The chip 161 psList *cellNames = papSplit(content, ", "); // Split the list of cells 162 psListIterator *cellNamesIter = psListIteratorAlloc(cellNames, PS_LIST_HEAD, false); 163 char *cellName = NULL; // Name of the cell 164 while (cellName = psListGetAndIncrement(cellNamesIter)) { 165 psMetadata *cell = getCellData(camera, cellName); 166 psMetadataAdd(cell, PS_LIST_HEAD, "EXTENSION", PS_META_STR, "", "PHU"); 167 psMetadataAdd(chip, PS_LIST_TAIL, cellName, PS_META_META, "", cell); 168 } 169 psFree(cellNamesIter); 170 // Add the chip onto the FPA 171 psMetadataAdd(fpa, PS_LIST_TAIL, chipName, PS_META_META, "", chip); 172 } 173 } 174 psFree(contentsIter); 175 } else { 176 psError(PS_ERR_IO, false, "EXTENSIONS in camera definition is not CHIP, CELL or NONE.\n"); 177 psFree(fpa); 178 return NULL; 179 } // Type of extension 154 180 155 181 } else if (strcmp(phuType, "CHIP") == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.
