/home/dcp1990/prog/fakedbfs/libfakedbfs/dbinit.c File Reference

Database initialisation stuff. More...

#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <math.h>
#include "dbspec.h"
#include <fakedbfs/dbspecdata.h>
#include <fakedbfs/lexdefines.h>
#include <fakedbfs/fakedbfs.h>
#include <fakedbfs/db.h>
#include <fakedbfs/debug.h>

Defines

#define DSpecParseTOKENTYPE   Toke
#define DSpecParseARG_PDECL   ,Heads *heads
#define BUFFERSIZE   4096

Typedefs

typedef fdbfs_ds_buffer_state * YY_BUFFER_STATE

Functions

void * DSpecParseAlloc (void *(*mallocProc)(size_t))
void DSpecParseFree (void *p, void(*freeProc)(void *))
int fdbfs_dslex (void)
YY_BUFFER_STATE fdbfs_ds_scan_string (const char *)
void fdbfs_ds_delete_buffer (YY_BUFFER_STATE)
void DSpecParse (void *yyp, int yymajor, DSpecParseTOKENTYPE yyminor DSpecParseARG_PDECL)
void DSpecParseTrace (FILE *TraceFILE, char *zTracePrompt)
void yywrap (void)
char * fdbfs_normalise (char *s) const
EnumElemfdbfs_find_elem_by_name (struct EnumElem *h, const char *name)
 Find enum element by name.
CatElemfdbfs_find_catelem_enum (struct CatElem *h, struct EnumHead *en)
 Find catalogue element by enumhead.
char * fdbfs_get_enum_string_by_value (struct EnumElem *h, unsigned int val, short int fmted)
 Search enum list and return name of element with specified value.
EnumSubElemfdbfs_get_subhead_by_enval (struct EnumElem *h, unsigned int val)
 Get subelement head by value in enum.
char * fdbfs_get_enum_sub_string_by_value (struct EnumSubElem *h, unsigned int val)
 Get string in list of enum subelements by value.
CatalogueHeadfdbfs_find_cathead_by_name (struct CatalogueHead *h, const char *name)
 Search list of catalogue heads for a certain name.
CatElemfdbfs_find_catelem_by_name (struct CatElem *h, const char *name)
 Search for catalogue element by name.
EnumHeadfdbfs_find_enumhead_by_name (struct EnumHead *h, const char *name)
 Search for enum head by name.
EnumSubElemfdbfs_copy_sub_list (struct EnumSubElem *from, struct EnumSubElem *to, struct EnumElem *fajah, int *lastval)
 Copy subelement list.
size_t fdbfs_number_size (unsigned int n)
 Compute number of base10 digits for given unsigned integer.
size_t fdbfs_signed_size (int n)
 Compute number of base10 digits for given signed integer.
int fdbfs_create_catalogue (fdbfs_t *f, const char *name, const char *alias, const char *cname)
 Create catalogue.
int fdbfs_db_start (fdbfs_t *f)
 Initialise the database if necessary.
EnumElemfdbfs_enumelems_from_dbtab (fdbfs_t *f, const char *table, struct EnumHead *e)
 Construct EnumElem list from database enum description table.
EnumHeadfdbfs_enums_from_db (fdbfs_t *f)
 Construct EnumHead list from database.
CatElemfdbfs_catelems_from_dbtab (fdbfs_t *f, const char *table, struct EnumHead *enumhead)
 Construct CatElem list from catalogue description table.
actcat_tfdbfs_catalogues_from_db (fdbfs_t *f, struct CatalogueHead *cathead)
 Make actcat_t list from database.
CatalogueHeadfdbfs_cats_from_db (fdbfs_t *f, struct EnumHead *enumhead)
 Construct CatalogueHead list from database.
int fdbfs_db_rm_catalogue (fdbfs_t *f, const char *catname)
int fdbfs_dbspec_parse (fdbfs_t *f, const char *filename)
 Parse dbspec.
void fdbfs_dswrap (void)
int fdbfs_cat_type_exists (fdbfs_t *f, const char *ct)
 Check if CFD exists.
actcat_tfdbfs_find_catalogue (fdbfs_t *f, const char *name)
 Finds catalogue.

Variables

FILE * fdbfs_dsin


Detailed Description

Database initialisation stuff.


Define Documentation

#define BUFFERSIZE   4096
 

#define DSpecParseARG_PDECL   ,Heads *heads
 

#define DSpecParseTOKENTYPE   Toke
 


Typedef Documentation

typedef struct fdbfs_ds_buffer_state* YY_BUFFER_STATE
 


Function Documentation

void DSpecParse void *  yyp,
int  yymajor,
DSpecParseTOKENTYPE yyminor  DSpecParseARG_PDECL
 

void* DSpecParseAlloc void *(*)(size_t)  mallocProc  ) 
 

void DSpecParseFree void *  p,
void(*)(void *)  freeProc
 

void DSpecParseTrace FILE *  TraceFILE,
char *  zTracePrompt
 

int fdbfs_cat_type_exists fdbfs_t f,
const char *  ct
 

Check if CFD exists.

Parameters:
f Instance of fakedbfs.
ct Name to look for.

actcat_t* fdbfs_catalogues_from_db fdbfs_t f,
struct CatalogueHead cathead
 

Make actcat_t list from database.

Parameters:
f Instance of fakedbfs.
cathead Catalogue head to search for definitions.
Returns:
Pointer to list of actcat_t elements, or NULL on error.

struct CatElem* fdbfs_catelems_from_dbtab fdbfs_t f,
const char *  table,
struct EnumHead enumhead
 

Construct CatElem list from catalogue description table.

