IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 17, 2009, 12:08:50 PM (17 years ago)
Author:
beaumont
Message:

merged with head

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/psLib/src/sys/Makefile.am

    r19056 r23352  
    33noinst_LTLIBRARIES = libpslibsys.la
    44
    5 libpslibsys_la_CPPFLAGS = $(SRCINC) $(PSLIB_CFLAGS) $(CFITSIO_CFLAGS)
     5# PSLIB_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi`
     6# PSLIB_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi`
     7# PSLIB_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi`
     8
     9# Force recompilation of psConfigure.c, since it gets the version information
     10psConfigure.c: FORCE
     11        touch psConfigure.c
     12FORCE: ;
     13
     14libpslibsys_la_CPPFLAGS = $(SRCINC) $(PSLIB_CFLAGS) $(CFITSIO_CFLAGS) -DPSLIB_VERSION=$(SVN_VERSION) -DPSLIB_BRANCH=$(SVN_BRANCH) -DPSLIB_SOURCE=$(SVN_SOURCE)
    615libpslibsys_la_SOURCES = \
    716        psAbort.c \
  • branches/cnb_branches/cnb_branch_20090301/psLib/src/sys/psConfigure.c

    r18953 r23352  
    1212 *  @author Ross Harman, MHPCC
    1313 *  @author Robert DeSonia, MHPCC
     14 *  @author Paul Price, IfA
    1415 *
    15  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2008-08-08 18:05:08 $
    17  *
    18  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     16 *  Copyright 2004-2009 Institute for Astronomy, University of Hawaii
    1917 */
    2018
     
    2624#include <stdlib.h>
    2725#include <string.h>
     26
     27#include <fitsio.h>
     28#include <longnam.h>
     29#include <fftw3.h>
     30#include <gsl/gsl_version.h>
     31#ifdef HAVE_PSDB
     32#include <mysql.h>
     33#endif
    2834
    2935#include "psAbort.h"
     
    4147static FILE *memCheckFile = NULL;       // File to which to write results of mem check
    4248
    43 static const char *cvsTag = "$Name: not supported by cvs2svn $"; // CVS tag name
     49#ifndef PSLIB_VERSION
     50#error "PSLIB_VERSION is not set"
     51#endif
     52#ifndef PSLIB_BRANCH
     53#error "PSLIB_BRANCH is not set"
     54#endif
     55#ifndef PSLIB_SOURCE
     56#error "PSLIB_SOURCE is not set"
     57#endif
     58
     59#define xstr(s) str(s)
     60#define str(s) #s
    4461
    4562psString psLibVersion(void)
    4663{
    47     psString version = NULL;            // Version, to return
    48     psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION);
    49     return version;
     64    char *value = NULL;
     65    psStringAppend(&value, "%s@%s", xstr(PSLIB_BRANCH), xstr(PSLIB_VERSION));
     66    return value;
     67}
     68
     69psString psLibSource(void)
     70{
     71    return psStringCopy(xstr(PSLIB_SOURCE));
     72}
     73
     74psString psLibDependencies(void)
     75{
     76    psString deps = NULL;               // Dependencies, to return
     77    float cfitsioVersion;               // CFITSIO version number
     78    psStringAppend(&deps, "cfitsio-%.3f gsl-%s %s",
     79                   fits_get_version(&cfitsioVersion), gsl_version, fftwf_version);
     80
     81#ifdef HAVE_PSDB
     82    psStringAppend(&deps, " mysql-%s", mysql_get_client_info());
     83#endif
     84
     85    return deps;
    5086}
    5187
    5288psString psLibVersionLong(void)
    5389{
    54     psString version = psLibVersion();    // Version, to return
    55     psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag
     90    psString version = psLibVersion();  // Version, to return
     91    psString source = psLibSource();    // Source
     92    psString deps = psLibDependencies();// Dependencies
    5693
    57 #ifdef HAVE_PSDB
    58     psStringAppend(&version, " (cvs tag %s), %s, %s with psDB", tag, __DATE__, __TIME__);
     94    psStringPrepend(&version, "psLib ");
     95    psStringAppend(&version, " from %s, built %s, %s with %s",
     96                   source, __DATE__, __TIME__, deps);
     97    psFree(source);
     98    psFree(deps);
     99
     100#ifdef __OPTIMIZE__
     101    psStringAppend(&version, " optimised");
    59102#else
    60     psStringAppend(&version, " (cvs tag %s), %s, %s without psDB", tag, __DATE__, __TIME__);
     103    psStringAppend(&version, " unoptimised");
    61104#endif
    62     psFree(tag);
     105
     106#ifdef PS_NO_TRACE
     107    psStringAppend(&version, " without trace");
     108#else
     109    psStringAppend(&version, " with trace");
     110#endif
     111
    63112    return version;
    64 }
     113};
    65114
    66115// Check the memory; intended for use on exit, but might be used elsewhere
  • branches/cnb_branches/cnb_branch_20090301/psLib/src/sys/psConfigure.h

    r13950 r23352  
    2020#define PS_CONFIGURE_H
    2121
     22#include <psString.h>
     23
    2224/// @addtogroup SysUtils System Utilities
    2325/// @{
     
    2931 *  @return psString: String with version name.
    3032 */
    31 psString psLibVersion(
    32     void
    33 );
     33psString psLibVersion(void);
    3434
     35/** Get current psLib source
     36 *
     37 * Returns the current psLib source name as a string.
     38 *
     39 * @return psString: String with source name.
     40 */
     41psString psLibSource(void);
     42
     43/** Get psLib dependencies' versions
     44 *
     45 * Returns the psLib dependency versions as a string.
     46 *
     47 * @return psString: String with dependencies.
     48 */
     49psString psLibDependencies(void);
    3550
    3651/** Get current psLib version (full identification)
  • branches/cnb_branches/cnb_branch_20090301/psLib/src/sys/psLogMsg.c

    r20546 r23352  
    195195    }
    196196
    197     int fileD = creat(dest, 0666);
     197    int fileD = open(dest, O_WRONLY | O_CREAT, 0666);
    198198    if (fileD == 0) {
    199199        psError(PS_ERR_IO, true, _("Could not open file '%s' for output."), dest);
     
    316316
    317317    if (write(logFD, head, strlen(head))) {;} // ignore return value
    318    
     318
    319319    if (logMsg) {
    320320        psString msg = NULL;            // Message to print
  • branches/cnb_branches/cnb_branch_20090301/psLib/src/sys/psMemory.c

    r21346 r23352  
    10691069                   memBlock->func, memBlock->file, memBlock->lineno, (unsigned long)memBlock->tid);
    10701070}
     1071
     1072bool psMemTypeEqual (void *ptr1, void *ptr2) {
     1073
     1074    // if ptr is a psAlloc()'d memory, find the actual address of the memBlock
     1075    psMemBlock *memBlock1 = ((psMemBlock *)ptr1) - 1;
     1076    HANDLE_BAD_BLOCK(memBlock1, __FILE__, __LINE__, __func__);
     1077    if (!memBlock1->freeFunc) return false;
     1078
     1079    // if ptr is a psAlloc()'d memory, find the actual address of the memBlock
     1080    psMemBlock *memBlock2 = ((psMemBlock *)ptr2) - 1;
     1081    HANDLE_BAD_BLOCK(memBlock2, __FILE__, __LINE__, __func__);
     1082    if (!memBlock2->freeFunc) return false;
     1083
     1084    return (memBlock1->freeFunc == memBlock2->freeFunc);
     1085}
  • branches/cnb_branches/cnb_branch_20090301/psLib/src/sys/psMemory.h

    r15047 r23352  
    636636);
    637637
     638/** test for matching types (equal free functions)
     639 *
     640 * This function returns true if the two pointers have matching, non-NULL free functions.
     641 * Supplied pointers must have been allocated within the psLib memory system (ie, with a psAlloc) or the function will abort. (XXX just return false?)
     642 * Supplied pointers must have been provided with free function or the function returns false.
     643 */
     644bool psMemTypeEqual (void *ptr1, ///< pointer to first psMemory object
     645                     void *ptr2 ///< pointer to second psMemory object
     646  );
     647
    638648// Ensure this is a psLib pointer
    639649#define PS_ASSERT_PTR_HEAVY(PTR, RVAL) \
Note: See TracChangeset for help on using the changeset viewer.