view anagram/guisupport/redmenudc.cpp @ 15:f5acaf0c8a29

Don't cast through "volatile int". Causes a gcc warning nowadays. XXX: should put something else back here to frighten the optimizer
author David A. Holland
date Tue, 31 May 2022 01:00:55 -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.
 *
 * redmenudc.cpp
 */

#include "cint.h"
#include "dc.h"
#include "q1glbl.h"
#include "redmenudc.h"
#include "stacks.h"
#include "token.h"
#include "ut.h"

//#define INCLUDE_LOGGING
#include "log.h"


static int reduction_menu_tabs[] = {7,0};

reduction_menu_dc::reduction_menu_dc(unsigned rn)
  : dc("Select Reduction Token", AgString::format("Rule %d", rn))
{
  int length;
  int i, dw;
  rule_number = rn;
  //des->c_size = cursor_bar_size;

  if (rn == 0) {
    length = 0;
  }
  else {
    length = ibnfn[rn];
  }

  for (i = dw = 0; i < length; i++) {
    int tn = ibnfs[ibnfb[rn] + i];
    int k;
    ics();
    atkn(tn);
    k = reduction_menu_tabs[0] + rcs();
    if (k > dw) {
      dw = k;
    }
  }
  tab_stops = reduction_menu_tabs;
  des->d_size = cint(dw, length);
  //manual_resize = 0;
  //resize_window();
}

void reduction_menu_dc::getLine(unsigned ln) const {
  unsigned tn;

  tn = ibnfs[ibnfb[rule_number] + ln];
  //ssprintf("T%03u: ", tn);
  ssprintf("T%03u:\t", tn);
  atkn(tn);
}