<commit_before>/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/*************************************************************************
 * Copyright (c) 2011 AT&T Intellectual Property 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors: See CVS logs. Details at http://www.graphviz.org/
 *************************************************************************/


#include    "circular.h"
#include    "blocktree.h"
#include    "circpos.h"
#include	<string.h>

#define		MINDIST			1.0

/* initGraphAttrs:
 * Set attributes based on original root graph.
 * This is obtained by taking a node of g, finding its node
 * in the original graph, and finding that node's graph.
 */
static void initGraphAttrs(Agraph_t * g, circ_state * state)
{
    static Agraph_t *rootg;
    static attrsym_t *N_artpos;
    static attrsym_t *N_root;
    static double min_dist;
    static char *rootname;
    Agraph_t *rg;
    attrsym_t *G_mindist;
    node_t *n = agfstnode(g);

    rg = agraphof(ORIGN(n));
    if (rg != rootg) {		/* new root graph */
	state->blockCount = 0;
	rootg = rg;
	G_mindist = agattr(rootg,AGRAPH, "mindist", NULL);
	min_dist = late_double(rootg, G_mindist, MINDIST, 0.0);
	N_artpos = agattr(rootg,AGNODE, "articulation_pos", NULL);
	N_root = agattr(rootg,AGNODE, "root", NULL);
	rootname = agget(rootg, "root");
    }
    initBlocklist(&state->bl);
    state->orderCount = 1;
    state->min_dist = min_dist;
    state->N_artpos = N_artpos;
    state->N_root = N_root;
    state->rootname = rootname;
}

/* cleanup:
 * We need to cleanup objects created in initGraphAttrs
 * and all blocks. All graph objects are components of the
 * initial derived graph and will be freed when it is closed. 
 */<commit_msg>Fix bug 2395<commit_after>/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/*************************************************************************
 * Copyright (c) 2011 AT&T Intellectual Property 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors: See CVS logs. Details at http://www.graphviz.org/
 *************************************************************************/


#include    "circular.h"
#include    "blocktree.h"
#include    "circpos.h"
#include	<string.h>

#define		MINDIST			1.0

/* initGraphAttrs:
 * Set attributes based on original root graph.
 * This is obtained by taking a node of g, finding its node
 * in the original graph, and finding that node's graph.
 */
static void initGraphAttrs(Agraph_t * g, circ_state * state)
{
    static Agraph_t *rootg;
    static attrsym_t *N_artpos;
    static attrsym_t *N_root;
    static double min_dist;
    static char *rootname;
    Agraph_t *rg;
    attrsym_t *G_mindist;
    node_t *n = agfstnode(g);

    rg = agraphof(ORIGN(n));
    if (rg != rootg) {		/* new root graph */
	state->blockCount = 0;
	rootg = rg;
	G_mindist = agattr(rootg,AGRAPH, "mindist", NULL);
	N_artpos = agattr(rootg,AGNODE, "articulation_pos", NULL);
	N_root = agattr(rootg,AGNODE, "root", NULL);
    }
    rootname = agget(rootg, "root");
    min_dist = late_double(rootg, G_mindist, MINDIST, 0.0);
    initBlocklist(&state->bl);
    state->orderCount = 1;
    state->min_dist = min_dist;
    state->N_artpos = N_artpos;
    state->N_root = N_root;
    state->rootname = rootname;
}

/* cleanup:
 * We need to cleanup objects created in initGraphAttrs
 * and all blocks. All graph objects are components of the
 * initial derived graph and will be freed when it is closed. 
 */
{'fraction_non_alphanumeric': 0.1820056715648363, 'fraction_numerical': 0.009280742459396751, 'mean_word_length': 3.89281210592686, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4191378', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1251, 'n_words': 382}