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,d71460587da14d5b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-31 00:46:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc02.POSTED!not-for-mail From: Freejack Subject: Re: Importing C structs? Newsgroups: comp.lang.ada Message-ID: References: <1V1Wa.299$jp.55@newsread4.news.pas.earthlink.net> User-Agent: Pan/0.11.4 (Unix) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Comment-To: "Matthew Heaney" NNTP-Posting-Host: 12.245.85.50 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc02 1059637597 12.245.85.50 (Thu, 31 Jul 2003 07:46:37 GMT) NNTP-Posting-Date: Thu, 31 Jul 2003 07:46:37 GMT Organization: Comcast Online Date: Thu, 31 Jul 2003 07:46:37 GMT Xref: archiver1.google.com comp.lang.ada:41060 Date: 2003-07-31T07:46:37+00:00 List-Id: On Thu, 31 Jul 2003 01:35:57 -0400, Matthew Heaney wrote: > The type DBTYPE is a bit of a mystery at this point, since structs > aren't typically passed by value in C. Perhaps DBTYPE is really a > pointer? The header file declares it thusly.... /******************************************************* * Access methods. *******************************************************/ /* * !!! * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. */ typedef enum { DB_BTREE=1, DB_HASH, DB_RECNO, DB_QUEUE, DB_UNKNOWN /* Figure it out on open. */ } DBTYPE; So I'm assuming I could just use an Ada enumerated type. (It compiles when I do this, but it fails at runtime.) The second hurdle I'll need to jump is creating a suitable Ada replacement for this buttload of defines that occur after the DBTYPE declaration. /* * DB access method and cursor operation values. Each value is an operation * code to which additional bit flags are added. */ #define DB_AFTER 1 /* c_put() */ #define DB_APPEND 2 /* put() */ #define DB_BEFORE 3 /* c_put() */ #define DB_CACHED_COUNTS 4 /* stat() */ #define DB_CHECKPOINT 5 /* log_put(), log_get() */ #define DB_CONSUME 6 /* get() */ #define DB_CONSUME_WAIT 7 /* get() */ #define DB_CURLSN 8 /* log_put() */ #define DB_CURRENT 9 /* c_get(), c_put(), log_get() */ #define DB_FIRST 10 /* c_get(), log_get() */ #define DB_FLUSH 11 /* log_put() */ #define DB_GET_BOTH 12 /* get(), c_get() */ #define DB_GET_BOTHC 13 /* c_get() (internal) */ #define DB_GET_RECNO 14 /* c_get() */ #define DB_JOIN_ITEM 15 /* c_get(); do not do primary lookup */ #define DB_KEYFIRST 16 /* c_put() */ #define DB_KEYLAST 17 /* c_put() */ #define DB_LAST 18 /* c_get(), log_get() */ #define DB_NEXT 19 /* c_get(), log_get() */ #define DB_NEXT_DUP 20 /* c_get() */ #define DB_NEXT_NODUP 21 /* c_get() */ #define DB_NODUPDATA 22 /* put(), c_put() */ #define DB_NOOVERWRITE 23 /* put() */ #define DB_NOSYNC 24 /* close() */ #define DB_POSITION 25 /* c_dup() */ #define DB_POSITIONI 26 /* c_dup() (internal) */ #define DB_PREV 27 /* c_get(), log_get() */ #define DB_PREV_NODUP 28 /* c_get(), log_get() */ #define DB_RECORDCOUNT 29 /* stat() */ #define DB_SET 30 /* c_get(), log_get() */ #define DB_SET_RANGE 31 /* c_get() */ #define DB_SET_RECNO 32 /* get(), c_get() */ #define DB_WRITECURSOR 33 /* cursor() */ #define DB_WRITELOCK 34 /* cursor() (internal) */ But one step at a time. Hooking into glibc is cake, but this is something else entirely. Heh. Any suggestions? Freejack