Changeset 4944
- Timestamp:
- Sep 2, 2005, 11:32:06 AM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 11 edited
-
src/astro/psTime.c (modified) (3 diffs)
-
src/astro/psTime.h (modified) (2 diffs)
-
src/math/psMinimize.c (modified) (2 diffs)
-
src/mathtypes/psImage.c (modified) (3 diffs)
-
src/mathtypes/psImage.h (modified) (2 diffs)
-
src/mathtypes/psVector.c (modified) (3 diffs)
-
src/mathtypes/psVector.h (modified) (2 diffs)
-
src/sys/psTrace.c (modified) (3 diffs)
-
src/sys/psTrace.h (modified) (3 diffs)
-
test/astro/tst_psTime_01.c (modified) (4 diffs)
-
test/sys/tst_psTrace.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r4937 r4944 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.6 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 8-31 22:28:35$12 * @version $Revision: 1.69 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-09-02 21:32:03 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1360 1360 } 1361 1361 1362 psTime* psTimeFromISO(const char *input) 1362 psTime* psTimeFromISO(const char *input, 1363 psTimeType type) 1363 1364 { 1364 1365 psS32 millisecond; … … 1391 1392 outTime = p_psTimeFromTM(&tmTime); 1392 1393 outTime->nsec = millisecond * 1000000; 1394 outTime->type = type; 1393 1395 1394 1396 return outTime; -
trunk/psLib/src/astro/psTime.h
r4937 r4944 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-0 8-31 22:28:35$13 * @version $Revision: 1.38 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-02 21:32:03 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 281 281 */ 282 282 psTime* psTimeFromISO( 283 const char* input ///< Input time to be converted. 283 const char* input, ///< Input time to be converted. 284 psTimeType type ///< Time type. 284 285 ); 285 286 -
trunk/psLib/src/math/psMinimize.c
r4898 r4944 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.13 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 8-30 01:14:13$11 * @version $Revision: 1.133 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-02 21:32:06 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 2192 2192 2193 2193 if (psTraceGetLevel (".psLib.dataManip.VectorFitPolynomial1DOrd") >= 5) { 2194 FILE *f = psTraceGetDestination ();2194 FILE *f = fdopen((psTraceGetDestination ()), "a+"); 2195 2195 fprintf (f, "VectorFitPolynomial1D()\n"); 2196 2196 for (int i = 0; i < x->n; i++) { 2197 2197 fprintf (f, "(x, y, yErr) is (%f, %f, %f)\n", x->data.F64[i], y->data.F64[i], yErr->data.F64[i]); 2198 2198 } 2199 fclose(f); 2199 2200 } 2200 2201 -
trunk/psLib/src/mathtypes/psImage.c
r4920 r4944 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 79$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 8-31 02:07:11$11 * @version $Revision: 1.80 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-02 21:32:06 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 473 473 } 474 474 475 bool p_psImagePrint (FILE *f, psImage *a, char *name) 476 { 477 475 bool p_psImagePrint (int fd, psImage *a, char *name) 476 { 477 FILE *f; 478 f = fdopen(fd, "a+"); 478 479 fprintf (f, "matrix: %s\n", name); 479 480 … … 485 486 } 486 487 fprintf (f, "\n"); 488 fclose(f); 487 489 return (true); 488 490 } -
trunk/psLib/src/mathtypes/psImage.h
r4920 r4944 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.6 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-0 8-31 02:07:11$13 * @version $Revision: 1.66 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-02 21:32:06 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 239 239 */ 240 240 bool p_psImagePrint( 241 FILE *f, ///< Destination stream241 int fd, ///< Destination file descriptor 242 242 psImage *a, ///< image to print 243 243 char *name ///< name of the image (for title) -
trunk/psLib/src/mathtypes/psVector.c
r4898 r4944 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 8-30 01:14:13$11 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-02 21:32:06 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 599 599 } 600 600 601 bool p_psVectorPrint ( FILE *f,601 bool p_psVectorPrint (int fd, 602 602 psVector *a, 603 603 char *name) 604 604 { 605 605 FILE *f; 606 f = fdopen(fd, "a+"); 606 607 fprintf (f, "vector: %s\n", name); 607 608 … … 610 611 } 611 612 fprintf (f, "\n"); 613 fclose(f); 612 614 return (true); 613 615 } -
trunk/psLib/src/mathtypes/psVector.h
r4898 r4944 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.4 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-0 8-30 01:14:13$13 * @version $Revision: 1.43 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-02 21:32:06 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 192 192 */ 193 193 bool p_psVectorPrint ( 194 FILE *f, ///< output stream194 int fd, ///< output file descriptor 195 195 psVector *a, ///< vector to print 196 196 char *name ///< name of vector (for title) -
trunk/psLib/src/sys/psTrace.c
r4578 r4944 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 7-18 20:54:22$11 * @version $Revision: 1.56 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-02 21:32:06 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 55 55 static p_psComponent* cRoot = NULL; // The root of the trace component 56 56 static FILE *traceFP = NULL; // File destination for messages. 57 //static int traceFD = 0; 57 58 58 59 static void componentFree(p_psComponent* comp); … … 525 526 526 527 // XXX EAM : I've added code to close the old traceFP (safely) 527 void psTraceSetDestination(FILE * fp) 528 { 529 530 bool special; 531 532 // XXX EAM perhaps return an error? 533 if (fp == NULL) { 528 void psTraceSetDestination(int fd) 529 { 530 531 532 /* 533 bool special; 534 535 // XXX EAM perhaps return an error? 536 if (fp == NULL) { 537 return; 538 } 539 540 // cannot close traceFP if one of the special FILE ptrs 541 special = (traceFP == NULL); 542 special |= (traceFP == stdin); 543 special |= (traceFP == stdout); 544 special |= (traceFP == stderr); 545 546 if (!special) { 547 fclose (traceFP); 548 } 549 traceFP = fp; 550 */ 551 if (fd == -1) { 534 552 return; 535 553 } 536 537 // cannot close traceFP if one of the special FILE ptrs 538 special = (traceFP == NULL); 539 special |= (traceFP == stdin); 540 special |= (traceFP == stdout); 541 special |= (traceFP == stderr); 542 543 if (!special) { 544 fclose (traceFP); 545 } 546 traceFP = fp; 547 } 548 549 FILE *psTraceGetDestination() 550 { 551 if (traceFP == NULL) { 554 if (fd == 1) { 552 555 traceFP = stdout; 553 } 554 return traceFP; 556 } else if (fd == 2) { 557 traceFP = stderr; 558 } else if (fd == 0) { 559 traceFP = stdin; 560 } else if (fd > 2) { 561 traceFP = fdopen(fd, "w"); 562 } 563 } 564 565 int psTraceGetDestination() 566 { 567 int fd; 568 fd = fileno(traceFP); 569 return fd; 555 570 } 556 571 -
trunk/psLib/src/sys/psTrace.h
r4610 r4944 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 7-26 00:44:44$11 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-02 21:32:06 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 106 106 /// Set the destination of future trace messages. 107 107 void psTraceSetDestination( 108 FILE * fp ///< Pointer to file108 int fd ///< File descriptor 109 109 ); 110 110 … … 113 113 * @return FILE*: File Destination 114 114 */ 115 FILE *psTraceGetDestination(void);115 int psTraceGetDestination(void); 116 116 117 117 /* \} */// End of SystemGroup Functions -
trunk/psLib/test/astro/tst_psTime_01.c
r4547 r4944 23 23 * @author Eric Van Alst, MHPCC 24 24 * 25 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $26 * @date $Date: 2005-0 7-13 02:46:58$25 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 26 * @date $Date: 2005-09-02 21:32:06 $ 27 27 * 28 28 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 636 636 // Attempt to convert NULL string 637 637 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL ISO string"); 638 time = psTimeFromISO(NULL );638 time = psTimeFromISO(NULL, PS_TIME_TAI); 639 639 if(time != NULL) { 640 640 psError(PS_ERR_UNKNOWN,true,"Did not return NULL as expected for NULL ISO string"); … … 643 643 644 644 // Convert valid ISO string 645 time = psTimeFromISO(testTime1Str );645 time = psTimeFromISO(testTime1Str, PS_TIME_TAI); 646 646 if(time->type != PS_TIME_TAI) { 647 647 psError(PS_ERR_UNKNOWN,true,"Type %d not as expected %d", … … 658 658 // Attempt to convert invalid ISO string 659 659 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error for invalid ISO string"); 660 time = psTimeFromISO("Here I am" );660 time = psTimeFromISO("Here I am", PS_TIME_TAI); 661 661 if(time != NULL) { 662 662 psError(PS_ERR_UNKNOWN,true,"Did not return NULL as expected for invalid ISO string"); -
trunk/psLib/test/sys/tst_psTrace.c
r4547 r4944 8 8 #include "pslib_strict.h" 9 9 #include "psTest.h" 10 #include <fcntl.h> 11 #include <unistd.h> 10 12 11 13 … … 49 51 psS32 lev = 0; 50 52 51 psTraceSetDestination(stderr); 53 // psTraceSetDestination(stderr); 54 psTraceSetDestination(2); 52 55 53 56 for (i=0;i<10;i++) { … … 96 99 static psS32 testTrace01(void) 97 100 { 98 psTraceSetDestination(stderr); 101 // psTraceSetDestination(stderr); 102 psTraceSetDestination(2); 99 103 (void)psTraceSetLevel(".A.B.C.D.E", 5); 100 104 … … 111 115 { 112 116 psTraceReset(); 113 psTraceSetDestination(stderr); 117 // psTraceSetDestination(stderr); 118 psTraceSetDestination(2); 114 119 psTraceSetLevel(".A.B", 2); 115 120 psTraceSetLevel(".A.B.C.D.E", 5); … … 142 147 psS32 lev = 0; 143 148 144 psTraceSetDestination(stderr); 149 // psTraceSetDestination(stderr); 150 psTraceSetDestination(2); 145 151 146 152 for (i=0;i<10;i++) { … … 183 189 { 184 190 FILE *fp; 191 int FD; 185 192 psS32 nb = 0; 186 187 fp = fopen("tst_psTrace02_OUT", "w"); 193 FD = creat("tst_psTrace02_OUT", 0666); 194 // printf("\nFD = %d\n", FD); 195 // fp = fopen("tst_psTrace02_OUT", "w"); 196 fp = fdopen(FD, "w"); 188 197 for (nb = 0 ; nb<4;nb++) { 189 198 if (nb == 0) 190 psTraceSetDestination(stdout); 199 // psTraceSetDestination(stdout); 200 psTraceSetDestination(1); 191 201 if (nb == 1) 192 psTraceSetDestination(stderr); 202 // psTraceSetDestination(stderr); 203 psTraceSetDestination(2); 193 204 if (nb == 2) 194 psTraceSetDestination( NULL);205 psTraceSetDestination(-1); //NULL 195 206 if (nb == 3) 196 psTraceSetDestination( fp);207 psTraceSetDestination(FD); 197 208 198 209 (void)psTraceSetLevel(".", 4); … … 221 232 222 233 fclose(fp); 234 close(FD); 223 235 224 236 return(0); … … 227 239 static psS32 testTrace05(void) 228 240 { 229 psTraceSetDestination(stderr); 241 // psTraceSetDestination(stderr); 242 psTraceSetDestination(2); 230 243 231 244 (void)psTraceSetLevel(".", 9); … … 277 290 static psS32 testTrace06(void) 278 291 { 279 psTraceSetDestination(stderr); 292 // psTraceSetDestination(stderr); 293 psTraceSetDestination(2); 280 294 281 295 (void)psTraceSetLevel(".", 9);
Note:
See TracChangeset
for help on using the changeset viewer.
