view anagram/guisupport/ftpardc.h @ 12:aab9ff6af791

Strengthen the build hack for non-DOS targets.
author David A. Holland
date Tue, 31 May 2022 00:58:42 -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.
 *
 * ftpardc.h
 */

#ifndef FTPARDC_H
#define FTPARDC_H

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

class TokenMenuDc : public dc {
public:
  FtParser &parser;
  unsigned state_number;

  static MenuOption *auxTable[];
  virtual MenuOption **getAuxWinMenu(void) { return auxTable; }

  TokenMenuDc(FtParser &, unsigned);
  virtual void getLine(unsigned) const;
  virtual int positionCursor(unsigned, unsigned);

  virtual unsigned token(unsigned);
  virtual void reset(unsigned);

  virtual dc_ref expansion_rules(unsigned);
  virtual dc_ref productions(unsigned);
  virtual dc_ref set_elements(unsigned);
  virtual dc_ref usage(unsigned);

  virtual int expansion_rules_ok(unsigned);
  virtual int productions_ok(unsigned);
  virtual int set_elements_ok(unsigned);
  virtual int usage_ok(unsigned);
};

class FtParserDc : public dc {
public:
  FtParser &parser;
  FtParserDc(FtParser &p);
  virtual void getLine(unsigned) const;
  static MenuOption *auxTable[];
  MenuOption **getAuxWinMenu(void) { return auxTable; }
  dc_ref tokenMenu(int ln);

  void updateSize(const FtParser::StackChanged &);

  virtual unsigned token(unsigned);
  virtual unsigned state(unsigned);

  virtual dc_ref aux_trace(unsigned);
  virtual int    expansion_rules_ok(unsigned);
  virtual dc_ref expansion_rules(unsigned);
  virtual int    keywords_ok(unsigned);
  virtual dc_ref keywords(unsigned);
  virtual int    previous_states_ok(unsigned);
  virtual dc_ref previous_states(unsigned);
  virtual int    productions_ok(unsigned);
  virtual dc_ref productions(unsigned);
  //virtual dc_ref rule_stack(unsigned);
  virtual int    set_elements_ok(unsigned);
  virtual dc_ref set_elements(unsigned);
  virtual dc_ref state_definition(unsigned);
  virtual dc_ref state_expansion(unsigned);
  virtual int    usage_ok(unsigned);
  virtual dc_ref usage(unsigned);

};

class FtParserReductionDc : public reduction_menu_dc {
private:
  static int reduction_menu_tabs[];

public:
  FtParser &parser;
  FtParserReductionDc(FtParser &parser_)
    : reduction_menu_dc(parser_.ruleToReduce)
    , parser(parser_)
  {
    columnHeadTitle = "Reduction Choices";
    tab_stops = reduction_menu_tabs;
  }

  static MenuOption *auxTable[];
  MenuOption **getAuxWinMenu(void) { return auxTable; }
  virtual unsigned token(unsigned);
  virtual int    expansion_rules_ok(unsigned);
  virtual dc_ref expansion_rules(unsigned);
  virtual int    productions_ok(unsigned);
  virtual dc_ref productions(unsigned);
  virtual int    set_elements_ok(unsigned);
  virtual dc_ref set_elements(unsigned);
  virtual int    usage_ok(unsigned);
  virtual dc_ref usage(unsigned);

  void getLine(unsigned ln) const {
    unsigned tn;
    tn = ibnfs[ibnfb[rule_number] + ln];
    ssprintf("T%03u:  ",tn);
    atkn(tn);
  }
  unsigned token(unsigned ln) const {
    return ibnfs[ibnfb[rule_number] + ln];
  }

  //virtual void onEnterKey(void) {}
};


#endif /* FTPARDC_H */