File: variable.h

package info (click to toggle)
cuyo 2.0.0brl1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 15,624 kB
  • sloc: cpp: 11,728; ml: 5,515; sh: 1,179; makefile: 757; yacc: 558; awk: 355; lex: 244; perl: 193
file content (98 lines) | stat: -rw-r--r-- 2,988 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/***************************************************************************
                          variable.h  -  description
                             -------------------
    begin                : Fri Jul 21 2000
    copyright            : (C) 2000 by Immi
    email                : cuyo@pcpool.mathematik.uni-freiburg.de

Modified 2002,2005,2006,2010,2011 by the cuyo developers

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef VARIABLE_H
#define VARIABLE_H

struct ort_absolut;
class Blop;
class Ort;
class VarDefinition;
class Str;

/* Rckgabewert fr getOrt(). variable_global, variable_lokal
   und variable_fall werden auerdem verwendet:
   - beim Constructor (Variable("bla", variable_global))
   - in mDX
 */
#define variable_global 0x8000
#define variable_relativ 0x8001
#define variable_lokal 0x8002
#define variable_fall 0x8003


/** (Auftreten einer) Variable in einer Prozedur.

    Wenn mDeklaration sagt, dass es sich
    um eine (richtige echte) Konstante handelt, existiert die Variable
    nur so lange, bis in vparse.yy ein Ausdruck draus gemacht wird. Dabei
    wird es dann durch den Wert ersetzt. */
class Variable {


  /** Datei, in der diese Variablenverwendung steht (fr Fehlermeldungen) */
  //Str mDateiName;
  /** Zeilen-Nr, in der diese Variablenverwendung steht (fr Fehlermeldungen) */
  //int mZeilenNr;
  /* ... wird nicht mehr gebraucht. Diese Info wird vom darberliegenden
     Code an die Fehlermeldung gehngt. */

  VarDefinition * mDeklaration;

  /** Relative Koordinaten, so wie sie der cual-Programmierer eingegeben
      hat. */
  Ort * mOrt;

  
public:
  /** Erzeugt eine Mll-Variable. Wird verwendet, wenn es einen Fehler
      gab (blicherweise Variable nicht definiert). Die Mll-Variable
      versucht, Folgefehler zu vermeiden, so dass wenigstens noch fertig
      geparst werden kann. */
  Variable();
  
  Variable(//Str datna, int znr,
           VarDefinition * d, Ort * ort);

  ~Variable();

  Str toString() const;
  

  bool Ort_hier() const;

  ort_absolut getOrt(ort_absolut vonhieraus, Blop & fuer_code) const;
  
  int getNummer() const;
  
  bool istKonstante() const;
  
  /** Liefert den Default-Wert, wenn's eine Variable ist und den
      Wert, wenn's eine Konstante ist. */
  int getDefaultWert() const;
  
  Str getName() const;

};




#endif