Beispiel #1
0
static IDL_VPTR IDLOldRawClose(int argc,IDL_VPTR *argv) {
  int s=0;
  struct OldRawIDLFp *irawfp;
  IDL_VARIABLE unit;
  IDL_VPTR farg[1];

  IDL_ENSURE_STRUCTURE(argv[0]);
 
  irawfp=(struct OldRawIDLFp *) argv[0]->value.s.arr->data;

  unit.type=IDL_TYP_LONG;
  unit.flags=0;
  farg[0]=&unit;
  IDL_StoreScalar(farg[0],IDL_TYP_LONG,(IDL_ALLTYPES *) &irawfp->rawunit);

  IDL_FileFreeUnit(1,farg);

  if (irawfp->inxunit !=-1) {
    IDL_StoreScalar(farg[0],IDL_TYP_LONG,(IDL_ALLTYPES *) &irawfp->inxunit);
    IDL_FileFreeUnit(1,farg);
  }

  return (IDL_GettmpLong(s));

}
Beispiel #2
0
void pvcam_set_gain(int argc, IDL_VPTR argv[], char *argk)
{
    /* Parameter Variables */
    int16 hcam;                         /* A pointer to the camera's handle. */
    int16 gain;
    char error = 0;

    /* Point parameter variables to the actual IDL values. */
    hcam = (int16)IDL_LongScalar(argv[0]);
    gain = (int16)IDL_LongScalar(argv[1]);
    error = !ccd_set_gain(hcam, gain);

    /* Handling the error keyword */
    KW_RESULT kw;
    argc = IDL_KWProcessByOffset(argc,argv,argk,kw_pars,(IDL_VPTR *)0,1,&kw);
    if (kw.iError) {
        IDL_StoreScalar(kw.iError, IDL_TYP_BYTE, (IDL_ALLTYPES*) &error);
    }
    IDL_KW_FREE;
}
Beispiel #3
0
static IDL_VPTR IDLOldCnvMapSeek(int argc,IDL_VPTR *argv,char *argk) {

  struct OldCnvMapIDLInx *ifptr;

  int s=0,n;
  struct RfileIndex *finx=NULL;
  static IDL_VPTR vatme;
  double atme=0;

  int outargc=0;
  IDL_VPTR outargv[8];
  static IDL_KW_PAR kw_pars[]={IDL_KW_FAST_SCAN,
			       {"ATME",IDL_TYP_UNDEF,1,
                                IDL_KW_OUT | IDL_KW_ZERO,0,
                                IDL_CHARA(vatme)},
				 {NULL}};


  IDL_LONG unit=0,yr=0,mo=0,dy=0,hr=0,mt=0,sc=0;
  IDL_FILE_STAT stat;

  FILE *fp=NULL;

  IDL_KWCleanup(IDL_KW_MARK);
  outargc=IDL_KWGetParams(argc,argv,argk,kw_pars,outargv,1);


  IDL_ENSURE_SCALAR(outargv[0]);
  IDL_ENSURE_SCALAR(outargv[1]);
  IDL_ENSURE_SCALAR(outargv[2]);
  IDL_ENSURE_SCALAR(outargv[3]);
  IDL_ENSURE_SCALAR(outargv[4]);
  IDL_ENSURE_SCALAR(outargv[5]);
  IDL_ENSURE_SCALAR(outargv[6]);

  if (outargc>7) IDL_ENSURE_ARRAY(outargv[7]);

  unit=IDL_LongScalar(outargv[0]);

  s=IDL_FileEnsureStatus(IDL_MSG_RET,unit,IDL_EFS_USER);

  if (s==FALSE) {
    s=-1;
    return (IDL_GettmpLong(s));
  }

  /* Get information about the file */

  IDL_FileFlushUnit(unit);
  IDL_FileStat(unit,&stat);
 
  /* Find the file pointer */

  fp=stat.fptr;
  
  if (fp==NULL) {
    s=-1;
    return (IDL_GettmpLong(s));
  }

  yr=IDL_LongScalar(outargv[1]);
  mo=IDL_LongScalar(outargv[2]);
  dy=IDL_LongScalar(outargv[3]);
  hr=IDL_LongScalar(outargv[4]);
  mt=IDL_LongScalar(outargv[5]);
  sc=IDL_LongScalar(outargv[6]);

  /* test for existence of index */

  if (outargc>7) {
    /* decode index here */
    finx=malloc(sizeof(struct RfileIndex));
    if (finx==NULL) {
      s=-1;
      return (IDL_GettmpLong(s));
    }
    finx->num=outargv[7]->value.s.arr->n_elts;
    finx->time.start=malloc(sizeof(double)*finx->num);
    if (finx->time.start==NULL) {
      s=-1;
      free(finx);
      return (IDL_GettmpLong(s));
    } 
    finx->time.end=malloc(sizeof(double)*finx->num);
    if (finx->time.end==NULL) {
      s=-1;
      free(finx->time.start);
      free(finx);
      return (IDL_GettmpLong(s));
    } 

    finx->offset=malloc(sizeof(int)*finx->num);
    if (finx->offset==NULL) {
      s=-1;
      free(finx->time.start);
      free(finx->time.end);
      free(finx);
      return (IDL_GettmpLong(s));
    } 
    for (n=0;n<finx->num;n++) {
      ifptr=(struct OldCnvMapIDLInx *) (outargv[7]->value.s.arr->data+
                                    n*outargv[7]->value.s.arr->elt_len);
      finx->time.start[n]=ifptr->st_time;
      finx->time.end[n]=ifptr->ed_time;
      finx->offset[n]=ifptr->offset;
    }
    finx->st_time=finx->time.start[0];
    finx->ed_time=finx->time.end[finx->num-1];

  }


  s=OldCnvMapFseek(fp,yr,mo,dy,hr,mt,sc,finx,&atme);

  if (vatme) IDL_StoreScalar(vatme,IDL_TYP_DOUBLE,(IDL_ALLTYPES *) &atme);
 
  if (finx !=NULL) {
    free(finx->time.start);
    free(finx->time.end);
    free(finx->offset);
    free(finx);
  }
   
  IDL_KWCleanup(IDL_KW_CLEAN);
  return (IDL_GettmpLong(s));


}
Beispiel #4
0
static IDL_VPTR IDLOldRawSeek(int argc,IDL_VPTR *argv,char *argk) {

  IDL_FILE_STAT stat;
  struct OldRawIDLFp *irawfp;
  struct OldRawFp rawfp;
  int s=0;
  static IDL_VPTR vatme;
  double atme=0;

  IDL_VPTR outargv[8];
  static IDL_KW_PAR kw_pars[]={IDL_KW_FAST_SCAN,
			       {"ATME",IDL_TYP_UNDEF,1,
                                IDL_KW_OUT | IDL_KW_ZERO,0,
                                IDL_CHARA(vatme)},
				 {NULL}};


  IDL_LONG yr=0,mo=0,dy=0,hr=0,mt=0,sc=0;
  FILE *ffp=NULL,*ifp=NULL;

  IDL_KWCleanup(IDL_KW_MARK);
  IDL_KWGetParams(argc,argv,argk,kw_pars,outargv,1);

  IDL_ENSURE_STRUCTURE(outargv[0]);
  IDL_ENSURE_SCALAR(outargv[1]);
  IDL_ENSURE_SCALAR(outargv[2]);
  IDL_ENSURE_SCALAR(outargv[3]);
  IDL_ENSURE_SCALAR(outargv[4]);
  IDL_ENSURE_SCALAR(outargv[5]);
  IDL_ENSURE_SCALAR(outargv[6]);

  yr=IDL_LongScalar(outargv[1]);
  mo=IDL_LongScalar(outargv[2]);
  dy=IDL_LongScalar(outargv[3]);
  hr=IDL_LongScalar(outargv[4]);
  mt=IDL_LongScalar(outargv[5]);
  sc=IDL_LongScalar(outargv[6]);

  irawfp=(struct OldRawIDLFp *) outargv[0]->value.s.arr->data;
  
  s=IDL_FileEnsureStatus(IDL_MSG_RET,irawfp->rawunit,IDL_EFS_USER);

  if (s==FALSE) {
    s=-1;
    return (IDL_GettmpLong(s));
  }

  IDL_FileFlushUnit(irawfp->rawunit);
  IDL_FileStat(irawfp->rawunit,&stat);
 

  ffp=stat.fptr;
  
  if (ffp==NULL) {
    s=-1;
    return (IDL_GettmpLong(s));
  }
 
  if (irawfp->inxunit !=-1) {
    IDL_FileFlushUnit(irawfp->inxunit);
    IDL_FileStat(irawfp->inxunit,&stat);
    ifp=stat.fptr;
  }

  if (ifp !=NULL) fflush(ifp);

  rawfp.rawfp=fileno(ffp);
  if (ifp !=NULL) rawfp.inxfp=fileno(ifp);
  else rawfp.inxfp=-1;

  OldRawIDLToRawFp(irawfp,&rawfp);

  s=OldRawSeek(&rawfp,yr,mo,dy,hr,mt,sc,&atme);

  OldRawRawFpToIDL(&rawfp,irawfp);


  if (vatme) IDL_StoreScalar(vatme,IDL_TYP_DOUBLE,(IDL_ALLTYPES *) &atme);
 
  IDL_KWCleanup(IDL_KW_CLEAN);
  return (IDL_GettmpLong(s));
}