view anagram/agcore/rproc.h @ 21:1c9dac05d040

Add lint-style FALLTHROUGH annotations to fallthrough cases. (in the parse engine and thus the output code) Document this, because the old output causes warnings with gcc10.
author David A. Holland
date Mon, 13 Jun 2022 00:04:38 -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.
 *
 * rproc.h
 */

#ifndef RPROC_H
#define RPROC_H

#include "register.h"

struct CSegment {
  unsigned char *begin;
  unsigned char *end;
  int line;

  // this is in pgg24.syn and moving it would make an ugly mess
  CSegment();

  int length() { return end - begin; }
  int operator < (const CSegment &s) const { return begin < s.begin; }
};

struct ProcedureDescriptor;

class Procedure : public ObjectRegister<ProcedureDescriptor> {
public:
  Procedure() {}
  Procedure(const int x);
  //Procedure(const Procedure &t) : ObjectRegister<ProcedureDescriptor>(t) {}
  Procedure(const CSegment &t);
  static const int first;
  static void reset();
  int operator < (const Procedure p) const;
};

struct ProcedureDescriptor {
  int cast;
  //int n_params;
  //unsigned cast_index;
  //int auto_proc;
  int alias;
  int line, col;
  int form_number;
  CSegment cSegment;
  //int *args;
  int macro_flag : 1;
  int value_flag : 1;

  ProcedureDescriptor();
  ProcedureDescriptor(const CSegment &);
  int operator < (const ProcedureDescriptor &d) const {
    return cSegment.begin < d.cSegment.begin;
  }
};


#endif /* RPROC_H */