├── .gitignore ├── CMakeLists.txt ├── CODING_STYLE ├── COPYING.LIB ├── HowToCompileWin32.txt ├── Makefile.am ├── README ├── autogen.sh ├── cmake ├── FindBISON.cmake ├── FindFLEX.cmake ├── prebuilt.cmake └── version.cmake ├── configure.ac ├── dataview ├── CMakeLists.txt ├── Dataview.dd ├── Makefile.am ├── States.dd ├── dw.h ├── dwanneal.c ├── dwmain.c ├── dwplace.c ├── dwpostscript.c ├── dwroute.c └── dwwrite.c ├── debian ├── changelog ├── compat ├── control ├── copyright ├── dirs ├── docs └── rules ├── examples ├── JSON │ ├── JSON.dd │ ├── Makefile │ ├── README │ ├── array.c │ ├── json.c │ ├── json.h │ ├── object.c │ ├── parseJSON.c │ └── value.c ├── array │ ├── Array.dd │ ├── README │ ├── array.c │ ├── configure │ ├── httypedef.h │ └── nodes.txt ├── attributes │ ├── Attrtest.dd │ ├── README │ ├── attrtest.c │ ├── configure │ └── nodes.txt ├── extension │ ├── Color.dd │ ├── Graph.dd │ ├── README │ ├── color.c │ ├── commands.txt │ ├── configure │ ├── graph.c │ └── graph.h ├── graph │ ├── Graph.dd │ ├── README │ ├── configure │ └── graph.c ├── graph_benchmark │ ├── Graph.dd │ ├── README │ ├── boost_graph.cpp │ ├── graph.c │ ├── graph.cpp │ ├── makefile │ └── rawc_graph.c ├── hash │ ├── Hash.dd │ ├── README │ ├── configure │ ├── hash.c │ └── nodes.txt ├── heap │ ├── Heap.dd │ ├── README │ ├── configure │ ├── heap.c │ ├── one.txt │ ├── states.txt │ └── zero.txt ├── ordered_list │ ├── OrderedList.dd │ ├── README │ ├── makefile │ ├── ordered.c │ └── states.txt ├── redblack_benchmark │ ├── Benchmark.dd │ ├── README │ ├── benchmark.h │ ├── loop_benchmark.c │ ├── makefile │ ├── multiset_benchmark.cpp │ ├── multisetloop_benchmark.cpp │ ├── ordered_benchmark.c │ ├── rand_benchmark.c │ └── util.c ├── sparse │ ├── README │ ├── Sparse.dd │ ├── configure │ ├── nodes.txt │ └── sparse.c ├── sym │ ├── README │ ├── makefile │ └── sym.c └── treap_benchmark │ ├── README │ ├── benchmark.h │ ├── makefile │ ├── oltreap.c │ ├── oltreap.h │ ├── ordered_benchmark.c │ ├── rand_benchmark.c │ └── util.c ├── manual.odt ├── manual.pdf ├── postweb ├── src ├── CMakeLists.txt ├── Database.dd ├── Makefile.am ├── dv.h ├── dvadmin.c ├── dvbuild.c ├── dvdatabase.c ├── dvdatabase.h ├── dvgenc.c ├── dvgenerate.c ├── dvgenh.c ├── dvlexwrap.c ├── dvmain.c ├── dvparse.y ├── dvread.c ├── dvscan.l ├── dvutil.c ├── dvversion.h └── msw │ └── unistd.h ├── util ├── CMakeLists.txt ├── DatadrawUtil.dd ├── Makefile.am ├── ddutil.h ├── utcygwin.c ├── utdatabase.c ├── utdatabase.h ├── utdatabasep.c ├── utdatabaseu.c ├── utdatabaseup.c ├── util.c ├── utmanage.c ├── utmem.c ├── utmem.h ├── utnt.c ├── utoslayer.c ├── utpersist.c ├── utpersist.h ├── utrand.c ├── uttypes.h └── utunix.c ├── vs2005 ├── database_mem │ └── database_mem.vcproj ├── database_persistence │ └── database_persistence.vcproj ├── database_undo │ └── database_undo.vcproj ├── database_undo_persistence │ └── database_undo_persistence.vcproj ├── datadraw │ └── datadraw.vcproj └── vs2005.sln ├── vs6 ├── VS6.dsw ├── database_mem │ └── database_mem.dsp ├── database_persistence │ └── database_persistence.dsp ├── database_undo │ └── database_undo.dsp ├── database_undo_persistence │ └── database_undo_persistence.dsp └── datadraw │ └── datadraw.dsp └── www ├── images ├── dreamweaver-template-9.gif ├── index_r4_c2.gif ├── index_r4_c4.gif ├── index_r6_c2.gif ├── index_r6_c4.gif ├── leaf50-back.jpg ├── leaf50-backlong.gif ├── spacer-green.gif └── spacer.gif └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | *\.o 2 | *\.a 3 | *scan\.c 4 | *parse\.[ch] 5 | *database\.[ch] 6 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.5.0 FATAL_ERROR) 2 | 3 | 4 | #SET(CMAKE_VERBOSE_MAKEFILE "ON" CACHE BOOLEAN "Make it more verbose!" FORCE) 5 | if(COMMAND cmake_policy) 6 | cmake_policy(SET CMP0003 NEW) 7 | endif(COMMAND cmake_policy) 8 | 9 | 10 | SET (CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "" FORCE) 11 | MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) 12 | 13 | 14 | SET(DEBUGGING_ON TRUE CACHE BOOLEAN "Turn on debugging?" FORCE) 15 | MARK_AS_ADVANCED(DEBUGGING_ON) 16 | 17 | 18 | PROJECT(datadraw) 19 | 20 | 21 | # CMake include directory 22 | SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) 23 | SET(PACKAGE ${PROJECT_NAME}) 24 | SET(CMAKE_SKIP_BUILD_RPATH TRUE) 25 | SET(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin) 26 | SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) 27 | SET(REAL_EXECUTABLE_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}) 28 | 29 | 30 | # On Visual Studio 2003+ MS deprecated C. This removes all 1.276E1265 security 31 | # warnings 32 | IF(MSVC AND NOT MSVC60) 33 | ADD_DEFINITIONS( 34 | -D_CRT_SECURE_NO_WARNINGS 35 | -D_CRT_NONSTDC_NO_WARNINGS 36 | 37 | -D_CRT_FAR_MAPPINGS_NO_DEPRECATE 38 | -D_CRT_IS_WCTYPE_NO_DEPRECATE 39 | -D_CRT_MANAGED_FP_NO_DEPRECATE 40 | -D_CRT_NONSTDC_NO_DEPRECATE 41 | -D_CRT_SECURE_NO_DEPRECATE 42 | -D_CRT_SECURE_NO_DEPRECATE_GLOBALS 43 | -D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE 44 | -D_CRT_TIME_FUNCTIONS_NO_DEPRECATE 45 | -D_CRT_VCCLRIT_NO_DEPRECATE 46 | -D_SCL_SECURE_NO_DEPRECATE 47 | ) 48 | ENDIF(MSVC AND NOT MSVC60) 49 | 50 | 51 | # Version data that need modification for each release. 52 | INCLUDE(version) 53 | # Prebuild datadraw! 54 | SET(MAINBUILD TRUE) 55 | INCLUDE(prebuilt) 56 | 57 | IF(DEBUGGING_ON AND GCC) 58 | SET(PARAMS "-Wall -W -Wno-unused-parameter -Wno-unused-function") 59 | SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${PARAMS}" ) 60 | SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${PARAMS}" ) 61 | 62 | SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${PARAMS}" ) 63 | SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${PARAMS}" ) 64 | ENDIF(DEBUGGING_ON AND GCC) 65 | 66 | # Build and continue 67 | IF(MSVC) 68 | SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI" ) 69 | SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD" ) 70 | ENDIF(MSVC) 71 | 72 | 73 | #INCLUDE(packit) 74 | 75 | 76 | add_subdirectory(util ${CMAKE_CURRENT_BINARY_DIR}) 77 | add_subdirectory(src) 78 | add_subdirectory(dataview) 79 | #ADD_SUBDIRECTORY(examples) 80 | -------------------------------------------------------------------------------- /CODING_STYLE: -------------------------------------------------------------------------------- 1 | Since multiple developers are joining the DataDraw development team, some words about coding style are in order. 2 | 3 | The code format that exists in the current files should be followed closely, so that the code looks consistent. Note 4 | that there are no '*' '->' or '.' operators used in the manually generated code, except for 'char *' variables. Also, 5 | there are no pointers to pointers (char **). Further, there are no '#if'. The except to these rules are low-level 6 | files in the util directory. As much as possible '#if' declarations should be confined to uttypes.h, and they should 7 | not show up outside the util directory (except in generated database files). Every function should have a comment. 8 | Functions should be small, typically fitting on a single page in VI (25 lines or less). 9 | 10 | Tabs are to be removed from the source before checking in (I use the 'expand' utility). This keeps us from fighting 11 | over whether they are 4 or 8 spaces. The "^M" characters that appear at the ends of lines when DOS editors are used 12 | should be removed. I use the "dos2unix" utility for this. 13 | 14 | Recently, #defines have been replaced by 'static inline' functions as there is no performance cost and are more 15 | compiler and debugger friendly. 16 | 17 | That's it for now! Feel free to enhance this file as issues arise. 18 | -------------------------------------------------------------------------------- /HowToCompileWin32.txt: -------------------------------------------------------------------------------- 1 | 2 | - get latest cygwin (I'm using Flex 2.5.4 and Bison 2.3 and 3 | have tested building with vs6 and vs2005-express-edition; 4 | I've got MANY warnings regarding 64bit-support, don't know 5 | if that is problematic or not) 6 | 7 | - include the path from bison and flex into visual studio 8 | executable directory (be sure that really the new tools 9 | are used and no other bison/flex is before yours in the 10 | path!) Tools -> Options -> Directories -> Executables 11 | 12 | - hit compile, in the datadraw-executable is the "undo and 13 | persistence"-library included by default and in the 14 | project-setting exceptions are disabled. 15 | 16 | have fun 17 | 18 | PS: I've not tested the windows-version much, but it 19 | generates the graph-example so I think it's working. 20 | 21 | =============================================================== 22 | 23 | UPDATE: 24 | by Steven 'KaReL' Van Ingelgem 25 | 26 | - Get the latest CMake version from 27 | http://www.cmake.org/HTML/Download.html 28 | 29 | - Run the CMake interface against the datadraw directory. 30 | 31 | - You should end up with the project files for your choosen 32 | compiler in the datadraw directory. 33 | 34 | have fun 35 | 36 | PS: If you find any issues, please patch them if possible, but 37 | above all, please report them to the SF project tracker! 38 | 39 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ## -*- Makefile -*- 2 | ## 3 | ## 4 | 5 | AUTOMAKE_OPTIONS = subdir-objects 6 | SUBDIRS= util src dataview 7 | EXTRA_DIST= manual.odt README \ 8 | CODING_STYLE \ 9 | www/images/leaf50-back.jpg \ 10 | www/images/index_r6_c4.gif \ 11 | www/images/index_r6_c2.gif \ 12 | www/images/index_r4_c4.gif \ 13 | www/images/index_r4_c2.gif \ 14 | www/images/spacer.gif \ 15 | www/images/dreamweaver-template-9.gif \ 16 | www/images/spacer-green.gif \ 17 | www/images/leaf50-backlong.gif \ 18 | www/index.html \ 19 | examples/extension/graph.h \ 20 | examples/extension/README \ 21 | examples/extension/color.c \ 22 | examples/extension/Graph.dd \ 23 | examples/extension/graph.c \ 24 | examples/extension/Color.dd \ 25 | examples/extension/commands.txt \ 26 | examples/extension/configure \ 27 | examples/array/README \ 28 | examples/array/Array.dd \ 29 | examples/array/nodes.txt \ 30 | examples/array/httypedef.h \ 31 | examples/array/array.c \ 32 | examples/array/configure \ 33 | examples/heap/states.txt \ 34 | examples/heap/README \ 35 | examples/heap/one.txt \ 36 | examples/heap/zero.txt \ 37 | examples/heap/Heap.dd \ 38 | examples/heap/prdatabase.h \ 39 | examples/heap/prdatabase.c \ 40 | examples/heap/heap.c \ 41 | examples/heap/configure \ 42 | examples/attributes/README \ 43 | examples/attributes/Attrtest.dd \ 44 | examples/attributes/attrtest.c \ 45 | examples/attributes/configure \ 46 | examples/graph/README \ 47 | examples/graph/graph_database \ 48 | examples/graph/Graph.dd \ 49 | examples/graph/graph.c \ 50 | examples/graph/configure \ 51 | examples/sparse/README \ 52 | examples/sparse/Sparse.dd \ 53 | examples/sparse/sparse.c \ 54 | examples/sparse/nodes.txt \ 55 | examples/sparse/htdatabase.h \ 56 | examples/sparse/htdatabase.c \ 57 | examples/sparse/configure \ 58 | examples/sym/sym.c \ 59 | examples/hash/README \ 60 | examples/hash/Hash.dd \ 61 | examples/hash/nodes.txt \ 62 | examples/hash/hash.c \ 63 | examples/hash/configure 64 | 65 | deb: 66 | fakeroot debian/rules binary 67 | 68 | 69 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | DataDraw is a database generator. It takes a database description file and creates C code that 2 | links the database directly into your C program. There have been 3 major rewrites of DataDraw. 3 | 4 | The original, version 1.0, was written by me, Bill Cox, in 1992. I placed it into the copy-left 5 | domain at that time. It allowed a single-page schema to be drawn in Windows, and the database was 6 | generated from that. 7 | 8 | After that, QuickLogic put time into developing version 2.0, which inherited my copy-left. 9 | Version 2.0 has been used since about 1993, and is stable, mature, and quite useful. It supports 10 | many features, such as multiple schemas per tool, and multiple tools, and dynamic class extension. 11 | However, it's showing it's age, and most of the open-source community seems to want command-line 12 | driven tools, rather than a graphical front-end. 13 | 14 | I wrote version 3.0 in 2006, starting with code from version 2.0. Version 3.0 inherits it's 15 | copy-left from version 2.0. All three versions are copyrighted under the GNU Library General Public 16 | License. You should have received a copy, and if not, you can find it on fsf.org. 17 | 18 | Version 3.0 is modern, feature-rich, and well documented. I hope you find it useful for your 19 | project. The manual is in datadraw3.0/manual.odt, which is "Open Document Format", compatible 20 | with multiple editors, just none currently from Microsoft. I wrote it using OpenOffice, which I 21 | highly recommend. Installation and usage instructions are in the manual. 22 | 23 | Linux Installation 24 | ------------------ 25 | 26 | If you just want to compile it now, before reading the manual, just type this: 27 | 28 | $ cd datadraw3.X.X 29 | $ ./autogen.sh 30 | $ ./configure 31 | $ make 32 | $ su 33 | $ make install 34 | $ exit 35 | 36 | If you have any trouble, it may be that you do not have all the build tools 37 | installed. Make sure to have automake, and in debian, build-essential 38 | installed. 39 | 40 | This should install a "datadraw" executable, which you can use on database description files 41 | (ending in ".dd"). The following will generate the C database: 42 | 43 | $ cd src 44 | $ datadraw dvdatabase.dd 45 | 46 | The output files are dvdatabase.c and dvdatabase.h, which you can check out. I recommend taking 47 | some Advil before reading the generating code. The manual is where I recommend you start. 48 | 49 | Debian Installation 50 | ------------------- 51 | 52 | Thanks to Aes, we now have Debian scripts to build proper Debian .pkg files for DataDraw3.0. You 53 | can build a Debian package with "make deb", which will create the package in the directory 54 | containing datadraw3.0. These packages are also available at 55 | http://sourceforge.net/projects/datadraw, where you can download and install them directly. 56 | 57 | Windows Installation 58 | -------------------- 59 | 60 | You should find a datadraw_windows directory in the tar-ball. This contains Visual C++ 6.0 61 | project files. In addition, there is a Bakefile directory which can be used with the 62 | bakefile-tool (http://bakefile.sourceforge.net) to build project files for Visual C++ as well as 63 | others. Thanks to Questor for the port! 64 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # 4 | # Run the various GNU autotools to bootstrap the build 5 | # system. Should only need to be done once and also is only 6 | # needed by the maintainer 7 | 8 | # for now avoid using bash as not everyone has that installed 9 | CONFIG_SHELL=/bin/sh 10 | export CONFIG_SHELL 11 | 12 | echo "Running aclocal..." 13 | aclocal $ACLOCAL_FLAGS || exit 1 14 | echo "Done with aclocal" 15 | 16 | echo "Running autoheader..." 17 | autoheader || exit 1 18 | echo "Done with autoheader" 19 | 20 | echo "Running automake..." 21 | automake -a -c --foreign || exit 1 22 | echo "Done with automake" 23 | 24 | echo "Running autoconf..." 25 | autoconf || exit 1 26 | echo "Done with autoconf" 27 | 28 | echo "You must now run configure" 29 | 30 | echo "All done with autogen.sh" 31 | 32 | -------------------------------------------------------------------------------- /cmake/FindFLEX.cmake: -------------------------------------------------------------------------------- 1 | # - Find flex executable and provides a macro to generate custom build rules 2 | # The module defines the following variables: 3 | # FLEX_FOUND - true is flex executable is found 4 | # FLEX_VERSION - the version of flex 5 | # If flex is found on the system, the module provides the macro: 6 | # FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS ]) 7 | # which creates a custom command to generate the file from 8 | # the file. If COMPILE_FLAGS option is specified, the next 9 | # parameter is added to the flex command line. Name is an alias used to 10 | # get details of this custom command. Indeed the macro defines the 11 | # following variables: 12 | # FLEX_${Name}_DEFINED - true is the macro ran successfully 13 | # FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an 14 | # alias for FlexOutput 15 | # FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput} 16 | # 17 | # Flex scanners oftenly use tokens defined by Bison: the code generated 18 | # by Flex depends of the header generated by Bison. This module also 19 | # defines a macro: 20 | # ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget) 21 | # which adds the required dependency between a scanner and a parser 22 | # where and are the first parameters of 23 | # respectively FLEX_TARGET and BISON_TARGET macros. 24 | # 25 | # Example: 26 | # FIND_PACKAGE(BISON) 27 | # FIND_PACKAGE(FLEX) 28 | # BISON_TARGET(MyParser parser.y ${PROJECT_BINARY_DIR}/parser.cpp 29 | # FLEX_TARGET(MyScanner lexer.l ${PROJECT_BINARY_DIR}/lexer.cpp) 30 | # ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser) 31 | # 32 | 33 | # Copyright (c) 2006, Tristan Carel 34 | # All rights reserved. 35 | # Redistribution and use in source and binary forms, with or without 36 | # modification, are permitted provided that the following conditions are met: 37 | # 38 | # * Redistributions of source code must retain the above copyright 39 | # notice, this list of conditions and the following disclaimer. 40 | # * Redistributions in binary form must reproduce the above copyright 41 | # notice, this list of conditions and the following disclaimer in the 42 | # documentation and/or other materials provided with the distribution. 43 | # * Neither the name of the University of California, Berkeley nor the 44 | # names of its contributors may be used to endorse or promote products 45 | # derived from this software without specific prior written permission. 46 | # 47 | # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY 48 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 49 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 50 | # DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY 51 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 52 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 53 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 54 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 55 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 56 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 57 | 58 | # $Id:: FindFLEX.cmake 3 2006-11-03 02:42:02Z ken $ 59 | 60 | SET(FLEX_FOUND FALSE) 61 | 62 | FIND_PROGRAM(FLEX_EXECUTABLE flex DOC "path to the flex executable") 63 | MARK_AS_ADVANCED(FLEX_EXECUTABLE) 64 | 65 | FIND_LIBRARY(FL_LIBRARY NAMES fl 66 | PATHS /usr/lib DOC "path to the fl library") 67 | SET(FLEX_LIBRARIES ${FL_LIBRARY}) 68 | 69 | IF(FLEX_EXECUTABLE) 70 | SET(FLEX_FOUND TRUE) 71 | 72 | EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version 73 | OUTPUT_VARIABLE FLEX_version_output 74 | ERROR_VARIABLE FLEX_version_error 75 | RESULT_VARIABLE FLEX_version_result 76 | OUTPUT_STRIP_TRAILING_WHITESPACE) 77 | IF(NOT ${FLEX_version_result} EQUAL 0) 78 | MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_error}") 79 | ELSE(NOT ${FLEX_version_result} EQUAL 0) 80 | STRING(REGEX REPLACE "^flex (.*)$" "\\1" 81 | FLEX_VERSION "${FLEX_version_output}") 82 | ENDIF(NOT ${FLEX_version_result} EQUAL 0) 83 | 84 | MACRO(FLEX_TARGET Name Input Output) 85 | SET(FLEX_TARGET_usage "FLEX_TARGET( [COMPILE_FLAGS ]") 86 | IF(${ARGC} GREATER 3) 87 | IF(${ARGC} EQUAL 5) 88 | IF("${ARGV3}" STREQUAL "COMPILE_FLAGS") 89 | SET(FLEX_EXECUTABLE_opts "${ARGV4}") 90 | SEPARATE_ARGUMENTS(FLEX_EXECUTABLE_opts) 91 | ELSE("${ARGV3}" STREQUAL "COMPILE_FLAGS") 92 | MESSAGE(SEND_ERROR ${FLEX_TARGET_usage}) 93 | ENDIF("${ARGV3}" STREQUAL "COMPILE_FLAGS") 94 | ELSE(${ARGC} EQUAL 5) 95 | MESSAGE(SEND_ERROR ${FLEX_TARGET_usage}) 96 | ENDIF(${ARGC} EQUAL 5) 97 | ENDIF(${ARGC} GREATER 3) 98 | ADD_CUSTOM_COMMAND(OUTPUT ${Output} 99 | COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXECUTABLE_opts} -t ${Input} > ${Output} 100 | DEPENDS ${Input} 101 | COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}" 102 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 103 | 104 | SET(FLEX_${Name}_DEFINED TRUE) 105 | SET(FLEX_${Name}_OUTPUTS ${Output}) 106 | SET(FLEX_${Name}_INPUT ${Input}) 107 | SET(FLEX_${Name}_TARGET ${Name}) 108 | SET(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts}) 109 | ENDMACRO(FLEX_TARGET) 110 | 111 | MACRO(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget) 112 | IF(NOT FLEX_${FlexTarget}_TARGET) 113 | MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.") 114 | ENDIF(NOT FLEX_${FlexTarget}_TARGET) 115 | IF(NOT BISON_${BisonTarget}_TARGET) 116 | MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.") 117 | ENDIF(NOT BISON_${BisonTarget}_TARGET) 118 | 119 | SET_SOURCE_FILES_PROPERTIES(${FLEX_${FlexTarget}_OUTPUT} 120 | PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER}) 121 | ENDMACRO(ADD_FLEX_BISON_DEPENDENCY) 122 | 123 | ENDIF(FLEX_EXECUTABLE) 124 | 125 | IF(NOT FLEX_FOUND) 126 | IF(NOT FLEX_FIND_QUIETLY) 127 | MESSAGE(STATUS "FLEX was not found.") 128 | ELSE(NOT FLEX_FIND_QUIETLY) 129 | IF(FLEX_FIND_REQUIRED) 130 | MESSAGE(FATAL_ERROR "FLEX was not found.") 131 | ENDIF(FLEX_FIND_REQUIRED) 132 | ENDIF(NOT FLEX_FIND_QUIETLY) 133 | ENDIF(NOT FLEX_FOUND) 134 | 135 | # FindFLEX.cmake ends here 136 | -------------------------------------------------------------------------------- /cmake/prebuilt.cmake: -------------------------------------------------------------------------------- 1 | MACRO(IS_BUILD_DATADRAW) 2 | FIND_PROGRAM( 3 | DATADRAW 4 | datadraw 5 | PATHS 6 | ${PROJECT_SOURCE_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp 7 | ${PROJECT_SOURCE_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/bin 8 | ${PROJECT_SOURCE_DIR}/bin 9 | ${PROJECT_SOURCE_DIR}/src/bin 10 | PATH_SUFFIXES 11 | Debug 12 | debug 13 | Release 14 | release 15 | NO_DEFAULT_PATH 16 | ) 17 | ENDMACRO(IS_BUILD_DATADRAW) 18 | 19 | 20 | IS_BUILD_DATADRAW() 21 | 22 | 23 | IF(NOT DATADRAW) 24 | 25 | MESSAGE(STATUS "Building datadraw...") 26 | FILE(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) 27 | TRY_COMPILE( 28 | DATADRAW_OK 29 | ${PROJECT_SOURCE_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp 30 | ${PROJECT_SOURCE_DIR}/src 31 | datadraw 32 | ) 33 | 34 | IS_BUILD_DATADRAW() 35 | 36 | IF( NOT DATADRAW ) 37 | MESSAGE(FATAL_ERROR "datadraw failed to build. This is a needed file for the database precompilation!") 38 | ENDIF( NOT DATADRAW ) 39 | 40 | ENDIF(NOT DATADRAW) 41 | -------------------------------------------------------------------------------- /cmake/version.cmake: -------------------------------------------------------------------------------- 1 | # Version data that need review and possible modification for each release. 2 | set(DATADRAW_VERSION_MAJOR "3") 3 | set(DATADRAW_VERSION_MINOR "1") 4 | set(DATADRAW_SVN_REVISION "$Revision$") 5 | set(DATADRAW_VERSION_PATCH ${DATADRAW_SVN_REVISION}) 6 | set(DATADRAW_VERSION_STRING "${DATADRAW_VERSION_MAJOR}.${DATADRAW_VERSION_MINOR}.${DATADRAW_VERSION_PATCH}") 7 | 8 | 9 | # CPack version numbers for release tarball name. 10 | set(CPACK_PACKAGE_VERSION_MAJOR "${DATADRAW_VERSION_MAJOR}") 11 | set(CPACK_PACKAGE_VERSION_MINOR "${DATADRAW_VERSION_MINOR}") 12 | set(CPACK_PACKAGE_VERSION_PATCH "${DATADRAW_VERSION_PATCH}") 13 | 14 | 15 | if( NOT EXISTS config.h OR cmake/version.cmake IS_NEWER_THAN config.h ) 16 | file(WRITE config.h "/* config.h. Generated by \"version.cmake\". */\n") 17 | file(APPEND config.h "\n") 18 | file(APPEND config.h "/* Name of package */\n") 19 | file(APPEND config.h "#define PACKAGE \"${PROJECT_NAME}\"\n") 20 | file(APPEND config.h "\n") 21 | file(APPEND config.h "/* Define to the address where bug reports for this package should be sent. */\n") 22 | file(APPEND config.h "#define PACKAGE_BUGREPORT \"\"\n") 23 | file(APPEND config.h "\n") 24 | file(APPEND config.h "/* Define to the full name of this package. */\n") 25 | file(APPEND config.h "#define PACKAGE_NAME \"\"\n") 26 | file(APPEND config.h "\n") 27 | file(APPEND config.h "/* Define to the full name and version of this package. */\n") 28 | file(APPEND config.h "#define PACKAGE_STRING \"\"\n") 29 | file(APPEND config.h "\n") 30 | file(APPEND config.h "/* Define to the one symbol short name of this package. */\n") 31 | file(APPEND config.h "#define PACKAGE_TARNAME \"\"\n") 32 | file(APPEND config.h "\n") 33 | file(APPEND config.h "/* Define to the version of this package. */\n") 34 | file(APPEND config.h "#define PACKAGE_VERSION \"\"\n") 35 | file(APPEND config.h "\n") 36 | file(APPEND config.h "/* Version number of package */\n") 37 | file(APPEND config.h "#define VERSION \"${DATADRAW_VERSION_STRING}\"\n") 38 | file(APPEND config.h "\n") 39 | endif( NOT EXISTS config.h OR cmake/version.cmake IS_NEWER_THAN config.h ) 40 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | dnl 3 | dnl Contributed by Dan McMahill 4 | dnl 5 | 6 | AC_INIT 7 | AC_CONFIG_SRCDIR([src/dvmain.c]) 8 | AM_INIT_AUTOMAKE(datadraw, 3.1.X-unstable) 9 | AM_CONFIG_HEADER(config.h) 10 | 11 | AM_MAINTAINER_MODE 12 | 13 | dnl checks for programs. 14 | AC_PROG_CC 15 | AC_PROG_RANLIB 16 | AC_PROG_INSTALL 17 | 18 | AM_PROG_LEX 19 | AC_PROG_YACC 20 | 21 | # Datadraw uses itself to produce one of its files. 22 | # if we have a datadraw installed go ahead and enable 23 | # some extra rules. FIXME -- do we ultimately need a 2 24 | # stage build like what gcc does? Build datadraw then 25 | # rebuild again?? 26 | # 27 | # If we are cross compiling then we need to search for a 28 | # datadraw binary to use for the build of dataview. This can 29 | # either be an installed datadraw in our search path or 30 | # it can be specified like: 31 | # 32 | # env DATADRAW=/opt/ddr/bin/datadraw ./configure \ 33 | # --host=alpha--netbsd --build=i686--linux 34 | # 35 | 36 | if test "$cross_compiling" = "yes" ; then 37 | AC_PATH_PROG(DATADRAW, datadraw, [notfound]) 38 | else 39 | DATADRAW=../src/datadraw 40 | AC_SUBST([DATADRAW]) 41 | fi 42 | AM_CONDITIONAL(MISSING_DATADRAW, test x$DATADRAW = xnotfound) 43 | 44 | # if we have gcc and we've asked for debugging then add lots of -W 45 | if test "x$GCC" = "xyes" ; then 46 | for flag in -Wall -W -Wno-unused-parameter -Wno-unused-function; do 47 | case " ${CFLAGS} " in 48 | *\ ${flag}\ *) 49 | # flag is already present 50 | ;; 51 | 52 | *) 53 | AC_MSG_CHECKING([If the compiler accepts ${flag}]) 54 | old_CFLAGS="$CFLAGS" 55 | CFLAGS="$CFLAGS ${flag}" 56 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], 57 | [AC_MSG_RESULT([yes])], 58 | [AC_MSG_RESULT([no]) 59 | CFLAGS="${old_CFLAGS}" 60 | ] 61 | ) 62 | ;; 63 | esac 64 | done 65 | fi 66 | 67 | dnl checks for headers 68 | #AC_CHECK_HEADERS([ctype.h stdlib.h string.h]) 69 | 70 | 71 | AC_MSG_RESULT([ 72 | ** Configuration summary for $PACKAGE $VERSION: 73 | 74 | CPPFLAGS: $CPPFLAGS 75 | CFLAGS: $CFLAGS 76 | LIBS: $LIBS 77 | 78 | ]) 79 | 80 | AC_CONFIG_FILES([Makefile util/Makefile src/Makefile dataview/Makefile]) 81 | AC_OUTPUT 82 | 83 | -------------------------------------------------------------------------------- /dataview/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | add_custom_command( 4 | OUTPUT dwdatabase.c 5 | COMMAND ${DATADRAW} -I ${CMAKE_CURRENT_SOURCE_DIR}/../src Dataview.dd 6 | COMMENT "Pre-compiling Dataview.dd" 7 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 8 | ) 9 | 10 | 11 | include_directories( 12 | .. 13 | ../util 14 | ../src 15 | ) 16 | 17 | 18 | add_executable( 19 | dataview 20 | 21 | dwdatabase.c 22 | dwdatabase.h 23 | 24 | ../src/dvparse.c 25 | ../src/dvparse.h 26 | 27 | ../src/dvscan.c 28 | 29 | ../src/dvdatabase.c 30 | ../src/dvdatabase.h 31 | 32 | dw.h 33 | dwanneal.c 34 | dwmain.c 35 | dwplace.c 36 | dwpostscript.c 37 | dwroute.c 38 | 39 | ../src/dvbuild.c 40 | ../src/dvlexwrap.c 41 | ../src/dvread.c 42 | ../src/dvutil.c 43 | ) 44 | 45 | set_source_files_properties(dwdatabase.c dwdatabase.h ../src/dvparse.c ../src/dvparse.h ../src/dvscan.c ../src/dvdatabase.c ../src/dvdatabase.h PROPERTIES GENERATED TRUE) 46 | 47 | target_link_libraries(dataview ddutil m) 48 | 49 | install( 50 | TARGETS dataview 51 | RUNTIME DESTINATION bin 52 | ) 53 | -------------------------------------------------------------------------------- /dataview/Dataview.dd: -------------------------------------------------------------------------------- 1 | module Dataview dw 2 | 3 | import Database 4 | 5 | class Schema:dv 6 | uint32 rows 7 | uint32 cols 8 | uint32 rowHeight // This is the number of grid points tall each row is 9 | uint32 colWidth // This is the number of grid points wide each column is 10 | 11 | class Class:dv array 12 | uint32 X 13 | uint32 Y 14 | uint32 height 15 | uint32 width 16 | uint32 left 17 | uint32 bottom 18 | uint32 right 19 | uint32 top 20 | bool Added 21 | 22 | class Relationship:dv array 23 | 24 | class Bucket create_only 25 | 26 | class Bund create_only array 27 | Bund prevBund 28 | Bund overlappingBund 29 | uint32 x 30 | uint32 y 31 | bool nearClass 32 | 33 | class Adj create_only 34 | bool blocked 35 | 36 | class Route 37 | 38 | relationship Bucket Bund linked_list 39 | relationship Class Bund linked_list 40 | relationship Bund:From Adj:Out linked_list 41 | relationship Bund:To Adj:In linked_list 42 | relationship Relationship Route doubly_linked 43 | relationship Bund Route linked_list 44 | -------------------------------------------------------------------------------- /dataview/Makefile.am: -------------------------------------------------------------------------------- 1 | ## -*- Makefile -*- 2 | ## 3 | ## 4 | 5 | bin_PROGRAMS= dataview 6 | 7 | AUTOMAKE_OPTIONS = subdir-objects 8 | INCLUDES= -I$(srcdir)/../src -I$(srcdir)/../util 9 | LDADD= -lm ../util/libddutil.a 10 | 11 | AM_YFLAGS= -d -p dv 12 | AM_LFLAGS= -f 13 | 14 | dataview_SOURCES= \ 15 | dwdatabase.c dwdatabase.h \ 16 | dw.h dwanneal.c dwmain.c dwplace.c dwpostscript.c \ 17 | dwroute.c \ 18 | $(srcdir)/../src/dvbuild.c \ 19 | $(srcdir)/../src/dvdatabase.c \ 20 | $(srcdir)/../src/dvdatabase.h \ 21 | $(srcdir)/../src/dvlexwrap.c \ 22 | $(srcdir)/../src/dvparse.y \ 23 | $(srcdir)/../src/dvread.c \ 24 | $(srcdir)/../src/dvscan.l \ 25 | $(srcdir)/../src/dvutil.c 26 | 27 | dwdatabase.h dwdatabase.c: Dataview.dd 28 | $(DATADRAW) -I $(srcdir)/../src Dataview.dd 29 | 30 | # to help with parallel builds. This prevents the 31 | # datadraw command from being executed twice in parallel. 32 | dwdatabase.h: dwdatabase.c 33 | 34 | CLEANFILES= dwdatabase.h dwdatabase.c 35 | 36 | EXTRA_DIST= Dataview.dd dwwrite.c 37 | 38 | -------------------------------------------------------------------------------- /dataview/States.dd: -------------------------------------------------------------------------------- 1 | module States st 2 | 3 | 4 | class Hawaii 5 | class Alaska 6 | class Washington 7 | class Oregon 8 | class California 9 | class Nevada 10 | class Idaho 11 | class Utah 12 | class Arizona 13 | class Montana 14 | class Wyoming 15 | class Colorado 16 | class NewMexico 17 | class NorthDakota 18 | class SouthDakota 19 | class Nebraska 20 | class Kansas 21 | class Oklahoma 22 | class Texas 23 | class Wisconsin 24 | class Minnesota 25 | class Iowa 26 | class Missouri 27 | class Arkansas 28 | class Louisiana 29 | class Mississippi 30 | class Alabama 31 | class Florida 32 | class Georgia 33 | class SouthCarolina 34 | class NorthCarolina 35 | class Virginia 36 | class WestVirginia 37 | class Maryland 38 | class Deleware 39 | class NewJersey 40 | class Pennsylvania 41 | class NewYork 42 | class RhodeIsland 43 | class Connecticutt 44 | class Massachussetts 45 | class Vermont 46 | class NewHampshire 47 | class Maine 48 | class Tennessee 49 | class Kentucky 50 | class Ohio 51 | class Indiana 52 | class Illinois 53 | class Michigan 54 | 55 | schema States 56 | 57 | relationship Washington Oregon 58 | relationship Washington Idaho 59 | relationship Oregon Idaho 60 | relationship Oregon California 61 | relationship California Nevada 62 | relationship California Arizona 63 | relationship Nevada Idaho 64 | relationship Nevada Arizona 65 | relationship Nevada Utah 66 | relationship Idaho Montana 67 | relationship Idaho Wyoming 68 | relationship Idaho Utah 69 | relationship Utah Wyoming 70 | relationship Utah Colorado 71 | relationship Utah NewMexico 72 | relationship Arizona NewMexico 73 | relationship NorthDakota Minnesota 74 | relationship NorthDakota SouthDakota 75 | relationship SouthDakota Minnesota 76 | relationship SouthDakota Iowa 77 | relationship Nebraska Iowa 78 | relationship Nebraska Missouri 79 | relationship Nebraska Kansas 80 | relationship Kansas Missouri 81 | relationship Kansas Arkansas 82 | relationship Kansas Oklahoma 83 | relationship Oklahoma Arkansas 84 | relationship Oklahoma Louisiana 85 | relationship Texas Louisiana 86 | relationship Wisconsin Minnesota 87 | relationship Wisconsin Michigan 88 | relationship Wisconsin Illinois 89 | relationship Minnesota Illinois 90 | relationship Minnesota Iowa 91 | relationship Iowa Illinois 92 | relationship Missouri Kentucky 93 | relationship Missouri Tennessee 94 | relationship Missouri Arkansas 95 | relationship Arkansas Tennessee 96 | relationship Arkansas Mississippi 97 | relationship Arkansas Louisiana 98 | relationship Louisiana Mississippi 99 | relationship Mississippi Tennessee 100 | relationship Mississippi Alabama 101 | relationship Alabama Tennessee 102 | relationship Alabama Georgia 103 | relationship Alabama Florida 104 | relationship Florida Georgia 105 | relationship Georgia SouthCarolina 106 | relationship Georgia NorthCarolina 107 | relationship Georgia Tennessee 108 | relationship SouthCarolina NorthCarolina 109 | relationship NorthCarolina Tennessee 110 | relationship NorthCarolina Virginia 111 | relationship Virginia WestVirginia 112 | relationship Virginia Tennessee 113 | relationship Virginia Kentucky 114 | relationship Virginia Maryland 115 | relationship WestVirginia Kentucky 116 | relationship WestVirginia Ohio 117 | relationship WestVirginia Pennsylvania 118 | relationship WestVirginia Maryland 119 | relationship Maryland Deleware 120 | relationship Maryland Pennsylvania 121 | relationship NewJersey Pennsylvania 122 | relationship NewJersey NewYork 123 | relationship Pennsylvania NewYork 124 | relationship Pennsylvania Ohio 125 | relationship NewYork Connecticutt 126 | relationship NewYork NewHampshire 127 | relationship RhodeIsland Connecticutt 128 | relationship RhodeIsland Massachussetts 129 | relationship Connecticutt Massachussetts 130 | relationship Massachussetts Vermont 131 | relationship Massachussetts NewHampshire 132 | relationship Vermont NewHampshire 133 | relationship NewHampshire Maine 134 | relationship Tennessee Kentucky 135 | relationship Kentucky Ohio 136 | relationship Kentucky Indiana 137 | relationship Kentucky Illinois 138 | relationship Ohio Indiana 139 | relationship Ohio Michigan 140 | relationship Indiana Michigan 141 | relationship Indiana Illinois 142 | relationship Illinois Michigan 143 | -------------------------------------------------------------------------------- /dataview/dw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Bill Cox 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA 17 | */ 18 | 19 | #include "../src/dvdatabase.h" 20 | #include "dv.h" 21 | #include "dwdatabase.h" 22 | 23 | #define DW_ROUTING_TRACKS 6 24 | 25 | void dwReadDatabases(int argc, char *argv[]); 26 | void dwPlaceSchema(dvSchema schema); 27 | uint32 dwRouteSchema(dvSchema schema); 28 | void dwPrintSchemaClasses(dvSchema schema, bool optimizeForPrinting); 29 | void dwViewSchemas(void); 30 | void anAnneal(double coolingFactor); 31 | void anInitializeCycle(double temperature); 32 | int32 anInitializeSystem(uint32 *numElements); 33 | void anUndoMove(void); 34 | int32 anRandomizeSystem(void); 35 | int32 anMakeRandomMove(void); 36 | char *dwClassGetName(dvClass class); 37 | 38 | /* Global variables */ 39 | extern dwClassArray dwClasses; 40 | -------------------------------------------------------------------------------- /dataview/dwanneal.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------------------- 2 | Anneal a system to a low cost. 3 | --------------------------------------------------------------------------------------------------*/ 4 | #include 5 | #include 6 | #include "dv.h" 7 | #include "dw.h" 8 | #define AN_RANDOM_SYSTEMS 32 9 | #define AN_MOVES_PER_ELEMENT 20 10 | #define AN_FREEZE_TEMP 0.1 11 | 12 | double anTemperature; 13 | int64 anCost; 14 | 15 | /*-------------------------------------------------------------------------------------------------- 16 | Find the standard deviation of random systems. 17 | --------------------------------------------------------------------------------------------------*/ 18 | static double findInitialTemperature(void) { 19 | int64 costs[AN_RANDOM_SYSTEMS]; 20 | int64 totalCost = 0; 21 | int64 totalOfSquares = 0; 22 | int64 averageCost, difference; 23 | uint16 xRandomSystems; 24 | 25 | for(xRandomSystems = 0; xRandomSystems < AN_RANDOM_SYSTEMS; 26 | xRandomSystems++) { 27 | anCost = anCost + anRandomizeSystem(); 28 | } 29 | for(xRandomSystems = 0; xRandomSystems < AN_RANDOM_SYSTEMS; xRandomSystems++) { 30 | anCost = anCost + anRandomizeSystem(); 31 | costs[xRandomSystems] = anCost; 32 | totalCost = totalCost + costs[xRandomSystems]; 33 | } 34 | averageCost = totalCost/AN_RANDOM_SYSTEMS; 35 | for(xRandomSystems = 0; xRandomSystems < AN_RANDOM_SYSTEMS; xRandomSystems++) { 36 | difference = costs[xRandomSystems] - averageCost; 37 | totalOfSquares = totalOfSquares + difference*difference; 38 | } 39 | return sqrt(totalOfSquares/AN_RANDOM_SYSTEMS); 40 | } 41 | 42 | /*-------------------------------------------------------------------------------------------------- 43 | Anneal a system to a low cost. 44 | --------------------------------------------------------------------------------------------------*/ 45 | void anAnneal( 46 | double coolingFactor) 47 | { 48 | uint32 xMove, movesPerCycle; 49 | uint32 numElements; 50 | int64 deltaCost; 51 | 52 | anCost = anInitializeSystem(&numElements); 53 | movesPerCycle = numElements*AN_MOVES_PER_ELEMENT; 54 | anTemperature = findInitialTemperature(); 55 | if(numElements > 0) { 56 | do { 57 | anInitializeCycle(anTemperature); 58 | for (xMove = 0; xMove < movesPerCycle; xMove++) { 59 | deltaCost = anMakeRandomMove(); 60 | if (deltaCost > 0 && (int32)(UINT16_MAX*exp(-deltaCost/anTemperature)) <= (int32)utRandN(UINT16_MAX)) { 61 | anUndoMove(); 62 | } else { 63 | anCost = anCost + deltaCost; 64 | } 65 | } 66 | anTemperature *= coolingFactor; 67 | } while(anTemperature > 0.1); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | datadraw (3.1-1) unstable; urgency=low 2 | 3 | * Upgrade release, including dataview. 4 | 5 | -- Bill Cox Mon, 21 Apr 2008 5:58:51 +0100 6 | 7 | datadraw (3.0-1) unstable; urgency=low 8 | 9 | * Initial release. 10 | 11 | -- Anders Eurenius Wed, 10 Jan 2007 23:58:51 +0100 12 | 13 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 5 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: datadraw 2 | Section: devel 3 | Priority: extra 4 | Maintainer: Anders Eurenius 5 | Build-Depends: debhelper (>= 5) 6 | Standards-Version: 3.7.2 7 | 8 | Package: datadraw 9 | Architecture: any 10 | Depends: ${shlibs:Depends}, ${misc:Depends} 11 | Description: Ultra-fast persistent database for C 12 | It's so fast that many programs keep all their data in a DataDraw db, even 13 | while being manipulated in inner loops of compute intensive app. Unlike slow 14 | SQL db's, these are compiled, and directly link into your C programs. 15 | DataDraw db's are resident in memory, making manipulation even faster than if 16 | they were stored in native C data structures (really). Further, they can 17 | automatically support infinite undo/redo, greatly simplifying many apps. 18 | . 19 | Homepage: http://datadraw.sourceforge.net/ -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Anders Eurenius on 2 | Wed, 10 Jan 2007 23:58:51 +0100. 3 | 4 | It was downloaded from 5 | https://datadraw.svn.sourceforge.net/svnroot/datadraw/trunk/datadraw3.0 6 | 7 | Upstream Authors: 8 | Bill Cox, Bill Falk, Mukesh Lulla, Brad Pirtle and John Maushammer. (more?) 9 | 10 | Copyright: (c) 2007 (Upstream Authors) 11 | 12 | License: 13 | 14 | This package is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2 of the License. 17 | 18 | This package is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with this package; if not, write to the Free Software 25 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 | 27 | On Debian systems, the complete text of the GNU General 28 | Public License can be found in `/usr/share/common-licenses/GPL'. 29 | 30 | The Debian packaging is (C) 2007, Anders Eurenius and 31 | is licensed under the GPL, see above. 32 | 33 | --- 34 | Like some other code generators, only the actual code generator program is GPL. 35 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/include 3 | usr/lib 4 | usr/share 5 | usr/share/doc 6 | usr/share/doc/datadraw 7 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | README 2 | manual.odt 3 | manual.pdf 4 | examples.tar.gz 5 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | 13 | # These are used for cross-compiling and for saving the configure script 14 | # from having to guess our platform (since we know it already) 15 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 16 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 17 | 18 | 19 | CFLAGS = -Wall -g 20 | 21 | IPREFIX = $(CURDIR)/debian/datadraw/usr 22 | 23 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) 24 | CFLAGS += -O0 25 | else 26 | CFLAGS += -O2 27 | endif 28 | 29 | config.status: configure 30 | dh_testdir 31 | # Add here commands to configure the package. 32 | ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" 33 | 34 | 35 | build: build-stamp 36 | 37 | build-stamp: config.status 38 | dh_testdir 39 | 40 | $(MAKE) 41 | (tar cvzf examples.tar.gz --exclude=.svn examples) 42 | touch $@ 43 | 44 | clean: 45 | dh_testdir 46 | dh_testroot 47 | rm -f build-stamp 48 | 49 | # Add here commands to clean up after the build process. 50 | -$(MAKE) distclean 51 | $(RM) examples.tar.gz 52 | dh_clean 53 | 54 | install: build 55 | dh_testdir 56 | dh_testroot 57 | dh_clean -k 58 | dh_installdirs 59 | 60 | # Add here commands to install the package into debian/datadraw. 61 | $(MAKE) prefix=$(IPREFIX) install 62 | 63 | # Build architecture-independent files here. 64 | binary-indep: build install 65 | # We have nothing to do by default. 66 | 67 | # Build architecture-dependent files here. 68 | binary-arch: build install 69 | dh_testdir 70 | dh_testroot 71 | dh_installchangelogs 72 | dh_installdocs 73 | dh_installexamples 74 | # dh_install 75 | # dh_installmenu 76 | # dh_installdebconf 77 | # dh_installlogrotate 78 | # dh_installemacsen 79 | # dh_installpam 80 | # dh_installmime 81 | # dh_python 82 | # dh_installinit 83 | # dh_installcron 84 | # dh_installinfo 85 | dh_installman 86 | dh_link 87 | dh_strip 88 | dh_compress 89 | dh_fixperms 90 | # dh_perl 91 | # dh_makeshlibs 92 | dh_installdeb 93 | dh_shlibdeps 94 | dh_gencontrol 95 | dh_md5sums 96 | dh_builddeb 97 | $(RM) examples.tar.gz 98 | 99 | binary: binary-indep binary-arch 100 | .PHONY: build clean binary-indep binary-arch binary install 101 | -------------------------------------------------------------------------------- /examples/JSON/JSON.dd: -------------------------------------------------------------------------------- 1 | module JSON jn 2 | 3 | enum ValueType 4 | JN_VAL_STRING 5 | JN_VAL_NUMBER 6 | JN_VAL_OBJECT 7 | JN_VAL_ARRAY 8 | JN_VAL_TRUE 9 | JN_VAL_FALSE 10 | JN_VAL_NULL 11 | 12 | class Value 13 | ValueType type 14 | union type 15 | sym string: JN_VAL_STRING 16 | // Note that rounding errors occur here when converting to/from ASCII representation. 17 | // A number written, and then read, is not always exactly the same value. 18 | double number: JN_VAL_NUMBER 19 | Object object cascade: JN_VAL_OBJECT 20 | // Class members can be capitalized to avoid colliding with keywords like "array". 21 | Array Array cascade: JN_VAL_ARRAY 22 | 23 | // Objects contain a hash table of Entries, which are key:value pairs, where key is a sym. 24 | class Object 25 | 26 | class Entry 27 | Value value cascade 28 | 29 | class Array 30 | 31 | // The parser will return Value objects that the caller should destroy. Be careful not to destroy 32 | // a child object in the JSON tree without first removing it from a parent, since these 33 | // relationships are child_only. 34 | relationship Object Entry hashed child_only cascade 35 | relationship Array Value array child_only cascade 36 | -------------------------------------------------------------------------------- /examples/JSON/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-Wall -g 2 | LFLAGS=-lddutil-dbg -DDD_DEBUG 3 | CC=gcc 4 | 5 | json: jndatabase.c json.c parseJSON.c json.h value.c object.c array.c 6 | $(CC) $(CFLAGS) -o json json.c parseJSON.c jndatabase.c value.c object.c array.c $(LFLAGS) 7 | 8 | jndatabase.c: jndatabase.h 9 | 10 | jndatabase.h: JSON.dd 11 | datadraw JSON.dd 12 | 13 | clean: 14 | rm -f json jndatabase.c jndatabase.h 15 | -------------------------------------------------------------------------------- /examples/JSON/README: -------------------------------------------------------------------------------- 1 | This simple DataDraw was written by Bill Cox on May 28, 2019. I place it into 2 | the public domain. If your company or jurisdiction does not recognize the 3 | public domain, than you may use this under the Apache 2.0 license. 4 | 5 | This demo just shows how to represent JSON objects with DataDraw. There are a 6 | few TODOs. Feel free to finish it. 7 | -------------------------------------------------------------------------------- /examples/JSON/array.c: -------------------------------------------------------------------------------- 1 | #include "json.h" 2 | #include 3 | 4 | // Print an array. 5 | void jnPrintArray(jnArray array) { 6 | putchar('['); 7 | bool firstTime = true; 8 | jnValue value; 9 | jnForeachArrayValue(array, value) { 10 | if (!firstTime) { 11 | printf(", "); 12 | } 13 | firstTime = false; 14 | jnPrintValue(value); 15 | } jnEndArrayValue; 16 | putchar(']'); 17 | } 18 | -------------------------------------------------------------------------------- /examples/JSON/json.c: -------------------------------------------------------------------------------- 1 | // Executable program that parses, and then prints, a JSON value. 2 | #include "json.h" 3 | #include 4 | 5 | 6 | // Initialize the JSON dateabase. 7 | void jnStart(void) { 8 | utStart(); 9 | jnDatabaseStart(); 10 | } 11 | 12 | // Clean up memory used by the JSON database. 13 | void jnStop(void) { 14 | jnDatabaseStop(); 15 | utStop(false); 16 | } 17 | 18 | // Read input string from stdin, parse it, print the resulting value, and exit. 19 | int main(int argc, char **argv) { 20 | if (argc != 1) { 21 | printf("Usage: json\n Reads JSON string from STDIN, then prints it.\n"); 22 | return 1; 23 | } 24 | jnStart(); 25 | jnValue value = jnParse(stdin); 26 | jnPrintValue(value); 27 | jnValueDestroy(value); // Not actually needed: jnStop frees all memory. 28 | jnStop(); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /examples/JSON/json.h: -------------------------------------------------------------------------------- 1 | #include "jndatabase.h" 2 | 3 | // Main functions. 4 | void jnStart(void); 5 | void jnStop(void); 6 | jnValue jnParse(FILE *file); 7 | 8 | // Value methods. 9 | jnValue jnValueCreate(jnValueType type); 10 | jnValue jnObjectValueCreate(jnObject object); 11 | jnValue jnArrayValueCreate(jnArray array); 12 | jnValue jnStringValueCreate(utSym string); 13 | jnValue jnNumberValueCreate(double number); 14 | void jnPrintValue(jnValue value); 15 | 16 | // Object methods. 17 | static inline jnObject jnObjectCreate(void) { return jnObjectAlloc(); } 18 | void jnPrintObject(jnObject object); 19 | 20 | // Array methods. 21 | static inline jnArray jnArrayCreate(void) { return jnArrayAlloc(); } 22 | void jnPrintArray(jnArray array); 23 | 24 | // String methods. 25 | // TODO: Write an API to escape/unescape strings. 26 | 27 | // Number methods. 28 | -------------------------------------------------------------------------------- /examples/JSON/object.c: -------------------------------------------------------------------------------- 1 | #include "json.h" 2 | #include 3 | 4 | // Print an object. 5 | void jnPrintObject(jnObject object) { 6 | putchar('{'); 7 | bool firstTime = true; 8 | jnEntry entry; 9 | jnForeachObjectEntry(object, entry) { 10 | if (!firstTime) { 11 | printf(", "); 12 | } 13 | firstTime = false; 14 | printf("\"%s\":", jnEntryGetName(entry)); 15 | jnPrintValue(jnEntryGetValue(entry)); 16 | } jnEndObjectEntry; 17 | putchar('}'); 18 | } 19 | -------------------------------------------------------------------------------- /examples/JSON/value.c: -------------------------------------------------------------------------------- 1 | #include "json.h" 2 | 3 | // Create a value of the given type. 4 | jnValue jnValueCreate(jnValueType type) { 5 | jnValue value = jnValueAlloc(); 6 | jnValueSetType(value, type); 7 | return value; 8 | } 9 | 10 | // Create an object value. 11 | jnValue jnObjectValueCreate(jnObject object) { 12 | jnValue value = jnValueCreate(JN_VAL_OBJECT); 13 | jnValueSetObject(value, object); 14 | return value; 15 | } 16 | 17 | // Create an array value. 18 | jnValue jnArrayValueCreate(jnArray array) { 19 | jnValue value = jnValueCreate(JN_VAL_ARRAY); 20 | jnValueSetArray(value, array); 21 | return value; 22 | } 23 | 24 | // Create a string value. 25 | jnValue jnStringValueCreate(utSym string) { 26 | jnValue value = jnValueCreate(JN_VAL_STRING); 27 | jnValueSetString(value, string); 28 | return value; 29 | } 30 | 31 | // Create a number value. 32 | jnValue jnNumberValueCreate(double number) { 33 | jnValue value = jnValueCreate(JN_VAL_NUMBER); 34 | jnValueSetNumber(value, number); 35 | return value; 36 | } 37 | 38 | // Print the valiue. 39 | void jnPrintValue(jnValue value) { 40 | switch (jnValueGetType(value)) { 41 | case JN_VAL_STRING: 42 | printf("\"%s\"", utSymGetName(jnValueGetString(value))); 43 | break; 44 | case JN_VAL_NUMBER: 45 | printf("%g", jnValueGetNumber(value)); 46 | break; 47 | case JN_VAL_OBJECT: 48 | jnPrintObject(jnValueGetObject(value)); 49 | break; 50 | case JN_VAL_ARRAY: 51 | jnPrintArray(jnValueGetArray(value)); 52 | break; 53 | case JN_VAL_TRUE: 54 | printf("true"); 55 | break; 56 | break; 57 | case JN_VAL_FALSE: 58 | printf("false"); 59 | break; 60 | case JN_VAL_NULL: 61 | printf("null"); 62 | break; 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /examples/array/Array.dd: -------------------------------------------------------------------------------- 1 | module Array ht 2 | 3 | typedef dummy // Force include of httypedef.h 4 | 5 | class Graph 6 | 7 | class Node 8 | array char name[NAME_LENGTH] 9 | int32 x = "1" 10 | int32 y = "1" 11 | 12 | relationship Graph Node hashed x y child_only mandatory 13 | -------------------------------------------------------------------------------- /examples/array/README: -------------------------------------------------------------------------------- 1 | This is a simple test of fixed sized arrays 2 | 3 | To use it type: 4 | 5 | $ ./configure 6 | $ ./make 7 | 8 | To execute it, just type: 9 | 10 | $ ./array nodes.txt 11 | -------------------------------------------------------------------------------- /examples/array/array.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------------------- 2 | DataDraw is a CASE tool for generating data structures in C from simple descriptions. 3 | --------------------------------------------------------------------------------------------------*/ 4 | #include 5 | #include 6 | #include "htdatabase.h" 7 | 8 | htGraph htTheGraph; 9 | 10 | /*-------------------------------------------------------------------------------------------------- 11 | Create a new node. 12 | --------------------------------------------------------------------------------------------------*/ 13 | htNode htNodeCreate( 14 | char *name, 15 | int32 x, 16 | int32 y) 17 | { 18 | htNode node = htGraphFindNode(htTheGraph, x, y); 19 | uint32 length = strlen(name) + 1; 20 | 21 | if(length > NAME_LENGTH) { 22 | utExit("Name %s is too long", name); 23 | } 24 | if(node != htNodeNull) { 25 | utExit("Node %s is physically on top of node %s", name, htNodeGetName(node)); 26 | } 27 | node = htNodeAlloc(); 28 | htNodeSetName(node, name, length); 29 | htNodeSetX(node, x); 30 | htNodeSetY(node, y); 31 | htGraphInsertNode(htTheGraph, node); 32 | return node; 33 | } 34 | 35 | /*-------------------------------------------------------------------------------------------------- 36 | Read in the nodes from the text file. 37 | --------------------------------------------------------------------------------------------------*/ 38 | static void readNodes( 39 | char *filename) 40 | { 41 | char buffer[1024]; 42 | FILE *file = fopen(filename, "r"); 43 | htNode node; 44 | int x, y; 45 | 46 | if(file == NULL) { 47 | printf("Unable to open file %s\n", filename); 48 | exit(1); 49 | } 50 | while(fscanf(file, "%s %d %d", buffer, &x, &y) == 3) { 51 | node = htNodeCreate(buffer, x, y); 52 | } 53 | fclose(file); 54 | } 55 | 56 | /*-------------------------------------------------------------------------------------------------- 57 | This is the actual main routine. 58 | --------------------------------------------------------------------------------------------------*/ 59 | int main( 60 | int argc, 61 | char **argv) 62 | { 63 | utStart(); 64 | utInitLogFile("hash.log"); 65 | htDatabaseStart(); 66 | htTheGraph = htGraphAlloc(); 67 | readNodes(argv[1]); 68 | htDatabaseStop(); 69 | utStop(false); 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /examples/array/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SOURCE="array.c 4 | htdatabase.c" 5 | 6 | if [ ! -d obj ]; then 7 | mkdir obj 8 | fi 9 | 10 | ../../src/datadraw Array.dd 11 | 12 | CFLAGS="-g -Wall -W -Wno-unused-parameter -Wno-unused-function -DDD_DEBUG -I../../util" 13 | LIBS="" 14 | 15 | if [ "`uname -m`" = x86_64 ]; then 16 | CFLAGS="$CFLAGS -m64" 17 | fi 18 | 19 | echo "CFLAGS=$CFLAGS 20 | LIBS=$LIBS 21 | " > Makefile 22 | 23 | echo "OBJECTS=\\" >> Makefile 24 | for sourceFile in $SOURCE; do 25 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 26 | echo "$objFile\\" >> Makefile 27 | done 28 | 29 | echo " 30 | 31 | array: ../../util/libddutil-dbg.a \$(OBJECTS) 32 | \$(CC) \$(CFLAGS) \$(OBJECTS) \$(LIBS) ../../util/libddutil-dbg.a -o array 33 | 34 | ../../util/libddutil-dbg.a: 35 | make -C ../../util clean 36 | make -C ../../util libddutil-dbg.a 37 | 38 | htdatabase.c htdatabase.h: Array.dd 39 | ../../src/datadraw Array.dd 40 | 41 | clean: 42 | rm -f \$(OBJECTS) 43 | 44 | " >> Makefile 45 | 46 | for sourceFile in $SOURCE; do 47 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 48 | echo "$objFile: $sourceFile 49 | \$(CC) -c \$(CFLAGS) $sourceFile -o $objFile 50 | " >> Makefile 51 | done 52 | 53 | gcc -M $CFLAGS $SOURCE | sed 's/^\([^ ].*\.o:\)/obj\/\1/' >> Makefile 54 | -------------------------------------------------------------------------------- /examples/array/httypedef.h: -------------------------------------------------------------------------------- 1 | #define NAME_LENGTH 20 2 | -------------------------------------------------------------------------------- /examples/array/nodes.txt: -------------------------------------------------------------------------------- 1 | a 10 4 2 | b 48 132 3 | c 11 4 4 | d 48 131 5 | e 48 133 6 | f 49 132 7 | g 47 133 8 | h 49 131 9 | i 48 132 10 | j 10 5 11 | -------------------------------------------------------------------------------- /examples/attributes/Attrtest.dd: -------------------------------------------------------------------------------- 1 | module Attrtest ht 2 | 3 | class Graph attributes 4 | 5 | class Node attributes 6 | 7 | relationship Graph Node tail_linked mandatory 8 | -------------------------------------------------------------------------------- /examples/attributes/README: -------------------------------------------------------------------------------- 1 | This is a simple test of generated attributes. 2 | 3 | To use it type: 4 | 5 | $ ./configure 6 | $ ./make 7 | 8 | To execute it, just type: 9 | 10 | $ ./attrtest nodes.txt 11 | -------------------------------------------------------------------------------- /examples/attributes/attrtest.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------------------- 2 | DataDraw is a CASE tool for generating data structures in C from simple descriptions. 3 | --------------------------------------------------------------------------------------------------*/ 4 | #include 5 | #include 6 | #include "htdatabase.h" 7 | 8 | htGraph htTheGraph; 9 | utSym htNameSym, htXSym, htYSym; 10 | 11 | /*-------------------------------------------------------------------------------------------------- 12 | Create a new node. 13 | --------------------------------------------------------------------------------------------------*/ 14 | htNode htNodeCreate(void) 15 | { 16 | htNode node = htNodeAlloc(); 17 | 18 | htGraphAppendNode(htTheGraph, node); 19 | return node; 20 | } 21 | 22 | /*-------------------------------------------------------------------------------------------------- 23 | Read in the nodes from the text file. 24 | --------------------------------------------------------------------------------------------------*/ 25 | static void readNodes( 26 | char *filename) 27 | { 28 | char buffer[1024]; 29 | FILE *file = fopen(filename, "r"); 30 | htNode node; 31 | int x, y; 32 | 33 | if(file == NULL) { 34 | printf("Unable to open file %s\n", filename); 35 | exit(1); 36 | } 37 | while(fscanf(file, "%s %d %d", buffer, &x, &y) == 3) { 38 | node = htNodeCreate(); 39 | htNodeSetStringAttribute(node, htNameSym, buffer); 40 | htNodeSetInt64Attribute(node, htXSym, x); 41 | htNodeSetInt64Attribute(node, htYSym, y); 42 | } 43 | fclose(file); 44 | } 45 | 46 | /*-------------------------------------------------------------------------------------------------- 47 | Just write out the nodes. 48 | --------------------------------------------------------------------------------------------------*/ 49 | static void writeNodes(void) 50 | { 51 | htNode node; 52 | 53 | htForeachGraphNode(htTheGraph, node) { 54 | printf("%s %d %d\n", htNodeGetStringAttribute(node, htNameSym), 55 | (int32)htNodeGetInt64Attribute(node, htXSym), (int32)htNodeGetInt64Attribute(node, htYSym)); 56 | } htEndGraphNode; 57 | } 58 | 59 | /*-------------------------------------------------------------------------------------------------- 60 | This is the actual main routine. 61 | --------------------------------------------------------------------------------------------------*/ 62 | int main( 63 | int argc, 64 | char **argv) 65 | { 66 | utStart(); 67 | utInitLogFile("hash.log"); 68 | htDatabaseStart(); 69 | htTheGraph = htGraphAlloc(); 70 | htNameSym = utSymCreate("Name"); 71 | htXSym = utSymCreate("X"); 72 | htYSym = utSymCreate("Y"); 73 | readNodes(argv[1]); 74 | writeNodes(); 75 | htDatabaseStop(); 76 | utStop(false); 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /examples/attributes/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SOURCE="attrtest.c 4 | htdatabase.c" 5 | 6 | if [ ! -d obj ]; then 7 | mkdir obj 8 | fi 9 | 10 | ../../src/datadraw Attrtest.dd 11 | 12 | CFLAGS="-g -Wall -W -Wno-unused-parameter -Wno-unused-function -DDD_DEBUG -I../../util" 13 | LIBS="" 14 | 15 | if [ "`uname -m`" = x86_64 ]; then 16 | CFLAGS="$CFLAGS -m64" 17 | fi 18 | 19 | echo "CFLAGS=$CFLAGS 20 | LIBS=$LIBS 21 | " > Makefile 22 | 23 | echo "OBJECTS=\\" >> Makefile 24 | for sourceFile in $SOURCE; do 25 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 26 | echo "$objFile\\" >> Makefile 27 | done 28 | 29 | echo " 30 | 31 | attrtest: ../../util/libddutil-dbg.a \$(OBJECTS) 32 | \$(CC) \$(CFLAGS) \$(OBJECTS) \$(LIBS) ../../util/libddutil-dbg.a -o attrtest 33 | 34 | ../../util/libddutil-dbg.a: 35 | make -C ../../util clean 36 | make -C ../../util libddutil-dbg.a 37 | 38 | htdatabase.c htdatabase.h: Attrtest.dd 39 | ../../src/datadraw Attrtest.dd 40 | 41 | clean: 42 | rm -f \$(OBJECTS) 43 | 44 | " >> Makefile 45 | 46 | for sourceFile in $SOURCE; do 47 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 48 | echo "$objFile: $sourceFile 49 | \$(CC) -c \$(CFLAGS) $sourceFile -o $objFile 50 | " >> Makefile 51 | done 52 | 53 | gcc -M $CFLAGS $SOURCE | sed 's/^\([^ ].*\.o:\)/obj\/\1/' >> Makefile 54 | -------------------------------------------------------------------------------- /examples/attributes/nodes.txt: -------------------------------------------------------------------------------- 1 | a 10 4 2 | b 48 132 3 | c 11 4 4 | d 48 131 5 | e 48 133 6 | f 49 132 7 | g 47 133 8 | h 49 131 9 | i 48 132 10 | j 10 5 11 | -------------------------------------------------------------------------------- /examples/extension/Color.dd: -------------------------------------------------------------------------------- 1 | module Color co 2 | 3 | import Graph 4 | 5 | class Graph:Graph 6 | uint32 numColors 7 | 8 | class Node:Graph //sparse 9 | uint32 color 10 | bit colored 11 | -------------------------------------------------------------------------------- /examples/extension/Graph.dd: -------------------------------------------------------------------------------- 1 | // A simple test of persistent databases with infinite undo/redo 2 | 3 | module Graph gr 4 | 5 | class Root create_only 6 | Graph currentGraph 7 | 8 | class Graph 9 | 10 | class Node array 11 | 12 | class Edge 13 | 14 | relationship Root Graph hashed mandatory 15 | relationship Graph Node hashed mandatory 16 | relationship Node:From Edge:Out doubly_linked mandatory 17 | relationship Node:To Edge:In doubly_linked mandatory 18 | -------------------------------------------------------------------------------- /examples/extension/README: -------------------------------------------------------------------------------- 1 | This is a simple graph database application designed to demonstrate class extension. To build it, type 2 | 3 | $ ./configure 4 | $ ./make 5 | 6 | To execute it, just type: 7 | 8 | $ ./color 4 commands.txt 9 | 10 | That should result in 2 coloring conflicts, since commands.txt is a complete graph of 6 nodes. 11 | -------------------------------------------------------------------------------- /examples/extension/color.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------------------- 2 | DataDraw is a CASE tool for generating data structures in C from simple descriptions. 3 | --------------------------------------------------------------------------------------------------*/ 4 | #include 5 | #include 6 | #include "graph.h" 7 | #include "codatabase.h" 8 | 9 | #define NUM_RAND_NODES 40000 10 | #define NUM_RAND_EDGES 100000 11 | 12 | /*-------------------------------------------------------------------------------------------------- 13 | Just see if a color has been used by a neighbor. 14 | --------------------------------------------------------------------------------------------------*/ 15 | static void createLargeRandomGraph(void) 16 | { 17 | grGraph graph = grGraphCreate(utSymCreate("RandGraph")); 18 | grNode node, fromNode, toNode; 19 | grNodeArray nodes = grNodeArrayAlloc(); 20 | int32 xNode, xEdge, xRandFrom, xRandTo; 21 | 22 | srand(42); 23 | for(xNode = 0; xNode < NUM_RAND_NODES; xNode++) { 24 | node = grNodeCreate(graph, utSymCreateFormatted("N%u", xNode)); 25 | grNodeArrayAppendNode(nodes, node); 26 | } 27 | for(xEdge = 0; xEdge < NUM_RAND_EDGES; xEdge++) { 28 | xRandFrom = rand() % NUM_RAND_NODES; 29 | xRandTo = rand() % NUM_RAND_NODES; 30 | fromNode = grNodeArrayGetiNode(nodes, xRandFrom); 31 | toNode = grNodeArrayGetiNode(nodes, xRandTo); 32 | grEdgeCreate(fromNode, toNode); 33 | } 34 | grNodeArrayFree(nodes); 35 | } 36 | 37 | /*-------------------------------------------------------------------------------------------------- 38 | Just see if a color has been used by a neighbor. 39 | --------------------------------------------------------------------------------------------------*/ 40 | static bool colorAlreadyUsed( 41 | grNode node, 42 | uint32 color) 43 | { 44 | grNode otherNode; 45 | grEdge edge; 46 | 47 | grForeachNodeEdge(node, edge) { 48 | otherNode = grEdgeFindOtherNode(edge, node); 49 | if(coNodeColored(otherNode) && coNodeGetColor(otherNode) == color) { 50 | return true; 51 | } 52 | } grEndNodeEdge; 53 | return false; 54 | } 55 | 56 | /*-------------------------------------------------------------------------------------------------- 57 | Just find a color that has not yet been used to color adjacent nodes. It's a dumb N^2 loop. 58 | --------------------------------------------------------------------------------------------------*/ 59 | static uint32 findUnusedColor( 60 | grNode node) 61 | { 62 | grGraph graph = grNodeGetGraph(node); 63 | uint32 color; 64 | 65 | for(color = 0; color < coGraphGetNumColors(graph); color++) { 66 | if(!colorAlreadyUsed(node, color)) { 67 | return color; 68 | } 69 | } 70 | return UINT32_MAX; 71 | } 72 | 73 | /*-------------------------------------------------------------------------------------------------- 74 | This is a lame attempt to color the graph with a stupid greedy algorithm: just pick an unused 75 | color, and if none exist, color a node 0. 76 | --------------------------------------------------------------------------------------------------*/ 77 | static void colorGraph( 78 | grGraph graph) 79 | { 80 | grNode node; 81 | uint32 unusedColor; 82 | 83 | grForeachGraphNode(graph, node) { 84 | unusedColor = findUnusedColor(node); 85 | if(unusedColor == UINT32_MAX) { 86 | unusedColor = 0; 87 | printf("Node %s has color conflict\n", grNodeGetName(node)); 88 | } 89 | coNodeSetColor(node, unusedColor); 90 | coNodeSetColored(node, true); 91 | } grEndGraphNode; 92 | } 93 | 94 | /*-------------------------------------------------------------------------------------------------- 95 | Write out a colored graph. 96 | --------------------------------------------------------------------------------------------------*/ 97 | static void writeGraph( 98 | grGraph graph) 99 | { 100 | grNode node; 101 | 102 | grForeachGraphNode(graph, node) { 103 | printf("Node %s color %u\n", grNodeGetName(node), coNodeGetColor(node)); 104 | } grEndGraphNode; 105 | } 106 | 107 | /*-------------------------------------------------------------------------------------------------- 108 | This is the actual main routine. 109 | --------------------------------------------------------------------------------------------------*/ 110 | int main( 111 | int argc, 112 | char **argv) 113 | { 114 | grGraph graph; 115 | uint32 numColors; 116 | bool runManager = false; 117 | uint32 colorsArg = 1; 118 | uint32 fileArg = 2; 119 | 120 | if(argc < 3 || (argc == 4 && strcmp(argv[1], "-m")) || argc > 4) { 121 | printf("Usage: %s [-m] command.txt\n" 122 | " -m - this option starts the database manager after coloring.\n" 123 | " This will graph commands to build a graph, and then color it.\n", 124 | argv[0]); 125 | exit(1); 126 | } 127 | if(argc == 4) { 128 | runManager = true; 129 | colorsArg = 2; 130 | fileArg = 3; 131 | } 132 | numColors = atoi(argv[colorsArg]); 133 | utStart(); 134 | grStart(); 135 | createLargeRandomGraph(); /* Just so we have a reason to use a sparse extension */ 136 | grCommandInterpreter(argv[fileArg]); /* Read in a small graph from command line */ 137 | graph = grRootGetLastGraph(grTheRoot); /* Last graph will be the last one created */ 138 | if(graph == grGraphNull) { 139 | utExit("No graph to color!"); 140 | } 141 | coDatabaseStart(); /* This extends all the graph and node objects with extra fields */ 142 | coGraphSetNumColors(graph, numColors); 143 | colorGraph(graph); 144 | writeGraph(graph); 145 | if(runManager) { 146 | utManager(); 147 | } 148 | coDatabaseStop(); 149 | grStop(); 150 | utStop(true); 151 | return 0; 152 | } 153 | -------------------------------------------------------------------------------- /examples/extension/commands.txt: -------------------------------------------------------------------------------- 1 | graph g1 2 | node n1 n2 n3 n4 n5 n6 3 | node n2 n3 n4 n5 n6 4 | node n3 n4 n5 n6 5 | node n4 n5 n6 6 | node n5 n6 7 | -------------------------------------------------------------------------------- /examples/extension/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SOURCE="color.c 4 | codatabase.c 5 | graph.c 6 | grdatabase.c" 7 | 8 | if [ ! -d obj ]; then 9 | mkdir obj 10 | fi 11 | 12 | ../../src/datadraw Graph.dd 13 | ../../src/datadraw Color.dd 14 | 15 | CFLAGS="-g -Wall -W -Wno-unused-parameter -Wno-unused-function -DDD_DEBUG -I../../util" 16 | LIBS="" 17 | 18 | if [ "`uname -m`" = x86_64 ]; then 19 | CFLAGS="$CFLAGS -m64" 20 | fi 21 | 22 | echo "CFLAGS=$CFLAGS 23 | LIBS=$LIBS 24 | " > Makefile 25 | 26 | echo "OBJECTS=\\" >> Makefile 27 | for sourceFile in $SOURCE; do 28 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 29 | echo "$objFile\\" >> Makefile 30 | done 31 | 32 | echo " 33 | 34 | color: ../../util/libddutil-dbg.a \$(OBJECTS) 35 | \$(CC) \$(CFLAGS) \$(OBJECTS) \$(LIBS) ../../util/libddutil-dbg.a -o color 36 | 37 | ../../util/libddutil-dbg.a: 38 | make -C ../../util clean 39 | make -C ../../util libddutil-dbg.a 40 | 41 | grdatabase.c grdatabase.h: Graph.dd 42 | ../../src/datadraw Graph.dd 43 | 44 | codatabase.c codatabase.h: Color.dd Graph.dd 45 | ../../src/datadraw Color.dd 46 | 47 | clean: 48 | rm -f \$(OBJECTS) 49 | 50 | " >> Makefile 51 | 52 | for sourceFile in $SOURCE; do 53 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 54 | echo "$objFile: $sourceFile 55 | \$(CC) -c \$(CFLAGS) $sourceFile -o $objFile 56 | " >> Makefile 57 | done 58 | 59 | gcc -M $CFLAGS $SOURCE | sed 's/^\([^ ].*\.o:\)/obj\/\1/' >> Makefile 60 | -------------------------------------------------------------------------------- /examples/extension/graph.h: -------------------------------------------------------------------------------- 1 | #include "grdatabase.h" 2 | 3 | void grCommandInterpreter(char *commandFile); 4 | void grStart(void); 5 | void grStop(void); 6 | 7 | /* Constructors */ 8 | grGraph grGraphCreate(utSym name); 9 | grNode grNodeCreate(grGraph graph, utSym name); 10 | grEdge grEdgeCreate(grNode fromNode, grNode toNode); 11 | 12 | /* Iterator to traverse both in and out edges */ 13 | grEdge grNodeGetFirstEdge(grNode node); 14 | grEdge grEdgeGetNextNodeEdge(grNode node, grEdge edge); 15 | #define grForeachNodeEdge(node, edge) \ 16 | for(edge = grNodeGetFirstEdge(node); edge != grEdgeNull; edge = grEdgeGetNextNodeEdge(node, edge)) 17 | #define grEndNodeEdge 18 | #define grEdgeFindOtherNode(edge, node) (grEdgeGetFromNode(edge) == (node)? grEdgeGetToNode(edge) : \ 19 | grEdgeGetFromNode(edge)) 20 | 21 | extern grRoot grTheRoot; 22 | -------------------------------------------------------------------------------- /examples/graph/Graph.dd: -------------------------------------------------------------------------------- 1 | // A simple test of persistent databases with infinite undo/redo 2 | 3 | module Graph pr persistent undo_redo 4 | 5 | class Root create_only reference_size 8 6 | Graph currentGraph 7 | 8 | class Graph 9 | 10 | class Node 11 | 12 | class Edge 13 | 14 | relationship Root Graph hashed mandatory 15 | relationship Graph Node hashed mandatory 16 | relationship Node:From Edge:Out doubly_linked mandatory 17 | relationship Node:To Edge:In doubly_linked mandatory 18 | -------------------------------------------------------------------------------- /examples/graph/README: -------------------------------------------------------------------------------- 1 | This is a simple graph database application designed to demonstrate persistence. To build it, type 2 | 3 | $ ./configure 4 | $ ./make 5 | 6 | To execute it, just type: 7 | 8 | $ ./graph 9 | 10 | For help on commands, type "help" at the interactive prompt. 11 | 12 | -------------------------------------------------------------------------------- /examples/graph/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SOURCE="graph.c 4 | prdatabase.c" 5 | 6 | if [ ! -d obj ]; then 7 | mkdir obj 8 | fi 9 | 10 | if [ ! -d graph_database ]; then 11 | mkdir graph_database 12 | fi 13 | 14 | ../../src/datadraw -I ../../util Graph.dd 15 | 16 | CFLAGS="-g -Wall -W -Wno-unused-parameter -Wno-unused-function -DDD_DEBUG -I../../util" 17 | LIBS="" 18 | 19 | if [ "`uname -m`" = x86_64 ]; then 20 | CFLAGS="$CFLAGS -m64" 21 | fi 22 | 23 | PREFIX="/usr/bin" 24 | while [ $# != 0 ]; do 25 | if [ "$1" = "--dmalloc" ]; then 26 | LIBS="$LIBS -ldmalloc" 27 | CFLAGS="$CFLAGS -DMALLOC" 28 | useDmalloc=true 29 | else 30 | echo "Unknown option $1" 31 | exit 1 32 | fi 33 | shift 34 | done 35 | 36 | 37 | echo "CFLAGS=$CFLAGS 38 | LIBS=$LIBS 39 | " > Makefile 40 | 41 | echo "OBJECTS=\\" >> Makefile 42 | for sourceFile in $SOURCE; do 43 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 44 | echo "$objFile\\" >> Makefile 45 | done 46 | 47 | echo " 48 | 49 | graph: ../../util/libddutilup.a \$(OBJECTS) 50 | \$(CC) \$(CFLAGS) \$(OBJECTS) \$(LIBS) ../../util/libddutilup.a -o graph 51 | 52 | prdatabase.c prdatabase.h: Graph.dd 53 | ../../src/datadraw -I ../../util Graph.dd 54 | 55 | ../../util/libddutilup.a: 56 | make -C ../../util clean 57 | make -C ../../util libddutilup.a 58 | 59 | clean: 60 | rm -f \$(OBJECTS) 61 | 62 | " >> Makefile 63 | 64 | for sourceFile in $SOURCE; do 65 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 66 | echo "$objFile: $sourceFile 67 | \$(CC) -c \$(CFLAGS) $sourceFile -o $objFile 68 | " >> Makefile 69 | done 70 | 71 | gcc -M $CFLAGS $SOURCE | sed 's/^\([^ ].*\.o:\)/obj\/\1/' >> Makefile 72 | -------------------------------------------------------------------------------- /examples/graph_benchmark/Graph.dd: -------------------------------------------------------------------------------- 1 | module Graph gr 2 | 3 | class Graph 4 | 5 | class Node 6 | bool visited 7 | uint32 color 8 | uint32 level 9 | 10 | class Edge 11 | uint32 weight 12 | int32 riseDelay 13 | int32 fallDelay 14 | bool enabled 15 | 16 | relationship Graph Node array mandatory child_only 17 | relationship Node:From Edge:Out linked_list mandatory 18 | relationship Node:To Edge:In linked_list mandatory 19 | -------------------------------------------------------------------------------- /examples/graph_benchmark/README: -------------------------------------------------------------------------------- 1 | This benchmark compares typical EDA inner loop performance for DataDraw based applications to code written using the 2 | raw C code, code written in C++ using the STL library, and code writtin in C++ using the Boost library. I ran these 3 | benchmarks on my 2.0 GHz Core Duo based Dell Inspiron 9400 laptop, with 2 gig of RAM. Both programs performed 100 4 | traversals of a 4 million node graph using depth-first recursive traversal. Both were compiled on 64-bit Ubuntu using 5 | gcc for the C version, and G++ for the C++ version. The graph is in the shape of a 2000 X 2000 mesh. 6 | 7 | Here's the results. DataDraw is the big winner: 8 | 9 | Relative Relative 10 | Time Memory Slowdown Memory 11 | DataDraw 7.83s 432MB 1X 1X 12 | C++/Boost 40.05s 331MB 5.1X 1.3X* 13 | Raw C 55.20s 705MB 7X 1.63X 14 | C++/STL 124.6s 1.1GB 15X 2.5X 15 | 16 | * - For simplicity, the Boost benchmark was done without any user data fields. When DataDraw is done this way, 17 | it uses only 254MB, making Boost 1.3X higher 18 | 19 | The DataDraw improvement is due to L2 cache performance. The valgrind was used to determine cache miss rates: 20 | 21 | L1 miss L2 miss 22 | rate rate 23 | DataDraw 3.8% 1.3% 24 | C++/STL 32.9% 21.7% 25 | 26 | DataDraw's L2 miss rate was 16.7X lower than the C++/STL code. This accounts for the 15X difference in runtime. To 27 | find out cache performance use: 28 | 29 | $ valgrind --tool-cachegrind ./c_graph 30 | $ valgrind --tool-cachegrind ./cpp_graph 31 | 32 | To compile the boost benchmark example, install the boost libraries and development files, and type: 33 | 34 | $ g++ -O2 boost_graph.cpp -o boost_graph 35 | 36 | I also tuned the C version to determine at what point L2 cache efficiency drops off relative to the DataDraw version. 37 | I keep the total number of node traversals the same, and only varied the number of nodes: 38 | 39 | Num Nodes Runtime L2 miss rate 40 | DataDraw 9,000,000 8.64s 0.4% 41 | Raw C 40,000 40.3s 5.6% 42 | -------------------------------------------------------------------------------- /examples/graph_benchmark/boost_graph.cpp: -------------------------------------------------------------------------------- 1 | //======================================================================= 2 | // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. 3 | // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek 4 | // 5 | // Distributed under the Boost Software License, Version 1.0. (See 6 | // accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | //======================================================================= 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | const unsigned int graphWidth = 2000; 23 | const unsigned int numTraversals = 100; 24 | 25 | using namespace boost; 26 | using namespace std; 27 | 28 | 29 | template 30 | struct edge_categorizer : public dfs_visitor { 31 | typedef dfs_visitor Base; 32 | 33 | edge_categorizer(const VisitorList& v = null_visitor()) : Base(v) { } 34 | 35 | template 36 | void tree_edge(Edge e, Graph& G) { 37 | Base::tree_edge(e, G); 38 | } 39 | template 40 | void back_edge(Edge e, Graph& G) { 41 | Base::back_edge(e, G); 42 | } 43 | template 44 | void forward_or_cross_edge(Edge e, Graph& G) { 45 | Base::forward_or_cross_edge(e, G); 46 | } 47 | }; 48 | template 49 | edge_categorizer 50 | categorize_edges(const VisitorList& v) { 51 | return edge_categorizer(v); 52 | } 53 | 54 | static void buildGraphEdges( 55 | adjacency_list<> mygraph) 56 | { 57 | for(unsigned int xRow = 0; xRow < graphWidth; xRow++) { 58 | for(unsigned int xCol = 0; xCol < graphWidth; xCol++) { 59 | if(xCol > 0) { 60 | add_edge(xRow, xCol - 1, mygraph); 61 | } 62 | if(xRow > 0) { 63 | add_edge(xRow - 1 , xCol, mygraph); 64 | } 65 | } 66 | } 67 | } 68 | 69 | int 70 | main(int , char* []) 71 | { 72 | 73 | using namespace boost; 74 | 75 | typedef adjacency_list<> Graph; 76 | 77 | Graph G(graphWidth*graphWidth); 78 | 79 | typedef graph_traits::vertex_descriptor Vertex; 80 | typedef graph_traits::vertices_size_type size_type; 81 | 82 | std::vector d(num_vertices(G)); 83 | std::vector f(num_vertices(G)); 84 | for(unsigned int xTraversal = 0; xTraversal < numTraversals; xTraversal++) { 85 | int t = 0; 86 | depth_first_search(G, visitor(categorize_edges( 87 | make_pair(stamp_times(&d[0], t, on_discover_vertex()), 88 | stamp_times(&f[0], t, on_finish_vertex()))))); 89 | } 90 | 91 | return 0; 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/graph_benchmark/graph.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "grdatabase.h" 3 | 4 | #define GRAPH_WIDTH 2000 5 | #define NUM_TRAVERSALS 100 6 | 7 | /*------------------------------------------------------------------------------------------------- 8 | Macros to access 2-D array. 9 | -------------------------------------------------------------------------------------------------*/ 10 | static inline grNode grGraphGeti2Node(grGraph graph, uint32 row, uint32 col) { 11 | return grGraphGetiNode(graph, row*GRAPH_WIDTH + col);} 12 | static inline void grGraphSeti2Node(grGraph graph, uint32 row, uint32 col, grNode node) { 13 | grGraphSetiNode(graph, row*GRAPH_WIDTH + col, node);} 14 | 15 | /*------------------------------------------------------------------------------------------------- 16 | Create a new edge from the first node to the second. 17 | -------------------------------------------------------------------------------------------------*/ 18 | static grEdge edgeCreate( 19 | grNode node1, 20 | grNode node2) 21 | { 22 | grEdge edge = grEdgeAlloc(); 23 | 24 | grNodeInsertOutEdge(node1, edge); 25 | grNodeInsertInEdge(node2, edge); 26 | return edge; 27 | } 28 | 29 | /*------------------------------------------------------------------------------------------------- 30 | Create a new node. 31 | -------------------------------------------------------------------------------------------------*/ 32 | static grNode grNodeCreate( 33 | grGraph graph, 34 | uint32 row, 35 | uint32 col) 36 | { 37 | grNode node = grNodeAlloc(); 38 | 39 | grGraphSeti2Node(graph, row, col, node); 40 | return node; 41 | } 42 | 43 | /*------------------------------------------------------------------------------------------------- 44 | Create a mesh shapped graph which is GRAPH_WIDTH wide and GRAPH_WIDTH tall. The first node of 45 | the graph will be a corner with outgoing edges to neighbors, and those neighbors will point 46 | outward from the first node. 47 | -------------------------------------------------------------------------------------------------*/ 48 | static grGraph createGridGraph(void) 49 | { 50 | grGraph graph = grGraphAlloc(); 51 | grNode node; 52 | uint32 xRow, xCol; 53 | 54 | grGraphAllocNodes(graph, GRAPH_WIDTH*GRAPH_WIDTH); 55 | for(xRow = 0; xRow < GRAPH_WIDTH; xRow++) { 56 | for(xCol = 0; xCol < GRAPH_WIDTH; xCol++) { 57 | node = grNodeCreate(graph, xRow, xCol); 58 | if(xCol > 0) { 59 | edgeCreate(grGraphGeti2Node(graph, xRow, xCol - 1), node); 60 | } 61 | if(xRow > 0) { 62 | edgeCreate(grGraphGeti2Node(graph, xRow - 1, xCol), node); 63 | } 64 | } 65 | } 66 | grGraphSetUsedNode(graph, GRAPH_WIDTH*GRAPH_WIDTH); 67 | return graph; 68 | } 69 | 70 | /*------------------------------------------------------------------------------------------------- 71 | Traverse the entire graph reachable through forward edges from this node. Return the number 72 | of nodes reached. 73 | -------------------------------------------------------------------------------------------------*/ 74 | static uint32 traverseGraph( 75 | grNode node) 76 | { 77 | grNode nextNode; 78 | grEdge edge; 79 | uint32 numNodes = 1; 80 | 81 | grNodeSetVisited(node, true); 82 | grForeachNodeOutEdge(node, edge) { 83 | nextNode = grEdgeGetToNode(edge); 84 | if(!grNodeVisited(nextNode)) { 85 | numNodes += traverseGraph(nextNode); 86 | } 87 | } grEndNodeOutEdge; 88 | return numNodes; 89 | } 90 | 91 | /*------------------------------------------------------------------------------------------------- 92 | Clear visited flags on all nodes of the graph. 93 | -------------------------------------------------------------------------------------------------*/ 94 | static uint32 clearNodeFlags( 95 | grGraph graph) 96 | { 97 | grNode node; 98 | 99 | grForeachGraphNode(graph, node) { 100 | grNodeSetVisited(node, false); 101 | } grEndGraphNode; 102 | } 103 | 104 | /*------------------------------------------------------------------------------------------------- 105 | Main routine. Build a grid of nodes connected to neighbors, and then traverse them 106 | NUM_TRAVERSALS times. 107 | -------------------------------------------------------------------------------------------------*/ 108 | int main(void) 109 | { 110 | grGraph graph; 111 | uint32 xTraversal; 112 | 113 | utStart(); 114 | grDatabaseStart(); 115 | graph = createGridGraph(); 116 | for(xTraversal = 0; xTraversal < NUM_TRAVERSALS; xTraversal++) { 117 | clearNodeFlags(graph); 118 | utAssert(traverseGraph(grGraphGeti2Node(graph, 0, 0)) == GRAPH_WIDTH*GRAPH_WIDTH); 119 | } 120 | grDatabaseStop(); 121 | utStop(true); 122 | return 0; 123 | } 124 | -------------------------------------------------------------------------------- /examples/graph_benchmark/graph.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | const unsigned int graphWidth = 2000; 10 | const unsigned int numTraversals = 100; 11 | 12 | typedef struct GraphClass *Graph; 13 | typedef struct NodeClass *Node; 14 | typedef struct EdgeClass *Edge; 15 | typedef vector NodeVector; 16 | typedef list EdgeList; 17 | 18 | struct GraphClass { 19 | NodeVector nodes; 20 | Node getX2Node(unsigned int row, unsigned int col) { return nodes[row*graphWidth + col]; } 21 | void setX2Node(unsigned int row, unsigned int col, Node node) { nodes[row*graphWidth + col] = node; } 22 | GraphClass(); 23 | void clearNodeFlags(); 24 | }; 25 | 26 | struct NodeClass { 27 | unsigned int color; 28 | unsigned int level; 29 | bool visited; 30 | EdgeList inEdges, outEdges; 31 | Graph graph; 32 | 33 | NodeClass(Graph owningGraph, unsigned int row, unsigned int col) : 34 | graph(owningGraph), color(0), level(0), visited(0) { 35 | graph->setX2Node(row, col, this); } 36 | }; 37 | 38 | struct EdgeClass { 39 | unsigned int weight; 40 | int riseDelay; 41 | int fallDelay; 42 | bool enabled; 43 | Node fromNode, toNode; 44 | 45 | EdgeClass(Node node1, Node node2) : fromNode(node1), toNode(node2) { 46 | fromNode->outEdges.push_front(this); 47 | toNode->inEdges.push_front(this); } 48 | }; 49 | 50 | GraphClass::GraphClass() 51 | { 52 | nodes.resize(graphWidth*graphWidth); 53 | for(unsigned int xRow = 0; xRow < graphWidth; xRow++) { 54 | for(unsigned int xCol = 0; xCol < graphWidth; xCol++) { 55 | Node node = new NodeClass(this, xRow, xCol); 56 | if(xCol > 0) { 57 | new EdgeClass(this->getX2Node(xRow, xCol - 1), node); 58 | } 59 | if(xRow > 0) { 60 | new EdgeClass(this->getX2Node(xRow - 1, xCol), node); 61 | } 62 | } 63 | } 64 | } 65 | 66 | static unsigned int traverseGraph( 67 | Node node) 68 | { 69 | unsigned int numNodes = 1; 70 | node->visited = true; 71 | EdgeList::iterator lp; 72 | for(lp = node->outEdges.begin(); lp != node->outEdges.end(); lp++) { 73 | Edge edge = *lp; 74 | Node nextNode = edge->toNode; 75 | if(!nextNode->visited) { 76 | numNodes += traverseGraph(nextNode); 77 | } 78 | } 79 | return numNodes; 80 | } 81 | 82 | void GraphClass::clearNodeFlags() 83 | { 84 | NodeVector::iterator lp; 85 | for(lp = nodes.begin(); lp != nodes.end(); lp++) { 86 | (*lp)->visited = false; 87 | } 88 | } 89 | 90 | int main(void) 91 | { 92 | Graph graph = new GraphClass(); 93 | cout << "Done building graph\n"; 94 | for(unsigned int xTraversal = 0; xTraversal < numTraversals; xTraversal++) { 95 | graph->clearNodeFlags(); 96 | if(traverseGraph(graph->getX2Node(0, 0)) != graphWidth*graphWidth) { 97 | printf("Incorrect node count\n"); 98 | return 1; 99 | } 100 | } 101 | return 0; 102 | } 103 | 104 | -------------------------------------------------------------------------------- /examples/graph_benchmark/makefile: -------------------------------------------------------------------------------- 1 | all: c_graph cpp_graph rawc_graph 2 | 3 | c_graph: graph.c grdatabase.c grdatabase.h ../../util/ddutil.h ../../util/libddutil-dbg.a 4 | gcc -O2 graph.c grdatabase.c ../../util/libddutil.a -o c_graph 5 | #gcc -g -DDD_DEBUG graph.c grdatabase.c ../../util/libddutil-dbg.a -o c_graph 6 | 7 | cpp_graph: graph.cpp 8 | g++ -O2 graph.cpp -o cpp_graph 9 | #g++ -g graph.cpp -o cpp_graph 10 | 11 | rawc_graph: rawc_graph.c 12 | gcc -O2 rawc_graph.c -o rawc_graph 13 | #gcc -g rawc_graph.c -o rawc_graph 14 | 15 | ../../util/libddutil.a: 16 | make -C ../../util clean 17 | make -C ../../util libddutil.a 18 | 19 | grdatabase.c grdatabase.h: Graph.dd 20 | ../../src/datadraw Graph.dd 21 | -------------------------------------------------------------------------------- /examples/graph_benchmark/rawc_graph.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef struct grGraphStruct *grGraph; 5 | typedef struct grNodeStruct *grNode; 6 | typedef struct grEdgeStruct *grEdge; 7 | 8 | struct grGraphStruct { 9 | grNode *nodes; 10 | unsigned int numNodes; 11 | }; 12 | 13 | struct grNodeStruct { 14 | char visited; 15 | unsigned int color; 16 | unsigned int level; 17 | grNode nextGraphNode; 18 | grEdge firstOutEdge, firstInEdge; 19 | }; 20 | 21 | struct grEdgeStruct { 22 | unsigned int weight; 23 | int riseDelay; 24 | int fallDelay; 25 | char enabled; 26 | grNode fromNode, toNode; 27 | grEdge nextNodeOutEdge, nextNodeInEdge; 28 | }; 29 | 30 | #define GRAPH_WIDTH 2000 31 | #define NUM_TRAVERSALS 100 32 | 33 | /*------------------------------------------------------------------------------------------------- 34 | Macros to access 2-D array. 35 | -------------------------------------------------------------------------------------------------*/ 36 | static inline grNode grGraphGeti2Node(grGraph graph, unsigned int row, unsigned int col) { 37 | return graph->nodes[row*GRAPH_WIDTH + col];} 38 | static inline void grGraphSeti2Node(grGraph graph, unsigned int row, unsigned int col, grNode node) { 39 | graph->nodes[row*GRAPH_WIDTH + col] = node;} 40 | 41 | /*------------------------------------------------------------------------------------------------- 42 | Create a new edge from the first node to the second. 43 | -------------------------------------------------------------------------------------------------*/ 44 | static grEdge edgeCreate( 45 | grNode node1, 46 | grNode node2) 47 | { 48 | grEdge edge = (grEdge)malloc(sizeof(struct grEdgeStruct)); 49 | 50 | edge->fromNode = node1; 51 | edge->nextNodeOutEdge = node1->firstOutEdge; 52 | node1->firstOutEdge = edge; 53 | edge->toNode = node2; 54 | edge->nextNodeInEdge = node2->firstOutEdge; 55 | node2->firstInEdge = edge; 56 | return edge; 57 | } 58 | 59 | /*------------------------------------------------------------------------------------------------- 60 | Create a new node. 61 | -------------------------------------------------------------------------------------------------*/ 62 | static grNode grNodeCreate( 63 | grGraph graph, 64 | unsigned int row, 65 | unsigned int col) 66 | { 67 | grNode node = (grNode)malloc(sizeof(struct grNodeStruct)); 68 | 69 | node->firstOutEdge = NULL; 70 | node->firstInEdge = NULL; 71 | grGraphSeti2Node(graph, row, col, node); 72 | return node; 73 | } 74 | 75 | /*------------------------------------------------------------------------------------------------- 76 | Create a mesh shapped graph which is GRAPH_WIDTH wide and GRAPH_WIDTH tall. The first node of 77 | the graph will be a corner with outgoing edges to neighbors, and those neighbors will point 78 | outward from the first node. 79 | -------------------------------------------------------------------------------------------------*/ 80 | static grGraph createGridGraph(void) 81 | { 82 | grGraph graph = (grGraph)malloc(sizeof(struct grGraphStruct)); 83 | grNode node; 84 | unsigned int xRow, xCol; 85 | 86 | graph->nodes = malloc(sizeof(grNode)*GRAPH_WIDTH*GRAPH_WIDTH); 87 | for(xRow = 0; xRow < GRAPH_WIDTH; xRow++) { 88 | for(xCol = 0; xCol < GRAPH_WIDTH; xCol++) { 89 | node = grNodeCreate(graph, xRow, xCol); 90 | if(xCol > 0) { 91 | edgeCreate(grGraphGeti2Node(graph, xRow, xCol - 1), node); 92 | } 93 | if(xRow > 0) { 94 | edgeCreate(grGraphGeti2Node(graph, xRow - 1, xCol), node); 95 | } 96 | } 97 | } 98 | return graph; 99 | } 100 | 101 | /*------------------------------------------------------------------------------------------------- 102 | Traverse the entire graph reachable through forward edges from this node. Return the number 103 | of nodes reached. 104 | -------------------------------------------------------------------------------------------------*/ 105 | static unsigned int traverseGraph( 106 | grNode node) 107 | { 108 | grNode nextNode; 109 | grEdge edge; 110 | unsigned int numNodes = 1; 111 | 112 | node->visited = 1; 113 | for(edge = node->firstOutEdge; edge != NULL; edge = edge->nextNodeOutEdge) { 114 | nextNode = edge->toNode; 115 | if(!nextNode->visited) { 116 | numNodes += traverseGraph(nextNode); 117 | } 118 | } 119 | return numNodes; 120 | } 121 | 122 | /*------------------------------------------------------------------------------------------------- 123 | Clear visited flags on all nodes of the graph. 124 | -------------------------------------------------------------------------------------------------*/ 125 | static unsigned int clearNodeFlags( 126 | grGraph graph) 127 | { 128 | grNode node; 129 | unsigned int xNode; 130 | 131 | for(xNode = 0; xNode < GRAPH_WIDTH*GRAPH_WIDTH; xNode++) { 132 | node = graph->nodes[xNode]; 133 | node->visited = 0; 134 | } 135 | } 136 | 137 | /*------------------------------------------------------------------------------------------------- 138 | Main routine. Build a grid of nodes connected to neighbors, and then traverse them 139 | NUM_TRAVERSALS times. 140 | -------------------------------------------------------------------------------------------------*/ 141 | int main(void) 142 | { 143 | grGraph graph; 144 | unsigned int xTraversal; 145 | 146 | graph = createGridGraph(); 147 | for(xTraversal = 0; xTraversal < NUM_TRAVERSALS; xTraversal++) { 148 | clearNodeFlags(graph); 149 | if(traverseGraph(grGraphGeti2Node(graph, 0, 0)) != GRAPH_WIDTH*GRAPH_WIDTH) { 150 | printf("Incorrect graph depth!\n"); 151 | return 1; 152 | } 153 | } 154 | return 0; 155 | } 156 | -------------------------------------------------------------------------------- /examples/hash/Hash.dd: -------------------------------------------------------------------------------- 1 | module Hash ht 2 | 3 | class Graph 4 | 5 | class Node 6 | array char name 7 | int32 x 8 | int32 y 9 | 10 | relationship Graph Node:XY hashed x y child_only unordered // Look up by x and y 11 | relationship Graph Node hashed name mandatory // Look up by name - usually just do this with sym types 12 | -------------------------------------------------------------------------------- /examples/hash/README: -------------------------------------------------------------------------------- 1 | This is a simple hashed tabled based database application designed to test hash keys other than by name. 2 | 3 | To use it type: 4 | 5 | $ ./configure 6 | $ ./make 7 | 8 | To execute it, just type: 9 | 10 | $ ./hash nodes.txt 11 | 12 | It should simply read nodes.txt and complain when it sees a second node at the same x and y position as a previous 13 | one. 14 | -------------------------------------------------------------------------------- /examples/hash/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SOURCE="hash.c 4 | htdatabase.c" 5 | 6 | if [ ! -d obj ]; then 7 | mkdir obj 8 | fi 9 | 10 | ../../src/datadraw Hash.dd 11 | 12 | CFLAGS="-g -Wall -W -Wno-unused-parameter -Wno-unused-function -DDD_DEBUG -I../../util" 13 | LIBS="" 14 | 15 | if [ "`uname -m`" = x86_64 ]; then 16 | CFLAGS="$CFLAGS -m64" 17 | fi 18 | 19 | echo "CFLAGS=$CFLAGS 20 | LIBS=$LIBS 21 | " > Makefile 22 | 23 | echo "OBJECTS=\\" >> Makefile 24 | for sourceFile in $SOURCE; do 25 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 26 | echo "$objFile\\" >> Makefile 27 | done 28 | 29 | echo " 30 | 31 | hash: ../../util/libddutil-dbg.a \$(OBJECTS) 32 | \$(CC) \$(CFLAGS) \$(OBJECTS) \$(LIBS) ../../util/libddutil-dbg.a -o hash 33 | 34 | ../../util/libddutil-dbg.a: 35 | make -C ../../util clean 36 | make -C ../../util libddutil-dbg.a 37 | 38 | htdatabase.c htdatabase.h: Hash.dd 39 | ../../src/datadraw Hash.dd 40 | 41 | clean: 42 | rm -f \$(OBJECTS) 43 | 44 | " >> Makefile 45 | 46 | for sourceFile in $SOURCE; do 47 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 48 | echo "$objFile: $sourceFile 49 | \$(CC) -c \$(CFLAGS) $sourceFile -o $objFile 50 | " >> Makefile 51 | done 52 | 53 | gcc -M $CFLAGS $SOURCE | sed 's/^\([^ ].*\.o:\)/obj\/\1/' >> Makefile 54 | -------------------------------------------------------------------------------- /examples/hash/hash.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------------------- 2 | DataDraw is a CASE tool for generating data structures in C from simple descriptions. 3 | --------------------------------------------------------------------------------------------------*/ 4 | #include 5 | #include 6 | #include "htdatabase.h" 7 | 8 | htGraph htTheGraph; 9 | 10 | /*-------------------------------------------------------------------------------------------------- 11 | Create a new node. 12 | --------------------------------------------------------------------------------------------------*/ 13 | htNode htNodeCreate( 14 | char *name, 15 | int32 x, 16 | int32 y) 17 | { 18 | htNode node = htGraphFindXYNode(htTheGraph, x, y); 19 | uint32 length = strlen(name) + 1; 20 | 21 | if(node != htNodeNull) { 22 | utExit("Node %s is physically on top of node %s", name, htNodeGetName(node)); 23 | } 24 | node = htGraphFindNode(htTheGraph, name, length); 25 | if(node != htNodeNull) { 26 | utExit("Node %s is defined twice", name); 27 | } 28 | node = htNodeAlloc(); 29 | htNodeSetName(node, name, length); 30 | htNodeSetX(node, x); 31 | htNodeSetY(node, y); 32 | htGraphInsertNode(htTheGraph, node); 33 | htGraphInsertXYNode(htTheGraph, node); 34 | return node; 35 | } 36 | 37 | /*-------------------------------------------------------------------------------------------------- 38 | Read in the nodes from the text file. 39 | --------------------------------------------------------------------------------------------------*/ 40 | static void readNodes( 41 | char *filename) 42 | { 43 | char buffer[1024]; 44 | FILE *file = fopen(filename, "r"); 45 | htNode node; 46 | int x, y; 47 | 48 | if(file == NULL) { 49 | printf("Unable to open file %s\n", filename); 50 | exit(1); 51 | } 52 | while(fscanf(file, "%s %d %d", buffer, &x, &y) == 3) { 53 | node = htNodeCreate(buffer, x, y); 54 | } 55 | fclose(file); 56 | } 57 | 58 | /*-------------------------------------------------------------------------------------------------- 59 | This is the actual main routine. 60 | --------------------------------------------------------------------------------------------------*/ 61 | int main( 62 | int argc, 63 | char **argv) 64 | { 65 | utStart(); 66 | utInitLogFile("hash.log"); 67 | htDatabaseStart(); 68 | htTheGraph = htGraphAlloc(); 69 | readNodes(argv[1]); 70 | htDatabaseStop(); 71 | utStop(false); 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /examples/hash/nodes.txt: -------------------------------------------------------------------------------- 1 | a 10 4 2 | b 48 132 3 | c 11 4 4 | d 48 131 5 | e 48 133 6 | f 49 132 7 | g 47 133 8 | h 49 131 9 | i 48 132 10 | j 10 5 11 | -------------------------------------------------------------------------------- /examples/heap/Heap.dd: -------------------------------------------------------------------------------- 1 | module Heap pr persistent undo_redo 2 | 3 | class Root create_only reference_size 8 4 | 5 | class Node 6 | sym Sym 7 | 8 | relationship Root Node heap 9 | -------------------------------------------------------------------------------- /examples/heap/README: -------------------------------------------------------------------------------- 1 | This is a simple heap database application designed to test the heap. 2 | To use it type: 3 | 4 | $ ./configure 5 | $ ./make 6 | 7 | To execute it, just type: 8 | 9 | $ ./heap states.txt 10 | 11 | It should list the states listed in states.txt in alphabetical order. 12 | 13 | -------------------------------------------------------------------------------- /examples/heap/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SOURCE="heap.c 4 | prdatabase.c" 5 | 6 | if [ ! -d obj ]; then 7 | mkdir obj 8 | fi 9 | 10 | if [ ! -d heap_database ]; then 11 | mkdir heap_database 12 | fi 13 | 14 | ../../src/datadraw -I ../../util Heap.dd 15 | 16 | CFLAGS="-g -Wall -W -Wno-unused-parameter -Wno-unused-function -DDD_DEBUG -I../../util" 17 | LIBS="" 18 | 19 | if [ "`uname -m`" = x86_64 ]; then 20 | CFLAGS="$CFLAGS -m64" 21 | fi 22 | 23 | PREFIX="/usr/bin" 24 | while [ $# != 0 ]; do 25 | if [ "$1" = "--dmalloc" ]; then 26 | LIBS="$LIBS -ldmalloc" 27 | CFLAGS="$CFLAGS -DMALLOC" 28 | useDmalloc=true 29 | else 30 | echo "Unknown option $1" 31 | exit 1 32 | fi 33 | shift 34 | done 35 | 36 | 37 | echo "CFLAGS=$CFLAGS 38 | LIBS=$LIBS 39 | " > Makefile 40 | 41 | echo "OBJECTS=\\" >> Makefile 42 | for sourceFile in $SOURCE; do 43 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 44 | echo "$objFile\\" >> Makefile 45 | done 46 | 47 | echo " 48 | 49 | heap: ../../util/libddutilup.a \$(OBJECTS) 50 | \$(CC) \$(CFLAGS) \$(OBJECTS) \$(LIBS) ../../util/libddutilup.a -o heap 51 | 52 | prdatabase.c prdatabase.h: Heap.dd 53 | ../../src/datadraw -I ../../util Heap.dd 54 | 55 | ../../util/libddutilup.a: 56 | make -C ../../util clean 57 | make -C ../../util libddutilup.a 58 | 59 | clean: 60 | rm -f \$(OBJECTS) 61 | 62 | " >> Makefile 63 | 64 | for sourceFile in $SOURCE; do 65 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 66 | echo "$objFile: $sourceFile 67 | \$(CC) -c \$(CFLAGS) $sourceFile -o $objFile 68 | " >> Makefile 69 | done 70 | 71 | gcc -M $CFLAGS $SOURCE | sed 's/^\([^ ].*\.o:\)/obj\/\1/' >> Makefile 72 | -------------------------------------------------------------------------------- /examples/heap/heap.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------------------- 2 | DataDraw is a CASE tool for generating data structures in C from simple descriptions. 3 | --------------------------------------------------------------------------------------------------*/ 4 | #include 5 | #include 6 | #include "prdatabase.h" 7 | 8 | prRoot prTheRoot; 9 | 10 | 11 | 12 | /*-------------------------------------------------------------------------------------------------- 13 | Compare two Nodes. Return negative is first node gets popped off first. 14 | Return positve if second node gets popped off first. 15 | --------------------------------------------------------------------------------------------------*/ 16 | int prRootCompareNode( 17 | prNode a, 18 | prNode b) 19 | { 20 | utSym aSym = prNodeGetSym(a); 21 | utSym bSym = prNodeGetSym(b); 22 | char *aString = utSymGetName(aSym); 23 | char *bString = utSymGetName(bSym); 24 | 25 | return strcmp(aString, bString); 26 | } 27 | 28 | /*-------------------------------------------------------------------------------------------------- 29 | Create a new node. 30 | --------------------------------------------------------------------------------------------------*/ 31 | prNode prNodeCreate( 32 | utSym name) 33 | { 34 | prNode node = prNodeAlloc(); 35 | 36 | prNodeSetSym(node, name); 37 | return node; 38 | } 39 | 40 | /*-------------------------------------------------------------------------------------------------- 41 | Interpret commands and modify the graph database. 42 | --------------------------------------------------------------------------------------------------*/ 43 | static void readWriteTree( 44 | char *filename) 45 | { 46 | char buffer[1024]; 47 | FILE *file = fopen(filename, "r"); 48 | prNode node; 49 | 50 | if(file == NULL) { 51 | printf("Unable to open file %s\n", filename); 52 | exit(1); 53 | } 54 | while(fscanf(file, "%s", buffer) >= 0) { 55 | node = prNodeCreate(utSymCreate(buffer)); 56 | prRootPushNode(prTheRoot, node); 57 | } 58 | fclose(file); 59 | utDo { 60 | node = prRootPopNode(prTheRoot); 61 | } utWhile(node != prNodeNull) { 62 | printf("%s\n", utSymGetName(prNodeGetSym(node))); 63 | } utRepeat; 64 | } 65 | 66 | /*-------------------------------------------------------------------------------------------------- 67 | This is the actual main routine. 68 | --------------------------------------------------------------------------------------------------*/ 69 | int main( 70 | int argc, 71 | char **argv) 72 | { 73 | utStart(); 74 | utInitLogFile("graph.log"); 75 | prDatabaseStart(); 76 | prTheRoot = prRootAlloc(); 77 | readWriteTree(argv[1]); 78 | prDatabaseStop(); 79 | utStop(false); 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /examples/heap/one.txt: -------------------------------------------------------------------------------- 1 | Bert -------------------------------------------------------------------------------- /examples/heap/states.txt: -------------------------------------------------------------------------------- 1 | alaska 2 | hawaii 3 | washington 4 | oregon 5 | california 6 | nevada 7 | idaho 8 | utah 9 | arizona 10 | montana 11 | wyoming 12 | colorado 13 | new_mexico 14 | north_dakota 15 | south_dakota 16 | nebraska 17 | kansas 18 | oklahoma 19 | texas 20 | minnesota 21 | iowa 22 | missouri 23 | arkansas 24 | louisiana 25 | mississippi 26 | alabama 27 | florida 28 | georgia 29 | south_carolina 30 | north_carolina 31 | virginia 32 | west_virginia 33 | maryland 34 | deleware 35 | pennsylvania 36 | new_jersey 37 | new_york 38 | rhode_island 39 | connecticutt 40 | massachussets 41 | new_hampshire 42 | vermont 43 | main 44 | tennessee 45 | kentucky 46 | ohio 47 | indiana 48 | illiniou 49 | michigan 50 | wisconsin 51 | -------------------------------------------------------------------------------- /examples/heap/zero.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/examples/heap/zero.txt -------------------------------------------------------------------------------- /examples/ordered_list/OrderedList.dd: -------------------------------------------------------------------------------- 1 | module OrderedList ol 2 | 3 | class Root 4 | 5 | class Node 6 | array char name 7 | 8 | relationship Root Node ordered_list 9 | -------------------------------------------------------------------------------- /examples/ordered_list/README: -------------------------------------------------------------------------------- 1 | This is just a simple ordered_list example. To use it: 2 | 3 | $ make 4 | $ ./ordered states.txt 5 | -------------------------------------------------------------------------------- /examples/ordered_list/makefile: -------------------------------------------------------------------------------- 1 | ordered: ordered.c oldatabase.c oldatabase.h ../../util/ddutil.h ../../util/libddutil-dbg.a 2 | gcc -g -DDD_DEBUG -I../../util ordered.c oldatabase.c ../../util/libddutil-dbg.a -o ordered 3 | 4 | ../../util/libddutil-dbg.a: 5 | make -C ../../util clean 6 | make -C ../../util libddutil-dbg.a 7 | 8 | oldatabase.c oldatabase.h: OrderedList.dd 9 | ../../src/datadraw OrderedList.dd 10 | 11 | oldatabase.c oldatabase.h: 12 | -------------------------------------------------------------------------------- /examples/ordered_list/ordered.c: -------------------------------------------------------------------------------- 1 | #include "oldatabase.h" 2 | 3 | olNode olNodeCreate( 4 | olRoot root, 5 | char *name) 6 | { 7 | olNode node = olNodeAlloc(); 8 | 9 | olNodeSetName(node, name, strlen(name) + 1); 10 | olRootInsertNode(root, node); 11 | return node; 12 | } 13 | 14 | int olRootCompareNode( 15 | olNode a, 16 | olNode b) 17 | { 18 | uint32 i, m = utMin(olNodeGetNumName(a), olNodeGetNumName(b)); 19 | char *nameA = olNodeGetName(a); 20 | char *nameB = olNodeGetName(b); 21 | 22 | for(i=0; i < m; i++) { 23 | if(nameB[i] < nameA[i]) { 24 | return -1; 25 | } else if(nameB[i] > nameA[i]) { 26 | return +1; 27 | } 28 | } 29 | if(olNodeGetNumName(b) < olNodeGetNumName(a)) { 30 | return -1; 31 | } else if(olNodeGetNumName(b) > olNodeGetNumName(a)) { 32 | return +1; 33 | } 34 | return 0; 35 | } 36 | 37 | static void verifyTree( 38 | olNode node) 39 | { 40 | olNode parent = olNodeGetParentRootNode(node); 41 | olNode left = olNodeGetLeftRootNode(node); 42 | olNode right = olNodeGetRightRootNode(node); 43 | 44 | utAssert(parent == olNodeNull || olNodeGetLeftRootNode(parent) == node || olNodeGetRightRootNode(parent) == node); 45 | if(left != olNodeNull) { 46 | utAssert(!olNodeIsRedRootNode(node) || !olNodeIsRedRootNode(left)); 47 | verifyTree(left); 48 | } 49 | if(right != olNodeNull) { 50 | utAssert(!olNodeIsRedRootNode(node) || !olNodeIsRedRootNode(right)); 51 | verifyTree(right); 52 | } 53 | } 54 | 55 | static void verifyOrderedList( 56 | olRoot root) 57 | { 58 | olNode node; 59 | olNode rootNode = olRootGetRootNode(root); 60 | olNode prevNode = olNodeNull; 61 | 62 | olForeachRootNode(root, node) { 63 | utAssert(prevNode == olNodeNull || olRootCompareNode(prevNode, node) >= 0); 64 | } olEndRootNode; 65 | if(rootNode != olNodeNull) { 66 | verifyTree(rootNode); 67 | } 68 | } 69 | 70 | static void indent( 71 | uint32 depth) 72 | { 73 | int32 xChar; 74 | 75 | for(xChar = 0; xChar < depth; xChar++) { 76 | utDebug("\t"); 77 | } 78 | } 79 | 80 | static void dumpTree( 81 | olNode node, 82 | uint32 depth) 83 | { 84 | olNode left, right; 85 | 86 | if(node == olNodeNull) { 87 | indent(depth); 88 | utDebug("NULL\n"); 89 | return; 90 | } 91 | left = olNodeGetLeftRootNode(node); 92 | right = olNodeGetRightRootNode(node); 93 | dumpTree(left, depth + 1); 94 | indent(depth); 95 | utDebug("%s 0x%x %s\n", olNodeGetName(node), olNode2Index(node), olNodeIsRedRootNode(node)? "red" : "black"); 96 | dumpTree(right, depth + 1); 97 | } 98 | 99 | static uint32 countRootNodes( 100 | olRoot root) 101 | { 102 | olNode node; 103 | uint32 numNodes = 0; 104 | 105 | olForeachRootNode(root, node) { 106 | numNodes++; 107 | } olEndRootNode; 108 | return numNodes; 109 | } 110 | 111 | static olNode pickRandomNode( 112 | olRoot root) 113 | { 114 | olNode node = olRootGetFirstNode(root); 115 | uint32 numNodes = countRootNodes(root); 116 | uint32 randIndex; 117 | uint32 xNode; 118 | 119 | if(node == olNodeNull) { 120 | return olNodeNull; 121 | } 122 | randIndex = utRandN(numNodes); 123 | for(xNode = 0; xNode < randIndex; xNode++) { 124 | node = olNodeGetNextRootNode(node); 125 | } 126 | return node; 127 | } 128 | 129 | int main( 130 | int argc, 131 | char **argv) 132 | { 133 | olRoot root; 134 | olNode node; 135 | FILE *f; 136 | char buffer[1024]; 137 | 138 | utStart(); 139 | utInitLogFile("ordered.log"); 140 | olDatabaseStart(); 141 | root = olRootAlloc(); 142 | if(argc != 2) { 143 | utExit("Usage: ordered file"); 144 | } 145 | f = fopen(argv[1], "r"); 146 | if(f == NULL) { 147 | utExit("Unable to open %s", argv[1]); 148 | } 149 | while(fscanf(f, "%s", buffer) >= 0) { 150 | olNodeCreate(root, buffer); 151 | utDebug("====================================================================\n"); 152 | dumpTree(olRootGetRootNode(root), 0); 153 | verifyOrderedList(root); 154 | } 155 | fclose(f); 156 | olForeachRootNode(root, node) { 157 | utLogMessage("%s", olNodeGetName(node)); 158 | } olEndRootNode; 159 | utDo { 160 | node = pickRandomNode(root); 161 | } utWhile(node != olNodeNull) { 162 | utDebug("====================================================================\n"); 163 | utDebug("Deleting node %s\n", olNodeGetName(node)); 164 | olRootRemoveNode(root, node); 165 | dumpTree(olRootGetRootNode(root), 0); 166 | verifyOrderedList(root); 167 | } utRepeat; 168 | olRootDestroy(root); 169 | olDatabaseStop(); 170 | utStop(false); 171 | return 0; 172 | } 173 | -------------------------------------------------------------------------------- /examples/ordered_list/states.txt: -------------------------------------------------------------------------------- 1 | alaska 2 | hawaii 3 | washington 4 | oregon 5 | california 6 | nevada 7 | idaho 8 | utah 9 | arizona 10 | montana 11 | wyoming 12 | colorado 13 | new_mexico 14 | north_dakota 15 | south_dakota 16 | nebraska 17 | kansas 18 | oklahoma 19 | texas 20 | minnesota 21 | iowa 22 | missouri 23 | arkansas 24 | louisiana 25 | mississippi 26 | alabama 27 | florida 28 | georgia 29 | south_carolina 30 | north_carolina 31 | virginia 32 | west_virginia 33 | maryland 34 | deleware 35 | pennsylvania 36 | new_jersey 37 | new_york 38 | rhode_island 39 | connecticutt 40 | massachussets 41 | new_hampshire 42 | vermont 43 | main 44 | tennessee 45 | kentucky 46 | ohio 47 | indiana 48 | illiniou 49 | michigan 50 | wisconsin 51 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/Benchmark.dd: -------------------------------------------------------------------------------- 1 | module OrderedList ol 2 | 3 | class Root 4 | 5 | class Node 6 | uint32 key 7 | 8 | relationship Root Node ordered_list key 9 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/README: -------------------------------------------------------------------------------- 1 | This directory has three benchmarks for measuring the performance of the red/black trees used in DataDraw ordered_list 2 | relationships. This test did the following in 1 minute 41 seconds on my 2 GHz Inspiron 9400 laptop with 2 GB of 3 | memory: 4 | 5 | - Created 50 million nodes, and inserted them into the ordered list. Each new nodes had a higher key value than 6 | any others yet inserted. 7 | - Iteratively created and inserted a new maximum node and deleted the minimum, 50 million times 8 | - Deleted the 50 million nodes from minimum to maximum 9 | 10 | Average tree depth before deleting at the end was 33.4. 11 | 12 | The second benchmark measures random insert/delete performance. Average tree depth at the end was 33.0. It does the 13 | following steps in 1 minutes 48 seconds: 14 | 15 | - Creates 50 million nodes with random keys and inserts them into the ordered list. 16 | - Iteratively creates a with random key and inerts it, then finds a random node and deletes it, 50 million times 17 | - Deletes the 50 million nodes 18 | 19 | The third benchmark compares DataDraw's red-black tree based ordered lists to the C++ STL red-black tree based 20 | multisets. Unfortunately, because I run a 64-bit laptop, it ran out of memory with 50 million nodes. However, for 30 21 | million integers in the multi-set, preforming the same operations as the rand_benchmark above, it takes 5 minutes and 22 | 32 seconds. Conclusion: at least for integer-keyed ordered lists, DataDraw beats C++ STL by a factor of several. 23 | 24 | To reproduce these results, simply do: 25 | 26 | $ make 27 | $ ./ordered_bechmark 28 | $ ./rand_bechmark 29 | $ ./multiset_benchmark 30 | 31 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/benchmark.h: -------------------------------------------------------------------------------- 1 | #include "oldatabase.h" 2 | 3 | uint32 olVerifyTree(olNode node); 4 | void olVerifyOrderedList(olRoot root); 5 | void olDumpTree(olNode node, uint32 depth); 6 | void olDumpOrderedList(olRoot root); 7 | void olReportStats(olRoot root); 8 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/loop_benchmark.c: -------------------------------------------------------------------------------- 1 | #include "benchmark.h" 2 | 3 | #define NUM_NODES 5000000 4 | #define NUM_LOOPS 50 5 | 6 | static olNode nodeCreate( 7 | olRoot root, 8 | uint32 key) 9 | { 10 | olNode node = olNodeAlloc(); 11 | 12 | olNodeSetKey(node, key); 13 | olRootInsertNode(root, node); 14 | return node; 15 | } 16 | 17 | int main( 18 | int argc, 19 | char **argv) 20 | { 21 | olRoot root; 22 | olNode node; 23 | uint32 xNode, xLoop, keySum = 0, totalKeys = 0; 24 | 25 | utStart(); 26 | utInitLogFile("ordered_benchmark.log"); 27 | olDatabaseStart(); 28 | root = olRootAlloc(); 29 | if(argc != 1) { 30 | utExit("Usage: benchmark"); 31 | } 32 | for(xNode = 0; xNode < NUM_NODES; xNode++) { 33 | node = nodeCreate(root, xNode); 34 | /* utDebug("========================================= created 0x%x\n", olNode2Index(node)); 35 | olDumpOrderedList(root); 36 | olVerifyOrderedList(root); */ 37 | } 38 | for(xLoop = 0; xLoop < NUM_LOOPS; xLoop++) { 39 | olForeachRootNode(root, node) { 40 | keySum += olNodeGetKey(node); 41 | totalKeys++; 42 | } olEndRootNode; 43 | } 44 | /* olVerifyOrderedList(root); 45 | olReportStats(root); */ 46 | olSafeForeachRootNode(root, node) { 47 | olRootRemoveNode(root, node); 48 | olNodeFree(node); 49 | } olEndSafeRootNode; 50 | utLogMessage("Key sum = %u, total keys = %u", keySum, totalKeys); 51 | olRootDestroy(root); 52 | olDatabaseStop(); 53 | utStop(true); 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/makefile: -------------------------------------------------------------------------------- 1 | all: ordered_benchmark rand_benchmark loop_benchmark multiset_benchmark multisetloop_benchmark 2 | 3 | ordered_benchmark: ordered_benchmark.c oldatabase.c oldatabase.h benchmark.h util.c ../../util/ddutil.h ../../util/libddutil-dbg.a 4 | gcc -O2 ordered_benchmark.c oldatabase.c util.c ../../util/libddutil.a -o ordered_benchmark 5 | #gcc -g -DDD_DEBUG ordered_benchmark.c oldatabase.c util.c ../../util/libddutil-dbg.a -o ordered_benchmark 6 | 7 | rand_benchmark: rand_benchmark.c oldatabase.c oldatabase.h benchmark.h util.c ../../util/ddutil.h ../../util/libddutil-dbg.a 8 | gcc -O2 -g rand_benchmark.c oldatabase.c util.c ../../util/libddutil.a -o rand_benchmark 9 | #gcc -g -DDD_DEBUG rand_benchmark.c oldatabase.c util.c ../../util/libddutil-dbg.a -o rand_benchmark 10 | 11 | loop_benchmark: loop_benchmark.c oldatabase.c oldatabase.h benchmark.h util.c ../../util/ddutil.h ../../util/libddutil-dbg.a 12 | gcc -O2 loop_benchmark.c oldatabase.c util.c ../../util/libddutil.a -o loop_benchmark 13 | #gcc -g -DDD_DEBUG loop_benchmark.c oldatabase.c util.c ../../util/libddutil-dbg.a -o loop_benchmark 14 | 15 | 16 | multiset_benchmark: multiset_benchmark.cpp 17 | g++ -O2 -g multiset_benchmark.cpp -o multiset_benchmark 18 | 19 | multisetloop_benchmark: multisetloop_benchmark.cpp 20 | g++ -O2 -g multisetloop_benchmark.cpp -o multisetloop_benchmark 21 | 22 | ../../util/libddutil.a: 23 | make -C ../../util clean 24 | make -C ../../util libddutil.a 25 | 26 | oldatabase.c oldatabase.h: Benchmark.dd 27 | ../../src/datadraw Benchmark.dd 28 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/multiset_benchmark.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | //#define NUM_NODES 30000000 8 | #define NUM_NODES 5000000 9 | 10 | int main() 11 | { 12 | /* type of the collection: 13 | * - duplicates allowed 14 | * - elements are integral values 15 | * - descending order 16 | */ 17 | typedef multiset > IntSet; 18 | 19 | IntSet coll1; // empty multiset container 20 | 21 | // insert elements in random order 22 | int x; 23 | for(x = 0; x < NUM_NODES; x++) { 24 | int randKey = rand(); 25 | coll1.insert(randKey); 26 | } 27 | for(x = 0; x < NUM_NODES; x++) { 28 | int randKey = rand(); 29 | coll1.insert(randKey); 30 | randKey = rand(); 31 | IntSet::iterator lowerKey = coll1.lower_bound(randKey); 32 | if(lowerKey == coll1.end()) { 33 | lowerKey = coll1.begin(); 34 | } 35 | coll1.erase(*lowerKey); 36 | } 37 | coll1.erase(coll1.begin(), coll1.end()); 38 | } 39 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/multisetloop_benchmark.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | //#define NUM_NODES 30000000 8 | #define NUM_NODES 5000000 9 | #define NUM_LOOPS 50 10 | 11 | int main() 12 | { 13 | /* type of the collection: 14 | * - duplicates allowed 15 | * - elements are integral values 16 | * - descending order 17 | */ 18 | typedef multiset > IntSet; 19 | unsigned int keySum = 0, totalKeys = 0; 20 | 21 | IntSet coll1; // empty multiset container 22 | 23 | // insert elements in random order 24 | int x; 25 | for(x = 0; x < NUM_NODES; x++) { 26 | coll1.insert(x); 27 | } 28 | for(x = 0; x < NUM_LOOPS; x++) { 29 | IntSet::iterator lp; 30 | for(lp = coll1.begin(); lp != coll1.end(); lp++) { 31 | keySum += *lp; 32 | totalKeys++; 33 | } 34 | } 35 | cout << "Key sum " << keySum << ", total keys " << totalKeys << endl; 36 | coll1.erase(coll1.begin(), coll1.end()); 37 | } 38 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/ordered_benchmark.c: -------------------------------------------------------------------------------- 1 | #include "benchmark.h" 2 | 3 | #define NUM_NODES 5000000 4 | 5 | static olNode nodeCreate( 6 | olRoot root, 7 | uint32 key) 8 | { 9 | olNode node = olNodeAlloc(); 10 | 11 | olNodeSetKey(node, key); 12 | olRootInsertNode(root, node); 13 | return node; 14 | } 15 | 16 | int main( 17 | int argc, 18 | char **argv) 19 | { 20 | olRoot root; 21 | olNode node; 22 | uint32 xNode; 23 | 24 | utStart(); 25 | utInitLogFile("ordered_benchmark.log"); 26 | olDatabaseStart(); 27 | root = olRootAlloc(); 28 | if(argc != 1) { 29 | utExit("Usage: benchmark"); 30 | } 31 | for(xNode = 0; xNode < NUM_NODES; xNode++) { 32 | node = nodeCreate(root, xNode); 33 | /* utDebug("========================================= created 0x%x\n", olNode2Index(node)); 34 | olDumpOrderedList(root); 35 | olVerifyOrderedList(root); */ 36 | } 37 | for(xNode = NUM_NODES; xNode < NUM_NODES << 1; xNode++) { 38 | node = nodeCreate(root, xNode); 39 | /* utDebug("========================================= created 0x%x\n", olNode2Index(node)); 40 | olDumpOrderedList(root); 41 | olVerifyOrderedList(root); */ 42 | node = olRootGetFirstNode(root); 43 | olRootRemoveNode(root, node); 44 | /* utDebug("========================================= Destroyed 0x%x\n", olNode2Index(node)); */ 45 | olNodeFree(node); 46 | /* olDumpOrderedList(root); 47 | olVerifyOrderedList(root); */ 48 | } 49 | olVerifyOrderedList(root); 50 | olReportStats(root); 51 | olSafeForeachRootNode(root, node) { 52 | olRootRemoveNode(root, node); 53 | olNodeFree(node); 54 | } olEndSafeRootNode; 55 | olRootDestroy(root); 56 | olDatabaseStop(); 57 | utStop(true); 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/rand_benchmark.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "benchmark.h" 3 | 4 | #define NUM_NODES 5000000 5 | 6 | static void nodeCreate( 7 | olRoot root, 8 | uint32 key) 9 | { 10 | olNode node = olNodeAlloc(); 11 | 12 | olNodeSetKey(node, key); 13 | olRootInsertNode(root, node); 14 | } 15 | 16 | int main( 17 | int argc, 18 | char **argv) 19 | { 20 | olRoot root; 21 | olNode node; 22 | uint32 xNode, randKey; 23 | 24 | utStart(); 25 | utInitLogFile("rand_benchmark.log"); 26 | olDatabaseStart(); 27 | root = olRootAlloc(); 28 | if(argc != 1) { 29 | utExit("Usage: benchmark"); 30 | } 31 | for(xNode = 0; xNode < NUM_NODES; xNode++) { 32 | randKey = rand(); 33 | nodeCreate(root, randKey); 34 | /* utDebug("===================================================================== Create 0x%x %u\n", 35 | olNode2Index(node), randKey); 36 | olDumpOrderedList(root); 37 | olVerifyOrderedList(root); */ 38 | } 39 | /* olDumpOrderedList(root); */ 40 | for(xNode = 0; xNode < NUM_NODES; xNode++) { 41 | randKey = rand(); 42 | nodeCreate(root, randKey); 43 | /* utDebug("===================================================================== Create 0x%x %u\n", 44 | olNode2Index(node), randKey); 45 | olDumpOrderedList(root); 46 | olVerifyOrderedList(root); */ 47 | randKey = rand(); 48 | node = olRootFindPrevNode(root, randKey); 49 | if(node == olNodeNull) { 50 | node = olRootGetLastNode(root); 51 | } 52 | /* utDebug("===================================================================== Destory 0x%x %u\n", 53 | olNode2Index(node), randKey); */ 54 | olRootRemoveNode(root, node); 55 | olNodeFree(node); 56 | /* olDumpOrderedList(root); 57 | olVerifyOrderedList(root); */ 58 | } 59 | olVerifyOrderedList(root); 60 | olReportStats(root); 61 | olSafeForeachRootNode(root, node) { 62 | olRootRemoveNode(root, node); 63 | olNodeFree(node); 64 | } olEndSafeRootNode; 65 | olRootDestroy(root); 66 | olDatabaseStop(); 67 | utStop(true); 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /examples/redblack_benchmark/util.c: -------------------------------------------------------------------------------- 1 | #include "benchmark.h" 2 | 3 | uint32 olVerifyTree( 4 | olNode node) 5 | { 6 | olNode parent = olNodeGetParentRootNode(node); 7 | olNode left = olNodeGetLeftRootNode(node); 8 | olNode right = olNodeGetRightRootNode(node); 9 | uint32 leftDepth = 0, rightDepth = 0; 10 | 11 | utAssert(parent == olNodeNull || olNodeGetLeftRootNode(parent) == node || olNodeGetRightRootNode(parent) == node); 12 | utAssert(parent != olNodeNull || !olNodeIsRedRootNode(node)); 13 | if(left != olNodeNull) { 14 | utAssert(!olNodeIsRedRootNode(node) || !olNodeIsRedRootNode(left)); 15 | utAssert(olNodeGetKey(node) >= olNodeGetKey(left)); 16 | leftDepth = olVerifyTree(left); 17 | } 18 | if(right != olNodeNull) { 19 | utAssert(!olNodeIsRedRootNode(node) || !olNodeIsRedRootNode(right)); 20 | utAssert(olNodeGetKey(node) <= olNodeGetKey(right)); 21 | rightDepth = olVerifyTree(right); 22 | } 23 | utAssert(leftDepth == rightDepth); 24 | if(olNodeIsRedRootNode(node)) { 25 | return leftDepth; 26 | } 27 | return leftDepth + 1; 28 | } 29 | 30 | void olVerifyOrderedList( 31 | olRoot root) 32 | { 33 | olNode node; 34 | olNode rootNode = olRootGetRootNode(root); 35 | olNode prevNode = olNodeNull; 36 | 37 | olForeachRootNode(root, node) { 38 | utAssert(prevNode == olNodeNull || olRootCompareNode(prevNode, node) >= 0); 39 | } olEndRootNode; 40 | if(rootNode != olNodeNull) { 41 | utAssert(olNodeGetParentRootNode(rootNode) == olNodeNull); 42 | olVerifyTree(rootNode); 43 | } 44 | } 45 | 46 | static indent( 47 | uint32 depth) 48 | { 49 | int32 xChar; 50 | 51 | for(xChar = 0; xChar < depth; xChar++) { 52 | utDebug("\t"); 53 | } 54 | } 55 | 56 | void olDumpTree( 57 | olNode node, 58 | uint32 depth) 59 | { 60 | olNode left, right; 61 | 62 | if(node == olNodeNull) { 63 | indent(depth); 64 | utDebug("NULL\n"); 65 | return; 66 | } 67 | left = olNodeGetLeftRootNode(node); 68 | right = olNodeGetRightRootNode(node); 69 | olDumpTree(left, depth + 1); 70 | indent(depth); 71 | utDebug("0x%x %u %s\n", olNode2Index(node), olNodeGetKey(node), 72 | olNodeIsRedRootNode(node)? "red" : "black"); 73 | olDumpTree(right, depth + 1); 74 | } 75 | 76 | void olDumpOrderedList( 77 | olRoot root) 78 | { 79 | olNode rootNode = olRootGetRootNode(root); 80 | 81 | olDumpTree(rootNode, 0); 82 | } 83 | 84 | static uint32 countStats( 85 | olNode node, 86 | uint32 depth, 87 | uint64 *totalPathDepth) 88 | { 89 | olNode left = olNodeGetLeftRootNode(node); 90 | olNode right = olNodeGetRightRootNode(node); 91 | uint32 numNodes = 1; 92 | 93 | *totalPathDepth += depth; 94 | if(left != olNodeNull) { 95 | numNodes += countStats(left, depth + 1, totalPathDepth); 96 | } 97 | if(right != olNodeNull) { 98 | numNodes += countStats(right, depth + 1, totalPathDepth); 99 | } 100 | return numNodes; 101 | } 102 | 103 | void olReportStats( 104 | olRoot root) 105 | { 106 | olNode rootNode = olRootGetRootNode(root); 107 | uint64 totalPathDepth = 0; 108 | uint32 numNodes; 109 | 110 | if(rootNode == olNodeNull) { 111 | utLogMessage("This tree is empty"); 112 | return; 113 | } 114 | numNodes = countStats(olRootGetRootNode(root), 1, &totalPathDepth); 115 | utLogMessage("There are %u nodes with average depth %0.1f", numNodes, ((double)totalPathDepth/numNodes)); 116 | } 117 | -------------------------------------------------------------------------------- /examples/sparse/README: -------------------------------------------------------------------------------- 1 | This is a simple test of generated attributes. 2 | 3 | To use it type: 4 | 5 | $ ./configure 6 | $ ./make 7 | 8 | To execute it, just type: 9 | 10 | $ ./sparse nodes.txt 11 | -------------------------------------------------------------------------------- /examples/sparse/Sparse.dd: -------------------------------------------------------------------------------- 1 | module Sparse ht 2 | 3 | class Graph 4 | 5 | class Node 6 | array char name sparse 7 | int32 x = "1" sparse 8 | int32 y = "1" 9 | 10 | relationship Graph Node hashed x y child_only mandatory sparse 11 | -------------------------------------------------------------------------------- /examples/sparse/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SOURCE="sparse.c 4 | htdatabase.c" 5 | 6 | if [ ! -d obj ]; then 7 | mkdir obj 8 | fi 9 | 10 | ../../src/datadraw Sparse.dd 11 | 12 | CFLAGS="-g -Wall -W -Wno-unused-parameter -Wno-unused-function -DDD_DEBUG -I../../util" 13 | LIBS="" 14 | 15 | if [ "`uname -m`" = x86_64 ]; then 16 | CFLAGS="$CFLAGS -m64" 17 | fi 18 | 19 | echo "CFLAGS=$CFLAGS 20 | LIBS=$LIBS 21 | " > Makefile 22 | 23 | echo "OBJECTS=\\" >> Makefile 24 | for sourceFile in $SOURCE; do 25 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 26 | echo "$objFile\\" >> Makefile 27 | done 28 | 29 | echo " 30 | 31 | sparse: ../../util/libddutil-dbg.a \$(OBJECTS) 32 | \$(CC) \$(CFLAGS) \$(OBJECTS) \$(LIBS) ../../util/libddutil-dbg.a -o sparse 33 | 34 | ../../util/libddutil-dbg.a: 35 | make -C ../../util clean 36 | make -C ../../util libddutil-dbg.a 37 | 38 | htdatabase.c htdatabase.h: Sparse.dd 39 | ../../src/datadraw Sparse.dd 40 | 41 | clean: 42 | rm -f \$(OBJECTS) 43 | 44 | " >> Makefile 45 | 46 | for sourceFile in $SOURCE; do 47 | objFile="obj/`basename $sourceFile | sed 's/\.c$/.o/'`" 48 | echo "$objFile: $sourceFile 49 | \$(CC) -c \$(CFLAGS) $sourceFile -o $objFile 50 | " >> Makefile 51 | done 52 | 53 | gcc -M $CFLAGS $SOURCE | sed 's/^\([^ ].*\.o:\)/obj\/\1/' >> Makefile 54 | -------------------------------------------------------------------------------- /examples/sparse/nodes.txt: -------------------------------------------------------------------------------- 1 | a 10 4 2 | b 48 132 3 | c 11 4 4 | d 48 131 5 | e 48 133 6 | f 49 132 7 | g 47 133 8 | h 49 131 9 | i 48 132 10 | j 10 5 11 | -------------------------------------------------------------------------------- /examples/sparse/sparse.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------------------- 2 | DataDraw is a CASE tool for generating data structures in C from simple descriptions. 3 | --------------------------------------------------------------------------------------------------*/ 4 | #include 5 | #include 6 | #include "htdatabase.h" 7 | 8 | htGraph htTheGraph; 9 | 10 | /*-------------------------------------------------------------------------------------------------- 11 | Create a new node. 12 | --------------------------------------------------------------------------------------------------*/ 13 | htNode htNodeCreate( 14 | char *name, 15 | int32 x, 16 | int32 y) 17 | { 18 | htNode node = htGraphFindNode(htTheGraph, x, y); 19 | 20 | if(node != htNodeNull) { 21 | utExit("Node %s is physically on top of node %s", name, htNodeGetName(node)); 22 | } 23 | node = htNodeAlloc(); 24 | htNodeSetName(node, name, strlen(name) + 1); 25 | htNodeSetX(node, x); 26 | htNodeSetY(node, y); 27 | htGraphInsertNode(htTheGraph, node); 28 | return node; 29 | } 30 | 31 | /*-------------------------------------------------------------------------------------------------- 32 | Read in the nodes from the text file. 33 | --------------------------------------------------------------------------------------------------*/ 34 | static void readNodes( 35 | char *filename) 36 | { 37 | char buffer[1024]; 38 | FILE *file = fopen(filename, "r"); 39 | htNode node; 40 | int x, y; 41 | 42 | if(file == NULL) { 43 | printf("Unable to open file %s\n", filename); 44 | exit(1); 45 | } 46 | while(fscanf(file, "%s %d %d", buffer, &x, &y) == 3) { 47 | node = htNodeCreate(buffer, x, y); 48 | } 49 | fclose(file); 50 | } 51 | 52 | /*-------------------------------------------------------------------------------------------------- 53 | This is the actual main routine. 54 | --------------------------------------------------------------------------------------------------*/ 55 | int main( 56 | int argc, 57 | char **argv) 58 | { 59 | utStart(); 60 | utInitLogFile("hash.log"); 61 | htDatabaseStart(); 62 | htTheGraph = htGraphAlloc(); 63 | readNodes(argv[1]); 64 | htDatabaseStop(); 65 | utStop(false); 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /examples/sym/README: -------------------------------------------------------------------------------- 1 | This simple example just creates a bunch of sym objects, and then looks them up. To use it type: 2 | 3 | $ ./make 4 | 5 | To execute it, just type: 6 | 7 | $ ./sym 8 | -------------------------------------------------------------------------------- /examples/sym/makefile: -------------------------------------------------------------------------------- 1 | sym: sym.c ../../util/ddutil.h ../../util/libddutil-dbg.a 2 | gcc -g -DDD_DEBUG sym.c ../../util/libddutil-dbg.a -o sym 3 | 4 | ../../util/libddutil-dbg.a: 5 | make -C ../../util clean 6 | make -C ../../util libddutil-dbg.a 7 | 8 | -------------------------------------------------------------------------------- /examples/sym/sym.c: -------------------------------------------------------------------------------- 1 | #include "ddutil.h" 2 | 3 | int main(void) 4 | { 5 | char first, second, third, fourth; 6 | uint32 xLookup; 7 | 8 | utStart(); 9 | printf("Building symbols\n"); 10 | for(first = 'a'; first <= 'z'; first++) { 11 | for(second = 'a'; second <= 'z'; second++) { 12 | for(third = 'a'; third <= 'z'; third++) { 13 | for(fourth = 'a'; fourth <= 'z'; fourth++) { 14 | utSymCreateFormatted("%c%c%c%c", first, second, third, fourth); 15 | } 16 | } 17 | } 18 | } 19 | printf("Looking up symbols\n"); 20 | for(xLookup = 0; xLookup < 24*24*24*24; xLookup++) { 21 | utSymCreateFormatted("%c%c%c%c", 'a' + utRandN(24), 'a' + utRandN(24), 'a' + utRandN(24), 'a' + utRandN(24)); 22 | } 23 | utStop(false); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /examples/treap_benchmark/README: -------------------------------------------------------------------------------- 1 | This directory has two benchmarks for measuring the performance of the treaps used in DataDraw ordered_list 2 | relationships. This test did the following in 22 seconds on my 2 GHz Inspiron 9400 laptop with 2 GB of memory: 3 | 4 | - Created 50 million nodes, and inserted them into the ordered list. Each new nodes had a higher key value than 5 | any others yet inserted. 6 | - Iteratively created and inserted a new maximum node and deleted the minimum, 50 million times 7 | - Deleted the 50 million nodes from minimum to maximum 8 | 9 | The initial 50 million nodes are created and inserted in 7 seconds. The 50 million create, insert, remove and delete 10 | operations happen in 13 seconds. The 50 million removal and deletions happened in 2 seconds. Total runtime was 22 11 | seconds. Average tree depth before deleting at the end was 33.4. 12 | 13 | The second benchmark measures random insert/delete performance. It is interesting that it runs much slower, taking 18 14 | minutes. Average tree depth at the end was 33.0. It: 15 | 16 | - Creates 50 million nodes with random keys and inserts them into the ordered list. 17 | - Iteratively creates a with random key and inerts it, then finds a random node and deletes it, 50 million times 18 | - Deletes the 50 million nodes 19 | 20 | To reproduce these results, simply do: 21 | 22 | $ make 23 | $ ./ordered_bechmark 24 | $ ./rand_bechmark 25 | 26 | -------------------------------------------------------------------------------- /examples/treap_benchmark/benchmark.h: -------------------------------------------------------------------------------- 1 | #include "oltreap.h" 2 | 3 | void olVerifyTree(olNode node); 4 | void olVerifyOrderedList(olRoot root); 5 | void olDumpTree(olNode node, uint32 depth); 6 | void olDumpOrderedList(olRoot root); 7 | void olReportStats(olRoot root); 8 | -------------------------------------------------------------------------------- /examples/treap_benchmark/makefile: -------------------------------------------------------------------------------- 1 | all: ordered_benchmark rand_benchmark 2 | 3 | ordered_benchmark: ordered_benchmark.c oltreap.c oltreap.h benchmark.h util.c ../../util/ddutil.h ../../util/libddutil-dbg.a 4 | gcc -O2 ordered_benchmark.c oltreap.c util.c ../../util/libddutil.a -o ordered_benchmark 5 | 6 | rand_benchmark: rand_benchmark.c oltreap.c oltreap.h benchmark.h util.c ../../util/ddutil.h ../../util/libddutil-dbg.a 7 | gcc -O2 rand_benchmark.c oltreap.c util.c ../../util/libddutil.a -o rand_benchmark 8 | #gcc -g rand_benchmark.c oltreap.c util.c ../../util/libddutil-dbg.a -o rand_benchmark 9 | #gcc -g -pg rand_benchmark.c oltreap.c util.c ../../util/libddutil-dbg.a -o rand_benchmark 10 | 11 | ../../util/libddutil.a: 12 | make -C ../../util clean 13 | make -C ../../util libddutil.a 14 | -------------------------------------------------------------------------------- /examples/treap_benchmark/ordered_benchmark.c: -------------------------------------------------------------------------------- 1 | #include "benchmark.h" 2 | 3 | #define NUM_NODES 5000000 4 | 5 | static void nodeCreate( 6 | olRoot root, 7 | uint32 key) 8 | { 9 | olNode node = olNodeAllocRaw(); 10 | 11 | olNodeSetKey(node, key); 12 | olNodeSetRoot(node, root); 13 | olRootInsertNode(root, node); 14 | } 15 | 16 | int main( 17 | int argc, 18 | char **argv) 19 | { 20 | olRoot root; 21 | olNode node; 22 | uint32 xNode; 23 | 24 | utStart(); 25 | utInitLogFile("ordered_benchmark.log"); 26 | olDatabaseStart(); 27 | root = olRootAlloc(); 28 | if(argc != 1) { 29 | utExit("Usage: benchmark"); 30 | } 31 | for(xNode = 0; xNode < NUM_NODES; xNode++) { 32 | nodeCreate(root, xNode); 33 | } 34 | for(xNode = NUM_NODES; xNode < NUM_NODES << 1; xNode++) { 35 | nodeCreate(root, xNode); 36 | node = olRootGetFirstNode(root); 37 | olRootRemoveNode(root, node); 38 | olNodeFree(node); 39 | } 40 | olVerifyOrderedList(root); 41 | olReportStats(root); 42 | olSafeForeachRootNode(root, node) { 43 | olRootRemoveNode(root, node); 44 | olNodeFree(node); 45 | } olEndSafeRootNode; 46 | olRootDestroy(root); 47 | olDatabaseStop(); 48 | utStop(true); 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /examples/treap_benchmark/rand_benchmark.c: -------------------------------------------------------------------------------- 1 | #include "benchmark.h" 2 | 3 | #define NUM_NODES 5000000 4 | 5 | static void nodeCreate( 6 | olRoot root, 7 | uint32 key) 8 | { 9 | olNode node = olNodeAllocRaw(); 10 | 11 | olNodeSetKey(node, key); 12 | olNodeSetRoot(node, root); 13 | olRootInsertNode(root, node); 14 | } 15 | 16 | int main( 17 | int argc, 18 | char **argv) 19 | { 20 | olRoot root; 21 | olNode node; 22 | uint32 xNode, randKey; 23 | 24 | utStart(); 25 | utInitLogFile("rand_benchmark.log"); 26 | olDatabaseStart(); 27 | root = olRootAlloc(); 28 | if(argc != 1) { 29 | utExit("Usage: benchmark"); 30 | } 31 | for(xNode = 0; xNode < NUM_NODES; xNode++) { 32 | randKey = utRand(); 33 | nodeCreate(root, randKey); 34 | } 35 | /* olDumpOrderedList(root); */ 36 | for(xNode = 0; xNode < NUM_NODES; xNode++) { 37 | randKey = utRand(); 38 | nodeCreate(root, randKey); 39 | /* olVerifyOrderedList(root); 40 | utDebug("===================================================================== Create 0x%x\n", 41 | olNode2Index(node)); 42 | olDumpOrderedList(root); */ 43 | randKey = utRand(); 44 | node = olRootFindPrevNode(root, randKey); 45 | if(node == olNodeNull) { 46 | node = olRootGetLastNode(root); 47 | } 48 | /* utDebug("===================================================================== Destory 0x%x\n", 49 | olNode2Index(node)); */ 50 | olRootRemoveNode(root, node); 51 | olNodeFree(node); 52 | /* olVerifyOrderedList(root); 53 | olDumpOrderedList(root); */ 54 | } 55 | olVerifyOrderedList(root); 56 | olReportStats(root); 57 | olSafeForeachRootNode(root, node) { 58 | olRootRemoveNode(root, node); 59 | olNodeFree(node); 60 | } olEndSafeRootNode; 61 | olRootDestroy(root); 62 | olDatabaseStop(); 63 | utStop(true); 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /examples/treap_benchmark/util.c: -------------------------------------------------------------------------------- 1 | #include "benchmark.h" 2 | 3 | void olVerifyTree( 4 | olNode node) 5 | { 6 | olNode parent = olNodeGetParentRootNode(node); 7 | olNode left = olNodeGetLeftRootNode(node); 8 | olNode right = olNodeGetRightRootNode(node); 9 | 10 | utAssert(parent == olNodeNull || olNodeGetLeftRootNode(parent) == node || olNodeGetRightRootNode(parent) == node); 11 | if(left != olNodeNull) { 12 | utAssert(olNodeGetPriorityRootNode(node) >= olNodeGetPriorityRootNode(left)); 13 | olVerifyTree(left); 14 | } 15 | if(right != olNodeNull) { 16 | utAssert(olNodeGetPriorityRootNode(node) >= olNodeGetPriorityRootNode(right)); 17 | olVerifyTree(right); 18 | } 19 | } 20 | 21 | void olVerifyOrderedList( 22 | olRoot root) 23 | { 24 | olNode node; 25 | olNode rootNode = olRootGetRootNode(root); 26 | olNode prevNode = olNodeNull; 27 | 28 | olForeachRootNode(root, node) { 29 | utAssert(prevNode == olNodeNull || olRootCompareNode(prevNode, node) >= 0); 30 | } olEndRootNode; 31 | if(rootNode != olNodeNull) { 32 | olVerifyTree(rootNode); 33 | } 34 | } 35 | 36 | static indent( 37 | uint32 depth) 38 | { 39 | int32 xChar; 40 | 41 | for(xChar = 0; xChar < depth; xChar++) { 42 | utDebug("\t"); 43 | } 44 | } 45 | 46 | void olDumpTree( 47 | olNode node, 48 | uint32 depth) 49 | { 50 | olNode left, right; 51 | 52 | if(node == olNodeNull) { 53 | indent(depth); 54 | utDebug("NULL\n"); 55 | return; 56 | } 57 | left = olNodeGetLeftRootNode(node); 58 | right = olNodeGetRightRootNode(node); 59 | olDumpTree(left, depth + 1); 60 | indent(depth); 61 | utDebug("%u 0x%x %u\n", olNodeGetKey(node), olNode2Index(node), olNodeGetPriorityRootNode(node)); 62 | olDumpTree(right, depth + 1); 63 | } 64 | 65 | void olDumpOrderedList( 66 | olRoot root) 67 | { 68 | olNode rootNode = olRootGetRootNode(root); 69 | 70 | olDumpTree(rootNode, 0); 71 | } 72 | 73 | static uint32 countStats( 74 | olNode node, 75 | uint32 depth, 76 | uint64 *totalPathDepth) 77 | { 78 | olNode left = olNodeGetLeftRootNode(node); 79 | olNode right = olNodeGetRightRootNode(node); 80 | uint32 numNodes = 1; 81 | 82 | *totalPathDepth += depth; 83 | if(left != olNodeNull) { 84 | numNodes += countStats(left, depth + 1, totalPathDepth); 85 | } 86 | if(right != olNodeNull) { 87 | numNodes += countStats(right, depth + 1, totalPathDepth); 88 | } 89 | return numNodes; 90 | } 91 | 92 | void olReportStats( 93 | olRoot root) 94 | { 95 | olNode rootNode = olRootGetRootNode(root); 96 | uint64 totalPathDepth = 0; 97 | uint32 numNodes; 98 | 99 | if(rootNode == olNodeNull) { 100 | utLogMessage("This tree is empty"); 101 | return; 102 | } 103 | numNodes = countStats(olRootGetRootNode(root), 1, &totalPathDepth); 104 | utLogMessage("There are %u nodes with average depth %0.1f", numNodes, ((double)totalPathDepth/numNodes)); 105 | } 106 | -------------------------------------------------------------------------------- /manual.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/manual.odt -------------------------------------------------------------------------------- /manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/manual.pdf -------------------------------------------------------------------------------- /postweb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cp manual.odt manual.pdf www 3 | rsync -av --exclude=.svn --delete --rsh=ssh www/ smilindog2000@datadraw.sourceforge.net:/home/groups/d/da/datadraw/htdocs 4 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.5) 2 | 3 | 4 | if(NOT MAINBUILD) 5 | project(datadraw) 6 | 7 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake) 8 | set(PACKAGE ${PROJECT_NAME}) 9 | set(CMAKE_SKIP_BUILD_RPATH TRUE) 10 | set(CMAKE_CURRENT_BINARY_DIR ${PROJECT_SOURCE_DIR}/bin) 11 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) 12 | set(REAL_EXECUTABLE_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}) 13 | 14 | set(CMAKE_VERBOSE_MAKEFILE TRUE CACHE BOOLEAN "" FORCE) 15 | 16 | add_subdirectory(../util ${CMAKE_CURRENT_BINARY_DIR}) 17 | 18 | if(MSVC AND NOT MSVC60) 19 | add_definitions( 20 | -D_CRT_FAR_MAPPINGS_NO_DEPRECATE 21 | -D_CRT_IS_WCTYPE_NO_DEPRECATE 22 | -D_CRT_MANAGED_FP_NO_DEPRECATE 23 | -D_CRT_NONSTDC_NO_DEPRECATE 24 | -D_CRT_NONSTDC_NO_WARNINGS 25 | -D_CRT_SECURE_NO_DEPRECATE 26 | -D_CRT_SECURE_NO_DEPRECATE_GLOBALS 27 | -D_CRT_SECURE_NO_WARNINGS 28 | -D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE 29 | -D_CRT_TIME_FUNCTIONS_NO_DEPRECATE 30 | -D_CRT_VCCLRIT_NO_DEPRECATE 31 | -D_SCL_SECURE_NO_DEPRECATE 32 | ) 33 | endif(MSVC AND NOT MSVC60) 34 | else(NOT MAINBUILD) 35 | add_custom_command( 36 | OUTPUT dvdatabase.c 37 | COMMAND ${DATADRAW} Database.dd 38 | COMMENT "Pre-compiling Database.dd" 39 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 40 | ) 41 | endif(NOT MAINBUILD) 42 | 43 | 44 | include(FindBISON) 45 | include(FindFLEX) 46 | 47 | set(BISON_FIND_REQUIRED TRUE) 48 | find_package(BISON) 49 | 50 | set(FLEX_FIND_REQUIRED TRUE) 51 | find_package(FLEX) 52 | 53 | BISON_TARGET(dvParse dvparse.y ${CMAKE_CURRENT_SOURCE_DIR}/dvparse.c COMPILE_FLAGS " -l -d -p dv -b dv ") 54 | FLEX_TARGET(dvScan dvscan.l ${CMAKE_CURRENT_SOURCE_DIR}/dvscan.c COMPILE_FLAGS " -L -f -Pdvlex ") 55 | ADD_FLEX_BISON_DEPENDENCY(dvScan dvParse) 56 | 57 | 58 | include_directories( 59 | .. 60 | ../util 61 | ) 62 | 63 | 64 | if(MSVC) 65 | include_directories(msw) 66 | endif(MSVC) 67 | 68 | 69 | add_executable( 70 | datadraw 71 | 72 | # dvParse 73 | dvparse.c dvparse.h 74 | # dvScan 75 | dvscan.c 76 | 77 | dv.h 78 | dvadmin.c 79 | dvbuild.c 80 | dvdatabase.c 81 | dvdatabase.h 82 | dvgenc.c 83 | dvgenh.c 84 | dvgenerate.c 85 | dvlexwrap.c 86 | dvmain.c 87 | dvparse.h 88 | dvread.c 89 | dvutil.c 90 | ) 91 | 92 | set_source_files_properties(dvparse.c dvparse.h dvscan.c PROPERTIES GENERATED TRUE) 93 | 94 | target_link_libraries(datadraw ddutil) 95 | 96 | install( 97 | TARGETS datadraw 98 | RUNTIME DESTINATION bin 99 | ) 100 | -------------------------------------------------------------------------------- /src/Database.dd: -------------------------------------------------------------------------------- 1 | // These are DataDraw's data structures 2 | 3 | module Database dv volatile 4 | 5 | enum RelationshipType REL_ 6 | LINKED_LIST 7 | DOUBLY_LINKED 8 | TAIL_LINKED 9 | POINTER 10 | ARRAY 11 | HEAP 12 | HASHED 13 | ORDERED_LIST 14 | UNBOUND 15 | 16 | enum PropertyType PROP_ 17 | INT 18 | UINT 19 | FLOAT 20 | DOUBLE 21 | BIT 22 | BOOL 23 | CHAR 24 | ENUM 25 | TYPEDEF 26 | POINTER 27 | SYM 28 | UNBOUND 29 | 30 | enum MemoryStyle MEM_ 31 | CREATE_ONLY 32 | FREE_LIST 33 | 34 | // This just gives us a way to keep track of top level data structures 35 | class Root create_only 36 | 37 | class Modpath create_only 38 | 39 | class Module create_only 40 | sym prefixSym 41 | bit Persistent 42 | bit undoRedo 43 | bit hasSparseData 44 | uint16 numFields // The total number of fields to be tracked 45 | uint32 numClasses // The number of classes in the module 46 | uint32 numEnums // The number of classes in the module 47 | bit elaborated // Set true after generating all the fields for relationships 48 | 49 | // Helper class to break many-to-many relationship between modules and modules they import 50 | class Link create_only 51 | 52 | class Schema create_only 53 | 54 | class Enum create_only 55 | sym prefixSym 56 | uint16 numEntries 57 | 58 | class Entry create_only 59 | uint32 value 60 | 61 | class Typedef create_only 62 | array char initializer 63 | 64 | class Class create_only 65 | MemoryStyle memoryStyle 66 | uint8 referenceSize 67 | bit generateArrayClass 68 | bit generateAttributes 69 | bit Sparse 70 | uint16 numFields 71 | uint16 number 72 | sym baseClassSym 73 | 74 | class Property create_only 75 | PropertyType type 76 | bit Array 77 | bit Cascade 78 | bit Sparse 79 | bit View 80 | bit expanded // So that we only generate relationship fields once 81 | uint32 fieldNumber // Used in persistent databases 82 | Property firstElementProp // Used only for arrays 83 | Property numElementsProp // Used only for arrays 84 | bit hidden // Hides fields in the manager. Used if we have to add a free-list property 85 | array char initializer 86 | bit fixedSize 87 | array char index 88 | union type 89 | Enum enumProp: ENUM 90 | Typedef typedefProp: TYPEDEF 91 | Class classProp: POINTER 92 | sym typeSym: SYM // This is only used during parsing, to allow for forward references 93 | uint8 width: INT UINT 94 | uint32 line // This is set in parsing so we can report a line number in binding errors 95 | 96 | class Sparsegroup // Group of related sparse properties on a class 97 | 98 | class Relationship create_only 99 | RelationshipType type 100 | sym parentLabelSym 101 | sym childLabelSym 102 | bit Mandatory // Upper case avoids keyword collision 103 | bit Cascade 104 | bit accessChild 105 | bit accessParent 106 | bit sharedParent // Set for all but one relationship that share a common parent pointer 107 | bit Sparse 108 | bit Expanded // So that we only generate relationship fields once 109 | bit Unordered 110 | 111 | class Key 112 | uint32 lineNum // For reporting errors during binding 113 | 114 | class Keyproperty 115 | sym PropertySym // For unbound keys 116 | 117 | class Union 118 | sym propertySym 119 | Property typeProperty 120 | uint32 line // This is set in parsing so we can report a line number in binding errors 121 | uint16 number // This is used rather than a name, since unions are not named 122 | uint32 fieldNumber // Used in persistent databases 123 | uint16 numCases 124 | 125 | class Case 126 | sym entrySym // Used in binding to an entry 127 | 128 | // This class represents cache_together declarations 129 | class Cache 130 | uint16 number // This is used rather than a name, since caches are not named 131 | uint32 line // This is set in parsing so we can report a line number in binding errors 132 | 133 | class Propident 134 | sym Sym 135 | 136 | // Relationships are not owned by one class, but shared equally between "parent" and "child" 137 | relationship Root Modpath hashed mandatory 138 | relationship Root Module hashed child_only mandatory 139 | 140 | relationship Module Class hashed mandatory 141 | relationship Module Enum hashed mandatory 142 | relationship Module Typedef hashed mandatory 143 | relationship Module Schema hashed mandatory 144 | relationship Module:Import Link:Import tail_linked mandatory 145 | relationship Module:Export Link:Export tail_linked mandatory 146 | 147 | relationship Schema Relationship tail_linked 148 | 149 | relationship Class Property hashed mandatory 150 | relationship Class Property:freeList child_only 151 | relationship Class Sparsegroup hashed mandatory 152 | relationship Sparsegroup Property tail_linked 153 | 154 | relationship Enum Entry hashed mandatory 155 | 156 | relationship Class:base Class:derived tail_linked mandatory 157 | relationship Class:parent Relationship:child tail_linked mandatory 158 | relationship Class:child Relationship:parent tail_linked mandatory 159 | relationship Class Union tail_linked mandatory 160 | 161 | relationship Relationship Property tail_linked // List of fields generated to support the relationship 162 | relationship Union Property tail_linked 163 | relationship Entry Case tail_linked mandatory 164 | relationship Property Case tail_linked mandatory 165 | relationship Relationship Key tail_linked mandatory 166 | relationship Key Keyproperty tail_linked mandatory 167 | relationship Property Keyproperty tail_linked mandatory 168 | relationship Relationship Sparsegroup:Parent 169 | relationship Relationship Sparsegroup:Child 170 | 171 | relationship Class Cache tail_linked mandatory 172 | relationship Cache Property tail_linked 173 | relationship Cache Propident tail_linked mandatory 174 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | ## -*- Makefile -*- 2 | ## 3 | ## 4 | 5 | bin_PROGRAMS= datadraw 6 | 7 | datadraw_SOURCES= \ 8 | dv.h dvadmin.c dvbuild.c dvdatabase.c dvdatabase.h dvgenc.c dvgenh.c \ 9 | dvgenerate.c dvlexwrap.c dvmain.c dvparse.h dvparse.y dvread.c \ 10 | dvscan.l dvutil.c 11 | 12 | AUTOMAKE_OPTIONS = subdir-objects 13 | INCLUDES= -I $(srcdir)/../util 14 | LDADD= ../util/libddutil-dbg.a 15 | 16 | AM_YFLAGS= -d -Wno-yacc -p dv 17 | AM_LFLAGS= -f -o dvscan.c 18 | 19 | # hopefully this won't cause a chicken and egg problem... 20 | DDR= datadraw 21 | dvdatabase.h dvdatabase.c: $(srcdir)/Database.dd 22 | @if test -x ./${DDR} ; then \ 23 | echo "${DDR} $(srcdir)/Database.dd" ; \ 24 | ./${DDR} $(srcdir)/Database.dd || ${DDR} $(srcdir)/Database.dd; \ 25 | else \ 26 | echo "WARNING: Database.dd has changed making dvdatabase.c and dvdatabase.h out of date" ; \ 27 | echo " However you have not finished building datadraw yet. So you may want to" ; \ 28 | echo " build again a 2nd time after your build (hopefully) finishes." ; \ 29 | fi 30 | 31 | dvlexwrap.c: dvparse.h 32 | 33 | # be sure to include the .dd file in the distribution 34 | EXTRA_DIST= Database.dd 35 | 36 | -------------------------------------------------------------------------------- /src/dv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Bill Cox 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA 17 | */ 18 | 19 | #include 20 | #include "dvdatabase.h" 21 | 22 | #define DV_MAX_INDENT 1024 23 | 24 | bool dvGenerateCode(dvModule module, char *includeFile, char *sourceFile); 25 | void dvWriteHeaderFile(dvModule module, char *includeFile); 26 | void dvWriteCFile(dvModule module, char *sourceFile); 27 | void dvGenerateAdminTool(dvModule module, char *sourceDir); 28 | bool dvReadFile(char *fileName, bool loadModules); 29 | extern void dvBindProperty(dvProperty property, dvModule module); 30 | void dvBindTypes(dvModule module); 31 | 32 | /* Constructors */ 33 | dvModpath dvModpathCreate(utSym sym, bool insertAtHeadOfList); 34 | dvModule dvModuleCreate(utSym sym, utSym prefix); 35 | dvEnum dvEnumCreate(dvModule module, utSym sym, utSym prefix); 36 | dvEntry dvEntryCreate(dvEnum owningEnum, utSym sym, uint32 value); 37 | dvTypedef dvTypedefCreate(dvModule module, utSym sym, char *initializer); 38 | dvSchema dvSchemaCreate(dvModule module, utSym sym); 39 | dvClass dvClassCreate(dvModule module, utSym sym, dvClass baseClass); 40 | dvProperty dvPropertyCreate(dvClass owningClass, dvUnion owningUnion, dvPropertyType type, utSym sym); 41 | dvUnion dvUnionCreate(dvClass owningClass, utSym propertySym, uint16 unionNumber); 42 | dvRelationship dvRelationshipCreate(dvSchema schema, dvClass parent, dvClass child, dvRelationshipType type, 43 | utSym parentLabel, utSym childLabel); 44 | dvLink dvLinkCreate(dvModule importModule, dvModule exportModule); 45 | dvKey dvKeyCreate(dvRelationship relationship, dvProperty property); 46 | dvKey dvUnboundKeyCreate(dvRelationship relationship, utSym propertySym, uint32 lineNum); 47 | dvCase dvCaseCreate(dvProperty property, dvEntry entry); 48 | dvSparsegroup dvSparsegroupCreate(dvClass theClass, utSym sym); 49 | dvCache dvCacheCreate(dvClass theClass); 50 | dvKeyproperty dvUnboundKeypropertyCreate(dvKey key, utSym sym); 51 | dvKeyproperty dvKeypropertyCreate(dvKey key, dvProperty property); 52 | 53 | /* Utility functions */ 54 | void prUtilStart(void); 55 | void prUtilStop(void); 56 | dvModule dvFindModuleFromPrefix(utSym prefix); 57 | uint8 dvFindPropertySize(dvProperty property); 58 | void dvWrtemp(FILE *file, char *temp, ...); 59 | char *dvSwrtemp(char *temp, ...); 60 | char *dvPropertyGetTypeName(dvProperty property); 61 | char *dvPropertyGetFieldTypeName(dvProperty property); 62 | uint32 dvComputeDatabaseHash(void); 63 | char *dvClassGetPrefix(dvClass theClass); 64 | char *dvPropertyGetPrefix(dvProperty property); 65 | utSym dvUpperSym(utSym sym); 66 | char *dvFindPropertyFormatString(dvProperty property); 67 | char *dvClassGetReferenceTypeName(dvClass theClass); 68 | bool dvModuleHasClassAttributes(dvModule module); 69 | void dvAddDefaultKey(dvRelationship relationship); 70 | bool dvRelationshipHashedByName(dvRelationship relationship); 71 | char *dvPropertyFindInitializer(dvProperty property); 72 | dvProperty dvClassLookupProperty(dvClass theClass, utSym sym); 73 | char *dvKeyGetLengthMacro(dvKey key, bool useParamName, char *param); 74 | char *dvKeyGetAccessMacro(dvKey key, bool useParamName, char * param); 75 | char *dvPropertyGetLengthMacro(dvProperty property, bool useParamName, char * param); 76 | char *dvPropertyGetAccessMacro(dvProperty property, bool useParamName, char * param); 77 | 78 | /* Some shortcut macros */ 79 | #define dvModuleGetPrefix(module) utSymGetName(dvModuleGetPrefixSym(module)) 80 | #define dvRelationshipGetParentLabel(theClass) utSymGetName(dvRelationshipGetParentLabelSym(theClass)) 81 | #define dvRelationshipGetChildLabel(theClass) utSymGetName(dvRelationshipGetChildLabelSym(theClass)) 82 | #define dvClassPersistent(theClass) dvModulePersistent(dvClassGetModule(theClass)) 83 | #define dvPropertyGetID(property) utSprintf("%u", dvPropertyGetFieldNumber(property)) 84 | #define dvClassRedo(theClass) (dvModulePersistent(dvClassGetModule(theClass)) || \ 85 | dvModuleUndoRedo(dvClassGetModule(theClass))) 86 | #define dvClassUndo(theClass) (dvModuleUndoRedo(dvClassGetModule(theClass))) 87 | #define dvUnionGetTypeName(theUnion) utSprintf("%s%sUnion%u", dvPrefix, \ 88 | dvClassGetName(dvUnionGetClass(theUnion)), dvUnionGetNumber(theUnion)) 89 | #define dvUnionGetFieldName(theUnion) utSprintf("union%d", dvUnionGetNumber(theUnion)) 90 | #define dvCacheGetTypeName(cache) utSprintf("struct %s%sCache%u", dvPrefix, \ 91 | dvClassGetName(dvCacheGetClass(cache)), dvCacheGetNumber(cache)) 92 | #define dvCacheGetFieldName(cache) utSprintf("cache%d", dvCacheGetNumber(cache)) 93 | 94 | /* Globals */ 95 | extern dvRoot dvTheRoot; /* Root of the database */ 96 | extern dvModule dvCurrentModule; /* Module just read by dvparse */ 97 | 98 | /* Lex, Yacc stuff */ 99 | extern uint32 dvLineNum; 100 | extern bool dvLoadModules; 101 | extern uint16 dvNumEndsRemaining; 102 | extern int dvparse(void); 103 | extern int dvlex(void); /* A wrapper around dvlexlex */ 104 | extern int dvlexlex(void); /* The real lexer */ 105 | extern void dverror(char *message, ...); 106 | extern char *dvlextext; 107 | extern FILE *dvFile; 108 | extern bool dvLastWasReturn; 109 | extern bool dvEnding; 110 | -------------------------------------------------------------------------------- /src/dvadmin.c: -------------------------------------------------------------------------------- 1 | /* 2 | DataDraw 3 | Copyright(C) 1992-2006 Bill Cox 4 | 5 | This program can be distributed under the terms of the GNU Library GPL. 6 | See the file COPYING.LIB. 7 | */ 8 | 9 | #include "dv.h" 10 | 11 | /*-------------------------------------------------------------------------------------------------- 12 | Create the administration tool for this module. 13 | --------------------------------------------------------------------------------------------------*/ 14 | void dvGenerateAdminTool( 15 | dvModule module, 16 | char *sourceDir) 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /src/dvlexwrap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Bill Cox 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA 17 | */ 18 | 19 | /*-------------------------------------------------------------------------------------------------- 20 | This is a simple wrapper to allow KWEND to be returned multiple times in a row. 21 | --------------------------------------------------------------------------------------------------*/ 22 | #include "dv.h" 23 | // Bazel-specific hack. 24 | #ifdef VERSION 25 | #include "third_party/datadraw/src/dvparse.h" 26 | #else 27 | #include "dvparse.h" 28 | #endif 29 | 30 | uint16 dvNumEndsRemaining; 31 | 32 | /*-------------------------------------------------------------------------------------------------- 33 | This is a simple wrapper to allow KWEND to be returned multiple times in a row. 34 | --------------------------------------------------------------------------------------------------*/ 35 | int dvlex(void) 36 | { 37 | if(dvNumEndsRemaining > 0) { 38 | dvNumEndsRemaining--; 39 | return KWEND; 40 | } 41 | return dvlexlex(); 42 | } 43 | -------------------------------------------------------------------------------- /src/dvversion.h: -------------------------------------------------------------------------------- 1 | #define DV_VERSION "1.X unstable release" 2 | -------------------------------------------------------------------------------- /src/msw/unistd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/src/msw/unistd.h -------------------------------------------------------------------------------- /util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | set(SRCS ddutil.h util.c utmanage.c utmem.c utmem.h utpersist.c utpersist.h utrand.c uttypes.h utoslayer.c) 4 | 5 | 6 | set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_DEBUG "DD_DEBUG") 7 | 8 | 9 | add_library( 10 | ddutil 11 | STATIC 12 | 13 | ${SRCS} utdatabase.c utdatabase.h 14 | ) 15 | set_target_properties(ddutil PROPERTIES COMPILE_DEFINITIONS UT_USE_UTDATABASE_H DEBUG_POSTFIX "_dbg") 16 | 17 | add_library( 18 | ddutilp 19 | STATIC 20 | 21 | ${SRCS} utdatabasep.c utdatabasep.h 22 | ) 23 | set_target_properties(ddutil PROPERTIES COMPILE_DEFINITIONS UT_USE_UTDATABASEP_H DEBUG_POSTFIX "_dbg") 24 | 25 | add_library( 26 | ddutilu 27 | STATIC 28 | 29 | ${SRCS} utdatabaseu.c utdatabaseu.h 30 | ) 31 | set_target_properties(ddutil PROPERTIES COMPILE_DEFINITIONS UT_USE_UTDATABASEU_H DEBUG_POSTFIX "_dbg") 32 | 33 | add_library( 34 | ddutilup 35 | STATIC 36 | 37 | ${SRCS} utdatabaseup.c utdatabaseup.h 38 | ) 39 | set_target_properties(ddutil PROPERTIES COMPILE_DEFINITIONS UT_USE_UTDATABASEUP_H DEBUG_POSTFIX "_dbg") 40 | 41 | install( 42 | TARGETS 43 | ddutil ddutilp ddutilu ddutilup 44 | ARCHIVE DESTINATION lib 45 | ) 46 | 47 | install( 48 | FILES 49 | ddutil.h 50 | utdatabase.h 51 | utdatabasep.h 52 | utdatabaseu.h 53 | utdatabaseup.h 54 | utmem.h 55 | utpersist.h 56 | uttypes.h 57 | DESTINATION 58 | include 59 | ) 60 | -------------------------------------------------------------------------------- /util/DatadrawUtil.dd: -------------------------------------------------------------------------------- 1 | module DatadrawUtil ut 2 | 3 | enum FieldType 4 | UT_BIT 5 | UT_BOOL 6 | UT_INT 7 | UT_UINT 8 | UT_CHAR 9 | UT_FLOAT 10 | UT_DOUBLE 11 | UT_POINTER 12 | UT_TYPEDEF 13 | UT_ENUM 14 | UT_SYM 15 | UT_UNION 16 | 17 | class Symtab create_only 18 | array sym table 19 | uint32 numSym 20 | 21 | class Sym create_only array 22 | array char name 23 | uint32 hashValue 24 | Sym next 25 | 26 | class Dynarray 27 | array uint8 value 28 | uint16 valueSize 29 | uint32 usedValue 30 | uint32 size 31 | -------------------------------------------------------------------------------- /util/Makefile.am: -------------------------------------------------------------------------------- 1 | ## -*- Makefile -*- 2 | ## 3 | ## 4 | 5 | AUTOMAKE_OPTIONS = subdir-objects 6 | 7 | lib_LIBRARIES= libddutil.a libddutil-dbg.a 8 | 9 | libddutil_a_SOURCES= ${SRCS} utdatabase.c utdatabase.h 10 | libddutil_dbg_a_SOURCES= ${SRCS} utdatabase.c utdatabase.h 11 | 12 | SRCS= ddutil.h util.c utmanage.c utmem.c utmem.h utpersist.c utpersist.h utrand.c uttypes.h utoslayer.c 13 | 14 | include_HEADERS= ddutil.h utdatabase.h utmem.h utpersist.h uttypes.h 15 | 16 | # used by windows -- do I need to do something for cygwin/mingw here??? 17 | EXTRA_DIST= utnt.c 18 | 19 | libddutil_a_CPPFLAGS= -DUT_USE_UTDATABASE_H 20 | libddutil_dbg_a_CPPFLAGS= -DUT_USE_UTDATABASE_H -DDD_DEBUG 21 | 22 | # hopefully this won't cause a chicken and egg problem... 23 | DDR= ../src/datadraw 24 | utdatabase.h utdatabase.c: $(srcdir)/DatadrawUtil.dd 25 | if test -f ${DDR} ; then \ 26 | ${DDR} -s utdatabase.c -h utdatabase.h $(srcdir)/DatadrawUtil.dd ; \ 27 | else \ 28 | echo "${DDR} has not been built yet. Using pre-built $@" ; \ 29 | fi 30 | 31 | # should figure out how to appropriately pass down the different flags to a 32 | # suffix rule. This may require exploiting some GNU make specific features 33 | # which would lock the user into GNU make. That is probably not too bad of 34 | # a thing to do since many users have already been forced into GNU make by 35 | # other software 36 | # SUFFIXES 37 | #.dd.c: 38 | # if test -x ${DDR} ; then \ 39 | # ${DDR} -s $@ -h $ $@.h $(srcdir)/DatadrawUtil.dd ; \ 40 | # else \ 41 | # echo "WARNING: DatadrawUtil.dd has changed making dvdatabase.c and dvdatabase.h out of date" ; \ 42 | # echo " However you have not finished building datadraw yet. So you may want to" ; \ 43 | # echo " build again a 2nd time after your build (hopefully) finishes." ; \ 44 | # fi 45 | 46 | # be sure to include the .dd file in the distribution 47 | EXTRA_DIST+= DatadrawUtil.dd 48 | 49 | -------------------------------------------------------------------------------- /util/utmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1991-2006 Bill Cox 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA 17 | */ 18 | 19 | /*============================================================================ 20 | Module : Memory checker 21 | Purpose: This module checks for writing past the end of arrays, and 22 | memory leaks. It is used in conjunction with the utCalloc 23 | functions. It works for both the local and far versions. 24 | ============================================================================*/ 25 | #ifndef UTMEM_H 26 | #define UTMEM_H 27 | 28 | #include 29 | 30 | #ifndef UTTYPES_H 31 | #include "uttypes.h" 32 | #endif 33 | 34 | #if __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | typedef uint32 utMemRef; 39 | typedef uint32 utStackRef; 40 | 41 | /*-------------------------------------------------------------------------------------------------- 42 | Object : utMem 43 | Purpose: Keep track of a block of memory allocated with any ut function. 44 | When mems are allocated, they are assigned to the current top 45 | stack. When they are deleted, they are first checked for 46 | validity. Pickets are used to check trashing memory. 47 | --------------------------------------------------------------------------------------------------*/ 48 | struct utMem_ { 49 | utStackRef oStack; 50 | void *memPtr; 51 | uint8 picket; 52 | utMemRef nMem; 53 | uint32 line; 54 | char *name; 55 | size_t size; 56 | bool used; 57 | }; 58 | 59 | extern struct utMem_ *utMems; 60 | extern uint32 utfFreeMem, utfVirgMem_, utmMem; 61 | 62 | #define ut0Mem UINT32_MAX 63 | #define utmMem() utmMem 64 | #define utfMem() 0 65 | #define utnMem(mem) ((mem) + 1) 66 | #define utfFreeMem() utfFreeMem 67 | #define utnFreeMem(mem) (utMems[mem].nMem) 68 | #define utnStackMem(stack, mem) (utMems[mem].nMem) 69 | #define utfVirgMem() utfVirgMem_ 70 | #define uttMemExists(mem) ((mem) < utfVirgMem()) 71 | #define utgMemPicket(mem) (utMems[mem].picket) 72 | #define utgMemPtr(mem) (utMems[mem].memPtr) 73 | #define utgMemName(mem) (utMems[mem].name) 74 | #define utgMemLine(mem) (utMems[mem].line) 75 | #define utgMemSize(mem) (utMems[mem].size) 76 | #define utoStackMem(mem) (utMems[mem].oStack) 77 | #define uttMemUsed(mem) (utMems[mem].used) 78 | extern utMemRef utcMem(void); 79 | extern void utdMem(utMemRef mem, char *fileName, uint32 line); 80 | extern utMemRef utBuildMem(void *memPtr, size_t size, char *file, uint32 line); 81 | extern utMemRef utqMemPtr(void *memPtr); 82 | 83 | /*-------------------------------------------------------------------------------------------------- 84 | Object : utStack 85 | Purpose: Memory handle stack. This allows us to keep track of all memory 86 | allocations past a mark, and have multiple levels of marks. 87 | When stacks are created, all new utMems are assigned to them. 88 | When a stack is deleted, an error is reported if any mems still 89 | exists for the stack. Errors are also reported if stacks are 90 | deleted out of order. 91 | --------------------------------------------------------------------------------------------------*/ 92 | struct utStack_ { 93 | utMemRef fMem; 94 | char *name; 95 | uint32 line; 96 | }; 97 | 98 | extern struct utStack_ *utStacks; 99 | extern uint32 utsStack, utmStack; 100 | 101 | #define ut0Stack UINT32_MAX 102 | #define utfStack() 0 103 | #define utlStack() ((utStackRef)((int16)utsStack() - 1)) 104 | #define utsStack() utsStack 105 | #define utmStack() utmStack 106 | #define utnStack(stack) ((stack) + 1) 107 | #define uttStackExists(stack) ((stack) < utsStack()) 108 | #define utfStackMem(stack) (utStacks[stack].fMem) 109 | #define utgStackName(stack) (utStacks[stack].name) 110 | #define utgStackLine(stack) (utStacks[stack].line) 111 | extern utStackRef utcStackTrace(char *fileName, uint32 line); 112 | extern void utdStackTrace(utStackRef stack, char *fileName, 113 | uint32 line); 114 | #define utcStack() utcStackTrace(__FILE__, __LINE__) 115 | #define utdStack(stack) utdStackTrace(stack, __FILE__, __LINE__) 116 | extern void utaStackMem(utStackRef stack, utMemRef mem); 117 | extern void utdStackMem(utStackRef stack, utMemRef mem, 118 | char *fileName, uint32 line); 119 | 120 | extern void utMemStart(void); 121 | extern void utMemStop(bool reportMemory); 122 | extern void utMemCheckTrace(char *fileName, uint32 line); 123 | #define utMemCheck() utMemCheckTrace(__FILE__, __LINE__) 124 | 125 | #define mtResizeArray(array, num) \ 126 | ((array) = realloc((void *)(array), (num), sizeof(*(array)))) 127 | #define mtNew(type) (type *)calloc(1, sizeof(type)) 128 | #define mtNewA(type, num) (type *)calloc((num), sizeof(type)) 129 | 130 | #if __cplusplus 131 | } 132 | #endif 133 | 134 | #endif 135 | -------------------------------------------------------------------------------- /util/utoslayer.c: -------------------------------------------------------------------------------- 1 | #if _WIN32 2 | # ifdef _MSC_VER 3 | # include "utnt.c" 4 | # else /* utcygwin works in MinGW too */ 5 | # include "utcygwin.c" 6 | # endif 7 | #else 8 | # include "utunix.c" 9 | #endif 10 | -------------------------------------------------------------------------------- /util/utrand.c: -------------------------------------------------------------------------------- 1 | /* Note about copyright: This is now available for free commercial use 2 | according to their web site. We just need to provide our changed version 3 | in the public domain, and note changes we make in this file. -- Bill Cox 4 | 5 | July 20, 2003 - Changed interface and formating to just provide utSetSeed 6 | and utRand, and modified types to conform to DataDraw types -- Bill Cox 7 | */ 8 | 9 | /* A C-program for MT19937: Integer version (1999/10/28) */ 10 | /* genrand() generates one pseudorandom unsigned integer (32bit) */ 11 | /* which is uniformly distributed among 0 to 2^32-1 for each */ 12 | /* call. sgenrand(seed) sets initial values to the working area */ 13 | /* of 624 words. Before genrand(), sgenrand(seed) must be */ 14 | /* called once. (seed is any 32-bit integer.) */ 15 | /* Coded by Takuji Nishimura, considering the suggestions by */ 16 | /* Topher Cooper and Marc Rieffel in July-Aug. 1997. */ 17 | 18 | /* This library is free software under the Artistic license: */ 19 | /* see the file COPYING distributed together with this code. */ 20 | /* For the verification of the code, its output sequence file */ 21 | /* mt19937int.out is attached (2001/4/2) */ 22 | 23 | /* Copyright (C) 1997, 1999 Makoto Matsumoto and Takuji Nishimura. */ 24 | /* Any feedback is very welcome. For any question, comments, */ 25 | /* see http://www.math.keio.ac.jp/matumoto/emt.html or email */ 26 | /* matumoto@math.keio.ac.jp */ 27 | 28 | /* REFERENCE */ 29 | /* M. Matsumoto and T. Nishimura, */ 30 | /* "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform */ 31 | /* Pseudo-Random Number Generator", */ 32 | /* ACM Transactions on Modeling and Computer Simulation, */ 33 | /* Vol. 8, No. 1, January 1998, pp 3--30. */ 34 | 35 | #include "uttypes.h" 36 | 37 | /* Period parameters */ 38 | #define N 624 39 | #define M 397 40 | #define MATRIX_A 0x9908b0df /* constant vector a */ 41 | #define UPPER_MASK 0x80000000 /* most significant w-r bits */ 42 | #define LOWER_MASK 0x7fffffff /* least significant r bits */ 43 | 44 | /* Tempering parameters */ 45 | #define TEMPERING_MASK_B 0x9d2c5680 46 | #define TEMPERING_MASK_C 0xefc60000 47 | #define TEMPERING_SHIFT_U(y) (y >> 11) 48 | #define TEMPERING_SHIFT_S(y) (y << 7) 49 | #define TEMPERING_SHIFT_T(y) (y << 15) 50 | #define TEMPERING_SHIFT_L(y) (y >> 18) 51 | 52 | static uint32 mt[N]; /* the array for the state vector */ 53 | static int32 mti; 54 | 55 | /* Initializing the array with a seed */ 56 | void utInitSeed( 57 | uint32 seed) 58 | { 59 | int32 i; 60 | 61 | for (i=0;i> 16; 65 | seed = 69069 * seed + 1; 66 | } 67 | mti = N; 68 | } 69 | 70 | uint32 utRand(void) 71 | { 72 | uint32 y; 73 | int32 kk; 74 | static uint32 mag01[2]={0x0, MATRIX_A}; 75 | /* mag01[x] = x * MATRIX_A for x=0,1 */ 76 | 77 | if (mti >= N) { /* generate N words at one time */ 78 | for (kk=0;kk> 1) ^ mag01[y & 0x1]; 81 | } 82 | for (;kk> 1) ^ mag01[y & 0x1]; 85 | } 86 | y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); 87 | mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1]; 88 | mti = 0; 89 | } 90 | y = mt[mti++]; 91 | y ^= TEMPERING_SHIFT_U(y); 92 | y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B; 93 | y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C; 94 | y ^= TEMPERING_SHIFT_L(y); 95 | return y; 96 | } 97 | -------------------------------------------------------------------------------- /util/uttypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was written by Bill Cox, originally in 1991, and maintained since. It is hereby 3 | * placed into the public domain. 4 | */ 5 | 6 | /*============================================================================ 7 | Module : Type Definitions 8 | Purpose: Provide basic types used to build all objects. These typedefs 9 | clarify what we mean when we use an integer type, and make the 10 | code more portable. 11 | ============================================================================*/ 12 | 13 | #ifndef UTTYPES_H 14 | #define UTTYPES_H 15 | 16 | #include 17 | #include 18 | 19 | typedef uint64_t uint64; 20 | typedef uint32_t uint32; 21 | typedef uint16_t uint16; 22 | typedef uint8_t uint8; 23 | typedef int64_t int64; 24 | typedef int32_t int32; 25 | typedef int16_t int16; 26 | typedef int8_t int8; 27 | 28 | #ifndef UINT64_MAX 29 | #define UINT64_MAX ((uint64)0xffffffffffffffffLL) 30 | #endif 31 | #ifndef UINT32_MAX 32 | #define UINT32_MAX ((uint32)0xffffffff) 33 | #endif 34 | #ifndef UINT16_MAX 35 | #define UINT16_MAX ((uint16)0xffff) 36 | #endif 37 | #ifndef UINT8_MAX 38 | #define UINT8_MAX ((uint8)0xff) 39 | #endif 40 | #ifndef INT64_MAX 41 | #define INT64_MAX ((int64)0x7fffffffffffffffLL) 42 | #endif 43 | #ifndef INT32_MAX 44 | #define INT32_MAX ((int32)0x7fffffff) 45 | #endif 46 | #ifndef INT16_MAX 47 | #define INT16_MAX ((int16)0x7fff) 48 | #endif 49 | #ifndef INT8_MAX 50 | #define INT8_MAX ((int8)0x7f) 51 | #endif 52 | #ifndef INT64_MIN 53 | #define INT64_MIN ((int64)(-1 - INT64_MAX)) 54 | #endif 55 | #ifndef INT32_MIN 56 | #define INT32_MIN ((int32)(-1 - INT32_MAX)) 57 | #endif 58 | #ifndef INT16_MIN 59 | #define INT16_MIN ((int16)(-1 - INT16_MAX)) 60 | #endif 61 | #ifndef INT8_MIN 62 | #define INT8_MIN ((int8)(-1 - INT8_MAX)) 63 | #endif 64 | #ifndef DOUBLE_MAX 65 | #define DOUBLE_MAX ((double)1.7e308) 66 | #endif 67 | 68 | #if (defined(_WINDOWS) || defined(_WIN32)) && !defined(__GNUC__) 69 | #define UTDIRSEP '\\' 70 | #define UTDIRSEP_STRING "\\" 71 | #define UTPATHSEP ';' 72 | #else 73 | #define UTDIRSEP '/' 74 | #define UTDIRSEP_STRING "/" 75 | #define UTPATHSEP ':' 76 | #endif 77 | 78 | /*-------------------------------------------------------------------------------------------------- 79 | Compiler optimization hints example: if(utUnlikely(error)) {utExit("err");} 80 | --------------------------------------------------------------------------------------------------*/ 81 | 82 | #if defined(__GNUC__) && __GNUC__ > 3 83 | #define utLikely(x) __builtin_expect((x),1) /* assumes gcc version >= 3.0 */ 84 | #define utUnlikely(x) __builtin_expect((x),0) 85 | #define utExpected(x,y) __builtin_expect((x),(y)) 86 | /* Prefetch doesn't fault if addr is invalid. We don't use temporal locality parameter */ 87 | #define utPrefetchRead(x) __builtin_prefetch((x), 0) 88 | #define utPrefetchWrite(x) __builtin_prefetch((x), 1) 89 | /* also add markers for functions that never return (exit, error) using __attribute__ */ 90 | #else 91 | #define utLikely(x) (x) /* unknown if ms c compiler supports this */ 92 | #define utUnlikely(x) (x) 93 | #define utExpected(x,y) (x) 94 | #define utPrefetchRead(x) (x) 95 | #define utPrefetchWrite(x) (x) 96 | #endif 97 | #define utPrefetch(x) utPrefetchRead(x) 98 | 99 | /*-------------------------------------------------------------------------------------------------- 100 | handy macros 101 | --------------------------------------------------------------------------------------------------*/ 102 | #define utMin(x, y) ((x) <= (y)? (x) : (y)) 103 | #define utMax(x, y) ((x) >= (y)? (x) : (y)) 104 | #define utAbs(x) ((x) >= 0? (x) : -(x)) 105 | #define utUint32ToVoidp(x) ((void *)((uint32)(x) + (char *)NULL)) 106 | #define utVoidpToUint32(x) (uint32)((char *)x - (char *)NULL) 107 | 108 | /* This loop structure allows loop initialization code to be written 109 | once (between utDo and utWhile), rather than having to be duplicated */ 110 | #define utDo do { 111 | #define utWhile(cond) if(utUnlikely(!(cond))) break; 112 | #define utRepeat } while(true); 113 | 114 | /* 115 | This is needed because MS VS doesn't know "inline" (it's not a C-keyword!). 116 | GCC is more tolerant. 117 | */ 118 | #ifdef _MSC_VER 119 | # define utInlineC static __inline 120 | #else 121 | # define utInlineC static inline 122 | #endif 123 | 124 | #endif 125 | 126 | -------------------------------------------------------------------------------- /vs2005/database_mem/database_mem.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 64 | 67 | 70 | 73 | 76 | 79 | 80 | 88 | 91 | 94 | 97 | 100 | 103 | 112 | 115 | 118 | 121 | 124 | 127 | 130 | 133 | 136 | 139 | 140 | 141 | 142 | 143 | 144 | 147 | 148 | 151 | 152 | 155 | 156 | 159 | 160 | 163 | 164 | 167 | 168 | 171 | 172 | 175 | 176 | 179 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /vs2005/database_persistence/database_persistence.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 64 | 67 | 70 | 73 | 76 | 79 | 80 | 88 | 91 | 94 | 97 | 100 | 103 | 112 | 115 | 118 | 121 | 124 | 127 | 130 | 133 | 136 | 139 | 140 | 141 | 142 | 143 | 144 | 147 | 148 | 151 | 152 | 155 | 156 | 159 | 160 | 163 | 164 | 167 | 168 | 171 | 172 | 175 | 176 | 179 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /vs2005/database_undo/database_undo.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 64 | 67 | 70 | 73 | 76 | 79 | 80 | 88 | 91 | 94 | 97 | 100 | 103 | 112 | 115 | 118 | 121 | 124 | 127 | 130 | 133 | 136 | 139 | 140 | 141 | 142 | 143 | 144 | 147 | 148 | 151 | 152 | 155 | 156 | 159 | 160 | 163 | 164 | 167 | 168 | 171 | 172 | 175 | 176 | 179 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /vs2005/database_undo_persistence/database_undo_persistence.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 64 | 67 | 70 | 73 | 76 | 79 | 80 | 88 | 91 | 94 | 97 | 100 | 103 | 112 | 115 | 118 | 121 | 124 | 127 | 130 | 133 | 136 | 139 | 140 | 141 | 142 | 143 | 144 | 147 | 148 | 151 | 152 | 155 | 156 | 159 | 160 | 163 | 164 | 167 | 168 | 171 | 172 | 175 | 176 | 179 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /vs2005/vs2005.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual C++ Express 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datadraw", "datadraw\datadraw.vcproj", "{D2EAB884-7643-4096-A3EB-3E149AC7A26C}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {CADBC1A5-2CAF-41D8-B7C7-62865A4C7E26} = {CADBC1A5-2CAF-41D8-B7C7-62865A4C7E26} 7 | EndProjectSection 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "database_mem", "database_mem\database_mem.vcproj", "{B4AED0B2-0C2A-467C-88F2-2CE76ED87164}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "database_persistence", "database_persistence\database_persistence.vcproj", "{422642F4-4F64-4F2B-B51B-B76FB44811AF}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "database_undo", "database_undo\database_undo.vcproj", "{E610AB39-4A08-4F37-88EA-9A6C2E770242}" 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "database_undo_persistence", "database_undo_persistence\database_undo_persistence.vcproj", "{CADBC1A5-2CAF-41D8-B7C7-62865A4C7E26}" 16 | EndProject 17 | Global 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|Win32 = Debug|Win32 20 | Release|Win32 = Release|Win32 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {D2EAB884-7643-4096-A3EB-3E149AC7A26C}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {D2EAB884-7643-4096-A3EB-3E149AC7A26C}.Debug|Win32.Build.0 = Debug|Win32 25 | {D2EAB884-7643-4096-A3EB-3E149AC7A26C}.Release|Win32.ActiveCfg = Release|Win32 26 | {D2EAB884-7643-4096-A3EB-3E149AC7A26C}.Release|Win32.Build.0 = Release|Win32 27 | {B4AED0B2-0C2A-467C-88F2-2CE76ED87164}.Debug|Win32.ActiveCfg = Debug|Win32 28 | {B4AED0B2-0C2A-467C-88F2-2CE76ED87164}.Debug|Win32.Build.0 = Debug|Win32 29 | {B4AED0B2-0C2A-467C-88F2-2CE76ED87164}.Release|Win32.ActiveCfg = Release|Win32 30 | {B4AED0B2-0C2A-467C-88F2-2CE76ED87164}.Release|Win32.Build.0 = Release|Win32 31 | {422642F4-4F64-4F2B-B51B-B76FB44811AF}.Debug|Win32.ActiveCfg = Debug|Win32 32 | {422642F4-4F64-4F2B-B51B-B76FB44811AF}.Debug|Win32.Build.0 = Debug|Win32 33 | {422642F4-4F64-4F2B-B51B-B76FB44811AF}.Release|Win32.ActiveCfg = Release|Win32 34 | {422642F4-4F64-4F2B-B51B-B76FB44811AF}.Release|Win32.Build.0 = Release|Win32 35 | {E610AB39-4A08-4F37-88EA-9A6C2E770242}.Debug|Win32.ActiveCfg = Debug|Win32 36 | {E610AB39-4A08-4F37-88EA-9A6C2E770242}.Debug|Win32.Build.0 = Debug|Win32 37 | {E610AB39-4A08-4F37-88EA-9A6C2E770242}.Release|Win32.ActiveCfg = Release|Win32 38 | {E610AB39-4A08-4F37-88EA-9A6C2E770242}.Release|Win32.Build.0 = Release|Win32 39 | {CADBC1A5-2CAF-41D8-B7C7-62865A4C7E26}.Debug|Win32.ActiveCfg = Debug|Win32 40 | {CADBC1A5-2CAF-41D8-B7C7-62865A4C7E26}.Debug|Win32.Build.0 = Debug|Win32 41 | {CADBC1A5-2CAF-41D8-B7C7-62865A4C7E26}.Release|Win32.ActiveCfg = Release|Win32 42 | {CADBC1A5-2CAF-41D8-B7C7-62865A4C7E26}.Release|Win32.Build.0 = Release|Win32 43 | EndGlobalSection 44 | GlobalSection(SolutionProperties) = preSolution 45 | HideSolutionNode = FALSE 46 | EndGlobalSection 47 | EndGlobal 48 | -------------------------------------------------------------------------------- /vs6/VS6.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "database_mem"=.\database_mem\database_mem.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "database_persistence"=.\database_persistence\database_persistence.dsp - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Project: "database_undo"=.\database_undo\database_undo.dsp - Package Owner=<4> 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<4> 37 | {{{ 38 | }}} 39 | 40 | ############################################################################### 41 | 42 | Project: "database_undo_persistence"=.\database_undo_persistence\database_undo_persistence.dsp - Package Owner=<4> 43 | 44 | Package=<5> 45 | {{{ 46 | }}} 47 | 48 | Package=<4> 49 | {{{ 50 | }}} 51 | 52 | ############################################################################### 53 | 54 | Project: "datadraw"=.\datadraw\datadraw.dsp - Package Owner=<4> 55 | 56 | Package=<5> 57 | {{{ 58 | }}} 59 | 60 | Package=<4> 61 | {{{ 62 | Begin Project Dependency 63 | Project_Dep_Name database_undo_persistence 64 | End Project Dependency 65 | }}} 66 | 67 | ############################################################################### 68 | 69 | Global: 70 | 71 | Package=<5> 72 | {{{ 73 | }}} 74 | 75 | Package=<3> 76 | {{{ 77 | }}} 78 | 79 | ############################################################################### 80 | 81 | -------------------------------------------------------------------------------- /vs6/database_mem/database_mem.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="database_mem" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Static Library" 0x0104 6 | 7 | CFG=database_mem - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "database_mem.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "database_mem.mak" CFG="database_mem - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "database_mem - Win32 Release" (based on "Win32 (x86) Static Library") 21 | !MESSAGE "database_mem - Win32 Debug" (based on "Win32 (x86) Static Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "database_mem - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 44 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "_WIN32" /YX /FD /c 45 | # ADD BASE RSC /l 0x407 /d "NDEBUG" 46 | # ADD RSC /l 0x407 /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LIB32=link.exe -lib 51 | # ADD BASE LIB32 /nologo 52 | # ADD LIB32 /nologo 53 | 54 | !ELSEIF "$(CFG)" == "database_mem - Win32 Debug" 55 | 56 | # PROP BASE Use_MFC 0 57 | # PROP BASE Use_Debug_Libraries 1 58 | # PROP BASE Output_Dir "Debug" 59 | # PROP BASE Intermediate_Dir "Debug" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 0 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "Debug" 64 | # PROP Intermediate_Dir "Debug" 65 | # PROP Target_Dir "" 66 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 67 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "_WIN32" /YX /FD /GZ /c 68 | # ADD BASE RSC /l 0x407 /d "_DEBUG" 69 | # ADD RSC /l 0x407 /d "_DEBUG" 70 | BSC32=bscmake.exe 71 | # ADD BASE BSC32 /nologo 72 | # ADD BSC32 /nologo 73 | LIB32=link.exe -lib 74 | # ADD BASE LIB32 /nologo 75 | # ADD LIB32 /nologo 76 | 77 | !ENDIF 78 | 79 | # Begin Target 80 | 81 | # Name "database_mem - Win32 Release" 82 | # Name "database_mem - Win32 Debug" 83 | # Begin Source File 84 | 85 | SOURCE=..\..\util\ddutil.h 86 | # End Source File 87 | # Begin Source File 88 | 89 | SOURCE=..\..\util\utdatabase.c 90 | # End Source File 91 | # Begin Source File 92 | 93 | SOURCE=..\..\util\utdatabase.h 94 | # End Source File 95 | # Begin Source File 96 | 97 | SOURCE=..\..\util\util.c 98 | # End Source File 99 | # Begin Source File 100 | 101 | SOURCE=..\..\util\utmanage.c 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=..\..\util\utmem.c 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=..\..\util\utmem.h 110 | # End Source File 111 | # Begin Source File 112 | 113 | SOURCE=..\..\util\utnt.c 114 | # End Source File 115 | # Begin Source File 116 | 117 | SOURCE=..\..\util\utpersist.c 118 | # End Source File 119 | # Begin Source File 120 | 121 | SOURCE=..\..\util\utpersist.h 122 | # End Source File 123 | # Begin Source File 124 | 125 | SOURCE=..\..\util\utrand.c 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=..\..\util\uttypes.h 130 | # End Source File 131 | # End Target 132 | # End Project 133 | -------------------------------------------------------------------------------- /vs6/database_persistence/database_persistence.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="database_persistence" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Static Library" 0x0104 6 | 7 | CFG=database_persistence - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "database_persistence.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "database_persistence.mak" CFG="database_persistence - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "database_persistence - Win32 Release" (based on "Win32 (x86) Static Library") 21 | !MESSAGE "database_persistence - Win32 Debug" (based on "Win32 (x86) Static Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "database_persistence - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 44 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "_WIN32" /YX /FD /c 45 | # ADD BASE RSC /l 0x407 /d "NDEBUG" 46 | # ADD RSC /l 0x407 /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LIB32=link.exe -lib 51 | # ADD BASE LIB32 /nologo 52 | # ADD LIB32 /nologo 53 | 54 | !ELSEIF "$(CFG)" == "database_persistence - Win32 Debug" 55 | 56 | # PROP BASE Use_MFC 0 57 | # PROP BASE Use_Debug_Libraries 1 58 | # PROP BASE Output_Dir "Debug" 59 | # PROP BASE Intermediate_Dir "Debug" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 0 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "Debug" 64 | # PROP Intermediate_Dir "Debug" 65 | # PROP Target_Dir "" 66 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 67 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "_WIN32" /YX /FD /GZ /c 68 | # ADD BASE RSC /l 0x407 /d "_DEBUG" 69 | # ADD RSC /l 0x407 /d "_DEBUG" 70 | BSC32=bscmake.exe 71 | # ADD BASE BSC32 /nologo 72 | # ADD BSC32 /nologo 73 | LIB32=link.exe -lib 74 | # ADD BASE LIB32 /nologo 75 | # ADD LIB32 /nologo 76 | 77 | !ENDIF 78 | 79 | # Begin Target 80 | 81 | # Name "database_persistence - Win32 Release" 82 | # Name "database_persistence - Win32 Debug" 83 | # Begin Source File 84 | 85 | SOURCE=..\..\util\ddutil.h 86 | # End Source File 87 | # Begin Source File 88 | 89 | SOURCE=..\..\util\utdatabasep.c 90 | # End Source File 91 | # Begin Source File 92 | 93 | SOURCE=..\..\util\utdatabasep.h 94 | # End Source File 95 | # Begin Source File 96 | 97 | SOURCE=..\..\util\util.c 98 | # End Source File 99 | # Begin Source File 100 | 101 | SOURCE=..\..\util\utmanage.c 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=..\..\util\utmem.c 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=..\..\util\utmem.h 110 | # End Source File 111 | # Begin Source File 112 | 113 | SOURCE=..\..\util\utnt.c 114 | # End Source File 115 | # Begin Source File 116 | 117 | SOURCE=..\..\util\utpersist.c 118 | # End Source File 119 | # Begin Source File 120 | 121 | SOURCE=..\..\util\utpersist.h 122 | # End Source File 123 | # Begin Source File 124 | 125 | SOURCE=..\..\util\utrand.c 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=..\..\util\uttypes.h 130 | # End Source File 131 | # End Target 132 | # End Project 133 | -------------------------------------------------------------------------------- /vs6/database_undo/database_undo.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="database_undo" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Static Library" 0x0104 6 | 7 | CFG=database_undo - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "database_undo.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "database_undo.mak" CFG="database_undo - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "database_undo - Win32 Release" (based on "Win32 (x86) Static Library") 21 | !MESSAGE "database_undo - Win32 Debug" (based on "Win32 (x86) Static Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "database_undo - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 44 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "_WIN32" /YX /FD /c 45 | # ADD BASE RSC /l 0x407 /d "NDEBUG" 46 | # ADD RSC /l 0x407 /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LIB32=link.exe -lib 51 | # ADD BASE LIB32 /nologo 52 | # ADD LIB32 /nologo 53 | 54 | !ELSEIF "$(CFG)" == "database_undo - Win32 Debug" 55 | 56 | # PROP BASE Use_MFC 0 57 | # PROP BASE Use_Debug_Libraries 1 58 | # PROP BASE Output_Dir "Debug" 59 | # PROP BASE Intermediate_Dir "Debug" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 0 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "Debug" 64 | # PROP Intermediate_Dir "Debug" 65 | # PROP Target_Dir "" 66 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 67 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "_WIN32" /YX /FD /GZ /c 68 | # ADD BASE RSC /l 0x407 /d "_DEBUG" 69 | # ADD RSC /l 0x407 /d "_DEBUG" 70 | BSC32=bscmake.exe 71 | # ADD BASE BSC32 /nologo 72 | # ADD BSC32 /nologo 73 | LIB32=link.exe -lib 74 | # ADD BASE LIB32 /nologo 75 | # ADD LIB32 /nologo 76 | 77 | !ENDIF 78 | 79 | # Begin Target 80 | 81 | # Name "database_undo - Win32 Release" 82 | # Name "database_undo - Win32 Debug" 83 | # Begin Source File 84 | 85 | SOURCE=..\..\util\ddutil.h 86 | # End Source File 87 | # Begin Source File 88 | 89 | SOURCE=..\..\util\utdatabaseu.c 90 | # End Source File 91 | # Begin Source File 92 | 93 | SOURCE=..\..\util\utdatabaseu.h 94 | # End Source File 95 | # Begin Source File 96 | 97 | SOURCE=..\..\util\util.c 98 | # End Source File 99 | # Begin Source File 100 | 101 | SOURCE=..\..\util\utmanage.c 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=..\..\util\utmem.c 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=..\..\util\utmem.h 110 | # End Source File 111 | # Begin Source File 112 | 113 | SOURCE=..\..\util\utnt.c 114 | # End Source File 115 | # Begin Source File 116 | 117 | SOURCE=..\..\util\utpersist.c 118 | # End Source File 119 | # Begin Source File 120 | 121 | SOURCE=..\..\util\utpersist.h 122 | # End Source File 123 | # Begin Source File 124 | 125 | SOURCE=..\..\util\utrand.c 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=..\..\util\uttypes.h 130 | # End Source File 131 | # End Target 132 | # End Project 133 | -------------------------------------------------------------------------------- /vs6/database_undo_persistence/database_undo_persistence.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="database_undo_persistence" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Static Library" 0x0104 6 | 7 | CFG=database_undo_persistence - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "database_undo_persistence.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "database_undo_persistence.mak" CFG="database_undo_persistence - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "database_undo_persistence - Win32 Release" (based on "Win32 (x86) Static Library") 21 | !MESSAGE "database_undo_persistence - Win32 Debug" (based on "Win32 (x86) Static Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "database_undo_persistence - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 44 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "_WIN32" /YX /FD /c 45 | # ADD BASE RSC /l 0x407 /d "NDEBUG" 46 | # ADD RSC /l 0x407 /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LIB32=link.exe -lib 51 | # ADD BASE LIB32 /nologo 52 | # ADD LIB32 /nologo 53 | 54 | !ELSEIF "$(CFG)" == "database_undo_persistence - Win32 Debug" 55 | 56 | # PROP BASE Use_MFC 0 57 | # PROP BASE Use_Debug_Libraries 1 58 | # PROP BASE Output_Dir "Debug" 59 | # PROP BASE Intermediate_Dir "Debug" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 0 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "Debug" 64 | # PROP Intermediate_Dir "Debug" 65 | # PROP Target_Dir "" 66 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 67 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "_WIN32" /YX /FD /GZ /c 68 | # ADD BASE RSC /l 0x407 /d "_DEBUG" 69 | # ADD RSC /l 0x407 /d "_DEBUG" 70 | BSC32=bscmake.exe 71 | # ADD BASE BSC32 /nologo 72 | # ADD BSC32 /nologo 73 | LIB32=link.exe -lib 74 | # ADD BASE LIB32 /nologo 75 | # ADD LIB32 /nologo 76 | 77 | !ENDIF 78 | 79 | # Begin Target 80 | 81 | # Name "database_undo_persistence - Win32 Release" 82 | # Name "database_undo_persistence - Win32 Debug" 83 | # Begin Source File 84 | 85 | SOURCE=..\..\util\ddutil.h 86 | # End Source File 87 | # Begin Source File 88 | 89 | SOURCE=..\..\util\utdatabaseup.c 90 | # End Source File 91 | # Begin Source File 92 | 93 | SOURCE=..\..\util\utdatabaseup.h 94 | # End Source File 95 | # Begin Source File 96 | 97 | SOURCE=..\..\util\util.c 98 | # End Source File 99 | # Begin Source File 100 | 101 | SOURCE=..\..\util\utmanage.c 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=..\..\util\utmem.c 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=..\..\util\utmem.h 110 | # End Source File 111 | # Begin Source File 112 | 113 | SOURCE=..\..\util\utnt.c 114 | # End Source File 115 | # Begin Source File 116 | 117 | SOURCE=..\..\util\utpersist.c 118 | # End Source File 119 | # Begin Source File 120 | 121 | SOURCE=..\..\util\utpersist.h 122 | # End Source File 123 | # Begin Source File 124 | 125 | SOURCE=..\..\util\utrand.c 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=..\..\util\uttypes.h 130 | # End Source File 131 | # End Target 132 | # End Project 133 | -------------------------------------------------------------------------------- /www/images/dreamweaver-template-9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/dreamweaver-template-9.gif -------------------------------------------------------------------------------- /www/images/index_r4_c2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/index_r4_c2.gif -------------------------------------------------------------------------------- /www/images/index_r4_c4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/index_r4_c4.gif -------------------------------------------------------------------------------- /www/images/index_r6_c2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/index_r6_c2.gif -------------------------------------------------------------------------------- /www/images/index_r6_c4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/index_r6_c4.gif -------------------------------------------------------------------------------- /www/images/leaf50-back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/leaf50-back.jpg -------------------------------------------------------------------------------- /www/images/leaf50-backlong.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/leaf50-backlong.gif -------------------------------------------------------------------------------- /www/images/spacer-green.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/spacer-green.gif -------------------------------------------------------------------------------- /www/images/spacer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/images/spacer.gif -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waywardgeek/datadraw/a2491e6247c34d06c6cc46e353ebc6a59d031dd3/www/index.html --------------------------------------------------------------------------------