YAZ 5.37.0
cql2ccl.c File Reference

Implements CQL to CCL conversion. More...

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <yaz/cql.h>
#include <yaz/snprintf.h>

Go to the source code of this file.

Functions

static int cql_to_ccl_r (struct cql_node *cn, void(*pr)(const char *buf, void *client_data), void *client_data)
static void pr_term (const char **cpp, int stop_at_space, void(*pr)(const char *buf, void *client_data), void *client_data)
static int node_st (struct cql_node *cn, void(*pr)(const char *buf, void *client_data), void *client_data)
static int node_bool (struct cql_node *cn, void(*pr)(const char *buf, void *client_data), void *client_data)
int cql_to_ccl (struct cql_node *cn, void(*pr)(const char *buf, void *client_data), void *client_data)
 converts CQL tree to CCL and writes to user-defined stream
void cql_to_ccl_stdio (struct cql_node *cn, FILE *f)
 converts CQL tree to CCL and writes to file
int cql_to_ccl_buf (struct cql_node *cn, char *out, int max)
 converts CQL tree to CCL and writes result to buffer

Detailed Description

Implements CQL to CCL conversion.

Definition in file cql2ccl.c.

Function Documentation

◆ cql_to_ccl()

int cql_to_ccl ( struct cql_node * cn,
void(* pr )(const char *buf, void *client_data),
void * client_data )

converts CQL tree to CCL and writes to user-defined stream

Parameters
cnCQL node (tree)
prprint function
client_datadata to be passed to pr function

Definition at line 250 of file cql2ccl.c.

References cql_to_ccl_r().

Referenced by cql_to_ccl_buf(), and cql_to_ccl_stdio().

◆ cql_to_ccl_buf()

int cql_to_ccl_buf ( struct cql_node * cn,
char * out,
int max )

converts CQL tree to CCL and writes result to buffer

Parameters
cnCQL node (tree)
outbuffer
maxsize of buffer (max chars to write)
Return values
0OK
-1conversion error
-2buffer too small (truncated)

Definition at line 262 of file cql2ccl.c.

References cql_buf_write_info::buf, cql_buf_write_handler(), cql_to_ccl(), cql_buf_write_info::max, and cql_buf_write_info::off.

◆ cql_to_ccl_r()

int cql_to_ccl_r ( struct cql_node * cn,
void(* pr )(const char *buf, void *client_data),
void * client_data )
static

◆ cql_to_ccl_stdio()

void cql_to_ccl_stdio ( struct cql_node * cn,
FILE * f )

converts CQL tree to CCL and writes to file

Parameters
cnCQL node (tree)
ffile handle

Definition at line 257 of file cql2ccl.c.

References cql_fputs(), and cql_to_ccl().

◆ node_bool()

int node_bool ( struct cql_node * cn,
void(* pr )(const char *buf, void *client_data),
void * client_data )
static

◆ node_st()

int node_st ( struct cql_node * cn,
void(* pr )(const char *buf, void *client_data),
void * client_data )
static

◆ pr_term()

void pr_term ( const char ** cpp,
int stop_at_space,
void(* pr )(const char *buf, void *client_data),
void * client_data )
static

Definition at line 24 of file cql2ccl.c.

Referenced by node_st().