static void ploti(const char *line ) { int t, tt, g, n, h, S, E; plotv *y, *x, *dx, *dy; forecast r; if ( (n=sscanf( line, "%*s %d %d %d", &g, &S, &E ))!=EOF ) { if ( n == 1 ) { S = 0; E = datalen( DATA_TARGET ); } else { S = max( 0, S ); E = min( E, datalen( DATA_TARGET ) ); } if ( 0 < g && g <= status.curgen ) { g--; n = E - S; x = ymalloc( status.length * n * sizeof(plotv) ); y = ymalloc( status.length * n * sizeof(plotv) ); dx = ymalloc( n * sizeof(plotv) ); dy = ymalloc( n * sizeof(plotv) ); tt = 0; for ( t = S; t < E; t++ ) { dy[t-S] = getdata( DATA_TARGET, t ); dx[t-S] = t; r = evali( run[g].besti, t ); for ( h = 0; h < status.length; h++ ) { x[tt] = t + h + status.horizon; y[tt] = r.v[h]; tt++; } } gp_plotarray( port, GP_PLOT, GP_TITLE "\"data\"" GP_DOTS, dx, dy, n ); gp_plotarray( port, GP_REPLOT, GP_TITLE "\"forecast\"" GP_DOTS, x, y, n * status.length ); yfree( x ); yfree( y ); yfree( dx ); yfree( dy ); } else fprintf( stderr, "individual must lie in [1,%d]\n", status.curgen ); } else p_error( "no individual" ); }
void breakpoint_Relocation::unpack_data() { _bits = live_bits(); int targetlen = datalen() - 1 - instrlen(); jint target_bits = 0; if (targetlen == 0) target_bits = 0; else if (targetlen == 1) target_bits = binding()->short_data_at(1); else if (targetlen == 2) target_bits = binding()-> long_data_at(1); else { ShouldNotReachHere(); } _target = internal() ? address_from_scaled_offset(target_bits) : index_to_runtime_address ((intptr_t)target_bits); }
relocInfo* relocInfo::finish_prefix(short* prefix_limit) { assert(sizeof(relocInfo) == sizeof(short), "change this code"); short* p = (short*) data(); assert(prefix_limit >= p, "must be a valid span of data"); int plen = prefix_limit - p; if (plen == 0) { debug_only(_value = 0xFFFF); return this; // no data: remove self completely } if (plen == 1) { int data0 = p[0]; if (data0 >= 0 && data0 < immediate_limit) { (*this) = immediate_relocInfo(data0); // move data inside self return this+1; } } // cannot compact, so just update the count and return the limit pointer (*this) = prefix_relocInfo(plen); // write new datalen assert(data() + datalen() == prefix_limit, "pointers must line up"); return (relocInfo*)prefix_limit; }
bool CreateForestMapByRawData(ForestMap & fmap,const char *lpbuf,S_UINT bufsize) { if(lpbuf==NULL) return false; if(bufsize<sizeof(S_UINT)) return false; S_UINT len=0,tlen=sizeof(S_UINT); try{ fmap.clear(); const char *pend=lpbuf+bufsize; const char *pt=lpbuf; memmove(&len,pt,tlen); pt+=tlen; if(pt>pend) return false; if(len!=bufsize) { puts("Raw data of ForestMap error"); return false; } S_UINT count; memmove(&count,pt,tlen); pt+=tlen; std::string str; S_UINT datalen(0); const char * data(NULL); for(S_UINT i=0;i<count;i++) { str=pt; pt+=strlen(str.c_str())+1; if(pt>pend) return true; memmove(&datalen,pt,tlen); pt+=tlen; if(pt>pend) return true; data=pt; pt+=datalen; if(pt>pend) return true; NodeData ndata; if( CreateNodeDataByRawData(ndata, data, datalen) ) fmap.insert(std::make_pair( str,ndata )); } }catch(...) { cout<<"Exception to CreateForestMapByRawData."<<endl; return false; } return true; }
int main (int argc, char * argv []) { FILE * fp; char *Data1; long int Input_Size; long int Data1_Len; char Name1[MAX_LINE]; long int ssno; Site **Sites; long int len, proclen,offset,printlen,goback; int start,stop; int *offgene; int i; int predno; // ---------------------------- OPTIONS ------------------------------ if (argc < 2) { fprintf (stderr, "USAGE: %s <genome1-file> <training-dir-for-genome1> [options] \n", argv [0]); fprintf(stderr,"Options:\n"); fprintf(stderr,"-p file_name If protein domain searches are available, read them from file file_name\n"); fprintf(stderr,"-d dir_name Training directory is specified by dir_name (introduced for compatibility with earlier versions)\n"); fprintf(stderr,"-o file_name Print output in file_name; if n>1 for top best predictions, output is in file_name.1, file_name.2, ... , file_name.n f\n"); fprintf(stderr,"-n n Print top n best predictions\n"); fprintf(stderr,"-g Print output in gff format\n"); fprintf(stderr,"-v Don't use svm splice site predictions\n"); fprintf(stderr,"-f Don't make partial gene predictions\n"); fprintf(stderr,"-h Display the options of the program\n"); exit (-1); } Process_Options (argc, argv); // Set global variables to reflect status of // command-line options. // -> options should include the possibility to predict in only one genome (maximize score only for one, and not for the other <- kept constant) // --------------------------- READ DATA ------------------------------ fp = File_Open (argv [1], "r"); len=datalen(fp,Name1); if(len<INIT_SIZE) Input_Size=len+2; else Input_Size=INIT_SIZE+2; Data1 = (char *) malloc(Input_Size*sizeof(char)); if(Data1 == NULL ) { fprintf (stderr, "ERROR: Unable to alloc memory for input sequence\n"); exit (0); } Data1[0]='n'; start=1; goback=0; proclen=0; offgene = (int *) malloc(PREDNO*sizeof(int)); if(offgene == NULL) { fprintf(stderr,"ERROR: Unable to alloc memory for number of genes\n"); exit(0); } for(i=0;i<PREDNO;i++) offgene[i]=1; while(proclen<len) { Data1_Len = LoadData(fp,Data1,INIT_SIZE,goback)-1; if(!start) offset=proclen-OVLP_SIZE/2; else offset=0; // run graph file /*if(PREDNO==1) { predno=2;} // this here might be useful when using intron distribution; but you need to remember it when freeing the memory for Sites else*/ predno=PREDNO; // fprintf(stderr,"protein dom file = %s\n",proteindom_file); Sites=graph(Data1,Data1_Len,TRAIN_DIR,&ssno,proteindom_file,offset,ese,Name1,predno,force); // print data stop = proclen+Data1_Len<len ? 0 : 1; printlen=printgenes(Sites,ssno,start,stop,OVLP_SIZE/2,offset,offgene,Name1,len); if(!stop) { proclen=printlen; goback=INIT_SIZE-proclen+offset+OVLP_SIZE/2; } else proclen=len; start=0; fprintf(stderr,"Done %d bp\n",proclen); } free(offgene); }
void RelocIterator::print_current() { if (!has_current()) { tty->print_cr("(no relocs)"); return; } tty->print("relocInfo@" INTPTR_FORMAT " [type=%d(%s) addr=" INTPTR_FORMAT, _current, type(), reloc_type_string((relocInfo::relocType) type()), _addr); if (current()->format() != 0) tty->print(" format=%d", current()->format()); if (datalen() == 1) { tty->print(" data=%d", data()[0]); } else if (datalen() > 0) { tty->print(" data={"); for (int i = 0; i < datalen(); i++) { tty->print("%04x", data()[i] & 0xFFFF); } tty->print("}"); } tty->print("]"); switch (type()) { case relocInfo::oop_type: { oop_Relocation* r = oop_reloc(); oop* oop_addr = NULL; oop raw_oop = NULL; oop oop_value = NULL; if (code() != NULL || r->oop_index() == 0) { oop_addr = r->oop_addr(); raw_oop = *oop_addr; oop_value = r->oop_value(); } tty->print_cr(" | [oop_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " offset=%d]", oop_addr, raw_oop, r->offset()); // Do not print the oop by default--we want this routine to // work even during GC or other inconvenient times. if (WizardMode && oop_value != NULL) { tty->print("oop_value=" INTPTR_FORMAT ": ", oop_value); oop_value->print_value_on(tty); } break; } case relocInfo::external_word_type: case relocInfo::internal_word_type: { DataRelocation* r = (DataRelocation*) reloc(); tty->print(" | [target=" INTPTR_FORMAT "]", r->value()); //value==target break; } case relocInfo::static_call_type: case relocInfo::runtime_call_type: case relocInfo::jsr_type: { CallRelocation* r = (CallRelocation*) reloc(); tty->print(" | [destination=" INTPTR_FORMAT "]", r->destination()); break; } case relocInfo::virtual_call_type: { virtual_call_Relocation* r = (virtual_call_Relocation*) reloc(); tty->print(" | [destination=" INTPTR_FORMAT " first_oop=" INTPTR_FORMAT " oop_limit=" INTPTR_FORMAT "]", r->destination(), r->first_oop(), r->oop_limit()); break; } case relocInfo::static_stub_type: { static_stub_Relocation* r = (static_stub_Relocation*) reloc(); tty->print(" | [static_call=" INTPTR_FORMAT "]", r->static_call()); break; } } tty->cr(); }