MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/src/mime/internal/tok822_parse.cpp:693–729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691}
692
693int main(int unused_argc, char **unused_argv)
694{
695 VSTRING *vp = vstring_alloc(100);
696 TOK822 *list;
697 VSTRING *buf = vstring_alloc(100);
698
699#define TEST_TOKEN_LIMIT 20
700
701 while (readlline(buf, VSTREAM_IN, (int *) 0)) {
702 while (VSTRING_LEN(buf) > 0 && vstring_end(buf)[-1] == '\n') {
703 vstring_end(buf)[-1] = 0;
704 vstring_truncate(buf, VSTRING_LEN(buf) - 1);
705 }
706 if (!isatty(vstream_fileno(VSTREAM_IN)))
707 vstream_printf(">>>%s<<<\n\n", vstring_str(buf));
708 list = tok822_parse_limit(vstring_str(buf), TEST_TOKEN_LIMIT);
709 vstream_printf("Parse tree:\n");
710 tok822_print(list, 0);
711 vstream_printf("\n");
712
713 vstream_printf("Internalized:\n%s\n\n",
714 vstring_str(tok822_internalize(vp, list, TOK822_STR_DEFL)));
715 vstream_fflush(VSTREAM_OUT);
716 vstream_printf("Externalized, no newlines inserted:\n%s\n\n",
717 vstring_str(tok822_externalize(vp, list,
718 TOK822_STR_DEFL | TOK822_STR_TRNC)));
719 vstream_fflush(VSTREAM_OUT);
720 vstream_printf("Externalized, newlines inserted:\n%s\n\n",
721 vstring_str(tok822_externalize(vp, list,
722 TOK822_STR_DEFL | TOK822_STR_LINE | TOK822_STR_TRNC)));
723 vstream_fflush(VSTREAM_OUT);
724 tok822_free_tree(list);
725 }
726 vstring_free(vp);
727 vstring_free(buf);
728 return (0);
729}
730
731#endif
732#endif // !defined(ACL_MIME_DISABLE)

Callers

nothing calls this directly

Calls 5

tok822_parse_limitFunction · 0.85
tok822_printFunction · 0.85
tok822_internalizeFunction · 0.85
tok822_externalizeFunction · 0.85
tok822_free_treeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…