Пример #1
0
void mark_global(VARIABLE *v)
{
    if (v == NULL)
        return;
    mark_global(v->next);
    v->global = 1;
}
Пример #2
0
static void
mark_stacks(void)
{
  mark_registers();
  mark_trail();
  mark_local();
  mark_global();
}
Пример #3
0
static void
mark_stacks(USES_REGS1)
{
  mark_registers(PASS_REGS1);
  mark_trail(PASS_REGS1);
  mark_local(PASS_REGS1);
  mark_global(PASS_REGS1);
}
Пример #4
0
SERVICE *makeSERVICE(HTML *htmls, SCHEMA *schemas, 
                     VARIABLE *variables, FUNCTION *functions,
                     SESSION *sessions)
{
    SERVICE *s = NEW(SERVICE);
    s->htmls = htmls;
    s->schemas = schemas;
    s->variables = variables;
    mark_global(s->variables);
    s->functions = functions;
    s->sessions = sessions;
    return s;
}
Пример #5
0
/*============================*/
int main (int argc, char *argv[]) {
    int tmp;
    char *line;
    loc_min *LM;
    int *tm;
    int i;
    char signal[100]="", what[100]="", stuff[100]="";

    /* Parse command line */
    program_name = argv[0];

    opt.kT = -300;
    opt.MOVESET = "";
    opt.minh = 0.0000001;
    opt.label = 0; /* normally, use numbers for minima */
    GRAPH   = NULL;

    /* Try to parse head to determine graph-type */
    decode_switches (argc, argv);

    if (args_info.inputs_num > 0) {
        opt.INFILE = fopen(args_info.inputs[0], "r");
        if (opt.INFILE==NULL) nrerror("can't open file");
    } else {
        opt.INFILE = stdin;
    }

    line = get_line(opt.INFILE);
    if (line == NULL) {
        fprintf(stderr,"Error in input file\n");
        exit(123);
    }
    opt.seq = (char *) space(strlen(line) + 1);
    sscanf(line,"%s %d %99s %99s %99s", opt.seq, &tmp, signal, what, stuff);
    if(strcmp(stuff, "\0")!=0 && strncmp(what, "Q", 1)==0) { /* lattice proteins*/
        memset(opt.seq, 0, strlen(line)+1);
        strcpy(opt.seq, stuff);
    }

    if ((!opt.poset)&&(strcmp(signal,"::")!=0)) {
        int r, dim;
        /* in this case we have a poset file !!!! */
        r=sscanf(signal,"P:%d",&dim);
        if(r<1) {
            fprintf(stderr,
                    "Warning: obscure headline in input file\n");
            dim = 0;
        }
        if(dim>0) opt.poset  = dim;
    }

    if (opt.poset) { /* in this case we have a poset file !!!! */
        fprintf(stderr,
                "!!! Input data are a poset with %d objective functions\n",
                opt.poset);
        /* we have a SECIS design file */
        if (  ((GRAPH != NULL) && (strstr(GRAPH, "SECIS") != NULL))
                ||(strncmp(what, "SECIS", 5) == 0) )
        {
#if HAVE_SECIS_EXTENSION
            int len, max_m, min_as;
            char *sec_structure, *protein_sequence;

            if (sscanf(what,"SECIS,%d,%d", &max_m, &min_as) < 2) {
                fprintf(stderr,
                        "Error in input format for SECIS design !"
                        "expected format: SECIS,INT,INT\n"
                        "got: `%s'",
                        what);
                exit(EXIT_FAILURE);
            }

            free(line);
            line = get_line(opt.INFILE);
            len  = strlen(line);
            sec_structure    = (char*)calloc(len+1, sizeof(char));
            protein_sequence = (char*)calloc(len+1, sizeof(char));
            sscanf(line,"%s %s", sec_structure, protein_sequence);

            if (opt.want_verbose)
                fprintf(stderr,
                        "\nGraph is SECIS design with the following parameters:\n"
                        "Structure:   %s\n"
                        "Constraints: %s\n"
                        "Protein sequence: %s\n"
                        "Max. number of mutations : %d\n"
                        "Min. alignment score (aa): %d\n\n",
                        sec_structure,
                        opt.seq,
                        protein_sequence,
                        max_m,
                        min_as);

            initialize_SECIS(opt.seq, sec_structure, protein_sequence,
                             max_m, min_as);

            free(sec_structure);
            free(protein_sequence);
#else
            fprintf(stderr,
                    "You need to reconfigure barriers with the --with-secis"
                    " option\nto use barriers SECIS design extension\n");
            exit(EXIT_FAILURE);
#endif
        }
    }

    free(line);

    if (GRAPH==NULL)
        if(strlen(what)) GRAPH = what;

    if (GRAPH==NULL) GRAPH="RNA";
    opt.GRAPH=GRAPH;

    LM = barriers(opt);
    if (opt.INFILE != stdin) fclose(opt.INFILE);
    tm = make_truemin(LM);

    if(opt.poset) mark_global(LM);

    print_results(LM,tm,opt.seq);
    fflush(stdout);

    if (!opt.want_quiet) ps_tree(LM,tm,0);

    if (opt.rates || opt.microrates) {
        compute_rates(tm,opt.seq);
        if (!opt.want_quiet) ps_tree(LM,tm,1);
        print_rates(tm[0], "rates.out");
    }
    if (opt.poset) mark_global(LM);

    for (i = 0; i < args_info.path_given; ++i) {
        int L1, L2;
        sscanf(args_info.path_arg[i], "%d=%d", &L1, &L2);
        if ((L1>0) && (L2>0)) {
            FILE *PATH = NULL;
            char tmp[30];
            path_entry *path;

            path = backtrack_path(L1, L2, LM, tm);
            (void) sprintf(tmp, "path.%03d.%03d.txt", L1, L2);

            PATH = fopen (tmp, "w");
            if (PATH == NULL) nrerror("couldn't open path file");
            print_path(PATH, path, tm);
            /* fprintf(stderr, "%llu %llu\n", 0, MAXIMUM);   */
            fclose (PATH);
            fprintf (stderr, "wrote file %s\n", tmp);
            free (path);
        }
    }

    /* memory cleanup */
    free(opt.seq);
    free(LM);
    free(tm);
#if WITH_DMALLOC
    kill_hash(); /* freeing the hash takes unacceptably long */
#endif
    cmdline_parser_free(&args_info);
    exit(0);
}