MAGIC Magic Mailing List
 
 

From: R. Timothy Edwards (tim AT stravinsky DOT jhuapl.edu)
Date: Tue May 22 2001 - 16:07:15 EDT

  • Next message: R. Timothy Edwards: "Re: "Too few area/perim values" in magic"

    Hello, folks:
    
    
       I've was looking last week at the area/perim value error mentioned by
    Richard Lethin, and magic is definitely in error, something which has
    apparently been introduced in version 7.1.  The error is in the .ext file
    "merge" records.  What we have is in ExtHier.c, line 384:
    
    ------------------------------------------------------------------------
                c = (node->node_cap) / ExtCurStyle->exts_capScale;
                nn = node->node_names;
                if (nnext = nn->nn_next)
                {
    
                    /* First merge */
                    (void) fprintf(outf, "merge \"%s\" \"%s\" %lg",
                                    nn->nn_name, nnext->nn_name, c);
                    for (n = 0; n < ExtCurStyle->exts_numResistClasses; n++)
                        (void) fprintf(outf, " %d %d",
                                    node->node_pa[n].pa_area,
                                    node->node_pa[n].pa_perim);
                    (void) fprintf(outf, "\n");
                    nn->nn_node = (Node *) NULL;            /* Processed */
    
                    /* Subsequent merges */
                    for (nn = nnext; nnext = nn->nn_next; nn = nnext)
                    {
                        (void) fprintf(outf, "merge \"%s\" \"%s\" %lg\n",
                                        nn->nn_name, nnext->nn_name, c);
                        nn->nn_node = (Node *) NULL;        /* Processed */
                    }
                }
                nn->nn_node = (Node *) NULL;
                FREE((char *) node);
    ------------------------------------------------------------------------
    
    The "First merge" code is correct (and probably the original code).
    The "Subsequent merges" line does not print the area/perimeter
    information for each node.  There is no mention of such a "truncated"
    version of the "merge" syntax for ext files in the ext man page.
    If anyone will own up to this code, can they tell me what they were
    trying to do?  Otherwise, I assume that the code should look like this:
    
    ------------------------------------------------------------------------
                c = (node->node_cap) / ExtCurStyle->exts_capScale;
                for (nn = node->node_names; nnext = nn->nn_next; nn = nnext)
                {
                    (void) fprintf(outf, "merge \"%s\" \"%s\" %lg",
                                    nn->nn_name, nnext->nn_name, c);
                    for (n = 0; n < ExtCurStyle->exts_numResistClasses; n++)
                        (void) fprintf(outf, " %d %d",
                                    node->node_pa[n].pa_area,
                                    node->node_pa[n].pa_perim);
                    (void) fprintf(outf, "\n");
                    nn->nn_node = (Node *) NULL;            /* Processed */
                }
                nn->nn_node = (Node *) NULL;
                FREE((char *) node);
    ------------------------------------------------------------------------
    
    Any comments from the magic_dev group?
    
                                                    Regards,
                                                    Tim
    


  •  
     
    Questions? Contact Rajit Manohar
    cornell logo