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
|
** resulting SVG output which limits its max-width.
**
** -th Process the input using TH1 before passing it to pikchr.
**
** -th-novar Disable $var and $<var> TH1 processing. Only applies
** with the -th flag.
**
** -th-nopic When using -th, output the post-TH1'd script
** instead of the pikchr-rendered output.
**
** -th-trace Trace TH1 execution (for debugging purposes)
**
** TH1 Caveats: the built-in TH1 commands make some assumptions about
** HTML escaping and output which do not apply via this
** command. e.g. some commands will output directly to stdout, rather
** than the output buffer this command requires. Improvements in that
** regard are under consideration/construction.
*/
void pikchr_cmd(void){
Blob bIn = empty_blob;
Blob bOut = empty_blob;
const char * zInfile = "-";
const char * zOutfile = "-";
const int fWithDiv = find_option("div",0,0)!=0;
const int fTh1 = find_option("th",0,0)!=0;
const int fNoPic = find_option("th-nopic",0,0)!=0;
int isErr = 0;
u32 fThFlags = TH_INIT_DEFAULT/* | TH_INIT_NO_ESC*/
| (find_option("th-novar",0,0)!=0 ? TH_R2B_NO_VARS : 0);
Th_InitTraceLog()/*processes -th-trace flag*/;
verify_all_options();
if(g.argc>4){
|
|
|
|
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
|
** resulting SVG output which limits its max-width.
**
** -th Process the input using TH1 before passing it to pikchr.
**
** -th-novar Disable $var and $<var> TH1 processing. Only applies
** with the -th flag.
**
** -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)
**
** TH1 Caveats: the built-in TH1 commands make some assumptions about
** HTML escaping and output which do not apply via this
** command. e.g. some commands will output directly to stdout, rather
** than the output buffer this command requires. Improvements in that
** regard are under consideration/construction.
*/
void pikchr_cmd(void){
Blob bIn = empty_blob;
Blob bOut = empty_blob;
const char * zInfile = "-";
const char * zOutfile = "-";
const int fWithDiv = find_option("div",0,0)!=0;
const int fTh1 = find_option("th",0,0)!=0;
const int fNosvg = find_option("th-nosvg",0,0)!=0;
int isErr = 0;
u32 fThFlags = TH_INIT_DEFAULT/* | TH_INIT_NO_ESC*/
| (find_option("th-novar",0,0)!=0 ? TH_R2B_NO_VARS : 0);
Th_InitTraceLog()/*processes -th-trace flag*/;
verify_all_options();
if(g.argc>4){
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
bOut = out;
}else{
blob_reset(&bIn);
bIn = out;
}
}
if(!isErr){
if(fTh1 && fNoPic){
bOut = bIn;
bIn = empty_blob;
}else{
int w = 0, h = 0;
const char * zContent = blob_str(&bIn);
char *zOut;
|
|
>
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
bOut = out;
}else{
blob_reset(&bIn);
bIn = out;
}
}
if(!isErr){
if(fTh1 && fNosvg){
assert(0==blob_size(&bOut));
bOut = bIn;
bIn = empty_blob;
}else{
int w = 0, h = 0;
const char * zContent = blob_str(&bIn);
char *zOut;
|