Mercurial > ~dholland > hg > ag > index.cgi
comparison anagram/guisupport/proctabdc.cpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 /* | |
2 * AnaGram, A System for Syntax Directed Programming | |
3 * Copyright 1993-1999 Parsifal Software. All Rights Reserved. | |
4 * See the file COPYING for license and usage terms. | |
5 * | |
6 * proctabdc.cpp | |
7 */ | |
8 | |
9 //#include "brt.h" | |
10 #include "dc.h" | |
11 #include "proctabdc.h" | |
12 #include "rproc.h" | |
13 #include "rule.h" | |
14 #include "stacks.h" | |
15 #include "ut.h" | |
16 #include "wm1.h" | |
17 | |
18 //#define INCLUDE_LOGGING | |
19 #include "log.h" | |
20 | |
21 | |
22 /* | |
23 void string_table_dc::init(void) { | |
24 //LOGSECTION("string_table_dc::init"); | |
25 | |
26 int width = 0; | |
27 int nLines = text.size(); | |
28 | |
29 for (int i = 0; i < nLines; i++) { | |
30 width = max(width,text[i].size()); | |
31 //LOGV(text[i].pointer()); | |
32 } | |
33 | |
34 syntax_dependent = 0; | |
35 //des->c_size = cursor_bar_size; | |
36 des->d_size = cint(width, nLines); | |
37 } | |
38 | |
39 void string_table_dc::reset(AgString name, AgArray<AgString> text_) { | |
40 text = text_; | |
41 head_title = name; | |
42 init(); | |
43 } | |
44 | |
45 string_table_dc::string_table_dc(const AgString name, AgArray<AgString> text_) | |
46 : dc(name) | |
47 , text(text_) | |
48 { | |
49 init(); | |
50 //sorted = 1; | |
51 //resize_window(); | |
52 } | |
53 | |
54 void string_table_dc::getLine(unsigned ln) const { | |
55 sss(text[ln].pointer()); | |
56 } | |
57 */ | |
58 //extern int rule_coverage; | |
59 //extern unsigned *rule_counts; | |
60 | |
61 static int proc_table_tabs[] = {0,0}; | |
62 | |
63 proc_table_dc::proc_table_dc(void) | |
64 : dc("Reduction Procedures") | |
65 { | |
66 //des->c_size = cursor_bar_size; | |
67 //des->d_size.y = n_auto_procs; | |
68 des->d_size.y = Procedure::count() - 1; | |
69 tab_stops = proc_table_tabs; | |
70 //getWidth(); | |
71 //resize_window(); | |
72 } | |
73 | |
74 void proc_table_dc::getLine(unsigned ln) const { | |
75 //proc_name_map pm; | |
76 const char *cast, *cs; | |
77 unsigned i; | |
78 //char counts[20] = ""; | |
79 //int showCounts = rule_coverage && rule_counts != 0; | |
80 | |
81 ln++; | |
82 //pm = map_proc_name[ln]; | |
83 Procedure proc(ln); | |
84 Rule rule = proc->form_number; | |
85 //tab_stops[0] = showCounts ? 7 : 0; | |
86 tab_stops[0] = 0; | |
87 //if (showCounts) sprintf(counts,"%5u\t", rule_counts[pm.form_number]); | |
88 //cast = dict_str(cast_dict, pm.cast); | |
89 //cast = dict_str(cast_dict, proc->cast); | |
90 cast = Cast(proc->cast)->pointer(); | |
91 //assert(pm.cast == proc->cast); | |
92 if (cast == NULL) { | |
93 cast = ""; | |
94 } | |
95 //ssprintf("%s%s %s(", counts, cast, proc_name_string(ln).pointer()); | |
96 ssprintf("%s %s(", cast, proc_name_string(ln).pointer()); | |
97 | |
98 cs = ""; | |
99 /* | |
100 for (i = 0; i < pm.n_params; i++) { | |
101 apprintf("%s%s",cs, dict_str(cast_dict,lstptr(pm,cast)[i])); | |
102 cs = ", "; | |
103 } | |
104 */ | |
105 AgArray<RuleElement> elementList = rule->op_bias ? rule->hostElementList : rule->elementList; | |
106 for (i = 0; i < elementList.size(); i++) { | |
107 RuleElement &element = elementList[i]; | |
108 if (element.cVariable == 0) { | |
109 continue; | |
110 } | |
111 //apprintf("%s%s", cs, dict_str(cast_dict,element.token->value_type)); | |
112 apprintf("%s%s", cs, Cast(element.token->value_type)->pointer()); | |
113 cs = ", "; | |
114 } | |
115 acs(')'); | |
116 } | |
117 | |
118 void proc_table_dc::synchCursor(unsigned ln) const { | |
119 Procedure proc(ln+1); | |
120 set_text_line(proc->line, proc->col, 0); | |
121 /* | |
122 proc_name_map *mpn = &map_proc_name[ln+1]; | |
123 set_text_line(mpn->line, mpn->col,0); | |
124 */ | |
125 } |