void mainbody(t_env *env) { t_cmd *base; t_cmd *ptrmaillon; base = NULL; g_flagsignal = 0; if (!env) env = setdefaultenv(); while (42) { print_prompt(env); read_command_line(&base); if (base) { ptrmaillon = base; while (ptrmaillon) { if (ptrmaillon->listcmd) dispatch(&env, ptrmaillon->listcmd); ptrmaillon = ptrmaillon->next; } freebase(&base); } } }
int main(int argc, char **argv) { /* Read command line arguments */ read_command_line(argc,argv); /* Read Parameters from parameter file */ read_parameters(); /* read box from file header */ if (box_from_header) read_box(infilename); /* Initialize cell data structures */ init_cells(); /* Read coordinates and displacement */ read_displacement(infilename); /* Calculate strain tensor */ calc_strain(); /* Output strain tensor */ write_data(); return 0; }
int main(void) { // Allocate a buffer for the command line read from the user. char command_line_buffer[COMMAND_LINE_BUFFER_SIZE]; // Parse the command line using the next_command() parser. The // parser will populate the following array with the result of each call // to the parser. char* argv[MAX_ARGV_SIZE]; // Count the number of non empty command lines. int command_line_nr = 0; // Count the number of children forked for each command line. int num_of_children = 0; while(1) { command_line_nr = read_command_line(command_line_nr, command_line_buffer, COMMAND_LINE_BUFFER_SIZE); num_of_children = execute_command_line(command_line_buffer, argv); for (int i = 0; i < num_of_children; i ++) { // TODO 1: Make the parent wait for all children. wait(NULL); } fflush(NULL); } // end while(1) } // end of main()
/* Pintos main program. */ int main (void) { char **argv; /* Clear BSS. */ bss_init (); /* Break command line into arguments and parse options. */ argv = read_command_line (); argv = parse_options (argv); /* Initialize ourselves as a thread so we can use locks, then enable console locking. */ thread_init (); console_init (); /* Greet user. */ printf ("Pintos booting with %'"PRIu32" kB RAM...\n", init_ram_pages * PGSIZE / 1024); /* Initialize memory system. */ palloc_init (user_page_limit); malloc_init (); paging_init (); <<<<<<< HEAD
MuError mu_cmd_server (MuStore *store, MuConfig *opts/*unused*/, GError **err) { ServerContext ctx; gboolean do_quit; g_return_val_if_fail (store, MU_ERROR_INTERNAL); ctx.store = store; ctx.query = mu_query_new (store, err); if (!ctx.query) return MU_G_ERROR_CODE (err); srand (time(NULL)*getpid()); install_sig_handler (); g_print (";; welcome to " PACKAGE_STRING "\n"); /* the main REPL */ do_quit = FALSE; while (!MU_TERMINATE && !do_quit) { GHashTable *args; GError *my_err; /* args will receive a the command as a list of * strings. returning NULL indicates an error */ my_err = NULL; args = read_command_line (&my_err); if (!args) { if (feof(stdin)) break; if (my_err) print_and_clear_g_error (&my_err); continue; } switch (handle_args (&ctx, args, &my_err)) { case MU_OK: break; case MU_STOP: do_quit = TRUE; break; default: /* some error occurred */ print_and_clear_g_error (&my_err); } g_hash_table_destroy (args); } mu_store_flush (ctx.store); mu_query_destroy (ctx.query); return MU_OK; }
static void input_loop(bool interactive) { static const int kInputBufferSize = 100 * 1024; char* inputBuffer = new char[kInputBufferSize]; for (;;) { // read command line if (interactive) { if (!read_command_line(inputBuffer, kInputBufferSize)) break; } else { if (!get_external_command(inputBuffer, kInputBufferSize)) break; } // construct argv vector int result = FSSH_B_BAD_VALUE; ArgVector argVector; if (argVector.Parse(inputBuffer) && argVector.Argc() > 0) { int argc = argVector.Argc(); const char* const* argv = argVector.Argv(); // find command Command* command = CommandManager::Default()->FindCommand(argv[0]); if (command) { // execute it result = command->Do(argc, argv); if (result == COMMAND_RESULT_EXIT) { if (!interactive) reply_to_external_command(0); break; } } else { fprintf(stderr, "Error: Invalid command \"%s\". Type \"help\" " "for a list of supported commands\n", argv[0]); } } if (!interactive) reply_to_external_command(fssh_to_host_error(result)); } if (!interactive) external_command_cleanup(); delete[] inputBuffer; }
void read_cmd_params(int argc, char* argv[]) { po::options_description command_line_args_desc = command_line_args_create(); po::variables_map command_line_args = read_command_line(command_line_args_desc, argc, argv); if(command_line_args.count("crossover")) { const std::string crossover_operator = command_line_args["crossover"].as<std::string>(); std::cout << "crossover operator: " << crossover_operator << std::endl; } if(command_line_args.count("help")) { std::cout << command_line_args_create() << "\n"; } }
int main(int argc, char **argv) { int tablesize; int n,i,j,k,l; /* Read command line arguments */ read_command_line(argc,argv); /* Read Parameters from parameter file */ read_parameters(); tablesize = slots*ntypes*ntypes*ntypes*ntypes*sizeof(real); histogram = (real *) malloc(tablesize); if (NULL==histogram) error("Cannot allocate memory for histograms."); hist_dim.n = slots; hist_dim.i = ntypes; hist_dim.j = ntypes; hist_dim.k = ntypes; hist_dim.l = ntypes; for (n=0; n<slots; ++n) for (i=0; i<ntypes; ++i) for (j=0; j<ntypes; ++j) for (k=0; k<ntypes; ++k) for (l=0; l<ntypes; ++l) *PTR_5D_V(histogram,n,i,j,k,l,hist_dim) = 0.0; r2_cut = SQR(r_max); /* read box from file header */ if (box_from_header) read_box(infilename); /* Initialize cell data structures */ init_cells(); /* Read atoms */ read_atoms(infilename); /* Calculate the torsion angles */ calc_angles(); /* Output results */ write_data(); return 0; }
int main(void) { char *command_line; char **command_args; int status; // Run loop. do { printf("<Zhang> "); command_line = read_command_line(); command_args = split_command_line(command_line); status = execute_command(command_args); //deallocate memory free(command_line); free(command_args); } while (status); return 0; }
int main(int argc, char *argv[]) { gchar *message; config_file = g_strdup_printf("%s/.gtktermrc", getenv("HOME")); bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); gtk_init(&argc, &argv); create_buffer(); create_main_window(); if(read_command_line(argc, argv) < 0) { delete_buffer(); exit(1); } Config_port(); message = get_port_string(); Set_window_title(message); Set_status_message(message); g_free(message); add_shortcuts(); set_view(ASCII_VIEW); gtk_main(); delete_buffer(); Close_port(); return 0; }
int main(void) { // Allocate a buffer for the command line read from the user. char command_line_buffer[COMMAND_LINE_BUFFER_SIZE]; // Parse the command line using the next_command() parser. The // parser will populate the following array with the result of each call // to the parser. char* argv[MAX_ARGV_SIZE]; // Count the number of non empty command lines. int command_line_nr = 0; // Count the number of children forked for each command line. int num_of_children = 0; while(1) { command_line_nr = read_command_line(command_line_nr, command_line_buffer, COMMAND_LINE_BUFFER_SIZE); num_of_children = execute_command_line(command_line_buffer, argv); int status; int ret; for (int i = 0; i < num_of_children; i ++) { ret = wait(&status); if (ret < 0) { perror("Something went wrong.\n"); exit(EXIT_FAILURE); } } fflush(NULL); } // end while(1) } // end of main()
int main(int argc,char *argv[]) { General general; Stopping sto; Concentration conc; Event *event; Measurement meas; int i; event=(Event *) malloc(MAXEVENTS*sizeof(Event)); read_command_line(argc,argv,&general); read_setup(&general,&meas,&conc); allocate_general_sto_conc(&general, &meas, &sto, &conc); switch(general.cs) { default: case CS_RUTHERFORD: fprintf(stderr, "erd_depth is using Rutherford cross sections\n"); break; case CS_LECUYER: fprintf(stderr, "erd_depth is using L'Ecuyer corrected Rutherford cross sections\n"); break; case CS_ANDERSEN: fprintf(stderr, "erd_depth is using Andersen corrected Rutherford cross sections\n"); break; } clear_conc(&general, &conc); read_events(&general,&meas,event,&conc); calculate_stoppings(&general, &meas, &sto); create_conc_profile(&general,&meas,&sto,&conc); for(i=0;i<general.niter;i++){ calculate_primary_energy(&general,&meas,&sto,&conc); clear_conc(&general, &conc); calculate_recoil_depths(&general,&meas,event,&sto,&conc); create_conc_profile(&general,&meas,&sto,&conc); } output(&general,&conc,event); exit(0); }
int prompt(buffer_t* buffer, struct job** job) { int read; pipeline_t* pipeline = new_pipeline(); /* show prompt */ char* cwd = getcwd(0, 0); char* dir = last_dir(cwd); printf("%s [%s] ", PROMPT, dir); fflush(stdout); free(cwd); read = read_command_line(buffer); /* parse and build job */ *job = NULL; if (read > 0 && !parse_command_line(buffer, pipeline)) { *job = job_from_pipeline(pipeline, buffer->buffer); } release_pipeline(pipeline); return read; }
int main(int argc, char* argv[]) { try { po::options_description command_line_args_desc = command_line_args_create(); po::variables_map command_line_args = read_command_line(command_line_args_desc, argc, argv); if(command_line_args.count("help")) { std::cout << command_line_args_create() << "\n"; return 0; } config cfg = interpret_cmd_line_arguments(command_line_args); solve_flowshop(cfg); } catch(std::exception& e) { std::cerr << "Error: " << e.what() << "\n"; return 1; } return 0; }
int main(int argc, char **argv) { /* Read command line arguments */ read_command_line(argc,argv); /* Read Parameters from parameter file */ read_parameters(); /* read box from file header */ if (box_from_header) read_box(infilename); #ifdef TERSOFF /* Compute Tersoff parameters */ init_tersoff(); #endif /* Initialize cell data structures */ init_cells(); /* Read atoms */ read_atoms(infilename); /* Compute neighbour tables */ do_work(do_neighbour_tables); first = 0; do_work(do_neighbour_tables); /* Search for rings */ search_rings(); /* Output ring statistics */ write_data(); return 0; }
int main(int argc, char **argv) { /* Read command line arguments */ read_command_line(argc,argv); /* Read Parameters from parameter file */ read_parameters(); /* Initialize cell data structures */ init_cells(); /* Read atoms */ read_stress(infilename); /* Calculate volume of Voronoi cells */ voronoi(); /* Output results */ write_stress(restart); exit(0); }
int main(int argc, char *argv[]) { configuration_t configuration; int i, j; struct timeval tm; struct timezone tz; measurement_t *measurement; struct timeval next, wait; int subject_id, flow_id; unsigned long long packets, bytes; double mbps; char command[MAX_COMMAND+1]; char hostname_interface[MAX_HOSTNAME_INTERFACE+1]; /* DiMAPI connect string as "hostname:interface,..." */ struct timeval tv_start, tv_stop; /* to measure how fast mapi_read_result() responds */ int tv_diff_pkt, tv_diff_byte; /* time used by mapi_read_results() */ int tv_diff_threshold; /* 1 if threshold was reached */ mapi_results_t *pkt_counter_res; mapi_results_t *byte_counter_res; unsigned long long pkt_counter; unsigned long long byte_counter; int scope_size; double pkt_sec; /* seconds from previous packet result */ double byte_sec; /* seconds from previous byte result */ mapi_flow_info_t info; mapi_device_info_t dinfo; openlog("abw", LOG_PID, LOG_LOCAL0); syslog(LOG_DEBUG, "starting abw"); memset((void *)&configuration, 0, (size_t)(sizeof(configuration))); /* Create global configuration */ if ((configuration.global=malloc(sizeof(global_t)))==NULL) { fprintf(stderr, "%s: malloc() failed\n", __func__); return -1; } memset(configuration.global, 0, sizeof(global_t)); /* Create first subject, scope, parameters and measurement so that they can be filled-in by command-line options */ /* if ((configuration.subject=new_subject())==NULL) { fprintf(stderr, "%s: new_subject() failed\n", __func__); return -1; } if ((configuration.scope=new_scope())==NULL) { fprintf(stderr, "%s: new_subject() failed\n", __func__); return -1; } if ((configuration.parameters=new_parameters())==NULL) { fprintf(stderr, "%s: new_parameters() failed\n", __func__); return -1; } if ((configuration.measurement=new_measurement())==NULL) { fprintf(stderr, "%s: new_measurement() failed\n", __func__); return -1; } */ /* Read command line */ if (read_command_line(argc, argv, &configuration)<0) { fprintf(stderr, "%s: read_command_line() failed\n", __func__); return -1; } /* Read configuration file */ if (configuration.global->conf_filename) { if (read_conf_file(&configuration)<0) { fprintf(stderr, "%s: read_conf_file() failed\n", __func__); return -1; } } /* Fill-in local hostname */ if (get_local_hostname(&(configuration.global->hostname))<0) { fprintf(stderr, "%s: get_local_hostname() failed\n", __func__); return -1; } /* Check if specified values are within acceptable limits */ if (check_conf(&configuration)<0) { fprintf(stderr, "%s: check_conf() failed\n", __func__); exit(-1); } /* Print configuration */ if (debug) print_conf(&configuration); if (daemonize) { printf("Switching to daemon\n"); if (continue_as_daemon()<0) { fprintf(stderr, "%s: continue_as_daemon() failed\n", __func__); return -1; } printf("Continuing as daemon\n"); } /* * Create RRD files */ /* Go over all measurements */ measurement=configuration.measurement; while (measurement) { int parameters_id; char *filename; parameters_id = measurement->parameters_id; /* Go over all protocols */ j=0; while (protocols[j].protocol) { if ((filename= abw_rrd_create_filename(measurement->scope, parameters_id, protocols[j].protocol))==NULL) { fprintf(stderr, "%s: rrd_create_filename() failed\n", __func__); return -1; } if (abw_rrd_create_file(filename)<0) { fprintf(stderr, "%s: abw_rrd_create_file() failed\n", __func__); return -1; } j++; } /* Go over all protocols */ /* Go over all tracked protocols */ j=0; while (tracked_protocols[j].protocol) { if ((filename= abw_rrd_create_filename(measurement->scope, parameters_id, tracked_protocols[j].protocol))==NULL) { fprintf(stderr, "%s: rrd_create_filename() failed\n", __func__); return -1; } if (abw_rrd_create_file(filename)<0) { fprintf(stderr, "%s: abw_rrd_create_file() failed\n", __func__); return -1; } j++; } /* Go over all tracked protocols */ /* Create RRD file for "all" protocol (all traffic together) */ if ((filename= abw_rrd_create_filename(measurement->scope, parameters_id, "all"))==NULL) { fprintf(stderr, "%s: rrd_create_filename() failed\n", __func__); return -1; } if (abw_rrd_create_file(filename)<0) { fprintf(stderr, "%s: abw_rrd_create_file() failed\n", __func__); return -1; } measurement=measurement->next; } /* while (measurement) */ /* * Create MAPI flows */ flow_id=0; /* Go over all measurements */ measurement=configuration.measurement; while (measurement) { /* Go over all monitored protocols */ i=0; while (measurement->protocols_array[i] && i<MAX_PROTOCOLS) { int parameters_id; char *protocol; /* Create data structure to maintain MAPI information */ if (flow_id>=MAX_FLOWS) { fprintf(stderr, "%s: more than %d flows requested\n", __func__, MAX_FLOWS); return -1; } if ((flow[flow_id]=new_flow())==NULL) { fprintf(stderr, "%s: new_flow() failed\n", __func__); return -1; } flow[flow_id]->measurement=measurement; flow[flow_id]->protocol=measurement->protocols_array[i]; parameters_id = measurement->parameters_id; protocol = measurement->protocols_array[i]; if ((flow[flow_id]->rrd_filename= abw_rrd_create_filename(measurement->scope, parameters_id, protocol))==NULL) { fprintf(stderr, "%s: rrd_create_filename() failed\n", __func__); return -1; } /* * If scope has only one subject and if hostname is "localhost" or * equal to local hostname, then use MAPI connect string (not DiMAPI) */ if (!(measurement->scope->subject[1]) && (!strcmp(measurement->scope->subject[0]->hostname, "localhost") || !strcmp(measurement->scope->subject[0]->hostname, configuration.global->hostname))) strcpy(hostname_interface, measurement->scope->subject[0]->interface); /* * Prepare DiMAPI connect string as hostname:interface, ... */ else { j=0; hostname_interface[0]='\0'; while (measurement->scope->subject[j] && j<MAX_SUBJECTS) { /* Append comma "," */ if (hostname_interface[0]) { if (strlen(hostname_interface)+1>=MAX_HOSTNAME_INTERFACE) { fprintf(stderr, "%s: DiMAPI connect string is longer than %d characters\n", __func__, MAX_HOSTNAME_INTERFACE); return -1; } strcat(hostname_interface, ","); } /* Append next hostname:interface */ if (strlen(hostname_interface) + strlen(measurement->scope->subject[j]->hostname) + strlen(measurement->scope->subject[j]->interface) >= MAX_HOSTNAME_INTERFACE) { fprintf(stderr, "%s: DiMAPI connect string is longer than %d characters\n", __func__, MAX_HOSTNAME_INTERFACE); return -1; } sprintf(hostname_interface + strlen(hostname_interface), "%s:%s", measurement->scope->subject[j]->hostname, measurement->scope->subject[j]->interface); j++; } /* while (measurement->scope->subject[j] && j<MAX_SUBJECTS) */ } /* Creating DiMAPI connect string */ /* Create a new MAPI flow */ if (debug) printf("%s: mapi_create_flow(%s)\n", __func__, hostname_interface); if ((flow[flow_id]->fd=mapi_create_flow(hostname_interface))<0) { fprintf(stderr, "%s: mapi_create_flow(%s) failed\n", __func__, hostname_interface); fprintf(stderr, "%s: Do you run mapid daemon on the machine where you connect to?\n", __func__); fprintf(stderr, "%s: Do you run mapicommd daemon on the machine where you connect to? (if you are connecting to a non-local machine or to multiple machines)\n", __func__); return -1; } /* If this is a MAPI flow (not DiMAPI flow), then set MPLS and VLAN flags according to mapi.conf. Otherwise the flags were set in abw.conf */ if (!strchr(hostname_interface, ':')) { if (debug) printf("%s: MAPI flow on \"%s\", setting MPLS and VLAN flags from mapi.conf\n", __func__, hostname_interface); if ((mapi_get_flow_info(flow[flow_id]->fd, &info)) < 0){ fprintf(stderr, "%s: mapi_get_flow_info() failed\n", __func__); return -1; } if ((mapi_get_device_info(info.devid, &dinfo)) < 0) { fprintf(stderr, "%s: mapi_get_device_info() failed\n", __func__); return -1; } measurement->scope->mpls = dinfo.mpls; measurement->scope->vlan = dinfo.vlan; } else if (debug) printf("%s: DiMAPI flow on \"%s\", setting MPLS and VLAN flags from abw.conf\n", __func__, hostname_interface); /* Prepare header filter for this protocol */ if ((flow[flow_id]->tracked_protocol= protocol_filter(measurement->parameters->header_filter, flow[flow_id]->protocol, measurement->scope->mpls, measurement->scope->vlan, &(flow[flow_id]->header_filter)))<0) { fprintf(stderr, "%s: protocol_filter() failed\n", __func__); return -1; } if (debug) printf("measurement->parameters->header_filter: %s, flow[flow_id]->protocol: %s, flow[flow_id]->header_filter: %s, track_function: %s\n", (measurement->parameters->header_filter)?measurement->parameters->header_filter:"NULL", flow[flow_id]->protocol, (flow[flow_id]->header_filter)?flow[flow_id]->header_filter:"NULL", (flow[flow_id]->tracked_protocol)?tracked_protocols[flow[flow_id]->tracked_protocol-1].track_function:"none"); /* Filter based on input port, we can use port number in the first subject of the scope, because all subjects in a scope must have the same port number */ if (measurement->scope->subject[0]->port >= 0) { if ((flow[flow_id]->interface_fid=mapi_apply_function(flow[flow_id]->fd, "INTERFACE", measurement->scope->subject[0]->port))<0) { fprintf(stderr, "%s: INTERFACE failed\n", __func__); return -1; } } /* Note that BPF_FILTER uses compiled header filter that selects packets of the given protocol */ /* BPF_FILTER is applied if a) header_filter was specified in [parameters] section or b) protocol other than "all" and other than some that requires tracking was specified in [parameters] section or c) MPLS is used on links in this [scope] */ if (flow[flow_id]->header_filter) { if (debug) printf("%s: mapi_apply_function(%d, BPF_FILTER, \"%s\")\n", __func__, flow[flow_id]->fd, flow[flow_id]->header_filter); if ((flow[flow_id]->bpf_filter_fid= mapi_apply_function(flow[flow_id]->fd, "BPF_FILTER", flow[flow_id]->header_filter))<0) { fprintf(stderr, "%s: BPF_FILTER (\"%s\") failed\n", __func__, flow[flow_id]->header_filter); return -1; } } /* Track application protocol, BPF_FILTER could have been applied before */ if (flow[flow_id]->tracked_protocol) { if (debug) printf("%s: mapi_apply_function(%d, %s)\n", __func__, flow[flow_id]->fd, tracked_protocols[flow[flow_id]->tracked_protocol-1]. track_function); if ((flow[flow_id]->track_function_fid= mapi_apply_function(flow[flow_id]->fd, tracked_protocols[flow[flow_id]->tracked_protocol-1]. track_function))<0) { fprintf(stderr, "%s: tracking (%s) failed\n", __func__, tracked_protocols[flow[flow_id]->tracked_protocol-1]. track_function); return -1; } } /* Sampling */ if (measurement->parameters->sau_mode == 'd' && (unsigned int)(measurement->parameters->sau_threshold) != 1) { if ((flow[flow_id]->sample_fid= mapi_apply_function(flow[flow_id]->fd, "SAMPLE", measurement->parameters->sau_threshold, PERIODIC))<0) { fprintf(stderr, "%s: SAMPLE (PERIODIC, %.02f) failed\n", __func__, measurement->parameters->sau_threshold); return -1; } } else if (measurement->parameters->sau_mode == 'p' && (unsigned int)(measurement->parameters->sau_threshold) != 1) { if ((flow[flow_id]->sample_fid= mapi_apply_function(flow[flow_id]->fd, "SAMPLE", (measurement->parameters->sau_threshold)*100, PROBABILISTIC))<0) { fprintf(stderr, "%s: SAMPLE (PROBABILISTIC, %.02f) failed\n", __func__, (measurement->parameters->sau_threshold)*100); return -1; } } /* Payload searching */ if (measurement->parameters->payload_strings[0]) { if ((flow[flow_id]->str_search_fid= mapi_apply_function(flow[flow_id]->fd, "STR_SEARCH", measurement->parameters->payload_strings[0], 0, 0))<0) { fprintf(stderr, "%s: STR_SEARCH (%s) failed\n", __func__, measurement->parameters->payload_strings[0]); return -1; } } /* Counting packets and bytes */ if ((flow[flow_id]->pkt_counter_fid= mapi_apply_function(flow[flow_id]->fd, "PKT_COUNTER"))<0) { fprintf(stderr, "%s: PKT_COUNTER failed\n", __func__); return -1; } /* Simultaneous use of PKT_COUNTER and BYTE_COUNTER does not work with DAG4.3GE. Temporary hack: always use stflib version */ if ((flow[flow_id]->byte_counter_fid= mapi_apply_function(flow[flow_id]->fd, "stdflib:BYTE_COUNTER"))<0) { fprintf(stderr, "%s: BYTE_COUNTER failed\n", __func__); return -1; } /* Connect to flow */ if (!configuration.global->no_measure) { if (mapi_connect(flow[flow_id]->fd)<0) { fprintf(stderr, "%s: mapi_connect() (%s) failed\n", __func__, hostname_interface); return -1; } if ((scope_size=mapi_get_scope_size(flow[flow_id]->fd)) != flow[flow_id]->measurement->scope->subject_no) { fprintf(stderr, "%s: mapi_get_scope_size() returned %d for %d subjects\n", __func__, scope_size, flow[flow_id]->measurement->scope->subject_no); return -1; } } i++; flow_id++; } /* while (measurement->protocols_array[i] && i<MAX_PROTOCOLS) */ measurement=measurement->next; } /* while (measurement) */ if (configuration.global->no_measure || !configuration.measurement) return 0; /* Periodically get results from MAPI flows */ while (1) { if (gettimeofday(&tm, &tz)<0) { fprintf(stderr, "%s: gettimeofday() failed\n", __func__); return -1; } flow_id=0; while (flow[flow_id] && flow_id<MAX_FLOWS) { int scope_packets, scope_bytes; if (!configuration.global->no_stdout) { printf("%d %u.%u", flow[flow_id]->measurement->scope->id, (unsigned int)(tm.tv_sec), (unsigned int)(tm.tv_usec)); if (!configuration.global->stdout_simple) printf(" %s\n", flow[flow_id]->protocol); } gettimeofday(&tv_start, NULL); if ((pkt_counter_res=mapi_read_results(flow[flow_id]->fd, flow[flow_id]->pkt_counter_fid))==NULL) { fprintf(stderr, "%s: mapi_read_results() for flow %d failed\n", __func__, flow_id); return -1; } gettimeofday(&tv_stop, NULL); tv_diff_pkt=timestamp_diff(&tv_start, &tv_stop); gettimeofday(&tv_start, NULL); if ((byte_counter_res=mapi_read_results(flow[flow_id]->fd, flow[flow_id]->byte_counter_fid))==NULL) { fprintf(stderr, "%s: mapi_read_results() for flow %d failed\n", __func__, flow_id); return -1; } gettimeofday(&tv_stop, NULL); tv_diff_byte=timestamp_diff(&tv_start, &tv_stop); if (tv_diff_pkt>=TV_DIFF_THRESHOLD || tv_diff_byte>=TV_DIFF_THRESHOLD) tv_diff_threshold=1; else tv_diff_threshold=0; if (tv_diff_pkt>=TV_DIFF_THRESHOLD) syslog(LOG_DEBUG, "mapi_read_result() for PKT_COUNTER takes %d us for measurement ID %d and protocol %s (threshold %d us reached)", tv_diff_pkt, flow[flow_id]->measurement->id, flow[flow_id]->protocol, TV_DIFF_THRESHOLD); if (tv_diff_byte>=TV_DIFF_THRESHOLD) syslog(LOG_DEBUG, "mapi_read_result() for BYTE_COUNTER takes %d us for measurement ID %d and protocol %s (threshold %d us reached)", tv_diff_byte, flow[flow_id]->measurement->id, flow[flow_id]->protocol, TV_DIFF_THRESHOLD); scope_size = flow[flow_id]->measurement->scope->subject_no; scope_packets=0; scope_bytes=0; for (subject_id=0; subject_id<scope_size; subject_id++) { pkt_counter= *((unsigned long long*)(pkt_counter_res[subject_id].res)); byte_counter= *((unsigned long long*)(byte_counter_res[subject_id].res)); packets=pkt_counter - flow[flow_id]->pkt_counter[subject_id]; bytes=byte_counter - flow[flow_id]->byte_counter[subject_id]; mbps=(double)bytes*8/1000000; flow[flow_id]->pkt_counter[subject_id]=pkt_counter; flow[flow_id]->byte_counter[subject_id]=byte_counter; /* Determine seconds from previous result */ if (flow[flow_id]->pkt_ts[subject_id]) pkt_sec=(double)(pkt_counter_res[subject_id].ts - flow[flow_id]->pkt_ts[subject_id])/1000000; else pkt_sec= flow[flow_id]->measurement->parameters->interval.tv_sec + (double)(flow[flow_id]->measurement->parameters->interval.tv_usec)/1000000; if (flow[flow_id]->byte_ts[subject_id]) byte_sec=(double)(byte_counter_res[subject_id].ts - flow[flow_id]->byte_ts[subject_id])/1000000; else byte_sec= flow[flow_id]->measurement->parameters->interval.tv_sec + (double)(flow[flow_id]->measurement->parameters->interval.tv_usec)/1000000; scope_packets+=(packets/pkt_sec); scope_bytes+=(bytes/byte_sec); flow[flow_id]->pkt_ts[subject_id]= pkt_counter_res[subject_id].ts; flow[flow_id]->byte_ts[subject_id]= byte_counter_res[subject_id].ts; if (tv_diff_threshold) { syslog(LOG_DEBUG, "%s:%s: %.02f seconds from previous result", flow[flow_id]->measurement->scope->subject[subject_id]->hostname, flow[flow_id]->measurement->scope->subject[subject_id]->interface, byte_sec); } /* Print result */ if (!configuration.global->no_stdout) { if (configuration.global->stdout_simple) printf(" %0.2f %0.2f %0.2f", packets/pkt_sec, bytes/byte_sec, mbps/byte_sec); else printf(" %0.2f packets/s, %0.2f bytes/s, %0.2f Mb/s, time %uus/%uus, interval %0.2fs/%0.2fs\n", packets/pkt_sec, bytes/byte_sec, mbps/byte_sec, tv_diff_pkt, tv_diff_byte, pkt_sec, byte_sec); } } /* for (subject_id=0; subject_id++; subject_id<scope_size) */ if (!configuration.global->no_stdout) printf("\n"); /* If interval is at least 1 second, then store results to RRD file */ if (flow[flow_id]->measurement->parameters->interval.tv_sec) { sprintf(command, "rrdtool update %s %u:%lu:%lu:%.6f", flow[flow_id]->rrd_filename, (unsigned int)(tm.tv_sec), (unsigned long)(scope_packets), (unsigned long)(scope_bytes), (double)scope_bytes*8/1000000); if (configuration.global->debug > 1) syslog(LOG_DEBUG, "system(%s)", command); if (tm.tv_sec == flow[flow_id]->rrd_ts) syslog(LOG_ERR, "duplicate RRD timestamp %u for scope %d\n", (unsigned int)(tm.tv_sec), flow[flow_id]->measurement->scope->id); else flow[flow_id]->rrd_ts=tm.tv_sec; if (debug) printf("%s: system(%s)\n", __func__, command); if (system(command)<0) { fprintf(stderr, "%s: command(%s) failed\n", __func__, command); return -1; } } flow_id++; } /* while (flow[flow_id] && flow_id<MAX_FLOWS) */ abw_next_timestamp(&(configuration.measurement->parameters->interval), &next, &wait); if (!configuration.global->no_stdout && !configuration.global->stdout_simple) { printf("next.tv_sec: %d, next.tv_usec: %d, wait.tv_sec: %d, wait.tv_usec: %d\n", (int)(next.tv_sec), (int)(next.tv_usec), (int)(wait.tv_sec), (int)(wait.tv_usec)); printf("===============================================================================\n"); } usleep(wait.tv_sec * 1000000 + wait.tv_usec); } /* while (1) */ return 0; } /* main() */
int main(int argc, char *argv[]) { FILE *command = NULL; char *command_line = NULL; char *line = NULL; char *line_bkp = NULL; char *baseline_perfdata = NULL; char *baseline_perfdata_aux = NULL; char *ini_path; char *aux = NULL; struct metric_t *mt; struct metric_t *aux_mt; struct metric_t *metrics_root; struct deviation_t *deviation; int exit_code = OK; int ret = 0; int min_entries = 0; int collected_entries = 0; int allow_negatives = TRUE; float tolerance = 0; unsigned int name_last_pos = 0; dictionary *ini; extern char **environ; if (argc <= 1) { printf("Invalid check command supplied\n"); return UNKNOWN; } // search for hostname and servicedescription macros line = *(environ + ret++); while(line) { aux = strtok(line,"="); if (!strcmp(aux,"NAGIOS_HOSTNAME")) { host_name = strtok(NULL,"="); } else if (!strcmp(aux,"NAGIOS_SERVICEDESC")) { service_description = strtok(NULL,"="); } ret++; line = *(environ + ret); } line = NULL; if (!host_name || !service_description) { printf("Unable to locate NAGIOS_HOSTNAME and NAGIOS_SERVICEDESC macros\n"); return UNKNOWN; } asprintf(&ini_path,"%s/baseline.ini",INSTALLPATH); ini = iniparser_load(ini_path); if (ini == NULL) { printf("Unable to process %s file\n",ini_path); return UNKNOWN; } // i personally dont like to use 'extern' variables // with this approach we can easily provide more backends support aux = iniparser_getstring(ini, "database:host", NULL); ret = (aux) ? db_set_dbserver(aux) : db_set_dbserver("localhost"); if (ret != OK) goto memory_allocation_error; aux = iniparser_getstring(ini, "database:user", NULL); ret = (aux) ? db_set_dbuser(aux) : db_set_dbuser("root"); if (ret != OK) goto memory_allocation_error; aux = iniparser_getstring(ini, "database:password", NULL); ret = (aux) ? db_set_dbpassword(aux) : db_set_dbpassword(""); if (ret != OK) goto memory_allocation_error; aux = iniparser_getstring(ini, "general:baselinealgorithm", "standard_deviation"); baseline_algorithm = STANDARDDEVIATION; if (strstr(aux,"exponential_smoothing")) baseline_algorithm = EXPONENTIALSMOOTH; aux = iniparser_getstring(ini, "database:dbname", NULL); ret = (aux) ? db_set_dbname(aux) : db_set_dbname("nada"); if (ret != OK) goto memory_allocation_error; db_set_max_entries( iniparser_getint(ini, "general:maxentries", MAXENTRIESTODEVIATION) ); db_set_sazonality( iniparser_getint(ini, "general:sazonality", SAZONALITY) ); min_entries = iniparser_getint(ini, "general:minentries", MINENTRIESTODEVIATION); allow_negatives = iniparser_getboolean(ini, "general:allownegatives", TRUE); tolerance = (float)iniparser_getint(ini, "general:tolerance", DEVIATIONTOLERANCE) / 100 + 1; // we no longer need dictionary iniparser_freedict(ini); free(ini_path); command_line = read_command_line(argc,argv); if (command_line == NULL) { printf("Error getting command line\n"); return UNKNOWN; } command = popen(command_line,"r"); if (!command) { printf("Unable to run supplied command\n"); free(command_line); return UNKNOWN; } line = malloc(MAXPLUGINOUTPUT + 1); if (line == NULL) { free(command_line); pclose(command); goto memory_allocation_error; } if (fgets(line, MAXPLUGINOUTPUT,command) == NULL) { printf("Unable to read plugin output\n"); free(command_line); pclose(command); free(line); return UNKNOWN; } if (strstr(line,"|") == NULL) { printf("%s",line); free(command_line); pclose(command); free(line); return OK; } // plugin output returned value becames // our default output return code exit_code = WEXITSTATUS(pclose(command)); if ((line_bkp = malloc(strlen(line) + 1)) == NULL) { free(command_line); free(line); goto memory_allocation_error; } strcpy(line_bkp,line); line[strlen(line) - 1] = '\x0'; strtok(line_bkp,"|"); metrics_root = parse_perfdata(strtok(NULL,"|")); if (metrics_root == NULL) { printf("Error parsing metric data - %s\n",line); free(command_line); free(line_bkp); return UNKNOWN; } ret = db_open_conn(); if (ret != OK) { printf("Unable to connect to database\n"); free(command_line); free(line); free(line_bkp); return UNKNOWN; } if ((baseline_perfdata = malloc(1)) == NULL) { free(command_line); free(line); free(line_bkp); goto memory_allocation_error; } *baseline_perfdata = '\x0'; for(mt=metrics_root; mt != NULL; mt=mt->next) { deviation = get_deviation( command_line, mt, &collected_entries, tolerance, allow_negatives ); if (collected_entries > min_entries) { // baseline has been broken if (mt->value < deviation->bottom || mt->value > deviation->top) { // change return code exit_code = CRITICAL; } } /* XXX * this certainly is not the more * appropriate way to do it */ name_last_pos = strlen(mt->name) - 1; if (mt->name[name_last_pos] == '\'') { mt->name[name_last_pos] = '\x0'; asprintf( &baseline_perfdata_aux," %s_top'=%.3f%s;;;; %s_bottom'=%.3f%s;;;; ", mt->name, deviation->top, mt->unit, mt->name, deviation->bottom, mt->unit ); } else if (mt->name[name_last_pos] == '"') { mt->name[name_last_pos] = '\x0'; asprintf( &baseline_perfdata_aux," %s_top\"=%.3f%s;;;; %s_bottom\"=%.3f%s;;;; ", mt->name, deviation->top, mt->unit, mt->name, deviation->bottom, mt->unit ); } else { asprintf( &baseline_perfdata_aux," %s_top=%.3f%s;;;; %s_bottom=%.3f%s;;;; ", mt->name, deviation->top, mt->unit, mt->name, deviation->bottom, mt->unit ); } baseline_perfdata = realloc(baseline_perfdata, strlen(baseline_perfdata) + strlen(baseline_perfdata_aux) + 1); strcat(baseline_perfdata,baseline_perfdata_aux); free(baseline_perfdata_aux); free(deviation); } printf( "%s %s\n", line, baseline_perfdata); mt = metrics_root; while(mt) { aux_mt = mt->next; free(mt->name); free(mt->unit); free(mt); mt = aux_mt; } free(command_line); free(line); free(line_bkp); free(baseline_perfdata); db_close_conn(); return exit_code; memory_allocation_error: fprintf(stderr,"Memory allocation error\n"); return CRITICAL; }
int main(int argc, char*argv[]){ po::options_description options("Topic modeling of data with 1 dimensional structure."); load_rost_base_options(options).add_options() ("gamma", po::value<double>()->default_value(0.1), "Rate of topic growth") ("delta", po::value<double>()->default_value(0), "How much to day dream") ("neighborhood.size,g", po::value<int>()->default_value(1), "Depth of the neighborhood"); auto args = read_command_line(argc, argv, options); ROST<int,neighbors<int>, hash<int> > rost(args["nwords"].as<int>(), args["ntopics"].as<int>(), args["alpha"].as<double>(), args["beta"].as<double>(), args["gamma"].as<double>(), args["delta"].as<double>(), neighbors<int>(args["neighborhood.size"].as<int>()), hash<int>()); word_reader in(args["in.words"].as<string>(), args["in.cellsize"].as<int>()); if(!args.count("online")){ cerr<<"Processing words in batch mode."<<endl; int t=0; auto words = in.get(); while(!words.empty()){ rost.add_observation(t++,words); words = in.get(); } cerr<<"Read "<<rost.cells.size()<<" cells"<<endl; for(int i=0; i<args["iter"].as<int>(); ++i){ cerr<<"Iter: "<<i<<" \r"; parallel_refine(&rost, args["threads"].as<int>()); } cerr<<"Writing output:"<<endl; ofstream out_topics(args["out.topics"].as<string>()); for(int d = 0; d< rost.C; ++d){ vector<int> topics = rost.get_topics_for_pose(d); copy(topics.begin(), topics.end(), ostream_iterator<int>(out_topics," ")); //copy(rost.cells[d]->Z.begin(), rost.cells[d]->Z.end(), ostream_iterator<int>(out_topics," ")); out_topics<<endl; } } else{ cerr<<"Processing words online."<<endl; atomic<bool> stop; stop.store(false); auto workers = parallel_refine_online(&rost, args["tau"].as<double>(), args["threads"].as<int>(), &stop); ofstream out_topics(args["out.topics"].as<string>()); int t=0; auto words = in.get(); cerr<<"adasdasd"<<endl; while(!words.empty()){ this_thread::sleep_for(chrono::milliseconds(args["online.mint"].as<int>())); // cerr<<"Read cell: "<<t<<endl; if(t>0){ vector<int> topics = rost.get_topics_for_pose(t-1); copy(topics.begin(), topics.end(), ostream_iterator<int>(out_topics," ")); out_topics<<endl; } rost.add_observation(t++,words); words = in.get(); } vector<int> topics = rost.get_topics_for_pose(t-1); copy(topics.begin(), topics.end(), ostream_iterator<int>(out_topics," ")); //copy(rost.cells[t-1]->Z.begin(), rost.cells[t-1]->Z.end(), ostream_iterator<int>(out_topics," ")); out_topics<<endl; cerr<<"Reached EOF. Terminating."<<endl; stop.store(true); for(auto t:workers){ t->join(); } } return 0; }
/* Main function */ int main(int argc, char **argv) { buffer_t *command_line; pipeline_t *pipeline; int pid, status, tmp, fd, ret; command_line = new_command_line(); pipeline = new_pipeline(); current_directory = (char*) malloc(1024*sizeof(char)); exeJobs = (s_exeJobs*)malloc(sizeof(s_exeJobs)); exeJobs->jobs = NULL; exeJobs->count = 0; /* Welcome message */ system("clear"); printf("Welcome to BlueShell!\n\n"); while (go_on) { current_directory = getcwd(current_directory, 1024); printf("%s%s%s ", SHELL_NAME, current_directory, PROMPT); fflush(stdout); ret = read_command_line(command_line); fatal(ret < 0, NULL); /* Parse command line. */ if (parse_command_line(command_line, pipeline) == 0) { if (pipeline->ncommands < 1) continue; /* Try to execute built in command */ if (exec_builtin(pipeline->command[0][0], pipeline->command[0])) continue; /* Running group of process in background */ if(RUN_BACKGROUND(pipeline)) { addJobsBack(pipeline); } /* Running group of process in foreground */ if (RUN_FOREGROUND(pipeline)) { /* More than one command */ if (pipeline->ncommands > 1) { /* Create another process and check for fatal error */ pid = fork(); fatal(pid < 0, "Could not create a new process."); /* If parent */ if (pid > 0) { /* Just wait for child to end */ wait(&status); /* If child */ } else { execute_pipeline(pipeline, NULL, pipeline->ncommands - 1); return EXIT_SUCCESS; } /* Only one command was read */ } else { /* Create another process and check for fatal error */ pid = fork(); fatal(pid < 0, "Could not create a new process."); /* If parent */ if (pid > 0) { /* Just wait for child to end */ addJobsFore(pipeline, pid); wait(&status); /* If child */ } else { /* Redirecting input */ if (REDIRECT_STDIN(pipeline)) { tmp = open(pipeline->file_in, O_RDONLY); fatal(tmp < 0, "Could not redirect input: file not found"); /* Close file descriptor 0 which is 'stdin' */ close(0); /* Make a copy of file descriptor opened for input, thus now it is associated with file descriptor 0 that has been just released */ fd = dup(tmp); fatal(fd < 0, "Could not redirect input."); close(tmp); } /* Redirecting output */ if (REDIRECT_STDOUT(pipeline)) { /* '>' Overwrite if file exists, or create a new one */ if (REDIRECT_STDOUT_WRITE(pipeline)) { tmp = open(pipeline->file_out, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR); fatal(tmp < 0, "Could not redirect output: failed to create a file"); /* '>>' Append to existing file */ } else if(REDIRECT_STDOUT_APPEND(pipeline)) { tmp = open (pipeline->file_out, O_CREAT | O_APPEND | O_RDWR, S_IRUSR | S_IWUSR); fatal(tmp < 0, "Could not redirect output: failed to append to file"); } /* Close file descriptor 1 which is 'stdout' */ close(1); /* Make a copy of file descriptor opened for output, thus now it is associated with file descriptor 1 that has been just released */ fd = dup(tmp); fatal(fd < 0, "Could not redirect input."); close(tmp); } /* Execute a program */ execvp(pipeline->command[0][0], pipeline->command[0]); /* If program not found */ printf ("%s: command not found\n", pipeline->command[0][0]); return EXIT_FAILURE; } } /* Running group of process in background */ } else { if (REDIRECT_STDIN(pipeline)) { /* TODO */ } if (REDIRECT_STDOUT(pipeline)) { /* TODO */ } } } } release_command_line(command_line); release_pipeline(pipeline); return EXIT_SUCCESS; }
void main (unsigned argc, string argv[]) { bzr_preamble_type preamble; bzr_postamble_type postamble; tfm_char_type *tfm_chars; tfm_global_info_type tfm_info; string tfm_name; unsigned this_char; unsigned char_count = 0; string font_name = read_command_line (argc, argv); string font_basename = basename (font_name); string bzr_name = concat (font_name, ".bzr"); if (!bzr_open_input_file (bzr_name)) FATAL1 ("%s: Could not find BZR file", font_name); tfm_name = find_tfm_filename (font_name); if (tfm_name == NULL || !tfm_open_input_file (tfm_name)) FATAL1 ("%s: Could not find TFM file", font_name); preamble = bzr_get_preamble (); postamble = bzr_get_postamble (); tfm_info = tfm_get_global_info (); tfm_chars = tfm_get_chars (); if (output_name == NULL) output_name = strtok (xstrdup (font_basename), "0123456789"); else if (find_suffix (output_name) != NULL && ((output[metafont] && output[pstype1]) || (output[metafont] && output[pstype3]) || (output[pstype1] && output[pstype3]))) FATAL ("You can't specify all the output files' suffices to be the same"); if (output[metafont]) metafont_start_output (output_name, preamble, tfm_info); if (output[pstype1]) pstype1_start_output (font_basename, output_name, preamble, postamble, tfm_info); if (output[pstype3]) pstype3_start_output (font_basename, output_name, preamble, postamble, tfm_info); if (output[text]) text_start_output (font_basename, preamble); for (this_char = 0; this_char <= MAX_CHARCODE; this_char++) { bzr_char_type *c = bzr_get_char (this_char); if (c != NULL) { REPORT1 ("[%u", this_char); BZR_SHAPE (*c) = oblique_splines (BZR_SHAPE (*c)); if (output[metafont]) metafont_output_char (*c); if (output[pstype1]) pstype1_output_char (*c); if (output[pstype3]) pstype3_output_char (*c); if (output[text]) text_output_char (*c); REPORT1 ("]%c", ++char_count % 8 ? ' ' : '\n'); } } if (output[metafont]) metafont_finish_output (tfm_chars); if (output[pstype1]) pstype1_finish_output (); if (output[pstype3]) pstype3_finish_output (); if (output[text]) text_finish_output (postamble); if (char_count % 8 != 0) REPORT ("\n"); bzr_close_input_file (); tfm_close_input_file (); exit (0); }
void init_stuff() { int seed; Uint32 (*my_timer_pointer) (unsigned int) = my_timer; //TODO: process command line options chdir(datadir); //Initialize all strings init_translatables(); #ifdef WRITE_XML load_translatables();//Write to the current working directory - hopefully we'll have write rights here... #endif //read the config file read_config(); //Parse command line options read_command_line(); //OK, we have the video mode settings... setup_video_mode(full_screen,video_mode); //now you may set the video mode using the %<foo> in-game video_mode_set=1; //Good, we should be in the right working directory - load all translatables from their files load_translatables(); init_video(); resize_window(); init_gl_extensions(); #ifdef CAL3D create_cal3d_model(); init_cal3d_model(); #endif seed = time (NULL); srand (seed); cache_system_init(MAX_CACHE_SYSTEM); init_texture_cache(); init_md2_cache(); init_e3d_cache(); init_2d_obj_cache(); load_ignores(); load_filters(); load_e3d_list(); load_e2d_list(); load_part_list(); load_knowledge_list(); load_cursors(); build_cursors(); change_cursor(CURSOR_ARROW); build_glow_color_table(); init_actors_lists(); memset(tile_list, 0, sizeof(tile_list)); memset(lights_list, 0, sizeof(lights_list)); init_particles_list(); memset(actors_defs, 0, sizeof(actors_defs)); init_actor_defs(); load_map_tiles(); //lights setup build_global_light_table(); build_sun_pos_table(); reset_material(); init_lights(); disable_local_lights(); init_colors(); clear_error_log(); clear_conn_log(); clear_thunders(); build_rain_table(); read_bin_cfg(); build_levels_table();//for some HUD stuff init_scale_array(); if(!no_sound)init_sound(); //initialize the fonts init_fonts(); check_gl_errors(); //load the necesary textures //font_text=load_texture_cache("./textures/font.bmp",0); icons_text=load_texture_cache("./textures/gamebuttons.bmp",0); hud_text=load_texture_cache("./textures/gamebuttons2.bmp",0); cons_text=load_texture_cache("./textures/console.bmp",255); sky_text_1=load_texture_cache("./textures/sky.bmp",70); particle_textures[0]=load_texture_cache("./textures/particle0.bmp",0); particle_textures[1]=load_texture_cache("./textures/particle1.bmp",0); particle_textures[2]=load_texture_cache("./textures/particle2.bmp",0); particle_textures[3]=load_texture_cache("./textures/particle3.bmp",0); particle_textures[4]=load_texture_cache("./textures/particle4.bmp",0); particle_textures[5]=load_texture_cache("./textures/particle5.bmp",0); particle_textures[6]=load_texture_cache("./textures/particle6.bmp",0); particle_textures[7]=load_texture_cache("./textures/particle7.bmp",0); items_text_1=load_texture_cache("./textures/items1.bmp",0); items_text_2=load_texture_cache("./textures/items2.bmp",0); items_text_3=load_texture_cache("./textures/items3.bmp",0); items_text_4=load_texture_cache("./textures/items4.bmp",0); items_text_5=load_texture_cache("./textures/items5.bmp",0); items_text_6=load_texture_cache("./textures/items6.bmp",0); items_text_7=load_texture_cache("./textures/items7.bmp",0); items_text_8=load_texture_cache("./textures/items8.bmp",0); items_text_9=load_texture_cache("./textures/items9.bmp",0); portraits1_tex=load_texture_cache("./textures/portraits1.bmp",0); portraits2_tex=load_texture_cache("./textures/portraits2.bmp",0); portraits3_tex=load_texture_cache("./textures/portraits3.bmp",0); portraits4_tex=load_texture_cache("./textures/portraits4.bmp",0); portraits5_tex=load_texture_cache("./textures/portraits5.bmp",0); halo_tex=load_texture_cache("./textures/halo.bmp",0); if(have_multitexture)ground_detail_text=load_texture_cache("./textures/ground_detail.bmp",255); check_gl_errors(); create_char_error_str[0]=0; init_opening_interface(); init_hud_interface(); if(SDLNet_Init()<0) { char str[120]; sprintf(str,"%s: %s\n",failed_sdl_net_init,SDLNet_GetError()); log_error(str); SDLNet_Quit(); SDL_Quit(); exit(2); } if(SDL_InitSubSystem(SDL_INIT_TIMER)<0) { char str[120]; sprintf(str, "%s: %s\n", failed_sdl_timer_init,SDL_GetError()); log_error(str); SDL_Quit(); exit(1); } SDL_SetTimer (1000/(18*4), my_timer_pointer); ReadXML("languages/en/Encyclopedia/index.xml"); read_key_config(); load_questlog(); init_buddy(); //initiate function pointers init_attribf(); //we might want to do this later. connect_to_server(); }
int main(int argc,char *argv[]) { Centroid *SYS,*ENV; Sprngmtx *Gamma; char *sysfile,*envfile,*massfile,*ctfile,*spgfile; double **GG; double *CUT,**HS,**HE,**HX,**PH,*P; double dd,x,y; int **CT,**PIX,nss,nen,nn,ntp,nse,r1,c1,r2,c2,i,j,k; int ptmd,rprm,pprm; /* Formalities */ read_command_line(argc,argv,&pprm,&rprm,&ptmd,&MSCL); /* Read coordinate and mass data */ sysfile=get_param(argv[pprm],"syscoords"); envfile=get_param(argv[pprm],"envcoords"); massfile=get_param(argv[pprm],"massfile"); SYS=read_centroids1(sysfile,massfile,&nss); ENV=read_centroids1(envfile,massfile,&nen); nn=nss+nen; fprintf(stderr,"System read from %s: %d centroids\n",sysfile,nss); fprintf(stderr,"Environment read from %s: %d centroids\n",envfile,nen); fprintf(stderr,"Masses read from %s\n",massfile); CT=imatrix(1,nn,1,nn); /* Find extent of membrane */ membounds(ENV,nen,&MHI,&MLO); /* Print masses, if called for */ if(ptmd==2){ for(i=1;i<=nss;i++) for(j=-2;j<=0;j++){ k=3*i+j; printf("%8d%8d% 25.15e\n",k,k,SYS[i].mass); } for(i=1;i<=nen;i++) for(j=-2;j<=0;j++){ k=3*nss+3*i+j; printf("%8d%8d% 25.15e\n",k,k,ENV[i].mass); } return 0; } /* ---------------- Assign contacts... ----------------- */ /* From a contact file... */ if((ctfile=get_param(argv[pprm],"contactfile"))!=NULL){ read_contacts(ctfile,CT,nn); fprintf(stderr,"Contacts read from %s\n",ctfile); } /* ...or from a cutoff file... */ else if((ctfile=get_param(argv[pprm],"cutfile"))!=NULL){ fprintf(stderr,"Cutoff values read from %s\n",ctfile); CUT=read_cutfile2(ctfile,SYS,ENV,nss,nen); radius_contact_sysenv(CT,SYS,ENV,nss,nen,CUT); } /* ...or from default values */ else{ CUT=dvector(1,nn); for(i=1;i<=nn;i++) CUT[i]=DEFCUT; fprintf(stderr,"All cutoff values set to %.3f\n",DEFCUT); radius_contact_sysenv(CT,SYS,ENV,nss,nen,CUT); } fprintf(stderr,"%d clusters\n",num_clusters(CT,nn)); if(ptmd==1){ fprintf(stderr,"Printing contacts\n"); for(i=1;i<=nn;i++) for(j=i+1;j<=nn;j++) if(CT[i][j]!=0) printf("%d\t%d\n",i,j); return 0; } /* ------- Construct the matrix of force constants -------*/ GG=dmatrix(1,nn,1,nn); /* Read force constants from file... */ if((spgfile=get_param(argv[pprm],"springfile"))!=NULL){ fprintf(stderr,"Reading spring constants from %s\n",spgfile); Gamma=read_springfile_sysenv(spgfile,SYS,ENV,nss,nen,&ntp); spring_constants_sysenv(SYS,ENV,GG,CT,Gamma,nss,nen,ntp); } /* ...or else assign the default value to all springs */ else for(i=1;i<=nn;i++) for(j=i;j<=nn;j++) if(CT[i][j]!=0) GG[i][j]=GG[j][i]=DEFGAM; /* Construct the mass-weighted Hessian from coordinates, masses, and potential matrix */ fprintf(stderr,"Calculating Hessian...\n"); HS=dmatrix(1,3*nss,1,3*nss); HE=dmatrix(1,3*nen,1,3*nen); HX=dmatrix(1,3*nss,1,3*nen); mwhess_sysenv(HS,HE,HX,SYS,ENV,GG,nss,nen); /* PRINT THE ENVIRONMENT-ENVIRONMENT SUB-HESSIAN IN SPARSE FORMAT */ if(ptmd==0 && rprm==-1){ fprintf(stderr,"\nPrinting env-env sub-hessian...\n\n"); for(i=1;i<=3*nen;i++) for(j=i;j<=3*nen;j++) if(fabs(HE[i][j])>1.0e-10) printf("%8d%8d% 25.15e\n",i,j,HE[i][j]); return 0; } /* PRINT THE FULL HESSIAN IN SPARSE FORMAT */ if(ptmd==3){ for(i=1;i<=3*nss;i++){ for(j=i;j<=3*nss;j++) if(fabs(HS[i][j])>1.0e-10) printf("%8d%8d% 20.10e\n",i,j,HS[i][j]); for(j=1;j<=3*nen;j++) if(fabs(HX[i][j])>1.0e-10) printf("%8d%8d% 20.10e\n",i,j+3*nss,HX[i][j]); } for(i=1;i<=3*nen;i++) for(j=i;j<=3*nen;j++) if(fabs(HE[i][j])>1.0e-10) printf("%8d%8d% 20.10e\n",i+3*nss,j+3*nss,HE[i][j]); return 0; } /* READ INVERSE OF ENVIRONMENTAL HESSIAN, OR INVERT HE */ free_imatrix(CT,1,nn,1,nn); free_dmatrix(GG,1,nn,1,nn); if(rprm!=-1){ fprintf(stderr,"Reading matrix from %s...\n",argv[rprm]); read_sparsemtx(argv[rprm],HE,3*nen,3*nen); } else{ fprintf(stderr,"\nWell...How did I get here?\n\n"); exit(1);} /* ---------------- CALCULATE AND PRINT THE PSEUDOHESSIAN ---------------- */ /* COUNT THE NUMBER OF NON-ZERO TERMS IN THE PROJECTION MATRIX */ nse=0; for(i=1;i<=3*nss;i++) for(j=1;j<=3*nen;j++) if(fabs(HX[i][j])>1.0e-9) nse++; fprintf(stderr,"%d non-zero projection elements\n",nse); P=dvector(1,nse); PIX=imatrix(1,nse,1,2); k=1; for(i=1;i<=3*nss;i++) for(j=1;j<=3*nen;j++) if(fabs(HX[i][j])>1.0e-9){ PIX[k][1]=i; PIX[k][2]=j; P[k]=HX[i][j]; k++; } free_dmatrix(HX,1,3*nss,1,3*nen); PH=dmatrix(1,3*nss,1,3*nss); for(i=1;i<=3*nss;i++) for(j=i;j<=3*nss;j++) PH[i][j]=PH[j][i]=0.0; for(i=1;i<=nse;i++){ r1=PIX[i][1]; c1=PIX[i][2]; x=P[i]; for(j=i;j<=nse;j++){ r2=PIX[j][1]; c2=PIX[j][2]; y=HE[c1][c2]*P[j]*x; PH[r1][r2]+=y; if(r1==r2 && c1!=c2) PH[r1][r2]+=y; } } for(i=1;i<=3*nss;i++) for(j=i;j<=3*nss;j++){ dd=HS[i][j]-PH[i][j]; if(fabs(dd)>1.0e-10) printf("%8d%8d% 25.15e\n",i,j,dd); } return 0; }
void main (int argc, string argv[]) { int code; string font_name = read_command_line (argc, argv); bitmap_font_type f = get_bitmap_font (font_name, atou (dpi)); string font_basename = basename (font_name); /* Initializing the display might involve forking a process. We wouldn't want that process to get copies of open output files, since then when it exited, random stuff might get written to the end of the file. */ init_display (f); if (logging) log_file = xfopen (concat (font_basename, ".log"), "w"); if (strlen (BITMAP_FONT_COMMENT (f)) > 0) REPORT1 ("{%s}\n", BITMAP_FONT_COMMENT (f)); if (output_name == NULL) output_name = font_basename; bzr_start_output (output_name, f); /* The main loop: for each character, find the outline of the shape, then fit the splines to it. */ for (code = starting_char; code <= ending_char; code++) { pixel_outline_list_type pixels; spline_list_array_type splines; char_info_type *c = get_char (font_name, code); if (c == NULL) continue; REPORT1 ("[%u ", code); if (logging) { LOG ("\n\n\f"); print_char (log_file, *c); } x_start_char (*c); pixels = find_outline_pixels (*c); /* `find_outline_pixels' uses corners as the coordinates, instead of the pixel centers. So we have to increase the bounding box. */ CHAR_MIN_COL (*c)--; CHAR_MAX_COL (*c)++; CHAR_MIN_ROW (*c)--; CHAR_MAX_ROW (*c)++; REPORT ("|"); splines = fitted_splines (pixels); bzr_output_char (*c, splines); /* Flush output before displaying the character, in case the user is interested in looking at it and the online version simultaneously. */ flush_log_output (); x_output_char (*c, splines); REPORT ("]\n"); /* If the character was empty, it won't have a bitmap. */ if (BITMAP_BITS (CHAR_BITMAP (*c)) != NULL) free_bitmap (&CHAR_BITMAP (*c)); free_pixel_outline_list (&pixels); free_spline_list_array (&splines); } bzr_finish_output (); close_display (); close_font (font_name); exit (0); }
main ( int argc, char **argv) { time_t r; int a, b, c, d, e; char time_string[100]; Parameter *PARAM; PARAM=declare_parameter(); get_ref_time (PARAM); argv=break_list ( argv, &argc, "=:;,"); process_command_line ( argc,argv, PARAM); read_command_line ( argc,argv, PARAM); fprintf ( stderr, "\nFINISHED READING PARAMETERS"); declare_dos_2 ( PARAM); INTERACTIVE_PROMPT_SET=(PARAM->BGA)->INTERACTIVE; if ( (PARAM->BGA)->OUTPUT_SCREEN==0) { (PARAM->std0)=stderr; (PARAM->std1)=(PARAM->std2)=fopen ( "/dev/null", "w"); } else if ( (PARAM->BGA)->OUTPUT_SCREEN==1) { (PARAM->std0)=(PARAM->std1)=stderr; (PARAM->std2)=fopen ( "/dev/null", "w"); } else if ((PARAM->BGA)->OUTPUT_SCREEN==2) { (PARAM->std0)=(PARAM->std1)=(PARAM->std2)=stderr; } time(&r); sprintf ( time_string, "%d", (int) r); PARAM->START=r; if ( (PARAM->BGA)->RANDOM_SEED >0) {addrandinit ( (unsigned long) (PARAM->BGA)->RANDOM_SEED); if ( ((PARAM->BGA)->OUTPUT_SCREEN)==1)printf ( "\nRANDOM_SEED= %d",(PARAM->BGA)->RANDOM_SEED); } else if ( (PARAM->BGA)->RANDOM_SEED== -1) { b=0; for ( a= strlen ( time_string)-1; a>=strlen ( time_string)-3; a--) time_string[b++]= time_string[a]; time_string[b]='\0'; (PARAM->BGA)->RANDOM_SEED= atoi ( time_string); addrandinit ( (unsigned long) (PARAM->BGA)->RANDOM_SEED); fprintf ((PARAM->std1), "\nRANDOM_SEED(undet)= %d",(PARAM->BGA)->RANDOM_SEED); } process_param (PARAM); input_data (PARAM); main_do_aln (PARAM); }
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*/