# include <dvo.h>

PhotCode_PS1_DEV_1 *PhotCode_Internal_To_PS1_DEV_1 (PhotCode *in, int Nvalues) {

  int i;
  PhotCode_PS1_DEV_1 *out;

  ALLOCATE (out, PhotCode_PS1_DEV_1, Nvalues);

  for (i = 0; i < Nvalues; i++) {
    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    out[i].name[31] = 0; // force termination

    out[i].code = in[i].code;         
    out[i].type = in[i].type;         
    out[i].C = in[i].C;            
    out[i].dC = in[i].dC;           
    out[i].dX = in[i].dX;           
    out[i].K = in[i].K;            
    out[i].c1 = in[i].c1;           
    out[i].c2 = in[i].c2;           
    out[i].equiv = in[i].equiv;        
    out[i].Nc = in[i].Nc;           
    memcpy (out[i].X, in[i].X, 4*sizeof(float));            

    out[i].astromScale = in[i].astromScale;  
    out[i].photSysErr = in[i].photSysErr;   
  }
  return (out);
}

PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) {

  int i;
  PhotCode *out;

  ALLOCATE (out, PhotCode, Nvalues);

  for (i = 0; i < Nvalues; i++) {
    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    out[i].name[31] = 0; // force termination

    out[i].code = in[i].code;         
    out[i].type = in[i].type;         
    out[i].C = in[i].C;            
    out[i].dC = in[i].dC;           
    out[i].dX = in[i].dX;           
    out[i].K = in[i].K;            
    out[i].c1 = in[i].c1;           
    out[i].c2 = in[i].c2;           
    out[i].equiv = in[i].equiv;        
    out[i].Nc = in[i].Nc;           
    memcpy (out[i].X, in[i].X, 4*sizeof(float));            

    out[i].astromScale = in[i].astromScale;  
    out[i].photSysErr = in[i].photSysErr;   
  }
  return (out);
}
