From a50aacd30adb87698eb775ef5c7615c65e57a11d Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Thu, 29 Apr 2021 17:54:54 +0200 Subject: very basic binary file parsing and skeleton for state-machine based parsing of ascii format --- service/src/stlfile.h | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'service/src/stlfile.h') diff --git a/service/src/stlfile.h b/service/src/stlfile.h index 424b61b..00cf28d 100644 --- a/service/src/stlfile.h +++ b/service/src/stlfile.h @@ -3,14 +3,36 @@ #include #include +#include +#include + +enum { + KW_SOLID_BEGIN, + KW_SOLID_END, + KW_FACET, + KW_OUTER, + KW_VERTEX +}; + +enum { + TYPE_ASCII, + TYPE_BIN +}; + +struct stack { + int *data; + size_t count, cap; +}; struct parseinfo { char fmtbuf[256]; - int attrs; + char header[80]; + int type, valid; + unsigned int loopcount; + float bbw, bbh; char *namehash, *infopath, *stlpath; }; -struct parseinfo* parse_file(char *buf, size_t len); -void free_parseinfo(struct parseinfo *info); +int parse_file(struct parseinfo *info, char *buf, size_t len); -#endif // STLFILE_H +#endif /* STLFILE_H */ -- cgit v1.2.3-71-gd317