waywardgeek / datadraw Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
DataDraw is a database generator. It takes a database description file and creates C code that links the database directly into your C program. There have been 3 major rewrites of DataDraw. The original, version 1.0, was written by me, Bill Cox, in 1992. I placed it into the copy-left domain at that time. It allowed a single-page schema to be drawn in Windows, and the database was generated from that. After that, QuickLogic put time into developing version 2.0, which inherited my copy-left. Version 2.0 has been used since about 1993, and is stable, mature, and quite useful. It supports many features, such as multiple schemas per tool, and multiple tools, and dynamic class extension. However, it's showing it's age, and most of the open-source community seems to want command-line driven tools, rather than a graphical front-end. I wrote version 3.0 in 2006, starting with code from version 2.0. Version 3.0 inherits it's copy-left from version 2.0. All three versions are copyrighted under the GNU Library General Public License. You should have received a copy, and if not, you can find it on fsf.org. Version 3.0 is modern, feature-rich, and well documented. I hope you find it useful for your project. The manual is in datadraw3.0/manual.odt, which is "Open Document Format", compatible with multiple editors, just none currently from Microsoft. I wrote it using OpenOffice, which I highly recommend. Installation and usage instructions are in the manual. Linux Installation ------------------ If you just want to compile it now, before reading the manual, just type this: $ cd datadraw3.X.X $ ./autogen.sh $ ./configure $ make $ su $ make install $ exit If you have any trouble, it may be that you do not have all the build tools installed. Make sure to have automake, and in debian, build-essential installed. This should install a "datadraw" executable, which you can use on database description files (ending in ".dd"). The following will generate the C database: $ cd src $ datadraw dvdatabase.dd The output files are dvdatabase.c and dvdatabase.h, which you can check out. I recommend taking some Advil before reading the generating code. The manual is where I recommend you start. Debian Installation ------------------- Thanks to Aes, we now have Debian scripts to build proper Debian .pkg files for DataDraw3.0. You can build a Debian package with "make deb", which will create the package in the directory containing datadraw3.0. These packages are also available at http://sourceforge.net/projects/datadraw, where you can download and install them directly. Windows Installation -------------------- You should find a datadraw_windows directory in the tar-ball. This contains Visual C++ 6.0 project files. In addition, there is a Bakefile directory which can be used with the bakefile-tool (http://bakefile.sourceforge.net) to build project files for Visual C++ as well as others. Thanks to Questor for the port!
I am actually trying to run this on macOS M1 (to use Rune) clang 14 => but the make
throws a bunch of warnings like:
./utdatabase.h:157:70: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
utInlineC uint32 utSym2ValidIndex(utSym Sym) {return utValidSym(Sym) - (utSym)0;}
It is an undefined behavior because when a null pointer is involved in pointer subtraction we are violating C standards, so it is crucial to refrain from conducting pointer arithmetic with null pointers.
Using this tool https://www.bottlecaps.de/convert/ and then manually adding the tokens from dvscan.l
we can get a nice railroad diagram for the grammar in dvparse.y
, copy the EBNF shown bellow and paste at https://www.bottlecaps.de/rr/ui on the tab Edit Grammar
then click on the tab View Diagram
I hope this can help to have a global view of the grammar.
/* converted on Sat Dec 18, 2021, 15:03 (UTC+01) by bison-to-w3c v0.54 which is Copyright (c) 2011-2021 by Gunther Rademacher <[email protected]> */
goal ::= initialize module
initialize
::=
module ::= moduleHeader moduleParameter* '\n' moduleElement*
moduleParameter
::= KWVOLATILE
| KWPERSISTENT
| KWUNDO_REDO
moduleHeader
::= KWMODULE upperIdent optIdent
optIdent ::= IDENT?
moduleElement
::= import
| enum
| typedef
| schema
| class
| relationship
import ::= KWIMPORT upperIdent '\n'
enum ::= enumHeader KWBEGIN entry+ KWEND
enumHeader
::= KWENUM upperIdent optIdent '\n'
entry ::= IDENT ( '=' INTEGER )? '\n'
typedef ::= KWTYPEDEF IDENT ( '=' STRING )? '\n'
schema ::= KWSCHEMA upperIdent '\n'
class ::= classHeader classOptions '\n' ( KWBEGIN ( ( property | cacheTogether ) '\n' | union )+ KWEND )?
classHeader
::= KWCLASS upperIdent optLabel
classOptions
::= classOption*
classOption
::= KWREFERENCE_SIZE INTEGER
| KWFREE_LIST
| KWCREATE_ONLY
| KWARRAY
| KWATTRIBUTES
| KWSPARSE
property ::= ( baseProperty | KWARRAY baseProperty INDEX? ) propertyAttributes
propertyAttributes
::= propertyAttribute*
propertyAttribute
::= KWCASCADE
| KWVIEW
| KWSPARSE
| '=' STRING
baseProperty
::= ( moduleSpec? IDENT | propertyType ) upperIdent
cacheTogether
::= cacheTogetherHeader upperIdent*
cacheTogetherHeader
::= KWCACHE_TOGETHER
moduleSpec
::= IDENT ':'
propertyType
::= INTTYPE
| UINTTYPE
| KWFLOAT
| KWDOUBLE
| KWBIT
| KWBOOL
| KWCHAR
| KWENUM
| KWTYPEDEF
| KWSYM
union ::= unionHeader KWBEGIN ( property ':' unionCases '\n' )+ KWEND
unionHeader
::= KWUNION upperIdent '\n'
unionCases
::= unionCase+
unionCase
::= IDENT
relationship
::= relationshipHeader relationshipType relationshipOption* '\n'
relationshipHeader
::= KWRELATIONSHIP upperIdent optLabel upperIdent optLabel
optLabel ::= ( ':' IDENT )?
relationshipType
::= ( KWLINKED_LIST | KWDOUBLY_LINKED | KWTAIL_LINKED | KWARRAY | ( KWHEAP | KWHASHED | KWORDERED_LIST ) key )?
key ::= ( upperIdent ( '.' upperIdent )* )*
relationshipOption
::= KWCASCADE
| KWMANDATORY
| KWPARENT_ONLY
| KWCHILD_ONLY
| KWSPARSE
| KWUNORDERED
upperIdent
::= IDENT
//Tokens
//<INITIAL>\("[^"]+"\)\s+{myDebug("\([^\\]+\).+
KWARRAY ::= "array"
KWATTRIBUTES ::= "attributes"
KWBIT ::= "bit"
KWBOOL ::= "bool"
KWCACHE_TOGETHER ::= "cache_together"
KWCASCADE ::= "cascade"
KWCHAR ::= "char"
KWCHILD_ONLY ::= "child_only"
KWCLASS ::= "class"
KWCREATE_ONLY ::= "create_only"
KWDOUBLE ::= "double"
KWDOUBLY_LINKED ::= "doubly_linked"
KWENUM ::= "enum"
KWFLOAT ::= "float"
KWFREE_LIST ::= "free_list"
KWHASHED ::= "hashed"
KWHEAP ::= "heap"
KIMPORT ::= "import"
KWLINKED_LIST ::= "linked_list"
KWMANDATORY ::= "mandatory"
KWMODULE ::= "module"
KWORDERED_LIST ::= "ordered_list"
KWPARENT_ONLY ::= "parent_only"
KWPERSISTENT ::= "persistent"
KWREFERENCE_SIZE ::= "reference_size"
KWRELATIONSHIP ::= "relationship"
KWSCHEMA ::= "schema"
KWSPARSE ::= "sparse"
KWSYM ::= "sym"
KWTAIL_LINKED ::= "tail_linked"
KWTYPEDEF ::= "typedef"
KWUNDO_REDO ::= "undo_redo"
KWUNION ::= "union"
KWUNORDERED ::= "unordered"
KWVIEW ::= "view"
KWVOLATILE ::= "volatile"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.