CWB
|
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include "../cl/globals.h"
#include "../cl/macros.h"
#include "cqp.h"
#include "options.h"
#include "output.h"
#include "symtab.h"
#include "tree.h"
#include "eval.h"
#include "corpmanag.h"
#include "regex2dfa.h"
#include "ranges.h"
#include "macro.h"
#include "targets.h"
#include "parser.tab.h"
Functions | |
int | yyparse (void) |
Activates the CQP-query-language parser. More... | |
void | yyrestart (FILE *input_file) |
restarts the CQP-query-language parser. More... | |
static void | sigINT_signal_handler (int signum) |
This is the signal handler function that is used for the interrupt signal (CTRL+C). More... | |
void | install_signal_handler (void) |
Installs the interrupt signal handler function with the OS. More... | |
int | initialize_cqp (int argc, char **argv) |
Initialises the CQP program (or cqpserver or cqpcl). More... | |
int | cqp_parse_file (FILE *fd, int exit_on_parse_errors) |
Parses a stream for CQP query syntax. More... | |
int | cqp_parse_string (char *s) |
Parses a string for CQP query syntax. More... | |
int | setInterruptCallback (InterruptCheckProc f) |
Sets the interrupt callback function. More... | |
void | CheckForInterrupts (void) |
Calls the interrupt callback function, if set. More... | |
Variables | |
FILE * | yyin |
File handle used by the CQP-query-language parser. More... | |
FILE * | cqp_files [MAXCQPFILES] |
Array of file handles. More... | |
int | cqp_file_p |
index into cqp_files. More... | |
int | reading_cqprc = 0 |
Boolean: true iff cqp_parse_file() - the main query syntax parsing function - is currently reading from the cqprc file handler. More... | |
int | cqp_error_status = 0 |
Global error status for CQP (will be returned to the caller when CQP exits). More... | |
char | QueryBuffer [QUERY_BUFFER_SIZE] |
buffer for queries More... | |
int | QueryBufferP = 0 |
index into this buffer, for appending More... | |
int | QueryBufferOverflow = 0 |
flag which signals buffer overflows More... | |
InterruptCheckProc | interruptCallbackHook = NULL |
Pointer for the interrupt callback function. More... | |
void CheckForInterrupts | ( | void | ) |
Calls the interrupt callback function, if set.
References interruptCallbackHook.
Referenced by evaluate_target(), and simulate().
int cqp_parse_file | ( | FILE * | fd, |
int | exit_on_parse_errors | ||
) |
Parses a stream for CQP query syntax.
Note that cqp_parse_file() fclose()s fd unless it is STDOUT.
fd | File handle of the file to parse. |
exit_on_parse_errors | Boolean: should CQP exit on parse errors? |
References child_process, cqp_file_p, cqp_files, current_corpus, exit_cqp, MAXCQPFILES, cl::mother_name, cl::name, quiet, reading_cqprc, save_on_exit, save_unsaved_subcorpora(), silent, cl::size, STREQ, yyin, yyparse(), and yyrestart().
Referenced by do_exec(), initialize_cqp(), and main().
int cqp_parse_string | ( | char * | s | ) |
Parses a string for CQP query syntax.
s | The string to parse. |
References cqp_input_string, cqp_input_string_position, cqpmessage(), cqpserver, Error, exit_cqp, which_app, and yyparse().
Referenced by do_cqi_cqp_query(), and main().
int initialize_cqp | ( | int | argc, |
char ** | argv | ||
) |
Initialises the CQP program (or cqpserver or cqpcl).
This function:
References batchfd, batchmode, check_available_corpora(), child_process, cl_free, cl_malloc(), CL_MAX_FILENAME_LENGTH, cl_randomize(), corpuslist, cqp_file_p, cqp_init_file, cqp_parse_file(), CQPMACRORC_NAME, cqpmessage(), CQPRC_NAME, cqpserver, default_corpus, eep, enable_macros, exit_cqp, init_macros(), macro_init_file, parse_options(), parser_debug, reading_cqprc, set_current_corpus_name(), SUBDIR_SEPARATOR, UNDEF, Warning, and which_app.
Referenced by main().
void install_signal_handler | ( | void | ) |
Installs the interrupt signal handler function with the OS.
This function installs a Ctrl-C interrupt handler (clears EvaluationIsRunning flag). The function installed is sigINT_signal_handler.
References cqpmessage(), sigINT_signal_handler(), signal_handler_is_installed, and Warning.
Referenced by check_alignment_constraints(), ComputeGroupInternally(), evaluate_subset(), evaluate_target(), main(), simulate_dfa(), SortSubcorpus(), and SortSubcorpusRandomize().
int setInterruptCallback | ( | InterruptCheckProc | f | ) |
Sets the interrupt callback function.
f | Pointer to the function to set as interrupt callback. |
References interruptCallbackHook.
|
static |
This is the signal handler function that is used for the interrupt signal (CTRL+C).
signum | The signal number (ignored). |
References EvaluationIsRunning, and signal_handler_is_installed.
Referenced by install_signal_handler().
int yyparse | ( | void | ) |
Activates the CQP-query-language parser.
Referenced by cqp_parse_file(), and cqp_parse_string().
void yyrestart | ( | FILE * | input_file | ) |
restarts the CQP-query-language parser.
Referenced by cqp_parse_file().
int cqp_error_status = 0 |
Global error status for CQP (will be returned to the caller when CQP exits).
For the moment, it's simply boolean (0 = all OK, anything else = error.) Later, we might want to define some error macros (maybe have the CDA_ macros as a subset for errors bubbling up from CL, plus also extra macros for other errors.
TODO actually get this variable set in various error conditions. TODO work out whether cqpserver should exit with this error.
Referenced by main().
int cqp_file_p |
FILE* cqp_files[MAXCQPFILES] |
Array of file handles.
Allows nested execution of "included" text files full of commands.
Referenced by cqp_parse_file().
InterruptCheckProc interruptCallbackHook = NULL |
Pointer for the interrupt callback function.
Referenced by CheckForInterrupts(), and setInterruptCallback().
char QueryBuffer[QUERY_BUFFER_SIZE] |
buffer for queries
Referenced by addHistoryLine(), after_CorpusCommand(), after_Query(), prepare_Query(), resetQueryBuffer(), and yy_input_char().
int QueryBufferOverflow = 0 |
flag which signals buffer overflows
Referenced by after_CorpusCommand(), after_Query(), resetQueryBuffer(), and yy_input_char().
int QueryBufferP = 0 |
index into this buffer, for appending
Referenced by after_Query(), resetQueryBuffer(), and yy_input_char().
int reading_cqprc = 0 |
Boolean: true iff cqp_parse_file() - the main query syntax parsing function - is currently reading from the cqprc file handler.
Referenced by addHistoryLine(), cqp_parse_file(), initialize_cqp(), and yy_input_char().
FILE* yyin |
File handle used by the CQP-query-language parser.
Referenced by cqp_parse_file().