From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7c6f57d4c2ed4321,start X-Google-Attributes: gid103376,public From: Greg Baker Subject: [ANNOUNCE] Bindings to Gnu Database Manager Date: 1996/09/12 Message-ID: <85sp8owciw.fsf@walleroo.rp.CSIRO.AU> X-Deja-AN: 180094784 sender: usenet@rp.CSIRO.AU (Network news) x-nntp-posting-host: walleroo.rp.csiro.au organization: CSIRO Division of Radiophysics/Australia Telescope National Facility newsgroups: comp.lang.ada Date: 1996-09-12T00:00:00+00:00 List-Id: Currently available at ftp://ftp.rp.csiro.au/pub/people/gbaker/gdbm-1-7-3-ada-bindings-alpha.tar.gz Unfortunately, I will be leaving CSIRO soon, and won't be able to provide an anonymous ftp home for these for very much longer. If you would like to provide a home for an 8k tar file, and a 2k README, I'd love to hear from you. Here's the README. ---------------------------------------------------------------------- Gdbm Ada-interface README file What is this thing? An interface to the GNU database manager which looks nicely Ada-like. Automatically generated interfaces tend to look like C and makes for funny Ada, making client code somewhat error-prone. This interface provides nice wrappers for the gdbm functions allowing client packages to be kept type-safe and readable. My aim has been to make it as readable and as obvious as possible, rather than to keep similarity with the C versions. For example, gdbm_setopt has turned into Gnu.Gdbm.Set_Cache_Size, Gnu.Gdbm.Turn_On_Fast_Mode Gnu.Gdbm.Turn_Off_Fast_Mode which strikes me as somewhat more obvious! What versions of gdbm does it work with? Probably most of them, since the C interface hasn't changed in a while. I developed and tested it under Linux using gdbm-1.7.3. What compilers/platforms are supported? I really haven't a clue. It only uses Ada83 constructs, but I have only ever compiled it under Linux using Gnat 3.04. I would guess any Ada compiler, any flavour of Unix. You might get lucky with other platforms. Thread-safe? It is as thread safe as gdbm itself, which (I believe) is not safe at all. This doesn't particularly concern me - if you are updating and reading entries from the database in different threads, you have horrible race conditions awaiting you. If you are just reading, then I suggest you open the database multiple times. How do I use it? The best answer to that is to look at gdbm_test.adb - hopefully that should make it fairly clear what to do. gnu.gdbm.ads is very nicely documented - the non-private parts of it should tell you all you need to know. Finally, the man pages that came with gdbm might be of some assistance as well, if you want to have fine details. A quick summary - instantiate a Database with some Key_Type and Content_Type. Open a GDBM_Database. Using this GDBM_Database you can Store Fetch Delete Reorganise Sync check something Exists iterate from First_Key using Next_Key Close Set_Cache_Size Turn_On_Fast_Mode Turn_Off_Fast_Mode I compile using "gnatmake gdbm_test -largs -lgdbm". Your methods will (obviously) vary. What's all this other junk in the distribution? It seemed sensible to put the interfaces under a package GNU - I intend to write other such "nice" bindings in the future. Similarly, Unix file modes crop up in lots of different places, and there is bound to be more Unix-specific things in the future too. Consider this the first in a long line of such things. Anything else? At the moment, if you do anything that returns a Key_Type or a Content_Type (i.e. Fetch, First_Key, Next_Key), the wrappers check to make sure that the size of data it found is the same as the size of a Key_Type or a Content_Type (whichever is appropriate). So if you have extended types (i.e. you are using Ada95's object features) and you store a child type, and then later attempt to fetch it when the Content_Type is a parent, you will have Data_Invalidity raised, even though the child is a valid subclass of parent. I would appreciate suggestions as to how to fix this nicely. You perhaps also should be warned that this was one of the first things I have written in Ada. Hopefully this won't be noticable! Contacts I will only be at CSIRO Radiophysics until the beginning of October, 1996 (gbaker@rp.csiro.au). After that I will be gregb@apt.net.au, and might not be as heavily net-connected as I am now. I fully intend to support this for as long as people are interested. (Although I doubt it will need much support). If you are reading this sometime a long time after 1996 I should still be easily findable. Search for - Greg Baker "quantum computers" solresol "probable" - GdB, 10-September-1996. Striving for a GNU-ful and Christian world. -- Gregory D. Baker gbaker@rp.csiro.au CSIRO Radiophysics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - predictions of the future - quantum computers - silly poetry - - the "langue musicale universale" (Solresol) revival project - - - - - - - - - http://www.rp.csiro.au/~gbaker - - - - - - - - - I am about to leave CSIRO. The above email address and URL may become invalid in October. Email should then be sent to gregb@apt.net.au.