CWB
Functions | Variables
cwb-makeall.c File Reference
#include "../cl/globals.h"
#include "../cl/corpus.h"
#include "../cl/attributes.h"
#include "../cl/endian.h"
#include "../cl/fileutils.h"

Functions

int component_ok (Attribute *attr, ComponentID cid)
 Checks whether a component has already been created. More...
 
void makeall_make_component (Attribute *attr, ComponentID cid)
 Creates a component for the specified attribute. More...
 
int validate_revcorp (Attribute *attr)
 Validates the REVCORP component of the given attribute. More...
 
void makeall_do_attribute (Attribute *attr, ComponentID cid, int validate)
 Create a given component (or all components) for an attribute. More...
 
void makeall_usage (void)
 Prints a usage message and exits the program. More...
 
int main (int argc, char **argv)
 Main function for cwb-makeall. More...
 

Variables

Corpuscorpus
 The corpus we are working on. More...
 
char * progname = NULL
 Name of this program. More...
 

Function Documentation

int component_ok ( Attribute attr,
ComponentID  cid 
)

Checks whether a component has already been created.

Parameters
attrThe attribute of the component to check.
cidThe component ID of the component to check.
Returns
RUE iff the component has already been created.

References component_state(), ComponentDefined, ComponentLoaded, and ComponentUnloaded.

Referenced by makeall_do_attribute(), and makeall_make_component().

int main ( int  argc,
char **  argv 
)
void makeall_do_attribute ( Attribute attr,
ComponentID  cid,
int  validate 
)

Create a given component (or all components) for an attribute.

Parameters
attrThe attribute to work on.
cidIf this is CompLast, all components will be created. Otherwise, it specifies the single component that will be created.
validateboolean - if true, validate_revcorp is called to check the resulting revcorp.

References _Attribute::any, cid_name(), CompCompRF, CompCompRFX, CompCorpus, CompCorpusFreqs, CompHuffCodes, CompHuffSeq, CompHuffSync, CompLast, CompLexicon, CompLexiconIdx, CompLexiconSrt, component_ok(), CompRevCorpus, CompRevCorpusIdx, is_directory(), makeall_make_component(), and validate_revcorp().

Referenced by main().

void makeall_make_component ( Attribute attr,
ComponentID  cid 
)

Creates a component for the specified attribute.

This function will create the component if it doesn't already exist; it aborts on error.

See also
create_component
Parameters
attrThe attribute of the component to create.
cidThe component ID of the component to create.

References cid_name(), component_ok(), component_state(), ComponentLoaded, ComponentUnloaded, and create_component().

Referenced by makeall_do_attribute().

void makeall_usage ( void  )

Prints a usage message and exits the program.

References progname, and VERSION.

Referenced by main().

int validate_revcorp ( Attribute attr)

Validates the REVCORP component of the given attribute.

This function validates a REVCORP (i.e. an uncompressed index). It assumes that a lexicon, frequencies and (compressed or uncompressed) token stream are available for CL access for the given attribute.

Parameters
attrThe attribute whose REVCORP should be checked.
Returns
True for all OK, false for a problem.

References cid_name(), cl_calloc(), cl_cpos2id(), cl_free, cl_id2freq(), cl_max_cpos(), cl_max_id(), CompRevCorpus, TMblob::data, TComponent::data, ensure_component(), and TComponent::size.

Referenced by makeall_do_attribute().

Variable Documentation

Corpus* corpus

The corpus we are working on.

char* progname = NULL

Name of this program.

Referenced by main(), and makeall_usage().