static void update_plugin() { gint w_scroll, w_decal; static gint x_scroll; if (command_pipe) { command_done(); } if(GK.timer_ticks % 6 == 0) { run_command(); } #if defined(GKRELLM_HAVE_DECAL_SCROLL_TEXT) gkrellm_decal_scroll_text_set_text(panel, text1_btc, btc_text); gkrellm_decal_scroll_text_get_size(text1_btc, &w_scroll, NULL); gkrellm_decal_get_size(text1_btc, &w_decal, NULL); x_scroll -= 1; if (x_scroll <= -w_scroll) x_scroll = scroll_loop_mode ? 0 : w_decal; gkrellm_decal_text_set_offset(text1_btc, x_scroll, 0); #else w_decal = text1_btc->w; w_scroll = gdk_string_width(text1_btc->text_style.font, scroll_text); x_scroll -= 1; if (x_scroll <= -w_scroll) x_scroll = w_decal; text1_btc->x_off = x_scroll; gkrellm_draw_decal_text(panel, text1_btc, scroll_text, x_scroll); #endif gkrellm_draw_panel_layers(panel); }
/* normally this is the main() function entry, but if OpenOCD is linked * into application, then this fn will not be invoked, but rather that * application will have it's own implementation of main(). */ int openocd_main(int argc, char *argv[]) { int ret; /* initialize commandline interface */ struct command_context *cmd_ctx; cmd_ctx = setup_command_handler(NULL); if (util_init(cmd_ctx) != ERROR_OK) return EXIT_FAILURE; if (ioutil_init(cmd_ctx) != ERROR_OK) return EXIT_FAILURE; LOG_OUTPUT("For bug reports, read\n\t" "http://openocd.sourceforge.net/doc/doxygen/bugs.html" "\n"); command_context_mode(cmd_ctx, COMMAND_CONFIG); command_set_output_handler(cmd_ctx, configuration_output_handler, NULL); /* Start the executable meat that can evolve into thread in future. */ ret = openocd_thread(argc, argv, cmd_ctx); unregister_all_commands(cmd_ctx, NULL); /* free commandline interface */ command_done(cmd_ctx); adapter_quit(); return ret; }
static int remove_connection(struct service *service, struct connection *connection) { struct connection **p = &service->connections; struct connection *c; /* find connection */ while ((c = *p)) { if (c->fd == connection->fd) { service->connection_closed(c); if (service->type == CONNECTION_TCP) close_socket(c->fd); else if (service->type == CONNECTION_PIPE) { /* The service will listen to the pipe again */ c->service->fd = c->fd; } command_done(c->cmd_ctx); /* delete connection */ *p = c->next; free(c); service->max_connections++; break; } /* redirect p to next list pointer */ p = &(*p)->next; } return ERROR_OK; }
/* normally this is the main() function entry, but if OpenOCD is linked * into application, then this fn will not be invoked, but rather that * application will have it's own implementation of main(). */ int openocd_main(int argc, char *argv[]) { int ret; /* initialize commandline interface */ command_context_t *cmd_ctx; cmd_ctx = setup_command_handler(); #if BUILD_IOUTIL if (ioutil_init(cmd_ctx) != ERROR_OK) { return EXIT_FAILURE; } #endif LOG_OUTPUT("\n\nBUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS\n\n\n"); print_version(); command_context_mode(cmd_ctx, COMMAND_CONFIG); command_set_output_handler(cmd_ctx, configuration_output_handler, NULL); if (parse_cmdline_args(cmd_ctx, argc, argv) != ERROR_OK) return EXIT_FAILURE; ret = parse_config_file(cmd_ctx); if ( (ret != ERROR_OK) && (ret != ERROR_COMMAND_CLOSE_CONNECTION) ) return EXIT_FAILURE; #if BUILD_HTTPD if (httpd_start()!=ERROR_OK) return EXIT_FAILURE; #endif if (ret != ERROR_COMMAND_CLOSE_CONNECTION) { command_context_mode(cmd_ctx, COMMAND_EXEC); if (command_run_line(cmd_ctx, "init")!=ERROR_OK) return EXIT_FAILURE; /* handle network connections */ server_loop(cmd_ctx); } /* shut server down */ server_quit(); #if BUILD_HTTPD httpd_stop(); #endif unregister_all_commands(cmd_ctx); /* free commandline interface */ command_done(cmd_ctx); return EXIT_SUCCESS; }
void release_data (void) { g_hash_table_destroy (ProgramsCache); while (CommandList != NULL) { CommandData *cdata = CommandList->data; command_done (cdata); } }
void release_data (void) { if (! initialized) return; while (CommandList != NULL) { CommandData *cdata = CommandList->data; command_done (cdata); } }
/* NB! this fn can be invoked outside this file for non PC hosted builds * NB! do not change to 'static'!!!! */ struct command_context *setup_command_handler(Jim_Interp *interp) { log_init(); LOG_DEBUG("log_init: complete"); const char *startup = openocd_startup_tcl; struct command_context *cmd_ctx = command_init(startup, interp); /* register subsystem commands */ typedef int (*command_registrant_t)(struct command_context *cmd_ctx_value); static const command_registrant_t command_registrants[] = { &openocd_register_commands, &server_register_commands, &gdb_register_commands, &log_register_commands, &transport_register_commands, &interface_register_commands, &bitbang_register_commands, &swd_register_commands, &target_register_commands, &flash_register_commands, &nand_register_commands, &pld_register_commands, &mflash_register_commands, NULL }; for (unsigned i = 0; NULL != command_registrants[i]; i++) { int retval = (*command_registrants[i])(cmd_ctx); if (ERROR_OK != retval) { command_done(cmd_ctx); return NULL; } } LOG_DEBUG("command registration: complete"); LOG_OUTPUT(OPENOCD_VERSION "\n" "Licensed under GNU GPL v2\n"); global_cmd_ctx = cmd_ctx; return cmd_ctx; }
static void romloader_openocd_close_instance(void *pvHandle) { command_context_t *cmd_ctx; target_t *target; int iResult; wxString strMsg; /* cast the handle to the command context */ cmd_ctx = (command_context_t*)pvHandle; strMsg.Printf(wxT("closing romloader openocd at %p"), cmd_ctx); wxLogMessage(strMsg); /* NOTE: this seems to work with ftd2xx, but not with libftdi */ if( jtag!=NULL && jtag->quit!=NULL ) { jtag->quit(); } /* close all subsystems */ iResult = jtag_close(cmd_ctx); if( iResult!=ERROR_OK ) { strMsg.Printf(wxT("failed to close jtag interface: %d"), iResult); wxLogWarning(strMsg); } iResult = target_close(cmd_ctx); if( iResult!=ERROR_OK ) { strMsg.Printf(wxT("failed to close target interface: %d"), iResult); wxLogWarning(strMsg); } // free commandline interface command_done(cmd_ctx); }
void nscsi_full_device::step(bool timeout) { UINT32 ctrl = scsi_bus->ctrl_r(); UINT32 data = scsi_bus->data_r(); if(ctrl & S_RST) { scsi_bus->data_w(scsi_refid, 0); scsi_bus->ctrl_w(scsi_refid, 0, S_ALL); scsi_state = IDLE; logerror("%s: scsi bus reset\n", tag()); return; } if(0) logerror("%s: state=%d.%d %s\n", tag(), scsi_state & STATE_MASK, (scsi_state & SUB_MASK) >> SUB_SHIFT, timeout ? "timeout" : "change"); switch(scsi_state & SUB_MASK ? scsi_state & SUB_MASK : scsi_state & STATE_MASK) { case IDLE: if(((ctrl & (S_SEL|S_BSY)) == S_SEL) && (scsi_id != -1) && ((data & (1 << scsi_id)) != 0)) { for(scsi_initiator_id = 0; scsi_initiator_id != 16 && (scsi_initiator_id == scsi_id || (data & (1 << scsi_initiator_id))); scsi_initiator_id++); if(scsi_initiator_id == 16) scsi_initiator_id = -1; scsi_state = TARGET_SELECT_WAIT_BUS_SETTLE; scsi_timer->adjust(scsi_bus_settle_delay()); } break; case TARGET_SELECT_WAIT_BUS_SETTLE: if((ctrl & (S_SEL|S_BSY)) == S_SEL) { scsi_state = TARGET_SELECT_WAIT_SEL_0; scsi_bus->ctrl_w(scsi_refid, S_BSY, S_BSY); } else scsi_state = IDLE; break; case TARGET_SELECT_WAIT_SEL_0: if(ctrl & S_SEL) break; buf_control_push()->action = BC_MSG_OR_COMMAND; scsi_state = TARGET_NEXT_CONTROL; step(false); break; case RECV_BYTE_T_WAIT_ACK_1 << SUB_SHIFT: if(ctrl & S_ACK) { scsi_put_data(data_buffer_id, data_buffer_pos++, scsi_bus->data_r()); scsi_state = (scsi_state & STATE_MASK) | (RECV_BYTE_T_WAIT_ACK_0 << SUB_SHIFT); scsi_bus->ctrl_w(scsi_refid, 0, S_REQ); } break; case RECV_BYTE_T_WAIT_ACK_0 << SUB_SHIFT: if(!(ctrl & S_ACK)) { scsi_state &= STATE_MASK; scsi_bus->ctrl_wait(scsi_refid, 0, S_ACK); step(false); } break; case SEND_BYTE_T_WAIT_ACK_1 << SUB_SHIFT: if(ctrl & S_ACK) { scsi_state = (scsi_state & STATE_MASK) | (SEND_BYTE_T_WAIT_ACK_0 << SUB_SHIFT); scsi_bus->data_w(scsi_refid, 0); scsi_bus->ctrl_w(scsi_refid, 0, S_REQ); } break; case SEND_BYTE_T_WAIT_ACK_0 << SUB_SHIFT: if(!(ctrl & S_ACK)) { scsi_state &= STATE_MASK; scsi_bus->ctrl_wait(scsi_refid, 0, S_ACK); step(false); } break; case TARGET_NEXT_CONTROL: { control *ctl = buf_control_pop(); switch(ctl->action) { case BC_MSG_OR_COMMAND: data_buffer_id = SBUF_MAIN; data_buffer_pos = 0; if(ctrl & S_ATN) { scsi_state = TARGET_WAIT_MSG_BYTE; scsi_bus->ctrl_w(scsi_refid, S_PHASE_MSG_OUT, S_PHASE_MASK); } else { scsi_state = TARGET_WAIT_CMD_BYTE; scsi_bus->ctrl_w(scsi_refid, S_PHASE_COMMAND, S_PHASE_MASK); } target_recv_byte(); break; case BC_STATUS: scsi_bus->ctrl_w(scsi_refid, S_PHASE_STATUS, S_PHASE_MASK); target_send_byte(ctl->param1); break; case BC_DATA_IN: scsi_bus->ctrl_w(scsi_refid, S_PHASE_DATA_IN, S_PHASE_MASK); data_buffer_id = ctl->param1; data_buffer_size = ctl->param2; data_buffer_pos = 0; scsi_state = TARGET_WAIT_DATA_IN_BYTE; target_send_buffer_byte(); break; case BC_DATA_OUT: scsi_bus->ctrl_w(scsi_refid, S_PHASE_DATA_OUT, S_PHASE_MASK); data_buffer_id = ctl->param1; data_buffer_size = ctl->param2; data_buffer_pos = 0; scsi_state = TARGET_WAIT_DATA_OUT_BYTE; target_recv_byte(); break; case BC_MESSAGE_1: scsi_bus->ctrl_w(scsi_refid, S_PHASE_MSG_IN, S_PHASE_MASK); target_send_byte(ctl->param1); break; case BC_BUS_FREE: scsi_bus->data_w(scsi_refid, 0); scsi_bus->ctrl_wait(scsi_refid, S_BSY|S_SEL|S_RST, S_ALL); scsi_bus->ctrl_w(scsi_refid, 0, S_ALL); scsi_state = IDLE; break; }; break; } case TARGET_WAIT_DATA_IN_BYTE: if(data_buffer_pos == data_buffer_size-1) scsi_state = TARGET_NEXT_CONTROL; target_send_buffer_byte(); break; case TARGET_WAIT_DATA_OUT_BYTE: if(data_buffer_pos == data_buffer_size-1) scsi_state = TARGET_NEXT_CONTROL; target_recv_byte(); break; case TARGET_WAIT_MSG_BYTE: if(ctrl & S_SEL) return; if(!(ctrl & S_ATN)) { scsi_cmdsize = data_buffer_pos; scsi_message(); data_buffer_id = SBUF_MAIN; data_buffer_pos = 0; scsi_state = TARGET_WAIT_CMD_BYTE; scsi_bus->ctrl_w(scsi_refid, S_PHASE_COMMAND, S_PHASE_MASK); } target_recv_byte(); break; case TARGET_WAIT_CMD_BYTE: if(ctrl & S_SEL) return; if(ctrl & S_ATN) { logerror("%s: Parity error? Say what?\n", tag()); scsi_state = IDLE; break; } if(command_done()) { scsi_cmdsize = data_buffer_pos; scsi_bus->ctrl_wait(scsi_refid, 0, S_ACK); scsi_command(); scsi_state = TARGET_NEXT_CONTROL; step(false); } else target_recv_byte(); break; default: logerror("%s: step() unexpected state %d.%d\n", tag(), scsi_state & STATE_MASK, (scsi_state & SUB_MASK) >> SUB_SHIFT); exit(0); } }
static int add_connection(struct service *service, struct command_context *cmd_ctx) { socklen_t address_size; struct connection *c, **p; int retval; int flag = 1; c = malloc(sizeof(struct connection)); c->fd = -1; c->fd_out = -1; memset(&c->sin, 0, sizeof(c->sin)); c->cmd_ctx = copy_command_context(cmd_ctx); c->service = service; c->input_pending = 0; c->priv = NULL; c->next = NULL; if (service->type == CONNECTION_TCP) { address_size = sizeof(c->sin); c->fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size); c->fd_out = c->fd; /* This increases performance dramatically for e.g. GDB load which * does not have a sliding window protocol. * * Ignore errors from this fn as it probably just means less performance */ setsockopt(c->fd, /* socket affected */ IPPROTO_TCP, /* set option at TCP level */ TCP_NODELAY, /* name of option */ (char *)&flag, /* the cast is historical cruft */ sizeof(int)); /* length of option value */ LOG_INFO("accepting '%s' connection on tcp/%s", service->name, service->port); retval = service->new_connection(c); if (retval != ERROR_OK) { close_socket(c->fd); LOG_ERROR("attempted '%s' connection rejected", service->name); command_done(c->cmd_ctx); free(c); return retval; } } else if (service->type == CONNECTION_STDINOUT) { c->fd = service->fd; c->fd_out = fileno(stdout); #ifdef _WIN32 /* we are using stdin/out so ignore ctrl-c under windoze */ SetConsoleCtrlHandler(NULL, TRUE); #endif /* do not check for new connections again on stdin */ service->fd = -1; LOG_INFO("accepting '%s' connection from pipe", service->name); retval = service->new_connection(c); if (retval != ERROR_OK) { LOG_ERROR("attempted '%s' connection rejected", service->name); command_done(c->cmd_ctx); free(c); return retval; } } else if (service->type == CONNECTION_PIPE) { c->fd = service->fd; /* do not check for new connections again on stdin */ service->fd = -1; char *out_file = alloc_printf("%so", service->port); c->fd_out = open(out_file, O_WRONLY); free(out_file); if (c->fd_out == -1) { LOG_ERROR("could not open %s", service->port); command_done(c->cmd_ctx); free(c); return ERROR_FAIL; } LOG_INFO("accepting '%s' connection from pipe %s", service->name, service->port); retval = service->new_connection(c); if (retval != ERROR_OK) { LOG_ERROR("attempted '%s' connection rejected", service->name); command_done(c->cmd_ctx); free(c); return retval; } } /* add to the end of linked list */ for (p = &service->connections; *p; p = &(*p)->next) ; *p = c; if (service->max_connections != CONNECTION_LIMIT_UNLIMITED) service->max_connections--; return ERROR_OK; }
int main(int argc, char *argv[]) { int callrun; #ifdef MTRACE_DEBUG mtrace(); #endif /* Start initialisation:*/ /* Pick out the number from the string "$Revision: 2.37 $":*/ {/*Block begin*/ char *tmp=currentrevision; for( tmp=currentrevision;(*tmp!=' ')&&(*tmp!='\0');tmp++); if(*tmp == ' ') tmp++; for( currentRevisionNumber=tmp;(*tmp!=' ')&&(*tmp!='\0');tmp++); *tmp='\0'; }/*Block end*/ /* Check here is there the request for the version information. * If so, output the revision number and quit, if there are no any * other option: */ for(i=1; i<argc; i++) if( (s_cmp(argv[i],"-V")==0)||(s_cmp(argv[i],"-version")==0)){ printf("%s\n",currentRevisionNumber); if(argc == 2) exit(0); } first_init();/*module init.c*/ read_command_line(argc, argv);/*module cmd_line.c*/ message(INITIALIZATION,NULL); /*End initialisation*/ message(READINGCONFIG,config_name); scaner_init(config_name,cnf_comment);/*module init.c*/ read_config_file_before_truns();/*module cnf_read.c*/ if( is_bit_set(&mode,bitCHECKMOMENTABALANCE)&& (!is_bit_set(&mode,bitONLYINTERPRET)) ){ check_momenta_balance_on_each_topology(); } message(DONE,NULL); /*Translation of the TM program:*/ {char tmp[MAX_STR_LEN]; if ( (is_bit_set(&mode,bitONLYINTERPRET))|| (!is_bit_set(&mode,bitBROWS))|| (is_bit_set(&mode,bitVERIFY))|| (is_bit_set(&mode,bitFORCEDTRUNSLATION)) ){ command_init();/*module truns.c*/ if(!is_bit_set(&mode,bitONLYINTERPRET)){ if (set_table==NULL)set_table=create_hash_table( set_hash_size,str_hash,str_cmp,c_destructor); if(is_bit_set(&mode,bitBROWS)) install(new_str("_specmode"),new_str("browser"),set_table); else install(new_str("_specmode"),new_str("common"),set_table); } message(BEGINTRUNS,NULL); do{ if(truns(¤t_number_of_trunslated_lines, ¤t_array_of_trunslated_lines)){ number_of_trunslated_lines= current_number_of_trunslated_lines; current_number_of_trunslated_lines=0; array_of_trunslated_lines= current_array_of_trunslated_lines; current_array_of_trunslated_lines=NULL; } }while(number_of_trunslated_lines==0); message(ENDTRUNS,NULL); mem_esc_char=esc_char; macro_done();/*module macro.c*/ reject_proc();/*module truns.c*/ command_done();/*module truns.c*/ clear_defs();/*module truns.c*/ clear_label_stack();/*module truns.c*/ for_done();/*module truns.c*/ IF_done();/*module truns.c*/ if(s_scmp(sc_get_token(tmp),"translate")) halt(UNEXPECTED ,tmp); } } sc_done();/*module tools.c*/ /*TM program is translated. The resulting code is in array_of_trunslated_lines*/ /*Keep the table up to the end of the program!:*/ #ifdef SKIP if (vectors_table!=NULL){ hash_table_done(vectors_table);/*module hash.c*/ vectors_table=NULL; } #endif message(DONEINIT,NULL); if (is_bit_set(&mode,bitVERIFY)){ message(ONLYVERIFY,NULL); errorlevel=0;halt(NOERROR,NULL); } if (g_ttnames != NULL){/*Topology tables were defined in the config file*/ HASH_TABLE wrktrans; message(LOADINGTABLES,NULL); read_topology_tables();/*module utils.c*/ free_mem(&g_ttnames); /*Create the working table:*/ g_tt_wrk=tt_createNewTable(g_defaultTokenDictSize,g_defaultHashTableSize); /*Check success, if not, halt the system:*/ checkTT(g_tt_wrk,FAILCREATINGWRKTABLE); /*Collect translations from all tables:*/ wrktrans=tt_table[g_tt_wrk-1]->htrans; /*Full toplogies:*/ for(i=0;i<g_tt_top_full;i++){ HASH_TABLE ttrans=tt_table[g_tt_full[i]-1]->htrans; if( ttrans!=NULL ) binary_operations_under_hash_table( ttrans,/*"from"*/ wrktrans,/*"to"*/ -1);/*see "hash.c"; op>0 -> add enties to "to" from "from", only if they are absent in "to", op<0 -> rewrite entries in "to" by the corresponding "from", op==0 -> remove all entries in "to" matching "from"*/ }/*for(i=0;i<g_tt_top_full;i++)*/ /*Internal topologies:*/ for(i=0;i<g_tt_top_int;i++){ HASH_TABLE ttrans=tt_table[g_tt_int[i]-1]->htrans; if( ttrans!=NULL ) binary_operations_under_hash_table( ttrans,/*"from"*/ wrktrans,/*"to"*/ -1);/*see "hash.c"; op>0 -> add enties to "to" from "from", only if they are absent in "to", op<0 -> rewrite entries in "to" by the corresponding "from", op==0 -> remove all entries in "to" matching "from"*/ }/*for(i=0;i<g_tt_top_int;i++)*/ /*Override translations, if present, in wrk table; in loaded tables translations remain to be untranslated!:*/ if( g_ttTokens_table!=NULL ) binary_operations_under_hash_table( g_ttTokens_table,/*"from"*/ wrktrans,/*"to"*/ -1);/*see "hash.c"; op>0 -> add enties to "to" from "from", only if they are absent in "to", op<0 -> rewrite entries in "to" by the corresponding "from", op==0 -> remove all entries in "to" matching "from"*/ /*Now wrk table is ready*/ /*Override translations, if present, in full toplogies:*/ if( g_ttTokens_table!=NULL )for(i=0;i<g_tt_top_full;i++){ HASH_TABLE ttrans=tt_table[g_tt_full[i]-1]->htrans; if( ttrans!=NULL )/*BTW, it CANNOT be a NULL! See, how tt_createNewTableis invoked in the beginning of tt_loadTable, file tt_load.c*/ binary_operations_under_hash_table( g_ttTokens_table,/*"from"*/ ttrans,/*"to"*/ -1);/*see "hash.c"; op>0 -> add enties to "to" from "from", only if they are absent in "to", op<0 -> rewrite entries in "to" by the corresponding "from", op==0 -> remove all entries in "to" matching "from"*/ }/*for(i=0;i<g_tt_top_full;i++)*/ message(DONE,NULL); }/*if (g_ttnames != NULL)*/ /*If only interpret, we need not analyse diagrams:*/ if(is_bit_set(&mode,bitONLYINTERPRET)){ int exitcode; run_init(1);/*module init.c*/ esc_char=mem_esc_char; islast=1; g_nocurrenttopology=1;/*Similar to islast, but specially for topologies.*/ message(CALLTOINTERPRETER,NULL); exitcode=run(number_of_trunslated_lines,array_of_trunslated_lines); message(DONE,NULL); {char endmessage[MAX_STR_LEN]; sprintf(endmessage,EXITCODEFROMINTERPRETER,exitcode); errorlevel=exitcode; halt(endmessage,NULL); } /*Stop running...*/ }/*if(is_bit_set(&mode,bitONLYINTERPRET)*/ /*ok, if we are here then we have to read diagrams...*/ detect_last_diagram_number();/*module last_num.c*/ message(LOOKINGFORFIRRSTDIAGRAM,NULL); scaner_init(input_name,0);/*module init.c*/ skip_until_first_actual_diagram();/*module read_inp.c*/ create_table(&dbuf,&dtable,MAX_VERTEX,MAX_I_LINE,ext_lines);/*module utils.c*/ create_table(&wrkbuf,&wrktable,MAX_VERTEX,MAX_I_LINE,ext_lines); message(DONE,NULL); message(READDIAGRAMS,NULL); for(i=start_diagram;!(i>finish_diagram);i++){/*begin main loop*/ skip_to_new_diagram();/* module read_inp.c Reads until '['*/ if(i % STEP_INDICATOR == 0){ char mes[MAX_STR_LEN]; sprintf(mes,INDICATE_MESSAGE,i,finish_diagram); message(mes,NULL); }/*if(i % STEP_INDICATOR == 0)*/ /* Check should we process this diagram:*/ if (set_in(i % 250,dmask[i / 250])) continue; new_diagram();/*module read_inp.c. Some initializations before each diagram.*/ detect_number_and_coefficient();/*module read_inp.c This function must receive from scaner exactly 'd###'*/ if(i!=diagram_count) halt(CURRUPTEDINPUT,input_name); create_primary_diagram_table();/*module read_inp.c*/ if ( skiptadpoles && thisistadpole ) continue; define_topology();/*module read_inp.c*/ /*compare_topology() returns 1 if topology is not actual. If topology is undefined, this procedure will call 'out_undefined_topology();' (if bitBROWS is not set) and set bitTERROR. */ if(compare_topology())/*module read_inp.c*/ continue; create_diagram_table();/*module read_inp.c*/ define_prototype();/*module read_inp.c*/ if(!is_bit_set(&mode,bitFORCEDTRUNSLATION)) if(skip_prototype())/*module utils.c*/ continue; create_indices_table();/*module read_inp.c*/ if(must_diagram_be_skipped())/*module utils.c*/ continue; if (is_bit_set(&mode,bitBROWS)) fill_up_diagram_array(count);/*module read_inp.c*/ count++; if(is_bit_set(&mode,bitFORCEDTRUNSLATION)){ if(g_tt_try_loaded>0)/*Automatic momenta distribution mechanism*/ callrun=1; else if( ( is_bit_set(&mode,bitTERROR) )&&(!is_bit_set(&mode,bitBROWS))) callrun=0; else callrun=1; }else{ callrun=( (!is_bit_set(&mode,bitTERROR) )&& (!is_bit_set(&mode,bitBROWS) ) ); } /*Run the interpreter:*/ if(callrun){ build_form_input();/*module read_inp.c*/ run_init(0);/*module init.c*/ esc_char=mem_esc_char; if(run(number_of_trunslated_lines,array_of_trunslated_lines)==HALT) set_bit(&mode,bitRUNSIGNAL); run_clear();/*module init.c*/ if(is_bit_set(&mode, bitSKIP)){ unset_bit(&mode,bitSKIP); count--; }else if((is_bit_set(&mode,bitFORCEDTRUNSLATION))&& (skip_prototype()/*module utils.c*/)){ count--; }else{ if(g_topologyLabel!=NULL){/*First occurence, otherwise will be NULL*/ /*Mark topology as occurred*/ set_bit(g_topologyLabel,0); if(g_tt_try_loaded>0){/*Table were loaded*/ if( topologies[cn_topol].orig==NULL )/*Undefined topology*/ process_topol_tables(0);/*try to find momenta, read_inp.c*/ if(topologies[cn_topol].coordinates_ok==0)/*No coords*/ process_topol_tables(1);/*try to find coordinates, read_inp.c*/ /*Now current topology is marked, and wrk toable is built.*/ }else{ if( topologies[cn_topol].orig==NULL ){/*Undefined topology*/ if( automatic_momenta_group(NULL,cn_topol)==1) /*Now momenta are distributed automatically:*/ set_bit(g_topologyLabel,2); /*Bit 0: 0, if topology not occures, or 1; bit 1: 1, if topology was produced form generic, or 0. bit 2: 1, automatic momenta is implemented, or 0 */ }/*if( topologies[cn_topol].orig==NULL )*/ }/*if(g_tt_try_loaded>0)...else...*/ }/*if(g_topologyLabel!=NULL)*/ output_common_protocol(count);/*module read_inp.c*/ }/*if(is_bit_set(&mode, bitSKIP)) ... else ... else*/ if(is_bit_set(&mode,bitRUNSIGNAL)){ sc_done(); errorlevel=0; halt(RUNSIGNAL,NULL); }/*if(is_bit_set(&mode,bitRUNSIGNAL))*/ }/*if(callrun)*/ }/*end main loop*/ sc_done(); message(DONEDIAGRAMS,NULL); /*Check should we run the interpreter once more:*/ if(is_bit_set(&mode,bitEND)){ /*To use some of specmode operators during "extra call":*/ new_diagram(); run_init(1); esc_char=mem_esc_char; islast=1; g_nocurrenttopology=1;/*Similar to islast, but specially for topologies.*/ cn_topol=top_topol;/*Indicate that there is no special topology */ message(EXTRACALL,NULL); if(run(number_of_trunslated_lines,array_of_trunslated_lines)==HALT){ errorlevel=0; halt(RUNSIGNAL,NULL); } message(DONE,NULL); }/*if(is_bit_set(&mode,bitEND))*/ if (is_bit_set(&mode,bitBROWS)){ message(BROWSERMODEDETECT,NULL); out_browse_head(count);/*module browser.c*/ message(SORTINGDIAGRAMS,NULL); sort_diargams(count);/*module browser.c*/ message(DONE,NULL); message(PRINTINGDIAGRAMS,NULL); print_diagrams(count);/*module browser.c*/ message(DONE,NULL); sort_prototypes();/*module browser.c*/ print_prototypes();/*module browser.c*/ print_all_found_topologies();/*module browser.c*/ print_not_found_topologies();/*module browser.c*/ print_undefined_topologies();/*module browser.c*/ }/*if (is_bit_set(&mode,bitBROWS))*/ errorlevel=0; halt(NOERROR,NULL); return(0);/*Actually, the control can't reach this point*/ }/*main*/