1 /* -------------------------------------------------------------------
2 xldlas -- A Stastics Package
3
4 Copyright (C) 1996 Thor Sigvaldason
5
6 Handles the echoing of on-screen output to user-specified log and
7 texlog files
8
9 -------------------------------------------------------------------*/
10
11 #include "xldlas.h"
12
13 extern void inhibit_input();
14 extern void reenable_input();
15 extern void say_status(char the_status[XLDLASMAX_INPUT]);
16 extern void do_system_call(char the_command[XLDLASMAX_INPUT]);
17
filter_tex_specials(char input_string[XLDLASMAX_INPUT])18 void filter_tex_specials(char input_string[XLDLASMAX_INPUT])
19 {
20 int i;
21 int no_filter;
22 int place;
23 place = 0;
24 strcpy(filtered_tex_string,"");
25 for(i = 0; i < strlen(input_string); i++)
26 {
27 no_filter = TRUE;
28 if(input_string[i] == '$')
29 {
30 no_filter = FALSE;
31 filtered_tex_string[place] = '\\';
32 place++;
33 filtered_tex_string[place] = '$';
34 place++;
35 }
36 if(input_string[i] == '%')
37 {
38 no_filter = FALSE;
39 filtered_tex_string[place] = '\\';
40 place++;
41 filtered_tex_string[place] = '%';
42 place++;
43 }
44 if(input_string[i] == '&')
45 {
46 no_filter = FALSE;
47 filtered_tex_string[place] = '\\';
48 place++;
49 filtered_tex_string[place] = '&';
50 place++;
51 }
52 if(input_string[i] == '#')
53 {
54 no_filter = FALSE;
55 filtered_tex_string[place] = '\\';
56 place++;
57 filtered_tex_string[place] = '#';
58 place++;
59 }
60 if(input_string[i] == '_')
61 {
62 no_filter = FALSE;
63 filtered_tex_string[place] = '\\';
64 place++;
65 filtered_tex_string[place] = '_';
66 place++;
67 }
68 if(no_filter == TRUE)
69 {
70 filtered_tex_string[place] = input_string[i];
71 place++;
72 }
73 }
74 filtered_tex_string[place] = '\0';
75 }
76
click_end_viewfile(FL_FORM * form,void * arg)77 int click_end_viewfile(FL_FORM *form, void *arg)
78 {
79 say_status("Ready");
80 return(FL_OK);
81 }
82
end_viewfile(FL_OBJECT * obj,long arg)83 void end_viewfile(FL_OBJECT *obj, long arg)
84 {
85 say_status("Ready");
86 fl_hide_form(viewfile_window);
87 }
88
view_a_file(char the_file[XLDLASMAX_INPUT])89 void view_a_file(char the_file[XLDLASMAX_INPUT])
90 {
91 say_status("Viewing File");
92 fl_clear_browser(viewfile_browser);
93 fl_load_browser(viewfile_browser,the_file);
94 fl_show_form(viewfile_window,FL_PLACE_FREE,FL_TRANSIENT,the_file);
95 }
96
print_a_file(char the_file[XLDLASMAX_INPUT])97 void print_a_file(char the_file[XLDLASMAX_INPUT])
98 {
99 char string_one[XLDLASMAX_INPUT];
100 say_status("Printing File");
101 sprintf(string_one,"%s %s",print_command, the_file);
102 do_system_call(string_one);
103 say_status("Ready");
104 }
105
dvi_a_file(char the_file[XLDLASMAX_INPUT])106 void dvi_a_file(char the_file[XLDLASMAX_INPUT])
107 {
108 char string_one[XLDLASMAX_INPUT];
109 char one_character;
110 FILE *original_file;
111 FILE *working_file;
112 say_status("Preview a TeXLog file ...");
113 original_file = fopen(the_file,"r");
114 working_file = fopen("xldlas_temp.tex","w");
115 while(!feof(original_file))
116 {
117 fscanf(original_file,"%c",&one_character);
118 fprintf(working_file,"%c",one_character);
119 }
120 fprintf(working_file,"\n\n\\bye");
121 fclose(original_file);
122 fclose(working_file);
123 sprintf(string_one, "%s xldlas_temp.tex ; %s xldlas_temp.dvi ; rm xldlas_temp.tex ; rm xldlas_temp.log ; rm xldlas_temp.dvi ", tex_command, dviview_command);
124 do_system_call(string_one);
125 say_status("Configuring TeXLog");
126 }
127
texprint_a_file(char the_file[XLDLASMAX_INPUT])128 void texprint_a_file(char the_file[XLDLASMAX_INPUT])
129 {
130 char string_one[XLDLASMAX_INPUT];
131 char one_character;
132 FILE *original_file;
133 FILE *working_file;
134 say_status("Preview a TeXLog file ...");
135 original_file = fopen(the_file,"r");
136 working_file = fopen("xldlas_temp.tex","w");
137 while(!feof(original_file))
138 {
139 fscanf(original_file,"%c",&one_character);
140 fprintf(working_file,"%c",one_character);
141 }
142 fprintf(working_file,"\n\n\\bye");
143 fclose(original_file);
144 fclose(working_file);
145 sprintf(string_one, "%s xldlas_temp.tex ; %s xldlas_temp.dvi ; rm xldlas_temp.tex ; rm xldlas_temp.log ; rm xldlas_temp.dvi ", tex_command, dviprint_command);
146 do_system_call(string_one);
147 say_status("Configuring TeXLog");
148 }
149
150
click_done_logtexlog(FL_FORM * form,void * arg)151 int click_done_logtexlog(FL_FORM *form, void *arg)
152 {
153 reenable_input();
154 say_status("Ready");
155 return(FL_OK);
156 }
157
log_init_output()158 void log_init_output()
159 {
160 time_t timeval;
161 (void)time(&timeval);
162 fprintf(log_file,"#\n#This file was created/appended by xldlas v%d.%d on %s#\n", XLDLAS_MAJOR, XLDLAS_MINOR, ctime(&timeval));
163 }
164
htmllog_init_output()165 void htmllog_init_output()
166 {
167 time_t timeval;
168 (void)time(&timeval);
169 fprintf(htmllog_file,"<P> This file was created/appended by xldlas v%d.%d on %s </P>\n", XLDLAS_MAJOR, XLDLAS_MINOR, ctime(&timeval));
170 }
171
texlog_init_output()172 void texlog_init_output()
173 {
174 time_t timeval;
175 (void)time(&timeval);
176 fprintf(texlog_file,"%%\n%%This file was created/appended by xldlas v%d.%d on %s%%\n", XLDLAS_MAJOR, XLDLAS_MINOR, ctime(&timeval));
177 fprintf(texlog_file,"%s\n", tex_preamble);
178 }
179
set_texlog_inhibits()180 void set_texlog_inhibits()
181 {
182 if(strlen(texlog_name) < 1)
183 {
184 fl_set_input(texlog_file_input,"");
185 fl_set_button(texlog_on_button, 0);
186 fl_deactivate_object(texlog_on_button);
187 fl_set_object_lcol(texlog_on_button,FL_INACTIVE);
188 fl_set_button(texlog_verbose_button, texlog_verbose_on);
189 fl_deactivate_object(texlog_verbose_button);
190 fl_set_object_lcol(texlog_verbose_button,FL_INACTIVE);
191 fl_deactivate_object(texlog_source_button);
192 fl_set_object_lcol(texlog_source_button,FL_INACTIVE);
193 fl_deactivate_object(texlog_dvi_button);
194 fl_set_object_lcol(texlog_dvi_button,FL_INACTIVE);
195 fl_deactivate_object(texlog_print_button);
196 fl_set_object_lcol(texlog_print_button,FL_INACTIVE);
197 }
198 else
199 {
200 fl_set_input(texlog_file_input,texlog_name);
201 fl_set_button(texlog_on_button, texlog_on);
202 fl_activate_object(texlog_on_button);
203 fl_set_object_lcol(texlog_on_button,FL_BLACK);
204 fl_set_button(texlog_verbose_button, texlog_verbose_on);
205 fl_activate_object(texlog_verbose_button);
206 fl_set_object_lcol(texlog_verbose_button,FL_BLACK);
207 fl_activate_object(texlog_source_button);
208 fl_set_object_lcol(texlog_source_button,FL_BLACK);
209 fl_activate_object(texlog_dvi_button);
210 fl_set_object_lcol(texlog_dvi_button,FL_BLACK);
211 fl_activate_object(texlog_print_button);
212 fl_set_object_lcol(texlog_print_button,FL_BLACK);
213 }
214 }
215
set_log_inhibits()216 void set_log_inhibits()
217 {
218 if(strlen(log_name) < 1)
219 {
220 fl_set_input(log_file_input,"");
221 fl_set_button(log_on_button, 0);
222 fl_deactivate_object(log_on_button);
223 fl_set_object_lcol(log_on_button,FL_INACTIVE);
224 fl_set_button(log_verbose_button, log_verbose_on);
225 fl_deactivate_object(log_verbose_button);
226 fl_set_object_lcol(log_verbose_button,FL_INACTIVE);
227 fl_deactivate_object(log_view_button);
228 fl_set_object_lcol(log_view_button,FL_INACTIVE);
229 fl_deactivate_object(log_print_button);
230 fl_set_object_lcol(log_print_button,FL_INACTIVE);
231 }
232 else
233 {
234 fl_set_input(log_file_input,log_name);
235 fl_set_button(log_on_button, log_on);
236 fl_activate_object(log_on_button);
237 fl_set_object_lcol(log_on_button,FL_BLACK);
238 fl_set_button(log_verbose_button, log_verbose_on);
239 fl_activate_object(log_verbose_button);
240 fl_set_object_lcol(log_verbose_button,FL_BLACK);
241 fl_activate_object(log_view_button);
242 fl_set_object_lcol(log_view_button,FL_BLACK);
243 fl_activate_object(log_print_button);
244 fl_set_object_lcol(log_print_button,FL_BLACK);
245 }
246 }
247
set_htmllog_inhibits()248 void set_htmllog_inhibits()
249 {
250 if(strlen(htmllog_name) < 1)
251 {
252 fl_set_input(htmllog_file_input,"");
253 fl_set_button(htmllog_on_button, 0);
254 fl_deactivate_object(htmllog_on_button);
255 fl_set_object_lcol(htmllog_on_button,FL_INACTIVE);
256 fl_set_button(htmllog_verbose_button, htmllog_verbose_on);
257 fl_deactivate_object(htmllog_verbose_button);
258 fl_set_object_lcol(htmllog_verbose_button,FL_INACTIVE);
259 fl_deactivate_object(htmllog_view_button);
260 fl_set_object_lcol(htmllog_view_button,FL_INACTIVE);
261 }
262 else
263 {
264 fl_set_input(htmllog_file_input,htmllog_name);
265 fl_set_button(htmllog_on_button, htmllog_on);
266 fl_activate_object(htmllog_on_button);
267 fl_set_object_lcol(htmllog_on_button,FL_BLACK);
268 fl_set_button(htmllog_verbose_button, htmllog_verbose_on);
269 fl_activate_object(htmllog_verbose_button);
270 fl_set_object_lcol(htmllog_verbose_button,FL_BLACK);
271 fl_activate_object(htmllog_view_button);
272 fl_set_object_lcol(htmllog_view_button,FL_BLACK);
273 }
274 }
275
logtexlog_routines(FL_OBJECT * obj,long arg)276 void logtexlog_routines(FL_OBJECT *obj, long arg)
277 {
278 char string_one[XLDLASMAX_INPUT];
279 if(arg == 11)
280 {
281 if(fl_get_button(log_on_button) == TRUE) log_on = TRUE;
282 else log_on = FALSE;
283 return;
284 }
285 if(arg == 12)
286 {
287 if(fl_get_button(log_verbose_button) == TRUE) log_verbose_on = TRUE;
288 else log_verbose_on = FALSE;
289 return;
290 }
291 if(arg == 13)
292 {
293 strcpy(string_one,fl_get_input(log_file_input));
294 if(log_file)
295 {
296 fclose(log_file);
297 }
298 log_file = fopen(string_one,"a");
299 if(!log_file)
300 {
301 fl_show_alert("Sorry, could not open the requested file for writing","(Is it a legal file name?)","",TRUE);
302 return;
303 }
304 strcpy(log_name,string_one);
305 log_verbose_on = TRUE;
306 log_on = TRUE;
307 set_log_inhibits();
308 log_init_output();
309 return;
310 }
311 if(arg == 14)
312 {
313 fclose(log_file);
314 view_a_file(log_name);
315 log_file = fopen(log_name,"a");
316 return;
317 }
318 if(arg == 16)
319 {
320 fclose(log_file);
321 print_a_file(log_name);
322 log_file = fopen(log_name,"a");
323 return;
324 }
325 if(arg == 17)
326 {
327 strcpy(string_one,fl_get_input(log_file_input));
328 if(strlen(string_one) > 0 && strcmp(string_one,log_name) != 0)
329 {
330 if(log_file)
331 {
332 fclose(log_file);
333 }
334 log_file = fopen(string_one,"a");
335 if(!log_file)
336 {
337 fl_show_alert("Sorry, could not open the requested file for writing","(Is it a legal file name?)","",TRUE);
338 return;
339 }
340 strcpy(log_name,string_one);
341 log_verbose_on = TRUE;
342 log_on = TRUE;
343 set_log_inhibits();
344 log_init_output();
345 }
346 fl_hide_form(log_window);
347 say_status("Ready");
348 reenable_input();
349 return;
350 }
351 if(arg == 21)
352 {
353 if(fl_get_button(texlog_on_button) == TRUE) texlog_on = TRUE;
354 else texlog_on = FALSE;
355 return;
356 }
357 if(arg == 22)
358 {
359 if(fl_get_button(log_verbose_button) == TRUE) texlog_verbose_on = TRUE;
360 else texlog_verbose_on = FALSE;
361 return;
362 }
363 if(arg == 23)
364 {
365 strcpy(string_one,fl_get_input(texlog_file_input));
366 if(texlog_file)
367 {
368 fclose(texlog_file);
369 }
370 texlog_file = fopen(string_one,"a");
371 if(!texlog_file)
372 {
373 fl_show_alert("Sorry, could not open the requested file for writing","(Is it a legal file name?)","",TRUE);
374 return;
375 }
376 strcpy(texlog_name,string_one);
377 texlog_verbose_on = TRUE;
378 texlog_on = TRUE;
379 set_texlog_inhibits();
380 texlog_init_output();
381 return;
382 }
383 if(arg == 24)
384 {
385 fclose(texlog_file);
386 view_a_file(texlog_name);
387 texlog_file = fopen(texlog_name,"a");
388 return;
389 }
390 if(arg == 25)
391 {
392 fclose(texlog_file);
393 dvi_a_file(texlog_name);
394 texlog_file = fopen(texlog_name,"a");
395 return;
396 }
397 if(arg == 26)
398 {
399 fclose(texlog_file);
400 texprint_a_file(texlog_name);
401 texlog_file = fopen(texlog_name,"a");
402 return;
403 }
404 if(arg == 27)
405 {
406 strcpy(string_one,fl_get_input(texlog_file_input));
407 if(strlen(string_one) > 0 && strcmp(string_one,texlog_name) != 0)
408 {
409 if(texlog_file)
410 {
411 fclose(texlog_file);
412 }
413 texlog_file = fopen(string_one,"a");
414 if(!texlog_file)
415 {
416 fl_show_alert("Sorry, could not open the requested file for writing","(Is it a legal file name?)","",TRUE);
417 return;
418 }
419 strcpy(texlog_name,string_one);
420 texlog_verbose_on = TRUE;
421 texlog_on = TRUE;
422 set_texlog_inhibits();
423 texlog_init_output();
424 }
425 fl_hide_form(texlog_window);
426 say_status("Ready");
427 reenable_input();
428 return;
429 }
430 if(arg == 31)
431 {
432 if(fl_get_button(htmllog_on_button) == TRUE) htmllog_on = TRUE;
433 else htmllog_on = FALSE;
434 return;
435 }
436 if(arg == 32)
437 {
438 if(fl_get_button(htmllog_verbose_button) == TRUE) htmllog_verbose_on = TRUE;
439 else htmllog_verbose_on = FALSE;
440 return;
441 }
442 if(arg == 33)
443 {
444 strcpy(string_one,fl_get_input(htmllog_file_input));
445 if(htmllog_file)
446 {
447 fclose(htmllog_file);
448 }
449 htmllog_file = fopen(string_one,"a");
450 if(!htmllog_file)
451 {
452 fl_show_alert("Sorry, could not open the requested file for writing","(Is it a legal file name?)","",TRUE);
453 return;
454 }
455 strcpy(htmllog_name,string_one);
456 htmllog_verbose_on = TRUE;
457 htmllog_on = TRUE;
458 set_htmllog_inhibits();
459 htmllog_init_output();
460 return;
461 }
462 if(arg == 34)
463 {
464 fclose(htmllog_file);
465 view_a_file(htmllog_name);
466 htmllog_file = fopen(htmllog_name,"a");
467 return;
468 }
469 if(arg == 37)
470 {
471 strcpy(string_one,fl_get_input(htmllog_file_input));
472 if(strlen(string_one) > 0 && strcmp(string_one,htmllog_name) != 0)
473 {
474 if(htmllog_file)
475 {
476 fclose(htmllog_file);
477 }
478 htmllog_file = fopen(string_one,"a");
479 if(!htmllog_file)
480 {
481 fl_show_alert("Sorry, could not open the requested file for writing","(Is it a legal file name?)","",TRUE);
482 return;
483 }
484 strcpy(htmllog_name,string_one);
485 htmllog_verbose_on = TRUE;
486 htmllog_on = TRUE;
487 set_htmllog_inhibits();
488 htmllog_init_output();
489 }
490 fl_hide_form(htmllog_window);
491 say_status("Ready");
492 reenable_input();
493 return;
494 }
495 }
496
497
start_log()498 void start_log()
499 {
500 inhibit_input();
501 say_status("Adjusting Log File Status");
502 set_log_inhibits();
503 fl_show_form(log_window,FL_PLACE_FREE,FL_TRANSIENT,"Log File Settings");
504 }
505
start_htmllog()506 void start_htmllog()
507 {
508 inhibit_input();
509 say_status("Adjusting HTML Log File Status");
510 set_htmllog_inhibits();
511 fl_show_form(htmllog_window,FL_PLACE_FREE,FL_TRANSIENT,"HTML Log File Settings");
512 }
513
start_texlog()514 void start_texlog()
515 {
516 inhibit_input();
517 say_status("Adjusting TeXLog File Status");
518 set_texlog_inhibits();
519 fl_show_form(texlog_window,FL_PLACE_FREE,FL_TRANSIENT,"TeXLog File Settings");
520 }
521
522
graph_output(char save_name[XLDLASMAX_INPUT],int the_xvar,int the_variables[],int how_many)523 void graph_output(char save_name[XLDLASMAX_INPUT], int the_xvar, int the_variables[], int how_many)
524 {
525 int i;
526 char string_one[XLDLASMAX_INPUT];
527 char string_two[XLDLASMAX_INPUT];
528 if(strlen(save_name) < 1)
529 {
530 sprintf(string_one,"plot>\tPlotted ");
531 for(i = 0; i < how_many; i++)
532 {
533 strcat(string_one, data_matrix[the_variables[i]].name);
534 if(i == how_many -1)
535 {
536 strcat(string_one," vs ");
537 }
538 else
539 {
540 strcat(string_one,", ");
541 }
542 }
543 strcat(string_one, data_matrix[the_xvar].name);
544 strcat(string_one," (not saved)");
545 fl_addto_browser(main_browser,string_one);
546 if(log_on == TRUE && log_verbose_on == TRUE)
547 {
548 fprintf(log_file,"%s\n", string_one);
549 }
550 if(texlog_on == TRUE && texlog_verbose_on == TRUE)
551 {
552 sprintf(string_two,"%%\t%s", string_one);
553 fprintf(texlog_file,"%s\n", string_two);
554 }
555 }
556 else
557 {
558 sprintf(string_one,"plot>\tPlotted ");
559 for(i = 0; i < how_many; i++)
560 {
561 strcat(string_one, data_matrix[the_variables[i]].name);
562 if(i == how_many -1)
563 {
564 strcat(string_one," vs ");
565 }
566 else
567 {
568 strcat(string_one,", ");
569 }
570 }
571 strcat(string_one, data_matrix[the_xvar].name);
572 strcat(string_one," (saved to ");
573 strcat(string_one,save_name);
574 strcat(string_one,")");
575 fl_addto_browser(main_browser,string_one);
576 if(log_on == TRUE && log_verbose_on == TRUE)
577 {
578 fprintf(log_file,"%s\n", string_one);
579 }
580 if(texlog_on == TRUE && strlen(tex_graphmacrol) > 0)
581 {
582 sprintf(string_one,"%s%s%s", tex_graphmacrol, save_name, tex_graphmacror);
583 fprintf(texlog_file,"%s\n", string_one);
584 }
585 if(texlog_on == TRUE && texlog_verbose_on == TRUE && strlen(tex_graphmacrol) < 1)
586 {
587 sprintf(string_two,"%%\t%s", string_one);
588 fprintf(texlog_file,"%s\n", string_two);
589 }
590 if(htmllog_on == TRUE)
591 {
592 sprintf(string_one," <CENTER> <IMG SRC=\"%s\"> </CENTER>", save_name);
593 fprintf(htmllog_file,"%s\n",string_one);
594 }
595 }
596 }
597
simple_line_output(char which_routine[XLDLASMAX_INPUT],char the_output[XLDLASMAX_INPUT])598 void simple_line_output(char which_routine[XLDLASMAX_INPUT], char the_output[XLDLASMAX_INPUT])
599 {
600 strcpy(line_of_output,which_routine);
601 strcat(line_of_output,">\t");
602 strcat(line_of_output,the_output);
603 fl_addto_browser(main_browser, line_of_output);
604 if(log_on == TRUE && log_verbose_on == TRUE)
605 {
606 fprintf(log_file,"%s\n",line_of_output);
607 }
608 if(texlog_on == TRUE && texlog_verbose_on == TRUE)
609 {
610 fprintf(texlog_file,"%%\t%s\n", line_of_output);
611 }
612 if(htmllog_on == TRUE && htmllog_verbose_on == TRUE)
613 {
614 fprintf(htmllog_file,"<P> %s\n</P>\n", line_of_output);
615 }
616 }
617
seperator_output(int how_many)618 void seperator_output(int how_many)
619 {
620 char string_one[XLDLASMAX_INPUT];
621 char string_two[XLDLASMAX_INPUT];
622 int i,j;
623 strcpy(string_one,"");
624 for(i = 0; i <= how_many; i++)
625 {
626 for(j = 0; j < NAME_LENGTH; j++)
627 {
628 strcat(string_one,"-");
629 }
630 }
631 strcpy(string_two, "@f@Stbl> ");
632 strcat(string_two, string_one);
633 fl_addto_browser(main_browser, string_two);
634 if(log_on == TRUE)
635 {
636 strcpy(string_two, "tbl> ");
637 strcat(string_two, string_one);
638 fprintf(log_file, string_two);
639 fprintf(log_file,"\n");
640 }
641 if(texlog_on == TRUE)
642 {
643 fprintf(texlog_file,"height2pt\n");
644 for(i = 0; i < how_many; i++)
645 {
646 fprintf(texlog_file,"&\\omit&");
647 }
648 fprintf(texlog_file,"\\cr\n");
649 fprintf(texlog_file,"\\noalign{\\hrule}");
650 fprintf(texlog_file,"height2pt\n");
651 for(i = 0; i < how_many; i++)
652 {
653 fprintf(texlog_file,"&\\omit&");
654 }
655 fprintf(texlog_file,"\\cr\n");
656 }
657 }
658
begin_table_output(int how_many,char title[XLDLASMAX_INPUT])659 void begin_table_output(int how_many, char title[XLDLASMAX_INPUT])
660 {
661 int i;
662 char string_one[XLDLASMAX_INPUT];
663 sprintf(string_one,"@f@Stbl> %s",title);
664 fl_addto_browser(main_browser," ");
665 fl_addto_browser(main_browser,string_one);
666 if(log_on == TRUE)
667 {
668 fprintf(log_file,"\n\n");
669 }
670 if(texlog_on == TRUE)
671 {
672 filter_tex_specials(title);
673 fprintf(texlog_file,"\n\n\\midinsert\n\n\\centerline{%s}\n\n\\bigskip\n\n",filtered_tex_string);
674 fprintf(texlog_file,"\n\n%%\n%% This table macro is taken from _The TeX Book_ ((C) 1992) pg. 246\n%%\n\n");
675 fprintf(texlog_file,"\n\n$$\n\\vbox{\\offinterlineskip\n\\hrule\n\\halign{&\\vrule#&\n\t\\strut\\quad\\hfil#\\quad\\cr\n");
676 fprintf(texlog_file,"height2pt\n");
677 for(i = 0; i < how_many; i++)
678 {
679 fprintf(texlog_file,"&\t\\omit\t&");
680 }
681 fprintf(texlog_file,"\\cr\n");
682 }
683 if(htmllog_on == TRUE)
684 {
685 fprintf(htmllog_file,"<CENTER> <TABLE BORDER=2 CELLPADDING=5> <CAPTION> %s </CAPTION>\n", title);
686 }
687 }
688
end_table_output(int how_many)689 void end_table_output(int how_many)
690 {
691 int i;
692 fl_addto_browser(main_browser," ");
693 if(log_on == TRUE)
694 {
695 fprintf(log_file,"\n\n");
696 }
697 if(texlog_on == TRUE)
698 {
699 fprintf(texlog_file,"height2pt\n");
700 for(i = 0; i < how_many; i++)
701 {
702 fprintf(texlog_file,"&\t\\omit\t&");
703 }
704 fprintf(texlog_file,"\\cr}\n\\hrule}\n$$\n\\endinsert\n\n");
705 }
706 if(htmllog_on == TRUE)
707 {
708 fprintf(htmllog_file,"</TABLE> </CENTER><BR>\n");
709 }
710 }
711
check_blanks(char the_string[XLDLASMAX_INPUT])712 int check_blanks(char the_string[XLDLASMAX_INPUT])
713 {
714 int i;
715 int all_blank;
716 all_blank = TRUE;
717 for(i = 0; i < strlen(the_string); i++)
718 {
719 if(the_string[i] != ' ')
720 {
721 all_blank = FALSE;
722 }
723 }
724 return(all_blank);
725 }
726
begin_column_output(char first_column[XLDLASMAX_INPUT],int justify)727 void begin_column_output(char first_column[XLDLASMAX_INPUT], int justify)
728 {
729 char html_output[XLDLASMAX_INPUT];
730 strcpy(line_of_output,"@f@Stbl> ");
731 strcat(line_of_output,first_column);
732 if(texlog_on == TRUE)
733 {
734 filter_tex_specials(first_column);
735 if(justify == XLDLAS_JUST_CENTER)
736 {
737 fprintf(texlog_file,"&\t\\hfill %s \\hfill\t&",filtered_tex_string);
738 }
739 if(justify == XLDLAS_JUST_RIGHT)
740 {
741 fprintf(texlog_file,"&\t\\hfill %s \t&",filtered_tex_string);
742 }
743 if(justify == XLDLAS_JUST_LEFT)
744 {
745 fprintf(texlog_file,"&\t %s \\hfill\t&",filtered_tex_string);
746 }
747 }
748 if(htmllog_on == TRUE)
749 {
750 if(check_blanks(first_column) == TRUE)
751 {
752 strcpy(html_output," ");
753 }
754 else
755 {
756 strcpy(html_output,first_column);
757 }
758 if(justify == XLDLAS_JUST_CENTER)
759 {
760 fprintf(htmllog_file,"<TR> <TD align=CENTER> %s \n", html_output);
761 }
762 if(justify == XLDLAS_JUST_RIGHT)
763 {
764 fprintf(htmllog_file,"<TR> <TD align=RIGHT> %s \n", html_output);
765 }
766 if(justify == XLDLAS_JUST_LEFT)
767 {
768 fprintf(htmllog_file,"<TR> <TD align=LEFT> %s \n", html_output);
769 }
770 }
771 }
772
add_column_output(char next_column[XLDLASMAX_INPUT],int justify)773 void add_column_output(char next_column[XLDLASMAX_INPUT], int justify)
774 {
775 char html_output[XLDLASMAX_INPUT];
776 strcat(line_of_output,next_column);
777 if(texlog_on == TRUE)
778 {
779 filter_tex_specials(next_column);
780 if(justify == XLDLAS_JUST_CENTER)
781 {
782 fprintf(texlog_file,"&\t\\hfill %s \\hfill\t&",filtered_tex_string);
783 }
784 if(justify == XLDLAS_JUST_RIGHT)
785 {
786 fprintf(texlog_file,"&\t\\hfill %s \t&",filtered_tex_string);
787 }
788 if(justify == XLDLAS_JUST_LEFT)
789 {
790 fprintf(texlog_file,"&\t %s \\hfill\t&",filtered_tex_string);
791 }
792 }
793 if(htmllog_on == TRUE)
794 {
795 if(check_blanks(next_column) == TRUE)
796 {
797 strcpy(html_output, " ");
798 }
799 else
800 {
801 strcpy(html_output, next_column);
802 }
803 if(justify == XLDLAS_JUST_CENTER)
804 {
805 fprintf(htmllog_file,"<TD align=CENTER> %s \n", html_output);
806 }
807 if(justify == XLDLAS_JUST_RIGHT)
808 {
809 fprintf(htmllog_file,"<TD align=RIGHT> %s \n", html_output);
810 }
811 if(justify == XLDLAS_JUST_LEFT)
812 {
813 fprintf(htmllog_file,"<TD align=LEFT> %s \n", html_output);
814 }
815 }
816 }
817
end_column_output()818 void end_column_output()
819 {
820 fl_addto_browser(main_browser, line_of_output);
821 if(log_on == TRUE)
822 {
823 fprintf(log_file,"%s\n", line_of_output);
824 }
825 if(texlog_on == TRUE)
826 {
827 fprintf(texlog_file,"\\cr\n");
828 }
829 }
830
log_routines(FL_OBJECT * menu,long user_data)831 void log_routines(FL_OBJECT *menu, long user_data)
832 {
833 int choice;
834 choice = fl_get_menu(menu);
835 if(choice == 1) start_log();
836 if(choice == 2) start_texlog();
837 if(choice == 3) start_htmllog();
838 }
839
840