summaryrefslogtreecommitdiff
path: root/source/luametatex/source/lua/lmttokenlib.h
blob: bfc3ed6f2502218a2caf7bbdc2cfdd86bc6c61fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
    See license.txt in the root of this project.
*/

# ifndef LMT_LTOKENLIB_H
# define LMT_LTOKENLIB_H

typedef enum token_origins {
    token_origin_lua,
    token_origin_tex,
} token_origins;

typedef struct lua_token {
    int           token;
    token_origins origin;
} lua_token;

typedef enum command_item_types {
    unused_command_item,
    regular_command_item,
    character_command_item,
    register_command_item,
    internal_command_item,
    reference_command_item,
    data_command_item,
    token_command_item,
    node_command_item,
} command_item_types;

extern void     lmt_token_list_to_lua         (lua_State *L, halfword p);
extern void     lmt_token_list_to_luastring   (lua_State *L, halfword p, int nospace, int strip, int wipe);
extern halfword lmt_token_list_from_lua       (lua_State *L, int slot);
extern halfword lmt_token_code_from_lua       (lua_State *L, int slot);

extern void     lmt_function_call             (int slot, int prefix);
extern int      lmt_function_call_by_category (int slot, int property, halfword *value);
extern void     lmt_token_call                (int p);
extern void     lmt_local_call                (int slot);

extern char    *lmt_get_expansion             (halfword head, int *len);

extern void     lmt_token_register_to_lua     (lua_State *L, halfword t);

extern void     lmt_tokenlib_initialize       (void);

extern int      lmt_push_specification        (lua_State *L, halfword ptr, int onlycount);

extern void     lmt_push_cmd_name             (lua_State *L, int cmd);

extern halfword lmt_macro_to_tok              (lua_State* L, int slot, halfword *tail);

# endif