Changeset 8312
- Timestamp:
- Aug 14, 2006, 10:05:05 AM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 7 edited
-
src/math/psRegion.h (modified) (5 diffs)
-
src/types/psMetadata.c (modified) (14 diffs)
-
src/types/psMetadataConfig.c (modified) (4 diffs)
-
src/types/psMetadataConfig.h (modified) (2 diffs)
-
test/types/Makefile.am (modified) (2 diffs)
-
test/types/tap_psMetadataItemCompare.c (modified) (1 diff)
-
test/types/tap_psMetadataItemParse.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psRegion.h
r7901 r8312 11 11 typedef struct 12 12 { 13 float x0; ///< the first column of the region.14 float x1; ///< the last column of the region.15 float y0; ///< the first row of the region.16 float y1; ///< the last row of the region.13 float x0; ///< the first column of the region. 14 float x1; ///< the last column of the region. 15 float y0; ///< the first row of the region. 16 float y1; ///< the last row of the region. 17 17 } 18 18 psRegion; … … 22 22 * @return psRegion* : a new psRegion. 23 23 */ 24 psRegion *psRegionAlloc(float x0, ///< the first column of the region. 25 float x1, ///< the last column of the region + 1. 26 float y0, ///< the first row of the region. 27 float y1 ///< the last row of the region + 1. 28 ); 24 psRegion *psRegionAlloc( 25 float x0, ///< the first column of the region. 26 float x1, ///< the last column of the region + 1. 27 float y0, ///< the first row of the region. 28 float y1 ///< the last row of the region + 1. 29 ); 29 30 30 31 /** Checks the type of a particular pointer. … … 40 41 /** Create a psRegion with the specified attributes. 41 42 * 42 * @return psRegion : a cooresponding psRegion.43 * @return psRegion : a corresponding psRegion. 43 44 */ 44 45 psRegion psRegionSet( … … 54 55 * shall be of the standard IRAF form '[x0:x1,y0:y1]' 55 56 * 56 * @return psRegion: A new psRegion struct, or NULL is not successful.57 * @return psRegion: A new psRegion struct, or NULL is not successful. 57 58 */ 58 59 psRegion psRegionFromString( … … 75 76 */ 76 77 psRegion psRegionForSquare( 77 double x, ///< x coordinate at square-center78 double y, ///< y coordinate at square-center79 double radius ///< radius of square78 double x, ///< x coordinate at square-center 79 double y, ///< y coordinate at square-center 80 double radius ///< radius of square 80 81 ); 81 82 -
trunk/psLib/src/types/psMetadata.c
r8245 r8312 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.12 2$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-08- 09 02:26:44$14 * @version $Revision: 1.123 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-08-14 20:05:05 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1194 1194 psMetadataItem *item = NULL; // Item from metadata 1195 1195 while ( (item = psMetadataGetAndIncrement(iter)) ) { 1196 // Indent... 1197 for (int i = 0; i < level; i++) { 1198 fprintf(fd, " "); 1199 } 1200 fprintf(fd, "%s", item->name); 1201 if (item->comment && strlen(item->comment) > 0) { 1202 fprintf(fd, " (%s)", item->comment); 1203 } 1204 fprintf(fd, ": "); 1196 //So that unsupported types are not printed here, adding a switch statement 1197 switch(item->type) { 1198 case PS_DATA_STRING: 1199 case PS_DATA_BOOL: 1200 case PS_DATA_S8: 1201 case PS_DATA_S16: 1202 case PS_DATA_S32: 1203 case PS_DATA_S64: 1204 case PS_DATA_U8: 1205 case PS_DATA_U16: 1206 case PS_DATA_U32: 1207 case PS_DATA_U64: 1208 case PS_DATA_F32: 1209 case PS_DATA_F64: 1210 case PS_DATA_METADATA: 1211 case PS_DATA_REGION: 1212 case PS_DATA_LIST: 1213 case PS_DATA_TIME: 1214 case PS_DATA_VECTOR: 1215 // Indent... 1216 // fprintf(fd, "\n"); 1217 for (int i = 0; i < level; i++) { 1218 fprintf(fd, " "); 1219 } 1220 fprintf(fd, "%s", item->name); 1221 if (item->comment && strlen(item->comment) > 0) { 1222 fprintf(fd, " (%s)", item->comment); 1223 } 1224 fprintf(fd, ": "); 1225 break; 1226 case PS_DATA_UNKNOWN: 1227 default: 1228 break; 1229 } 1205 1230 switch (item->type) { 1206 1231 case PS_DATA_STRING: 1207 fprintf(fd, "%s ", (char*)(item->data.V));1232 fprintf(fd, "%s\n", (char*)(item->data.V)); 1208 1233 break; 1209 1234 case PS_DATA_BOOL: 1210 1235 if (item->data.B) { 1211 fprintf(fd, "True ");1236 fprintf(fd, "True\n"); 1212 1237 } else { 1213 fprintf(fd, "False ");1238 fprintf(fd, "False\n"); 1214 1239 } 1215 1240 break; 1216 1241 case PS_DATA_S8: 1217 fprintf(fd, "%d ", item->data.S8);1242 fprintf(fd, "%d\n", item->data.S8); 1218 1243 break; 1219 1244 case PS_DATA_S16: 1220 fprintf(fd, "%d ", item->data.S16);1245 fprintf(fd, "%d\n", item->data.S16); 1221 1246 break; 1222 1247 case PS_DATA_S32: 1223 fprintf(fd, "%d ", item->data.S32);1248 fprintf(fd, "%d\n", item->data.S32); 1224 1249 break; 1225 1250 case PS_DATA_S64: 1226 fprintf(fd, "%jd ", item->data.S64);1251 fprintf(fd, "%jd\n", item->data.S64); 1227 1252 break; 1228 1253 case PS_DATA_U8: 1229 fprintf(fd, "%u ", item->data.U8);1254 fprintf(fd, "%u\n", item->data.U8); 1230 1255 break; 1231 1256 case PS_DATA_U16: 1232 fprintf(fd, "%u ", item->data.U16);1257 fprintf(fd, "%u\n", item->data.U16); 1233 1258 break; 1234 1259 case PS_DATA_U32: 1235 fprintf(fd, "%u ", item->data.U32);1260 fprintf(fd, "%u\n", item->data.U32); 1236 1261 break; 1237 1262 case PS_DATA_U64: 1238 fprintf(fd, "%ju ", item->data.U64);1263 fprintf(fd, "%ju\n", item->data.U64); 1239 1264 break; 1240 1265 case PS_DATA_F32: 1241 fprintf(fd, "%f ", item->data.F32);1266 fprintf(fd, "%f\n", item->data.F32); 1242 1267 break; 1243 1268 case PS_DATA_F64: 1244 fprintf(fd, "%f ", item->data.F64);1269 fprintf(fd, "%f\n", item->data.F64); 1245 1270 break; 1246 1271 case PS_DATA_METADATA: … … 1254 1279 case PS_DATA_REGION: { 1255 1280 psString region = psRegionToString(*(psRegion*)item->data.V); 1256 fprintf(fd, "%s ", region);1281 fprintf(fd, "%s\n", region); 1257 1282 psFree(region); 1258 1283 break; 1259 1284 } 1260 1285 case PS_DATA_LIST: 1261 fprintf(fd, "<a list of unknown contents> ");1286 fprintf(fd, "<a list of unknown contents>\n"); 1262 1287 break; 1263 1288 case PS_DATA_TIME: { 1264 1289 psString time = psTimeToISO(item->data.V); 1265 fprintf(fd, "%s ", time);1290 fprintf(fd, "%s\n", time); 1266 1291 psFree(time); 1267 1292 break; … … 1275 1300 fprintf(fd, "%u ", vector->data.U8[i]); 1276 1301 } 1302 fprintf(fd, "\n"); 1277 1303 break; 1278 1304 case PS_DATA_U16: … … 1281 1307 fprintf(fd, "%u ", vector->data.U16[i]); 1282 1308 } 1309 fprintf(fd, "\n"); 1283 1310 break; 1284 1311 case PS_DATA_U32: … … 1287 1314 fprintf(fd, "%u ", vector->data.U32[i]); 1288 1315 } 1316 fprintf(fd, "\n"); 1289 1317 break; 1290 1318 case PS_DATA_U64: … … 1293 1321 fprintf(fd, "%ju ", vector->data.U64[i]); 1294 1322 } 1323 fprintf(fd, "\n"); 1295 1324 break; 1296 1325 case PS_DATA_S8: … … 1299 1328 fprintf(fd, "%d ", vector->data.S8[i]); 1300 1329 } 1330 fprintf(fd, "\n"); 1301 1331 break; 1302 1332 case PS_DATA_S16: … … 1305 1335 fprintf(fd, "%d ", vector->data.S16[i]); 1306 1336 } 1337 fprintf(fd, "\n"); 1307 1338 break; 1308 1339 case PS_DATA_S32: … … 1311 1342 fprintf(fd, "%d ", vector->data.S32[i]); 1312 1343 } 1344 fprintf(fd, "\n"); 1313 1345 break; 1314 1346 case PS_DATA_S64: … … 1317 1349 fprintf(fd, "%jd ", vector->data.S64[i]); 1318 1350 } 1351 fprintf(fd, "\n"); 1319 1352 break; 1320 1353 case PS_DATA_F32: … … 1323 1356 fprintf(fd, "%f ", vector->data.F32[i]); 1324 1357 } 1358 fprintf(fd, "\n"); 1325 1359 break; 1326 1360 case PS_DATA_F64: … … 1329 1363 fprintf(fd, "%f ", vector->data.F64[i]); 1330 1364 } 1365 fprintf(fd, "\n"); 1331 1366 break; 1332 1367 case PS_DATA_UNKNOWN: … … 1334 1369 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 1335 1370 _("Specified psDataType, %d, is not supported."), vector->type.type); 1371 psFree(iter); 1372 fprintf(fd, "<Unsupported type>\n"); 1336 1373 return false; 1337 1374 } 1375 // fprintf(fd, "\n"); 1338 1376 break; 1339 1377 } 1340 1378 default: 1341 fprintf(fd, "\n");1379 // fprintf(fd, "\n"); 1342 1380 psError(PS_ERR_IO, false, "Non-printable metadata type: %x\n", item->type); 1343 } 1344 fprintf(fd, "\n"); 1345 } 1381 break; 1382 } 1383 // fprintf(fd, "\n"); 1384 } 1385 // fprintf(fd, "\n"); 1346 1386 psFree(iter); 1347 1387 -
trunk/psLib/src/types/psMetadataConfig.c
r8298 r8312 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.7 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-08-1 2 02:53:36$12 * @version $Revision: 1.72 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-08-14 20:05:05 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 453 453 psBool success = true; 454 454 455 PS_ASSERT_PTR_NON_NULL(fd, success);456 PS_ASSERT_PTR_NON_NULL(format, success);457 PS_ASSERT_PTR_NON_NULL(item, success);455 PS_ASSERT_PTR_NON_NULL(fd, false); 456 PS_ASSERT_PTR_NON_NULL(format, false); 457 PS_ASSERT_PTR_NON_NULL(item, false); 458 458 459 459 type = item->type; … … 464 464 // well, the format contains no reference to the metadataItem's data: 465 465 // that is truly trival to do! 466 fprintf(fd,format);467 return success;466 // fprintf(fd,format); 467 return false; 468 468 } 469 469 … … 552 552 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 553 553 _("Specified print format, %%%c, is not supported."), *fType); 554 success = false; 554 555 break; 555 556 } -
trunk/psLib/src/types/psMetadataConfig.h
r7245 r8312 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 5-30 22:18:39$12 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-08-14 20:05:05 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 48 48 * this formatting command must also be numeric, and the type conversion 49 49 * performed to the value to match the format type. If the metadata type is 50 * a string, the f romatting command must also be for a string. If the50 * a string, the formatting command must also be for a string. If the 51 51 * metadata type is any other data type, printing is not allowed. 52 52 * 53 * @return psMetadataItem* : Pointer metadata item.53 * @return psMetadataItem* : Pointer metadata item. 54 54 */ 55 55 bool psMetadataItemPrint( -
trunk/psLib/test/types/Makefile.am
r8257 r8312 31 31 tap_psMetadataConfigParse \ 32 32 tap_psMetadataItemCompare \ 33 tap_psMetadataItemParse 33 tap_psMetadataItemParse \ 34 tap_psMetadata_printing 34 35 35 36 … … 69 70 tap_psMetadataItemParse_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/test/tap/src 70 71 tap_psMetadataItemParse_LDFLAGS = $(AM_LDFLAGS) $(top_builddir)/test/tap/src/libtap.la 72 73 tap_psMetadata_printing_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/test/tap/src 74 tap_psMetadata_printing_LDFLAGS = $(AM_LDFLAGS) $(top_builddir)/test/tap/src/libtap.la 71 75 72 76 check_DATA = \ -
trunk/psLib/test/types/tap_psMetadataItemCompare.c
r8269 r8312 1 #include <stdio.h> 1 2 2 #include "pstap.h" 3 3 -
trunk/psLib/test/types/tap_psMetadataItemParse.c
r8269 r8312 1 #include <stdio.h> 1 2 2 #include "pstap.h" 3 3
Note:
See TracChangeset
for help on using the changeset viewer.
