IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6025


Ignore:
Timestamp:
Jan 16, 2006, 11:23:21 PM (21 years ago)
Author:
magnier
Message:

added psLine, commented out

Location:
branches/eam_rel9_b1/psLib/src/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_rel9_b1/psLib/src/sys/psString.c

    r5569 r6025  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-11-22 19:11:07 $
     14 *  @version $Revision: 1.21.6.1 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-01-17 09:23:21 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5959}
    6060
     61// XXX EAM : since 'dest' is on the memory system, this probably should be:
     62//   ssize_t psStringAppend(psString *dest, const char *format, ...)
    6163ssize_t psStringAppend(char **dest, const char *format, ...)
    6264{
     
    157159    return length;
    158160}
     161
     162/*** psLine not yet released ***/
     163# if (0)
     164    static void psLineFree (psLine *line)
     165{
     166
     167    if (line == NULL)
     168        return;
     169
     170    psFree (line->line);
     171    return;
     172}
     173
     174// allocate a psLine structrue
     175psLine *psLineAlloc (int Nline)
     176{
     177
     178    psLine *line;
     179    line = psAlloc (sizeof(psLine));
     180    psMemSetDeallocator(line, (psFreeFunc) psLineFree);
     181
     182    line->Nline = 0;
     183    line->NLINE = Nline;
     184    line->line = psAlloc (Nline);
     185    return (line);
     186}
     187
     188bool psLineInit (psLine *line)
     189{
     190    if (line == NULL)
     191        return (false);
     192    line->Nline = 0;
     193    return (true);
     194}
     195
     196bool psLineAdd (psLine *line, char *format, ...)
     197{
     198
     199    int Nchar;
     200    va_list ap;
     201
     202    if (line == NULL)
     203        return (false);
     204
     205    int nMax = line->NLINE - line->Nline;
     206
     207    va_start (ap, format);
     208    Nchar = vsnprintf (&line->line[line->Nline], nMax, format, ap);
     209    line->Nline += PS_MIN (nMax - 1, Nchar);
     210    va_end (ap);
     211
     212    if (Nchar >= nMax)
     213        return (false);
     214    return (true);
     215}
     216# endif
  • branches/eam_rel9_b1/psLib/src/sys/psString.h

    r5015 r6025  
    1313 *  @author Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2005-09-13 01:09:58 $
     15 *  @version $Revision: 1.16.18.1 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-01-17 09:23:21 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9797/** @} */// Doxygen - End of SystemGroup Functions
    9898
     99
     100/* psLine not yet released */
     101# if (0)
     102    // structure to carry a dynamic string
     103    typedef struct
     104    {
     105        int NLINE;
     106        int Nline;
     107        char *line;
     108    }
     109psLine;
     110
     111// psLine functions -- keep out for now?
     112psLine      *psLineAlloc (int Nline);
     113bool      psLineInit (psLine *line);
     114bool      psLineAdd (psLine *line, char *format, ...);
     115# endif
     116
    99117#endif // #ifndef PS_STRING_H
     118
Note: See TracChangeset for help on using the changeset viewer.