Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

lcmaps_db_read.c File Reference

the LCMAPS database reader. More...

#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include "lcmaps_log.h"
#include "_lcmaps_db_read.h"

Include dependency graph for lcmaps_db_read.c:

Include dependency graph

Go to the source code of this file.

Defines

#define MAXDBENTRIES   250
#define MAXPAIRS   2
#define WHITESPACE_CHARS   " \t\n"
#define QUOTING_CHARS   "\""
#define ESCAPING_CHARS   "\\"
#define COMMENT_CHARS   "#"
#define PAIR_SEP_CHARS   ","
#define VARVAL_SEP_CHARS   "="
#define PAIR_TERMINATOR_CHARS   PAIR_SEP_CHARS WHITESPACE_CHARS
#define VARVAL_TERMINATOR_CHARS   VARVAL_SEP_CHARS WHITESPACE_CHARS
#define NUL   '\0'

Functions

int lcmaps_db_read_entries (FILE *)
 Read db entries from stream and fill a lsit of db entries. More...

int lcmaps_db_parse_line (char *, lcmaps_db_entry_t **)
 Parses database line and fills database structure. More...

int lcmaps_db_parse_pair (char *, char **, char **)
 Parses a database variable-value pair and returns the variable name and its value. More...

int lcmaps_db_parse_string (char **)
 Takes a string and removes prepending and trailing spaces and quotes (unless escaped). More...


Variables

lcmaps_db_entry_tlcmaps_db_list = NULL


Detailed Description

the LCMAPS database reader.

Author:
Martijn Steenbakkers for the EU DataGrid.

Definition in file lcmaps_db_read.c.


Define Documentation

#define COMMENT_CHARS   "#"
 

For internal use only.

Definition at line 37 of file lcmaps_db_read.c.

#define ESCAPING_CHARS   "\\"
 

For internal use only.

Definition at line 36 of file lcmaps_db_read.c.

#define MAXDBENTRIES   250
 

maximum number of LCMAPS database entries

For internal use only.

Definition at line 30 of file lcmaps_db_read.c.

#define MAXPAIRS   2
 

maximum number of variable-value pairs that will be parsed per line

For internal use only.

Definition at line 31 of file lcmaps_db_read.c.

#define NUL   '\0'
 

For internal use only.

Definition at line 60 of file lcmaps_db_read.c.

#define PAIR_SEP_CHARS   ","
 

Characters separating variable-value pairs in the lcmaps database file

For internal use only.

Definition at line 40 of file lcmaps_db_read.c.

#define PAIR_TERMINATOR_CHARS   PAIR_SEP_CHARS WHITESPACE_CHARS
 

Characters that terminate pairs in the lcmaps database file. This is a combination of whitespace and separators.

For internal use only.

Definition at line 52 of file lcmaps_db_read.c.

#define QUOTING_CHARS   "\""
 

For internal use only.

Definition at line 35 of file lcmaps_db_read.c.

#define VARVAL_SEP_CHARS   "="
 

Characters separating variables from values

For internal use only.

Definition at line 42 of file lcmaps_db_read.c.

#define VARVAL_TERMINATOR_CHARS   VARVAL_SEP_CHARS WHITESPACE_CHARS
 

Characters that terminate variables and values in the lcmaps database file. This is a combination of whitespace and separators.

For internal use only.

Definition at line 57 of file lcmaps_db_read.c.

#define WHITESPACE_CHARS   " \t\n"
 

For internal use only.

Definition at line 34 of file lcmaps_db_read.c.


Function Documentation

int lcmaps_db_parse_line ( char * line,
lcmaps_db_entry_t ** entry ) [static]
 

Parses database line and fills database structure.

Parameters:
line   database line
entry   pointer to a pointer to a database structure (can/should be freed afterwards)
Return values:
1   succes.
0   failure.

For internal use only.

Definition at line 261 of file lcmaps_db_read.c.

Referenced by lcmaps_db_read_entries().

int lcmaps_db_parse_pair ( char * pair,
char ** pvar,
char ** pval ) [static]
 

Parses a database variable-value pair and returns the variable name and its value.

Parameters:
pair   string containing the pair
pvar   pointer to the variable string
pval   pointer to the value string
Return values:
1   succes.
0   failure.

For internal use only.

Definition at line 397 of file lcmaps_db_read.c.

Referenced by lcmaps_db_parse_line().

int lcmaps_db_parse_string ( char ** pstring ) [static]
 

Takes a string and removes prepending and trailing spaces and quotes (unless escaped).

Parameters:
pstring   pointer to a pointer to a char
Return values:
1   succes.
0   failure.

For internal use only.

Definition at line 494 of file lcmaps_db_read.c.

Referenced by lcmaps_db_parse_pair().

int lcmaps_db_read_entries ( FILE * dbstream ) [static]
 

Read db entries from stream and fill a lsit of db entries.

Parameters:
dbstream   database stream
Returns:
the number of entries found (failure --> negative number)

For internal use only.

Definition at line 132 of file lcmaps_db_read.c.

Referenced by lcmaps_db_read().


Variable Documentation

lcmaps_db_entry_t * lcmaps_db_list = NULL [static]
 

list of database entries

Definition at line 74 of file lcmaps_db_read.c.


Generated at Thu Mar 4 17:39:17 2004 for edg-lcmaps by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001