├── .gitignore ├── CMakeLists.txt ├── License.txt ├── README.md ├── examples └── trafficlight │ ├── CMakeLists.txt │ ├── main.cpp │ └── trafficlight.h ├── libcgraphviz ├── .gitignore ├── CMakeLists.txt ├── Readme.md ├── graphviz-2.38.0 │ ├── COPYING │ ├── ast_common.h │ ├── builddate.h │ ├── compat.h │ ├── graphviz_version.h │ ├── lib │ │ ├── cdt │ │ │ ├── README │ │ │ ├── cdt.def │ │ │ ├── cdt.h │ │ │ ├── dtclose.c │ │ │ ├── dtdisc.c │ │ │ ├── dtextract.c │ │ │ ├── dtflatten.c │ │ │ ├── dthash.c │ │ │ ├── dthdr.h │ │ │ ├── dtlist.c │ │ │ ├── dtmethod.c │ │ │ ├── dtopen.c │ │ │ ├── dtrenew.c │ │ │ ├── dtrestore.c │ │ │ ├── dtsize.c │ │ │ ├── dtstat.c │ │ │ ├── dtstrhash.c │ │ │ ├── dttree.c │ │ │ ├── dttreeset.c │ │ │ ├── dtview.c │ │ │ ├── dtwalk.c │ │ │ └── features │ │ │ │ └── common │ │ ├── cgraph │ │ │ ├── agerror.c │ │ │ ├── agxbuf.c │ │ │ ├── agxbuf.h │ │ │ ├── apply.c │ │ │ ├── attr.c │ │ │ ├── cghdr.h │ │ │ ├── cgraph.def │ │ │ ├── cgraph.h │ │ │ ├── cmpnd.c │ │ │ ├── edge.c │ │ │ ├── flatten.c │ │ │ ├── grammar.c │ │ │ ├── grammar.h │ │ │ ├── graph.c │ │ │ ├── id.c │ │ │ ├── imap.c │ │ │ ├── io.c │ │ │ ├── main.c │ │ │ ├── malloc.h │ │ │ ├── mem.c │ │ │ ├── node.c │ │ │ ├── obj.c │ │ │ ├── pend.c │ │ │ ├── rec.c │ │ │ ├── refstr.c │ │ │ ├── scan.c │ │ │ ├── subg.c │ │ │ ├── tester.c │ │ │ ├── utils.c │ │ │ ├── vmstub.h │ │ │ ├── write.c │ │ │ ├── y.tab.c │ │ │ └── y.tab.h │ │ ├── circogen │ │ │ ├── block.c │ │ │ ├── block.h │ │ │ ├── blockpath.c │ │ │ ├── blockpath.h │ │ │ ├── blocktree.c │ │ │ ├── blocktree.h │ │ │ ├── circo.h │ │ │ ├── circpos.c │ │ │ ├── circpos.h │ │ │ ├── circular.c │ │ │ ├── circular.h │ │ │ ├── circularinit.c │ │ │ ├── deglist.c │ │ │ ├── deglist.h │ │ │ ├── edgelist.c │ │ │ ├── edgelist.h │ │ │ ├── nodelist.c │ │ │ ├── nodelist.h │ │ │ ├── nodeset.c │ │ │ └── nodeset.h │ │ ├── common │ │ │ ├── args.c │ │ │ ├── arith.h │ │ │ ├── arrows.c │ │ │ ├── brewer_colors │ │ │ ├── brewer_lib │ │ │ ├── color.h │ │ │ ├── color_lib │ │ │ ├── color_names │ │ │ ├── colorprocs.h │ │ │ ├── colortbl.h │ │ │ ├── colxlate.c │ │ │ ├── const.h │ │ │ ├── ellipse.c │ │ │ ├── emit.c │ │ │ ├── entities.h │ │ │ ├── fontmap.cfg │ │ │ ├── geom.c │ │ │ ├── geom.h │ │ │ ├── geomprocs.h │ │ │ ├── globals.c │ │ │ ├── globals.h │ │ │ ├── htmllex.c │ │ │ ├── htmllex.h │ │ │ ├── htmlparse.c │ │ │ ├── htmlparse.h │ │ │ ├── htmltable.c │ │ │ ├── htmltable.h │ │ │ ├── input.c │ │ │ ├── intset.c │ │ │ ├── intset.h │ │ │ ├── labels.c │ │ │ ├── logic.h │ │ │ ├── macros.h │ │ │ ├── memory.c │ │ │ ├── memory.h │ │ │ ├── ns.c │ │ │ ├── output.c │ │ │ ├── pointset.c │ │ │ ├── pointset.h │ │ │ ├── postproc.c │ │ │ ├── ps_font_equiv.h │ │ │ ├── psusershape.c │ │ │ ├── render.h │ │ │ ├── routespl.c │ │ │ ├── shapes.c │ │ │ ├── splines.c │ │ │ ├── strcasecmp.c │ │ │ ├── strncasecmp.c │ │ │ ├── svgcolor_lib │ │ │ ├── svgcolor_names │ │ │ ├── taper.c │ │ │ ├── textspan.c │ │ │ ├── textspan.h │ │ │ ├── timing.c │ │ │ ├── types.h │ │ │ ├── usershape.h │ │ │ ├── utils.c │ │ │ ├── utils.h │ │ │ ├── y.tab.c │ │ │ └── y.tab.h │ │ ├── dotgen │ │ │ ├── acyclic.c │ │ │ ├── aspect.c │ │ │ ├── aspect.h │ │ │ ├── class1.c │ │ │ ├── class2.c │ │ │ ├── cluster.c │ │ │ ├── compound.c │ │ │ ├── conc.c │ │ │ ├── decomp.c │ │ │ ├── dot.h │ │ │ ├── dotinit.c │ │ │ ├── dotprocs.h │ │ │ ├── dotsplines.c │ │ │ ├── fastgr.c │ │ │ ├── flat.c │ │ │ ├── mincross.c │ │ │ ├── position.c │ │ │ ├── rank.c │ │ │ └── sameport.c │ │ ├── dotgen2 │ │ │ ├── decomp.c │ │ │ ├── dot2.h │ │ │ ├── dot2procs.h │ │ │ ├── dotinit.c │ │ │ ├── groups.c │ │ │ ├── groups.h │ │ │ ├── level.c │ │ │ ├── minc.h │ │ │ ├── minc2.c │ │ │ ├── minc_utils.c │ │ │ └── ns.c │ │ ├── fdpgen │ │ │ ├── clusteredges.c │ │ │ ├── clusteredges.h │ │ │ ├── comp.c │ │ │ ├── comp.h │ │ │ ├── dbg.c │ │ │ ├── dbg.h │ │ │ ├── fdp.h │ │ │ ├── fdpinit.c │ │ │ ├── grid.c │ │ │ ├── grid.h │ │ │ ├── layout.c │ │ │ ├── tlayout.c │ │ │ ├── tlayout.h │ │ │ ├── xlayout.c │ │ │ └── xlayout.h │ │ ├── gvc │ │ │ ├── gvbuffstderr.c │ │ │ ├── gvc.c │ │ │ ├── gvc.h │ │ │ ├── gvcext.h │ │ │ ├── gvcint.h │ │ │ ├── gvcjob.h │ │ │ ├── gvcommon.h │ │ │ ├── gvconfig.c │ │ │ ├── gvconfig.h │ │ │ ├── gvcontext.c │ │ │ ├── gvcproc.h │ │ │ ├── gvdevice.c │ │ │ ├── gvevent.c │ │ │ ├── gvio.h │ │ │ ├── gvjobs.c │ │ │ ├── gvlayout.c │ │ │ ├── gvloadimage.c │ │ │ ├── gvplugin.c │ │ │ ├── gvplugin.h │ │ │ ├── gvplugin_device.h │ │ │ ├── gvplugin_layout.h │ │ │ ├── gvplugin_loadimage.h │ │ │ ├── gvplugin_render.h │ │ │ ├── gvplugin_textlayout.h │ │ │ ├── gvrender.c │ │ │ ├── gvtextlayout.c │ │ │ ├── gvusershape.c │ │ │ ├── regex_win32.c │ │ │ └── regex_win32.h │ │ ├── label │ │ │ ├── index.c │ │ │ ├── index.h │ │ │ ├── node.c │ │ │ ├── node.h │ │ │ ├── nrtmain.c │ │ │ ├── rectangle.c │ │ │ ├── rectangle.h │ │ │ ├── split.q.c │ │ │ ├── split.q.h │ │ │ ├── xlabels.c │ │ │ └── xlabels.h │ │ ├── ortho │ │ │ ├── fPQ.c │ │ │ ├── fPQ.h │ │ │ ├── maze.c │ │ │ ├── maze.h │ │ │ ├── ortho.c │ │ │ ├── ortho.h │ │ │ ├── partition.c │ │ │ ├── partition.h │ │ │ ├── rawgraph.c │ │ │ ├── rawgraph.h │ │ │ ├── sgraph.c │ │ │ ├── sgraph.h │ │ │ ├── structures.h │ │ │ ├── trap.h │ │ │ └── trapezoid.c │ │ ├── pack │ │ │ ├── ccomps.c │ │ │ ├── pack.c │ │ │ ├── pack.h │ │ │ └── ptest.c │ │ ├── pathplan │ │ │ ├── README │ │ │ ├── cvt.c │ │ │ ├── inpoly.c │ │ │ ├── pathgeom.h │ │ │ ├── pathplan.def │ │ │ ├── pathplan.h │ │ │ ├── pathutil.h │ │ │ ├── route.c │ │ │ ├── shortest.c │ │ │ ├── shortestpth.c │ │ │ ├── solvers.c │ │ │ ├── solvers.h │ │ │ ├── tri.h │ │ │ ├── triang.c │ │ │ ├── util.c │ │ │ ├── vis.h │ │ │ ├── visibility.c │ │ │ └── vispath.h │ │ └── xdot │ │ │ ├── xdot.c │ │ │ └── xdot.h │ ├── libltdl │ │ └── libltdl │ │ │ └── lt_system.h │ ├── plugin │ │ ├── core │ │ │ ├── gvloadimage_core.c │ │ │ ├── gvplugin_core.c │ │ │ ├── gvplugin_core.def │ │ │ ├── gvrender_core_dot.c │ │ │ ├── gvrender_core_fig.c │ │ │ ├── gvrender_core_map.c │ │ │ ├── gvrender_core_pic.c │ │ │ ├── gvrender_core_pov.c │ │ │ ├── gvrender_core_ps.c │ │ │ ├── gvrender_core_svg.c │ │ │ ├── gvrender_core_tk.c │ │ │ ├── gvrender_core_vml.c │ │ │ ├── ps.h │ │ │ └── ps.txt │ │ └── dot_layout │ │ │ ├── gvlayout_dot_layout.c │ │ │ └── gvplugin_dot_layout.c │ └── windows │ │ └── config.h ├── libcgraphviz_dot_builtins.c └── linux-gcc │ └── config.h └── statemachineviewer ├── CMakeLists.txt ├── deferredresizemodesetter.cpp ├── deferredresizemodesetter.h ├── deferredtreeviewconfiguration.cpp ├── deferredtreeviewconfiguration.h ├── gammaray_export.h ├── gammaray_statemachineviewer.desktop ├── gammaray_statemachineviewer_ui.desktop ├── gvgraph ├── gvgraph.cpp ├── gvgraph.h ├── gvgraphelements.h ├── gvgraphitems.cpp ├── gvgraphitems.h ├── gvtypes.h ├── gvutils.cpp └── gvutils.h ├── objectmodel.h ├── objectmodelbase.h ├── objecttypefilterproxymodel.h ├── statemachineview.cpp ├── statemachineview.h ├── statemachineviewer.cpp ├── statemachineviewer.h ├── statemachineviewer.ui ├── statemachineviewerclient.cpp ├── statemachineviewerclient.h ├── statemachineviewerinterface.cpp ├── statemachineviewerinterface.h ├── statemachineviewerserver.cpp ├── statemachineviewerserver.h ├── statemachineviewerutil.h ├── statemachineviewerwidget.cpp ├── statemachineviewerwidget.h ├── statemachinewatcher.cpp ├── statemachinewatcher.h ├── statemodel.cpp ├── statemodel.h ├── test_main.cpp ├── transitionmodel.cpp ├── transitionmodel.h └── util.h /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user 2 | 3 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.9) 2 | 3 | project(StateMachineViewer) 4 | 5 | set(CMAKE_EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) 6 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 7 | set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) 8 | 9 | if(qt5) 10 | add_definitions(-DQT5) 11 | macro(use_qt5lib lib) 12 | find_package(${lib} REQUIRED) 13 | include_directories(${${lib}_INCLUDE_DIRS}) 14 | endmacro() 15 | use_qt5lib(Qt5Core) 16 | get_target_property(qmakebin Qt5::qmake IMPORTED_LOCATION) 17 | get_filename_component(QT_BINARY_DIR ${qmakebin} PATH) 18 | message(STATUS "Using Qt5 from ${QT_BINARY_DIR}") 19 | use_qt5lib(Qt5Widgets) 20 | set(qtlibs ${Qt5Widgets_LIBRARIES}) 21 | macro(qt_moc) 22 | qt5_wrap_cpp(${ARGN} OPTIONS "-nw") 23 | endmacro() 24 | macro(qt_uic) 25 | qt5_wrap_ui(${ARGN}) 26 | endmacro() 27 | else() 28 | cmake_policy(SET CMP0020 NEW) # link qtmain 29 | set(QT_USE_IMPORTED_TARGETS true) 30 | find_package(Qt4 ${QT_MIN_VERSION} REQUIRED QtCore QtGui) 31 | include(${QT_USE_FILE}) 32 | set(qtlibs ${QT_QTGUI_LIBRARIES} ${QT_QTCORE_LIBRARIES}) 33 | macro(qt_moc) 34 | qt4_wrap_cpp(${ARGN} OPTIONS "-nw") 35 | endmacro() 36 | macro(qt_uic) 37 | qt4_wrap_ui(${ARGN}) 38 | endmacro() 39 | endif() 40 | 41 | 42 | if(WIN32) 43 | set(LIBCGRAPHVIZ_DLL 1) 44 | else() 45 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 46 | endif() 47 | 48 | set(smvdir ${CMAKE_CURRENT_SOURCE_DIR}/statemachineviewer) 49 | 50 | add_subdirectory(libcgraphviz) 51 | add_subdirectory(statemachineviewer) 52 | add_subdirectory(examples/trafficlight) 53 | 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #StateMachineViewer 2 | 3 | StateMachineViewer is a class to visualize state machines which use Qt's QStateMachine. 4 | 5 | It monitors a running state machine and shows which state is active and through which transition it was entered. 6 | 7 | Images could be saved at different resolutions to disk. 8 | 9 | 10 | ##Usage 11 | 12 | StateMachineViewer is designed to be linked into an existing application. 13 | 14 | Projects using CMake should add this project with 'add_subdirectory()' and link against 'statemachineviewer'. 15 | 16 | Example code: 17 | ``` 18 | #include "statemachineviewer.h" 19 | 20 | StateMachineViewer* showStateMachine(QStateMachine* machine) 21 | { 22 | StateMachineViewer* smv = new StateMachineViewer(); 23 | smv->setStateMachine(machine); 24 | smv->show(); 25 | return smv; 26 | } 27 | ``` 28 | 29 | Also see example/trafficlight. 30 | 31 | ##Thanks 32 | Thx to the GammayRay and Graphviz teams, on whose work StateMachineViewer is based on. 33 | 34 | ##License 35 | License is GPL. 36 | 37 | While developing you could also use StateMachineViewer in closed source projects as long as you don't 38 | link against StateMachineViewer in the final product. 39 | 40 | -------------------------------------------------------------------------------- /examples/trafficlight/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${smvdir}) 3 | 4 | qt_moc(moced trafficlight.h) 5 | add_executable(trafficlight main.cpp trafficlight.h ${moced}) 6 | target_link_libraries(trafficlight statemachineviewer) 7 | -------------------------------------------------------------------------------- /libcgraphviz/.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user 2 | 3 | -------------------------------------------------------------------------------- /libcgraphviz/Readme.md: -------------------------------------------------------------------------------- 1 | libcgraphviz 2 | ------------ 3 | 4 | C-library of Graphviz . 5 | 6 | Simplifies embedding Graphviz's C-libraries into an application which uses CMake as build system. 7 | 8 | Include this repository with add_subdirectory() in your CMake file and use these CMake variables to build and link libcgraphviz: 9 | 10 | LIBCGRAPHVIZ_LIBRARY : library name 11 | LIBCGRAPHVIZ_INCLUDE_DIR : include directories 12 | LIBCGRAPHVIZ_DEFINITIONS : definitions needed when compiling client code 13 | 14 | 15 | Set before calling add_subdirectory() 16 | 17 | LIBCGRAPHVIZ_DLL 18 | 19 | to TRUE when a Dll should be build. 20 | 21 | 22 | Graphviz's version is available via: 23 | 24 | LIBCGRAPHVIZ_MAJOR_VERSION 25 | LIBCGRAPHVIZ_MINOR_VERSION 26 | LIBCGRAPHVIZ_PATCH_VERSION 27 | 28 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/builddate.h: -------------------------------------------------------------------------------- 1 | #define BUILDDATE "20140413.2041" 2 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/compat.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPAT_H 2 | #define COMPAT_H 3 | #ifdef HAVE_CONFIG_H 4 | #include "config.h" 5 | /* 6 | #ifndef HAVE_STRCASECMP 7 | extern int strcasecmp(const char*, const char*); 8 | #endif 9 | #ifndef HAVE_STRNCASECMP 10 | extern int strncasecmp(const char*, const char*, unsigned int); 11 | #endif 12 | */ 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/graphviz_version.h: -------------------------------------------------------------------------------- 1 | #define GVPLUGIN_CONFIG_FILE "config6" 2 | #define GVPLUGIN_VERSION 6 3 | #define PACKAGE_BUGREPORT "http://www.graphviz.org/" 4 | #define PACKAGE_NAME "graphviz" 5 | #define PACKAGE_STRING "graphviz 2.38.0" 6 | #define PACKAGE_TARNAME "graphviz" 7 | #define PACKAGE_URL "" 8 | #define PACKAGE_VERSION "2.38.0" 9 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/README: -------------------------------------------------------------------------------- 1 | DIRECTORY HIERARCHY: 2 | This directory hierarchy contains the source of Cdt, the container data type library. 3 | 4 | .: source code for Cdt functions. 5 | ./features: source code for generating configuration parameters. 6 | ./Cdt_p: source code for emulating the POSIX packages tsearch and hsearch. 7 | ./Cdt_ex: an example program that uses Cdt. 8 | ./Cdt_t: a set of regression tests - executable with "runtest" 9 | 10 | SOFTWARE CONSTRUCTION: 11 | 12 | There are two make files, Makefile for Glenn Fowler's nmake and 13 | makefile for old make. The build procedure is based on the 14 | iffe language for automatic configuration. An iffe interpreter 15 | and its manual pages are included in this code distribution. 16 | See the files in ./features for examples of iffe probes to generate 17 | configuration parameters. 18 | 19 | CORRESPONDENCE: 20 | Comments, etc. should be sent to: 21 | 22 | Phong Vo 23 | AT&T Labs - Research 24 | 180 Park Avenue 25 | Florham Park, NJ 07932 26 | e-mail: kpv@research.att.com 27 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/cdt.def: -------------------------------------------------------------------------------- 1 | LIBRARY "cdt" 2 | 3 | EXPORTS 4 | Dtbag 5 | dtclose 6 | dtdisc 7 | dtextract 8 | dtflatten 9 | Dthash 10 | Dtlist 11 | dtmethod 12 | Dtobag 13 | dtopen 14 | Dtorder 15 | Dtoset 16 | Dtqueue 17 | dtrenew 18 | dtrestore 19 | Dtset 20 | dtsize 21 | Dtstack 22 | dtstat 23 | dtstrhash 24 | Dttree 25 | dtview 26 | dtwalk 27 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtclose.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Close a dictionary 4 | ** 5 | ** Written by Kiem-Phong Vo (05/25/96) 6 | */ 7 | #if __STD_C 8 | int dtclose(reg Dt_t* dt) 9 | #else 10 | int dtclose(dt) 11 | reg Dt_t* dt; 12 | #endif 13 | { 14 | Dtdisc_t *disc; 15 | int ev = 0; 16 | 17 | if(!dt || dt->nview > 0 ) /* can't close if being viewed */ 18 | return -1; 19 | 20 | /* announce the close event to see if we should continue */ 21 | disc = dt->disc; 22 | if(disc->eventf && 23 | (ev = (*disc->eventf)(dt,DT_CLOSE,NIL(Void_t*),disc)) < 0) 24 | return -1; 25 | 26 | if(dt->view) /* turn off viewing */ 27 | dtview(dt,NIL(Dt_t*)); 28 | 29 | if(ev == 0) /* release all allocated data */ 30 | { (void)(*(dt->meth->searchf))(dt,NIL(Void_t*),DT_CLEAR); 31 | if(dtsize(dt) > 0) 32 | return -1; 33 | 34 | if(dt->data->ntab > 0) 35 | (*dt->memoryf)(dt,(Void_t*)dt->data->htab,0,disc); 36 | (*dt->memoryf)(dt,(Void_t*)dt->data,0,disc); 37 | } 38 | 39 | if(dt->type == DT_MALLOC) 40 | free((Void_t*)dt); 41 | else if(ev == 0 && dt->type == DT_MEMORYF) 42 | (*dt->memoryf)(dt, (Void_t*)dt, 0, disc); 43 | 44 | if(disc->eventf) 45 | (void)(*disc->eventf)(dt, DT_ENDCLOSE, NIL(Void_t*), disc); 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtdisc.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Change discipline. 4 | ** dt : dictionary 5 | ** disc : discipline 6 | ** 7 | ** Written by Kiem-Phong Vo (5/26/96) 8 | */ 9 | 10 | #if __STD_C 11 | static Void_t* dtmemory(Dt_t* dt,Void_t* addr,size_t size,Dtdisc_t* disc) 12 | #else 13 | static Void_t* dtmemory(dt, addr, size, disc) 14 | Dt_t* dt; /* dictionary */ 15 | Void_t* addr; /* address to be manipulate */ 16 | size_t size; /* size to obtain */ 17 | Dtdisc_t* disc; /* discipline */ 18 | #endif 19 | { 20 | if(addr) 21 | { if(size == 0) 22 | { free(addr); 23 | return NIL(Void_t*); 24 | } 25 | else return realloc(addr,size); 26 | } 27 | else return size > 0 ? malloc(size) : NIL(Void_t*); 28 | } 29 | 30 | #if __STD_C 31 | Dtdisc_t* dtdisc(Dt_t* dt, Dtdisc_t* disc, int type) 32 | #else 33 | Dtdisc_t* dtdisc(dt,disc,type) 34 | Dt_t* dt; 35 | Dtdisc_t* disc; 36 | int type; 37 | #endif 38 | { 39 | reg Dtsearch_f searchf; 40 | reg Dtlink_t *r, *t; 41 | reg char* k; 42 | reg Dtdisc_t* old; 43 | 44 | if(!(old = dt->disc) ) /* initialization call from dtopen() */ 45 | { dt->disc = disc; 46 | if(!(dt->memoryf = disc->memoryf) ) 47 | dt->memoryf = dtmemory; 48 | return disc; 49 | } 50 | 51 | if(!disc) /* only want to know current discipline */ 52 | return old; 53 | 54 | searchf = dt->meth->searchf; 55 | 56 | UNFLATTEN(dt); 57 | 58 | if(old->eventf && (*old->eventf)(dt,DT_DISC,(Void_t*)disc,old) < 0) 59 | return NIL(Dtdisc_t*); 60 | 61 | dt->disc = disc; 62 | if(!(dt->memoryf = disc->memoryf) ) 63 | dt->memoryf = dtmemory; 64 | 65 | if(dt->data->type&(DT_STACK|DT_QUEUE|DT_LIST)) 66 | goto done; 67 | else if(dt->data->type&DT_BAG) 68 | { if(type&DT_SAMEHASH) 69 | goto done; 70 | else goto dt_renew; 71 | } 72 | else if(dt->data->type&(DT_SET|DT_BAG)) 73 | { if((type&DT_SAMEHASH) && (type&DT_SAMECMP)) 74 | goto done; 75 | else goto dt_renew; 76 | } 77 | else /*if(dt->data->type&(DT_OSET|DT_OBAG))*/ 78 | { if(type&DT_SAMECMP) 79 | goto done; 80 | dt_renew: 81 | r = dtflatten(dt); 82 | dt->data->type &= ~DT_FLATTEN; 83 | dt->data->here = NIL(Dtlink_t*); 84 | dt->data->size = 0; 85 | 86 | if(dt->data->type&(DT_SET|DT_BAG)) 87 | { reg Dtlink_t **s, **ends; 88 | ends = (s = dt->data->htab) + dt->data->ntab; 89 | while(s < ends) 90 | *s++ = NIL(Dtlink_t*); 91 | } 92 | 93 | /* reinsert them */ 94 | while(r) 95 | { t = r->right; 96 | if(!(type&DT_SAMEHASH)) /* new hash value */ 97 | { k = (char*)_DTOBJ(r,disc->link); 98 | k = _DTKEY((Void_t*)k,disc->key,disc->size); 99 | r->hash = _DTHSH(dt,k,disc,disc->size); 100 | } 101 | (void)(*searchf)(dt,(Void_t*)r,DT_RENEW); 102 | r = t; 103 | } 104 | } 105 | 106 | done: 107 | return old; 108 | } 109 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtextract.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Extract objects of a dictionary. 4 | ** 5 | ** Written by Kiem-Phong Vo (5/25/96). 6 | */ 7 | 8 | #if __STD_C 9 | Dtlink_t* dtextract(reg Dt_t* dt) 10 | #else 11 | Dtlink_t* dtextract(dt) 12 | reg Dt_t* dt; 13 | #endif 14 | { 15 | reg Dtlink_t *list, **s, **ends; 16 | 17 | if(dt->data->type&(DT_OSET|DT_OBAG) ) 18 | list = dt->data->here; 19 | else if(dt->data->type&(DT_SET|DT_BAG)) 20 | { list = dtflatten(dt); 21 | for(ends = (s = dt->data->htab) + dt->data->ntab; s < ends; ++s) 22 | *s = NIL(Dtlink_t*); 23 | } 24 | else /*if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE))*/ 25 | { list = dt->data->head; 26 | dt->data->head = NIL(Dtlink_t*); 27 | } 28 | 29 | dt->data->type &= ~DT_FLATTEN; 30 | dt->data->size = 0; 31 | dt->data->here = NIL(Dtlink_t*); 32 | 33 | return list; 34 | } 35 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtflatten.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Flatten a dictionary into a linked list. 4 | ** This may be used when many traversals are likely. 5 | ** 6 | ** Written by Kiem-Phong Vo (5/25/96). 7 | */ 8 | 9 | #if __STD_C 10 | Dtlink_t* dtflatten(Dt_t* dt) 11 | #else 12 | Dtlink_t* dtflatten(dt) 13 | Dt_t* dt; 14 | #endif 15 | { 16 | reg Dtlink_t *t, *r, *list, *last, **s, **ends; 17 | 18 | /* already flattened */ 19 | if(dt->data->type&DT_FLATTEN ) 20 | return dt->data->here; 21 | 22 | list = last = NIL(Dtlink_t*); 23 | if(dt->data->type&(DT_SET|DT_BAG)) 24 | { for(ends = (s = dt->data->htab) + dt->data->ntab; s < ends; ++s) 25 | { if((t = *s) ) 26 | { if(last) 27 | last->right = t; 28 | else list = last = t; 29 | while(last->right) 30 | last = last->right; 31 | *s = last; 32 | } 33 | } 34 | } 35 | else if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE) ) 36 | list = dt->data->head; 37 | else if((r = dt->data->here) ) /*if(dt->data->type&(DT_OSET|DT_OBAG))*/ 38 | { while((t = r->left) ) 39 | RROTATE(r,t); 40 | for(list = last = r, r = r->right; r; last = r, r = r->right) 41 | { if((t = r->left) ) 42 | { do RROTATE(r,t); 43 | while((t = r->left) ); 44 | 45 | last->right = r; 46 | } 47 | } 48 | } 49 | 50 | dt->data->here = list; 51 | dt->data->type |= DT_FLATTEN; 52 | 53 | return list; 54 | } 55 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dthdr.h: -------------------------------------------------------------------------------- 1 | #ifndef _DTHDR_H 2 | #define _DTHDR_H 1 3 | #ifndef _BLD_cdt 4 | #define _BLD_cdt 1 5 | #endif 6 | 7 | /* Internal definitions for libcdt. 8 | ** Written by Kiem-Phong Vo (5/25/96) 9 | */ 10 | 11 | #if defined(_PACKAGE_ast) && defined(USE_AST) 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | #include 18 | 19 | /* short-hand notations */ 20 | #define NIL(t) ((t)0) 21 | #define reg register 22 | #define uint unsigned int 23 | #define left hl._left 24 | #define hash hl._hash 25 | #define htab hh._htab 26 | #define head hh._head 27 | 28 | /* this must be disjoint from DT_METHODS */ 29 | #define DT_FLATTEN 010000 /* dictionary already flattened */ 30 | #define DT_WALK 020000 /* hash table being walked */ 31 | 32 | /* how the Dt_t handle was allocated */ 33 | #define DT_MALLOC 0 34 | #define DT_MEMORYF 1 35 | 36 | /* max search length before splaying */ 37 | #define DT_MINP (sizeof(size_t)*8 - 2) 38 | 39 | /* hash start size and load factor */ 40 | #define HSLOT (256) 41 | #define HRESIZE(n) ((n) << 1) 42 | #define HLOAD(s) ((s) << 1) 43 | #define HINDEX(n,h) ((h)&((n)-1)) 44 | 45 | #define UNFLATTEN(dt) \ 46 | ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NIL(Dtlink_t*)) : 0) 47 | 48 | /* tree rotation/linking functions */ 49 | #define rrotate(x,y) ((x)->left = (y)->right, (y)->right = (x)) 50 | #define lrotate(x,y) ((x)->right = (y)->left, (y)->left = (x)) 51 | #define rlink(r,x) ((r) = (r)->left = (x) ) 52 | #define llink(l,x) ((l) = (l)->right = (x) ) 53 | 54 | #define RROTATE(x,y) (rrotate(x,y), (x) = (y)) 55 | #define LROTATE(x,y) (lrotate(x,y), (x) = (y)) 56 | 57 | #if !_PACKAGE_ast 58 | _BEGIN_EXTERNS_ 59 | extern Void_t* malloc _ARG_((size_t)); 60 | extern Void_t* realloc _ARG_((Void_t*, size_t)); 61 | extern void free _ARG_((Void_t*)); 62 | _END_EXTERNS_ 63 | #endif 64 | 65 | #endif /* _DTHDR_H */ 66 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtmethod.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Change search method. 4 | ** 5 | ** Written by Kiem-Phong Vo (05/25/96) 6 | */ 7 | 8 | #if __STD_C 9 | Dtmethod_t* dtmethod(Dt_t* dt, Dtmethod_t* meth) 10 | #else 11 | Dtmethod_t* dtmethod(dt, meth) 12 | Dt_t* dt; 13 | Dtmethod_t* meth; 14 | #endif 15 | { 16 | reg Dtlink_t *list, *r; 17 | reg Dtdisc_t* disc = dt->disc; 18 | reg Dtmethod_t* oldmeth = dt->meth; 19 | 20 | if(!meth || meth->type == oldmeth->type) 21 | return oldmeth; 22 | 23 | if(disc->eventf && 24 | (*disc->eventf)(dt,DT_METH,(Void_t*)meth,disc) < 0) 25 | return NIL(Dtmethod_t*); 26 | 27 | dt->data->minp = 0; 28 | 29 | /* get the list of elements */ 30 | list = dtflatten(dt); 31 | 32 | if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE) ) 33 | dt->data->head = NIL(Dtlink_t*); 34 | else if(dt->data->type&(DT_SET|DT_BAG) ) 35 | { if(dt->data->ntab > 0) 36 | (*dt->memoryf)(dt,(Void_t*)dt->data->htab,0,disc); 37 | dt->data->ntab = 0; 38 | dt->data->htab = NIL(Dtlink_t**); 39 | } 40 | 41 | dt->data->here = NIL(Dtlink_t*); 42 | dt->data->type = (dt->data->type&~(DT_METHODS|DT_FLATTEN)) | meth->type; 43 | dt->meth = meth; 44 | if(dt->searchf == oldmeth->searchf) 45 | dt->searchf = meth->searchf; 46 | 47 | if(meth->type&(DT_LIST|DT_STACK|DT_QUEUE) ) 48 | { if(!(oldmeth->type&(DT_LIST|DT_STACK|DT_QUEUE)) ) 49 | { if((r = list) ) 50 | { reg Dtlink_t* t; 51 | for(t = r->right; t; r = t, t = t->right ) 52 | t->left = r; 53 | list->left = r; 54 | } 55 | } 56 | dt->data->head = list; 57 | } 58 | else if(meth->type&(DT_OSET|DT_OBAG)) 59 | { dt->data->size = 0; 60 | while(list) 61 | { r = list->right; 62 | (*meth->searchf)(dt,(Void_t*)list,DT_RENEW); 63 | list = r; 64 | } 65 | } 66 | else if(!((meth->type&DT_BAG) && (oldmeth->type&DT_SET)) ) 67 | { int rehash; 68 | if((meth->type&(DT_SET|DT_BAG)) && !(oldmeth->type&(DT_SET|DT_BAG))) 69 | rehash = 1; 70 | else rehash = 0; 71 | 72 | dt->data->size = dt->data->loop = 0; 73 | while(list) 74 | { r = list->right; 75 | if(rehash) 76 | { reg Void_t* key = _DTOBJ(list,disc->link); 77 | key = _DTKEY(key,disc->key,disc->size); 78 | list->hash = _DTHSH(dt,key,disc,disc->size); 79 | } 80 | (void)(*meth->searchf)(dt,(Void_t*)list,DT_RENEW); 81 | list = r; 82 | } 83 | } 84 | 85 | return oldmeth; 86 | } 87 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtopen.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | static char* Version = "\n@(#)$Id$\0\n"; 3 | 4 | /* Make a new dictionary 5 | ** 6 | ** Written by Kiem-Phong Vo (5/25/96) 7 | */ 8 | 9 | #if __STD_C 10 | Dt_t* dtopen(Dtdisc_t* disc, Dtmethod_t* meth) 11 | #else 12 | Dt_t* dtopen(disc, meth) 13 | Dtdisc_t* disc; 14 | Dtmethod_t* meth; 15 | #endif 16 | { 17 | Dt_t* dt = (Dt_t*)Version; /* shut-up unuse warning */ 18 | reg int e; 19 | Dtdata_t* data; 20 | 21 | if(!disc || !meth) 22 | return NIL(Dt_t*); 23 | 24 | /* allocate space for dictionary */ 25 | if(!(dt = (Dt_t*) malloc(sizeof(Dt_t)))) 26 | return NIL(Dt_t*); 27 | 28 | /* initialize all absolutely private data */ 29 | dt->searchf = NIL(Dtsearch_f); 30 | dt->meth = NIL(Dtmethod_t*); 31 | dt->disc = NIL(Dtdisc_t*); 32 | dtdisc(dt,disc,0); 33 | dt->type = DT_MALLOC; 34 | dt->nview = 0; 35 | dt->view = dt->walk = NIL(Dt_t*); 36 | dt->user = NIL(Void_t*); 37 | 38 | if(disc->eventf) 39 | { /* if shared/persistent dictionary, get existing data */ 40 | data = NIL(Dtdata_t*); 41 | if((e = (*disc->eventf)(dt,DT_OPEN,(Void_t*)(&data),disc)) < 0) 42 | goto err_open; 43 | else if(e > 0) 44 | { if(data) 45 | { if(data->type&meth->type) 46 | goto done; 47 | else goto err_open; 48 | } 49 | 50 | if(!disc->memoryf) 51 | goto err_open; 52 | 53 | free((Void_t*)dt); 54 | if(!(dt = (*disc->memoryf)(0, 0, sizeof(Dt_t), disc)) ) 55 | return NIL(Dt_t*); 56 | dt->searchf = NIL(Dtsearch_f); 57 | dt->meth = NIL(Dtmethod_t*); 58 | dt->disc = NIL(Dtdisc_t*); 59 | dtdisc(dt,disc,0); 60 | dt->type = DT_MEMORYF; 61 | dt->nview = 0; 62 | dt->view = dt->walk = NIL(Dt_t*); 63 | } 64 | } 65 | 66 | /* allocate sharable data */ 67 | if(!(data = (Dtdata_t*)(dt->memoryf)(dt,NIL(Void_t*),sizeof(Dtdata_t),disc)) ) 68 | { err_open: 69 | free((Void_t*)dt); 70 | return NIL(Dt_t*); 71 | } 72 | 73 | data->type = meth->type; 74 | data->here = NIL(Dtlink_t*); 75 | data->htab = NIL(Dtlink_t**); 76 | data->ntab = data->size = data->loop = 0; 77 | data->minp = 0; 78 | 79 | done: 80 | dt->data = data; 81 | dt->searchf = meth->searchf; 82 | dt->meth = meth; 83 | 84 | if(disc->eventf) 85 | (*disc->eventf)(dt, DT_ENDOPEN, (Void_t*)dt, disc); 86 | 87 | return dt; 88 | } 89 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtrenew.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | 4 | /* Renew the object at the current finger. 5 | ** 6 | ** Written by Kiem-Phong Vo (5/25/96) 7 | */ 8 | 9 | #if __STD_C 10 | Void_t* dtrenew(Dt_t* dt, reg Void_t* obj) 11 | #else 12 | Void_t* dtrenew(dt, obj) 13 | Dt_t* dt; 14 | reg Void_t* obj; 15 | #endif 16 | { 17 | reg Void_t* key; 18 | reg Dtlink_t *e, *t, **s; 19 | reg Dtdisc_t* disc = dt->disc; 20 | 21 | UNFLATTEN(dt); 22 | 23 | if(!(e = dt->data->here) || _DTOBJ(e,disc->link) != obj) 24 | return NIL(Void_t*); 25 | 26 | if(dt->data->type&(DT_STACK|DT_QUEUE|DT_LIST)) 27 | return obj; 28 | else if(dt->data->type&(DT_OSET|DT_OBAG) ) 29 | { if(!e->right ) /* make left child the new root */ 30 | dt->data->here = e->left; 31 | else /* make right child the new root */ 32 | { dt->data->here = e->right; 33 | 34 | /* merge left subtree to right subtree */ 35 | if(e->left) 36 | { for(t = e->right; t->left; t = t->left) 37 | ; 38 | t->left = e->left; 39 | } 40 | } 41 | } 42 | else /*if(dt->data->type&(DT_SET|DT_BAG))*/ 43 | { s = dt->data->htab + HINDEX(dt->data->ntab,e->hash); 44 | if((t = *s) == e) 45 | *s = e->right; 46 | else 47 | { for(; t->right != e; t = t->right) 48 | ; 49 | t->right = e->right; 50 | } 51 | key = _DTKEY(obj,disc->key,disc->size); 52 | e->hash = _DTHSH(dt,key,disc,disc->size); 53 | dt->data->here = NIL(Dtlink_t*); 54 | } 55 | 56 | dt->data->size -= 1; 57 | return (*dt->meth->searchf)(dt,(Void_t*)e,DT_RENEW) ? obj : NIL(Void_t*); 58 | } 59 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtrestore.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Restore dictionary from given tree or list of elements. 4 | ** There are two cases. If called from within, list is nil. 5 | ** From without, list is not nil and data->size must be 0. 6 | ** 7 | ** Written by Kiem-Phong Vo (5/25/96) 8 | */ 9 | 10 | #if __STD_C 11 | int dtrestore(reg Dt_t* dt, reg Dtlink_t* list) 12 | #else 13 | int dtrestore(dt, list) 14 | reg Dt_t* dt; 15 | reg Dtlink_t* list; 16 | #endif 17 | { 18 | reg Dtlink_t *t, **s, **ends; 19 | reg int type; 20 | reg Dtsearch_f searchf = dt->meth->searchf; 21 | 22 | type = dt->data->type&DT_FLATTEN; 23 | if(!list) /* restoring a flattened dictionary */ 24 | { if(!type) 25 | return -1; 26 | list = dt->data->here; 27 | } 28 | else /* restoring an extracted list of elements */ 29 | { if(dt->data->size != 0) 30 | return -1; 31 | type = 0; 32 | } 33 | dt->data->type &= ~DT_FLATTEN; 34 | 35 | if(dt->data->type&(DT_SET|DT_BAG)) 36 | { dt->data->here = NIL(Dtlink_t*); 37 | if(type) /* restoring a flattened dictionary */ 38 | { for(ends = (s = dt->data->htab) + dt->data->ntab; s < ends; ++s) 39 | { if((t = *s) ) 40 | { *s = list; 41 | list = t->right; 42 | t->right = NIL(Dtlink_t*); 43 | } 44 | } 45 | } 46 | else /* restoring an extracted list of elements */ 47 | { dt->data->size = 0; 48 | while(list) 49 | { t = list->right; 50 | (*searchf)(dt,(Void_t*)list,DT_RENEW); 51 | list = t; 52 | } 53 | } 54 | } 55 | else 56 | { if(dt->data->type&(DT_OSET|DT_OBAG)) 57 | dt->data->here = list; 58 | else /*if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE))*/ 59 | { dt->data->here = NIL(Dtlink_t*); 60 | dt->data->head = list; 61 | } 62 | if(!type) 63 | dt->data->size = -1; 64 | } 65 | 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtsize.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Return the # of objects in the dictionary 4 | ** 5 | ** Written by Kiem-Phong Vo (5/25/96) 6 | */ 7 | 8 | #if __STD_C 9 | static int treecount(reg Dtlink_t* e) 10 | #else 11 | static int treecount(e) 12 | reg Dtlink_t* e; 13 | #endif 14 | { return e ? treecount(e->left) + treecount(e->right) + 1 : 0; 15 | } 16 | 17 | #if __STD_C 18 | int dtsize(Dt_t* dt) 19 | #else 20 | int dtsize(dt) 21 | Dt_t* dt; 22 | #endif 23 | { 24 | reg Dtlink_t* t; 25 | reg int size; 26 | 27 | UNFLATTEN(dt); 28 | 29 | if(dt->data->size < 0) /* !(dt->data->type&(DT_SET|DT_BAG)) */ 30 | { if(dt->data->type&(DT_OSET|DT_OBAG)) 31 | dt->data->size = treecount(dt->data->here); 32 | else if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE)) 33 | { for(size = 0, t = dt->data->head; t; t = t->right) 34 | size += 1; 35 | dt->data->size = size; 36 | } 37 | } 38 | 39 | return dt->data->size; 40 | } 41 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtstat.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Get statistics of a dictionary 4 | ** 5 | ** Written by Kiem-Phong Vo (5/25/96) 6 | */ 7 | 8 | #if __STD_C 9 | static void dttstat(Dtstat_t* ds, Dtlink_t* root, int depth, int* level) 10 | #else 11 | static void dttstat(ds,root,depth,level) 12 | Dtstat_t* ds; 13 | Dtlink_t* root; 14 | int depth; 15 | int* level; 16 | #endif 17 | { 18 | if(root->left) 19 | dttstat(ds,root->left,depth+1,level); 20 | if(root->right) 21 | dttstat(ds,root->right,depth+1,level); 22 | if(depth > ds->dt_n) 23 | ds->dt_n = depth; 24 | if(level) 25 | level[depth] += 1; 26 | } 27 | 28 | #if __STD_C 29 | static void dthstat(reg Dtdata_t* data, Dtstat_t* ds, reg int* count) 30 | #else 31 | static void dthstat(data, ds, count) 32 | reg Dtdata_t* data; 33 | Dtstat_t* ds; 34 | reg int* count; 35 | #endif 36 | { 37 | reg Dtlink_t* t; 38 | reg int n, h; 39 | 40 | for(h = data->ntab-1; h >= 0; --h) 41 | { n = 0; 42 | for(t = data->htab[h]; t; t = t->right) 43 | n += 1; 44 | if(count) 45 | count[n] += 1; 46 | else if(n > 0) 47 | { ds->dt_n += 1; 48 | if(n > ds->dt_max) 49 | ds->dt_max = n; 50 | } 51 | } 52 | } 53 | 54 | #if __STD_C 55 | int dtstat(reg Dt_t* dt, Dtstat_t* ds, int all) 56 | #else 57 | int dtstat(dt, ds, all) 58 | reg Dt_t* dt; 59 | Dtstat_t* ds; 60 | int all; 61 | #endif 62 | { 63 | reg int i; 64 | static int *Count, Size; 65 | 66 | UNFLATTEN(dt); 67 | 68 | ds->dt_n = ds->dt_max = 0; 69 | ds->dt_count = NIL(int*); 70 | ds->dt_size = dtsize(dt); 71 | ds->dt_meth = dt->data->type&DT_METHODS; 72 | 73 | if(!all) 74 | return 0; 75 | 76 | if(dt->data->type&(DT_SET|DT_BAG)) 77 | { dthstat(dt->data,ds,NIL(int*)); 78 | if(ds->dt_max+1 > Size) 79 | { if(Size > 0) 80 | free(Count); 81 | if(!(Count = (int*)malloc((ds->dt_max+1)*sizeof(int))) ) 82 | return -1; 83 | Size = ds->dt_max+1; 84 | } 85 | for(i = ds->dt_max; i >= 0; --i) 86 | Count[i] = 0; 87 | dthstat(dt->data,ds,Count); 88 | } 89 | else if(dt->data->type&(DT_OSET|DT_OBAG)) 90 | { if(dt->data->here) 91 | { dttstat(ds,dt->data->here,0,NIL(int*)); 92 | if(ds->dt_n+1 > Size) 93 | { if(Size > 0) 94 | free(Count); 95 | if(!(Count = (int*)malloc((ds->dt_n+1)*sizeof(int))) ) 96 | return -1; 97 | Size = ds->dt_n+1; 98 | } 99 | 100 | for(i = ds->dt_n; i >= 0; --i) 101 | Count[i] = 0; 102 | dttstat(ds,dt->data->here,0,Count); 103 | for(i = ds->dt_n; i >= 0; --i) 104 | if(Count[i] > ds->dt_max) 105 | ds->dt_max = Count[i]; 106 | } 107 | } 108 | ds->dt_count = Count; 109 | 110 | return 0; 111 | } 112 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtstrhash.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Hashing a string into an unsigned integer. 4 | ** The basic method is to continuingly accumulate bytes and multiply 5 | ** with some given prime. The length n of the string is added last. 6 | ** The recurrent equation is like this: 7 | ** h[k] = (h[k-1] + bytes)*prime for 0 <= k < n 8 | ** h[n] = (h[n-1] + n)*prime 9 | ** The prime is chosen to have a good distribution of 1-bits so that 10 | ** the multiplication will distribute the bits in the accumulator well. 11 | ** The below code accumulates 2 bytes at a time for speed. 12 | ** 13 | ** Written by Kiem-Phong Vo (02/28/03) 14 | */ 15 | 16 | #if __STD_C 17 | uint dtstrhash(reg uint h, Void_t* args, reg int n) 18 | #else 19 | uint dtstrhash(h,args,n) 20 | reg uint h; 21 | Void_t* args; 22 | reg int n; 23 | #endif 24 | { 25 | reg unsigned char* s = (unsigned char*)args; 26 | 27 | if(n <= 0) 28 | { for(; *s != 0; s += s[1] ? 2 : 1) 29 | h = (h + (s[0]<<8) + s[1])*DT_PRIME; 30 | n = s - (unsigned char*)args; 31 | } 32 | else 33 | { reg unsigned char* ends; 34 | for(ends = s+n-1; s < ends; s += 2) 35 | h = (h + (s[0]<<8) + s[1])*DT_PRIME; 36 | if(s <= ends) 37 | h = (h + (s[0]<<8))*DT_PRIME; 38 | } 39 | return (h+n)*DT_PRIME; 40 | } 41 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dttreeset.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Set attributes of a tree. 4 | ** 5 | ** Written by Kiem-Phong Vo (09/17/2001) 6 | */ 7 | 8 | #if __STD_C 9 | static Dtlink_t* treebalance(Dtlink_t* list, int size) 10 | #else 11 | static Dtlink_t* treebalance(list, size) 12 | Dtlink_t* list; 13 | int size; 14 | #endif 15 | { 16 | int n; 17 | Dtlink_t *l, *mid; 18 | 19 | if(size <= 2) 20 | return list; 21 | 22 | for(l = list, n = size/2 - 1; n > 0; n -= 1) 23 | l = l->right; 24 | 25 | mid = l->right; l->right = NIL(Dtlink_t*); 26 | mid->left = treebalance(list, (n = size/2) ); 27 | mid->right = treebalance(mid->right, size - (n + 1)); 28 | return mid; 29 | } 30 | 31 | #if __STD_C 32 | int dttreeset(Dt_t* dt, int minp, int balance) 33 | #else 34 | int dttreeset(dt, minp, balance) 35 | Dt_t* dt; 36 | int minp; 37 | int balance; 38 | #endif 39 | { 40 | int size; 41 | 42 | if(dt->meth->type != DT_OSET) 43 | return -1; 44 | 45 | size = dtsize(dt); 46 | 47 | if(minp < 0) 48 | { for(minp = 0; minp < DT_MINP; ++minp) 49 | if((1 << minp) >= size) 50 | break; 51 | if(minp <= DT_MINP-4) /* use log(size) + 4 */ 52 | minp += 4; 53 | } 54 | 55 | if((dt->data->minp = minp + (minp%2)) > DT_MINP) 56 | dt->data->minp = DT_MINP; 57 | 58 | if(balance) 59 | dt->data->here = treebalance(dtflatten(dt), size); 60 | 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cdt/dtwalk.c: -------------------------------------------------------------------------------- 1 | #include "dthdr.h" 2 | 3 | /* Walk a dictionary and all dictionaries viewed through it. 4 | ** userf: user function 5 | ** 6 | ** Written by Kiem-Phong Vo (5/25/96) 7 | */ 8 | 9 | #if __STD_C 10 | int dtwalk(reg Dt_t* dt, int (*userf)(Dt_t*, Void_t*, Void_t*), Void_t* data) 11 | #else 12 | int dtwalk(dt,userf,data) 13 | reg Dt_t* dt; 14 | int(* userf)(); 15 | Void_t* data; 16 | #endif 17 | { 18 | reg Void_t *obj, *next; 19 | reg Dt_t* walk; 20 | reg int rv; 21 | 22 | for(obj = dtfirst(dt); obj; ) 23 | { if(!(walk = dt->walk) ) 24 | walk = dt; 25 | next = dtnext(dt,obj); 26 | if((rv = (*userf)(walk, obj, data )) < 0) 27 | return rv; 28 | obj = next; 29 | } 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/apply.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #include 15 | 16 | /* The following functions take a graph and a template (node/edge/graph) 17 | * and return the object representing the template within the local graph. 18 | */ 19 | static Agobj_t *subnode_search(Agraph_t * sub, Agobj_t * n) 20 | { 21 | if (agraphof(n) == sub) 22 | return n; 23 | return (Agobj_t *) agsubnode(sub, (Agnode_t *) n, FALSE); 24 | } 25 | 26 | static Agobj_t *subedge_search(Agraph_t * sub, Agobj_t * e) 27 | { 28 | if (agraphof(e) == sub) 29 | return e; 30 | return (Agobj_t *) agsubedge(sub, (Agedge_t *) e, FALSE); 31 | } 32 | 33 | static Agobj_t *subgraph_search(Agraph_t * sub, Agobj_t * g) 34 | { 35 | NOTUSED(g); 36 | return (Agobj_t *) sub; 37 | } 38 | 39 | /* recursively apply objfn within the hierarchy of a graph. 40 | * if obj is a node or edge, it and its images in every subg are visited. 41 | * if obj is a graph, then it and its subgs are visited. 42 | */ 43 | static void rec_apply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg, 44 | agobjsearchfn_t objsearch, int preorder) 45 | { 46 | Agraph_t *sub; 47 | Agobj_t *subobj; 48 | 49 | if (preorder) 50 | fn(g, obj, arg); 51 | for (sub = agfstsubg(g); sub; sub = agnxtsubg(sub)) { 52 | if ((subobj = objsearch(sub, obj))) 53 | rec_apply(sub, subobj, fn, arg, objsearch, preorder); 54 | } 55 | if (NOT(preorder)) 56 | fn(g, obj, arg); 57 | } 58 | 59 | /* external entry point (this seems to be one of those ineffective 60 | * comments censured in books on programming style) */ 61 | int agapply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg, 62 | int preorder) 63 | { 64 | Agobj_t *subobj; 65 | 66 | agobjsearchfn_t objsearch; 67 | switch (AGTYPE(obj)) { 68 | case AGRAPH: 69 | objsearch = subgraph_search; 70 | break; 71 | case AGNODE: 72 | objsearch = subnode_search; 73 | break; 74 | case AGOUTEDGE: 75 | case AGINEDGE: 76 | objsearch = subedge_search; 77 | break; 78 | default: 79 | agerr(AGERR, "agapply: unknown object type %d\n", AGTYPE(obj)); 80 | return FAILURE; 81 | break; 82 | } 83 | if ((subobj = objsearch(g, obj))) { 84 | rec_apply(g, subobj, fn, arg, objsearch, preorder); 85 | return SUCCESS; 86 | } else 87 | return FAILURE; 88 | } 89 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/cgraph.def: -------------------------------------------------------------------------------- 1 | LIBRARY "cgraph" 2 | EXPORTS 3 | Ag_G_global 4 | Ag_mainedge_id_disc 5 | Ag_mainedge_seq_disc 6 | Ag_subedge_id_disc 7 | Ag_subedge_seq_disc 8 | Ag_subgraph_id_disc 9 | Ag_subnode_id_disc 10 | Ag_subnode_seq_disc 11 | agalloc 12 | agallocid 13 | agapply 14 | agattr 15 | agattrrec 16 | agattrsym 17 | agbindrec 18 | agcallbacks 19 | agcanonStr 20 | agclean 21 | agclose 22 | agcopyattr 23 | agdatadict 24 | AgDataDictDisc 25 | AgDataRecName 26 | AgDefaultDisc 27 | agdegree 28 | agdelcb 29 | agdeledge 30 | agdeledgeimage 31 | agdelete 32 | agdelnode 33 | agdelnodeimage 34 | agdelrec 35 | agdelsubg 36 | agdictobjfree 37 | agdictobjmem 38 | agdictof 39 | agdictsym 40 | Agdirected 41 | agdtclose 42 | agdtdelete 43 | agdtdisc 44 | agdtopen 45 | agedge 46 | agedgeattr_delete 47 | agedgeattr_init 48 | agedgeidcmpf 49 | agedgeseqcmpf 50 | agerr 51 | agerrorf 52 | agerrors 53 | agfindnode_by_id 54 | agfindnode_by_name 55 | agflatten 56 | agflatten_edges 57 | agfree 58 | agfreeid 59 | agfstedge 60 | agfstin 61 | agfstnode 62 | agfstout 63 | agfstsubg 64 | agget 65 | aggetrec 66 | aggetuserptr 67 | aghead 68 | agheap 69 | aghtmlstr 70 | AgIdDisc 71 | agidedge 72 | agidnode 73 | agidsubg 74 | aginit 75 | aginitcb 76 | aginternalmapclearlocalnames 77 | aginternalmapclose 78 | aginternalmapdelete 79 | aginternalmapinsert 80 | aginternalmaplookup 81 | aginternalmapprint 82 | AgIoDisc 83 | agisdirected 84 | agisstrict 85 | agisundirected 86 | aglasterr 87 | aglocaldictsym 88 | aglstnode 89 | agmapnametoid 90 | AgMemDisc 91 | agmethod_delete 92 | agmethod_init 93 | agmethod_upd 94 | agnameof 95 | agnedges 96 | agnewsym 97 | agnextseq 98 | agnnodes 99 | agnode 100 | agnodeattr_delete 101 | agnodeattr_init 102 | agnotflat 103 | agnxtattr 104 | agnxtedge 105 | agnxtin 106 | agnxtnode 107 | agnxtout 108 | agnxtsubg 109 | agobjfinalize 110 | agobjkind 111 | agopen 112 | agopen1 113 | agopp 114 | agparent 115 | agpopdisc 116 | agprvnode 117 | agpushdisc 118 | agraphattr_delete 119 | agraphattr_init 120 | agraphidcmpf 121 | agraphof 122 | agraphseqcmpf 123 | AgraphVersion 124 | agrealloc 125 | agrecclose 126 | agrecord_callback 127 | agrelabel_node 128 | agrename 129 | agroot 130 | agsafeset 131 | agset 132 | agseterr 133 | agstrbind 134 | agstrcanon 135 | agstrclose 136 | agstrdup 137 | agstrdup_html 138 | agstrfree 139 | Agstrictdirected 140 | Agstrictundirected 141 | agsubedge 142 | agsubg 143 | agsubnode 144 | agsubnodeidcmpf 145 | agsubnodeseqcmpf 146 | agsubrep 147 | agtail 148 | Agundirected 149 | agupdcb 150 | agwarningf 151 | agwrite 152 | agxbfree 153 | agxbinit 154 | agxbmore 155 | agxbpop 156 | agxbput 157 | agxbput_n 158 | agxget 159 | agxset 160 | node_in_subg 161 | agread 162 | agmemread 163 | agsetfile 164 | agcontains 165 | agreseterrors 166 | agseterrf 167 | 168 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/flatten.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #include "cghdr.h" 15 | 16 | static void agflatten_elist(Dict_t * d, Dtlink_t ** lptr, int flag) 17 | { 18 | dtrestore(d, *lptr); 19 | dtmethod(d, flag? Dtlist : Dtoset); 20 | *lptr = dtextract(d); 21 | } 22 | 23 | void agflatten_edges(Agraph_t * g, Agnode_t * n, int flag) 24 | { 25 | Agsubnode_t *sn; 26 | Dtlink_t **tmp; 27 | 28 | sn = agsubrep(g,n); 29 | tmp = &(sn->out_seq); /* avoiding - "dereferencing type-punned pointer will break strict-aliasing rules" */ 30 | agflatten_elist(g->e_seq, tmp, flag); 31 | tmp = &(sn->in_seq); 32 | agflatten_elist(g->e_seq, tmp, flag); 33 | } 34 | 35 | void agflatten(Agraph_t * g, int flag) 36 | { 37 | Agnode_t *n; 38 | 39 | if (flag) { 40 | if (g->desc.flatlock == FALSE) { 41 | dtmethod(g->n_seq,Dtlist); 42 | for (n = agfstnode(g); n; n = agnxtnode(g,n)) 43 | agflatten_edges(g, n, flag); 44 | g->desc.flatlock = TRUE; 45 | } 46 | } else { 47 | if (g->desc.flatlock) { 48 | dtmethod(g->n_seq,Dtoset); 49 | for (n = agfstnode(g); n; n = agnxtnode(g,n)) 50 | agflatten_edges(g, n, flag); 51 | g->desc.flatlock = FALSE; 52 | } 53 | } 54 | } 55 | 56 | void agnotflat(Agraph_t * g) 57 | { 58 | if (g->desc.flatlock) 59 | agerr(AGERR, "flat lock broken"); 60 | } 61 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/main.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #include 15 | #include 16 | 17 | static void prstats(Agraph_t * g, int verbose); 18 | static void do_it(Agraph_t * g, int dostat); 19 | 20 | 21 | static void my_ins(Agraph_t * g, Agobj_t * obj, void *context) 22 | { 23 | Agnode_t *n; 24 | 25 | if (AGTYPE(obj) == AGNODE) { 26 | n = (Agnode_t *) obj; 27 | fprintf(stderr, "%s initialized with label %s\n", agnameof(n), 28 | agget(n, "label")); 29 | } 30 | } 31 | 32 | static Agcbdisc_t mydisc = { {0, 0, 0}, {my_ins, 0, 0}, {0, 0, 0} }; 33 | 34 | main(int argc, char **argv) 35 | { 36 | Agraph_t *g, *prev; 37 | int dostat; 38 | 39 | if (argc > 1) 40 | dostat = atoi(argv[1]); 41 | else 42 | dostat = 0; 43 | 44 | prev = agopen("some_name", Agdirected, NIL(Agdisc_t *)); 45 | agcallbacks(prev, FALSE); 46 | agpushdisc(prev, &mydisc, NIL(void *)); 47 | while (g = agconcat(prev, stdin, NIL(Agdisc_t *))) { 48 | /*do_it(g, dostat); */ 49 | } 50 | /*agwrite(prev,stdout); */ 51 | fprintf(stderr, "ready to go, computer fans\n"); 52 | agcallbacks(prev, TRUE); 53 | agclose(prev); 54 | return 1; 55 | } 56 | 57 | static void prstats(Agraph_t * g, int verbose) 58 | { 59 | #ifdef HAVE_VMALLOC 60 | Vmstat_t ss, *s; 61 | vmstat(g->cmn->heap, &ss); 62 | s = &ss; 63 | if (verbose) 64 | fprintf(stderr, 65 | "n_busy %d n_free %d s_busy %d s_free %d m_busy %d m_free %d n_seg %d extent %d\n", 66 | s->n_busy, s->n_free, s->s_busy, s->s_free, s->m_busy, 67 | s->m_free, s->n_seg, s->extent); 68 | else 69 | fprintf(stderr, "%d (%d,%d)\n", s->extent, s->s_busy, s->s_free); 70 | #endif 71 | } 72 | 73 | static void do_it(Agraph_t * g, int dostat) 74 | { 75 | agwrite(g, stdout); 76 | if (dostat) 77 | prstats(g, dostat > 1); 78 | } 79 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/malloc.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* This defeats the that yacc generated code includes */ 15 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/subg.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #include 15 | 16 | static Agraph_t *agfindsubg_by_id(Agraph_t * g, unsigned long id) 17 | { 18 | Agraph_t template; 19 | 20 | agdtdisc(g, g->g_dict, &Ag_subgraph_id_disc); 21 | AGID(&template) = id; 22 | return (Agraph_t *) dtsearch(g->g_dict, &template); 23 | } 24 | 25 | static Agraph_t *localsubg(Agraph_t * g, unsigned long id) 26 | { 27 | Agraph_t *subg; 28 | 29 | subg = agfindsubg_by_id(g, id); 30 | if (subg) 31 | return subg; 32 | 33 | subg = agalloc(g, sizeof(Agraph_t)); 34 | subg->clos = g->clos; 35 | subg->desc = g->desc; 36 | subg->desc.maingraph = FALSE; 37 | subg->parent = g; 38 | subg->root = g->root; 39 | AGID(subg) = id; 40 | return agopen1(subg); 41 | } 42 | 43 | Agraph_t *agidsubg(Agraph_t * g, unsigned long id, int cflag) 44 | { 45 | Agraph_t *subg; 46 | subg = agfindsubg_by_id(g, id); 47 | if ((subg == NILgraph) && cflag && agallocid(g, AGRAPH, id)) 48 | subg = localsubg(g, id); 49 | return subg; 50 | } 51 | 52 | Agraph_t *agsubg(Agraph_t * g, char *name, int cflag) 53 | { 54 | unsigned long id; 55 | Agraph_t *subg; 56 | 57 | if (name && agmapnametoid(g, AGRAPH, name, &id, FALSE)) { 58 | /* might already exist */ 59 | if ((subg = agfindsubg_by_id(g, id))) 60 | return subg; 61 | } 62 | 63 | if (cflag && agmapnametoid(g, AGRAPH, name, &id, TRUE)) { /* reserve id */ 64 | subg = localsubg(g, id); 65 | agregister(g, AGRAPH, subg); 66 | return subg; 67 | } 68 | 69 | return NILgraph; 70 | } 71 | 72 | Agraph_t *agfstsubg(Agraph_t * g) 73 | { 74 | return (Agraph_t *) dtfirst(g->g_dict); 75 | } 76 | 77 | Agraph_t *agnxtsubg(Agraph_t * subg) 78 | { 79 | Agraph_t *g; 80 | 81 | g = agparent(subg); 82 | return g? (Agraph_t *) dtnext(g->g_dict, subg) : 0; 83 | } 84 | 85 | Agraph_t *agparent(Agraph_t * g) 86 | { 87 | return g->parent; 88 | } 89 | 90 | /* this function is only responsible for deleting the entry 91 | * in the parent's subg dict. the rest is done in agclose(). 92 | */ 93 | long agdelsubg(Agraph_t * g, Agraph_t * subg) 94 | { 95 | return (long) dtdelete(g->g_dict, subg); 96 | } 97 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/tester.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #include 15 | #include 16 | #include 17 | #include "cgraph.h" 18 | 19 | #define NILgraph NIL(Agraph_t*) 20 | #define NILnode NIL(Agnode_t*) 21 | #define NILedge NIL(Agedge_t*) 22 | #define NILsym NIL(Agsym_t*) 23 | #define NILstr NIL(char*) 24 | 25 | main() 26 | { 27 | Agraph_t *g; 28 | Agnode_t *n; 29 | Agedge_t *e; 30 | Agsym_t *sym; 31 | char *val; 32 | 33 | while (g = agread(stdin, NIL(Agdisc_t *))) { 34 | #ifdef NOTDEF 35 | for (n = agfstnode(g); n; n = agnxtnode(g, n)) { 36 | fprintf(stderr, "%s\n", agnameof(n)); 37 | for (sym = agnxtattr(g, AGNODE, 0); sym; 38 | sym = agnxtattr(g, AGNODE, sym)) { 39 | val = agxget(n, sym); 40 | fprintf(stderr, "\t%s=%s\n", sym->name, val); 41 | } 42 | } 43 | #endif 44 | sym = agattr(g, AGRAPH, "nonsense", "junk"); 45 | fprintf(stderr,"sym = %x, %s\n", sym, sym? sym->defval : "(none)"); 46 | agwrite(g, stdout); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/utils.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #include 15 | 16 | static Agraph_t *Ag_dictop_G; 17 | 18 | /* only indirect call through dtopen() is expected */ 19 | void *agdictobjmem(Dict_t * dict, Void_t * p, size_t size, Dtdisc_t * disc) 20 | { 21 | Agraph_t *g; 22 | 23 | NOTUSED(dict); 24 | NOTUSED(disc); 25 | g = Ag_dictop_G; 26 | if (g) { 27 | if (p) 28 | agfree(g, p); 29 | else 30 | return agalloc(g, size); 31 | } else { 32 | if (p) 33 | free(p); 34 | else 35 | return malloc(size); 36 | } 37 | return NIL(void *); 38 | } 39 | 40 | void agdictobjfree(Dict_t * dict, Void_t * p, Dtdisc_t * disc) 41 | { 42 | Agraph_t *g; 43 | 44 | NOTUSED(dict); 45 | NOTUSED(disc); 46 | g = Ag_dictop_G; 47 | if (g) 48 | agfree(g, p); 49 | else 50 | free(p); 51 | } 52 | 53 | Dict_t *agdtopen(Agraph_t * g, Dtdisc_t * disc, Dtmethod_t * method) 54 | { 55 | Dtmemory_f memf; 56 | Dict_t *d; 57 | 58 | memf = disc->memoryf; 59 | disc->memoryf = agdictobjmem; 60 | Ag_dictop_G = g; 61 | d = dtopen(disc, method); 62 | disc->memoryf = memf; 63 | Ag_dictop_G = NIL(Agraph_t*); 64 | return d; 65 | } 66 | 67 | long agdtdelete(Agraph_t * g, Dict_t * dict, void *obj) 68 | { 69 | Ag_dictop_G = g; 70 | return (long) dtdelete(dict, obj); 71 | } 72 | 73 | int agobjfinalize(Void_t * obj) 74 | { 75 | agfree(Ag_dictop_G, obj); 76 | return 0; 77 | } 78 | 79 | int agdtclose(Agraph_t * g, Dict_t * dict) 80 | { 81 | Dtmemory_f memf; 82 | Dtdisc_t *disc; 83 | 84 | disc = dtdisc(dict, NIL(Dtdisc_t *), 0); 85 | memf = disc->memoryf; 86 | disc->memoryf = agdictobjmem; 87 | Ag_dictop_G = g; 88 | if (dtclose(dict)) 89 | return 1; 90 | disc->memoryf = memf; 91 | Ag_dictop_G = NIL(Agraph_t*); 92 | return 0; 93 | } 94 | 95 | void agdtdisc(Agraph_t * g, Dict_t * dict, Dtdisc_t * disc) 96 | { 97 | if (disc && (dtdisc(dict, NIL(Dtdisc_t *), 0) != disc)) { 98 | dtdisc(dict, disc, 0); 99 | } 100 | /* else unchanged, disc is same as old disc */ 101 | } 102 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/cgraph/vmstub.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef _VMSTUB_H 15 | #define _VMSTUB_H 16 | #include 17 | #ifdef HAVE_MALLOC_H 18 | #include 19 | #endif 20 | typedef void Vmalloc_t; 21 | #define vmalloc(heap,size) malloc(size) 22 | #define vmopen(x,y,z) (Vmalloc_t*)(0) 23 | #define vmclose(x) while (0) 24 | #define vmresize(heap,ptr,size,oktomoveflag) realloc((ptr),(size)) 25 | #define vmfree(heap,ptr) free(ptr) 26 | #ifndef EXTERN 27 | #define EXTERN extern 28 | #endif 29 | EXTERN void *Vmregion; 30 | #endif 31 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/block.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | #include 16 | 17 | #include "circular.h" 18 | #include "block.h" 19 | 20 | void initBlocklist(blocklist_t * bl) 21 | { 22 | bl->first = NULL; 23 | bl->last = NULL; 24 | } 25 | 26 | /* 27 | void 28 | cleanBlocklist(blocklist_t* sp) 29 | { 30 | block_t* bp; 31 | block_t* temp; 32 | 33 | if (!sp) return; 34 | for(bp = sp->first; bp; bp = temp) { 35 | temp = bp->next; 36 | freeBlock(bp); 37 | } 38 | } 39 | */ 40 | 41 | block_t *mkBlock(Agraph_t * g) 42 | { 43 | block_t *sn; 44 | 45 | sn = NEW(block_t); 46 | initBlocklist(&sn->children); 47 | sn->sub_graph = g; 48 | return sn; 49 | } 50 | 51 | void freeBlock(block_t * sp) 52 | { 53 | if (!sp) 54 | return; 55 | freeNodelist(sp->circle_list); 56 | free(sp); 57 | } 58 | 59 | int blockSize(block_t * sp) 60 | { 61 | return agnnodes (sp->sub_graph); 62 | } 63 | 64 | /* appendBlock: 65 | * add block at end 66 | */ 67 | void appendBlock(blocklist_t * bl, block_t * bp) 68 | { 69 | bp->next = NULL; 70 | if (bl->last) { 71 | bl->last->next = bp; 72 | bl->last = bp; 73 | } else { 74 | bl->first = bp; 75 | bl->last = bp; 76 | } 77 | } 78 | 79 | /* insertBlock: 80 | * add block at beginning 81 | */ 82 | void insertBlock(blocklist_t * bl, block_t * bp) 83 | { 84 | if (bl->first) { 85 | bp->next = bl->first; 86 | bl->first = bp; 87 | } else { 88 | bl->first = bp; 89 | bl->last = bp; 90 | } 91 | } 92 | 93 | #ifdef DEBUG 94 | void printBlocklist(blocklist_t * snl) 95 | { 96 | block_t *bp; 97 | for (bp = snl->first; bp; bp = bp->next) { 98 | Agnode_t *n; 99 | char *p; 100 | Agraph_t *g = bp->sub_graph; 101 | fprintf(stderr, "block=%s\n", agnameof(g)); 102 | for (n = agfstnode(g); n; n = agnxtnode(g, n)) { 103 | Agedge_t *e; 104 | if (PARENT(n)) 105 | p = agnameof(PARENT(n)); 106 | else 107 | p = ""; 108 | fprintf(stderr, " %s (%d %s)\n", agnameof(n), VAL(n), p); 109 | for (e = agfstedge(g, n); e; e = agnxtedge(g, e, n)) { 110 | fprintf(stderr, " %s--", agnameof(agtail(e))); 111 | fprintf(stderr, "%s\n", agnameof(aghead(e))); 112 | } 113 | } 114 | } 115 | } 116 | #endif 117 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/block.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef BLOCK_H 19 | #define BLOCK_H 20 | 21 | #include 22 | 23 | typedef struct block block_t; 24 | 25 | typedef struct { 26 | block_t *first; 27 | block_t *last; 28 | } blocklist_t; 29 | 30 | struct block { 31 | Agnode_t *child; /* if non-null, points to node in parent block */ 32 | block_t *next; /* sibling block */ 33 | Agraph_t *sub_graph; /* nodes and edges in this block */ 34 | double radius; /* radius of block and subblocks */ 35 | double rad0; /* radius of block */ 36 | nodelist_t *circle_list; /* ordered list of nodes in block */ 37 | blocklist_t children; /* child blocks */ 38 | double parent_pos; /* if block has 1 node, angle to place parent */ 39 | int flags; 40 | }; 41 | 42 | extern block_t *mkBlock(Agraph_t *); 43 | extern void freeBlock(block_t * sp); 44 | extern int blockSize(block_t * sp); 45 | 46 | extern void initBlocklist(blocklist_t *); 47 | extern void appendBlock(blocklist_t * sp, block_t * sn); 48 | extern void insertBlock(blocklist_t * sp, block_t * sn); 49 | /* extern void freeBlocklist (blocklist_t* sp); */ 50 | 51 | #ifdef DEBUG 52 | extern void printBlocklist(blocklist_t * snl); 53 | #endif 54 | 55 | #define CHILD(b) ((b)->child) 56 | #define BLK_PARENT(b) (CHILD(b)? PARENT(CHILD(b)) : 0) 57 | #define BLK_FLAGS(b) ((b)->flags) 58 | 59 | #define COALESCED_F (1 << 0) 60 | #define COALESCED(b) (BLK_FLAGS(b)&COALESCED_F) 61 | #define SET_COALESCED(b) (BLK_FLAGS(b) |= COALESCED_F) 62 | 63 | #endif 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/blockpath.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef BLOCKPATH_H 19 | #define BLOCKPATH_H 20 | 21 | #include 22 | 23 | extern nodelist_t *layout_block(Agraph_t * g, block_t * sn, double); 24 | extern int cmpNodeDegree(Dt_t *, Agnode_t **, Agnode_t **, Dtdisc_t *); 25 | 26 | #ifdef DEBUG 27 | extern void prTree(Agraph_t * g); 28 | #endif 29 | 30 | #endif 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/blocktree.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef BLOCKTREE_H 19 | #define BLOCKTREE_H 20 | 21 | #include 22 | #include 23 | 24 | extern block_t *createBlocktree(Agraph_t * g, circ_state * state); 25 | extern void freeBlocktree(block_t *); 26 | #ifdef DEBUG 27 | extern void print_blocktree(block_t * sn, int depth); 28 | #endif 29 | 30 | #endif 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/circo.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef CIRCO_H 15 | #define CIRCO_H 16 | 17 | #include "render.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | extern void circo_layout(Agraph_t * g); 24 | extern void circoLayout(Agraph_t * g); 25 | extern void circo_cleanup(Agraph_t * g); 26 | extern void circo_init_graph(graph_t * g); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif 32 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/circpos.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef CIRCPOS_H 19 | #define CIRCPOS_H 20 | 21 | #include 22 | #include 23 | 24 | extern void circPos(Agraph_t * g, block_t * sn, circ_state *); 25 | 26 | #endif 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/deglist.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef DEGLIST_H 19 | #define DEGLIST_H 20 | 21 | /* List of nodes sorted by increasing degree */ 22 | 23 | #include 24 | 25 | typedef Dt_t deglist_t; 26 | 27 | extern deglist_t *mkDeglist(void); 28 | extern void freeDeglist(deglist_t * list); 29 | extern void insertDeglist(deglist_t * list, Agnode_t * n); 30 | extern void removeDeglist(deglist_t * list, Agnode_t * n); 31 | extern Agnode_t *firstDeglist(deglist_t *); 32 | 33 | #ifdef DEBUG 34 | extern void printDeglist(deglist_t *); 35 | #endif 36 | 37 | #endif 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/edgelist.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | #include "edgelist.h" 16 | #include 17 | 18 | static edgelistitem *mkItem(Dt_t * d, edgelistitem * obj, Dtdisc_t * disc) 19 | { 20 | edgelistitem *ap = GNEW(edgelistitem); 21 | 22 | ap->edge = obj->edge; 23 | return ap; 24 | } 25 | 26 | static void freeItem(Dt_t * d, edgelistitem * obj, Dtdisc_t * disc) 27 | { 28 | free(obj); 29 | } 30 | 31 | static int 32 | cmpItem(Dt_t * d, Agedge_t ** key1, Agedge_t ** key2, Dtdisc_t * disc) 33 | { 34 | if (*key1 > *key2) 35 | return 1; 36 | else if (*key1 < *key2) 37 | return -1; 38 | else 39 | return 0; 40 | } 41 | 42 | static Dtdisc_t ELDisc = { 43 | offsetof(edgelistitem, edge), /* key */ 44 | sizeof(Agedge_t *), /* size */ 45 | offsetof(edgelistitem, link), /* link */ 46 | (Dtmake_f) mkItem, 47 | (Dtfree_f) freeItem, 48 | (Dtcompar_f) cmpItem, 49 | (Dthash_f) 0, 50 | (Dtmemory_f) 0, 51 | (Dtevent_f) 0 52 | }; 53 | 54 | edgelist *init_edgelist() 55 | { 56 | edgelist *list = dtopen(&ELDisc, Dtoset); 57 | return list; 58 | } 59 | 60 | void free_edgelist(edgelist * list) 61 | { 62 | dtclose(list); 63 | } 64 | 65 | void add_edge(edgelist * list, Agedge_t * e) 66 | { 67 | edgelistitem temp; 68 | 69 | temp.edge = e; 70 | dtinsert(list, &temp); 71 | } 72 | 73 | void remove_edge(edgelist * list, Agedge_t * e) 74 | { 75 | edgelistitem temp; 76 | 77 | temp.edge = e; 78 | dtdelete(list, &temp); 79 | } 80 | 81 | #ifdef DEBUG 82 | void print_edge(edgelist * list) 83 | { 84 | edgelistitem *temp; 85 | Agedge_t *ep; 86 | 87 | for (temp = (edgelistitem *) dtflatten(list); temp; 88 | temp = (edgelistitem *) dtlink(list, (Dtlink_t *) temp)) { 89 | ep = temp->edge; 90 | fprintf(stderr, "%s--", agnameof(agtail(ep))); 91 | fprintf(stderr, "%s \n", agnameof(aghead(ep))); 92 | } 93 | fputs("\n", stderr); 94 | } 95 | #endif 96 | 97 | int size_edgelist(edgelist * list) 98 | { 99 | return dtsize(list); 100 | } 101 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/edgelist.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef EDGELIST_H 19 | #define EDGELIST_H 20 | 21 | #include 22 | 23 | typedef struct edgelistitem { 24 | Dtlink_t link; 25 | Agedge_t *edge; 26 | } edgelistitem; 27 | 28 | typedef Dt_t edgelist; 29 | 30 | extern edgelist *init_edgelist(void); 31 | extern void add_edge(edgelist * list, Agedge_t * e); 32 | extern void remove_edge(edgelist * list, Agedge_t * e); 33 | extern void free_edgelist(edgelist * list); 34 | extern int size_edgelist(edgelist * list); 35 | #ifdef DEBUG 36 | extern void print_edge(edgelist *); 37 | #endif 38 | 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/nodelist.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef NODELIST_H 19 | #define NODELIST_H 20 | 21 | #include 22 | 23 | typedef struct nodelistitem nodelistitem_t; 24 | 25 | struct nodelistitem { 26 | node_t *curr; 27 | nodelistitem_t *next; 28 | nodelistitem_t *prev; 29 | }; 30 | 31 | typedef struct { 32 | nodelistitem_t *first; 33 | nodelistitem_t *last; 34 | int sz; 35 | } nodelist_t; 36 | 37 | extern nodelist_t *mkNodelist(void); 38 | extern void freeNodelist(nodelist_t *); 39 | extern int sizeNodelist(nodelist_t * list); 40 | 41 | extern void appendNodelist(nodelist_t *, nodelistitem_t *, 42 | Agnode_t * n); 43 | /* extern void removeNodelist(nodelist_t* list, Agnode_t* n); */ 44 | /* extern int node_exists(nodelist_t* list, Agnode_t* n); */ 45 | /* extern int nodename_exists(nodelist_t* list, char* n); */ 46 | extern int node_position(nodelist_t * list, Agnode_t * n); 47 | 48 | extern void realignNodelist(nodelist_t * list, nodelistitem_t * n); 49 | extern void insertNodelist(nodelist_t *, Agnode_t *, Agnode_t *, int); 50 | 51 | extern void reverseAppend(nodelist_t *, nodelist_t *); 52 | extern nodelist_t *reverseNodelist(nodelist_t * list); 53 | extern nodelist_t *cloneNodelist(nodelist_t * list); 54 | 55 | #ifdef DEBUG 56 | extern void printNodelist(nodelist_t * list); 57 | #endif 58 | 59 | #endif 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/circogen/nodeset.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef NODESET_H 19 | #define NODESET_H 20 | 21 | #include 22 | 23 | typedef struct { 24 | Dtlink_t link; 25 | Agnode_t *np; 26 | } nsitem_t; 27 | 28 | typedef Dt_t nodeset_t; 29 | 30 | extern nodeset_t *mkNodeset(void); 31 | extern void freeNodeset(nodeset_t *); 32 | extern void clearNodeset(nodeset_t *); 33 | extern void insertNodeset(nodeset_t * ns, Agnode_t * n); 34 | extern void removeNodeset(nodeset_t *, Agnode_t * n); 35 | extern int sizeNodeset(nodeset_t * ns); 36 | 37 | #ifdef DEBUG 38 | extern void printNodeset(nodeset_t *); 39 | #endif 40 | 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/arith.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* geometric functions (e.g. on points and boxes) with application to, but 15 | * no specific dependance on graphs */ 16 | 17 | #ifndef GV_ARITH_H 18 | #define GV_ARITH_H 19 | 20 | /* for sincos */ 21 | #ifndef _GNU_SOURCE 22 | #define _GNU_SOURCE 1 23 | #endif 24 | 25 | #include 26 | #ifdef HAVE_VALUES_H 27 | #include 28 | #endif 29 | #include 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #ifdef MIN 36 | #undef MIN 37 | #endif 38 | #define MIN(a,b) ((a)<(b)?(a):(b)) 39 | 40 | #ifdef MAX 41 | #undef MAX 42 | #endif 43 | #define MAX(a,b) ((a)>(b)?(a):(b)) 44 | 45 | #ifdef ABS 46 | #undef ABS 47 | #endif 48 | #define ABS(a) ((a) >= 0 ? (a) : -(a)) 49 | 50 | #define AVG(a,b) ((a + b) / 2) 51 | #define SGN(a) (((a)<0)? -1 : 1) 52 | #define CMP(a,b) (((a)<(b)) ? -1 : (((a)>(b)) ? 1 : 0)) 53 | 54 | #ifndef INT_MAX 55 | #define INT_MAX ((int)(~(unsigned)0 >> 1)) 56 | #endif 57 | 58 | #ifndef INT_MIN 59 | #define INT_MIN (-INT_MAX - 1) 60 | #endif 61 | 62 | #ifndef MAXSHORT 63 | #define MAXSHORT (0x7fff) 64 | #endif 65 | 66 | #ifndef MAXDOUBLE 67 | #define MAXDOUBLE 1.7976931348623157e+308 68 | #endif 69 | 70 | #ifndef MAXFLOAT 71 | #define MAXFLOAT ((float)3.40282347e+38) 72 | #endif 73 | 74 | #ifdef BETWEEN 75 | #undef BETWEEN 76 | #endif 77 | #define BETWEEN(a,b,c) (((a) <= (b)) && ((b) <= (c))) 78 | 79 | #ifndef M_PI 80 | #define M_PI 3.14159265358979323846 81 | #endif 82 | 83 | #ifndef SQRT2 84 | #define SQRT2 1.41421356237309504880 85 | #endif 86 | 87 | #define ROUND(f) ((f>=0)?(int)(f + .5):(int)(f - .5)) 88 | #define RADIANS(deg) ((deg)/180.0 * M_PI) 89 | #define DEGREES(rad) ((rad)/M_PI * 180.0) 90 | 91 | #define SQR(a) ((a) * (a)) 92 | 93 | #ifdef HAVE_SINCOS 94 | extern void sincos(double x, double *s, double *c); 95 | #else 96 | # define sincos(x,s,c) *s = sin(x); *c = cos(x) 97 | #endif 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/color.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GV_COLOR_H 15 | #define GV_COLOR_H 16 | 17 | /* #include "arith.h" */ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef struct hsvrgbacolor_t { 24 | char *name; 25 | unsigned char h, s, v; 26 | unsigned char r, g, b, a; 27 | } hsvrgbacolor_t; 28 | 29 | /* possible representations of color in gvcolor_t */ 30 | typedef enum { HSVA_DOUBLE, RGBA_BYTE, RGBA_WORD, CMYK_BYTE, 31 | RGBA_DOUBLE, COLOR_STRING, COLOR_INDEX } color_type_t; 32 | 33 | /* gvcolor_t can hold a color spec in a choice or representations */ 34 | typedef struct color_s { 35 | union { 36 | double RGBA[4]; 37 | double HSVA[4]; 38 | unsigned char rgba[4]; 39 | unsigned char cmyk[4]; 40 | int rrggbbaa[4]; 41 | char *string; 42 | int index; 43 | } u; 44 | color_type_t type; 45 | } gvcolor_t; 46 | 47 | #define COLOR_MALLOC_FAIL -1 48 | #define COLOR_UNKNOWN 1 49 | #define COLOR_OK 0 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | #endif 55 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/colorprocs.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GV_COLORPROCS_H 15 | #define GV_COLORPROCS_H 16 | 17 | #include "color.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | extern void setColorScheme (char* s); 24 | extern int colorxlate(char *str, gvcolor_t * color, color_type_t target_type); 25 | extern char *canontoken(char *str); 26 | extern int colorCvt(gvcolor_t *ocolor, gvcolor_t *ncolor); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif 32 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/globals.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef HAVE_CONFIG_H 15 | #include "config.h" 16 | #endif 17 | 18 | #define EXTERN 19 | #include "types.h" 20 | #include "globals.h" 21 | #include "fdp.h" 22 | 23 | /* Default layout values, possibly set via command line; -1 indicates unset */ 24 | static fdpParms_t fdpParms = { 25 | 1, /* useGrid */ 26 | 1, /* useNew */ 27 | -1, /* numIters */ 28 | 50, /* unscaled */ 29 | 0.0, /* C */ 30 | 1.0, /* Tfact */ 31 | -1.0, /* K - set in initParams; used in init_edge */ 32 | -1.0, /* T0 */ 33 | }; 34 | 35 | struct fdpParms_s* fdp_parms = &fdpParms; 36 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/htmllex.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef HTMLLEX_H 19 | #define HTMLLEX_H 20 | 21 | #include 22 | 23 | extern int initHTMLlexer(char *, agxbuf *, htmlenv_t *); 24 | extern int htmllex(void); 25 | extern int htmllineno(void); 26 | extern int clearHTMLlexer(void); 27 | void htmlerror(const char *); 28 | 29 | #endif 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/intset.c: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef HAVE_CONFIG_H 15 | #include "config.h" 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | static Void_t* 23 | mkIntItem(Dt_t* d,intitem* obj,Dtdisc_t* disc) 24 | { 25 | intitem* np = NEW(intitem); 26 | np->id = obj->id; 27 | return (Void_t*)np; 28 | } 29 | 30 | static void 31 | freeIntItem(Dt_t* d,intitem* obj,Dtdisc_t* disc) 32 | { 33 | free (obj); 34 | } 35 | 36 | static int 37 | cmpid(Dt_t* d, int* key1, int* key2, Dtdisc_t* disc) 38 | { 39 | if (*key1 > *key2) return 1; 40 | else if (*key1 < *key2) return -1; 41 | else return 0; 42 | } 43 | 44 | static Dtdisc_t intSetDisc = { 45 | offsetof(intitem,id), 46 | sizeof(int), 47 | offsetof(intitem,link), 48 | (Dtmake_f)mkIntItem, 49 | (Dtfree_f)freeIntItem, 50 | (Dtcompar_f)cmpid, 51 | 0, 52 | 0, 53 | 0 54 | }; 55 | 56 | Dt_t* 57 | openIntSet (void) 58 | { 59 | return dtopen(&intSetDisc,Dtoset); 60 | } 61 | 62 | void 63 | addIntSet (Dt_t* is, int v) 64 | { 65 | intitem obj; 66 | 67 | obj.id = v; 68 | dtinsert(is, &obj); 69 | } 70 | 71 | int 72 | inIntSet (Dt_t* is, int v) 73 | { 74 | return (dtmatch (is, &v) != 0); 75 | } 76 | 77 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/intset.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef INTSET_H 15 | #define INTSET_H 16 | 17 | #include 18 | 19 | typedef struct { 20 | int id; 21 | Dtlink_t link; 22 | } intitem; 23 | 24 | extern Dt_t* openIntSet (void); 25 | extern void addIntSet (Dt_t*, int); 26 | extern int inIntSet (Dt_t*, int); 27 | #endif 28 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/logic.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GV_LOGIC_H 15 | #define GV_LOGIC_H 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #if defined HAVE_STDBOOL_H && ! defined __cplusplus 22 | #include 23 | #endif 24 | 25 | #ifndef NOT 26 | #define NOT(v) (!(v)) 27 | #endif 28 | 29 | #if 0 30 | /* HAVE_BOOL only tested the CC compiler, we know C++ must define bool */ 31 | #if ! defined HAVE_BOOL && ! defined __cplusplus 32 | typedef unsigned char bool; 33 | #define false 0 34 | #define true NOT(false) 35 | #endif 36 | #endif 37 | 38 | #ifndef FALSE 39 | #define FALSE (0) 40 | #endif 41 | #ifndef TRUE 42 | #define TRUE (!FALSE) 43 | #endif 44 | 45 | #ifndef NOTUSED 46 | #define NOTUSED(var) (void) var 47 | #endif 48 | 49 | #ifndef NULL 50 | #define NULL (void *)0 51 | #endif 52 | 53 | #ifndef NIL 54 | #define NIL(type) ((type)0) 55 | #endif 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/macros.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GV_MACROS_H 15 | #define GV_MACROS_H 16 | 17 | #ifndef NOTUSED 18 | #define NOTUSED(var) (void) var 19 | #endif 20 | 21 | #ifndef NIL 22 | #define NIL(type) ((type)0) 23 | #endif 24 | 25 | #define isPinned(n) (ND_pinned(n) == P_PIN) 26 | #define hasPos(n) (ND_pinned(n) > 0) 27 | #define isFixed(n) (ND_pinned(n) > P_SET) 28 | 29 | #define SET_CLUST_NODE(n) (ND_clustnode(n) = TRUE) 30 | #define IS_CLUST_NODE(n) (ND_clustnode(n)) 31 | #define HAS_CLUST_EDGE(g) (GD_flags(g) & 1) 32 | #define SET_CLUST_EDGE(g) (GD_flags(g) |= 1) 33 | #define EDGE_TYPE(g) (GD_flags(g) & (7 << 1)) 34 | 35 | #ifndef streq 36 | #define streq(a,b) (*(a)==*(b)&&!strcmp(a,b)) 37 | #endif 38 | 39 | #define XPAD(d) ((d).x += 4*GAP) 40 | #define YPAD(d) ((d).y += 2*GAP) 41 | #define PAD(d) {XPAD(d); YPAD(d);} 42 | 43 | #define OTHERDIR(dir) ((dir == CCW) ? CW : CCW) 44 | 45 | #define NEXTSIDE(side, dir) ((dir == CCW) ? \ 46 | ((side & 0x8) ? BOTTOM : (side << 1)) : \ 47 | ((side & 0x1) ? LEFT : (side >> 1))) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/memory.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef HAVE_CONFIG_H 15 | #include "config.h" 16 | #endif 17 | 18 | #include 19 | #include 20 | #include "memory.h" 21 | 22 | void *zmalloc(size_t nbytes) 23 | { 24 | char *rv; 25 | if (nbytes == 0) 26 | return 0; 27 | rv = gmalloc(nbytes); 28 | memset(rv, 0, nbytes); 29 | return rv; 30 | } 31 | 32 | void *zrealloc(void *ptr, size_t size, size_t elt, size_t osize) 33 | { 34 | void *p = realloc(ptr, size * elt); 35 | if (p == NULL && size) { 36 | fprintf(stderr, "out of memory\n"); 37 | return p; 38 | } 39 | if (osize < size) 40 | memset((char *) p + (osize * elt), '\0', (size - osize) * elt); 41 | return p; 42 | } 43 | 44 | void *gmalloc(size_t nbytes) 45 | { 46 | char *rv; 47 | if (nbytes == 0) 48 | return NULL; 49 | rv = malloc(nbytes); 50 | if (rv == NULL) { 51 | fprintf(stderr, "out of memory\n"); 52 | } 53 | return rv; 54 | } 55 | 56 | void *grealloc(void *ptr, size_t size) 57 | { 58 | void *p = realloc(ptr, size); 59 | if (p == NULL && size) { 60 | fprintf(stderr, "out of memory\n"); 61 | } 62 | return p; 63 | } 64 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/memory.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GV_MEMORY_H 15 | #define GV_MEMORY_H 16 | 17 | #include 18 | #ifdef HAVE_MALLOC_H 19 | #include 20 | #endif 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #ifdef DMALLOC 27 | #define NEW(t) (t*)calloc(1,sizeof(t)) 28 | #define N_NEW(n,t) (t*)calloc((n),sizeof(t)) 29 | #define GNEW(t) (t*)malloc(sizeof(t)) 30 | #define N_GNEW(n,t) (t*)malloc((n)*sizeof(t)) 31 | #define ALLOC(size,ptr,type) (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type))) 32 | #define RALLOC(size,ptr,type) ((type*)realloc(ptr,(size)*sizeof(type))) 33 | #define ZALLOC(size,ptr,type,osize) (ptr? (type*)recalloc(ptr,(size)*sizeof(type)):(type*)calloc((size),sizeof(type))) 34 | #else 35 | #define NEW(t) (t*)zmalloc(sizeof(t)) 36 | #define N_NEW(n,t) (t*)zmalloc((n)*sizeof(t)) 37 | #define GNEW(t) (t*)gmalloc(sizeof(t)) 38 | 39 | #define N_GNEW(n,t) (t*)gmalloc((n)*sizeof(t)) 40 | #define N_GGNEW(n,t) (t*)malloc((n)*sizeof(t)) 41 | #define ALLOC(size,ptr,type) (ptr? (type*)grealloc(ptr,(size)*sizeof(type)):(type*)gmalloc((size)*sizeof(type))) 42 | #define RALLOC(size,ptr,type) ((type*)grealloc(ptr,(size)*sizeof(type))) 43 | #define ZALLOC(size,ptr,type,osize) (ptr? (type*)zrealloc(ptr,size,sizeof(type),osize):(type*)zmalloc((size)*sizeof(type))) 44 | #endif 45 | #ifdef GVDLL 46 | #define extern __declspec(dllexport) 47 | #else 48 | #ifdef WIN32_DLL 49 | #ifndef GVC_EXPORTS 50 | #define extern __declspec(dllimport) 51 | #endif 52 | #endif 53 | 54 | #endif 55 | 56 | extern void *zmalloc(size_t); 57 | extern void *zrealloc(void *, size_t, size_t, size_t); 58 | extern void *gmalloc(size_t); 59 | extern void *grealloc(void *, size_t); 60 | #undef extern 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/pointset.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef _POINTSET_H 15 | #define _POINTSET_H 1 16 | 17 | #include 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef Dict_t PointSet; 25 | typedef Dict_t PointMap; 26 | #ifdef GVDLL 27 | #define extern __declspec(dllexport) 28 | #else 29 | #define extern 30 | #endif 31 | 32 | /*visual studio*/ 33 | #ifdef WIN32_DLL 34 | #ifndef GVC_EXPORTS 35 | #define extern __declspec(dllimport) 36 | #endif 37 | #endif 38 | /*end visual studio*/ 39 | 40 | extern PointSet *newPS(void); 41 | extern void freePS(PointSet *); 42 | extern void insertPS(PointSet *, point); 43 | extern void addPS(PointSet *, int, int); 44 | extern int inPS(PointSet *, point); 45 | extern int isInPS(PointSet *, int, int); 46 | extern int sizeOf(PointSet *); 47 | extern point *pointsOf(PointSet *); 48 | 49 | extern PointMap *newPM(void); 50 | extern void clearPM(PointMap *); 51 | extern void freePM(PointMap *); 52 | extern int insertPM(PointMap *, int, int, int); 53 | extern int updatePM(PointMap * pm, int x, int y, int v); 54 | 55 | #undef extern 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif /* _POINTSET_H */ 61 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/strcasecmp.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef HAVE_CONFIG_H 15 | #include "config.h" 16 | #endif 17 | 18 | 19 | #include 20 | #include 21 | 22 | 23 | int strcasecmp(const char *s1, const char *s2) 24 | { 25 | while ((*s1 != '\0') 26 | && (tolower(*(unsigned char *) s1) == 27 | tolower(*(unsigned char *) s2))) { 28 | s1++; 29 | s2++; 30 | } 31 | 32 | return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/strncasecmp.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef HAVE_CONFIG_H 15 | #include "config.h" 16 | #endif 17 | 18 | 19 | #include 20 | #include 21 | 22 | int strncasecmp(const char *s1, const char *s2, unsigned int n) 23 | { 24 | if (n == 0) 25 | return 0; 26 | 27 | while ((n-- != 0) 28 | && (tolower(*(unsigned char *) s1) == 29 | tolower(*(unsigned char *) s2))) { 30 | if (n == 0 || *s1 == '\0' || *s2 == '\0') 31 | return 0; 32 | s1++; 33 | s2++; 34 | } 35 | 36 | return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/textspan.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef TEXTSPAN_H 15 | #define TEXTSPAN_H 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Bold, Italic, Underline, Sup, Sub, Strike */ 22 | /* Stored in textfont_t.flags, which is 7 bits, so full */ 23 | /* Probably should be moved to textspan_t */ 24 | #define HTML_BF (1 << 0) 25 | #define HTML_IF (1 << 1) 26 | #define HTML_UL (1 << 2) 27 | #define HTML_SUP (1 << 3) 28 | #define HTML_SUB (1 << 4) 29 | #define HTML_S (1 << 5) 30 | #define HTML_OL (1 << 6) 31 | 32 | typedef struct _PostscriptAlias { 33 | char* name; 34 | char* family; 35 | char* weight; 36 | char* stretch; 37 | char* style; 38 | int xfig_code; 39 | char* svg_font_family; 40 | char* svg_font_weight; 41 | char* svg_font_style; 42 | } PostscriptAlias; 43 | 44 | /* font information 45 | * If name or color is NULL, or size < 0, that attribute 46 | * is unspecified. 47 | */ 48 | typedef struct { 49 | char* name; 50 | char* color; 51 | PostscriptAlias *postscript_alias; 52 | double size; 53 | unsigned int flags:7; /* HTML_UL, HTML_IF, HTML_BF, etc. */ 54 | unsigned int cnt:(sizeof(unsigned int) * 8 - 7); /* reference count */ 55 | } textfont_t; 56 | 57 | /* atomic unit of text emitted using a single htmlfont_t */ 58 | typedef struct { 59 | char *str; /* stored in utf-8 */ 60 | textfont_t *font; 61 | void *layout; 62 | void (*free_layout) (void *layout); /* FIXME - this is ugly */ 63 | double yoffset_layout, yoffset_centerline; 64 | pointf size; 65 | char just; /* 'l' 'n' 'r' */ /* FIXME */ 66 | } textspan_t; 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | #endif 72 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/timing.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef WIN32 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | 23 | #ifndef HZ 24 | #define HZ 60 25 | #endif 26 | typedef struct tms mytime_t; 27 | #define GET_TIME(S) times(&(S)) 28 | #define DIFF_IN_SECS(S,T) ((S.tms_utime + S.tms_stime - T.tms_utime - T.tms_stime)/(double)HZ) 29 | 30 | #else 31 | 32 | #include 33 | #include "render.h" 34 | #include "utils.h" 35 | 36 | typedef clock_t mytime_t; 37 | #define GET_TIME(S) S = clock() 38 | #define DIFF_IN_SECS(S,T) ((S - T) / (double)CLOCKS_PER_SEC) 39 | 40 | #endif 41 | 42 | 43 | static mytime_t T; 44 | 45 | void start_timer(void) 46 | { 47 | GET_TIME(T); 48 | } 49 | 50 | double elapsed_sec(void) 51 | { 52 | mytime_t S; 53 | double rv; 54 | 55 | GET_TIME(S); 56 | rv = DIFF_IN_SECS(S, T); 57 | return rv; 58 | } 59 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/common/usershape.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef USERSHAPE_H 15 | #define USERSHAPE_H 16 | 17 | #include "cdt.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef enum { FT_NULL, 24 | FT_BMP, FT_GIF, FT_PNG, FT_JPEG, 25 | FT_PDF, FT_PS, FT_EPS, FT_SVG, FT_XML, 26 | FT_RIFF, FT_WEBP, FT_ICO, FT_TIFF 27 | } imagetype_t; 28 | 29 | typedef enum { 30 | IMAGESCALE_FALSE, /* no image scaling */ 31 | IMAGESCALE_TRUE, /* scale image to fit but keep aspect ratio */ 32 | IMAGESCALE_WIDTH, /* scale image width to fit, keep height fixed */ 33 | IMAGESCALE_HEIGHT, /* scale image height to fit, keep width fixed */ 34 | IMAGESCALE_BOTH /* scale image to fit without regard for aspect ratio */ 35 | } imagescale_t; 36 | 37 | typedef struct usershape_s usershape_t; 38 | 39 | struct usershape_s { 40 | Dtlink_t link; 41 | const char *name; 42 | int macro_id; 43 | boolean must_inline; 44 | boolean nocache; 45 | FILE *f; 46 | imagetype_t type; 47 | char *stringtype; 48 | int x, y, w, h, dpi; 49 | void *data; /* data loaded by a renderer */ 50 | size_t datasize; /* size of data (if mmap'ed) */ 51 | void (*datafree)(usershape_t *us); /* renderer's function for freeing data */ 52 | }; 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | #endif 58 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/dotgen/acyclic.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | /* 16 | * Break cycles in a directed graph by depth-first search. 17 | */ 18 | 19 | #include "dot.h" 20 | 21 | void reverse_edge(edge_t * e) 22 | { 23 | edge_t *f; 24 | 25 | delete_fast_edge(e); 26 | if ((f = find_fast_edge(aghead(e), agtail(e)))) 27 | merge_oneway(e, f); 28 | else 29 | virtual_edge(aghead(e), agtail(e), e); 30 | } 31 | 32 | static void 33 | dfs(node_t * n) 34 | { 35 | int i; 36 | edge_t *e; 37 | node_t *w; 38 | 39 | if (ND_mark(n)) 40 | return; 41 | ND_mark(n) = TRUE; 42 | ND_onstack(n) = TRUE; 43 | for (i = 0; (e = ND_out(n).list[i]); i++) { 44 | w = aghead(e); 45 | if (ND_onstack(w)) { 46 | reverse_edge(e); 47 | i--; 48 | } else { 49 | if (ND_mark(w) == FALSE) 50 | dfs(w); 51 | } 52 | } 53 | ND_onstack(n) = FALSE; 54 | } 55 | 56 | 57 | void acyclic(graph_t * g) 58 | { 59 | int c; 60 | node_t *n; 61 | 62 | for (c = 0; c < GD_comp(g).size; c++) { 63 | GD_nlist(g) = GD_comp(g).list[c]; 64 | for (n = GD_nlist(g); n; n = ND_next(n)) 65 | ND_mark(n) = FALSE; 66 | for (n = GD_nlist(g); n; n = ND_next(n)) 67 | dfs(n); 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/dotgen/aspect.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef ASPECT_H 15 | #define ASPECT_H 16 | 17 | typedef struct aspect_t { 18 | double targetAR; /* target aspect ratio */ 19 | double combiAR; 20 | int prevIterations; /* no. of iterations in previous pass */ 21 | int curIterations; /* no. of iterations in current pass */ 22 | int nextIter; /* dynamically adjusted no. of iterations */ 23 | int nPasses; /* bound on no. of top-level passes */ 24 | int badGraph; /* hack: set if graph is disconnected or has 25 | * clusters. If so, turn off aspect */ 26 | } aspect_t; 27 | 28 | extern aspect_t* setAspect (Agraph_t * g, aspect_t* adata); 29 | extern void rank3(graph_t * g, aspect_t * asp); 30 | extern void initEdgeTypes(graph_t * g); 31 | extern void init_UF_size(graph_t * g); 32 | extern int countDummyNodes(graph_t * g); 33 | 34 | #endif /* ASPECT_H */ 35 | 36 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/dotgen/decomp.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | /* 16 | * Decompose finds the connected components of a graph. 17 | * It searches the temporary edges and ignores non-root nodes. 18 | * The roots of the search are the real nodes of the graph, 19 | * but any virtual nodes discovered are also included in the 20 | * component. 21 | */ 22 | 23 | #include "dot.h" 24 | 25 | 26 | static graph_t *G; 27 | static node_t *Last_node; 28 | static char Cmark; 29 | 30 | static void 31 | begin_component(void) 32 | { 33 | Last_node = GD_nlist(G) = NULL; 34 | } 35 | 36 | static void 37 | add_to_component(node_t * n) 38 | { 39 | GD_n_nodes(G)++; 40 | ND_mark(n) = Cmark; 41 | if (Last_node) { 42 | ND_prev(n) = Last_node; 43 | ND_next(Last_node) = n; 44 | } else { 45 | ND_prev(n) = NULL; 46 | GD_nlist(G) = n; 47 | } 48 | Last_node = n; 49 | ND_next(n) = NULL; 50 | } 51 | 52 | static void 53 | end_component(void) 54 | { 55 | int i; 56 | 57 | i = GD_comp(G).size++; 58 | GD_comp(G).list = ALLOC(GD_comp(G).size, GD_comp(G).list, node_t *); 59 | GD_comp(G).list[i] = GD_nlist(G); 60 | } 61 | 62 | static void 63 | search_component(graph_t * g, node_t * n) 64 | { 65 | int c, i; 66 | elist vec[4]; 67 | node_t *other; 68 | edge_t *e; 69 | 70 | add_to_component(n); 71 | vec[0] = ND_out(n); 72 | vec[1] = ND_in(n); 73 | vec[2] = ND_flat_out(n); 74 | vec[3] = ND_flat_in(n); 75 | 76 | for (c = 0; c <= 3; c++) { 77 | if (vec[c].list) 78 | for (i = 0; (e = vec[c].list[i]); i++) { 79 | if ((other = aghead(e)) == n) 80 | other = agtail(e); 81 | if ((ND_mark(other) != Cmark) && (other == UF_find(other))) 82 | search_component(g, other); 83 | } 84 | } 85 | } 86 | 87 | void decompose(graph_t * g, int pass) 88 | { 89 | graph_t *subg; 90 | node_t *n, *v; 91 | 92 | G = g; 93 | if (++Cmark == 0) 94 | Cmark = 1; 95 | GD_n_nodes(g) = GD_comp(g).size = 0; 96 | for (n = agfstnode(g); n; n = agnxtnode(g, n)) { 97 | v = n; 98 | if ((pass > 0) && (subg = ND_clust(v))) 99 | v = GD_rankleader(subg)[ND_rank(v)]; 100 | else if (v != UF_find(v)) 101 | continue; 102 | if (ND_mark(v) != Cmark) { 103 | begin_component(); 104 | search_component(g, v); 105 | end_component(); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/dotgen/dot.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | #ifndef DOT_H 16 | #define DOT_H 17 | 18 | #include "render.h" 19 | #include "dotprocs.h" 20 | 21 | #endif /* DOT_H */ 22 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/dotgen2/dot2.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | #ifndef DOT2_H 16 | #define DOT2_H 17 | 18 | #include "render.h" 19 | #include "dot2procs.h" 20 | 21 | /* tags for representative (model) objects */ 22 | /* 0 is reserved for undefined */ 23 | #define STDNODE 1 /* a real node on only one rank */ 24 | #define TALLNODE 2 /* a real node on two or more ranks */ 25 | #define EXTNODE 3 /* a node external to a cluster */ 26 | #define SKELETON 4 27 | #define PATH 5 28 | #define INTNODE 6 /*internal temporary nodes to fill rank gaps*/ 29 | #define LBLNODE 7 /*internal temp nodes for edge labels*/ 30 | 31 | #endif /* DOT_H */ 32 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/dotgen2/dot2procs.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef DOT2PROCS_H 15 | #define DOT2PROCS_H 16 | 17 | #ifdef _BEGIN_EXTERNS_ 18 | _BEGIN_EXTERNS_ /* public data */ 19 | #endif 20 | /* tabs at 8, or you're a sorry loser */ 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | extern int is_nonconstraint(edge_t * e); 26 | 27 | #if defined(_BLD_dot) && defined(_DLL) 28 | # define extern __EXPORT__ 29 | #endif 30 | extern Agraph_t* dot2_mincross(Agraph_t *); 31 | /* extern void dot_position(Agraph_t *, aspect_t*); */ 32 | extern void dot2_levels(Agraph_t *); 33 | /* extern void dot_sameports(Agraph_t *); */ 34 | /* extern void dot_splines(Agraph_t *); */ 35 | #undef extern 36 | 37 | #ifdef _END_EXTERNS_ 38 | _END_EXTERNS_ 39 | #endif 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/dotgen2/groups.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GROUPS_H 15 | #define GROUPS_H 16 | 17 | #include 18 | 19 | extern void createGroups(Agraph_t* g); 20 | extern void nodesToClusters(Agraph_t* g); 21 | extern void graphGroups(Agraph_t* sg); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/fdpgen/clusteredges.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef CLUSTEREDGES_H 19 | #define CLUSTEREDGES_H 20 | 21 | #include 22 | #include 23 | 24 | extern int compoundEdges(graph_t * g, expand_t* pm, int splines); 25 | 26 | #endif 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/fdpgen/comp.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef COMP_H 19 | #define COMP_H 20 | 21 | #include 22 | 23 | extern graph_t **findCComp(graph_t *, int *, int *); 24 | 25 | #endif 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/fdpgen/dbg.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef FDPDBG_H 19 | #define FDPDBG_H 20 | 21 | #ifdef DEBUG 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | extern double Scale; 28 | extern void outputGraph(Agraph_t *, FILE *, int); 29 | 30 | extern void incInd(void); 31 | extern void decInd(void); 32 | extern void prIndent(void); 33 | 34 | extern void dump(graph_t * g, int doAll, int doBB); 35 | extern void dumpE(graph_t * g, int derived); 36 | extern void dumpG(graph_t * g, char *fname, int); 37 | 38 | #endif 39 | 40 | #endif 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/fdpgen/grid.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef GRID_H 19 | #define GRID_H 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | 28 | typedef struct _grid Grid; 29 | 30 | typedef struct _node_list { 31 | Agnode_t *node; 32 | struct _node_list *next; 33 | } node_list; 34 | 35 | typedef struct { 36 | int i, j; 37 | } gridpt; 38 | 39 | typedef struct { 40 | gridpt p; /* index of cell */ 41 | node_list *nodes; /* nodes in cell */ 42 | Dtlink_t link; /* cdt data */ 43 | } cell; 44 | 45 | extern Grid *mkGrid(int); 46 | extern void adjustGrid(Grid * g, int nnodes); 47 | extern void clearGrid(Grid *); 48 | extern void addGrid(Grid *, int, int, Agnode_t *); 49 | extern void walkGrid(Grid *, int (*)(Dt_t *, cell *, Grid *)); 50 | extern cell *findGrid(Grid *, int, int); 51 | extern void delGrid(Grid *); 52 | extern int gLength(cell * p); 53 | 54 | #endif 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/fdpgen/tlayout.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef TLAYOUT_H 19 | #define TLAYOUT_H 20 | 21 | #include "fdp.h" 22 | #include "xlayout.h" 23 | 24 | typedef enum { 25 | seed_unset, seed_val, seed_time, seed_regular 26 | } seedMode; 27 | 28 | extern void fdp_initParams(graph_t *); 29 | extern void fdp_tLayout(graph_t *, xparams *); 30 | 31 | #endif 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/fdpgen/xlayout.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef XLAYOUT_H 19 | #define XLAYOUT_H 20 | 21 | #include 22 | 23 | typedef struct { 24 | int numIters; 25 | double T0; 26 | double K; 27 | double C; 28 | int loopcnt; 29 | } xparams; 30 | 31 | extern void fdp_xLayout(graph_t *, xparams *); 32 | 33 | #endif 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvbuffstderr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | struct buff_s { 8 | int fd; 9 | fpos_t pos; 10 | char *template; 11 | }; 12 | 13 | /* switch stderr output to temporary file buffering 14 | */ 15 | void *buffstderr(void) 16 | { 17 | char *p; 18 | struct buff_s *b; 19 | 20 | assert ((b = malloc(sizeof(struct buff_s)))); 21 | assert ((b->template = strdup("/tmp/stderr_buffer_XXXXXX"))); 22 | assert ((p = mktemp(b->template))); 23 | fflush(stderr); 24 | fgetpos(stderr, &(b->pos)); 25 | b->fd = dup(fileno(stderr)); 26 | freopen(b->template, "w+", stderr); 27 | return (void *)b; 28 | } 29 | 30 | /* switch stderr output back to normal, 31 | * and return any buffered output in a malloc'ed buffer 32 | */ 33 | char *unbuffstderr(struct buff_s *b) 34 | { 35 | long sz; 36 | char *t = NULL; 37 | FILE *f; 38 | 39 | fflush(stderr); 40 | sz = ftell(stderr); 41 | dup2(b->fd, fileno(stderr)); 42 | close(b->fd); 43 | clearerr(stderr); 44 | fsetpos(stderr, &(b->pos)); 45 | 46 | if (sz) { 47 | /* stderr has been restored; these asserts use normal stderr output */ 48 | assert((t = malloc(sz+1))); 49 | assert((f = fopen(b->template, "r"))); 50 | assert( fread(t, 1, sz, f) == sz); 51 | fclose(f); 52 | t[sz]='\0'; 53 | } 54 | 55 | unlink(b->template); 56 | free(b->template); 57 | free(b); 58 | 59 | return t; 60 | } 61 | 62 | #if 0 /* FOR TESTING */ 63 | int main (int argc, char *argv[]) { 64 | 65 | void *buff; 66 | char *text; 67 | 68 | fprintf(stderr, "First message\n"); 69 | 70 | buff = buffstderr(); 71 | fprintf(stderr, "Second message\n"); 72 | 73 | fprintf(stderr, "Third message\n"); 74 | 75 | text = unbuffstderr(buff); 76 | fprintf(stderr, "Fourth message\n"); 77 | 78 | if (text) { 79 | fprintf(stderr, text); 80 | free(text); 81 | } 82 | 83 | return 0; 84 | } 85 | #endif 86 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvcext.h: -------------------------------------------------------------------------------- 1 | 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* Common header used by both clients and plugins */ 15 | 16 | #ifndef GVCEXT_H 17 | #define GVCEXT_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* 24 | * Define an apis array of name strings using an enumerated api_t as index. 25 | * The enumerated type is defined here. The apis array is 26 | * inititialized in gvplugin.c by redefining ELEM and reinvoking APIS. 27 | */ 28 | #define APIS ELEM(render) ELEM(layout) ELEM(textlayout) ELEM(device) ELEM(loadimage) 29 | 30 | /* 31 | * Define api_t using names based on the plugin names with API_ prefixed. 32 | */ 33 | #define ELEM(x) API_##x, 34 | typedef enum { APIS _DUMMY_ELEM_=0 } api_t; /* API_render, API_layout, ... */ 35 | /* Stupid but true: The sole purpose of "_DUMMY_ELEM_=0" 36 | * is to avoid a "," after the last element of the enum 37 | * because some compilers when using "-pedantic" 38 | * generate an error for about the dangling "," 39 | * but only if this header is used from a .cpp file! 40 | * Setting it to 0 makes sure that the enumeration 41 | * does not define an extra value. (It does however 42 | * define _DUMMY_ELEM_ as an enumeration symbol, 43 | * but its value duplicates that of the first 44 | * symbol in the enumeration - in this case "render".) 45 | */ 46 | 47 | /* One could wonder why trailing "," in: 48 | * int nums[]={1,2,3,}; 49 | * is OK, but in: 50 | * typedef enum {a,b,c,} abc_t; 51 | * is not!!! 52 | */ 53 | #undef ELEM 54 | 55 | typedef struct GVJ_s GVJ_t; 56 | typedef struct GVG_s GVG_t; 57 | typedef struct GVC_s GVC_t; 58 | 59 | typedef struct { 60 | const char *name; 61 | void* address; 62 | } lt_symlist_t; 63 | 64 | typedef struct gvplugin_available_s gvplugin_available_t; 65 | 66 | /*visual studio*/ 67 | #ifdef WIN32_DLL 68 | #ifndef GVC_EXPORTS 69 | __declspec(dllimport) lt_symlist_t lt_preloaded_symbols[]; 70 | #else 71 | __declspec(dllexport) lt_symlist_t lt_preloaded_symbols[]; 72 | lt_symlist_t lt_preloaded_symbols[]; 73 | #endif 74 | #endif 75 | /*end visual studio*/ 76 | 77 | 78 | #ifndef WIN32_DLL 79 | #if defined(GVDLL) 80 | __declspec(dllexport) lt_symlist_t lt_preloaded_symbols[]; 81 | #else 82 | #if !defined(LTDL_H) 83 | extern lt_symlist_t lt_preloaded_symbols[]; 84 | #endif 85 | #endif 86 | #endif 87 | 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvcommon.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GVCOMMON_H 15 | #define GVCOMMON_H 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef struct GVCOMMON_s { 22 | char **info; 23 | char *cmdname; 24 | int verbose; 25 | boolean config, auto_outfile_names; 26 | void (*errorfn) (const char *fmt, ...); 27 | const char **show_boxes; /* emit code for correct box coordinates */ 28 | const char **lib; 29 | 30 | /* rendering state */ 31 | int viewNum; /* current view - 1 based count of views, 32 | all pages in all layers */ 33 | const lt_symlist_t *builtins; 34 | int demand_loading; 35 | } GVCOMMON_t; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* GVCOMMON_H */ 41 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvconfig.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* Header used by plugins */ 15 | 16 | #ifndef GVCONFIG_H 17 | #define GVCONFIG_H 18 | 19 | #include "gvplugin.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | extern void gvconfig_plugin_install_from_library(GVC_t * gvc, char *path, gvplugin_library_t *library); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif /* GVCONFIG_H */ 31 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvcontext.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* 15 | A gvcontext is a single instance of a GVC_t data structure providing 16 | for a set of plugins for processing one graph at a time, and a job 17 | description provividing for a sequence of graph jobs. 18 | 19 | Sometime in the future it may become the basis for a thread. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include "config.h" 24 | #endif 25 | 26 | #include 27 | 28 | #include "builddate.h" 29 | #include "types.h" 30 | #include "gvplugin.h" 31 | #include "gvcjob.h" 32 | #include "gvcint.h" 33 | #include "gvcproc.h" 34 | #include "gvc.h" 35 | 36 | /* from common/utils.c */ 37 | extern void *zmalloc(size_t); 38 | 39 | /* from common/textspan.c */ 40 | extern void textfont_dict_close(GVC_t *gvc); 41 | 42 | /* from common/emit.c */ 43 | extern void emit_once_reset(void); 44 | 45 | /* from common/globals.c */ 46 | extern int graphviz_errors; 47 | 48 | static char *LibInfo[] = { 49 | "graphviz", /* Program */ 50 | PACKAGE_VERSION, /* Version */ 51 | BUILDDATE /* Build Date */ 52 | }; 53 | 54 | GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading) 55 | { 56 | GVC_t *gvc = zmalloc(sizeof(GVC_t)); 57 | 58 | if (gvc) { 59 | gvc->common.info = LibInfo; 60 | gvc->common.errorfn = agerrorf; 61 | gvc->common.builtins = builtins; 62 | gvc->common.demand_loading = demand_loading; 63 | } 64 | return gvc; 65 | } 66 | 67 | void gvFinalize(GVC_t * gvc) 68 | { 69 | if (gvc->active_jobs) 70 | gvrender_end_job(gvc->active_jobs); 71 | } 72 | 73 | 74 | int gvFreeContext(GVC_t * gvc) 75 | { 76 | GVG_t *gvg, *gvg_next; 77 | gvplugin_package_t *package, *package_next; 78 | 79 | emit_once_reset(); 80 | gvg_next = gvc->gvgs; 81 | while ((gvg = gvg_next)) { 82 | gvg_next = gvg->next; 83 | free(gvg); 84 | } 85 | package_next = gvc->packages; 86 | while ((package = package_next)) { 87 | package_next = package->next; 88 | free(package->path); 89 | free(package->name); 90 | free(package); 91 | } 92 | gvjobs_delete(gvc); 93 | if (gvc->config_path) 94 | free(gvc->config_path); 95 | if (gvc->input_filenames) 96 | free(gvc->input_filenames); 97 | textfont_dict_close(gvc); 98 | free(gvc); 99 | return (graphviz_errors + agerrors()); 100 | } 101 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvio.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GVDEVICE_H 15 | #define GVDEVICE_H 16 | 17 | #include "gvcjob.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #ifdef GVDLL 24 | #define extern __declspec(dllexport) 25 | #else 26 | #define extern 27 | #endif 28 | 29 | /*visual studio*/ 30 | #ifdef WIN32_DLL 31 | #ifndef GVC_EXPORTS 32 | #define extern __declspec(dllimport) 33 | #endif 34 | #endif 35 | /*end visual studio*/ 36 | 37 | extern size_t gvwrite (GVJ_t * job, const char *s, size_t len); 38 | extern size_t gvfwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream); 39 | extern int gvferror (FILE *stream); 40 | extern int gvputc(GVJ_t * job, int c); 41 | extern int gvputs(GVJ_t * job, const char *s); 42 | extern int gvflush (GVJ_t * job); 43 | extern void gvprintf(GVJ_t * job, const char *format, ...); 44 | extern void gvprintdouble(GVJ_t * job, double num); 45 | extern void gvprintpointf(GVJ_t * job, pointf p); 46 | extern void gvprintpointflist(GVJ_t * job, pointf *p, int n); 47 | 48 | #undef extern 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* GVDEVICE_H */ 55 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvloadimage.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* 15 | * graphics code generator wrapper 16 | * 17 | * This library forms the socket for run-time loadable loadimage plugins. 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif 23 | 24 | #include 25 | 26 | #include "const.h" 27 | #include "gvplugin_loadimage.h" 28 | #include "gvcint.h" 29 | #include "gvcproc.h" 30 | 31 | /* for agerr() */ 32 | #include "cgraph.h" 33 | 34 | static int gvloadimage_select(GVJ_t * job, char *str) 35 | { 36 | gvplugin_available_t *plugin; 37 | gvplugin_installed_t *typeptr; 38 | 39 | plugin = gvplugin_load(job->gvc, API_loadimage, str); 40 | if (plugin) { 41 | typeptr = plugin->typeptr; 42 | job->loadimage.engine = (gvloadimage_engine_t *) (typeptr->engine); 43 | job->loadimage.id = typeptr->id; 44 | return GVRENDER_PLUGIN; 45 | } 46 | return NO_SUPPORT; 47 | } 48 | 49 | void gvloadimage(GVJ_t * job, usershape_t *us, boxf b, boolean filled, const char *target) 50 | { 51 | gvloadimage_engine_t *gvli; 52 | char type[SMALLBUF]; 53 | 54 | assert(job); 55 | assert(us); 56 | assert(us->name); 57 | assert(us->name[0]); 58 | 59 | strcpy(type, us->stringtype); 60 | strcat(type, ":"); 61 | strcat(type, target); 62 | 63 | if (gvloadimage_select(job, type) == NO_SUPPORT) 64 | agerr (AGWARN, "No loadimage plugin for \"%s\"\n", type); 65 | 66 | if ((gvli = job->loadimage.engine) && gvli->loadimage) 67 | gvli->loadimage(job, us, b, filled); 68 | } 69 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvplugin.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* Header used by plugins */ 15 | 16 | #ifndef GVPLUGIN_H 17 | #define GVPLUGIN_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #include "gvcext.h" 24 | 25 | /* 26 | * Terminology: 27 | * 28 | * package - e.g. libgvplugin_cairo.so 29 | * api - e.g. render 30 | * type - e.g. "png", "ps" 31 | */ 32 | 33 | typedef struct { 34 | int id; /* an id that is only unique within a package 35 | of plugins of the same api. 36 | A renderer-type such as "png" in the cairo package 37 | has an id that is different from the "ps" type 38 | in the same package */ 39 | const char *type; /* a string name, such as "png" or "ps" that 40 | distinguishes different types withing the same 41 | (renderer in this case) */ 42 | int quality; /* an arbitrary integer used for ordering plugins of 43 | the same type from different packages */ 44 | void *engine; /* pointer to the jump table for the plugin */ 45 | void *features; /* pointer to the feature description 46 | void* because type varies by api */ 47 | } gvplugin_installed_t; 48 | 49 | typedef struct { 50 | api_t api; 51 | gvplugin_installed_t *types; 52 | } gvplugin_api_t; 53 | 54 | typedef struct { 55 | char *packagename; /* used when this plugin is builtin and has 56 | no pathname */ 57 | gvplugin_api_t *apis; 58 | } gvplugin_library_t; 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #endif /* GVPLUGIN_H */ 64 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvplugin_device.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GVDEVICE_PLUGIN_H 15 | #define GVDEVICE_PLUGIN_H 16 | 17 | #include "types.h" 18 | #include "gvplugin.h" 19 | #include "gvcjob.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | struct gvdevice_engine_s { 26 | void (*initialize) (GVJ_t * firstjob); 27 | void (*format) (GVJ_t * firstjob); 28 | void (*finalize) (GVJ_t * firstjob); 29 | }; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif /* GVDEVICE_PLUGIN_H */ 35 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvplugin_layout.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GVPLUGIN_LAYOUT_H 15 | #define GVPLUGIN_LAYOUT_H 16 | 17 | #include "types.h" 18 | #include "gvplugin.h" 19 | #include "gvcjob.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | struct gvlayout_engine_s { 26 | void (*layout) (graph_t * g); 27 | void (*cleanup) (graph_t * g); 28 | }; 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif /* GVPLUGIN_LAYOUT_H */ 34 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvplugin_loadimage.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GVPLUGIN_IMAGELOAD_H 15 | #define GVPLUGIN_IMAGELOAD_H 16 | 17 | #include "types.h" 18 | #include "gvplugin.h" 19 | #include "gvcjob.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #ifdef GVDLL 26 | # define extern __declspec(dllexport) 27 | #endif 28 | 29 | /*visual studio*/ 30 | #ifdef WIN32_DLL 31 | #ifndef GVC_EXPORTS 32 | #define extern __declspec(dllimport) 33 | #endif 34 | #endif 35 | /*end visual studio*/ 36 | 37 | extern boolean gvusershape_file_access(usershape_t *us); 38 | extern void gvusershape_file_release(usershape_t *us); 39 | 40 | struct gvloadimage_engine_s { 41 | void (*loadimage) (GVJ_t *job, usershape_t *us, boxf b, boolean filled); 42 | }; 43 | 44 | #ifdef extern 45 | #undef extern 46 | #endif 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | #endif /* GVPLUGIN_IMAGELOAD_H */ 52 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvplugin_render.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GVPLUGIN_RENDER_H 15 | #define GVPLUGIN_RENDER_H 16 | 17 | #include "types.h" 18 | #include "gvplugin.h" 19 | #include "gvcjob.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | struct gvrender_engine_s { 26 | void (*begin_job) (GVJ_t * job); 27 | void (*end_job) (GVJ_t * job); 28 | void (*begin_graph) (GVJ_t * job); 29 | void (*end_graph) (GVJ_t * job); 30 | void (*begin_layer) (GVJ_t * job, char *layername, 31 | int layerNum, int numLayers); 32 | void (*end_layer) (GVJ_t * job); 33 | void (*begin_page) (GVJ_t * job); 34 | void (*end_page) (GVJ_t * job); 35 | void (*begin_cluster) (GVJ_t * job); 36 | void (*end_cluster) (GVJ_t * job); 37 | void (*begin_nodes) (GVJ_t * job); 38 | void (*end_nodes) (GVJ_t * job); 39 | void (*begin_edges) (GVJ_t * job); 40 | void (*end_edges) (GVJ_t * job); 41 | void (*begin_node) (GVJ_t * job); 42 | void (*end_node) (GVJ_t * job); 43 | void (*begin_edge) (GVJ_t * job); 44 | void (*end_edge) (GVJ_t * job); 45 | void (*begin_anchor) (GVJ_t * job, 46 | char *href, char *tooltip, char *target, char *id); 47 | void (*end_anchor) (GVJ_t * job); 48 | void (*begin_label) (GVJ_t * job, label_type type); 49 | void (*end_label) (GVJ_t * job); 50 | void (*textspan) (GVJ_t * job, pointf p, textspan_t * span); 51 | void (*resolve_color) (GVJ_t * job, gvcolor_t * color); 52 | void (*ellipse) (GVJ_t * job, pointf * A, int filled); 53 | void (*polygon) (GVJ_t * job, pointf * A, int n, int filled); 54 | void (*beziercurve) (GVJ_t * job, pointf * A, int n, 55 | int arrow_at_start, int arrow_at_end, int); 56 | void (*polyline) (GVJ_t * job, pointf * A, int n); 57 | void (*comment) (GVJ_t * job, char *comment); 58 | void (*library_shape) (GVJ_t * job, char *name, pointf * A, int n, int filled); 59 | }; 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | #endif /* GVPLUGIN_RENDER_H */ 65 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvplugin_textlayout.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef GVPLUGIN_TEXTLAYOUT_H 15 | #define GVPLUGIN_TEXTLAYOUT_H 16 | 17 | #include "types.h" 18 | #include "gvplugin.h" 19 | #include "gvcjob.h" 20 | #include "gvcommon.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | struct gvtextlayout_engine_s { 27 | boolean (*textlayout) (textspan_t *span, char** fontpath); 28 | }; 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif /* GVPLUGIN_TEXTLAYOUT_H */ 34 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/gvc/gvtextlayout.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* 15 | * textlayout engine wrapper 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | #include "config.h" 20 | #endif 21 | 22 | #include "const.h" 23 | #include "gvplugin_textlayout.h" 24 | #include "gvcint.h" 25 | #include "gvcproc.h" 26 | 27 | int gvtextlayout_select(GVC_t * gvc) 28 | { 29 | gvplugin_available_t *plugin; 30 | gvplugin_installed_t *typeptr; 31 | 32 | plugin = gvplugin_load(gvc, API_textlayout, "textlayout"); 33 | if (plugin) { 34 | typeptr = plugin->typeptr; 35 | gvc->textlayout.engine = (gvtextlayout_engine_t *) (typeptr->engine); 36 | return GVRENDER_PLUGIN; /* FIXME - need more suitable success code */ 37 | } 38 | return NO_SUPPORT; 39 | } 40 | 41 | boolean gvtextlayout(GVC_t *gvc, textspan_t *span, char **fontpath) 42 | { 43 | gvtextlayout_engine_t *gvte = gvc->textlayout.engine; 44 | 45 | if (gvte && gvte->textlayout) 46 | return gvte->textlayout(span, fontpath); 47 | return FALSE; 48 | } 49 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/label/node.h: -------------------------------------------------------------------------------- 1 | /* vim:set shiftwidth=4 ts=8: */ 2 | 3 | /************************************************************************* 4 | * Copyright (c) 2011 AT&T Intellectual Property 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * which accompanies this distribution, and is available at 8 | * http://www.eclipse.org/legal/epl-v10.html 9 | * 10 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 11 | *************************************************************************/ 12 | 13 | #ifndef NODE_H 14 | #define NODE_H 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #include 21 | 22 | typedef struct Branch { 23 | Rect_t rect; 24 | struct Node *child; 25 | } Branch_t; 26 | 27 | typedef struct Node { 28 | int count; 29 | int level; /* 0 is leaf, others positive */ 30 | struct Branch branch[NODECARD]; 31 | } Node_t; 32 | 33 | void RTreeFreeNode(RTree_t *, Node_t *); 34 | void InitNode(Node_t *); 35 | void InitBranch(Branch_t *); 36 | Rect_t NodeCover(Node_t *); 37 | int PickBranch(Rect_t *, Node_t *); 38 | int AddBranch(RTree_t *, Branch_t *, Node_t *, Node_t **); 39 | void DisconBranch(Node_t *, int); 40 | void PrintBranch(int, Branch_t *); 41 | Node_t *RTreeNewNode(RTree_t *); 42 | #ifdef RTDEBUG 43 | void PrintNode(Node_t * n); 44 | void PrintBranch(int i, Branch_t * b); 45 | #endif 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /*NODE_H */ 52 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/label/rectangle.h: -------------------------------------------------------------------------------- 1 | /* vim:set shiftwidth=4 ts=8: */ 2 | 3 | /************************************************************************* 4 | * Copyright (c) 2011 AT&T Intellectual Property 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * which accompanies this distribution, and is available at 8 | * http://www.eclipse.org/legal/epl-v10.html 9 | * 10 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 11 | *************************************************************************/ 12 | 13 | #ifndef RECTANGLE_H 14 | #define RECTANGLE_H 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | typedef struct Rect { 21 | int boundary[NUMSIDES]; 22 | } Rect_t; 23 | 24 | void InitRect(Rect_t * r); 25 | #ifdef RTDEBUG 26 | void PrintRect(Rect_t *); 27 | #endif 28 | unsigned int RectArea(Rect_t *); 29 | int Overlap(Rect_t *, Rect_t *); 30 | int Contained(Rect_t *, Rect_t *); 31 | Rect_t CombineRect(Rect_t *, Rect_t *); 32 | Rect_t NullRect(void); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /*RECTANGLE_H */ 39 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/label/split.q.h: -------------------------------------------------------------------------------- 1 | /* vim:set shiftwidth=4 ts=8: */ 2 | 3 | /************************************************************************* 4 | * Copyright (c) 2011 AT&T Intellectual Property 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * which accompanies this distribution, and is available at 8 | * http://www.eclipse.org/legal/epl-v10.html 9 | * 10 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 11 | *************************************************************************/ 12 | 13 | #ifndef SPLIT_Q_H 14 | #define SPLIT_Q_H 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /*----------------------------------------------------------------------------- 21 | | Definitions and global variables. 22 | -----------------------------------------------------------------------------*/ 23 | #include 24 | #include 25 | 26 | #ifndef METHODS 27 | #define METHODS 1 28 | #endif /*METHODS*/ 29 | /* variables for finding a partition */ 30 | struct PartitionVars { 31 | int partition[NODECARD + 1]; 32 | int taken[NODECARD + 1]; 33 | int count[2]; 34 | struct Rect cover[2]; 35 | int area[2]; 36 | }; 37 | 38 | typedef struct split_q_s { 39 | struct Branch BranchBuf[NODECARD + 1]; 40 | struct Rect CoverSplit; 41 | unsigned int CoverSplitArea; 42 | struct PartitionVars Partitions[METHODS]; 43 | } SplitQ_t; 44 | 45 | void SplitNode(RTree_t *, Node_t *, Branch_t *, Node_t **); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /*SPLIT_Q_H */ 52 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/ortho/maze.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef MAZE_H 15 | #define MAZE_H 16 | 17 | #include 18 | 19 | enum {M_RIGHT=0, M_TOP, M_LEFT, M_BOTTOM}; 20 | 21 | #define MZ_ISNODE 1 22 | #define MZ_VSCAN 2 23 | #define MZ_HSCAN 4 24 | #define MZ_SMALLV 8 25 | #define MZ_SMALLH 16 26 | 27 | /* cell corresponds to node */ 28 | #define IsNode(cp) (cp->flags & MZ_ISNODE) 29 | /* cell already inserted in vertical channel */ 30 | #define IsVScan(cp) (cp->flags & MZ_VSCAN) 31 | /* cell already inserted in horizontal channel */ 32 | #define IsHScan(cp) (cp->flags & MZ_HSCAN) 33 | /* cell has small height corresponding to a small height node */ 34 | #define IsSmallV(cp) (cp->flags & MZ_SMALLV) 35 | /* cell has small width corresponding to a small width node */ 36 | #define IsSmallH(cp) (cp->flags & MZ_SMALLH) 37 | 38 | typedef struct cell { 39 | int flags; 40 | int nedges; 41 | sedge* edges[6]; 42 | int nsides; 43 | snode** sides; 44 | boxf bb; 45 | } cell; 46 | 47 | typedef struct { 48 | int ncells, ngcells; 49 | cell* cells; /* cells not corresponding to graph nodes */ 50 | cell* gcells; /* cells corresponding to graph nodes */ 51 | sgraph* sg; 52 | Dt_t* hchans; 53 | Dt_t* vchans; 54 | } maze; 55 | 56 | extern maze* mkMaze (graph_t*, int); 57 | extern void freeMaze (maze*); 58 | void updateWts (sgraph* g, cell* cp, sedge* ep); 59 | #ifdef DEBUG 60 | extern int odb_flags; 61 | #define ODB_MAZE 1 62 | #define ODB_SGRAPH 2 63 | #define ODB_ROUTE 4 64 | #define ODB_CHANG 8 65 | #define ODB_IGRAPH 16 66 | #endif 67 | #endif 68 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/ortho/ortho.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef ORTHO_H 15 | #define ORTHO_H 16 | #include 17 | 18 | void orthoEdges (Agraph_t* g, int useLbls); 19 | #endif 20 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/ortho/partition.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef PARTITION_H 15 | #define PARTITION_H 16 | 17 | #include 18 | 19 | extern boxf* partition (cell*, int, int*, boxf); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/ortho/rawgraph.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef RAWGRAPH_H 15 | #define RAWGRAPH_H 16 | 17 | #include 18 | 19 | typedef struct { 20 | int color; 21 | int topsort_order; 22 | Dt_t* adj_list; /* adj_list */ 23 | } vertex; 24 | 25 | typedef struct { 26 | int nvs; 27 | vertex* vertices; 28 | } rawgraph; 29 | 30 | extern rawgraph* make_graph(int n); /* makes a graph wih n vertices, 0 edges */ 31 | extern void free_graph(rawgraph*); 32 | /* inserts edge FROM v1 to v2 */ 33 | extern void insert_edge(rawgraph*, int v1, int v2); 34 | /* removes any edge between v1 to v2 -- irrespective of direction */ 35 | extern void remove_redge(rawgraph*, int v1, int v2); 36 | /* tests if there is an edge FROM v1 TO v2 */ 37 | extern int edge_exists(rawgraph*, int v1, int v2); 38 | /* topologically sorts the directed graph */ 39 | extern void top_sort(rawgraph*); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/ortho/sgraph.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef SEARCH_G_H 15 | #define SEARCH_G_H 16 | 17 | #include "structures.h" 18 | 19 | typedef struct snode snode; 20 | typedef struct sedge sedge; 21 | 22 | struct snode { 23 | int n_val, n_idx; 24 | snode* n_dad; 25 | sedge* n_edge; 26 | short n_adj; 27 | short save_n_adj; 28 | struct cell* cells[2]; 29 | 30 | /* edges incident on this node 31 | * -- stored as indices of the edges array in the graph 32 | */ 33 | int* adj_edge_list; 34 | int index; 35 | boolean isVert; /* true if node corresponds to vertical segment */ 36 | }; 37 | 38 | struct sedge { 39 | double weight; /* weight of edge */ 40 | int cnt; /* paths using edge */ 41 | /* end-points of the edge 42 | * -- stored as indices of the nodes vector in the graph 43 | */ 44 | int v1, v2; 45 | }; 46 | 47 | typedef struct { 48 | int nnodes, nedges; 49 | int save_nnodes, save_nedges; 50 | snode* nodes; 51 | sedge* edges; 52 | } sgraph; 53 | 54 | extern void reset(sgraph*); 55 | extern void gsave(sgraph*); 56 | extern sgraph* createSGraph(int); 57 | extern void freeSGraph (sgraph*); 58 | extern void initSEdges (sgraph* g, int maxdeg); 59 | extern int shortPath (sgraph* g, snode* from, snode* to); 60 | extern snode* createSNode (sgraph*); 61 | extern sedge* createSEdge (sgraph* g, snode* v0, snode* v1, double wt); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/ortho/structures.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef STRUCTURES_H 15 | #define STRUCTURES_H 16 | 17 | #include "types.h" 18 | #include "cgraph.h" 19 | #include "rawgraph.h" 20 | 21 | typedef struct { 22 | double p1, p2; 23 | } paird; 24 | 25 | typedef struct { 26 | int a,b; 27 | } pair; 28 | 29 | typedef struct { 30 | pair t1, t2; 31 | } pair2; 32 | 33 | typedef enum {B_NODE, B_UP, B_LEFT, B_DOWN, B_RIGHT} bend; 34 | 35 | /* Example : segment connecting maze point (3,2) 36 | * and (3,8) has isVert = 1, common coordinate = 3, p1 = 2, p2 = 8 37 | */ 38 | typedef struct segment { 39 | boolean isVert; 40 | boolean flipped; 41 | double comm_coord; /* the common coordinate */ 42 | paird p; /* end points */ 43 | bend l1, l2; 44 | int ind_no; /* index number of this segment in its channel */ 45 | int track_no; /* track number assigned in the channel */ 46 | struct segment* prev; 47 | struct segment* next; 48 | } segment; 49 | 50 | typedef struct { 51 | int n; 52 | segment* segs; 53 | } route; 54 | 55 | typedef struct { 56 | Dtlink_t link; 57 | paird p; /* extrema of channel */ 58 | int cnt; /* number of segments */ 59 | segment** seg_list; /* array of segment pointers */ 60 | rawgraph* G; 61 | struct cell* cp; 62 | } channel; 63 | 64 | #if 0 65 | typedef struct { 66 | int i1, i2, j; 67 | int cnt; 68 | int* seg_list; /* list of indices of the segment list */ 69 | 70 | rawgraph* G; 71 | } hor_channel; 72 | 73 | typedef struct { 74 | hor_channel* hs; 75 | int cnt; 76 | } vhor_channel; 77 | 78 | typedef struct { 79 | int i, j1, j2; 80 | int cnt; 81 | int* seg_list; /* list of indices of the segment list */ 82 | 83 | rawgraph* G; 84 | } vert_channel; 85 | 86 | typedef struct { 87 | vert_channel* vs; 88 | int cnt; 89 | } vvert_channel; 90 | #endif 91 | 92 | #define N_DAD(n) (n)->n_dad 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/ortho/trap.h: -------------------------------------------------------------------------------- 1 | /* $Id$Revision: */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifndef TRAP_H 15 | #define TRAP_H 16 | 17 | /* Segment attributes */ 18 | 19 | typedef struct { 20 | pointf v0, v1; /* two endpoints */ 21 | int is_inserted; /* inserted in trapezoidation yet ? */ 22 | int root0, root1; /* root nodes in Q */ 23 | int next; /* Next logical segment */ 24 | int prev; /* Previous segment */ 25 | } segment_t; 26 | 27 | 28 | /* Trapezoid attributes */ 29 | 30 | typedef struct { 31 | int lseg, rseg; /* two adjoining segments */ 32 | pointf hi, lo; /* max/min y-values */ 33 | int u0, u1; 34 | int d0, d1; 35 | int sink; /* pointer to corresponding in Q */ 36 | int usave, uside; /* I forgot what this means */ 37 | int state; 38 | } trap_t; 39 | 40 | #define ST_VALID 1 /* for trapezium state */ 41 | #define ST_INVALID 2 42 | 43 | #define C_EPS 1.0e-7 /* tolerance value: Used for making */ 44 | /* all decisions about collinearity or */ 45 | /* left/right of segment. Decrease */ 46 | /* this value if the input points are */ 47 | /* spaced very close together */ 48 | #define FP_EQUAL(s, t) (fabs(s - t) <= C_EPS) 49 | 50 | #define _equal_to(v0,v1) \ 51 | (FP_EQUAL((v0)->y, (v1)->y) && FP_EQUAL((v0)->x, (v1)->x)) 52 | 53 | #define _greater_than(v0, v1) \ 54 | (((v0)->y > (v1)->y + C_EPS) ? TRUE : (((v0)->y < (v1)->y - C_EPS) ? FALSE : ((v0)->x > (v1)->x))) 55 | 56 | extern int construct_trapezoids(int, segment_t*, int*, int, trap_t*); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/README: -------------------------------------------------------------------------------- 1 | Spline-o-matic Bezier path planner 2 | David Dobkin, Emden Gansner, Eleftherios Koutsofios, Stephen North 3 | Alpha release 5/16/98 4 | 5 | NOTES 6 | Makefile is for AT&T nmake, available as part of "astkit" at 7 | http://akpublic.research.att.com:9000/sw/tools/reuse/ 8 | The entire build is controlled from the Makefile. 9 | 10 | makefile is for old make (works with GNU) and employs recursive makes. 11 | Edit the configuration in Config.mk (for platform independent 12 | definitions) and makearch/$(ARCH) (for platform dependent definitions). 13 | 14 | The makefiles build the path planner library, and an interactive TCL/tk 15 | front end for demos. To run the interactive demo, the general idea is 16 | to build visitk (an executable that contains tclsh) or Visitk.so 17 | (a dynamic shared library that can be loaded into tclsh) and then 18 | run path.tcl to get the demo. 19 | 20 | The library is still being developed. Our plan is to clean up the 21 | internal interfaces (where data structures are copied and converted 22 | so we could glue in some older code). We also changed the spline 23 | fitter router so that the output spline is not forced to hit all the 24 | points of the input path. We plan to extend the library interface to 25 | let the caller determine which path points must be hit. 26 | 27 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/inpoly.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | /* 15 | * in_poly 16 | * 17 | * Test if a point is inside a polygon. 18 | * The polygon must be convex with vertices in CW order. 19 | */ 20 | 21 | #include 22 | #include "vispath.h" 23 | #include "pathutil.h" 24 | 25 | #ifdef DMALLOC 26 | #include "dmalloc.h" 27 | #endif 28 | 29 | int in_poly(Ppoly_t poly, Ppoint_t q) 30 | { 31 | int i, i1; /* point index; i1 = i-1 mod n */ 32 | int n; 33 | Ppoint_t *P; 34 | 35 | P = poly.ps; 36 | n = poly.pn; 37 | for (i = 0; i < n; i++) { 38 | i1 = (i + n - 1) % n; 39 | if (wind(P[i1],P[i],q) == 1) return FALSE; 40 | } 41 | return TRUE; 42 | } 43 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/pathgeom.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | #ifndef _PATHGEOM_INCLUDE 16 | #define _PATHGEOM_INCLUDE 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #ifdef HAVE_POINTF_S 23 | typedef struct pointf_s Ppoint_t; 24 | typedef struct pointf_s Pvector_t; 25 | #else 26 | typedef struct Pxy_t { 27 | double x, y; 28 | } Pxy_t; 29 | 30 | typedef struct Pxy_t Ppoint_t; 31 | typedef struct Pxy_t Pvector_t; 32 | #endif 33 | 34 | typedef struct Ppoly_t { 35 | Ppoint_t *ps; 36 | int pn; 37 | } Ppoly_t; 38 | 39 | typedef Ppoly_t Ppolyline_t; 40 | 41 | typedef struct Pedge_t { 42 | Ppoint_t a, b; 43 | } Pedge_t; 44 | 45 | /* opaque state handle for visibility graph operations */ 46 | typedef struct vconfig_s vconfig_t; 47 | 48 | void freePath(Ppolyline_t* p); 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/pathplan.def: -------------------------------------------------------------------------------- 1 | LIBRARY "Pathplan" 2 | 3 | 4 | EXPORTS 5 | area2 6 | copypoly 7 | directVis 8 | dist2 9 | freepoly 10 | freePath 11 | in_poly 12 | inBetween 13 | intersect 14 | make_polyline 15 | makePath 16 | Pobsbarriers 17 | Pobsclose 18 | Pobsopen 19 | Pobspath 20 | Ppolybarriers 21 | Proutespline 22 | Pshortestpath 23 | Ptriangulate 24 | ptVis 25 | shortestPath 26 | solve1 27 | solve2 28 | solve3 29 | visibility 30 | wind 31 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/pathplan.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | 16 | #ifndef _PATH_INCLUDE 17 | #define _PATH_INCLUDE 18 | 19 | #include "pathgeom.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | 26 | #if defined(_BLD_pathplan) && defined(__EXPORT__) 27 | # define extern __EXPORT__ 28 | #endif 29 | 30 | /* find shortest euclidean path within a simple polygon */ 31 | extern int Pshortestpath(Ppoly_t * boundary, Ppoint_t endpoints[2], 32 | Ppolyline_t * output_route); 33 | 34 | /* fit a spline to an input polyline, without touching barrier segments */ 35 | extern int Proutespline(Pedge_t * barriers, int n_barriers, 36 | Ppolyline_t input_route, 37 | Pvector_t endpoint_slopes[2], 38 | Ppolyline_t * output_route); 39 | 40 | /* utility function to convert from a set of polygonal obstacles to barriers */ 41 | extern int Ppolybarriers(Ppoly_t ** polys, int npolys, 42 | Pedge_t ** barriers, int *n_barriers); 43 | 44 | /* function to convert a polyline into a spline representation */ 45 | extern void make_polyline(Ppolyline_t line, Ppolyline_t* sline); 46 | 47 | #undef extern 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/pathutil.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | 16 | #ifndef _PATHUTIL_INCLUDE 17 | #define _PATHUTIL_INCLUDE 18 | #define _BLD_pathplan 1 19 | 20 | #include "pathplan.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #ifndef NOT 27 | #define NOT(x) (!(x)) 28 | #endif 29 | #ifndef FALSE 30 | #define FALSE 0 31 | #define TRUE (NOT(FALSE)) 32 | #endif 33 | 34 | /*visual studio*/ 35 | #ifdef WIN32_DLL 36 | #ifdef PATHPLAN_EXPORTS 37 | #define extern __declspec(dllexport) 38 | #else 39 | #define extern __declspec(dllimport) 40 | #endif 41 | #endif 42 | /*end visual studio*/ 43 | typedef double COORD; 44 | extern COORD area2(Ppoint_t, Ppoint_t, Ppoint_t); 45 | extern int wind(Ppoint_t a, Ppoint_t b, Ppoint_t c); 46 | extern COORD dist2(Ppoint_t, Ppoint_t); 47 | extern int intersect(Ppoint_t a, Ppoint_t b, Ppoint_t c, Ppoint_t d); 48 | 49 | int in_poly(Ppoly_t argpoly, Ppoint_t q); 50 | Ppoly_t copypoly(Ppoly_t); 51 | void freepoly(Ppoly_t); 52 | 53 | #undef extern 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | #endif 58 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/solvers.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | 19 | 20 | #ifndef _SOLVERS_INCLUDE 21 | #define _SOLVERS_INCLUDE 22 | 23 | extern int solve3(double *, double *); 24 | extern int solve2(double *, double *); 25 | extern int solve1(double *, double *); 26 | 27 | #endif 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/tri.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | 19 | #include 20 | int Ptriangulate(Ppoly_t * polygon, 21 | void (*fn) (void *closure, Ppoint_t tri[]), 22 | void *vc); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/util.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | #include 16 | #include 17 | #include "pathutil.h" 18 | 19 | #ifdef DMALLOC 20 | #include "dmalloc.h" 21 | #endif 22 | 23 | #define ALLOC(size,ptr,type) (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type))) 24 | 25 | Ppoly_t copypoly(Ppoly_t argpoly) 26 | { 27 | Ppoly_t rv; 28 | int i; 29 | 30 | rv.pn = argpoly.pn; 31 | rv.ps = malloc(sizeof(Ppoint_t) * argpoly.pn); 32 | for (i = 0; i < argpoly.pn; i++) 33 | rv.ps[i] = argpoly.ps[i]; 34 | return rv; 35 | } 36 | 37 | void freePath(Ppolyline_t* p) 38 | { 39 | free(p->ps); 40 | free(p); 41 | } 42 | 43 | void freepoly(Ppoly_t argpoly) 44 | { 45 | free(argpoly.ps); 46 | } 47 | 48 | int Ppolybarriers(Ppoly_t ** polys, int npolys, Pedge_t ** barriers, 49 | int *n_barriers) 50 | { 51 | Ppoly_t pp; 52 | int i, j, k, n, b; 53 | Pedge_t *bar; 54 | 55 | n = 0; 56 | for (i = 0; i < npolys; i++) 57 | n = n + polys[i]->pn; 58 | 59 | bar = malloc(n * sizeof(Pedge_t)); 60 | 61 | b = 0; 62 | for (i = 0; i < npolys; i++) { 63 | pp = *polys[i]; 64 | for (j = 0; j < pp.pn; j++) { 65 | k = j + 1; 66 | if (k >= pp.pn) 67 | k = 0; 68 | bar[b].a = pp.ps[j]; 69 | bar[b].b = pp.ps[k]; 70 | b++; 71 | } 72 | } 73 | assert(b == n); 74 | *barriers = bar; 75 | *n_barriers = n; 76 | return 1; 77 | } 78 | 79 | /* make_polyline: 80 | */ 81 | void 82 | make_polyline(Ppolyline_t line, Ppolyline_t* sline) 83 | { 84 | static int isz = 0; 85 | static Ppoint_t* ispline = 0; 86 | int i, j; 87 | int npts = 4 + 3*(line.pn-2); 88 | 89 | if (npts > isz) { 90 | ispline = ALLOC(npts, ispline, Ppoint_t); 91 | isz = npts; 92 | } 93 | 94 | j = i = 0; 95 | ispline[j+1] = ispline[j] = line.ps[i]; 96 | j += 2; 97 | i++; 98 | for (; i < line.pn-1; i++) { 99 | ispline[j+2] = ispline[j+1] = ispline[j] = line.ps[i]; 100 | j += 3; 101 | } 102 | ispline[j+1] = ispline[j] = line.ps[i]; 103 | 104 | sline->pn = npts; 105 | sline->ps = ispline; 106 | } 107 | 108 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/vis.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | #ifndef VISIBILITY_H 16 | #define VISIBILITY_H 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "vispath.h" 23 | #include "pathutil.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef COORD **array2; 30 | 31 | #define OBSCURED 0.0 32 | #define EQ(p,q) ((p.x == q.x) && (p.y == q.y)) 33 | #define NEQ(p,q) (!EQ(p,q)) 34 | #define NIL(p) ((p)0) 35 | #define CW 0 36 | #define CCW 1 37 | 38 | struct vconfig_s { 39 | int Npoly; 40 | int N; /* number of points in walk of barriers */ 41 | Ppoint_t *P; /* barrier points */ 42 | int *start; 43 | int *next; 44 | int *prev; 45 | 46 | /* this is computed from the above */ 47 | array2 vis; 48 | }; 49 | #ifdef WIN32_DLL 50 | #ifndef PATHPLAN_EXPORTS 51 | #define extern __declspec(dllimport) 52 | #endif 53 | #endif 54 | /*end visual studio*/ 55 | 56 | extern COORD *ptVis(vconfig_t *, int, Ppoint_t); 57 | extern int directVis(Ppoint_t, int, Ppoint_t, int, vconfig_t *); 58 | extern void visibility(vconfig_t *); 59 | extern int *makePath(Ppoint_t p, int pp, COORD * pvis, 60 | Ppoint_t q, int qp, COORD * qvis, 61 | vconfig_t * conf); 62 | 63 | #undef extern 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | #endif 69 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/lib/pathplan/vispath.h: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | 16 | #ifndef _VIS_INCLUDE 17 | #define _VIS_INCLUDE 18 | 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #if defined(_BLD_pathplan) && defined(__EXPORT__) 26 | # define extern __EXPORT__ 27 | #endif 28 | 29 | /* open a visibility graph 30 | * Points in polygonal obstacles must be in clockwise order. 31 | */ 32 | extern vconfig_t *Pobsopen(Ppoly_t ** obstacles, int n_obstacles); 33 | 34 | /* close a visibility graph, freeing its storage */ 35 | extern void Pobsclose(vconfig_t * config); 36 | 37 | /* route a polyline from p0 to p1, avoiding obstacles. 38 | * if an endpoint is inside an obstacle, pass the polygon's index >=0 39 | * if the endpoint is not inside an obstacle, pass POLYID_NONE 40 | * if the endpoint location is not known, pass POLYID_UNKNOWN 41 | */ 42 | 43 | extern int Pobspath(vconfig_t * config, Ppoint_t p0, int poly0, 44 | Ppoint_t p1, int poly1, 45 | Ppolyline_t * output_route); 46 | 47 | #define POLYID_NONE -1111 48 | #define POLYID_UNKNOWN -2222 49 | 50 | #undef extern 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/plugin/core/gvplugin_core.def: -------------------------------------------------------------------------------- 1 | LIBRARY "gvplugin_core" 2 | EXPORTS 3 | gvplugin_core_LTX_library 4 | 5 | 6 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/plugin/dot_layout/gvlayout_dot_layout.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | 15 | #ifdef HAVE_CONFIG_H 16 | #include "config.h" 17 | #endif 18 | 19 | #include "gvplugin_layout.h" 20 | 21 | typedef enum { LAYOUT_DOT, } layout_type; 22 | 23 | #ifdef WIN32 /*dependencies*/ 24 | #ifndef NO_PRAGMA_LINKING 25 | #pragma comment( lib, "gvc.lib" ) 26 | #pragma comment( lib, "ingraphs.lib" ) 27 | #pragma comment( lib, "cdt.lib" ) 28 | #pragma comment( lib, "gvortho.lib" ) 29 | #pragma comment( lib, "cgraph.lib" ) 30 | #pragma comment( lib, "dotgen.lib" ) 31 | #endif 32 | #endif 33 | 34 | extern void dot_layout(graph_t * g); 35 | extern void dot_cleanup(graph_t * g); 36 | 37 | gvlayout_engine_t dotgen_engine = { 38 | dot_layout, 39 | dot_cleanup, 40 | }; 41 | 42 | 43 | gvlayout_features_t dotgen_features = { 44 | LAYOUT_USES_RANKDIR, 45 | }; 46 | 47 | gvplugin_installed_t gvlayout_dot_layout[] = { 48 | {LAYOUT_DOT, "dot", 0, &dotgen_engine, &dotgen_features}, 49 | {0, NULL, 0, NULL, NULL} 50 | }; 51 | -------------------------------------------------------------------------------- /libcgraphviz/graphviz-2.38.0/plugin/dot_layout/gvplugin_dot_layout.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #include "gvplugin.h" 15 | 16 | extern gvplugin_installed_t gvlayout_dot_layout[]; 17 | 18 | static gvplugin_api_t apis[] = { 19 | {API_layout, gvlayout_dot_layout}, 20 | {(api_t)0, 0}, 21 | }; 22 | /*visual studio*/ 23 | #ifdef WIN32_DLL 24 | #ifndef GVPLUGIN_DOT_LAYOUT_EXPORTS 25 | __declspec(dllimport) gvplugin_library_t gvplugin_dot_layout_LTX_library = { "dot_layout", apis }; 26 | #else 27 | __declspec(dllexport) gvplugin_library_t gvplugin_dot_layout_LTX_library = { "dot_layout", apis }; 28 | #endif 29 | #endif 30 | 31 | 32 | 33 | /*end visual studio*/ 34 | 35 | 36 | #ifndef WIN32_DLL 37 | #ifdef GVDLL 38 | __declspec(dllexport) gvplugin_library_t gvplugin_dot_layout_LTX_library = { "dot_layout", apis }; 39 | #else 40 | gvplugin_library_t gvplugin_dot_layout_LTX_library = { "dot_layout", apis }; 41 | #endif 42 | #endif 43 | 44 | 45 | -------------------------------------------------------------------------------- /libcgraphviz/libcgraphviz_dot_builtins.c: -------------------------------------------------------------------------------- 1 | /* $Id$ $Revision$ */ 2 | /* vim:set shiftwidth=4 ts=8: */ 3 | 4 | /************************************************************************* 5 | * Copyright (c) 2011 AT&T Intellectual Property 6 | * All rights reserved. This program and the accompanying materials 7 | * are made available under the terms of the Eclipse Public License v1.0 8 | * which accompanies this distribution, and is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 | *************************************************************************/ 13 | 14 | #ifdef HAVE_CONFIG_H 15 | #include "config.h" 16 | #endif 17 | 18 | #include "gvplugin.h" 19 | #include "gvc.h" 20 | 21 | extern gvplugin_library_t gvplugin_dot_layout_LTX_library; 22 | extern gvplugin_library_t gvplugin_neato_layout_LTX_library; 23 | #ifdef HAVE_LIBGD 24 | extern gvplugin_library_t gvplugin_gd_LTX_library; 25 | #endif 26 | #ifdef HAVE_PANGOCAIRO 27 | extern gvplugin_library_t gvplugin_pango_LTX_library; 28 | #ifdef HAVE_WEBP 29 | extern gvplugin_library_t gvplugin_webp_LTX_library; 30 | #endif 31 | #endif 32 | extern gvplugin_library_t gvplugin_core_LTX_library; 33 | 34 | 35 | lt_symlist_t lt_preloaded_symbols[] = { 36 | { "gvplugin_dot_layout_LTX_library", (void*)(&gvplugin_dot_layout_LTX_library) }, 37 | //{ "gvplugin_neato_layout_LTX_library", (void*)(&gvplugin_neato_layout_LTX_library) }, 38 | #ifdef HAVE_PANGOCAIRO 39 | { "gvplugin_pango_LTX_library", (void*)(&gvplugin_pango_LTX_library) }, 40 | #ifdef HAVE_WEBP 41 | { "gvplugin_webp_LTX_library", (void*)(&gvplugin_webp_LTX_library) }, 42 | #endif 43 | #endif 44 | #ifdef HAVE_LIBGD 45 | { "gvplugin_gd_LTX_library", (void*)(&gvplugin_gd_LTX_library) }, 46 | #endif 47 | { "gvplugin_core_LTX_library", (void*)(&gvplugin_core_LTX_library) }, 48 | { 0, 0 } 49 | }; 50 | -------------------------------------------------------------------------------- /statemachineviewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | if(WIN32) 3 | add_definitions(-DMAKE_GAMMARAY_LIB) 4 | endif() 5 | 6 | 7 | set(GRAPHVIZ_MAJOR_VERSION ${LIBCGRAPHVIZ_MAJOR_VERSION}) 8 | set(GRAPHVIZ_MINOR_VERSION ${LIBCGRAPHVIZ_MINOR_VERSION}) 9 | set(GRAPHVIZ_PATCH_VERSION ${LIBCGRAPHVIZ_PATCH_VERSION}) 10 | set(GRAPHVIZ_GRAPH_LIBRARY ${LIBCGRAPHVIZ_LIBRARY}) 11 | set(GRAPHVIZ_INCLUDE_DIR ${LIBCGRAPHVIZ_INCLUDE_DIR}) 12 | set(GRAPHVIZ_FOUND 1) 13 | set(GRAPHVIZ_GVC_LIBRARY "") 14 | set(GRAPHVIZ_EMBEDDED 1) 15 | 16 | add_definitions(-DGRAPHVIZ_MAJOR_VERSION=${GRAPHVIZ_MAJOR_VERSION} -DGRAPHVIZ_MINOR_VERSION=${GRAPHVIZ_MINOR_VERSION}) 17 | add_definitions(${LIBCGRAPHVIZ_DEFINITIONS}) 18 | 19 | add_definitions(-DGAMMARAY_GRAPHVIZ_EMBEDDED -DMAKE_GAMMARAY_LIB) 20 | add_definitions(${GRAPHVIZ_COMPILE_FLAGS}) 21 | 22 | include_directories(${GRAPHVIZ_INCLUDE_DIR} ${GRAPHVIZ_INCLUDE_DIR}/graphviz ${CMAKE_CURRENT_BINARY_DIR} ${smvdir}) 23 | 24 | file(GLOB sources ${smvdir}/*.cpp) 25 | file(GLOB gvsources ${smvdir}/gvgraph/*.cpp) 26 | 27 | file(GLOB headers ${smvdir}/*.h) 28 | file(GLOB gvheaders ${smvdir}/gvgraph/*.h) 29 | 30 | 31 | qt_moc(moced ${headers}) 32 | qt_uic(uiced ${smvdir}/statemachineviewer.ui) 33 | 34 | source_group("Generated Files" FILES ${moced} ${uiced}) 35 | 36 | list(REMOVE_ITEM sources ${smvdir}/test_main.cpp) 37 | 38 | add_library(statemachineviewer SHARED ${sources} ${headers} ${gvsources} ${gvheaders} ${moced} ${uiced}) 39 | set(linklibs ${GRAPHVIZ_GRAPH_LIBRARY} ${qtlibs}) 40 | target_link_libraries(statemachineviewer ${linklibs}) 41 | 42 | 43 | if(test) 44 | add_executable(statemachineviewer_test 45 | gvgraph/gvgraph.cpp 46 | gvgraph/gvgraphitems.cpp 47 | gvgraph/gvutils.cpp 48 | test_main.cpp) 49 | target_link_libraries(statemachineviewer_test ${linklibs}) 50 | endif() 51 | -------------------------------------------------------------------------------- /statemachineviewer/deferredresizemodesetter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | deferredresizemodesetter.cpp 3 | 4 | This file is part of GammaRay, the Qt application inspection and 5 | manipulation tool. 6 | 7 | Copyright (C) 2013-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 8 | Author: Volker Krause 9 | 10 | This program is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | */ 23 | 24 | #include "deferredresizemodesetter.h" 25 | 26 | using namespace GammaRay; 27 | 28 | DeferredResizeModeSetter::DeferredResizeModeSetter(QHeaderView* headerView, int section, QHeaderView::ResizeMode resizeMode): 29 | QObject(headerView), 30 | m_view(headerView), 31 | m_section(section), 32 | m_resizeMode(resizeMode) 33 | { 34 | connect(m_view, SIGNAL(sectionCountChanged(int,int)), SLOT(setSectionResizeMode())); 35 | setSectionResizeMode(); 36 | } 37 | 38 | DeferredResizeModeSetter::~DeferredResizeModeSetter() 39 | { 40 | } 41 | 42 | void DeferredResizeModeSetter::setSectionResizeMode() 43 | { 44 | if (m_view->count() <= m_section) 45 | return; // section not loaded yet 46 | 47 | #ifdef QT5 48 | m_view->setSectionResizeMode(m_section, m_resizeMode); 49 | #else 50 | m_view->setResizeMode(m_section, m_resizeMode); 51 | #endif 52 | } 53 | 54 | -------------------------------------------------------------------------------- /statemachineviewer/deferredresizemodesetter.h: -------------------------------------------------------------------------------- 1 | /* 2 | deferredresizemodesetter.h 3 | 4 | This file is part of GammaRay, the Qt application inspection and 5 | manipulation tool. 6 | 7 | Copyright (C) 2013-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 8 | Author: Volker Krause 9 | 10 | This program is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | */ 23 | 24 | #ifndef GAMMARAY_DEFERREDRESIZEMODESETTER_H 25 | #define GAMMARAY_DEFERREDRESIZEMODESETTER_H 26 | 27 | #include "gammaray_export.h" 28 | 29 | #include 30 | #include 31 | 32 | namespace GammaRay { 33 | 34 | /** @brief Sets the resize mode on a QHeaderView section once that section is actually available. 35 | * 36 | * This is a workaround for QHeaderView asserting when manipulating if the corresponding section 37 | * hasn't been loaded yet by the corresponding model, as well as forgetting the setting if the 38 | * model reports a columnCount of 0 again inbetween. 39 | */ 40 | class GAMMARAY_EXPORT DeferredResizeModeSetter : public QObject 41 | { 42 | Q_OBJECT 43 | public: 44 | DeferredResizeModeSetter(QHeaderView *headerView, int section, QHeaderView::ResizeMode resizeMode); 45 | ~DeferredResizeModeSetter(); 46 | 47 | private slots: 48 | void setSectionResizeMode(); 49 | 50 | private: 51 | QHeaderView *m_view; 52 | int m_section; 53 | QHeaderView::ResizeMode m_resizeMode; 54 | }; 55 | 56 | } 57 | 58 | #endif // GAMMARAY_DEFERREDRESIZEMODESETTER_H 59 | -------------------------------------------------------------------------------- /statemachineviewer/deferredtreeviewconfiguration.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | deferredtreeviewconfiguration.cpp 3 | 4 | This file is part of GammaRay, the Qt application inspection and 5 | manipulation tool. 6 | 7 | Copyright (C) 2013-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 8 | Author: Milian Wolff 9 | 10 | This program is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | */ 23 | 24 | #include "deferredtreeviewconfiguration.h" 25 | 26 | #include 27 | #include 28 | 29 | using namespace GammaRay; 30 | using namespace std; 31 | 32 | DeferredTreeViewConfiguration::DeferredTreeViewConfiguration(QTreeView *view, bool expandNewContent, bool selectNewContent, QObject *parent) 33 | : QObject(parent ? parent : view) 34 | , m_view(view) 35 | , m_expand(expandNewContent) 36 | , m_select(selectNewContent) 37 | { 38 | Q_ASSERT(view); 39 | Q_ASSERT(view->model()); 40 | Q_ASSERT(view->selectionModel()); 41 | 42 | connect(view->model(), SIGNAL(rowsInserted(QModelIndex,int,int)), 43 | SLOT(rowsInserted(QModelIndex))); 44 | connect(view->model(), SIGNAL(columnsInserted(QModelIndex,int,int)), 45 | SLOT(columnsInserted(QModelIndex))); 46 | 47 | if (view->model()->rowCount() > 0) { 48 | rowsInserted(QModelIndex()); 49 | if (m_expand) { 50 | view->expandAll(); 51 | } 52 | } 53 | columnsInserted(QModelIndex()); 54 | } 55 | 56 | void DeferredTreeViewConfiguration::hideColumn(int column) 57 | { 58 | m_hiddenColumns << column; 59 | 60 | columnsInserted(QModelIndex()); 61 | } 62 | 63 | void DeferredTreeViewConfiguration::rowsInserted(const QModelIndex &parent) 64 | { 65 | if (m_expand) { 66 | m_view->expand(parent); 67 | } 68 | if (m_select && !m_view->currentIndex().isValid()) { 69 | m_view->selectionModel()->setCurrentIndex(m_view->model()->index(0, 0), QItemSelectionModel::ClearAndSelect); 70 | } 71 | } 72 | 73 | void DeferredTreeViewConfiguration::columnsInserted(const QModelIndex &parent) 74 | { 75 | if (m_hiddenColumns.isEmpty() || parent.isValid()) { 76 | return; 77 | } 78 | 79 | const int columns = m_view->model()->columnCount(parent); 80 | foreach(int column, m_hiddenColumns) { 81 | if (column < columns) { 82 | m_view->hideColumn(column); 83 | } 84 | } 85 | } 86 | 87 | -------------------------------------------------------------------------------- /statemachineviewer/deferredtreeviewconfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | deferredtreeviewconfiguration.h 3 | 4 | This file is part of GammaRay, the Qt application inspection and 5 | manipulation tool. 6 | 7 | Copyright (C) 2013-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 8 | Author: Milian Wolff 9 | 10 | This program is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | */ 23 | 24 | #ifndef GAMMARAY_DEFERREDTREEVIEWCONFIGURATION_H 25 | #define GAMMARAY_DEFERREDTREEVIEWCONFIGURATION_H 26 | 27 | #include "gammaray_export.h" 28 | 29 | #include 30 | #include 31 | 32 | class QModelIndex; 33 | class QTreeView; 34 | 35 | namespace GammaRay { 36 | 37 | /** 38 | * @brief A utility helper to configure views for remote content. 39 | * 40 | * When @p expandNewContent is set to true, the tree view will stay expanded 41 | * when new content is added to the model. 42 | * 43 | * When @p selectNewContent is set to true, the tree view will select new content, 44 | * if no selection is already present. 45 | * 46 | * @note The tree view's model and selectionModel must be set beforehand and not 47 | * be changed afterwards! 48 | */ 49 | class GAMMARAY_EXPORT DeferredTreeViewConfiguration : public QObject 50 | { 51 | Q_OBJECT 52 | public: 53 | explicit DeferredTreeViewConfiguration(QTreeView *view, 54 | bool expandNewContent = true, bool selectNewContent = true, 55 | QObject *parent = 0); 56 | 57 | void hideColumn(int column); 58 | 59 | private slots: 60 | void rowsInserted(const QModelIndex &parent); 61 | void columnsInserted(const QModelIndex &parent); 62 | 63 | private: 64 | QTreeView *m_view; 65 | bool m_expand; 66 | bool m_select; 67 | QVector m_hiddenColumns; 68 | }; 69 | 70 | } 71 | 72 | #endif // GAMMARAY_DEFERREDTREEVIEWCONFIGURATION_H 73 | -------------------------------------------------------------------------------- /statemachineviewer/gammaray_export.h: -------------------------------------------------------------------------------- 1 | /* 2 | gammaray_ui_export.h 3 | 4 | This file is part of GammaRay, the Qt application inspection and 5 | manipulation tool. 6 | 7 | Copyright (C) 2012-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 8 | Author: Kevin Funk 9 | 10 | This program is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | */ 23 | 24 | #ifndef GAMMARAY_EXPORT_H 25 | #define GAMMARAY_EXPORT_H 26 | 27 | #include 28 | 29 | #ifdef GAMMARAY_STATICLIB 30 | # undef GAMMARAY_SHAREDLIB 31 | # define GAMMARAY_EXPORT 32 | #else 33 | # ifdef MAKE_GAMMARAY_LIB 34 | # define GAMMARAY_EXPORT Q_DECL_EXPORT 35 | # else 36 | # define GAMMARAY_EXPORT Q_DECL_IMPORT 37 | # endif 38 | #endif 39 | 40 | #endif /* GAMMARAY_UI_EXPORT_H */ 41 | -------------------------------------------------------------------------------- /statemachineviewer/gammaray_statemachineviewer.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=State Machines 3 | X-GammaRay-Types=QAbstractState; 4 | X-GammaRay-ServiceTypes=com.kdab.GammaRay.ToolFactory 5 | Exec=gammaray_statemachineviewer_plugin 6 | -------------------------------------------------------------------------------- /statemachineviewer/gammaray_statemachineviewer_ui.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | X-GammaRay-Id=gammaray_statemachineviewer 3 | X-GammaRay-ServiceTypes=com.kdab.GammaRay.ToolUiFactory 4 | Exec=gammaray_statemachineviewer_ui_plugin 5 | -------------------------------------------------------------------------------- /statemachineviewer/gvgraph/gvtypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Kevin Funk 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef GAMMARAY_GVTYPES_H 23 | #define GAMMARAY_GVTYPES_H 24 | 25 | #include 26 | 27 | namespace GammaRay { 28 | 29 | typedef quintptr ElementId; 30 | typedef quintptr EdgeId; 31 | typedef quintptr NodeId; 32 | typedef quintptr GraphId; 33 | 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /statemachineviewer/gvgraph/gvutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Kevin Funk 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef GAMMARAY_GVUTILS_H 23 | #define GAMMARAY_GVUTILS_H 24 | 25 | #ifdef GAMMARAY_GRAPHVIZ_EMBEDDED 26 | #include "types.h" 27 | #include "cgraph.h" 28 | #include "gvc.h" 29 | #else 30 | 31 | #include 32 | #ifdef WITH_CGRAPH 33 | # include 34 | #else 35 | # include 36 | #endif 37 | #endif 38 | 39 | #include 40 | 41 | namespace GammaRay { 42 | 43 | namespace GVUtils { 44 | 45 | /// The agopen method for opening a graph 46 | #ifdef WITH_CGRAPH 47 | extern Agraph_t *_agopen(const QString &name, Agdesc_t kind, Agdisc_t *disc); 48 | #else 49 | extern Agraph_t *_agopen(const QString &name, int kind); 50 | #endif 51 | 52 | /// Add an alternative value parameter to the method for getting an object's attribute 53 | QString _agget(void *object, const QString &attr, const QString& alt = QString()); 54 | 55 | Agsym_t *_agnodeattr(Agraph_t *object, const QString &attr, 56 | const QString &alt = QString()); 57 | Agsym_t *_agedgeattr(Agraph_t *object, const QString &attr, 58 | const QString &alt = QString()); 59 | 60 | int _gvLayout(GVC_t *gvc, graph_t *g, const char *engine); 61 | 62 | Agnode_t *_agnode(Agraph_t *graph, const QString &attr, bool create = true); 63 | Agedge_t *_agedge(Agraph_t *graph, Agnode_t *tail, Agnode_t *head, 64 | const QString &name = QString(), bool create = true); 65 | Agraph_t *_agsubg(Agraph_t *graph, const QString &attr, bool create = true); 66 | 67 | /// Directly use agsafeset which always works, contrarily to agset 68 | int _agset(void* object, const QString& attr, const QString& value); 69 | 70 | } 71 | 72 | } 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /statemachineviewer/objectmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | objectmodel.h 3 | 4 | This file is part of GammaRay, the Qt application inspection and 5 | manipulation tool. 6 | 7 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 8 | Author: Volker Krause 9 | 10 | This program is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | */ 23 | /** 24 | @file 25 | This file is part of the GammaRay Plugin API and declares the public object model roles. 26 | 27 | @brief 28 | Declares the public object model roles. 29 | 30 | @author Volker Krause \ 31 | */ 32 | 33 | #ifndef GAMMARAY_OBJECTMODEL_H 34 | #define GAMMARAY_OBJECTMODEL_H 35 | 36 | #include 37 | 38 | namespace GammaRay { 39 | 40 | /** 41 | * @brief GammaRay Object Models. 42 | * 43 | * Public object model roles, for use by tool plugins without needing access 44 | * to the real object model classes. 45 | */ 46 | namespace ObjectModel { 47 | 48 | /** Role enum, to be used with the object list and tree models. */ 49 | enum Role { 50 | // Qt4 uses 32, Qt5 256, for Qt::UserRole - use the latter globally to allow combining Qt4/5 client/servers. 51 | ObjectRole = 256 + 1, /**< the Object role */ 52 | UserRole /**< the UserRole, as defined by Qt */ 53 | }; 54 | } 55 | 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /statemachineviewer/statemachineview.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Kevin Funk 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "statemachineview.h" 23 | 24 | #include 25 | 26 | using namespace GammaRay; 27 | 28 | StateMachineView::StateMachineView(QWidget *parent) 29 | : QGraphicsView(parent) 30 | { 31 | } 32 | 33 | StateMachineView::StateMachineView(QGraphicsScene *scene, QWidget *parent) 34 | : QGraphicsView(scene, parent) 35 | { 36 | } 37 | 38 | void StateMachineView::zoomBy(qreal scaleFactor) 39 | { 40 | scale(scaleFactor, scaleFactor); 41 | } 42 | 43 | void StateMachineView::wheelEvent(QWheelEvent *event) 44 | { 45 | const qreal step = qAbs(event->delta() / 100.0); 46 | const qreal zoomFactor = event->delta() >= 0 ? step : 1.0f / step ; 47 | zoomBy(zoomFactor); 48 | event->accept(); 49 | } 50 | -------------------------------------------------------------------------------- /statemachineviewer/statemachineview.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Kevin Funk 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef GAMMARAY_STATEMACHINEVIEWER_STATEMACHINEVIEW_H 23 | #define GAMMARAY_STATEMACHINEVIEWER_STATEMACHINEVIEW_H 24 | 25 | #include 26 | 27 | namespace GammaRay { 28 | 29 | class StateMachineView : public QGraphicsView 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit StateMachineView(QWidget *parent = 0); 34 | explicit StateMachineView(QGraphicsScene *scene, QWidget *parent = 0); 35 | 36 | public Q_SLOTS: 37 | void zoomBy(qreal scaleFactor); 38 | 39 | protected: 40 | virtual void wheelEvent(QWheelEvent *event); 41 | }; 42 | 43 | } 44 | 45 | #endif // GAMMARAY_STATEMACHINEVIEW_H 46 | -------------------------------------------------------------------------------- /statemachineviewer/statemachineviewer.cpp: -------------------------------------------------------------------------------- 1 | #include "statemachineviewer.h" 2 | #include "statemachineviewerserver.h" 3 | #include "statemachineviewerwidget.h" 4 | 5 | 6 | StateMachineViewer::StateMachineViewer(QWidget *parent, bool left2right) : 7 | GammaRay::StateMachineViewerWidget(left2right, new GammaRay::StateMachineViewerServer, parent) 8 | { 9 | setWindowTitle(QLatin1String("StateMachineViewer")); 10 | } 11 | 12 | StateMachineViewer::~StateMachineViewer() 13 | { 14 | delete m_interface; 15 | } 16 | 17 | void StateMachineViewer::setStateMachine(QStateMachine* sm) 18 | { 19 | m_interface->setSelectedStateMachine(sm); 20 | if (!sm->objectName().isEmpty()) { 21 | setWindowTitle(QString(QLatin1String("State machine: '%1'")).arg(sm->objectName())); 22 | } 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /statemachineviewer/statemachineviewer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "statemachineviewerwidget.h" 4 | 5 | class GAMMARAY_EXPORT StateMachineViewer : public GammaRay::StateMachineViewerWidget 6 | { 7 | public: 8 | StateMachineViewer(QWidget *parent = 0, bool left2right = false); 9 | 10 | ~StateMachineViewer(); 11 | 12 | void setStateMachine(QStateMachine*); 13 | }; 14 | 15 | -------------------------------------------------------------------------------- /statemachineviewer/statemachineviewerclient.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2013-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Milian Wolff 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "statemachineviewerclient.h" 23 | 24 | using namespace GammaRay; 25 | 26 | StateMachineViewerClient::StateMachineViewerClient(QObject *parent) 27 | : StateMachineViewerInterface(parent) 28 | { 29 | 30 | } 31 | 32 | void StateMachineViewerClient::setMaximumDepth(int depth) 33 | { 34 | //Endpoint::instance()->invokeObject(objectName(), "setMaximumDepth", QVariantList() << depth); 35 | } 36 | 37 | void StateMachineViewerClient::toggleRunning() 38 | { 39 | //Endpoint::instance()->invokeObject(objectName(), "toggleRunning"); 40 | } 41 | 42 | void StateMachineViewerClient::repopulateGraph() 43 | { 44 | //Endpoint::instance()->invokeObject(objectName(), "repopulateGraph"); 45 | } 46 | -------------------------------------------------------------------------------- /statemachineviewer/statemachineviewerclient.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2013-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Milian Wolff 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef GAMMARAY_STATEMACHINEVIEWERCLIENT_H 23 | #define GAMMARAY_STATEMACHINEVIEWERCLIENT_H 24 | 25 | #include "statemachineviewerinterface.h" 26 | 27 | namespace GammaRay { 28 | 29 | class StateMachineViewerClient : public StateMachineViewerInterface 30 | { 31 | Q_OBJECT 32 | Q_INTERFACES(GammaRay::StateMachineViewerInterface) 33 | public: 34 | explicit StateMachineViewerClient(QObject *parent = 0); 35 | 36 | void setMaximumDepth(int depth); 37 | void toggleRunning(); 38 | void repopulateGraph(); 39 | }; 40 | 41 | } 42 | 43 | #endif // GAMMARAY_STATEMACHINEVIEWERCLIENT_H 44 | -------------------------------------------------------------------------------- /statemachineviewer/statemachineviewerinterface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2013-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Milian Wolff 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "statemachineviewerinterface.h" 23 | 24 | using namespace GammaRay; 25 | 26 | StateMachineViewerInterface::StateMachineViewerInterface(QObject *parent) 27 | : QObject(parent) 28 | { 29 | qRegisterMetaType(); 30 | qRegisterMetaTypeStreamOperators(); 31 | qRegisterMetaType(); 32 | qRegisterMetaTypeStreamOperators(); 33 | qRegisterMetaType(); 34 | qRegisterMetaTypeStreamOperators(); 35 | qRegisterMetaType(); 36 | qRegisterMetaTypeStreamOperators(); 37 | } 38 | 39 | StateMachineViewerInterface::~StateMachineViewerInterface() 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /statemachineviewer/statemachineviewerutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Kevin Funk 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef GAMMARAY_STATEMACHINEVIEWER_STATEMACHINEVIEWERUTIL_H 23 | #define GAMMARAY_STATEMACHINEVIEWER_STATEMACHINEVIEWERUTIL_H 24 | 25 | #include 26 | 27 | template 28 | class RingBuffer 29 | { 30 | public: 31 | RingBuffer() : m_size(5) 32 | { 33 | } 34 | 35 | void resize(int size) 36 | { 37 | Q_ASSERT(size > 0); 38 | m_size = size; 39 | cleanup(); 40 | } 41 | 42 | void enqueue(T t) 43 | { 44 | m_entries.enqueue(t); 45 | cleanup(); 46 | } 47 | 48 | void clear() 49 | { 50 | m_entries.clear(); 51 | } 52 | 53 | int size() const 54 | { 55 | return m_entries.size(); 56 | } 57 | 58 | T tail() const 59 | { 60 | return m_entries.last(); 61 | } 62 | 63 | QList entries() const 64 | { 65 | return m_entries; 66 | } 67 | 68 | private: 69 | void cleanup() 70 | { 71 | while (m_entries.size() > m_size) { 72 | m_entries.dequeue(); 73 | } 74 | } 75 | 76 | QQueue m_entries; 77 | int m_size; 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /statemachineviewer/statemachinewatcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Kevin Funk 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef GAMMARAY_STATEMACHINEVIEWER_STATEMACHINEWATCHER_H 23 | #define GAMMARAY_STATEMACHINEVIEWER_STATEMACHINEWATCHER_H 24 | 25 | #include 26 | #include 27 | 28 | class QAbstractState; 29 | class QAbstractState; 30 | class QAbstractTransition; 31 | class QState; 32 | class QStateMachine; 33 | 34 | namespace GammaRay { 35 | 36 | class StateMachineWatcher : public QObject 37 | { 38 | Q_OBJECT 39 | public: 40 | explicit StateMachineWatcher(QObject *parent = 0); 41 | virtual ~StateMachineWatcher(); 42 | 43 | void setWatchedStateMachine(QStateMachine *machine); 44 | QStateMachine *watchedStateMachine() const; 45 | 46 | Q_SIGNALS: 47 | void stateEntered(QAbstractState *state); 48 | void stateExited(QAbstractState *state); 49 | 50 | void transitionTriggered(QAbstractTransition*); 51 | 52 | void watchedStateMachineChanged(QStateMachine *); 53 | 54 | private Q_SLOTS: 55 | void watchState(QAbstractState *state); 56 | void clearWatchedStates(); 57 | 58 | void handleStateEntered(); 59 | void handleStateExited(); 60 | void handleStateDestroyed(); 61 | void handleTransitionTriggered(); 62 | 63 | private: 64 | QStateMachine *m_watchedStateMachine; 65 | QVector m_watchedStates; 66 | 67 | QAbstractState *m_lastEnteredState; 68 | QAbstractState *m_lastExitedState; 69 | }; 70 | 71 | } 72 | 73 | #endif // GAMMARAY_STATEMACHINEWATCHER_H 74 | -------------------------------------------------------------------------------- /statemachineviewer/test_main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of GammaRay, the Qt application inspection and 3 | manipulation tool. 4 | 5 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 6 | Author: Kevin Funk 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "gvgraph/gvgraph.h" 23 | #include "gvgraph/gvgraphitems.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | using namespace GammaRay; 30 | 31 | int main(int argc, char *argv[]) 32 | { 33 | QApplication app(argc, argv); 34 | 35 | // build data 36 | GVGraph *graph = new GVGraph("Graph"); 37 | NodeId nid1 = graph->addNode("Node1"); 38 | 39 | GraphId gid1 = graph->addGraph("SubGraph1"); 40 | NodeId nid2 = graph->addNode("Node2", gid1); 41 | NodeId nid3 = graph->addNode("Node3", gid1); 42 | 43 | EdgeId eid1 = graph->addEdge(nid1, nid2, "Edge1"); 44 | graph->setEdgeAttribute(eid1, "label", "Edge1"); 45 | EdgeId eid2 = graph->addEdge(nid2, nid3, "Edge2"); 46 | graph->setEdgeAttribute(eid2, "label", "Edge2"); 47 | EdgeId eid3 = graph->addEdge(nid1, nid3, "Edge3"); 48 | graph->setEdgeAttribute(eid3, "label", "Edge3"); 49 | graph->applyLayout(); 50 | 51 | if (argc > 1 && strcmp(argv[1], "--no-gui") == 0) { 52 | return 0; 53 | } 54 | 55 | // build ui 56 | QGraphicsView *view = new QGraphicsView; 57 | view->setRenderHint(QPainter::Antialiasing); 58 | QGraphicsScene *scene = new QGraphicsScene; 59 | view->setScene(scene); 60 | 61 | Q_FOREACH (const GVNodePair &pair, graph->gvNodes()) { 62 | const GVNode node = pair.second; 63 | QGraphicsItem *item = new GVNodeItem(node, 0); 64 | scene->addItem(item); 65 | } 66 | Q_FOREACH (const GVEdgePair &pair, graph->gvEdges()) { 67 | const GVEdge edge = pair.second; 68 | QGraphicsItem *item = new GVEdgeItem(edge, 0); 69 | scene->addItem(item); 70 | } 71 | Q_FOREACH (const GVSubGraphPair &pair, graph->gvSubGraphs()) { 72 | const GVSubGraph graph = pair.second; 73 | QGraphicsItem *item = new GVGraphItem(graph, 0); 74 | scene->addItem(item); 75 | } 76 | delete graph; 77 | graph = 0; 78 | 79 | view->show(); 80 | 81 | return app.exec(); 82 | } 83 | -------------------------------------------------------------------------------- /statemachineviewer/transitionmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | transitionmodel.h 3 | 4 | This file is part of GammaRay, the Qt application inspection and 5 | manipulation tool. 6 | 7 | Copyright (C) 2010-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 8 | Author: Stephen Kelly 9 | 10 | This program is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | */ 23 | 24 | #ifndef GAMMARAY_STATEMACHINEVIEWER_TRANSITIONMODEL_H 25 | #define GAMMARAY_STATEMACHINEVIEWER_TRANSITIONMODEL_H 26 | 27 | #include "objectmodelbase.h" 28 | 29 | class QAbstractState; 30 | 31 | namespace GammaRay { 32 | 33 | class TransitionModelPrivate; 34 | 35 | class TransitionModel : public ObjectModelBase 36 | { 37 | public: 38 | explicit TransitionModel(QObject *parent = 0); 39 | ~TransitionModel(); 40 | void setState(QAbstractState *state); 41 | int columnCount(const QModelIndex &parent = QModelIndex()) const; 42 | int rowCount (const QModelIndex &parent = QModelIndex()) const; 43 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 44 | QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const; 45 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; 46 | QModelIndex parent(const QModelIndex &index) const; 47 | 48 | #ifdef QT5 49 | QHash roleNames() const; 50 | #endif 51 | 52 | protected: 53 | Q_DECLARE_PRIVATE(TransitionModel) 54 | TransitionModelPrivate *const d_ptr; 55 | }; 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /statemachineviewer/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace GammaRay { 6 | namespace Util { 7 | 8 | inline QString displayString(const QObject *object) 9 | { 10 | if (!object) { 11 | return "QObject(0x0)"; 12 | } 13 | if (object->objectName().isEmpty()) { 14 | return QString::fromLatin1("%1").arg(object->metaObject()->className()); 15 | } 16 | return object->objectName(); 17 | } 18 | 19 | 20 | inline bool descendantOf(const QObject *ascendant, const QObject *obj) 21 | { 22 | QObject *parent = obj->parent(); 23 | if (!parent) { 24 | return false; 25 | } 26 | if (parent == ascendant) { 27 | return true; 28 | } 29 | return descendantOf(ascendant, parent); 30 | } 31 | 32 | 33 | } 34 | } --------------------------------------------------------------------------------