Esempio n. 1
0
File: cg.c Progetto: zeotrope/j7-src
static DF1(case1){A u;V*sv;
 PREF1(case1);
 sv=VAV(self);
 RZ(u=from(df1(w,sv->g),sv->h));
 ASSERT(!AR(u),EVRANK);
 R df1(w,*AV(u));
}
Esempio n. 2
0
/****************************************************
 * The process callback for this JACK application 
 * (i.e. the audio workhorse function)
 * It is called by JACK at the appropriate times
 * Optimize this function for time!
****************************************************/
int
process (jack_nframes_t nframes, void *arg)
{
    /* consider passing the filter struct */
    //biquad *filter = arg[0];

    sample_t *out = (sample_t *) jack_port_get_buffer (output_port, nframes);
    sample_t *in = (sample_t *) jack_port_get_buffer (input_port, nframes);
    smp_type outsample;

    for(int i = 0; i < nframes; i++) {

	/* compute the output sample */
	outsample = df1((smp_type)in[i], filter);
	out[i] = (sample_t)outsample;
    }
	

    /* bypass switch */
    if( STATE == ON) { 
	memcpy (out, in, sizeof (sample_t) * nframes);
    }

    //printf("%d = %f \n", i, out[i]);
//   printf("%f \n", out[10]);
    return 0;      
}
Esempio n. 3
0
static DF1(jtgsuffix){A h,*hv,z,*zv;I m,n,r;
 RZ(w);
 if(jt->rank&&jt->rank[1]<AR(w)){r=jt->rank[1]; jt->rank=0; R rank1ex(w,self,jt->rank[1],jtgsuffix);}
 jt->rank=0;
 n=IC(w); 
 h=VAV(self)->h; hv=AAV(h); m=AN(h);
 GATV(z,BOX,n,1,0); zv=AAV(z);
 DO(n, RZ(zv[i]=df1(drop(sc(i),w),hv[i%m])););
Esempio n. 4
0
File: cg.c Progetto: zeotrope/j7-src
static DF1(insert){PROLOG;A hs,*hv,z;I hn,j,k,m,n;
 RZ(w);
 m=IC(w); hs=VAV(self)->h; hn=AN(hs); hv=AAV(hs);
 if(!m)R df1(w,iden(*hv));
 j=n=MAX(hn,m-1);
 RZ(z=AR(w)?from(sc(n%m),w):ca(w));
 if(1==n)R z;
 DO(n, --j; k=j%hn; RZ(z=(VAV(hv[k])->f2)(from(sc(j%m),w),z,hv[k])));
 EPILOG(z);
}
Esempio n. 5
0
void foo() {
  df1(&d);
  dg1(&d);
  dh1(&d);
  df2(&d);
  df3(&d);

  struct FA : A {
    void f() {}
  } fa;
  af(&fa);
}
Esempio n. 6
0
File: a.c Progetto: zeotrope/j7-src
static DF1(reduce){PROLOG;DECLF;A y,z;C*u,*v;I c,k,m,old,t;
 RZ(w);
 m=IC(w);
 if(!m)R df1(w,iden(fs));
 RZ(z=tail(w));
 if(1==m)R z;
 t=AT(w); c=AN(z);
 GA(y,t,c,AR(z),AS(z)); u=CAV(y); k=SZT(t,c); v=CAV(w)+k*(m-1);
 old=tbase+ttop;
 DO(m-1, MC(u,v-=k,k); RZ(z=f2(y,z,fs)); gc(z,old));
 EPILOG(z);
}
Esempio n. 7
0
static DF1(jtpowseqlim){PROLOG(0039);A x,y,z,*zv;I i,n;
 RZ(w);
 RZ(z=exta(BOX,1L,1L,20L)); zv=AAV(z); *zv++=x=w;
 i=1; n=AN(z);
 while(1){
  if(n==i){RZ(z=ext(0,z)); zv=i+AAV(z); n=AN(z);}
  RZ(*zv++=x=df1(y=x,self));
  if(equ(x,y)){AN(z)=*AS(z)=i; break;}
  ++i;
 }
 z=ope(z);
 EPILOG(z);
}    /* f^:(<_) w */
Esempio n. 8
0
A jteva(J jt,    A w,C*s){R df1(  w,colon(one,   cstr(s)));}
Esempio n. 9
0
A jtev1(J jt,    A w,C*s){R df1(  w,eval(s));}
Esempio n. 10
0
// [[Rcpp::export]]
Rcpp::DataFrame read_body_gz(std::string x, Rcpp::NumericVector stats, int verbose = 1) {
  // Read in the fixed and genotype portion of the file.

  // Stats contains:
  // "meta", "header", "variants", "columns"

  // Matrix for body data.
  Rcpp::CharacterMatrix gt(stats[2], stats[3]);

  gzFile file;
  file = gzopen (x.c_str(), "r");
  if (! file) {
    Rcpp::Rcerr << "gzopen of " << x << " failed: " << strerror (errno) << ".\n";
    return Rcpp::StringVector(1);
  }

  // Scroll through buffers.
  std::string lastline = "";
  std::vector<std::string> header_vec;
  int var_num = 0;
  while (1) {
    Rcpp::checkUserInterrupt();
    int err;
    int bytes_read;
    char buffer[LENGTH];
    bytes_read = gzread (file, buffer, LENGTH - 1);
    buffer[bytes_read] = '\0';

    std::string mystring(reinterpret_cast<char*>(buffer));  // Recast buffer as a string.
    mystring = lastline + mystring;
    std::vector < std::string > svec;  // Initialize vector of strings for parsed buffer.
    char split = '\n'; // Must be single quotes!
    common::strsplit(mystring, svec, split);

    for(int i = 0; i < svec.size() - 1; i++){
      if(svec[i][0] == '#' && svec[i][1] == '#'){
        // Meta line, ignore.
      } else if(svec[i][0] == '#' && svec[i][1] != '#'){
        // Process header
        char header_split = '\t';
        common::strsplit(svec[i], header_vec, header_split);
      } else {
        // Variant line.
        proc_body_line(gt, var_num, svec[i]);
        var_num++;
        
        if(var_num % nreport == 0 && verbose == 1){
          Rcpp::Rcout << "\rProcessed variant " << var_num;
        }
      }   
//      }
    }
    lastline = svec[svec.size() - 1];


    // Check for EOF or errors.
    if (bytes_read < LENGTH - 1) {
      if (gzeof (file)) {
        break;
      }
      else {
        const char * error_string;
        error_string = gzerror (file, & err);
        if (err) {
          Rcpp::Rcerr << "Error: " << error_string << ".\n";
          return Rcpp::StringVector(1);
        }
      }
    }
  }
  gzclose (file);
  
  header_vec[0] = "CHROM";

//  Rcpp::Rcout << "Length of header_vec: " << header_vec.size() << "\n";
//  Rcpp::Rcout << "Number of columns in gt: " << gt.ncol() << "\n";
//  Rcpp::Rcout << "Number of rows in gt: " << gt.nrow() << "\n";
    
  gt.attr("dimnames") = Rcpp::List::create(Rcpp::CharacterVector::create(), header_vec);

  if(verbose == 1){
    Rcpp::Rcout << "\rProcessed variant: " << var_num;
    Rcpp::Rcout << "\nAll variants processed\n";
  }

//  Rcpp::DataFrame df1 = Rcpp::DataFrame::create(gt);
  Rcpp::DataFrame df1(gt);
//  df1.names() = header_vec;
  if(verbose == 1){
    Rcpp::Rcout << "Rcpp::DataFrame created.\n";
  }
  
//  return gt;
  return df1;
}
Esempio n. 11
0
// (name g h).  If name is ultimately defined as [:, we redefine the derived verb and then run it, with no inplacing for it.  Deprecated.
// The normal path supports inplacing
static DF1(jtcorx1){F1PREFIP;DECLFGH;PROLOG(0030);A z; if(cap(fs))RZ(z=df1(  w,folk(ds(CCAP),gs,hs))) else FOLK1; EPILOG(z);}
Esempio n. 12
0
static DF1(taa){TDECL;A t=df1(w,fs); ASSERT(!t||AT(t)&NOUN+VERB,EVSYNTAX); R df1(t,gs);}
Esempio n. 13
0
File: cg.c Progetto: zeotrope/j7-src
static DF1(gcl1){DECLFG;A*hv=AAV(sv->h);
 R df1(df1(w,hv[2]),df2(df1(w,hv[1]),gs,ds(sv->id)));
}
Esempio n. 14
0
static DF1(jtfitf1){V*sv=VAV(self); R df1(  w,fit(fix(sv->f),sv->g));}