dbsaver-new.c

lpmoo-1.2/mudlib/obj/dbsaver-new.c · 795 B

From the archive lpmoo-1.2.tar.gz

Download the archive   « Back to the archive contents

/*
 * NAME:	dbsaver.c
 * DESCRIPTION:	routines for saving a MOO db file
 */

# define DEBUG  0

inherit "/std/core";
inherit "/std/string";

# if DEBUG
inherit "/std/vartext";
# else
# define var2str(x)  ""
# endif

# include <objects.h>
# include <moo/data.h>
# include <moo/config.h>
# include <dgd/limits.h>
# include <dgd/status.h>

# define DELAY		2
# define CHUNK		500
# define SIZE		(7 * MAX_STRING_SIZE / 8)
# define MEMUSED()	(status()[ST_DMEMUSED])
# define MEMFREE()	(MEMUSED() < maxmem)

object	driver;		/* the driver object */

int	maxmem;		/* memory threshold to begin swapping */
string	dbfile;		/* name of the db file */

/*
 * NAME:	main()
 * DESCRIPTION:	write the database to a file
 */
void main(string file)
{
  dbfile = file;

  maxmem = CONFIG->query(CF_MEMORY_THRESH);
}

Site Stats

Snippets: 1791
Codebases: 571