Parameters:
f Instance of fakedbfs.
table Name of catalogue description table.
enumhead Head of enums to search when enum element is encountered.
Returns:
CatElem list, or NULL on error.

struct CatalogueHead* fdbfs_cats_from_db fdbfs_t f,
struct EnumHead enumhead
 

Construct CatalogueHead list from database.

Parameters:
f Instance of fakedbfs.
enumhead EnumHead list to search.
Returns:
CatalogueHead list, or NULL on error.

struct EnumSubElem* fdbfs_copy_sub_list struct EnumSubElem from,
struct EnumSubElem to,
struct EnumElem fajah,
int *  lastval
 

Copy subelement list.

For use with stuff like the sameas directive. Copies list of subelements.

Parameters:
[in] from From list.
[out] to To list. This must point to an allocated struct EnumSubElem; subsequent items will be allocated.
[in] fajah Father enum element of new list.
[in,out] lastval Pointer to integer specifying the value to use. Will be increased to last value when done.
Returns:
Tail element of copied list.

int fdbfs_create_catalogue fdbfs_t f,
const char *  name,
const char *  alias,
const char *  cname
 

Create catalogue.

Parameters:
f Fakedbfs instance.
name Name of new catalogue.
alias Alias of new catalogue.
cname Name of CFD for new catalogue.
Returns:
0 on error.

int fdbfs_db_rm_catalogue fdbfs_t f,
const char *  catname
 

int fdbfs_db_start fdbfs_t f  ) 
 

Initialise the database if necessary.

Parameters:
f Instance of fakedbfs to operate on.
Returns:
0 on error.

int fdbfs_dbspec_parse fdbfs_t f,
const char *  filename
 

Parse dbspec.

Parses the specified specfile and modifies the database accordingly. Must close and reopen before using other parts of the library to see changes.

Parameters:
f Instance of fakedbfs.
filename Specfile filename to read.
Returns:
0 on error.

void fdbfs_ds_delete_buffer YY_BUFFER_STATE   ) 
 

YY_BUFFER_STATE fdbfs_ds_scan_string const char *   ) 
 

int fdbfs_dslex void   ) 
 

void fdbfs_dswrap void   ) 
 

struct EnumElem* fdbfs_enumelems_from_dbtab fdbfs_t f,
const char *  table,
struct EnumHead e
 

Construct EnumElem list from database enum description table.

DOes so according to TABLE_FORMAT.

Parameters:
f Instance of fakedbfs.
table Table to read.
e Parent of all elements.
Returns:
List of EnumElems, or NULL on error.

struct EnumHead* fdbfs_enums_from_db fdbfs_t f  ) 
 

Construct EnumHead list from database.

Parameters:
f Instance of fakedbfs.
Returns:
EnumHead list, or NULL on error.

actcat_t* fdbfs_find_catalogue fdbfs_t f,
const char *  name
 

Finds catalogue.

Parameters:
f Instance of fakedbfs to search in.
name Name of catalogue to search for.
Returns:
NULL on not found or error.

struct CatElem* fdbfs_find_catelem_by_name struct CatElem h,
const char *  name
 

Search for catalogue element by name.

Parameters:
h Head of list to search.
name Name to search for.
Returns:
The element if found, NULL otherwise.

struct CatElem* fdbfs_find_catelem_enum struct CatElem h,
struct EnumHead en
 

Find catalogue element by enumhead.

Parameters:
h List head to search.
en Enumhead to search for.
Returns:
The element we found, or NULL on no match/error.

struct CatalogueHead* fdbfs_find_cathead_by_name struct CatalogueHead h,
const char *  name
 

Search list of catalogue heads for a certain name.

Parameters:
h Head of list to search.
name Name to search for.
Returns:
The element if found, NULL otherwise.

struct EnumElem* fdbfs_find_elem_by_name struct EnumElem h,
const char *  name
 

Find enum element by name.

Parameters:
h List head to search.
name Name to search for.
Returns:
The element we found, or NULL on no match/error.

struct EnumHead* fdbfs_find_enumhead_by_name struct EnumHead h,
const char *  name
 

Search for enum head by name.

Parameters:
h Head of list to search.
name Name to search for.
Returns:
The element if found, NULL otherwise.

char* fdbfs_get_enum_string_by_value struct EnumElem h,
unsigned int  val,
short int  fmted
 

Search enum list and return name of element with specified value.

Parameters:
h Head of list.
val Value to search for.
fmted 1 if formatted name is desired. 0 otherwise.
Returns:
Name of enum element, or NULL if none found.

char* fdbfs_get_enum_sub_string_by_value struct EnumSubElem h,
unsigned int  val
 

Get string in list of enum subelements by value.

Parameters:
h Sub element list head to search.
val Value to search for.
Returns:
Name of subelement with specified value, or NULL otherwise.

struct EnumSubElem* fdbfs_get_subhead_by_enval struct EnumElem h,
unsigned int  val
 

Get subelement head by value in enum.

Parameters:
h List head to search.
val Value to search for.
Returns:
Sub element list, or NULL if no match.

char* fdbfs_normalise char *  s  )  const
 

size_t fdbfs_number_size unsigned int  n  ) 
 

Compute number of base10 digits for given unsigned integer.

Parameters:
n Number to examine.
Returns:
Number of digits.

size_t fdbfs_signed_size int  n  ) 
 

Compute number of base10 digits for given signed integer.

Parameters:
n Number to examine.
Returns:
Number of digits.

void yywrap void   ) 
 


Variable Documentation

FILE* fdbfs_dsin
 


Generated on Wed Apr 19 16:26:23 2006 for fakedbfs by  doxygen 1.4.6