From: arif Date: Mon, 20 Jul 2009 14:10:43 +0000 (+0000) Subject: debug codes (printfs) have been removed X-Git-Tag: LAST_LIBGRAPH~32^2~1812 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65ec20730eef7030ac309ed4b35899b313b53244;p=graphviz debug codes (printfs) have been removed --- diff --git a/cmd/smyrna/draw.c b/cmd/smyrna/draw.c index 8e5e230b6..e11af6ed5 100755 --- a/cmd/smyrna/draw.c +++ b/cmd/smyrna/draw.c @@ -40,8 +40,7 @@ GLubyte rasters[24] = { 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xff, 0xc0, 0xff, 0xc0 }; -static void -DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param) +void DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param) { /*copied from NEHE */ /*Written by: David Nikdel ( ogapo@ithink.net ) */ @@ -290,7 +289,7 @@ load_raw_texture(char *file_name, int width, int height, int depth, //Draws a ellpise made out of points. //void DrawEllipse(xdot_point* xpoint,GLfloat xradius, GLfloat yradius,int filled) -static void DrawEllipse(xdot_op * op, int param) +void DrawEllipse(xdot_op * op, int param) { //to draw a circle set xradius and yradius same values GLfloat x, y, xradius, yradius; @@ -381,7 +380,7 @@ static void DrawPolygon(xdot_op * op, int param) glEnd(); } -static void DrawPolyline(xdot_op * op, int param) +void DrawPolyline(xdot_op * op, int param) { int i = 0; if (param == 0) @@ -426,7 +425,7 @@ DrawBitmap(GLfloat bmpX, GLfloat bmpY, GLfloat bmpW, GLfloat bmpH) } #endif -static void SetFillColor(xdot_op * op, int param) +void SetFillColor(xdot_op * op, int param) { RGBColor c; c = GetRGBColor(op->u.color); @@ -435,7 +434,7 @@ static void SetFillColor(xdot_op * op, int param) view->fillColor.B = c.B; view->fillColor.A = c.A; } -static void SetPenColor(xdot_op * op, int param) +void SetPenColor(xdot_op * op, int param) { RGBColor c; c = GetRGBColor(op->u.color); @@ -445,7 +444,7 @@ static void SetPenColor(xdot_op * op, int param) view->penColor.A = c.A; } -static void SetStyle(xdot_op * op, int param) +void SetStyle(xdot_op * op, int param) { @@ -458,12 +457,12 @@ static void SetFont(xdot_op * op, int param) view->FontSize = op->u.font.size;*/ } -static void InsertImage(xdot_op * op, int param) +void InsertImage(xdot_op * op, int param) { // SelectImage((sdot_op *) op); } -static void EmbedText(xdot_op * op, int param) +void EmbedText(xdot_op * op, int param) { GLfloat x; // SelectText((sdot_op *) op); @@ -562,7 +561,7 @@ void draw_magnifier(ViewInfo * view) } -static void draw_circle(float originX, float originY, float radius) +void draw_circle(float originX, float originY, float radius) { /* draw a circle from a bunch of short lines */ float vectorX1, vectorY1, vectorX, vectorY, angle; @@ -583,7 +582,7 @@ static void draw_circle(float originX, float originY, float radius) } -static GLUquadric* fisheyesphere; +GLUquadric* fisheyesphere; void draw_fisheye_magnifier(ViewInfo * view) { if ((view->mouse.mouse_mode == 21) && (view->mouse.mouse_down)) { diff --git a/cmd/smyrna/draw.h b/cmd/smyrna/draw.h index 83b317ba8..e57f7b945 100755 --- a/cmd/smyrna/draw.h +++ b/cmd/smyrna/draw.h @@ -46,6 +46,7 @@ extern RGBColor GetRGBColor(char *color); extern void drawBorders(ViewInfo * view); void drawEllipse(float xradius, float yradius,int angle1,int angle2); int draw_node_hintbox(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* text); +void DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param); void draw_sphere(float x,float y,float z,float r); diff --git a/cmd/smyrna/gui/beacon.c b/cmd/smyrna/gui/beacon.c index f3e797196..eca98c44c 100644 --- a/cmd/smyrna/gui/beacon.c +++ b/cmd/smyrna/gui/beacon.c @@ -133,7 +133,6 @@ int remove_from_pick_list(topview_node * n) { int ind = 0; int found = 0; - printf("removed\n"); for (; ind < view->Topview->picked_node_count; ind++) { if ((view->Topview->picked_nodes[ind] == n) && (!found)) found = 1; @@ -158,7 +157,6 @@ int add_to_pick_list(topview_node * n) view->Topview->picked_node_count++; view->Topview->picked_nodes =realloc(view->Topview->picked_nodes,sizeof(topview_node *) * view->Topview->picked_node_count); view->Topview->picked_nodes[view->Topview->picked_node_count - 1] = n; - printf("picked count:%d\n",view->Topview->picked_node_count); return 1; } @@ -177,7 +175,6 @@ int remove_edge_from_pick_list(topview_edge * e) { int ind = 0; int found = 0; - printf("removed\n"); for (; ind < view->Topview->picked_edge_count; ind++) { if ((view->Topview->picked_edges[ind] == e) && (!found)) @@ -201,7 +198,6 @@ int add_edge_to_pick_list(topview_edge * e) view->Topview->picked_edge_count++; view->Topview->picked_edges =realloc(view->Topview->picked_edges,sizeof(topview_edge *) * view->Topview->picked_edge_count); view->Topview->picked_edges[view->Topview->picked_edge_count - 1] = e; - printf("picked edge count:%d\n",view->Topview->picked_edge_count); return 1; } @@ -270,8 +266,8 @@ int draw_node_hint_boxes(void) for (ind = 0; ind < view->Topview->picked_edge_count; ind++) { - buf[0]=(char*)0; float x1,x2,x3,y1,y2,y3,z1,z2,z3l; + buf[0]=(char*)0; glColor4f(0, 1, 0, 0.5); e = view->Topview->picked_edges[ind]; x1=e->Node1->distorted_x; diff --git a/cmd/smyrna/gui/beacon.h b/cmd/smyrna/gui/beacon.h index 7ddf05ae7..07cf60182 100644 --- a/cmd/smyrna/gui/beacon.h +++ b/cmd/smyrna/gui/beacon.h @@ -2,9 +2,10 @@ #define BEACON_H #include "smyrnadefs.h" -int pick_node(topview_node * n); -int is_node_picked(topview_node * n); -int remove_from_pick_list(topview_node * n); -int add_to_pick_list(topview_node * n); +extern int pick_node(topview_node * n); +extern int is_node_picked(topview_node * n); +extern int remove_from_pick_list(topview_node * n); +extern int add_to_pick_list(topview_node * n); +extern int draw_node_hint_boxes(void); #endif diff --git a/cmd/smyrna/gui/menucallbacks.c b/cmd/smyrna/gui/menucallbacks.c index 85ec9d323..7e1d9a23b 100755 --- a/cmd/smyrna/gui/menucallbacks.c +++ b/cmd/smyrna/gui/menucallbacks.c @@ -77,7 +77,6 @@ void mSaveAsSlot(GtkWidget * widget, gpointer user_data) } void mCloseSlot(GtkWidget * widget, gpointer user_data) { - printf("mCloseSlot clicked\n"); if (view->activeGraph == 0) close_graph(view,0); } diff --git a/cmd/smyrna/main.c b/cmd/smyrna/main.c index 29f37c137..630259815 100755 --- a/cmd/smyrna/main.c +++ b/cmd/smyrna/main.c @@ -54,59 +54,6 @@ static char* smyrnaDir; /* path to directory containin smyrna data files */ char* smyrnaGlade; unsigned char SmyrnaVerbose; -#if 0 -infixtoposfic(char* infix,char* posfix,int bfsize) -{ - char a=NULL; - int ind=0; - int ind2=0; /*points to empty cell*/ - int st[512]; - int ptr=0; - for (ind=0;ind < strlen(infix); ind ++) - { - printf ("stack:%s\n",st); - printf ("posix:%s\n",posfix); - a=infix[ind]; - if ((a != '(') && (a != ')') &&(a != '+') && (a != '-') && (a != '/') &&(a != '*')) - { - posfix[ind2]=a; - ind2++; - continue; - } - if(a=='(') - { - st[ptr]=a; - ptr++; - continue; - } - if((a == '+') || (a == '-') || (a == '/') ||(a == '*')) - { - ptr --; - while ((st[ptr]=='+') || (st[ptr]=='-')|| (st[ptr]=='/')|| (st[ptr]=='*')) - { - posfix[ind2]=st[ptr]; - ind2++; - ptr --; - } - ptr++; - st[ptr]=a; - ptr++; - continue; - } - if(a==')') - { - while ((st[ptr]!= '(') ) - { - posfix[ind2]=st[ptr]; - ind2++; - ptr --; - } - ptr--; - } - } - posfix[ind2]='\0'; -} -#endif /* smyrnaPath: * Construct pathname for smyrna data file. diff --git a/cmd/smyrna/smyrna.vcproj b/cmd/smyrna/smyrna.vcproj index ada34581b..e16fc2110 100644 --- a/cmd/smyrna/smyrna.vcproj +++ b/cmd/smyrna/smyrna.vcproj @@ -325,6 +325,10 @@ RelativePath=".\draw.c" > + + diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index d72463461..a62dea2b5 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -20,7 +20,7 @@ #ifndef NO_WIN_HEADER #include "windows.h" #endif -//#include "gltexfont.h" +#include "xdot.h" //#define SMYRNA_GLADE "C:/Projects/graphviz2/share/gui/smyrna.glade" #define SMYRNA_ATTRS "c:/graphviz-ms/graphviz2/share/gui/attrs.txt" #endif @@ -248,6 +248,7 @@ typedef struct _viewport_camera{ } viewport_camera; + typedef struct { Agnode_t *Node; /*original coordinates */ @@ -288,6 +289,7 @@ typedef struct { RGBColor Color; int update_required; element_data data; + } topview_edge; typedef struct _graph_data { Agrec_t h; @@ -331,6 +333,8 @@ typedef struct { float init_node_size; //raster size of node float init_zoom; float fitin_zoom; + xdot_set* xdot_list;/*xdot attached to whole graph*/ + } topview; diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 07ca46734..eddee0d72 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -32,6 +32,7 @@ #include "hier.h" #include "arith.h" #include "topfisheyeview.h" +#include "beacon.h" #ifdef WIN32 #include "regex_win32.h" #else @@ -80,7 +81,8 @@ void cleartopview(topview * t) /*clear nodes */ free (t->Nodes); free (t->Edges); -// free(t); + free_xdotset(t->xdot_list); + } static void init_element_data(element_data* d) { @@ -275,6 +277,57 @@ void settvcolorinfo(Agraph_t* g,topview* t) } +static xdot* parseXdotwithattr(void *p, char *attr) +{ + xdot *xDot; + if ((xDot = parseXDotF(agget(p, attr), OpFns, sizeof(sdot_op)))) + return xDot; + else + return NULL; +} + +static void parseXdotwithattrs(void *e, xdot_set* s) +{ + xdot *xd,*xd2; + int ind; +// xd=parseXdotwithattr(e, "_draw_"); + xd=parseXDotF("e 54 102 27 18 c 9 -#000000ff c 9 -#000020ff ", OpFns, sizeof(sdot_op)); + xd2=parseXdotwithattr(e, "_draw_"); + if (xd2) + { + add_to_xdot_set(s,xd); + for (ind=0;ind < xd->cnt ;ind++) + { + xdot_op *op2,*op3; + op2=&xd->ops[ind]; + op3=&xd2->ops[ind]; + } + } + add_to_xdot_set(s,parseXdotwithattr(e, "_ldraw_")); + add_to_xdot_set(s,parseXdotwithattr(e, "_hdraw_")); + add_to_xdot_set(s,parseXdotwithattr(e, "_tdraw_")); + add_to_xdot_set(s,parseXdotwithattr(e, "_hldraw_")); + add_to_xdot_set(s,parseXdotwithattr(e, "_tldraw_")); +} +void settvxdot(Agraph_t* g,topview* t) +{ + /*look for xdot attributes and parse them if there is any*/ + + topview_node* np; + topview_edge* ep; + int ind; + for (ind=0;ind < t->Nodecount ; ind ++) + { + np=&t->Nodes[ind]; + parseXdotwithattrs(np->Node, t->xdot_list); + } + for (ind=0;ind < t->Edgecount ; ind ++) + { + ep=&t->Edges[ind]; + parseXdotwithattrs(ep->Edge, t->xdot_list); + } +} + void update_topview(Agraph_t * g, topview * t,int init) { @@ -288,11 +341,15 @@ void update_topview(Agraph_t * g, topview * t,int init) vsize = 0.05*sqrt((view->bdxRight - view->bdxLeft)*(view->bdyTop - view->bdyBottom)); t->init_node_size = vsize*2/GetOGLDistance(2)*percent/100.0/sqrt(t->Nodecount); t->init_zoom = view->zoom; + free_xdotset(view->Topview->xdot_list); + t->xdot_list=init_xdot_set(); } settvposinfo(g,t); settvcolorinfo(g,t); set_boundaries(t); set_update_required(t); + settvxdot(view->g[view->activeGraph],view->Topview); + print_xdot_set(view->Topview->xdot_list); btnToolZoomFit_clicked(NULL,NULL); } @@ -705,8 +762,7 @@ void drawTopViewGraph(Agraph_t * g) drawtopviewedges(g); drawtopviewedgelabels(g); enddrawcycle(g); - - + draw_xdot_set(view->Topview->xdot_list); draw_node_hint_boxes(); if ((view->Selection.Active > 0) && (!view->SignalBlock)) { view->Selection.Active = 0; @@ -937,7 +993,6 @@ static int draw_topview_label(topview_node * v, float zdepth) float ddx = 0; float ddy = 0; char* buf; - char bf[256]; if (((v->distorted_x / view->zoom * -1 > view->clipX1) && (v->distorted_x / view->zoom * -1 < view->clipX2) && (v->distorted_y / view->zoom * -1 > view->clipY1) @@ -1827,9 +1882,5 @@ void select_with_regex(char* exp) } } } - - } - - diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index e56f0722e..cd314c698 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -436,6 +436,7 @@ void init_viewport(ViewInfo * view) view->Selection.Anti = 0; view->Topview = GNEW(topview); view->Topview->fs = 0; + view->Topview->xdot_list=NULL; /* init topfish parameters */ view->Topview->parms.level.num_fine_nodes = 10; diff --git a/lib/glcomp/glcomptext.h b/lib/glcomp/glcomptext.h index 31002cf41..785f63709 100644 --- a/lib/glcomp/glcomptext.h +++ b/lib/glcomp/glcomptext.h @@ -11,7 +11,7 @@ * AT&T Research, Florham Park NJ * **********************************************************/ #ifndef GLCOMPTEXT_H -#define GLTEXFONTH_H +#define GLCOMPTEXT_H #include #include diff --git a/lib/glcomp/glutils.c b/lib/glcomp/glutils.c index 6686ec715..544e8f367 100644 --- a/lib/glcomp/glutils.c +++ b/lib/glcomp/glutils.c @@ -179,7 +179,6 @@ void to3D(int x, int y, GLfloat *X, GLfloat *Y,GLfloat *Z) { if ((winZ[idx] > comp) && (winZ[idx] < 1)) comp = winZ[idx]; - printf ("%f\n",winZ[idx]); } gluUnProject(winX,winY, comp,modelview, projection, viewport, &posX, &posY, &posZ); diff --git a/lib/xdot/xdot.c b/lib/xdot/xdot.c index 0e550fa74..61543113e 100755 --- a/lib/xdot/xdot.c +++ b/lib/xdot/xdot.c @@ -311,19 +311,22 @@ parseXDotF (char* s, drawfunc_t fns[], int sz) x->cnt = 0; x->sz = sz; - while ((s = parseOp (&op, s, fns))) { - if (x->cnt == bufsz) { - bufsz += XDBSIZE; - ops = (char*)grealloc (ops, bufsz*sz); - } - *(xdot_op*)(ops + (x->cnt*sz)) = op; - x->cnt++; + while ((s = parseOp (&op, s, fns))) + { + if (x->cnt == bufsz) + { + bufsz += XDBSIZE; + ops = (char*)grealloc (ops, bufsz*sz); + } + *(xdot_op*)(ops + (x->cnt*sz)) = op; + x->cnt++; } if (x->cnt) - x->ops = (xdot_op*)grealloc (ops, x->cnt*sz); - else { - free (x); - x = 0; + x->ops = (xdot_op*)grealloc (ops, x->cnt*sz); + else + { + free (x); + x = 0; } return x; } @@ -626,6 +629,95 @@ freeXDot (xdot* x) free (base); free (x); } +static void fix_capacity(xdot_set* s) +{ + if (s->cnt == s->capacity) + s->capacity=s->capacity + INITIAL_XDOT_CAPACITY; + s->obj=realloc(s->obj,(sizeof(void*))* s->capacity); + s->xdots=realloc (s->xdots,sizeof(xdot*)* s->capacity); +} +void add_to_xdot_set(xdot_set* s,xdot *x) +{ + int ind=0; + if (!x) + return ; + fix_capacity(s); + s->xdots[s->cnt]=x; + for (ind=0;ind < s->xdots[s->cnt]->cnt;ind++) + { + xdot_op* op,*op2,*op3; + op=&(s->xdots[s->cnt]->ops[ind]); + op2=&(x->ops[ind]); + op3=NULL; + + } + s->cnt ++; + +} +void free_xdotset(xdot_set* s) +{ + int idx; + if (!s) + return ; + + for (idx=0;idx < s->cnt ; idx ++) + { + if (s->obj[idx]) + free(s->obj[idx]); + if (s->xdots[idx]) + freeXDot(s->xdots[idx]); + } + free (s); +} + +xdot_set* init_xdot_set() +{ + xdot_set* rv; + rv=malloc(sizeof(xdot_set)); + rv->cnt=0; + rv->capacity=INITIAL_XDOT_CAPACITY; + rv->obj=malloc (sizeof(void*)* INITIAL_XDOT_CAPACITY); + rv->xdots=malloc (sizeof(xdot*)* INITIAL_XDOT_CAPACITY); + rv->obj=NULL; + rv->xdots=NULL; + + return rv; +} +void print_xdot_set(xdot_set* s) +{ + int ind=0; + printf("------------------------------------------\n"); + printf ("# of xdots in set:%d\n",s->cnt); + + for (ind=0;ind < s->cnt ; ind ++) + { + printf ("xdot id: %d count: %d",ind,s->xdots[ind]->cnt); + + } +} + +void draw_xdot_set(xdot_set* s) +{ + int ind=0; + int ind2=0; + for (ind=0;ind < s->cnt ; ind ++) + { + for (ind2=0;ind2 < s->xdots[ind]->cnt ; ind2 ++) + { + xdot_op* op; + op=&s->xdots[ind]->ops[ind2]; + if(op->drawfunc) + op->drawfunc(op,0); + } + } +} + + + + + + + #if 0 static void diff --git a/lib/xdot/xdot.h b/lib/xdot/xdot.h index 9350da8df..c34408f50 100755 --- a/lib/xdot/xdot.h +++ b/lib/xdot/xdot.h @@ -20,6 +20,7 @@ #include #endif #include "cgraph.h" +#define INITIAL_XDOT_CAPACITY 512 typedef enum { xd_left, xd_center, xd_right @@ -95,6 +96,14 @@ typedef struct { int sz; xdot_op* ops; } xdot; +/*xdot collection*/ +typedef struct _xdot_set +{ + int cnt; /*number of xdots*/ + int capacity; + void** obj; /*a pointer to the original object (node edge graph) can be stored here*/ + xdot** xdots; /*xdot collection*/ +}xdot_set; /* ops are indexed by xop_kind */ extern xdot* parseXDotF (char*, drawfunc_t ops[], int sz); @@ -102,4 +111,10 @@ extern xdot* parseXDot (char*); extern char* sprintXDot (xdot*); extern void fprintXDot (FILE*, xdot*); extern void freeXDot (xdot*); +extern void free_xdotset(xdot_set* s); +extern xdot_set* init_xdot_set(); +extern void add_to_xdot_set(xdot_set* s,xdot *x); +extern void print_xdot_set(xdot_set* s); + + #endif