+++ /dev/null
-/*************************************************************************
- * 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: Details at https://graphviz.org
- *************************************************************************/
-
-#include "btree.h"
-
-#include <common/memory.h>
-#include <string.h>
-
-btree_node *new_node(char *attribute, char *regex, float min, float max)
-{
- btree_node *n;
- n = GNEW(btree_node);
- n->child_count = 0;
- n->childs = 0;
- n->rank = 0;
- n->attr_name = strdup(attribute);
- n->regex = strdup(regex);
- n->min = 0;
- n->max = 0;
- n->value = -1;
- n->active = 1;
- return n;
-}
-
-int insert_node(btree_node * parent_n, btree_node * n)
-{
- parent_n->child_count++;
- parent_n->childs = RALLOC(parent_n->child_count, parent_n->childs,
- btree_node *);
- parent_n->childs[parent_n->child_count - 1] = n;
- n->rank = parent_n->rank + 1;
- n->parent = parent_n;
- return 1;
-}
-
-int delete_node_recursive(btree_node * n)
-{
- int i = 0;
- //delete recursively
- for (i = 0; i < n->child_count; i++) {
- delete_node(n->childs[i]);
- }
- free(n->attr_name);
- free(n->regex);
- free(n->childs);
-
- free(n);
- return 1;
-}
-
-int delete_node(btree_node * n)
-{
- btree_node *parent = n->parent;
- int i = 0;
- int child_found = 0;
- //rmeove from parent's child list
- if (parent) {
- parent->child_count--;
- for (i = 0; i < parent->child_count; i++) {
- if (parent->childs[i] == n) {
- child_found = 1;
- }
- if (child_found)
- parent->childs[i] = parent->childs[i + 1];
- }
- }
- parent->childs =
- RALLOC(parent->child_count, parent->childs, btree_node *);
- delete_node_recursive(n);
- return 1;
-}
-
-btree_node *look_up_node_with_string(btree_node * n,
- char *string_to_lookup)
-{
- int i = 0;
- btree_node *nn;
- if (validate_lookup(n, string_to_lookup))
- return n;
- else {
- for (i = 0; i < n->child_count; i++) {
- nn = look_up_node_with_string(n->childs[i], string_to_lookup);
- if (nn)
- return nn;
- }
- }
- return 0;
-
-}
-int validate_lookup(btree_node * n, char *string_to_lookup) //it can be anything, in this case attr_name
-{
- if (strcmp(n->attr_name, string_to_lookup) == 0)
- return 1;
- return 0;
-}
-
-int print_tree(btree_node * root)
-{
- return 1;
-}
-
-int print_children(btree_node * n)
-{
- int i = 0;
- if (n->node_type == 2)
- printf(" %*s=%s(%i)\n", n->rank * 5 + 1, n->attr_name,
- n->regex, n->rank);
- else
- printf("%*s %c(%i)\n", n->rank * 5 + 1, "", n->op, n->rank);
- for (i = 0; i < n->child_count; i++)
- {
- print_children(n->childs[i]);
- }
- return 1;
-
-}
-
-int sample_tree(void)
-{
- btree_node *root;
- btree_node *n;
- btree_node *nn;
- btree_node *kurbanlik;
- root = new_node("A", "R", 0, 0);
- root->parent = 0;
- insert_node(root, new_node("B", "R", 0, 0));
- insert_node(root, new_node("C", "R", 0, 0));
-
- n = new_node("D", "R", 0, 0);
- kurbanlik = n;
- insert_node(root, n);
-
- nn = new_node("E", "R", 0, 0);
- insert_node(n, nn);
- insert_node(n, new_node("X", "R", 0, 0));
- insert_node(n, new_node("Y", "R", 0, 0));
- insert_node(n, new_node("Z", "R", 0, 0));
- n = new_node("F", "R", 0, 0);
- insert_node(root, n);
-
- print_children(root);
- n = look_up_node_with_string(root, "F");
- if (n)
- printf("found value-->%s \n", n->attr_name);
-
- delete_node(kurbanlik);
- print_children(root);
- print_children(tree_from_filter_string("(()(())((())()))"));
- return 1;
-
-
-}
-
-btree_node *tree_from_filter_string(char *filter_string)
-{
- btree_node *root;
- btree_node *cursor;
- btree_node *n;
- btree_node *Nodes[2];
- char buffer[512];
- char *b_cursor = 0;
- char *c_cursor;
- char op = '\0';
- char last_char = '\0';
- root = new_node("R", "", 0, 0);
- cursor = root;
- c_cursor = filter_string;
- while (*c_cursor != '\0') {
- switch (*c_cursor) {
- case '(':
- n = new_node(".", "", 0, 0);
- insert_node(cursor, n);
- last_char = '(';
- cursor = n;
- break;
- case ')':
- last_char = ')';
- cursor = cursor->parent;
- break;
- default:
- if (last_char == '(') {
- b_cursor = buffer;
- while (*c_cursor != ')') {
- *b_cursor = *c_cursor;
- b_cursor++;
- c_cursor++;
- }
- *b_cursor = '\0';
- evaluate_filter_atom(buffer, Nodes, &op);
- if (Nodes[1] != 0) {
- insert_node(cursor, Nodes[0]);
- insert_node(cursor, Nodes[1]);
- cursor->op = op;
- } else //only one expression in ()
- {
- insert_node(cursor->parent, Nodes[0]);
- delete_node(cursor);
- cursor = Nodes[0];
- }
-
-
- c_cursor--;
- }
- if (last_char == ')')
- cursor->op = *c_cursor;
- break;
- };
- c_cursor++;
- }
- return root;
-}
-int evaluate_filter_atom(char *string, btree_node * Nodes[], char *op)
-{
- char *c_cursor;
- char **attrs;
- char buff_attr[512];
- int c_buff_attr = 0;
- char buff_value[512];
- int c_buff_value = 0;
- int attrs_count = 0;
- char **values;
- int values_count = 0;
- btree_node *n;
- int kp_open = 0; //[ open
- int qt_open = 0; //" open?
- int i = 0;
-
- attrs = 0;
- values = 0;
-
- c_cursor = string;
- while (*c_cursor != '\0') {
- if (kp_open) {
- if ((*c_cursor == ',') || ((*c_cursor == ']') && (!qt_open))) {
- attrs = RALLOC(attrs_count + 1, attrs, char *);
- attrs[attrs_count] = strdup(buff_attr);
- attrs_count++;
- values = RALLOC(values_count + 1, values, char *);
- values[values_count] = strdup(buff_value);
- values_count++;
- buff_attr[0] = '\0';
- buff_value[0] = '\0';
- c_buff_attr = 0;
- c_buff_value = 0;
- }
- if ((*c_cursor != '=') && (*c_cursor != ',')
- && (*c_cursor != '\"')) {
- if (!qt_open && (*c_cursor != ']') && (*c_cursor != '[')) {
- buff_attr[c_buff_attr] = *c_cursor;
- buff_attr[c_buff_attr + 1] = '\0';
- c_buff_attr++;
- }
- if (qt_open) {
- buff_value[c_buff_value] = *c_cursor;
- buff_value[c_buff_value + 1] = '\0';
- c_buff_value++;
- }
- }
- if ((*c_cursor == '\"') && (qt_open))
- qt_open = 0;
- else if ((*c_cursor == '\"') && (!qt_open))
- qt_open = 1;
- if ((*c_cursor == ']') && !qt_open)
- kp_open = 0;
- }
- if (*c_cursor == '[')
- kp_open = 1;
- if (*c_cursor == '&')
- *op = '&';
- if (*c_cursor == '|')
- *op = '|';
- c_cursor++;
- }
-
- n = new_node(attrs[0], values[0], (float) atof(values[1]),
- (float) atof(values[2]));
- n->node_type = 2;
- Nodes[0] = n;
-
- if (attrs_count > 5) {
- n = new_node(attrs[3], values[3], (float) atof(values[4]),
- (float) atof(values[5]));
- n->node_type = 2;
- Nodes[1] = n;
- } else
- Nodes[1] = 0;
-
- for (i = 0; i < attrs_count; i++) {
- free(attrs[i]);
- free(values[i]);
- }
- free(attrs);
- free(values);
-
- return 1;
-}
-
-int evaluate_expresions(tv_node * TV_Node, btree_node * n)
-{
- char *data;
- int i = 0;
- int ii = 0;
- if (!n)
- return 1;
- if (n->op == '&')
- ii = 1;
- for (i = 0; i < n->child_count; i++) {
- evaluate_expresions(TV_Node, n->childs[i]);
- if (n->op == '&')
- ii = ii && n->childs[i]->value;
-// if(n->op=='|')
- else
- ii = ii || n->childs[i]->value;
-
- }
- if (n->node_type == 2) {
-//assert(n);
-//assert(n->attr_name);
-//fprintf(stderr,"agget(%d,%s)", TV_Node->index , n->attr_name);
- data =
- agget(view->Topview->Nodes[TV_Node->index].Node, n->attr_name);
-//fprintf(stderr," = %s\n", data);
- if (data) {
- if (strstr(data, n->regex) != NULL)
- n->value = 1;
- else
- n->value = 0;
- } else
- n->value = 1; //no attribute return 1
- } else
- n->value = ii;
- return n->value;
-
-}
+++ /dev/null
-/*************************************************************************
- * 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: Details at https://graphviz.org
- *************************************************************************/
-
-#ifndef BTREE_H
-#define BTREE_H
-
-#include "tvnodes.h"
-#ifdef _WIN32
-#include <regex_win32.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- btree_node *new_node(char *attribute, char *regex, float min,
- float max);
- int insert_node(btree_node * parent_n, btree_node * n);
- int delete_node(btree_node * n);
- int delete_node_recursive(btree_node * n); //internal function
- btree_node *look_up_node_with_string(btree_node * n,
- char *string_to_lookup);
- int validate_lookup(btree_node * n, char *string_to_lookup); //it can be anything, in this case attr_name
- int print_tree(btree_node * root);
- int print_children(btree_node * n);
- btree_node *tree_from_filter_string(char *filter_string);
- int evaluate_filter_atom(char *string, btree_node * Nodes[], char *op);
- int evaluate_expresions(tv_node * Node, btree_node * root);
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-#endif
+++ /dev/null
-#ifndef DRAWXDOT_H
-#define DRAWXDOT_H
-// code here
-
-#endif
+++ /dev/null
-/*************************************************************************
- * 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: Details at https://graphviz.org
- *************************************************************************/
-
-#include "filter.h"
-#include <common/memory.h>
-
-int clear_filter(tv_filter * f)
-{
- delete_node(f->root);
- return 1;
-}
-
-int init_filters(tv_filters * filters)
-{
- filters->filter_count = 0;
- filters->filters = 0;
- return 1;
-
-}
-
-int add_filter_to_filters(tv_filters * filters, tv_filter * filter)
-{
- filters->filters =
- RALLOC(filters->filter_count + 1, filters->filters, tv_filter *);
- filters->filters[filters->filter_count] = filter;
- filters->filter_count++;
- return 1;
-
-}
-
-int clear_filters(tv_filters * filters)
-{
- //deep clear
- int ind = 0;
- for (ind = 0; ind < filters->filter_count; ind++) {
- clear_filter(filters->filters[ind]);
- free(filters->filters[ind]);
- }
- filters->filter_count = 0;
- return 1;
-
-}
-
-int union_filter(tv_filter * f1, tv_filter * f2)
-{
- return 1;
-
-}
-
-int intersect_filter(tv_filter * f1, tv_filter * f2)
-{
- return 1;
-
-}
+++ /dev/null
-/*************************************************************************
- * 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: Details at https://graphviz.org
- *************************************************************************/
-
-#ifndef FILTER_H
-#define FILTER_H
-#include "btree.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- typedef struct _tv_filters {
- tv_filter **filters;
- int filter_count;
- } tv_filters;
-
- int clear_filter(tv_filter * f);
- int init_filters(tv_filters * filters);
- int add_filter_to_filters(tv_filters * filters, tv_filter * filter);
- int clear_filters(tv_filters * filters);
- int union_filter(tv_filter * f1, tv_filter * f2);
- int intersect_filter(tv_filter * f1, tv_filter * f2);
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-#endif
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
- <ClInclude Include="btree.h" />
<ClInclude Include="draw.h" />
- <ClInclude Include="filter.h" />
<ClInclude Include="glexpose.h" />
<ClInclude Include="glmotion.h" />
<ClInclude Include="gltemplate.h" />
<ClInclude Include="support.h" />
<ClInclude Include="topfisheyeview.h" />
<ClInclude Include="topview.h" />
- <ClInclude Include="topviewdata.h" />
<ClInclude Include="topviewdefs.h" />
<ClInclude Include="trackball.h" />
<ClInclude Include="tvnodes.h" />
<ClInclude Include="gui\beacon.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="btree.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="gui\callbacks.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="draw.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="filter.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="gui\filterscallbacks.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="topview.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="topviewdata.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="topviewdefs.h">
<Filter>Header Files</Filter>
</ClInclude>
+++ /dev/null
-/*
- * DO NOT EDIT THIS FILE - it is generated by Glade.
- */
-
-#include "config.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <stdio.h>
-
-#include <gtk/gtk.h>
-
-#include "support.h"
-
-#if 0
-GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name)
-{
- GtkWidget *parent, *found_widget;
-
- for (;;) {
- if (GTK_IS_MENU(widget))
- parent = gtk_menu_get_attach_widget(GTK_MENU(widget));
- else
- parent = widget->parent;
- if (!parent)
- parent =
- (GtkWidget *) g_object_get_data(G_OBJECT(widget),
- "GladeParentKey");
- if (parent == NULL)
- break;
- widget = parent;
- }
-
- found_widget = (GtkWidget *) g_object_get_data(G_OBJECT(widget),
- widget_name);
- if (!found_widget)
- g_warning("Widget not found: %s", widget_name);
- return found_widget;
-}
-#endif
-
-static GList *pixmaps_directories = NULL;
-
-#if 0
-/* Use this function to set the directory containing installed pixmaps. */
-static void add_pixmap_directory(const gchar * directory)
-{
- pixmaps_directories = g_list_prepend(pixmaps_directories,
- g_strdup(directory));
-}
-
-/* This is an internally used function to find pixmap files. */
-static gchar *find_pixmap_file(const gchar * filename)
-{
- GList *elem;
-
- /* We step through each of the pixmaps directory to find it. */
- elem = pixmaps_directories;
- while (elem) {
- gchar *pathname = g_strdup_printf("%s%s%s", (gchar *) elem->data,
- G_DIR_SEPARATOR_S, filename);
- if (g_file_test(pathname, G_FILE_TEST_EXISTS))
- return pathname;
- g_free(pathname);
- elem = elem->next;
- }
- return NULL;
-}
-
-/* This is an internally used function to create pixmaps. */
-GtkWidget *create_pixmap(GtkWidget * widget, const gchar * filename)
-{
- gchar *pathname = NULL;
- GtkWidget *pixmap;
-
- if (!filename || !filename[0])
- return gtk_image_new();
-
- pathname = find_pixmap_file(filename);
-
- if (!pathname) {
- g_warning(_("Couldn't find pixmap file: %s"), filename);
- return gtk_image_new();
- }
-
- pixmap = gtk_image_new_from_file(pathname);
- g_free(pathname);
- return pixmap;
-}
-
-/* This is an internally used function to create pixmaps. */
-GdkPixbuf *create_pixbuf(const gchar * filename)
-{
- gchar *pathname = NULL;
- GdkPixbuf *pixbuf;
- GError *error = NULL;
-
- if (!filename || !filename[0])
- return NULL;
-
- pathname = find_pixmap_file(filename);
-
- if (!pathname) {
- g_warning(_("Couldn't find pixmap file: %s"), filename);
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_new_from_file(pathname, &error);
- if (!pixbuf) {
- fprintf(stderr, "Failed to load pixbuf file: %s: %s\n",
- pathname, error->message);
- g_error_free(error);
- }
- g_free(pathname);
- return pixbuf;
-}
-#endif
-
-#if 0
-/* This is used to set ATK action descriptions. */
-void
-glade_set_atk_action_description(AtkAction * action,
- const gchar * action_name,
- const gchar * description)
-{
- gint n_actions, i;
-
- n_actions = atk_action_get_n_actions(action);
-
-
- for (i = 0; i < n_actions; i++) {
- if (!strcmp(atk_action_get_name(action, i), action_name))
- atk_action_set_description(action, i, description);
- }
-}
-#endif
+++ /dev/null
-/*************************************************************************
- * 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: Details at https://graphviz.org
- *************************************************************************/
-
-#ifndef TOPVIEWDATA_H
-#define TOPVIEWDATA_H
-
-#include <gtk/gtk.h>
-#include <cgraph/cgraph.h>
-#include "smyrnadefs.h"
-#include "tvnodes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- int prepare_nodes_for_groups(topview * t, topviewdata * td,
- int groupindex);
- int load_host_buttons(topview * t, Agraph_t * g, glCompSet * s);
- int click_group_button(int groupindex);
- void glhost_button_clicked_Slot(void *p);
- _BB void host_button_clicked_Slot(GtkWidget * widget,
- gpointer user_data);
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-#endif