CWB
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
options.h File Reference
#include "../cl/globals.h"
#include "concordance.h"

Data Structures

struct  _cqpoption
 A CQPOption represents a single configuration option for CQP. More...
 

Macros

#define DEFAULT_HARDBOUNDARY   100
 Default value for the HardBoundary configuration option. More...
 
#define OPTION_CQP   1
 Flag for CQP configuration options: is this visible interactively in CQP? More...
 
#define DEFAULT_CONTEXT   25
 Default value for the context scope configuration option (counted in characters) More...
 
#define DEFAULT_LOCAL_PATH_ENV_VAR   "CQP_LOCAL_CORP_DIR"
 
#define CQP_FALLBACK_PAGER   "more"
 

Typedefs

typedef enum _opttype OptType
 Labels for the types of CQP option. More...
 
typedef struct _cqpoption CQPOption
 A CQPOption represents a single configuration option for CQP. More...
 

Enumerations

enum  _which_app { undef, cqp, cqpcl, cqpserver }
 
enum  _matching_strategy { traditional, shortest_match, standard_match, longest_match }
 matching strategy More...
 
enum  _opttype { OptInteger, OptString, OptBoolean, OptContext }
 Labels for the types of CQP option. More...
 

Functions

int find_option (char *s)
 Finds the index of an option. More...
 
char * set_string_option_value (char *opt_name, char *value)
 Sets a string-valued option. More...
 
char * set_integer_option_value (char *opt_name, int value)
 Sets an integer-valued option. More...
 
char * set_context_option_value (char *opt_name, char *sval, int ival)
 
void print_option_values ()
 Prints out the values of all the CQP configuration options. More...
 
void print_option_value (int opt)
 
void parse_options (int argc, char **argv)
 

Variables

enum _which_app which_app
 
int insecure
 Boolean: != 0 means we should not allow pipes etc. More...
 
int inhibit_activation
 Boolean: inhibit corpus activations in parser. More...
 
int parseonly
 if true, queries are only parsed, not evaluated. More...
 
int verbose_parser
 if true, absolutely all messages from the parser get printed (inc Message-level). More...
 
int show_symtab
 Doesn't seem to be used anywhere; should show_environment use it? if not, remove? TODO. More...
 
int show_gconstraints
 if true, the tree of global contraints is printed when an EvalEnvironment is displayed More...
 
int show_evaltree
 if true, the evaluation tree is printed when an EvalEnvironment is displayed More...
 
int show_patlist
 if true, the pattern list is printed when an EvalEnvironment is displayed More...
 
int show_compdfa
 if true, the complete DFA is printed when an EvalEnvironment is displayed More...
 
int show_dfa
 if true, the regex2dfa module will print out the states of the DFA after it is parsed. More...
 
int symtab_debug
 if this AND debug_simulation are true, print extra messages relating to eval environment labels when simulating an NFA. More...
 
int parser_debug
 if true, the parser's internal Bison-generated debug setting is turned on. More...
 
int tree_debug
 if true, extra messages are embedded when an evaluation tree is pretty-printed More...
 
int eval_debug
 if true, assorted debug messages related to query evaluation are printed More...
 
int search_debug
 if true, the evaltree of a pattern is pretty-printed before the DFA is created. More...
 
int initial_matchlist_debug
 if true, debug messages relating to the initial set of candidate matches are printed. More...
 
int debug_simulation
 if true, debug messages are printed when simulating an NFA. More...
 
int activate_cl_debug
 if true, the CL's debug message setting is set to On. More...
 
int server_log
 cqpserver option: logging (print log messages to standard output) More...
 
int server_debug
 cqpserver option: debugging output (print debug messages to standard error) More...
 
int snoop
 cqpserver option: monitor CQi network communication More...
 
int private_server
 cqpserver option: makes CQPserver accept a single connection only More...
 
int server_port
 cqpserver option: CQPserver's listening port (if 0, listens on CQI_PORT) More...
 
int localhost
 cqpserver option: accept local connections (loopback) only More...
 
int server_quit
 cqpserver option: spawn server and return to caller (for CQI::Server.pm) More...
 
int query_lock
 cqpserver option: safe mode for network/HTTP servers (allow query execution only) More...
 
int query_lock_violation
 cqpserver option: set for CQPserver's sake to detect attempted query lock violation More...
 
int enable_macros
 enable macros only at user request in case they introduce compatibility problems More...
 
int macro_debug
 enable debugging of macros (and print macro hash stats on shutdown). More...
 
