/* * Tests the alphabet string and attempts to return the ALPH_T. * If the alphabet is from some buffer a max size can be set * however it will still only test until the first null byte. * If the string is null terminated just set a max > 20 */ ALPH_T alph_type(const char *alphabet, int max) { int i; ALPH_T alph; alph = INVALID_ALPH; for (i = 0; i < max && alphabet[i] != '\0'; ++i) { if (!alph_test(&alph, i, alphabet[i])) return INVALID_ALPH; } if (i != ALPH_ASIZE[alph]) return INVALID_ALPH; return alph; }
int main(int argc, char **argv) { short pine = 0, output = 1, hist = 0, vol = 0, ahull = 0, ofn = 0, ifn = 0; int option; double alpha = 0; int main_out_form=0, alpha_out_form=0; simplex *root; fg *faces_gr; mult_up = 1; while ((option = getopt(argc, argv, "i:m:rs:do:X:a:Af:")) != EOF) { switch (option) { case 'm' : sscanf(optarg,"%lf",&mult_up); DEBEXP(-4,mult_up); break; case 'a' : vd = ahull = 1; switch(optarg[0]) { case 'a': sscanf(optarg+1,"%lf",&alpha); break; case '\0': break; default: tell_options(); } break; default : tell_options(); exit(1); } } INFILE = stdin; OUTFILE = stdout; DFILE = stderr; read_next_site(-1); if (dim > MAXDIM) panic("dimension bound MAXDIM exceeded"); point_size = site_size = sizeof(Coord)*dim; shuf = &noshuffle; get_site_n = read_next_site; root = build_convex_hull(get_next_site, site_numm, dim, vd); out_func* aof = out_funcs[alpha_out_form]; if (alpha==0) alpha=find_alpha(root); alph_test(0,0,&alpha); make_output(root, visit_outside_ashape, afacets_print, aof, OUTFILE); free_hull_storage(); exit(0); }