TeX/include/TeX/env.h

66 lines
1.7 KiB
C
Raw Normal View History

2019-06-12 18:53:50 +02:00
//---
// env: Environments
//---
#ifndef TEX_ENV
#define TEX_ENV
#include <stddef.h>
struct TeX_Node;
/* Simple type definition trick to use struct TeX_Env inside prototypes within
the struct definition itself */
typedef struct TeX_Env TeX_Env;
struct TeX_Env
{
/* Environment name */
char const * name;
/* free(): Free an environment instance */
void (*free)(TeX_Env *env);
/* add_node(): Add a node to an environment */
void (*add_node)(TeX_Env *env, struct TeX_Node *node);
/* add_separator(): Add a separator ("&") */
void (*add_separator)(TeX_Env *env);
/* add_break(): Add a break ("\\") */
void (*add_break)(TeX_Env *env);
2019-06-18 03:27:04 +02:00
/* layout(): Compute environment layout */
2019-06-19 17:52:09 +02:00
void (*layout)(TeX_Env *env, int display);
2019-06-12 18:53:50 +02:00
/* render(): Render environment */
void (*render)(TeX_Env *env, int x, int y, int color);
/* Dimensions */
uint16_t width;
uint16_t height;
uint16_t line;
/* More data, each TeX_Env_* subtype will decide */
};
//---
// Environment construction functions
//---
/* TeX_env_primary(): make a primary, single-flow environment
This is the environment type of whole formulas. It consists of a single
flow and ignores separators and breaks.
2019-06-18 03:27:04 +02:00
Creates and returns a new environment which must be freed by TeX_free(). */
2019-06-12 18:53:50 +02:00
struct TeX_Env *TeX_env_primary(void);
2019-06-18 03:27:04 +02:00
/* TeX_env_matrix(): make a variable-size matrix
This environment builds matrices without surrounding delimiters. Separators
are used to separate elements, and breaks mark the end of each line. Rows of
uneven length are all padded with empty elements to the maximum row length
of the whole matrix.
Returns a new environment; free with TeX_free(). */
struct TeX_Env *TeX_env_matrix(void);
2019-06-12 18:53:50 +02:00
#endif /* TEX_ENV */