CWB
Data Structures | Macros | Typedefs | Functions | Variables
corpus.h File Reference
#include "globals.h"

Data Structures

struct  _idbuf
 Underlying structure for the IDList class. More...
 
struct  TCorpus
 Underlying structure for the Corpus class. More...
 

Macros

#define IDList_delete(l)   FreeIDList(l)
 
#define IDList_check_member(l, s)   memberIDList(s, l) /* parameter order standardised for objects */
 

Typedefs

typedef struct _idbufIDList
 The IDList class: entries in linked lists of identifier strings. More...
 
typedef struct _idbuf IDBuf
 Underlying structure for the IDList class. More...
 

Functions

void FreeIDList (IDList *list)
 Deletes an IDList object, and sets the argument pointer to NULL. More...
 
int memberIDList (char *s, IDList l)
 Checks whether the specified string occurs in the given IDList. More...
 
void add_corpus_property (Corpus *corpus, char *property, char *value)
 Adds a property to the list of corpus properties. More...
 
Corpusfind_corpus (char *registry_dir, char *registry_name)
 Gets a pointer to the Corpus object with the specified CWB-name and registry location. More...
 
void describe_corpus (Corpus *corpus)
 Prints a description of the corpus to STDOUT. More...
 

Variables

char * cregin_path
 Full path of the registry file currently being parsed (for registry parser error messages) More...
 
char * cregin_name
 The name of registry file currently being parsed (for registry parser error messages) More...
 
Corpusloaded_corpora
 Head of a linked list of loaded corpus handles (for memory manager). More...
 

Macro Definition Documentation

#define IDList_check_member (   l,
 
)    memberIDList(s, l) /* parameter order standardised for objects */
#define IDList_delete (   l)    FreeIDList(l)

Typedef Documentation

typedef struct _idbuf IDBuf

Underlying structure for the IDList class.

typedef struct _idbuf* IDList

The IDList class: entries in linked lists of identifier strings.

These identifier strings can be usernames, groupnames or hostnames and are used to restrict access to particular corpora.

Note that IDLists are added to Corpus objects by the registry parser.

NOT to be confused with "idlist" in the sense of cl_idlist2cpos().

Function Documentation

void add_corpus_property ( Corpus corpus,
char *  property,
char *  value 
)

Adds a property to the list of corpus properties.

Use this function from registry.y only!

If the property is already defined, ignore and warn. If the property is 'charset', corpus charset is set as well.

Parameters
corpusCorpus object to add property to.
propertyName of property to add.
valueValue of property to add.

References TCorpus::charset, cl_charset_from_name(), cl_corpus_property(), cl_malloc(), cregin_name, cregin_path, TCorpusProperty::next, TCorpus::properties, TCorpusProperty::property, and TCorpusProperty::value.

void describe_corpus ( Corpus corpus)

Prints a description of the corpus to STDOUT.

TODO might be nice to have this function offer an option of XML-style output. TODO might also be nice to have it return a string, or send to a parameter stream, so that the caller can decide what to do with it: direct UI formatting does not really belong in the low-level CL.

References _Attribute::any, TCorpus::attributes, describe_attribute(), TCorpus::id, TCorpus::info_file, TCorpus::name, TCorpus::path, TCorpus::registry_dir, and TCorpus::registry_name.

Referenced by main().

Corpus* find_corpus ( char *  registry_dir,
char *  registry_name 
)

Gets a pointer to the Corpus object with the specified CWB-name and registry location.

(Works by searching the loaded_corpora global linked list.)

Parameters
registry_dirThe registry directory.
registry_nameThe CWB name of the corpus.
Returns
The Corpus, or NULL if it wasn't found.

References cl_standard_registry(), TCorpus::next, PATH_SEPARATOR, TCorpus::registry_dir, TCorpus::registry_name, and STREQ.

Referenced by cl_new_corpus().

void FreeIDList ( IDList list)

Deletes an IDList object, and sets the argument pointer to NULL.

Parameters
listIDList to delete.

References cl_free, _idbuf::next, and _idbuf::string.

Referenced by cl_delete_corpus().

int memberIDList ( char *  s,
IDList  l 
)

Checks whether the specified string occurs in the given IDList.

Parameters
sThe username, groupname, or hostname to look for.
lThe IDList to search.
Returns
Boolean: true if s is a member of the list, else false.

References _idbuf::next, and _idbuf::string.

Referenced by check_access_conditions().

Variable Documentation

char* cregin_name

The name of registry file currently being parsed (for registry parser error messages)

See also
cregparse

Referenced by add_corpus_property(), and cl_new_corpus().

char* cregin_path

Full path of the registry file currently being parsed (for registry parser error messages)

See also
cregparse

Referenced by add_corpus_property(), and cl_new_corpus().

Corpus* loaded_corpora

Head of a linked list of loaded corpus handles (for memory manager).

Referenced by cl_delete_corpus(), and cl_new_corpus().