IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4944 for trunk/psLib/src


Ignore:
Timestamp:
Sep 2, 2005, 11:32:06 AM (21 years ago)
Author:
drobbin
Message:

made requested changes including using file descriptors in psTrace

Location:
trunk/psLib/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psTime.c

    r4937 r4944  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-08-31 22:28:35 $
     12 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-09-02 21:32:03 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    13601360}
    13611361
    1362 psTime* psTimeFromISO(const char *input)
     1362psTime* psTimeFromISO(const char *input,
     1363                      psTimeType type)
    13631364{
    13641365    psS32 millisecond;
     
    13911392    outTime = p_psTimeFromTM(&tmTime);
    13921393    outTime->nsec = millisecond * 1000000;
     1394    outTime->type = type;
    13931395
    13941396    return outTime;
  • trunk/psLib/src/astro/psTime.h

    r4937 r4944  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-08-31 22:28:35 $
     13 *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-09-02 21:32:03 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    281281 */
    282282psTime* psTimeFromISO(
    283     const char* input                  ///< Input time to be converted.
     283    const char* input,                 ///< Input time to be converted.
     284    psTimeType type                    ///< Time type.
    284285);
    285286
  • trunk/psLib/src/math/psMinimize.c

    r4898 r4944  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.132 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-08-30 01:14:13 $
     11 *  @version $Revision: 1.133 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-09-02 21:32:06 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    21922192
    21932193    if (psTraceGetLevel (".psLib.dataManip.VectorFitPolynomial1DOrd") >= 5) {
    2194         FILE *f = psTraceGetDestination ();
     2194        FILE *f = fdopen((psTraceGetDestination ()), "a+");
    21952195        fprintf (f, "VectorFitPolynomial1D()\n");
    21962196        for (int i = 0; i < x->n; i++) {
    21972197            fprintf (f, "(x, y, yErr) is (%f, %f, %f)\n", x->data.F64[i], y->data.F64[i], yErr->data.F64[i]);
    21982198        }
     2199        fclose(f);
    21992200    }
    22002201
  • trunk/psLib/src/mathtypes/psImage.c

    r4920 r4944  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.79 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-08-31 02:07:11 $
     11 *  @version $Revision: 1.80 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-09-02 21:32:06 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    473473}
    474474
    475 bool p_psImagePrint (FILE *f, psImage *a, char *name)
    476 {
    477 
     475bool p_psImagePrint (int fd, psImage *a, char *name)
     476{
     477    FILE *f;
     478    f = fdopen(fd, "a+");
    478479    fprintf (f, "matrix: %s\n", name);
    479480
     
    485486    }
    486487    fprintf (f, "\n");
     488    fclose(f);
    487489    return (true);
    488490}
  • trunk/psLib/src/mathtypes/psImage.h

    r4920 r4944  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-08-31 02:07:11 $
     13 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-09-02 21:32:06 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    239239 */
    240240bool p_psImagePrint(
    241     FILE *f,                           ///< Destination stream
     241    int fd,                            ///< Destination file descriptor
    242242    psImage *a,                        ///< image to print
    243243    char *name                         ///< name of the image (for title)
  • trunk/psLib/src/mathtypes/psVector.c

    r4898 r4944  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-08-30 01:14:13 $
     11*  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-09-02 21:32:06 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    599599}
    600600
    601 bool p_psVectorPrint (FILE *f,
     601bool p_psVectorPrint (int fd,
    602602                      psVector *a,
    603603                      char *name)
    604604{
    605 
     605    FILE *f;
     606    f = fdopen(fd, "a+");
    606607    fprintf (f, "vector: %s\n", name);
    607608
     
    610611    }
    611612    fprintf (f, "\n");
     613    fclose(f);
    612614    return (true);
    613615}
  • trunk/psLib/src/mathtypes/psVector.h

    r4898 r4944  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-08-30 01:14:13 $
     13 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-09-02 21:32:06 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    192192 */
    193193bool p_psVectorPrint (
    194     FILE *f,                           ///< output stream
     194    int fd,                            ///< output file descriptor
    195195    psVector *a,                       ///< vector to print
    196196    char *name                         ///< name of vector (for title)
  • trunk/psLib/src/sys/psTrace.c

    r4578 r4944  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-07-18 20:54:22 $
     11 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-09-02 21:32:06 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5555static p_psComponent* cRoot = NULL; // The root of the trace component
    5656static FILE *traceFP = NULL;        // File destination for messages.
     57//static int traceFD = 0;
    5758
    5859static void componentFree(p_psComponent* comp);
     
    525526
    526527// 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) {
     528void 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) {
    534552        return;
    535553    }
    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) {
    552555        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
     565int psTraceGetDestination()
     566{
     567    int fd;
     568    fd = fileno(traceFP);
     569    return fd;
    555570}
    556571
  • trunk/psLib/src/sys/psTrace.h

    r4610 r4944  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-07-26 00:44:44 $
     11 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-09-02 21:32:06 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    106106/// Set the destination of future trace messages.
    107107void psTraceSetDestination(
    108     FILE * fp                          ///< Pointer to file
     108    int fd                             ///< File descriptor
    109109);
    110110
     
    113113 *  @return FILE*:      File Destination
    114114 */
    115 FILE *psTraceGetDestination(void);
     115int psTraceGetDestination(void);
    116116
    117117/* \} */// End of SystemGroup Functions
Note: See TracChangeset for help on using the changeset viewer.