CWB
Macros | Functions
macros.h File Reference
#include "globals.h"

Macros

#define new(T)   (T *)cl_malloc(sizeof(T))
 Allocates a new object. More...
 
#define New(P, T)   P = (T *)cl_malloc(sizeof(T))
 New-object allocator with alternative syntax. More...
 
#define STREQ(a, b)
 Tests two strings for equality. More...
 
#define MIN(a, b)   ((a)<(b) ? (a) : (b))
 Evaluates to the smaller of two integer arguments. More...
 
#define MAX(a, b)   ((a)>(b) ? (a) : (b))
 Evaluates to the greater of two integer arguments. More...
 
#define ilist_start(lw, ts, id)   start_indented_list(lw, ts, id)
 
#define ilist_print_break(l)   print_indented_list_br(l)
 
#define ilist_print_item(s)   print_indented_list_item(s)
 
#define ilist_end   end_indented_list
 
#define ILIST_INDENT   4
 
#define ILIST_TAB   12
 
#define ILIST_LINEWIDTH   72 /* total linewidth needed is ILIST_INDENT + ILIST_LINEWIDTH */
 

Functions

void progress_bar_child_mode (int on_off)
 Activates or deactivates child (simple) mode for progress_bar. More...
 
void progress_bar_clear_line (void)
 Clears the progress bar currently displayed on the terminal. More...
 
void progress_bar_message (int pass, int total, char *message)
 Prints a new progress bar (passes-plus-message format). More...
 
void progress_bar_percentage (int pass, int total, int percentage)
 Prints a new progress bar (passes-plus-percentage-done format). More...
 
void start_indented_list (int linewidth, int tabsize, int indent)
 Begins the printing of a line in an indented 'tabularised' list. More...
 
void print_indented_list_br (char *label)
 Starts a new line in an indented 'tabularised' list. More...
 
void print_indented_list_item (char *string)
 Prints an item into an ongoing indented list. More...
 
void end_indented_list (void)
 Ends the printing of a line in an indented 'tabularised' list. More...
 

Macro Definition Documentation

#define ilist_end   end_indented_list
#define ILIST_INDENT   4

Referenced by start_indented_list().

#define ILIST_LINEWIDTH   72 /* total linewidth needed is ILIST_INDENT + ILIST_LINEWIDTH */

Referenced by start_indented_list().

#define ilist_print_break (   l)    print_indented_list_br(l)
#define ilist_print_item (   s)    print_indented_list_item(s)
#define ilist_start (   lw,
  ts,
  id 
)    start_indented_list(lw, ts, id)
#define ILIST_TAB   12

Referenced by start_indented_list().

#define MAX (   a,
 
)    ((a)>(b) ? (a) : (b))

Evaluates to the greater of two integer arguments.

Referenced by calculate_ranges(), compose_kwic_line(), and evaluate_target().

#define MIN (   a,
 
)    ((a)<(b) ? (a) : (b))

Evaluates to the smaller of two integer arguments.

Referenced by calculate_ranges(), compose_kwic_line(), i2compare(), meet_mu(), Setop(), and simulate().

#define new (   T)    (T *)cl_malloc(sizeof(T))

Allocates a new object.

A macro for memory allocation which implements an object-oriented-style "new" term: it evaluates to a pointer to a newly-laid-out memory block of the size of the specified type.

Parameters
TThe data type of the "object" to be created.
Returns
A pointer to the new "object".

Referenced by do_undump().

#define New (   P,
 
)    P = (T *)cl_malloc(sizeof(T))

New-object allocator with alternative syntax.

See also
new

Referenced by GetSystemCorpus(), and NewCL().

#define STREQ (   a,
 
)
Value:
(((a) == (b)) || \
((a) && (b) && (strcmp((a), (b)) == 0)))

Tests two strings for equality.

This macro evaluates to 1 if the strings are equal, 0 otherwise. Be careful: strings are considered equal if they are both NULL, they are considered non-equal when one of both is NULL.

Parameters
athe first string
bthe second string
Returns
a Boolean

Referenced by cl_new_attribute_oldstyle(), component_full_name(), cqp_parse_file(), eval_bool(), find_corpus(), get_matched_corpus_positions(), and LoadedCorpus().

Function Documentation

void end_indented_list ( void  )

Ends the printing of a line in an indented 'tabularised' list.

References ilist_cursor.

Referenced by list_macros(), printSingleVariableValue(), and show_corpora_files1().

void print_indented_list_br ( char *  label)

Starts a new line in an indented 'tabularised' list.

Used when a line break is needed within an indented list; this function starts a new line (as
in HTML), an showing optional label in indentation.

Parameters
labelThe optional label, if this is NULL, no label is used; if it is a string, then the string appears on the far left hand side.

References ilist_cursor, ilist_indent, and ilist_print_blanks().

Referenced by list_macros(), print_indented_list_item(), and show_corpora_files1().

void print_indented_list_item ( char *  string)

Prints an item into an ongoing indented list.

Parameters
stringThe string to print as a list item.

References ilist_cursor, ilist_linewidth, ilist_tab, and print_indented_list_br().

Referenced by describecorpus_show_attribute_names(), list_macros(), printSingleVariableValue(), and show_corpora_files1().

void progress_bar_child_mode ( int  on_off)

Activates or deactivates child (simple) mode for progress_bar.

Parameters
on_offThe new setting for the progress bar mode, where 1 = simple messages ON STDOUT, 0 = pretty-printed messages with carriage returns ON STDERR

References progress_bar_simple.

Referenced by parse_options().

void progress_bar_clear_line ( void  )

Clears the progress bar currently displayed on the terminal.

Note: assumes line width of 60 characters.

References progress_bar_simple.

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

void progress_bar_message ( int  pass,
int  total,
char *  message 
)

Prints a new progress bar (passes-plus-message format).

The progress bar printed is as follows:

[pass {pass} of {total}: {message}]

If total is equal to zero, the function uses the pass and total values from the last call of this function.

References progress_bar_pass, progress_bar_simple, and progress_bar_total.

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

void progress_bar_percentage ( int  pass,
int  total,
int  percentage 
)

Prints a new progress bar (passes-plus-percentage-done format).

The progress bar printed is as follows:

[pass {pass} of {total}: {percentage}% complete]

If total is equal to zero, the function uses the pass and total values from the last call of this function.

References progress_bar_message().

Referenced by ComputeGroupInternally(), evaluate_subset(), evaluate_target(), and simulate().

void start_indented_list ( int  linewidth,
int  tabsize,
int  indent 
)

Begins the printing of a line in an indented 'tabularised' list.

This function begins the printing of the first line of an indented If any of the three parameters are zero, this function uses the internal default value for that parameter instead (ILIST macro constants).

Parameters
linewidthWidth of the line (in characters)
tabsizeTabulator steps (in characters)
indentIndentation of the list from left margin (in characters)

References ilist_cursor, ILIST_INDENT, ilist_indent, ILIST_LINEWIDTH, ilist_linewidth, ilist_print_blanks(), ILIST_TAB, and ilist_tab.

Referenced by describecorpus_show_attribute_names(), list_macros(), printSingleVariableValue(), and show_corpora_files1().