complex EWSMcache::Bfp_Mw2_Mw2_mfprime2_mf2(const int gen, const double Mw_i) const { int NumPar = 3; double mymf, mymfprime; double Mz = SM.getMz(); if (gen < 3) { mymf = mf(SM.getLeptons((StandardModel::lepton) (2 * gen)), Mz); mymfprime = mf(SM.getLeptons((StandardModel::lepton) (2 * gen + 1)), Mz); } else { int genq = gen - 3; mymf = mf(SM.getQuarks((QCD::quark) (2 * genq)), Mz); mymfprime = mf(SM.getQuarks((QCD::quark) (2 * genq + 1)), Mz); } double params[] = {Mw_i, mymf, mymfprime}; if (CacheCheck(Bfp_Mw2_Mw2_mfprime2_mf2_cache[gen], NumPar, params)) return complex(Bfp_Mw2_Mw2_mfprime2_mf2_cache[gen][NumPar], Bfp_Mw2_Mw2_mfprime2_mf2_cache[gen][NumPar + 1], false); else { double mf2 = mymf*mymf; double mfprime2 = mymfprime*mymfprime; complex newResult = PV.Bfp(Mw_i*Mw_i, Mw_i*Mw_i, mfprime2, mf2); newCacheForComplex(Bfp_Mw2_Mw2_mfprime2_mf2_cache[gen], NumPar, params, newResult); return newResult; } }
static inline void ProcessTCPFlow(FlowSource_t *fs, struct FlowNode *NewNode ) { struct FlowNode *Node; assert(NewNode->memflag == NODE_IN_USE); Node = Insert_Node(NewNode); // Return existing Node if flow exists already, otherwise insert es new if ( Node == NULL ) { // Insert as new dbg_printf("New TCP flow: Packets: %u, Bytes: %u\n", NewNode->packets, NewNode->bytes); // in case it's a FIN/RST only packet - immediately flush it if ( NewNode->fin == FIN_NODE ) { // flush node if ( StorePcapFlow(fs, NewNode) ) { Remove_Node(NewNode); } } if ( !CacheCheck() ) { uint32_t NumFlows; LogError("Node cache exhausted! - Immediate flush - increase flow cache!!"); NumFlows = Flush_FlowTree(fs); LogError("Flushed flows: %u", NumFlows); } if ( Link_RevNode(NewNode)) { // if we could link this new node, it is the server answer // -> calculate server latency SetServer_latency(NewNode); } return; } assert(Node->memflag == NODE_IN_USE); // check for first client ACK for client latency if ( Node->latency.flag == 1 ) { SetClient_latency(Node, &(NewNode->t_first)); } else if ( Node->latency.flag == 2 ) { SetApplication_latency(Node, &(NewNode->t_first)); } // update existing flow Node->flags |= NewNode->flags; Node->packets++; Node->bytes += NewNode->bytes; Node->t_last = NewNode->t_last; dbg_printf("Existing TCP flow: Packets: %u, Bytes: %u\n", Node->packets, Node->bytes); if ( NewNode->fin == FIN_NODE) { // flush node Node->fin = FIN_NODE; if ( StorePcapFlow(fs, Node) ) { Remove_Node(Node); } } else { Free_Node(NewNode); } } // End of ProcessTCPFlow
/* SymHebFontChange() * ==================================================================== * Called whenever the Symbol or Hebrew Font is changed, turned on * or turned off. */ void SymHebFontChange( void ) { #if 0 Current.Width = FALSE; ObString( WIDTHFLG ) = width_text[ Current.Width ]; /* Objc_draw( tree, WIDTHFLG, MAX_DEPTH, NULL );*/ CacheCheck( 0 ); /* Do I need to check if the cache is large enuf? NO!*/ #endif /* This is to prevent the warning from popping up all the time. * It will show ONCE and that is that. It is initialized when * the CPX or desk accessory is first opened. */ if( !Symbol_Change ) { Objc_draw( tree, ROOT, MAX_DEPTH, NULL ); form_alert( 1, sym_alert ); } Symbol_Change = TRUE; Make_Width_Flag = TRUE; /* Make sure we prompt for a make * width tables after an extend.sys */ }
gslpp::complex THDMcache::B00_Mz_Mw2_mA_mHp(const double Mz, const double Mw, const double mA, const double mHp) const { int NumPar = 4; double params[] = {Mz,Mw, mA, mHp}; int i = CacheCheck(B00_Mz_Mw2_mA_mHp_cache, NumPar, params); if (i>=0) { return ( B00_Mz_Mw2_mA_mHp_cache[NumPar][i] ); } else { gslpp::complex newResult = PV.B00(Mz*Mz, Mw*Mw, mA*mA, mHp*mHp); CacheShift(B00_Mz_Mw2_mA_mHp_cache, NumPar, params, newResult); return newResult; } }
double EWSMcache::A0_Mw2_Mw2(const double Mw_i) const { int NumPar = 1; double params[] = {Mw_i}; if (CacheCheck(A0_Mw2_Mw2_cache, NumPar, params)) return A0_Mw2_Mw2_cache[NumPar]; else { double newResult = PV.A0(Mw_i*Mw_i, Mw_i * Mw_i); newCacheForDouble(A0_Mw2_Mw2_cache, NumPar, params, newResult); return newResult; } }
double EWSMcache::A0_Mz2_Mz2() const { int NumPar = 1; double params[] = {SM.getMz()}; if (CacheCheck(A0_Mz2_Mz2_cache, NumPar, params)) return A0_Mz2_Mz2_cache[NumPar]; else { double newResult = PV.A0(SM.getMz() * SM.getMz(), SM.getMz() * SM.getMz()); newCacheForDouble(A0_Mz2_Mz2_cache, NumPar, params, newResult); return newResult; } }
double EWSMcache::Li3_MW2toMTOP2(const double Mw_i) const { int NumPar = 2; double params[] = {Mw_i, SM.getMtpole()}; if (CacheCheck(Li3_MW2toMTOP2_cache, NumPar, params)) return Li3_MW2toMTOP2_cache[NumPar]; else { double newResult = PolyLog.Li3(Mw_i * Mw_i / SM.getMtpole() / SM.getMtpole()); newCacheForDouble(Li3_MW2toMTOP2_cache, NumPar, params, newResult); return newResult; } }
double EWSMcache::log_cW2(const double Mw_i) const { int NumPar = 2; double params[] = {SM.getMz(), Mw_i}; if (CacheCheck(log_cW2_cache, NumPar, params)) return log_cW2_cache[NumPar]; else { double newResult = log(SM.cW2(Mw_i)); newCacheForDouble(log_cW2_cache, NumPar, params, newResult); return newResult; } }
double EWSMcache::logMTOPtoMH() const { int NumPar = 2; double params[] = {SM.getMtpole(), SM.getMHl()}; if (CacheCheck(logMTOPtoMH_cache, NumPar, params)) return logMTOPtoMH_cache[NumPar]; else { double newResult = log(SM.getMtpole() / SM.getMHl()); newCacheForDouble(logMTOPtoMH_cache, NumPar, params, newResult); return newResult; } }
gslpp::complex THDMcache::B00_Mz_0_mh_mHp(const double Mz, const double mh, const double mHp) const { int NumPar = 3; double params[] = {Mz, mh, mHp}; int i = CacheCheck(B00_Mz_0_mh_mHp_cache, NumPar, params); if (i>=0) { return ( B00_Mz_0_mh_mHp_cache[NumPar][i] ); } else { gslpp::complex newResult = PV.B00(Mz*Mz, 0., mh*mh, mHp*mHp); CacheShift(B00_Mz_0_mh_mHp_cache, NumPar, params, newResult); return newResult; } }
gslpp::complex THDMcache::B00_Mz_Mw2_Mw_mh(const double Mz, const double Mw, const double mh) const { int NumPar = 3; double params[] = {Mz,Mw, mh}; int i = CacheCheck(B00_Mz_Mw2_Mw_mh_cache, NumPar, params); if (i>=0) { return ( B00_Mz_Mw2_Mw_mh_cache[NumPar][i] ); } else { gslpp::complex newResult = PV.B00(Mz*Mz, Mw*Mw, Mw*Mw, mh*mh); CacheShift(B00_Mz_Mw2_Mw_mh_cache, NumPar, params, newResult); return newResult; } }
gslpp::complex THDMcache::B0_Mz_Mz2_Mz_mH(const double Mz, const double mH) const { int NumPar = 2; double params[] = {Mz, mH}; int i = CacheCheck(B0_Mz_Mz2_Mz_mH_cache, NumPar, params); if (i>=0) { return ( B0_Mz_Mz2_Mz_mH_cache[NumPar][i] ); } else { gslpp::complex newResult = PV.B0(Mz*Mz, Mz*Mz, Mz*Mz, mH*mH); CacheShift(B0_Mz_Mz2_Mz_mH_cache, NumPar, params, newResult); return newResult; } }
double EWSMcache::logMZtoMTAU() const { int NumPar = 2; double params[] = {SM.getMz(), mf(SM.getLeptons(SM.TAU))}; if (CacheCheck(logMZtoMTAU_cache, NumPar, params)) return logMZtoMTAU_cache[NumPar]; else { double newResult = log(SM.getMz() / mf(SM.getLeptons(SM.TAU))); newCacheForDouble(logMZtoMTAU_cache, NumPar, params, newResult); return newResult; } }
complex EWSMcache::B0p_Mz2_Mz2_mh2_Mz2() const { int NumPar = 2; double params[] = {SM.getMz(), SM.getMHl()}; if (CacheCheck(B0p_Mz2_Mz2_mh2_Mz2_cache, NumPar, params)) return complex(B0p_Mz2_Mz2_mh2_Mz2_cache[NumPar], B0p_Mz2_Mz2_mh2_Mz2_cache[NumPar + 1], false); else { complex newResult = PV.B0p(SM.getMz() * SM.getMz(), SM.getMz() * SM.getMz(), SM.getMHl() * SM.getMHl(), SM.getMz() * SM.getMz()); newCacheForComplex(B0p_Mz2_Mz2_mh2_Mz2_cache, NumPar, params, newResult); return newResult; } }
complex EWSMcache::C0_Mw2_Mw2_0_Mz2(const double Mw_i) const { int NumPar = 2; double params[] = {Mw_i, SM.getMz()}; if (CacheCheck(C0_Mw2_Mw2_0_Mz2_cache, NumPar, params)) return complex(C0_Mw2_Mw2_0_Mz2_cache[NumPar], C0_Mw2_Mw2_0_Mz2_cache[NumPar + 1], false); else { complex newResult = PV.C0(Mw_i*Mw_i, Mw_i*Mw_i, 0.0, SM.getMz() * SM.getMz()); newCacheForComplex(C0_Mw2_Mw2_0_Mz2_cache, NumPar, params, newResult); return newResult; } }
double EWSMcache::Li3_for_F1(const double Mw_i) const { int NumPar = 2; double params[] = {Mw_i, SM.getMtpole()}; if (CacheCheck(Li3_for_F1_cache, NumPar, params)) return Li3_for_F1_cache[NumPar]; else { double tmp = Mw_i * Mw_i / SM.getMtpole() / SM.getMtpole(); double newResult = PolyLog.Li3(-tmp / (1.0 - tmp)); newCacheForDouble(Li3_for_F1_cache, NumPar, params, newResult); return newResult; } }
complex EWSMcache::C0_Mz2_0_Mz2_0() const { int NumPar = 1; double params[] = {SM.getMz()}; if (CacheCheck(C0_Mz2_0_Mz2_0_cache, NumPar, params)) return complex(C0_Mz2_0_Mz2_0_cache[NumPar], C0_Mz2_0_Mz2_0_cache[NumPar + 1], false); else { complex newResult = PV.C0(SM.getMz() * SM.getMz(), 0.0, SM.getMz() * SM.getMz(), 0.0); newCacheForComplex(C0_Mz2_0_Mz2_0_cache, NumPar, params, newResult); return newResult; } }
complex EWSMcache::B0_Mw2_Mw2_mh2_Mw2(const double Mw_i) const { int NumPar = 2; double params[] = {Mw_i, SM.getMHl()}; if (CacheCheck(B0_Mw2_Mw2_mh2_Mw2_cache, NumPar, params)) return complex(B0_Mw2_Mw2_mh2_Mw2_cache[NumPar], B0_Mw2_Mw2_mh2_Mw2_cache[NumPar + 1], false); else { complex newResult = PV.B0(Mw_i*Mw_i, Mw_i*Mw_i, SM.getMHl() * SM.getMHl(), Mw_i * Mw_i); newCacheForComplex(B0_Mw2_Mw2_mh2_Mw2_cache, NumPar, params, newResult); return newResult; } }
complex EWSMcache::B0p_Mw2_Mw2_0_Mw2(const double Mw_i) const { int NumPar = 1; double params[] = {Mw_i}; if (CacheCheck(B0p_Mw2_Mw2_0_Mw2_cache, NumPar, params)) return complex(B0p_Mw2_Mw2_0_Mw2_cache[NumPar], B0p_Mw2_Mw2_0_Mw2_cache[NumPar + 1], false); else { complex newResult = PV.B0p(Mw_i*Mw_i, Mw_i*Mw_i, 0.0, Mw_i * Mw_i); newCacheForComplex(B0p_Mw2_Mw2_0_Mw2_cache, NumPar, params, newResult); return newResult; } }
complex EWSMcache::Bfp_Mz2_Mz2_mf2_mf2(const Particle f) const { int NumPar = 2; double params[] = {SM.getMz(), mf(f, SM.getMz())}; int ind = f.getIndex(); if (CacheCheck(Bfp_Mz2_Mz2_mf2_mf2_cache[ind], NumPar, params)) return complex(Bfp_Mz2_Mz2_mf2_mf2_cache[ind][NumPar], Bfp_Mz2_Mz2_mf2_mf2_cache[ind][NumPar + 1], false); else { complex newResult = PV.Bfp(SM.getMz() * SM.getMz(), SM.getMz() * SM.getMz(), mf2(f, SM.getMz()), mf2(f, SM.getMz())); newCacheForComplex(Bfp_Mz2_Mz2_mf2_mf2_cache[ind], NumPar, params, newResult); return newResult; } }
static inline void ProcessTCPFlow (FlowSource_t *fs, struct FlowNode *NewNode) { struct FlowNode *Node; assert (NewNode->memflag == NODE_IN_USE); Node = Insert_Node (NewNode); // if insert fails, the existing node is returned -> flow exists already if (Node == NULL) { dbg_printf ("New TCP flow: Packets: %u, Bytes: %u\n", NewNode->packets, NewNode->bytes); // in case it's a FIN/RST only packet - immediately flush it if (NewNode->fin == FIN_NODE) { // flush node if (StorePcapFlow (fs, NewNode)) { Remove_Node (NewNode); } } if (!CacheCheck()) { uint32_t NumFlows; LogError ("Node cache exhausted! - Immediate flush - increase flow cache!!"); NumFlows = Flush_FlowTree (fs); LogError ("Flushed flows: %u", NumFlows); } return; } assert (Node->memflag == NODE_IN_USE); // update existing flow Node->flags |= NewNode->flags; Node->packets++; Node->bytes += NewNode->bytes; Node->t_last = NewNode->t_last; dbg_printf ("Existing TCP flow: Packets: %u, Bytes: %u\n", Node->packets, Node->bytes); if (NewNode->fin == FIN_NODE) { // flush node Node->fin = FIN_NODE; if (StorePcapFlow (fs, Node)) { Remove_Node (Node); } } else { Free_Node (NewNode); } } // End of ProcessTCPFlow
complex EWSMcache::Bf_Mz2_0_mf2_mf2(const Particle f) const { int NumPar = 2; double params[] = {SM.getMz(), mf(f, SM.getMz())}; if (params[1] == 0.0) throw std::runtime_error("Error in EWSMcache::Bf_Mz_0_mf_mf()"); int ind = f.getIndex(); if (CacheCheck(Bf_Mz2_0_mf2_mf2_cache[ind], NumPar, params)) return complex(Bf_Mz2_0_mf2_mf2_cache[ind][NumPar], Bf_Mz2_0_mf2_mf2_cache[ind][NumPar + 1], false); else { complex newResult = PV.Bf(SM.getMz() * SM.getMz(), 0.0, mf2(f, SM.getMz()), mf2(f, SM.getMz())); newCacheForComplex(Bf_Mz2_0_mf2_mf2_cache[ind], NumPar, params, newResult); return newResult; } }
/* HandleCache() * =================================================================== */ int HandleCache( int button, WORD *msg ) { int quit; int out; int error; quit = FALSE; /* Handle Double-clicking of the objects */ if( ( button != -1 ) && ( button & 0x8000 ) ) button &= 0x7FFF; switch( button ) { case CCANCEL: Current.SpeedoCacheSize = OldSpeedoCache; Current.speedo_percent = OldPercent; Current.BitMapCacheSize = OldBitMapSize; case C*K: Deselect( button ); if( button == C*K ) { DoValuesCheck(); CacheCheck(); } Reset_Tree( ad_options ); Objc_draw( tree, ROOT, MAX_DEPTH, NULL ); break; case LCACHE: case MCACHE: case SCACHE: if( SpeedoFlag ) { sprintf( cache_path, "%s\\", OutlinePath ); out = fsel_name( FALSE, cache_path, "*.SPC", cache_text[ button - LCACHE ] ); if( ( ( out == A_OK ) || ( out == A_CANCEL )) && ( cache_path[0] != '\0' ) ) { if( out == A_OK ) { /* Check if the file exists first */ if(( button == LCACHE ) || ( button == MCACHE )) { olddma = Fgetdta(); Fsetdta( &newdma ); /* Point to OUR buffer */ error = Fsfirst( cache_path, 0 );/* Normal file search for 1st file */ if( error != E_OK ) /* No such files! */ { Fsetdta( olddma ); /* Point to OLD buffer */ form_alert( 1, nofile ); XDeselect( tree, button ); return( quit ); } } if( open_vwork() ) { switch( button ) { case LCACHE: out = v_loadcache( vhandle, cache_path, TRUE ); break; case MCACHE: out = v_loadcache( vhandle, cache_path, FALSE ); /* append, merge */ break; case SCACHE: out = v_savecache( vhandle, cache_path ); break; default: break; } if( out == -1 ) form_alert( 1, alert19 ); close_vwork(); } else form_alert( 1, alert18 ); } } Calc_Cache( TRUE ); } XDeselect( tree, button ); break; case CCACHE: if( SpeedoFlag ) { if( form_alert( 1, alert17 ) == 1 ) { if( open_vwork()) { if( v_flushcache( vhandle ) == -1 ) form_alert( 1, alert19 ); close_vwork(); } else form_alert( 1, alert18 ); Calc_Cache( TRUE ); } } XDeselect( tree, button ); break; case MUP: case MDOWN: Up_Down_Arrow( button, MUP, &MiscSizeText[0], &mcache, MSIZE ); break; case BUP: case BDOWN: Up_Down_Arrow( button, BUP, &BitSizeText[0], &Current.BitMapCacheSize, BSIZE ); break; case CUP: case CDOWN: Up_Down_Arrow( button, CUP, &CharSizeText[0], &ccache, CSIZE ); break; default: if( button == -1 ) { switch( msg[0] ) { case WM_REDRAW: break; case AC_CLOSE: quit = TRUE; break; case WM_CLOSED: quit = TRUE; DoValuesCheck(); CloseWindow(); break; case CT_KEY: break; default: break; } } break; } return( quit ); }
/* Outline_Buttons() * ==================================================================== * Handle the button events for the outline font dialog. */ int Outline_Buttons( int button, WORD *msg ) { int quit = FALSE; int out; long i; MRETS mk; if( ( button != -1 ) && ( button & 0x8000 ) ) button &= 0x7FFF; switch( button ) { case OCANCEL:pop_outline(); /* restore */ case OEXIT: Deselect( button ); if( OEXIT == button ) { /* Read in ONLY if new directory path */ if( strcmp( Current.FontPath, Backup.FontPath ) ) { MF_Save(); push_outline(); Scan_Message( ad_scan, TRUE ); read_fonts( 1 ); Scan_Message( ad_scan, FALSE ); pop_outline(); MF_Restore(); } } Return_To_Maintree( Maintree ); break; case SETCACHE: deselect( tree, SETCACHE ); Do_Cache_Size(); break; case DEFPOINT: Deselect( button ); Do_Point_Sizes( 0, DEFAULT_POINTS ); break; case FSMLEFT: select( tree, FSMLEFT ); do { Graf_mkstate( &mk ); if( dircount ) { dircount--; strncpy( view_path, &dirpath[ dircount ], min( DIR_MAX, dirsize - dircount ) ); if( dircount ) view_path[0] = 0xAE; if((dirsize - dircount ) > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( FSMPATH ) = view_path; Objc_draw( tree, FSMPATH, MAX_DEPTH, NULL ); } }while( mk.buttons ); deselect( tree, FSMLEFT ); break; case FSMRIGHT: select( tree, FSMRIGHT ); do { Graf_mkstate( &mk ); if( ( dirsize > DIR_MAX ) && ((dircount + DIR_MAX ) < dirsize )) { dircount++; strncpy( view_path, &dirpath[ dircount], min( DIR_MAX, dirsize - dircount) ); view_path[0] = 0xAE; if( (dirsize - dircount) > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( FSMPATH ) = view_path; Objc_draw( tree, FSMPATH, MAX_DEPTH, NULL ); } }while( mk.buttons ); deselect( tree, FSMRIGHT ); break; case FSMPATH: wait_up(); strcpy( newpath, dirpath ); for( i = strlen( newpath ); i && ( newpath[i] != '\\'); newpath[ i-- ] = '\0' ); out = fsel_name( FALSE, newpath, "*.QFM", title_fsmpath ); if( ( ( out == A_OK ) || ( out == A_CANCEL )) && ( newpath[0] != '\0' ) ) { for( i = strlen( newpath ); i && ( newpath[i] != '\\'); newpath[ i-- ] = '\0' ); strcpy( dirpath, newpath ); newpath[i] = '\0'; /* Get rid of the '\\' */ strcpy( Current.FontPath, newpath ); strcat( dirpath, "*.QFM" ); dirsize = (int)strlen( &dirpath[0] ); strcpy( view_path, underbar ); strncpy( view_path, dirpath, min( DIR_MAX, dirsize) ); dircount = 0; if( dirsize > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( FSMPATH ) = view_path; Objc_draw( tree, FSMPATH, MAX_DEPTH, NULL ); Change_Flag = TRUE; } break; case WIDTHFLG: Current.Width ^= TRUE; deselect( tree, button ); ObString( WIDTHFLG ) = width_text[ Current.Width ]; Objc_draw( tree, WIDTHFLG, MAX_DEPTH, NULL ); Change_Flag = TRUE; CacheCheck( 0 ); break; case SYMFLAG: Current.SymbolFlag ^= TRUE; if( SetSymbols( &Current.SymbolFlag, SYMTEXT, SYMTITLE, Current.SymbolFont, title_symbol, TRUE ) ) SymHebFontChange(); deselect( tree, SYMFLAG ); Change_Flag = TRUE; break; case HEBFLAG: Current.HebrewFlag ^= TRUE; if( SetSymbols( &Current.HebrewFlag, HEBTEXT, HEBTITLE, Current.HebrewFont, title_hebrew, TRUE )) SymHebFontChange(); deselect( tree, HEBFLAG ); Change_Flag = TRUE; break; case SYMTEXT: if( SymButton( Current.SymbolFont, SYMTITLE, SYMTEXT, title_symbol, &Current.SymbolFlag ) ) SymHebFontChange(); break; case HEBTEXT: if( SymButton( Current.HebrewFont, HEBTITLE, HEBTEXT, title_hebrew, &Current.HebrewFlag ) ) SymHebFontChange(); break; default: if( button == -1 ) { switch( msg[0] ) { case WM_REDRAW: break; case AC_CLOSE: quit = TRUE; break; case WM_CLOSED: quit = TRUE; do_write_extend( FALSE ); break; case CT_KEY: break; default: break; } } break; } return( quit ); }