Mercurial > ~dholland > hg > ag > index.cgi
view anagram/guisupport/coveragedc.cpp @ 8:ec2b657edf13
Add explicit lint-comment-style fallthrough annotations.
GCC now assumes that if you don't have these you're making a mistake,
which is annoying.
XXX: This changeset updates the AG output files only (by hand) and is
XXX: abusive - rebuilding them will erase the change. However, I need
XXX: to get things to build before I can try to get AG to issue the
XXX: annotations itself, so this seems like a reasonable expedient.
author | David A. Holland |
---|---|
date | Mon, 30 May 2022 23:51:43 -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); }