protoverse

A metaverse protocol
git clone git://jb55.com/protoverse
Log | Files | Refs | README | LICENSE

commit bb13628866489dcc9acd398cfc29c3046d51ec88
parent d912ca3728ebdaf454b104f4de3f5f1a2e976534
Author: William Casarin <jb55@jb55.com>
Date:   Fri,  6 Nov 2020 21:59:55 -0800

describe: make non-static

we will need this elsewhere

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdescribe.c | 26++++++++++++++++++++------
Mdescribe.h | 7+++++++
Mprotoverse.c | 19-------------------
3 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/describe.c b/describe.c @@ -10,12 +10,6 @@ /* various functions used to describe the scene */ -struct describe { - struct cell *cell; - struct parser *parsed; - struct cursor *strs; -}; - static int push_sized_word(struct cursor *strs, const char *str, int len) { int ok; @@ -370,3 +364,23 @@ int describe_cells(struct cell *cell, struct parser *parsed, struct cursor *strs return describe_cells(cell, parsed, strs, max_depth, depth+1); } + + +int describe(struct parser *parser, u16 root_cell) +{ + static char strbuf[2048]; + struct cursor strs; + struct cell *cell; + + strbuf[0] = 0; + + cell = get_cell(parser->cells, root_cell); + + make_cursor((u8*)strbuf, (u8*)strbuf + sizeof(strbuf), &strs); + + describe_cells(cell, parser, &strs, 10, 0); + + printf("\n\ndescription\n-----------\n\n%s\n", strbuf); + + return 1; +} diff --git a/describe.h b/describe.h @@ -4,6 +4,13 @@ #include "parse.h" +struct describe { + struct cell *cell; + struct parser *parsed; + struct cursor *strs; +}; + +int describe(struct parser *parser, u16 root_cell); int describe_cell(struct cell *cell, struct parser *parsed, struct cursor *strbuf); int describe_cells(struct cell *cell, struct parser *parsed, struct cursor *strs, int max_depth, int depth); diff --git a/protoverse.c b/protoverse.c @@ -101,25 +101,6 @@ static int parse_file(struct parser *parser, const char *filename, u16 *root) return 1; } -static int describe(struct parser *parser, u16 root_cell) -{ - static char strbuf[2048]; - struct cursor strs; - struct cell *cell; - - strbuf[0] = 0; - - cell = get_cell(parser->cells, root_cell); - - make_cursor((u8*)strbuf, (u8*)strbuf + sizeof(strbuf), &strs); - - describe_cells(cell, parser, &strs, 10, 0); - - printf("\n\ndescription\n-----------\n\n%s\n", strbuf); - - return 1; -} - static int usage(void) { printf("usage: protoverse <command> [args]\n\n");