IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 2, 2006, 3:02:08 PM (20 years ago)
Author:
Paul Price
Message:

Applying RHL patch. Generally improves the error handling and traceback. pmConcepts.c and pmConceptsRead.c done by PAP (RHL did this also, but I had already done them). Resolved conflicts, except for pmFPAfile.c, which uses psAbort in some instances where RHL's patch had psError; leave this for Gene to decide.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfile.c

    r7307 r7311  
    2121#include "pmPSF_IO.h"
    2222#include "pmFPA_JPEG.h"
     23#define WERROR 0                        // if true, warnings in this file are treated as errors
    2324
    2425static void pmFPAfileFree(pmFPAfile *file)
     
    8485    return file;
    8586}
     87
     88static const char *depthEnumToName(pmFPAdepth depth)
     89{
     90    const char *val = NULL;
     91
     92    switch (depth) {
     93    case PM_FPA_DEPTH_NONE:
     94        val = "NONE";
     95        break;
     96    case PM_FPA_DEPTH_FPA:
     97        val = "FPA";
     98        break;
     99    case PM_FPA_DEPTH_CHIP:
     100        val = "CHIP";
     101        break;
     102    case PM_FPA_DEPTH_CELL:
     103        val = "CELL";
     104        break;
     105    case PM_FPA_DEPTH_READOUT:
     106        val = "READOUT";
     107        break;
     108    default:
     109        psAbort(PS_FILE_LINE, "You can't get here; depth = %d", depth);
     110    }
     111
     112    return val;
     113}
     114
     115static pmFPAdepth depthNameToEnum(const char *name)
     116{
     117    pmFPAdepth val;
     118
     119    if (name == NULL) {
     120        val = PM_FPA_DEPTH_NONE;
     121    } else if (!strcasecmp(name, "FPA"))     {
     122        val = PM_FPA_DEPTH_FPA;
     123    } else if (!strcasecmp(name, "CHIP"))    {
     124        val = PM_FPA_DEPTH_CHIP;
     125    } else if (!strcasecmp(name, "CELL"))    {
     126        val = PM_FPA_DEPTH_CELL;
     127    } else if (!strcasecmp(name, "READOUT")) {
     128        val = PM_FPA_DEPTH_READOUT;
     129    } else {
     130        val = PM_FPA_DEPTH_NONE;
     131    }
     132
     133    return val;
     134}
     135
    86136
    87137pmFPAfile *pmFPAfileDefine(psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name)
     
    94144
    95145    bool status;
    96     char *depth;
    97146    char *type;
    98147
     
    100149    psMetadata *filerules = psMetadataLookupPtr (&status, camera, "FILERULES");
    101150    if (filerules == NULL) {
    102         psErrorStackPrint(stderr, "Can't find FILERULES in the CAMERA configuration!\n");
     151        psError(PS_ERR_IO, true, "Can't find FILERULES in the CAMERA configuration!");
    103152        return NULL;
    104153    }
     
    107156    // check for alias name (type == STR, name is aliased name)
    108157    char *realname = psMetadataLookupStr (&status, filerules, name);
    109     if (realname == NULL)
     158    if (!realname || strlen(realname) == 0) {
    110159        realname = name;
     160    }
    111161
    112162    psMetadata *data = psMetadataLookupPtr (&status, filerules, realname);
    113163    if (data == NULL) {
    114         psErrorStackPrint(stderr, "Can't find file concept %s!\n", name);
     164        psError(PS_ERR_IO, true, "Can't find file concept %s!", name);
    115165        return NULL;
    116166    }
     
    126176    file->extxtra  = psMemIncrRefCounter(psMetadataLookupStr (&status, data, "EXTNAME.XTRA"));
    127177
    128     file->fileDepth = PM_FPA_DEPTH_NONE;
    129     depth = psMetadataLookupStr (&status, data, "FILE.DEPTH");
    130     if (depth != NULL) {
    131         if (!strcasecmp (depth, "FPA"))     {
    132             file->fileDepth = PM_FPA_DEPTH_FPA;
    133         }
    134         if (!strcasecmp (depth, "CHIP"))    {
    135             file->fileDepth = PM_FPA_DEPTH_CHIP;
    136         }
    137         if (!strcasecmp (depth, "CELL"))    {
    138             file->fileDepth = PM_FPA_DEPTH_CELL;
    139         }
    140         if (!strcasecmp (depth, "READOUT")) {
    141             file->fileDepth = PM_FPA_DEPTH_READOUT;
    142         }
    143     }
     178    file->fileDepth = depthNameToEnum(psMetadataLookupStr(&status, data, "FILE.DEPTH"));
    144179    if (file->fileDepth == PM_FPA_DEPTH_NONE) {
    145180        psLogMsg (__func__, 3, "warning: FILE.DEPTH is not set for %s\n", name);
    146181    }
    147182
    148     file->dataDepth = PM_FPA_DEPTH_NONE;
    149     depth = psMetadataLookupStr (&status, data, "DATA.DEPTH");
    150     if (depth != NULL) {
    151         if (!strcasecmp (depth, "FPA"))     {
    152             file->dataDepth = PM_FPA_DEPTH_FPA;
    153         }
    154         if (!strcasecmp (depth, "CHIP"))    {
    155             file->dataDepth = PM_FPA_DEPTH_CHIP;
    156         }
    157         if (!strcasecmp (depth, "CELL"))    {
    158             file->dataDepth = PM_FPA_DEPTH_CELL;
    159         }
    160         if (!strcasecmp (depth, "READOUT")) {
    161             file->dataDepth = PM_FPA_DEPTH_READOUT;
    162         }
    163     }
     183    file->dataDepth = depthNameToEnum(psMetadataLookupStr (&status, data, "DATA.DEPTH"));
    164184    if (file->dataDepth == PM_FPA_DEPTH_NONE) {
    165185        psLogMsg (__func__, 3, "warning: DATA.DEPTH is not set for %s\n", name);
     
    240260    pmFPAfile *file = pmFPAfileDefine (files, format, fpa, name);
    241261    psFree (fpa);
     262    if (!file) {
     263        psErrorStackPrint(stderr, "file %s not defined\n", name);
     264        return NULL;
     265    }
    242266    return file;
    243267}
     
    257281
    258282    if (file->state & PM_FPA_STATE_INACTIVE) {
     283        psError(PS_ERR_IO, true, "Atempted to read an inactive file");
    259284        return false;
    260285    }
     
    265290
    266291    if (file->mode == PM_FPA_MODE_NONE) {
     292        psError(PS_ERR_IO, true, "File is mode PM_FPA_MODE_NONE");
    267293        return false;
    268294    }
    269295    if (file->mode == PM_FPA_MODE_INTERNAL) {
     296        psError(PS_ERR_IO, true, "File is mode PM_FPA_MODE_INTERNAL");
    270297        return false;
    271298    }
     
    279306    // determine the file name
    280307    file->filename = pmFPAfileNameFromRule (file->filerule, file, view);
    281     if (file->filename == NULL)
    282         return false;
     308    if (file->filename == NULL) {
     309        psError(PS_ERR_IO, true, "Filename is NULL");
     310        return false;
     311    }
    283312
    284313    // indirect filenames
     
    288317        file->filename = psMetadataLookupStr (&status, file->names, extra);
    289318        psFree (extra);
    290         if (file->filename == NULL)
     319        if (file->filename == NULL) {
    291320            psAbort ("pmFPAfile", "no file specified");
     321        }
    292322        // psMetadataLookupStr just returns a view, file->filename must be protected
    293323        psMemIncrRefCounter (file->filename);
     
    298328        // file->filename = pmDetrendSelect (extra);
    299329        psFree (extra);
    300         if (file->filename == NULL)
     330        if (file->filename == NULL) {
    301331            psAbort ("pmFPAfile", "no file specified");
     332        }
    302333        psMemIncrRefCounter (file->filename);
    303334    }
     
    309340        psTrace ("pmFPAfile", 5, "opening %s (type: %d)\n", file->filename, file->type);
    310341        file->fits = psFitsOpen (file->filename, mode);
    311         if (file->fits == NULL)
    312             psAbort (__func__, "error opening file %s\n", file->filename);
     342        if (file->fits == NULL) {
     343            psError(PS_ERR_IO, false, "error opening file %s\n", file->filename);
     344            return false;
     345        }
    313346        file->state = PM_FPA_STATE_OPEN;
    314347        break;
     
    325358
    326359    default:
    327         fprintf (stderr, "warning: type mismatch for %s : %d\n", file->filename, file->type);
     360        psError(PS_ERR_IO, true, "type mismatch for %s : %d\n", file->filename, file->type);
    328361        return false;
    329362    }
     
    336369    PS_ASSERT_PTR_NON_NULL(view, false);
    337370
    338     if (file->state & PM_FPA_STATE_INACTIVE)
    339         return false;
    340 
    341     if (file->mode != PM_FPA_MODE_READ)
    342         return false;
     371    if (file->state & PM_FPA_STATE_INACTIVE) {
     372        psError(PS_ERR_IO, true, "Atempted to read an inactive file");
     373        return false;
     374    }
     375
     376    if (file->mode != PM_FPA_MODE_READ) {
     377        psError(PS_ERR_IO, true, "File isn't mode PM_FPA_MODE_READ");
     378        return false;
     379    }
    343380
    344381    // get the current depth
     
    347384    // do we need to open this file?
    348385    if (depth == file->fileDepth) {
    349         pmFPAfileOpen (file, view);
     386        if (!pmFPAfileOpen (file, view)) {
     387            psError(PS_ERR_IO, false, "Opening file");
     388            return false;
     389        }
    350390    }
    351391
    352392    // do we need to read this file?
    353     if (depth != file->dataDepth)
    354         return false;
     393    if (depth != file->dataDepth) {
     394        #if WERROR
     395        psError(PS_ERR_IO, true, "Desired depth %s doesn't match dataDepth %s",
     396                depthEnumToName(depth), depthEnumToName(file->dataDepth));
     397        return false;
     398        #else
     399
     400        return true;
     401        #endif
     402
     403    }
    355404
    356405    switch (file->type) {
     
    359408            psTrace ("pmFPAfile", 5, "reading %s (type: %d)\n", file->filename, file->type);
    360409        } else {
    361             psTrace ("pmFPAfile", 5, "skipping %s (type: %d)\n", file->filename, file->type);
     410            psError(PS_ERR_UNKNOWN, false, "skipping %s (type: %d)\n", file->filename, file->type);
     411            return false;
    362412        }
    363413        break;
     
    381431
    382432    default:
    383         fprintf (stderr, "warning: type mismatch\n");
     433        psError(PS_ERR_IO, true, "warning: type mismatch; saw type %d", file->type);
    384434        return false;
    385435    }
     
    393443
    394444    if (file->state & PM_FPA_STATE_INACTIVE) {
     445        psError(PS_ERR_IO, true, "Atempted to write an inactive file");
    395446        return false;
    396447    }
    397448
    398449    if (file->mode != PM_FPA_MODE_WRITE) {
     450        psError(PS_ERR_IO, true, "File isn't mode PM_FPA_MODE_WRITE");
    399451        return false;
    400452    }
     
    404456
    405457    // do we need to write this file?
    406     if (depth != file->dataDepth)
    407         return false;
     458    if (depth != file->dataDepth) {
     459        #if WERROR
     460        psError(PS_ERR_IO, true, "Desired depth %s doesn't match dataDepth %s",
     461                depthEnumToName(depth), depthEnumToName(file->dataDepth));
     462        return false;
     463        #else
     464
     465        return true;
     466        #endif
     467
     468    }
    408469
    409470    // do we need to open this file?
    410471    if (depth >= file->fileDepth) {
    411         pmFPAfileOpen (file, view);
     472        if (!pmFPAfileOpen (file, view)) {
     473            psError(PS_ERR_IO, false, "failed to open %s", file->filename);
     474            return false;
     475        }
    412476    }
    413477
     
    423487    case PM_FPA_FILE_CMP:
    424488    case PM_FPA_FILE_CMF:
    425         pmFPAviewWriteObjects (view, file);
    426         psTrace ("pmFPAfile", 5, "wrote object %s (fpa: %p)\n", file->filename, file->fpa);
     489        psTrace ("pmFPAfile", 5, "writing object %s (fpa: %p)\n", file->filename, file->fpa);
     490        if (!pmFPAviewWriteObjects (view, file)) {
     491            psError(PS_ERR_IO, false, "Failed to write object %s", file->filename);
     492            return false;
     493        }
     494
    427495        break;
    428496
     
    451519
    452520    if (file->state & PM_FPA_STATE_INACTIVE) {
    453         return false;
    454     }
    455     if (file->mode != PM_FPA_MODE_WRITE)
    456         return false;
     521        psError(PS_ERR_IO, true, "Atempted to create an inactive file");
     522        return false;
     523    }
     524    if (file->mode != PM_FPA_MODE_WRITE) {
     525        psError(PS_ERR_IO, true, "File isn't mode PM_FPA_MODE_WRITE");
     526        return false;
     527    }
    457528
    458529    // get the current depth
    459530    pmFPAdepth depth = pmFPAviewDepth (view);
    460531
     532    // XXX is this a sufficient check to avoid creating elements?
     533    if (file->src == NULL) {
     534        #if WERROR
     535        psError(PS_ERR_IO, true, "file->src is NULL");
     536        return false;
     537        #else
     538
     539        return true;
     540        #endif
     541
     542    }
     543
    461544    // do we need to write this file?
    462     if (depth != file->dataDepth)
    463         return false;
    464 
    465     // XXX is this a sufficient check to avoid creating elements?
    466     if (file->src == NULL)
    467         return false;
     545    if (depth != file->dataDepth) {
     546        psError(PS_ERR_IO, true, "Desired depth %s doesn't match dataDepth %s",
     547                depthEnumToName(depth), depthEnumToName(file->dataDepth));
     548        return false;
     549    }
    468550
    469551    switch (file->type) {
     
    484566
    485567    default:
    486         fprintf (stderr, "warning: type mismatch\n");
     568        psError(PS_ERR_IO, true, "Unsupported type: %d", file->type);
    487569        return false;
    488570    }
     
    496578
    497579    if (file->state & PM_FPA_STATE_INACTIVE) {
     580        psError(PS_ERR_IO, true, "Atempted to close an inactive file");
    498581        return false;
    499582    }
     
    505588    pmFPAdepth depth = pmFPAviewDepth (view);
    506589    if (file->fileDepth != depth) {
    507         return false;
     590        #if WERROR
     591        psError(PS_ERR_IO, true, "Desired depth %s doesn't match fileDepth %s",
     592                depthEnumToName(depth), depthEnumToName(file->fileDepth));
     593        return false;
     594        #else
     595
     596        return true;
     597        #endif
     598
    508599    }
    509600
     
    531622
    532623    default:
    533         fprintf (stderr, "warning: type mismatch\n");
     624        psError(PS_ERR_IO, true, "type mismatch: %d", file->type);
    534625        return false;
    535626    }
     
    560651    bool status = false;
    561652    pmFPAfile *file = psMetadataLookupPtr (&status, files, name);
     653    if (!status) {
     654        psError(PS_ERR_IO, true, "Failed to look up file %s", name);
     655        return false;
     656    }
    562657    if (!file) {
     658        psError(PS_ERR_IO, true, "file %s is NULL", name);
    563659        return false;
    564660    }
     
    583679        pmFPAfile *file = item->data.V;
    584680
    585         if (place == PM_FPA_BEFORE) {
    586             pmFPAfileRead (file, view);
    587             pmFPAfileCreate (file, view);
    588         } else {
    589             pmFPAfileWrite (file, view);
    590             pmFPAfileClose (file, view);
     681        switch (place) {
     682        case PM_FPA_BEFORE:
     683            if (file->mode == PM_FPA_MODE_READ && !pmFPAfileRead (file, view)) {
     684                psError(PS_ERR_IO, false, "failed in FPA_BEFORE block for %s", file->name);
     685                psFree(iter);
     686                return false;
     687            }
     688            if (file->mode == PM_FPA_MODE_WRITE && !pmFPAfileCreate(file, view)) {
     689                psError(PS_ERR_IO, false, "failed in FPA_BEFORE block for %s", file->name);
     690                psFree(iter);
     691                return false;
     692            }
     693            break;
     694        case PM_FPA_AFTER:
     695            if (file->mode == PM_FPA_MODE_WRITE && !pmFPAfileWrite (file, view)) {
     696                psError(PS_ERR_IO, false, "failed in FPA_AFTER block for %s", file->name);
     697                psFree(iter);
     698                return false;
     699            }
     700            if (!pmFPAfileClose(file, view)) {
     701                psError(PS_ERR_IO, false, "failed in FPA_AFTER block for %s", file->name);
     702                psFree(iter);
     703                return false;
     704            }
     705            break;
     706        default:
     707            psAbort(PS_FILE_LINE, "You can't get here");
    591708        }
    592709    }
    593710    psFree (iter);
     711
    594712    return true;
    595713}
     
    627745
    628746    pmFPAfile *file = psMetadataLookupPtr (&status, files, name);
    629     if (file == NULL)
    630         return false;
    631 
    632     if (file->mode != PM_FPA_MODE_INTERNAL)
    633         return false;
     747    if (file == NULL) {
     748        psError(PS_ERR_IO, true, "Failed to lookup %s", name);
     749        return false;
     750    }
     751
     752    if (file->mode != PM_FPA_MODE_INTERNAL) {
     753        psError(PS_ERR_IO, true, "File %s has mode %d != PM_FPA_MODE_INTERNAL", name, file->mode);
     754        return false;
     755    }
    634756
    635757    psMetadataRemoveKey (files, name);
     
    648770
    649771    pmFPAfile *file = psMetadataLookupPtr (&status, files, name);
    650     if (file == NULL)
    651         return NULL;
     772    if (file == NULL) {
     773        return NULL;
     774    }
    652775
    653776    // internal files have the readout as a separate element:
     
    677800
    678801    if (view->chip >= fpa->chips->n) {
     802        psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %d", view->chip, fpa->chips->n);
    679803        return false;
    680804    }
     
    687811
    688812    if (view->cell >= chip->cells->n) {
     813        psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %d", view->cell, chip->cells->n);
    689814        return false;
    690815    }
     
    695820        return status;
    696821    }
     822    psError(PS_ERR_UNKNOWN, true, "Returning false");
    697823    return false;
    698824
    699825    // XXX pmReadoutRead, pmReadoutReadSegement disabled for now
    700     # if (0)
    701 
    702         if (view->readout >= cell->readouts->n) {
    703             return false;
    704         }
     826    #if 0
     827
     828    if (view->readout >= cell->readouts->n) {
     829        psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouts->n == %d",
     830                view->readout, cell->readouts->n);
     831        return false;
     832    }
    705833    pmReadout *readout = cell->readouts->data[view->readout];
    706834
     
    711839    }
    712840    return true;
    713     # endif
     841    #endif
    714842}
    715843
     
    731859
    732860    if (view->chip >= fpa->chips->n) {
     861        psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %d", view->chip, fpa->chips->n);
    733862        return false;
    734863    }
     
    757886
    758887    if (view->cell >= chip->cells->n) {
     888        psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %d", view->cell, chip->cells->n);
    759889        return false;
    760890    }
     
    762892
    763893    if (view->readout == -1) {
    764         pmCellWrite (cell, fits, NULL, true);
    765         return true;
    766     }
     894        return pmCellWrite (cell, fits, NULL, true);
     895    }
     896    psError(PS_ERR_UNKNOWN, true, "Returning false");
    767897    return false;
    768898
    769899    // XXX disable readout write for now
    770     # if (0)
    771 
    772         if (view->readout >= cell->readouts->n) {
    773             return false;
    774         }
     900    #if 0
     901
     902    if (view->readout >= cell->readouts->n) {
     903        psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouts->n == %d",
     904                view->readout, cell->readouts->n);
     905        return false;
     906    }
    775907    pmReadout *readout = cell->readouts->data[view->readout];
    776908
     
    781913    }
    782914    return true;
    783     # endif
     915    #endif
    784916}
    785917
     
    808940    psArray *infiles = psMetadataLookupPtr(&status, config->arguments, argname);
    809941    if (!status) {
     942        psError(PS_ERR_IO, false, "Failed to read %s from metadata\n", argname);
    810943        return NULL;
    811944    }
    812945    if (infiles->n < 1) {
     946        psError(PS_ERR_IO, false, "Found n == %d files in %s from metadata\n", infiles->n, argname);
    813947        return NULL;
    814948    }
     
    819953    phu = psFitsReadHeader (NULL, fits);
    820954    format = pmConfigCameraFormatFromHeader (config, phu);
    821     psFitsClose (fits);
     955    psFitsClose (fits);                        // don't close phu; we'll use it below
     956    if (!format) {
     957        psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", infiles->data[0]);
     958        psFree(phu);
     959        return NULL;
     960    }
    822961
    823962    // build the template fpa, set up the basic view
    824963    fpa = pmFPAConstruct (config->camera);
     964    if (!fpa) {
     965        psError(PS_ERR_IO, false, "Failed to construct FPA from %s", infiles->data[0]);
     966        return NULL;
     967    }
    825968
    826969    // load the given filerule (from config->camera) and associate it with the fpa
     
    828971    file = pmFPAfileDefine (config->files, config->camera, fpa, filename);
    829972    if (!file) {
    830         psErrorStackPrint(stderr, "file %s not defined\n", filename);
     973        psError(PS_ERR_IO, false, "file %s not defined", filename);
     974        psFree(phu);
    831975        psFree (fpa);
    832976        psFree (format);
     
    854998        // set the view to the corresponding entry for this phu
    855999        pmFPAview *view = pmFPAAddSourceFromHeader (fpa, phu, format);
     1000        if (!view) {
     1001            psError(PS_ERR_IO, false, "Failed to set view from file %s", infiles->data[i]);
     1002            psFree(phu);
     1003            psFree (fpa);
     1004            psFree (format);
     1005            return NULL;
     1006        }
    8561007
    8571008        // XXX is this the correct psMD to save the filename?
     
    8711022
    8721023// XXX this this function through, then finish
    873 # if 0
     1024#if 0
    8741025// look for the given name on the argument list.
    8751026// returns the file (a view to the one saved on config->files)
     
    9251076    file = pmFPAfileDefine (config->files, config->camera, fpa, filename);
    9261077    if (!file) {
    927         psErrorStackPrint(stderr, "file %s not defined\n", filename);
     1078        psError(PS_ERR_IO, false, "file %s not defined", filename);
    9281079        psFree (fpa);
    9291080        psFree (format);
     
    9661117    return file;
    9671118}
    968 # endif
     1119#endif
    9691120
    9701121// create a new output pmFPAfile based on an existing FPA
     
    9791130    pmFPA *fpa = pmFPAConstruct (config->camera);
    9801131    pmFPAfile *file = pmFPAfileDefine (config->files, config->camera, fpa, filename);
     1132    if (!file) {
     1133        psErrorStackPrint(stderr, "file %s not defined\n", filename);
     1134        return NULL;
     1135    }
    9811136    file->src = src; // inherit output elements from this source pmFPA
    9821137    file->xBin = xBin;
     
    10141169    file = pmFPAfileDefine (config->files, config->camera, NULL, filename);
    10151170    if (!file) {
    1016         psErrorStackPrint(stderr, "file %s not defined\n", filename);
     1171        psError(PS_ERR_IO, false, "file %s not defined\n", filename);
    10171172        return NULL;
    10181173    }
     
    11201275    newName = psStringCopy (rule);
    11211276
     1277    if (strstr (newName, "{OUTPUT}") != NULL) {
     1278        char *name = psMetadataLookupStr (NULL, file->names, "OUTPUT");
     1279        if (name != NULL) {
     1280            newName = psStringSubstitute (newName, name, "{OUTPUT}");
     1281        }
     1282    }
    11221283    if (strstr (newName, "{CHIP.NAME}") != NULL) {
    11231284        pmChip *chip = pmFPAviewThisChip (view, file->fpa);
     
    11441305        }
    11451306    }
    1146     if (strstr (newName, "{OUTPUT}") != NULL) {
    1147         char *name = psMetadataLookupStr (NULL, file->names, "OUTPUT");
    1148         if (name != NULL) {
    1149             newName = psStringSubstitute (newName, name, "{OUTPUT}");
    1150         }
    1151     }
    11521307    return newName;
    11531308}
     
    11671322    }
    11681323    if (view->chip >= in->chips->n) {
     1324        psError(PS_ERR_IO, true, "Requested chip == %d >= in->chips->n == %d", view->chip, in->chips->n);
    11691325        return false;
    11701326    }
     
    11771333    }
    11781334    if (view->cell >= inChip->cells->n) {
     1335        psError(PS_ERR_IO, true, "Requested cell == %d>= inChip->cells->n == %d",
     1336                view->cell, inChip->cells->n);
    11791337        return false;
    11801338    }
     
    11861344        return true;
    11871345    }
     1346    psError(PS_ERR_UNKNOWN, true, "Returning false");
    11881347    return false;
    11891348
     
    12031362    if (view->chip == -1) {
    12041363        pmFPAAddSourceFromView (out, view, format);
    1205         pmFPACopyStructure (out, in, xBin, yBin);
    1206         return true;
     1364        return pmFPACopyStructure (out, in, xBin, yBin);
    12071365    }
    12081366    if (view->chip >= in->chips->n) {
     1367        psError(PS_ERR_IO, true, "Requested chip == %d >= in->chips->n == %d", view->chip, in->chips->n);
    12091368        return false;
    12101369    }
     
    12141373    if (view->cell == -1) {
    12151374        pmFPAAddSourceFromView (out, view, format);
    1216         pmChipCopyStructure (outChip, inChip, xBin, yBin);
    1217         return true;
     1375        return pmChipCopyStructure (outChip, inChip, xBin, yBin);
    12181376    }
    12191377    if (view->cell >= inChip->cells->n) {
     1378        psError(PS_ERR_IO, true, "Requested cell == %d>= inChip->cells->n == %d",
     1379                view->cell, inChip->cells->n);
    12201380        return false;
    12211381    }
     
    12251385    if (view->readout == -1) {
    12261386        pmFPAAddSourceFromView (out, view, format);
    1227         pmCellCopyStructure (outCell, inCell, xBin, yBin);
    1228         return true;
    1229     }
     1387        return pmCellCopyStructure (outCell, inCell, xBin, yBin);
     1388    }
     1389    psError(PS_ERR_UNKNOWN, true, "Returning false");
    12301390    return false;
    12311391
Note: See TracChangeset for help on using the changeset viewer.