int hard_boundary
 Query option: use implicit 'within' clause (unless overridden by explicit spec) More...
 
int hard_cut
 Query option: use hard cut value for all queries (cannot be changed) More...
 
int subquery
 Query option: use auto-subquery mode. More...
 
char * def_unbr_attr
 Query option: unbracketed attribute (attribute matched by "..." patterns) More...
 
int query_optimize
 Query option: use query optimisation (untested and expensive optimisations) More...
 
enum _matching_strategy matching_strategy
 
char * matching_strategy_name
 The matching strategy option: which is implemented as a vstring option with side-effect. More...
 
int strict_regions
 boolean: expression between {s} ... More...
 
int use_readline
 UI option: use GNU Readline for input line editing if available. More...
 
int highlighting
 UI option: highlight match / fields in terminal output? (default = yes) More...
 
int paging
 UI option: activate/deactivate paging of query results. More...
 
char * pager
 UI option: pager program to used for paged kwic display. More...
 
char * tested_pager
 UI option: CQP tests if selected pager works & will fall back to "more" if it doesn't. More...
 
char * less_charset_variable
 UI option: name of environment variable for controlling less charset (usually LESSCHARSET) More...
 
int use_colour
 UI option: use colours for terminal output (experimental) More...
 
int progress_bar
 UI option: show progress bar during query execution. More...
 
int pretty_print
 UI option: pretty-print most of CQP's output (turn off to simplify parsing of CQP output) More...
 
int autoshow
 UI option: show query results after evaluation (otherwise, just print number of matches) More...
 
int timing
 UI option: time queries (printed after execution) More...
 
int show_tag_attributes
 kwic option: show values of s-attributes as SGML tag attributes in kwic lines More...
 
int show_targets
 kwic option: show numbers of target anchors in brackets More...
 
char * printModeString
 kwic option: string of current printmode More...
 
char * printModeOptions
 kwic option: some printing options More...
 
int printNrMatches
 kwic option: -> 'cat' prints number of matches in first line (do we need this?) More...
 
char * printStructure
 kwic option: show annotations of structures containing match More...
 
char * left_delimiter
 kwic option: the match start prefix (defaults to '<') More...
 
char * right_delimiter
 kwic option: the match end suffix (defaults to '>') More...
 
char * registry
 registry directory More...
 
char * LOCAL_CORP_PATH
 directory where subcorpora are stored (saved & loaded) More...
 
int auto_save
 automatically save subcorpora More...
 
int save_on_exit
 save unsaved subcorpora upon exit More...
 
char * cqp_init_file
 changed from 'init_file' because of clash with a # define in {term.h} More...
 
char * macro_init_file
 secondary init file for loading macro definitions (not read if macros are disabled) More...
 
char * cqp_history_file
 filename where CQP command history will be saved More...
 
int write_history_file
 Controls whether CQP command history is written to file. More...
 
int batchmode
 set by -f {file} option (don't read ~/.cqprc, then process input from {file}) More...
 
int silent
 Disables some messages & warnings (used rather inconsistently). More...
 
char * default_corpus
 corpus specified with -D {corpus} More...
 
char * query_string
 query specified on command line (-E {string}, cqpcl only) More...
 
int UseExternalSorting
 (option which should not exist) use external sorting algorithm More...
 
char * ExternalSortingCommand
 (option which should not exist) external sort command to use More...
 
int UseExternalGrouping
 (option which should not exist) use external grouping algorithm More...
 
char * ExternalGroupingCommand
 (option which should not exist) external group command to use More...
 
int user_level
 (option which should not exist) user level: 0 == normal, 1 == advanced, 2 == expert) More...
 
int rangeoutput
 (option which should not exist) More...
 
int child_process
 Child process mode (used by Perl interface (CQP.pm) and by CQPweb (cqp.inc.php)) More...
 
ContextDescriptor CD
 The global context descriptor. More...
 
int handle_sigpipe
 
char * progname
 
char * licensee
 
FILE * batchfd
 
CQPOption cqpoptions []
 Global array of options for CQP. More...
 

Macro Definition Documentation

#define CQP_FALLBACK_PAGER   "more"

Referenced by open_stream().

#define DEFAULT_CONTEXT   25

Default value for the context scope configuration option (counted in characters)

Referenced by set_default_option_values().

#define DEFAULT_HARDBOUNDARY   100

Default value for the HardBoundary configuration option.

#define DEFAULT_LOCAL_PATH_ENV_VAR   "CQP_LOCAL_CORP_DIR"

Referenced by do_save().

#define OPTION_CQP   1

Flag for CQP configuration options: is this visible interactively in CQP?

Referenced by print_option_values().

Typedef Documentation

typedef struct _cqpoption CQPOption

A CQPOption represents a single configuration option for CQP.

It does not actually contain the config-option itself; that is held as a global variable somewhere. Instead, it holds metadata about the config-option, including a pointer to the actual variable.

Note it's possible to have wo CQPOption objects referring to the same actual variable - in this case the two option names in question would be synonymous.

typedef enum _opttype OptType

Labels for the types of CQP option.

Enumeration Type Documentation

matching strategy

Enumerator
traditional 
shortest_match 
standard_match 
longest_match 
enum _opttype

Labels for the types of CQP option.

Enumerator
OptInteger 
OptString 
OptBoolean 
OptContext 
enum _which_app
Enumerator
undef 
cqp 
cqpcl 
cqpserver 

Function Documentation

int find_option ( char *  s)

Finds the index of an option.

Return the index in the global options array of the option with name s. This should be never called from outside.

See also
cqpoptions
Parameters
sName of the option to find (or abbreviation); matched case-insensitively.
Returns
Index of element in cqpoptions corresponding to the name s, or -1 if no corresponding element was found.

References _cqpoption::opt_name.

Referenced by parse_options(), print_option_value(), print_option_values(), set_context_option_value(), set_integer_option_value(), and set_string_option_value().

void parse_options ( int  argc,
char **  argv 
)
void print_option_value ( int  opt)
void print_option_values ( )

Prints out the values of all the CQP configuration options.

References find_option(), _cqpoption::opt_name, OPTION_CQP, print_option_value(), silent, and user_level.

char* set_context_option_value ( char *  opt_name,
char *  sval,
int  ival 
)
char* set_integer_option_value ( char *  opt_name,
int  value 
)

Sets an integer-valued option.

An error string (function-internal constant, do NOT free) is returned if the type of the option does not correspond to the function which is called. Upon success, NULL is returned.

Parameters
opt_nameThe name of the option to set.
valueIts new value.
Returns
NULL if all OK; otherwise a string describing the problem.

References execute_side_effects(), find_option(), OptBoolean, OptContext, OptInteger, set_context_option_value(), and validate_integer_option_value().

Referenced by open_stream().

char* set_string_option_value ( char *  opt_name,
char *  value 
)

Sets a string-valued option.

An error string (function-internal constant, do NOT free) is returned if the type of the option does not correspond to the function which is called. Upon success, NULL is returned.

set_string_option_value does NOT strdup the value!

Parameters
opt_nameThe name of the option to set.
valueIts new value.
Returns
NULL if all OK; otherwise a string describing the problem.

References execute_side_effects(), expand_filename(), find_option(), OptContext, OptString, set_context_option_value(), and validate_string_option_value().

Referenced by do_SimpleVariableReference(), do_StringConstraint(), and open_stream().

Variable Documentation

int activate_cl_debug

if true, the CL's debug message setting is set to On.

Referenced by execute_side_effects(), parse_options(), and set_default_option_values().

int auto_save
int autoshow

UI option: show query results after evaluation (otherwise, just print number of matches)

Referenced by after_CorpusCommand(), main(), and parse_options().

FILE* batchfd

Referenced by initialize_cqp(), main(), and parse_options().

int batchmode

set by -f {file} option (don't read ~/.cqprc, then process input from {file})

Referenced by initialize_cqp(), main(), and parse_options().

int child_process

Child process mode (used by Perl interface (CQP.pm) and by CQPweb (cqp.inc.php))

  • don't automatically read in user's .cqprc and .cqpmacros
  • print CQP version on startup
  • now: output blank line after each command -> SHOULD BE CHANGED
  • command ".EOL.;" prints special line (``-::-EOL-::-''), which parent can use to recognise end of output
  • print message "PARSE ERROR" on STDERR when a parse error occurs (which parent can easily recognise)

This global variable is a Boolean: child process mode on or off.

Referenced by cqp_parse_file(), initialize_cqp(), main(), and parse_options().

char* cqp_history_file

filename where CQP command history will be saved

Referenced by addHistoryLine().

char* cqp_init_file

changed from 'init_file' because of clash with a # define in {term.h}

Referenced by initialize_cqp(), parse_options(), and set_default_option_values().

CQPOption cqpoptions[]

Global array of options for CQP.

int debug_simulation

if true, debug messages are printed when simulating an NFA.

See also
simulate

Referenced by parse_options(), and simulate().

char* def_unbr_attr

Query option: unbracketed attribute (attribute matched by "..." patterns)

Referenced by do_SimpleVariableReference(), and do_StringConstraint().

char* default_corpus

corpus specified with -D {corpus}

Referenced by initialize_cqp(), and parse_options().

int enable_macros

enable macros only at user request in case they introduce compatibility problems

Referenced by initialize_cqp(), list_macros(), macro_iterator_next_macro(), parse_options(), and print_macro_definition().

int eval_debug

if true, assorted debug messages related to query evaluation are printed

Referenced by calculate_initial_matchlist_1(), eval_bool(), get_label_referenced_position(), get_leaf_value(), get_matched_corpus_positions(), and parse_options().

char* ExternalGroupingCommand

(option which should not exist) external group command to use

Referenced by ComputeGroupExternally(), and set_default_option_values().

char* ExternalSortingCommand

(option which should not exist) external sort command to use

Referenced by set_default_option_values(), and SortExternally().

int handle_sigpipe
int hard_boundary

Query option: use implicit 'within' clause (unless overridden by explicit spec)

Referenced by cqp_run_tab_query(), and parse_options().

int hard_cut

Query option: use hard cut value for all queries (cannot be changed)

Referenced by cqp_run_query().

int highlighting

UI option: highlight match / fields in terminal output? (default = yes)

Referenced by ascii_print_output(), and parse_options().

int inhibit_activation

Boolean: inhibit corpus activations in parser.

Referenced by ActivateCorpus(), parse_options(), and set_default_option_values().

int initial_matchlist_debug

if true, debug messages relating to the initial set of candidate matches are printed.

Referenced by get_corpus_positions(), get_matched_corpus_positions(), parse_options(), and simulate_dfa().

int insecure

Boolean: != 0 means we should not allow pipes etc.

(For example, in CGI.)

Referenced by compute_grouping(), open_input_stream(), open_stream(), parse_options(), SetVariableValue(), and SortSubcorpus().

char* left_delimiter

kwic option: the match start prefix (defaults to '<')

Referenced by print_concordance_line().

char* less_charset_variable

UI option: name of environment variable for controlling less charset (usually LESSCHARSET)

Referenced by open_pager().

char* licensee

Referenced by parse_options().

char* LOCAL_CORP_PATH

directory where subcorpora are stored (saved & loaded)

Referenced by check_available_corpora(), do_save(), get_fulllocalpath(), load_corpusnames(), parse_options(), save_subcorpus(), and save_unsaved_subcorpora().

int localhost

cqpserver option: accept local connections (loopback) only

Referenced by accept_connection(), main(), parse_options(), and set_default_option_values().

int macro_debug

enable debugging of macros (and print macro hash stats on shutdown).

Referenced by expand_macro(), main(), parse_options(), and yy_input_char().

char* macro_init_file

secondary init file for loading macro definitions (not read if macros are disabled)

Referenced by initialize_cqp(), parse_options(), and set_default_option_values().

enum _matching_strategy matching_strategy
char* matching_strategy_name

The matching strategy option: which is implemented as a vstring option with side-effect.

Referenced by execute_side_effects().

char* pager

UI option: pager program to used for paged kwic display.

Referenced by open_stream(), and parse_options().

int paging

UI option: activate/deactivate paging of query results.

Referenced by main(), open_stream(), and parse_options().

int parseonly

if true, queries are only parsed, not evaluated.

Referenced by do_MUQuery(), do_StandardQuery(), and do_TABQuery().

int parser_debug

if true, the parser's internal Bison-generated debug setting is turned on.

Referenced by initialize_cqp(), and parse_options().

int pretty_print

UI option: pretty-print most of CQP's output (turn off to simplify parsing of CQP output)

Referenced by ascii_print_group(), list_macros(), PrintContextDescriptor(), show_corpora_files1(), and SortSubcorpus().

char* printModeOptions

kwic option: some printing options

Referenced by ParsePrintOptions().

char* printModeString

kwic option: string of current printmode

Referenced by execute_side_effects().

int printNrMatches

kwic option: -> 'cat' prints number of matches in first line (do we need this?)

Referenced by catalog_corpus().

char* printStructure

kwic option: show annotations of structures containing match

Referenced by ComputePrintStructures().

int private_server

cqpserver option: makes CQPserver accept a single connection only

Referenced by accept_connection(), parse_options(), and set_default_option_values().

char* progname

Referenced by cqp_usage(), main(), and parse_options().

int progress_bar

UI option: show progress bar during query execution.

Referenced by ComputeGroupInternally(), do_subset(), evaluate_subset(), evaluate_target(), prepare_do_subset(), simulate(), and simulate_dfa().

int query_lock

cqpserver option: safe mode for network/HTTP servers (allow query execution only)

Referenced by do_cqi_cqp_query().

int query_lock_violation

cqpserver option: set for CQPserver's sake to detect attempted query lock violation

int query_optimize

Query option: use query optimisation (untested and expensive optimisations)

Referenced by execute_side_effects(), matchfirstpattern(), and set_default_option_values().

char* query_string

query specified on command line (-E {string}, cqpcl only)

Referenced by main(), parse_options(), and set_default_option_values().

int rangeoutput

(option which should not exist)

Referenced by catalog_corpus(), and parse_options().

char* registry
char* right_delimiter

kwic option: the match end suffix (defaults to '>')

Referenced by print_concordance_line().

int save_on_exit

save unsaved subcorpora upon exit

Referenced by cqp_parse_file().

int search_debug

if true, the evaltree of a pattern is pretty-printed before the DFA is created.

Referenced by do_SearchPattern(), and parse_options().

int server_debug
int server_log

cqpserver option: logging (print log messages to standard output)

Referenced by accept_connection(), do_cqi_cqp_query(), main(), and parse_options().

int server_port

cqpserver option: CQPserver's listening port (if 0, listens on CQI_PORT)

Referenced by main(), parse_options(), and set_default_option_values().

int server_quit

cqpserver option: spawn server and return to caller (for CQI::Server.pm)

Referenced by accept_connection(), parse_options(), and set_default_option_values().

int show_compdfa

if true, the complete DFA is printed when an EvalEnvironment is displayed

Referenced by parse_options(), and show_environment().

int show_dfa

if true, the regex2dfa module will print out the states of the DFA after it is parsed.

Referenced by parse_options(), and regex2dfa().

int show_evaltree

if true, the evaluation tree is printed when an EvalEnvironment is displayed

Referenced by parse_options(), and show_environment().

int show_gconstraints

if true, the tree of global contraints is printed when an EvalEnvironment is displayed

Referenced by parse_options(), and show_environment().

int show_patlist

if true, the pattern list is printed when an EvalEnvironment is displayed

Referenced by parse_options(), and show_environment().

int show_symtab

Doesn't seem to be used anywhere; should show_environment use it? if not, remove? TODO.

Referenced by parse_options().

int show_tag_attributes

kwic option: show values of s-attributes as SGML tag attributes in kwic lines

Referenced by get_position_values().

int show_targets

kwic option: show numbers of target anchors in brackets

Referenced by ascii_print_field(), do_attribute_show(), and PrintContextDescriptor().

int silent
int snoop
int strict_regions

boolean: expression between {s} ...

{/s} tags is constrained to single {s} region

Referenced by do_XMLTag(), eval_constraint(), and simulate().

int subquery

Query option: use auto-subquery mode.

Referenced by after_CorpusCommand(), and parse_options().

int symtab_debug

if this AND debug_simulation are true, print extra messages relating to eval environment labels when simulating an NFA.

Referenced by parse_options(), and simulate().

char* tested_pager

UI option: CQP tests if selected pager works & will fall back to "more" if it doesn't.

Referenced by open_pager(), and set_default_option_values().

int timing

UI option: time queries (printed after execution)

Referenced by do_start_timer(), and do_timing().

int tree_debug

if true, extra messages are embedded when an evaluation tree is pretty-printed

Referenced by print_booltree().

int use_colour

UI option: use colours for terminal output (experimental)

Referenced by main(), and parse_options().

int use_readline

UI option: use GNU Readline for input line editing if available.

Referenced by main(), and parse_options().

int UseExternalGrouping

(option which should not exist) use external grouping algorithm

Referenced by compute_grouping().

int UseExternalSorting

(option which should not exist) use external sorting algorithm

Referenced by SortSubcorpus().

int user_level

(option which should not exist) user level: 0 == normal, 1 == advanced, 2 == expert)

Referenced by ensure_corpus_size(), and print_option_values().

int verbose_parser

if true, absolutely all messages from the parser get printed (inc Message-level).

Referenced by cqpmessage(), and parse_options().

enum _which_app which_app
int write_history_file

Controls whether CQP command history is written to file.

Referenced by addHistoryLine(), and yy_input_char().