comp.lang.ada
 help / color / mirror / Atom feed
From: Freejack <freejack@nospam.net>
Subject: Re: Importing C structs?
Date: Thu, 31 Jul 2003 07:46:37 GMT
Date: 2003-07-31T07:46:37+00:00	[thread overview]
Message-ID: <pan.2003.07.31.07.52.36.94842.845@nospam.net> (raw)
In-Reply-To: 1V1Wa.299$jp.55@newsread4.news.pas.earthlink.net

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



  reply	other threads:[~2003-07-31  7:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-30 20:03 Importing C structs? Freejack
2003-07-30 20:52 ` chris
2003-07-30 21:26   ` Freejack
2003-07-30 23:50   ` tmoran
2003-07-31 10:53     ` chris
2003-08-04 14:33     ` Andreas Almroth
2003-08-04 15:16       ` Samuel Tardieu
2003-08-04 20:07         ` Randy Brukardt
2003-07-31 17:14   ` Warren W. Gay VE3WWG
2003-08-12  0:02     ` chris
2003-07-31 18:17   ` Xenos
2003-07-31 19:16     ` Simon Wright
2003-07-31 20:17       ` Samuel Tardieu
2003-07-31 20:40       ` Xenos
2003-07-30 23:14 ` Ching Bon Lam
2003-07-31  0:07   ` tmoran
2003-07-31  5:35   ` Matthew Heaney
2003-07-31  7:46     ` Freejack [this message]
2003-07-31  9:27       ` Martin Dowie
2003-07-31 21:41         ` Freejack
2003-08-01  7:39           ` Martin Dowie
2003-07-31 17:34       ` Matthew Heaney
2003-07-31 11:29     ` Ching Bon Lam
2003-07-31 16:59       ` Matthew Heaney
2003-07-31 17:32         ` Warren W. Gay VE3WWG
2003-07-31 17:13       ` Matthew Heaney
2003-07-31 17:40       ` Randy Brukardt
2003-07-31  5:21 ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox