Mercurial > ~dholland > hg > ag > index.cgi
view anagram/guisupport/coveragedc.cpp @ 4:bebb2ba69e1d
maybe help with getting tex to fail properly on error
author | David A. Holland |
---|---|
date | Sat, 18 Apr 2020 17:12:17 -0400 |
parents | 13d2b8934445 |
children |
line wrap: on
line source
/* * AnaGram, A System for Syntax Directed Programming * Copyright 1993-2002 Parsifal Software. All Rights Reserved. * See the file COPYING for license and usage terms. * * coveragedc.cpp */ #include <stdio.h> #include "port.h" #include "coveragedc.h" #include "dc.h" #include "q1glbl.h" #include "rule.h" #include "stacks.h" #include "ut.h" #include "wm1.h" //#define INCLUDE_LOGGING #include "log.h" dc_ref read_counts(AgString fileName) { LOGSECTION("read_counts"); LOGV(fileName); FILE *ag_file; unsigned i; long ag_file_id; dc_ref window; AgArray<unsigned> counts(nforms_base+1); ag_file = fopen(fileName.pointer(), "r"); fscanf(ag_file, "%ld", &ag_file_id); //ZALLOCATE_ST(rule_counts, nforms_base+1); int k = 1; for (i = 0; k && i <= nforms_base; i++) { //k = fscanf(ag_file,"%d", &rule_counts[i]); k = fscanf(ag_file,"%d", &counts[i]); } fclose(ag_file); if (k) { window = dc_ref(new rule_count_dc("Rule Coverage", counts)); window->foot_title = fileName; return window; } return dc_ref(); } static int rule_count_tabs[] = {8,0}; rule_count_dc::rule_count_dc(const char *name, AgArray<unsigned> ca) : dc(name) { LOGSECTION("rule_count_dc::rule_count_dc"); LOGV(name); counts = ca; des->d_size.y = nforms_base+1; tab_stops = rule_count_tabs; counts = ca; } void rule_count_dc::getLine(unsigned ln) const { ssprintf("%6u\t", counts[ln]); append_item(ln, 1+map_form_number[ln].length()); } void rule_count_dc::synchCursor(unsigned ln) const { set_rule_line(ln); }