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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#if INTERFACE
/* These are described in pikchr_process()'s docs. */
/* The first two must match the values from pikchr.c */
#define PIKCHR_PROCESS_PLAINTEXT_ERRORS 0x0001
#define PIKCHR_PROCESS_DARK_MODE 0x0002
/* end of flags supported directly by pikchr() */
#define PIKCHR_PROCESS_PASSTHROUGH 0x0003 /* Pass through these flags */
#define PIKCHR_PROCESS_TH1 0x0004
#define PIKCHR_PROCESS_TH1_NOSVG 0x0008
#define PIKCHR_PROCESS_NONCE 0x0010
#define PIKCHR_PROCESS_ERR_PRE 0x0020
#define PIKCHR_PROCESS_SRC 0x0040
#define PIKCHR_PROCESS_DIV 0x0080
#define PIKCHR_PROCESS_DIV_INDENT 0x0100
#define PIKCHR_PROCESS_DIV_CENTER 0x0200
#define PIKCHR_PROCESS_DIV_FLOAT_LEFT 0x0400
#define PIKCHR_PROCESS_DIV_FLOAT_RIGHT 0x0800
#define PIKCHR_PROCESS_DIV_TOGGLE 0x1000
#define PIKCHR_PROCESS_DIV_SOURCE 0x2000
#define PIKCHR_PROCESS_DIV_SOURCE_INLINE 0x4000
#endif
/*
** Processes a pikchr script, optionally with embedded TH1, and
** produces HTML code for it. zIn is the NUL-terminated input
** script. pikFlags may be a bitmask of any of the PIKCHR_PROCESS_xxx
** flags documented below. thFlags may be a bitmask of any of the
** TH_INIT_xxx and/or TH_R2B_xxx flags. Output is sent to pOut,
** appending to it without modifying any prior contents.
**
** Returns 0 on success, 1 if TH1 processing failed, or 2 if pikchr
** processing failed. In either case, the error message (if any) from
** TH1 or pikchr will be appended to pOut.
**
** pikFlags flag descriptions:
**
** - PIKCHR_PROCESS_TH1 means to run zIn through TH1, using the TH1
** init flags specified in the 3rd argument. If thFlags is non-0 then
** this flag is assumed even if it is not specified.
**
** - PIKCHR_PROCESS_TH1_NOSVG means that processing stops after the
** TH1 eval step, thus the output will be (presumably) a
** TH1-generated/processed pikchr script (or whatever else the TH1
** outputs). If this flag is set, PIKCHR_PROCESS_TH1 is assumed even
** if it is not specified.
**
** All of the remaining flags listed below are ignored if
** PIKCHR_PROCESS_TH1_NOSVG is specified!
**
** - PIKCHR_PROCESS_DIV: if set, the SVG result is wrapped in a DIV
** element which specifies a max-width style value based on the SVG's
** calculated size. This flag has multiple mutually exclusive forms:
**
** - PIKCHR_PROCESS_DIV uses default element alignment.
** - PIKCHR_PROCESS_DIV_INDENT indents the div.
** - PIKCHR_PROCESS_DIV_CENTER centers the div.
|
<
<
<
|
|
<
<
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
|
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
53
54
55
56
57
58
59
60
61
62
|
#if INTERFACE
/* These are described in pikchr_process()'s docs. */
/* The first two must match the values from pikchr.c */
#define PIKCHR_PROCESS_PLAINTEXT_ERRORS 0x0001
#define PIKCHR_PROCESS_DARK_MODE 0x0002
/* end of flags supported directly by pikchr() */
#define PIKCHR_PROCESS_PASSTHROUGH 0x0003 /* Pass through these flags */
#define PIKCHR_PROCESS_NONCE 0x0010
#define PIKCHR_PROCESS_ERR_PRE 0x0020
#define PIKCHR_PROCESS_SRC 0x0040
#define PIKCHR_PROCESS_DIV 0x0080
#define PIKCHR_PROCESS_DIV_INDENT 0x0100
#define PIKCHR_PROCESS_DIV_CENTER 0x0200
#define PIKCHR_PROCESS_DIV_FLOAT_LEFT 0x0400
#define PIKCHR_PROCESS_DIV_FLOAT_RIGHT 0x0800
#define PIKCHR_PROCESS_DIV_TOGGLE 0x1000
#define PIKCHR_PROCESS_DIV_SOURCE 0x2000
#define PIKCHR_PROCESS_DIV_SOURCE_INLINE 0x4000
#endif
/*
** Processes a pikchr script. zIn is the NUL-terminated input
** script. pikFlags may be a bitmask of any of the PIKCHR_PROCESS_xxx
** flags documented below. Output is sent to pOut,
**
** Returns 0 on success, or non-zero if pikchr processing failed.
** In either case, the error message (if any) from pikchr will be
** appended to pOut.
**
** pikFlags flag descriptions:
**
** - PIKCHR_PROCESS_DIV: if set, the SVG result is wrapped in a DIV
** element which specifies a max-width style value based on the SVG's
** calculated size. This flag has multiple mutually exclusive forms:
**
** - PIKCHR_PROCESS_DIV uses default element alignment.
** - PIKCHR_PROCESS_DIV_INDENT indents the div.
** - PIKCHR_PROCESS_DIV_CENTER centers the div.
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
** PIKCHR_PROCESS_DIV_SOURCE or PIKCHR_PROCESS_DIV_SOURCE_INLINE is
** set, this flag is automatically implied.
**
** - PIKCHR_PROCESS_ERR_PRE: if set and pikchr() fails, the resulting
** error report is wrapped in a PRE element, else it is retained
** as-is (intended only for console output).
*/
int pikchr_process(const char * zIn, int pikFlags, int thFlags,
Blob * pOut){
Blob bIn = empty_blob;
int isErr = 0;
const char *zNonce = (PIKCHR_PROCESS_NONCE & pikFlags)
? safe_html_nonce(1) : 0;
if(!(PIKCHR_PROCESS_DIV & pikFlags)
/* If any DIV_xxx flags are set, set DIV */
&& (PIKCHR_PROCESS_DIV_INDENT
| PIKCHR_PROCESS_DIV_CENTER
| PIKCHR_PROCESS_DIV_FLOAT_RIGHT
| PIKCHR_PROCESS_DIV_FLOAT_LEFT
| PIKCHR_PROCESS_DIV_SOURCE
| PIKCHR_PROCESS_DIV_SOURCE_INLINE
| PIKCHR_PROCESS_DIV_TOGGLE
) & pikFlags){
pikFlags |= PIKCHR_PROCESS_DIV;
}
if(!(PIKCHR_PROCESS_TH1 & pikFlags)
/* If any TH1_xxx flags are set, set TH1 */
&& (PIKCHR_PROCESS_TH1_NOSVG & pikFlags || thFlags!=0)){
pikFlags |= PIKCHR_PROCESS_TH1;
}
if(zNonce){
blob_appendf(pOut, "%s\n", zNonce);
}
if(PIKCHR_PROCESS_TH1 & pikFlags){
Blob out = empty_blob;
isErr = Th_RenderToBlob(zIn, &out, thFlags)
? 1 : 0;
if(isErr){
blob_append(pOut, blob_str(&out), blob_size(&out));
blob_reset(&out);
}else{
bIn = out;
}
}else{
blob_init(&bIn, zIn, -1);
}
if(!isErr){
if(PIKCHR_PROCESS_TH1_NOSVG & pikFlags){
blob_append(pOut, blob_str(&bIn), blob_size(&bIn));
}else{
int w = 0, h = 0;
const char * zContent = blob_str(&bIn);
char *zOut;
zOut = pikchr(zContent, "pikchr",
0x01 | (pikFlags&PIKCHR_PROCESS_PASSTHROUGH),
&w, &h);
if( w>0 && h>0 ){
const char * zClassToggle = "";
const char * zClassSource = "";
const char * zWrapperClass = "";
if(PIKCHR_PROCESS_DIV & pikFlags){
if(PIKCHR_PROCESS_DIV_CENTER & pikFlags){
zWrapperClass = " center";
}else if(PIKCHR_PROCESS_DIV_INDENT & pikFlags){
zWrapperClass = " indent";
}else if(PIKCHR_PROCESS_DIV_FLOAT_LEFT & pikFlags){
zWrapperClass = " float-left";
}else if(PIKCHR_PROCESS_DIV_FLOAT_RIGHT & pikFlags){
zWrapperClass = " float-right";
}
if(PIKCHR_PROCESS_DIV_TOGGLE & pikFlags){
zClassToggle = " toggle";
}
if(PIKCHR_PROCESS_DIV_SOURCE_INLINE & pikFlags){
if(PIKCHR_PROCESS_DIV_SOURCE & pikFlags){
zClassSource = " source source-inline";
}else{
zClassSource = " source-inline";
}
pikFlags |= PIKCHR_PROCESS_SRC;
}else if(PIKCHR_PROCESS_DIV_SOURCE & pikFlags){
zClassSource = " source";
pikFlags |= PIKCHR_PROCESS_SRC;
}
blob_appendf(pOut,"<div class='pikchr-wrapper"
"%s%s%s'>"
"<div class=\"pikchr-svg\" "
"style=\"max-width:%dpx\">\n",
zWrapperClass/*safe-for-%s*/,
zClassToggle/*safe-for-%s*/,
zClassSource/*safe-for-%s*/, w);
}
blob_append(pOut, zOut, -1);
if(PIKCHR_PROCESS_DIV & pikFlags){
blob_append(pOut, "</div>\n", 7);
}
if(PIKCHR_PROCESS_SRC & pikFlags){
static int counter = 0;
++counter;
blob_appendf(pOut, "<div class='pikchr-src'>"
"<pre id='pikchr-src-%d'>%h</pre>"
"<span class='hidden'>"
"<a href='%R/pikchrshow?fromSession' "
"class='pikchr-src-pikchrshow' target='_new-%d' "
"data-pikchrid='pikchr-src-%d' "
"title='Open this pikchr in /pikchrshow'"
">→ /pikchrshow</a></span>"
"</div>\n",
counter, blob_str(&bIn), counter, counter);
}
if(PIKCHR_PROCESS_DIV & pikFlags){
blob_append(pOut, "</div>\n", 7);
}
}else{
isErr = 2;
if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
blob_append(pOut, "<pre class='error'>\n", 20);
}
blob_appendf(pOut, "%h", zOut);
if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
blob_append(pOut, "\n</pre>\n", 8);
}
}
fossil_free(zOut);
}
}
if(zNonce){
blob_appendf(pOut, "%s\n", zNonce);
}
blob_reset(&bIn);
return isErr;
}
/*
** Legacy impl of /pikchrshow. pikchrshow_page() will delegate to
** this one if the "legacy" or "ajax" request arguments are set.
**
|
|
<
<
>
>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
<
|
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
** PIKCHR_PROCESS_DIV_SOURCE or PIKCHR_PROCESS_DIV_SOURCE_INLINE is
** set, this flag is automatically implied.
**
** - PIKCHR_PROCESS_ERR_PRE: if set and pikchr() fails, the resulting
** error report is wrapped in a PRE element, else it is retained
** as-is (intended only for console output).
*/
int pikchr_process(const char *zIn, int pikFlags, Blob * pOut){
int isErr = 0;
int w = 0, h = 0;
char *zOut;
const char *zNonce = (PIKCHR_PROCESS_NONCE & pikFlags)
? safe_html_nonce(1) : 0;
if(!(PIKCHR_PROCESS_DIV & pikFlags)
/* If any DIV_xxx flags are set, set DIV */
&& (PIKCHR_PROCESS_DIV_INDENT
| PIKCHR_PROCESS_DIV_CENTER
| PIKCHR_PROCESS_DIV_FLOAT_RIGHT
| PIKCHR_PROCESS_DIV_FLOAT_LEFT
| PIKCHR_PROCESS_DIV_SOURCE
| PIKCHR_PROCESS_DIV_SOURCE_INLINE
| PIKCHR_PROCESS_DIV_TOGGLE
) & pikFlags){
pikFlags |= PIKCHR_PROCESS_DIV;
}
if(zNonce){
blob_appendf(pOut, "%s\n", zNonce);
}
zOut = pikchr(zIn, "pikchr",
0x01 | (pikFlags&PIKCHR_PROCESS_PASSTHROUGH),
&w, &h);
if( w>0 && h>0 ){
const char * zClassToggle = "";
const char * zClassSource = "";
const char * zWrapperClass = "";
if(PIKCHR_PROCESS_DIV & pikFlags){
if(PIKCHR_PROCESS_DIV_CENTER & pikFlags){
zWrapperClass = " center";
}else if(PIKCHR_PROCESS_DIV_INDENT & pikFlags){
zWrapperClass = " indent";
}else if(PIKCHR_PROCESS_DIV_FLOAT_LEFT & pikFlags){
zWrapperClass = " float-left";
}else if(PIKCHR_PROCESS_DIV_FLOAT_RIGHT & pikFlags){
zWrapperClass = " float-right";
}
if(PIKCHR_PROCESS_DIV_TOGGLE & pikFlags){
zClassToggle = " toggle";
}
if(PIKCHR_PROCESS_DIV_SOURCE_INLINE & pikFlags){
if(PIKCHR_PROCESS_DIV_SOURCE & pikFlags){
zClassSource = " source source-inline";
}else{
zClassSource = " source-inline";
}
pikFlags |= PIKCHR_PROCESS_SRC;
}else if(PIKCHR_PROCESS_DIV_SOURCE & pikFlags){
zClassSource = " source";
pikFlags |= PIKCHR_PROCESS_SRC;
}
blob_appendf(pOut,"<div class='pikchr-wrapper"
"%s%s%s'>"
"<div class=\"pikchr-svg\" "
"style=\"max-width:%dpx\">\n",
zWrapperClass/*safe-for-%s*/,
zClassToggle/*safe-for-%s*/,
zClassSource/*safe-for-%s*/, w);
}
blob_append(pOut, zOut, -1);
if(PIKCHR_PROCESS_DIV & pikFlags){
blob_append(pOut, "</div>\n", 7);
}
if(PIKCHR_PROCESS_SRC & pikFlags){
static int counter = 0;
++counter;
blob_appendf(pOut, "<div class='pikchr-src'>"
"<pre id='pikchr-src-%d'>%h</pre>"
"<span class='hidden'>"
"<a href='%R/pikchrshow?fromSession' "
"class='pikchr-src-pikchrshow' target='_new-%d' "
"data-pikchrid='pikchr-src-%d' "
"title='Open this pikchr in /pikchrshow'"
">→ /pikchrshow</a></span>"
"</div>\n",
counter, zIn, counter, counter);
}
if(PIKCHR_PROCESS_DIV & pikFlags){
blob_append(pOut, "</div>\n", 7);
}
}else{
isErr = 2;
if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
blob_append(pOut, "<pre class='error'>\n", 20);
}
blob_appendf(pOut, "%h", zOut);
if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
blob_append(pOut, "\n</pre>\n", 8);
}
}
fossil_free(zOut);
if(zNonce){
blob_appendf(pOut, "%s\n", zNonce);
}
return isErr;
}
/*
** Legacy impl of /pikchrshow. pikchrshow_page() will delegate to
** this one if the "legacy" or "ajax" request arguments are set.
**
|
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
if(P("ajax")!=0){
/* Called from the JS-side preview updater.
TODO: respond with JSON instead.*/
cgi_set_content_type("text/html");
if(zContent && *zContent){
Blob out = empty_blob;
const int isErr =
pikchr_process(zContent, pikFlags, 0, &out);
if(isErr){
cgi_printf_header("x-pikchrshow-is-error: %d\r\n", isErr);
}
CX("%b", &out);
blob_reset(&out);
}else{
CX("<pre>No content! Nothing to render</pre>");
|
|
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
if(P("ajax")!=0){
/* Called from the JS-side preview updater.
TODO: respond with JSON instead.*/
cgi_set_content_type("text/html");
if(zContent && *zContent){
Blob out = empty_blob;
const int isErr =
pikchr_process(zContent, pikFlags, &out);
if(isErr){
cgi_printf_header("x-pikchrshow-is-error: %d\r\n", isErr);
}
CX("%b", &out);
blob_reset(&out);
}else{
CX("<pre>No content! Nothing to render</pre>");
|
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
CX("<fieldset id='pikchrshow-output-wrapper'>"); {
CX("<legend></legend>"
/* Reminder: Firefox does not properly flexbox a LEGEND
element, always flowing it in column mode. */);
CX("<div id='pikchrshow-output'>");
if(*zContent){
Blob out = empty_blob;
pikchr_process(zContent, pikFlags, 0, &out);
CX("%b", &out);
blob_reset(&out);
} CX("</div>"/*#pikchrshow-output*/);
} CX("</fieldset>"/*#pikchrshow-output-wrapper*/);
} CX("</div>"/*sbs-wrapper*/);
builtin_fossil_js_bundle_or("fetch", "copybutton", "popupwidget",
"storage", "pikchr", NULL);
|
|
|
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
CX("<fieldset id='pikchrshow-output-wrapper'>"); {
CX("<legend></legend>"
/* Reminder: Firefox does not properly flexbox a LEGEND
element, always flowing it in column mode. */);
CX("<div id='pikchrshow-output'>");
if(*zContent){
Blob out = empty_blob;
pikchr_process(zContent, pikFlags, &out);
CX("%b", &out);
blob_reset(&out);
} CX("</div>"/*#pikchrshow-output*/);
} CX("</fieldset>"/*#pikchrshow-output-wrapper*/);
} CX("</div>"/*sbs-wrapper*/);
builtin_fossil_js_bundle_or("fetch", "copybutton", "popupwidget",
"storage", "pikchr", NULL);
|
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
|
** -div-source Set the 'source' CSS class on the div, which tells
** CSS to hide the SVG and reveal the source by default.
**
** -src Store the input pikchr's source code in the output as
** a separate element adjacent to the SVG one. Implied
** by -div-source.
**
**
** -th Process the input using TH1 before passing it to pikchr
**
** -th-novar Disable $var and $<var> TH1 processing. Use this if the
** pikchr script uses '$' for its own purposes and that
** causes issues. This only affects parsing of '$' outside
** of TH1 script blocks. Code in such blocks is unaffected.
**
** -th-nosvg When using -th, output the post-TH1'd script
** instead of the pikchr-rendered output
**
** -th-trace Trace TH1 execution (for debugging purposes)
**
** -dark Change pikchr colors to assume a dark-mode theme.
**
**
** The -div-indent/center/left/right flags may not be combined.
**
** TH1-related Notes and Caveats:
**
** If the -th flag is used, this command must open a fossil database
** for certain functionality to work (via a check-out or the -R REPO
** flag). If opening a db fails, execution will continue but any TH1
** commands which require a db will trigger a fatal error.
**
** In Fossil skins, TH1 variables in the form $varName are expanded
** as-is and those in the form $<varName> are htmlized in the
** resulting output. This processor disables the htmlizing step, so $x
** and $<x> are equivalent unless the TH1-processed pikchr script
** invokes the TH1 command [enable_htmlify 1] to enable it. Normally
** that option will interfere with pikchr output, however, e.g. by
** HTML-encoding double-quotes.
**
** Many of the fossil-installed TH1 functions simply do not make any
** sense for pikchr scripts.
*/
void pikchr_cmd(void){
Blob bIn = empty_blob;
Blob bOut = empty_blob;
const char * zInfile = "-";
const char * zOutfile = "-";
const int fTh1 = find_option("th",0,0)!=0;
const int fNosvg = find_option("th-nosvg",0,0)!=0;
int isErr = 0;
int pikFlags = find_option("src",0,0)!=0
? PIKCHR_PROCESS_SRC : 0;
u32 fThFlags = TH_INIT_NO_ENCODE
| (find_option("th-novar",0,0)!=0 ? TH_R2B_NO_VARS : 0);
Th_InitTraceLog()/*processes -th-trace flag*/;
if(find_option("div",0,0)!=0){
pikFlags |= PIKCHR_PROCESS_DIV;
}else if(find_option("div-indent",0,0)!=0){
pikFlags |= PIKCHR_PROCESS_DIV_INDENT;
}else if(find_option("div-center",0,0)!=0){
pikFlags |= PIKCHR_PROCESS_DIV_CENTER;
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
|
** -div-source Set the 'source' CSS class on the div, which tells
** CSS to hide the SVG and reveal the source by default.
**
** -src Store the input pikchr's source code in the output as
** a separate element adjacent to the SVG one. Implied
** by -div-source.
**
** -dark Change pikchr colors to assume a dark-mode theme.
**
**
** The -div-indent/center/left/right flags may not be combined.
*/
void pikchr_cmd(void){
Blob bIn = empty_blob;
Blob bOut = empty_blob;
const char * zInfile = "-";
const char * zOutfile = "-";
int isErr = 0;
int pikFlags = find_option("src",0,0)!=0
? PIKCHR_PROCESS_SRC : 0;
if(find_option("div",0,0)!=0){
pikFlags |= PIKCHR_PROCESS_DIV;
}else if(find_option("div-indent",0,0)!=0){
pikFlags |= PIKCHR_PROCESS_DIV_INDENT;
}else if(find_option("div-center",0,0)!=0){
pikFlags |= PIKCHR_PROCESS_DIV_CENTER;
|
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
if(g.argc>2){
zInfile = g.argv[2];
}
if(g.argc>3){
zOutfile = g.argv[3];
}
blob_read_from_file(&bIn, zInfile, ExtFILE);
if(fTh1){
db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0)
/* ^^^ needed for certain TH1 functions to work */;
pikFlags |= PIKCHR_PROCESS_TH1;
if(fNosvg) pikFlags |= PIKCHR_PROCESS_TH1_NOSVG;
}
isErr = pikchr_process(blob_str(&bIn), pikFlags,
fTh1 ? fThFlags : 0, &bOut);
if(isErr){
fossil_fatal("%s ERROR:%c%b", 1==isErr ? "TH1" : "pikchr",
1==isErr ? ' ' : '\n',
&bOut);
}else{
blob_write_to_file(&bOut, zOutfile);
}
Th_PrintTraceLog();
blob_reset(&bIn);
blob_reset(&bOut);
}
|
<
<
<
<
<
<
|
<
<
<
|
<
|
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
|
if(g.argc>2){
zInfile = g.argv[2];
}
if(g.argc>3){
zOutfile = g.argv[3];
}
blob_read_from_file(&bIn, zInfile, ExtFILE);
isErr = pikchr_process(blob_str(&bIn), pikFlags, &bOut);
if(isErr){
fossil_fatal("pikchr ERROR: %b", &bOut);
}else{
blob_write_to_file(&bOut, zOutfile);
}
blob_reset(&bIn);
blob_reset(&bOut);
}
|