DiskIn help: prioritise object-style example over OSC example
[supercollider.git] / SCDoc / main.cpp
blob260993a497f2ce66ddb6df95b400b540ea7aa3ad
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <stdarg.h>
6 #include "SCDoc.h"
8 void error(const char *fmt, ...)
10 fprintf(stderr, "ERROR: ");
11 va_list vargs;
12 va_start(vargs, fmt);
13 vfprintf(stderr, fmt, vargs);
14 fflush(stderr);
17 void post(const char *fmt, ...)
19 va_list vargs;
20 va_start(vargs, fmt);
21 vfprintf(stderr, fmt, vargs);
22 fflush(stderr);
25 int main(int argc, char **argv)
27 if(argc>1) {
28 DocNode *n;
29 if(argc>2 && strcmp(argv[1],"--partial")==0)
30 n = scdoc_parse_file(argv[2], SCDOC_PARSE_PARTIAL);
31 else
32 if(argc>2 && strcmp(argv[1],"--metadata")==0)
33 n = scdoc_parse_file(argv[2], SCDOC_PARSE_METADATA);
34 else
35 n = scdoc_parse_file(argv[1], SCDOC_PARSE_FULL);
36 if(n) {
37 doc_node_dump(n);
38 doc_node_free_tree(n);
39 } else
40 return 1;
41 } else {
42 fprintf(stderr, "Usage: %s inputfile.schelp\n",argv[0]);
44 return 0;