diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anagram/guisupport/proctabdc.cpp	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,125 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1993-1999 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * proctabdc.cpp
+ */
+
+//#include "brt.h"
+#include "dc.h"
+#include "proctabdc.h"
+#include "rproc.h"
+#include "rule.h"
+#include "stacks.h"
+#include "ut.h"
+#include "wm1.h"
+
+//#define INCLUDE_LOGGING
+#include "log.h"
+
+
+/*
+void string_table_dc::init(void) {
+  //LOGSECTION("string_table_dc::init");
+
+  int width = 0;
+  int nLines = text.size();
+
+  for (int i = 0; i < nLines; i++) {
+    width = max(width,text[i].size());
+    //LOGV(text[i].pointer());
+  }
+
+  syntax_dependent = 0;
+  //des->c_size = cursor_bar_size;
+  des->d_size = cint(width, nLines);
+}
+
+void string_table_dc::reset(AgString name, AgArray<AgString> text_) {
+  text = text_;
+  head_title = name;
+  init();
+}
+
+string_table_dc::string_table_dc(const AgString name, AgArray<AgString> text_)
+  : dc(name)
+  , text(text_)
+{
+  init();
+  //sorted = 1;
+  //resize_window();
+}
+
+void string_table_dc::getLine(unsigned ln) const {
+  sss(text[ln].pointer());
+}
+*/
+//extern int       rule_coverage;
+//extern unsigned *rule_counts;
+
+static int proc_table_tabs[] = {0,0};
+
+proc_table_dc::proc_table_dc(void)
+  : dc("Reduction Procedures")
+{
+  //des->c_size = cursor_bar_size;
+  //des->d_size.y = n_auto_procs;
+  des->d_size.y = Procedure::count() - 1;
+  tab_stops = proc_table_tabs;
+  //getWidth();
+  //resize_window();
+}
+
+void proc_table_dc::getLine(unsigned ln) const {
+  //proc_name_map pm;
+  const char *cast, *cs;
+  unsigned i;
+  //char counts[20] = "";
+  //int showCounts = rule_coverage && rule_counts != 0;
+
+  ln++;
+  //pm = map_proc_name[ln];
+  Procedure proc(ln);
+  Rule rule = proc->form_number;
+  //tab_stops[0] = showCounts ? 7 : 0;
+  tab_stops[0] = 0;
+  //if (showCounts) sprintf(counts,"%5u\t", rule_counts[pm.form_number]);
+  //cast = dict_str(cast_dict, pm.cast);
+  //cast = dict_str(cast_dict, proc->cast);
+  cast = Cast(proc->cast)->pointer();
+  //assert(pm.cast == proc->cast);
+  if (cast == NULL) {
+    cast = "";
+  }
+  //ssprintf("%s%s %s(", counts, cast, proc_name_string(ln).pointer());
+  ssprintf("%s %s(", cast, proc_name_string(ln).pointer());
+
+  cs = "";
+/*
+  for (i = 0; i < pm.n_params; i++) {
+    apprintf("%s%s",cs, dict_str(cast_dict,lstptr(pm,cast)[i]));
+    cs = ", ";
+  }
+*/
+  AgArray<RuleElement> elementList = rule->op_bias ? rule->hostElementList : rule->elementList;
+  for (i = 0; i < elementList.size(); i++) {
+    RuleElement &element = elementList[i];
+    if (element.cVariable == 0) {
+      continue;
+    }
+    //apprintf("%s%s", cs, dict_str(cast_dict,element.token->value_type));
+    apprintf("%s%s", cs, Cast(element.token->value_type)->pointer());
+    cs = ", ";
+  }
+  acs(')');
+}
+
+void proc_table_dc::synchCursor(unsigned ln) const {
+  Procedure proc(ln+1);
+  set_text_line(proc->line, proc->col, 0);
+/*
+  proc_name_map *mpn = &map_proc_name[ln+1];
+  set_text_line(mpn->line, mpn->col,0);
+*/
+}