TeX/include/TeX/env.h

59 lines
1.3 KiB
C

//---
// 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);
/* size(): Compute environment size */
void (*size)(TeX_Env *env);
/* 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.
Creates and returns a new environment [env] which must be freed by a call
to [env->free(env)]. */
struct TeX_Env *TeX_env_primary(void);
#endif /* TEX_ENV */