jx_print.h File Reference

Print JX expressions to strings, files, and buffers. More...

`#include "jx.h"`
`#include "buffer.h"`
`#include "link.h"`
`#include <stdio.h>`

Go to the source code of this file.

## Functions

char * | jx_print_string (struct jx *j)
| Convert a JX expression into a string.
void | jx_print_stream (struct jx *j, FILE *file)
| Print a JX expression to a standard I/O stream.
void | jx_print_shell (struct jx *j, FILE *file)
| Print a JX object as shell environment variables.
void | jx_print_buffer (struct jx *j, buffer_t *buffer)
| Print a JX expression to a buffer.
void | jx_print_link (struct jx *j, struct link *l, time_t stoptime)
| Print a JX expression to a link.
void | jx_escape_string (const char *s, buffer_t *b)
| Print a C string in JSON format (with escape codes) into a buffer.
void | jx_print_args (struct jx *j, buffer_t *b)
| Print a list of arguments to a buffer.
const char * | jx_operator_string (jx_operator_t type)
| Get a string representation of an operator.
const char * | jx_type_string (jx_type_t type)
| Get a string representation of an object type.

## Detailed Description

Print JX expressions to strings, files, and buffers.

## Function Documentation

## jx_print_string()

char * jx_print_string | ( | struct jx * | j | ) |

Convert a JX expression into a string.

Parameters

  j | A JX expression.

Returns
  A C string representing the expression in JSON form. The string must be deleted with free().

## jx_print_stream()

void jx_print_stream | ( | struct jx * | j,
|  | FILE * | file )

Print a JX expression to a standard I/O stream.

Parameters

  j | A JX expression.
  file | A standard IO stream.

## jx_print_shell()

void jx_print_shell | ( | struct jx * | j,
|  | FILE * | file )

Print a JX object as shell environment variables.

Parameters

  j | A JX expression.
  file | A standard IO stream.

## jx_print_buffer()

void jx_print_buffer | ( | struct jx * | j,
|  | buffer_t * | buffer )

Print a JX expression to a buffer.

Parameters

  j | A JX expression.
  buffer | The buffer for output.

See also
  buffer.h

## jx_print_link()

void jx_print_link | ( | struct jx * | j,
|  | struct link * | l,
|  | time_t | stoptime )

Print a JX expression to a link.

Parameters

  j | A JX expression.
  l | The network link to write.
  stoptime | The absolute time to stop.

See also
  link.h

## jx_escape_string()

void jx_escape_string | ( | const char * | s,
|  | buffer_t * | b )

Print a C string in JSON format (with escape codes) into a buffer.

Parameters

  s | A C string.
  b | The buffer for output.

See also
  buffer.h

## jx_print_args()

void jx_print_args | ( | struct jx * | j,
|  | buffer_t * | b )

Print a list of arguments to a buffer.

Parameters

  j | Array of arguments to print.
  b | The buffer for output.

## jx_operator_string()

const char * jx_operator_string | ( | jx_operator_t | type | ) |

Get a string representation of an operator.

Parameters

  type | The operator to get.

## jx_type_string()

const char * jx_type_string | ( | jx_type_t | type | ) |

Get a string representation of an object type.

Parameters

  type | The object type to get.