📄 ttools.c
字号:
#ifndef __TURBOC__ SigSaveSet=sigblock(SigBlockSet); #endifBuff[0]= '*'; Buff[1]= '\0';/*if (HistSize > 4) { l = (int) HistSize/2; n = (size < Hist[l].size)?0:(l-1); }else n=0L;*//* for(; n < HistSize; n++) */for(n =0; n < HistSize; n++) { if ((I32u)sl[Hist[n].size] < 4L) {empty++; continue;} if (IMode == GEN_HIST) { if ((I32u)sl[Hist[n].size]->g[Hist[n].lbl] < 4L) { empty++; tcount = 0; } else tcount = sl[Hist[n].size]->g[Hist[n].lbl]->pop; } else if (IMode == SIZM_HIST) { tcount = size * sl[Hist[n].size]->num_c; } else tcount = sl[Hist[n].size]->num_c; if ((tcount < 1L)&& (++empty > 3)) { query_species(fe_lines);#ifdef unix (void)sigsetmask(SigSaveSet); #endif return; } if (Hist[n].size == size) { if ((IMode == GEN_HIST) && (Hist[n].lbl != lbl)) continue; if( tcount > 0L ) { old_n_star = Hist[n].nstar; l = HistNStars * tcount; Hist[n].nstar = (l > 255)?255 : l; ns_dlta = Hist[n].nstar - old_n_star; } else { old_n_star = 0L; Hist[n].nstar = 0; ns_dlta = 0L; Buff[0] = ' '; } if (IMode == GEN_HIST) FEPrintf(MSG_X+10,MSG_Y+n,0,"%6ld", tcount); else FEPrintf(MSG_X+6,MSG_Y+n,0,"%3hd %6ld",sl[Hist[n].size]->num_g, tcount); if (Hist[n].nstar && !ns_dlta) break; if (Hist[n].nstar > (fe_width)) { Buff[0] = '+'; old_n_star = 1+fe_width; ns_dlta = 0; Hist[n].nstar=fe_width; } else { if ( ns_dlta > 1L) { for(l= 0;l < ns_dlta;l++,strcat(Buff, "*")); ns_dlta=0; } } FEPrintf((MSG_X+19+old_n_star+ns_dlta),MSG_Y+n,0,"%s\n",Buff); break; }}#ifndef __TURBOC__ (void)sigsetmask(SigSaveSet); #endif}#endif /* FRONTEND == BASIC *//*-----------------------------------------------------------------------*/#ifdef unix/*-----------------------------------------------------------------------*//* THIS CODE IS NOT FINISHED */void T_sig_read(sig,code,scp,addr) I32s sig,code; /* struct sigcontext *scp; */ I32s *scp; /* DO NOT USE !!!!! */ I8s *addr;{ FILE *inf; I8s data[85]; I32s i; struct s_list **tsl; signal(SIGUSR1, T_sig_read); FEError(-1506,NOEXIT,NOWRITE, "=========================================================="); FEError(-1507,NOEXIT,NOWRITE,"TIERRA: re-read soup_in (%s) ...",soup_fn); inf = fopen(soup_fn, "r"); if (inf == NULL) { FEError(-1508,EXIT,NOWRITE, "Tierra T_sig_read() GetSoupIn: file %s not opened, exiting", soup_fn); } fgets(data, 84, inf); sscanf(data, "tierra core:"); /* file header line */ fgets(data, 84, inf); /* blank line */ fgets(data, 84, inf); while (strlen(data) > 3) { if (!GetAVar(data)) FEError(-1509,NOEXIT,NOWRITE, "Tierra T_sig_read() bad soup_in line: %s", data); fgets(data, 84, inf); } FEError(-1510,NOEXIT,NOWRITE, "=========================================================="); ToggleLog(0L);}#endif /* unix *//*-----------------------------------------------------------------------*/#ifdef unix/*-----------------------------------------------------------------------*//* THIS CODE IS NOT FINISHED */void T_sig_write(sig,code,scp,addr) I32s sig,code; /* struct sigcontext *scp; */ I32s *scp; /* DO NOT USE !!!!! */ I8s *addr;{signal(SIGHUP, T_sig_write); FEError(-1511,NOEXIT,NOWRITE, "=========================================================="); FEError(-1512,NOEXIT,WRITE,"TIERRA: writing soup ..."); FEError(-1513,NOEXIT,NOWRITE, "==========================================================");}#endif /* unix *//*-----------------------------------------------------------------------*/#ifdef unix/*-----------------------------------------------------------------------*//* THIS CODE IS NOT FINISHED */void T_sig_info(sig,code,scp,addr) I32s sig,code; /* struct sigcontext *scp; */ I32s *scp; /* DO NOT USE !!!!! */ I8s *addr;{I32s t_hist_print = HistPrint;signal(SIGUSR2, T_sig_info);if(!HistPrint) HistPrint = 1L; sprintf(mes[0], "---------------------------------------------------------"); sprintf(mes[1],"InstExe.m = %6ld InstExec.i = %6ld NumCells = %4ld ", InstExe.m,InstExe.i,NumCells); FEMessage(2,mes); if(GeneBnker) { sprintf(mes[0],"NumGenotypes = %4ld NumSizes = %4ld", NumGenotypes, NumSizes); FEMessage(1,mes); } sprintf(mes[0], "---------------------------------------------------------"); FEMessage(1,mes); query_species(20); sprintf(mes[0], "---------------------------------------------------------"); FEMessage(1,mes);HistPrint = t_hist_print;}#endif /* unix *//*-----------------------------------------------------------------------*/void ToggleLog(mode)I32s mode;{ if (Log && (tfp_log == NULL)) { if(!new_soup) tfp_log = fopen("tierra.log","a"); else tfp_log = fopen("tierra.log","w"); if(tfp_log == NULL) { FEError(-1514,NOEXIT,NOWRITE, "Tierra ToggleLog() Problem opening - tierra.log "); } } if(!Log && ( tfp_log )) {fclose(tfp_log);tfp_log = NULL;} sprintf(mes[0],"TIERRA: LOG = %s, Histogram Logging = %s \n", (Log)? "on" : "off", (HistPrint)? "on" : "off"); FEMessage(1,mes);}/* ----------------------------------------------------------------------*/#ifdef MICROvoid Micro_Spy(ce)Pcells ce;{I32s tlog,off_int;I8s off_char = ' ',d_data[80],cc; IMode= PLN_STATS; tlog = Log; Log = 0; /*note: file not closed, we just wont scream at it */ if ((MicroSlice) && (ThisSlice != MicroSlice)) return; off_int = ce->c.ip - ce->mm.p ; if (off_int > (ce->mm.s)) off_char = '+'; if (ce->md.s >= MinCellSize) sprintf(d_data,"Daughter @ %-6ld + %-6ld",ce->md.p,ce->md.s); else sprintf(d_data,"NO Daughter"); sprintf(mes[0], "Cell %2d:%3d %04ld%3s @ %7ld Slice=%4d Stack[%7ld] ", ce->q.this.a, ce->q.this.i, ce->mm.s,Int2Lbl( ce->d.gi),ce->mm.p, ce->d.ib,ce->c.st[0]); sprintf(mes[1], "IP [%7ld](%c%-7ld) = 0x%02x %9.9s [%7ld] ", ce->c.ip, off_char, off_int, soup[ad(ce->c.ip)].inst, id[soup[ad(ce->c.ip)].inst].mn, ce->c.st[1]); sprintf(mes[2], "AX [%7ld] [%7ld] ", ce->c.re[0], ce->c.st[2]); sprintf(mes[3], "BX [%7ld] [%7ld] ", ce->c.re[1], ce->c.st[3]); sprintf(mes[4], "CX [%7ld] [%7ld] ", ce->c.re[2], ce->c.st[4]); sprintf(mes[5], "DX [%7ld] [%7ld] ", ce->c.re[3], ce->c.st[5]); sprintf(mes[6], "Flag = %1.1d [%7ld] ", (int) ce->c.fl,ce->c.st[6]); sprintf(mes[7], "%-30.30s [%7ld] ", d_data, ce->c.st[7]); sprintf(mes[8], " [%7ld] ", ce->c.st[8]); sprintf(mes[9], " [%7ld] ", ce->c.st[9]); mes[ce->c.sp][57] = '<'; FEMessage(10,mes); Log= tlog; if (MC_step > 0L) { FEPrintf(HLP_X,HLP_Y,1,"MICRO | %15.15s ESC-Main Menu n-Next step ", (MicroSlice)?"t-Untrack cell": "T-Track cell");#if FRONTEND == STDIO printf("\n");#endif /* FRONTEND == STDIO */ } if(( MC_step > 0L) && ((cc = FEGetc()) == 0x1b)) FEMenu(); if (cc == 'T') MicroSlice = ThisSlice; else if (cc == 't') MicroSlice = NULL; if( MC_step == 0L) { if (KEYHIT()) FEMenu(); else sleep(1); }#ifdef ALCOMM if ( MIsDFEnabled( TrtIPEvent ) ) { TMoveIP( ThisSlice->mm.p,ThisSlice->c.ip); }#endif /* ALCOMM */}#endif /* MICRO *//*-----------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -