#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <dirent.h>
#include "options.h"
#include "print-modes.h"
#include "output.h"
#include "corpmanag.h"
#include "concordance.h"
#include "../cl/attributes.h"
#include "../cl/macros.h"
#define DEFAULT_EXTERNAL_GROUPING_COMMAND "sort -n %s +0n +1n -2 | uniq -c | sort -n -r +1n +0rn +2n" |
Referenced by set_default_option_values().
#define DEFAULT_EXTERNAL_SORTING_COMMAND "sort -k 2 -k 1n " |
Referenced by set_default_option_values().
void execute_side_effects | ( | int | opt | ) |
Carries out any "side effects" of setting an option.
opt | The option that has just been set. |
References activate_cl_debug, CD, check_available_corpora(), cl_free, cl_set_debug_level(), cl_set_optimize(), cl_strdup(), ComputePrintStructures(), cqpmessage(), current_corpus, DestroyAttributeList(), Error, GlobalPrintMode, longest_match, matching_strategy, matching_strategy_name, ParsePrintOptions(), PrintASCII, PrintHTML, PrintLATEX, printModeString, PrintSGML, _context_description_block::printStructureTags, query_optimize, shortest_match, standard_match, SUB, SYSTEM, and traditional.
Referenced by parse_options(), set_context_option_value(), set_integer_option_value(), and set_string_option_value().
char* expand_filename | ( | char * | fname | ) |
References cl_strdup().
Referenced by set_string_option_value().
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.
s | Name of the option to find. |
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 | ac, | |
char * | av[] | |||
) |
Parses program options and sets their default values.
ac | The program's argc. | |
av | The program's argv. |
References activate_cl_debug, auto_save, autoshow, batchfd, batchmode, CD, child_process, cl_set_debug_level(), cl_strdup(), cqp, cqp_init_file, cqpcl, cqpserver, debug_simulation, default_corpus, enable_macros, eval_debug, execute_side_effects(), False, find_option(), handle_sigpipe, hard_boundary, highlighting, _cqpoption::idefault, inhibit_activation, initial_matchlist_debug, insecure, _context_description_block::left_width, licensee, LOCAL_CORP_PATH, localhost, macro_debug, macro_init_file, OpenFile(), OptBoolean, pager, paging, parser_debug, private_server, progname, progress_bar_child_mode(), query_string, rangeoutput, registry, _context_description_block::right_width, search_debug, server_debug, server_log, server_port, server_quit, set_default_option_values(), show_compdfa, show_dfa, show_evaltree, show_gconstraints, show_patlist, show_symtab, silent, snoop, subquery, symtab_debug, syntax(), True, use_colour, use_readline, verbose_parser, and which_app.
Referenced by initialize_cqp(), and main().
void print_option_value | ( | int | opt | ) |
References ALIGN_CONTEXT, CHAR_CONTEXT, find_option(), GlobalPrintOptions, _print_option_rec_::number_lines, OptBoolean, OptContext, OptInteger, OptString, _print_option_rec_::print_border, _print_option_rec_::print_header, print_option_value(), _print_option_rec_::print_tabular, _print_option_rec_::print_wrap, STRUC_CONTEXT, and WORD_CONTEXT.
Referenced by print_option_value(), and print_option_values().
void print_option_values | ( | ) |
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 | |||
) |
References CD, CHAR_CONTEXT, cl_free, cl_strdup(), execute_side_effects(), find_option(), _context_description_block::left_structure, _context_description_block::left_structure_name, _context_description_block::left_type, _context_description_block::left_width, OptContext, _context_description_block::right_structure, _context_description_block::right_structure_name, _context_description_block::right_type, _context_description_block::right_width, STRUC_CONTEXT, and WORD_CONTEXT.
Referenced by set_integer_option_value(), and set_string_option_value().
void set_default_option_values | ( | void | ) |
Sets all the CQP options to their default values.
References activate_cl_debug, CD, CHAR_CONTEXT, cl_set_debug_level(), cl_set_optimize(), cl_strdup(), cqp_init_file, DEFAULT_CONTEXT, DEFAULT_EXTERNAL_GROUPING_COMMAND, DEFAULT_EXTERNAL_SORTING_COMMAND, ExternalGroupingCommand, ExternalSortingCommand, handle_sigpipe, _cqpoption::idefault, inhibit_activation, initialize_context_descriptor(), _context_description_block::left_type, _context_description_block::left_width, localhost, macro_init_file, matching_strategy, _cqpoption::opt_name, OptBoolean, OptInteger, OptString, _context_description_block::print_cpos, private_server, query_optimize, query_string, _context_description_block::right_type, _context_description_block::right_width, server_port, server_quit, standard_match, and tested_pager.
Referenced by parse_options().
char* set_integer_option_value | ( | char * | opt_name, | |
int | value | |||
) |
Sets an integer or string-valued option.
An error string is returned if the type of the option does not correspond to the function which is called. Upon success, NULL is returned.
opt_name | The name of the option to set. | |
value | Its new value. |
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 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!
opt_name | The name of the option to set. | |
value | Its new value. |
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().
void syntax | ( | void | ) |
int validate_integer_option_value | ( | int | opt, | |
int | value | |||
) |
Referenced by set_integer_option_value().
int validate_string_option_value | ( | int | opt, | |
char * | value | |||
) |
Referenced by set_string_option_value().
Global array of options for CQP.