-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQPSystem.cpp
119 lines (92 loc) · 2.99 KB
/
QPSystem.cpp
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*------------------------------------------------------------------------------+
| |
| QP - QSDL Parser |
| |
| (C) 1994-98 Marc Diefenbruch |
| University of Essen, Germany |
| |
+---------------+-------------------+---------------+-------------------+-------+
| Module | File | Created | Project | |
+---------------+-------------------+---------------+-------------------+-------+
| QPSystem | QPSystem.cpp | 9. Aug 1994 | QP | |
+------------------------------------------------------------------------------*/
/* Lineal
000000000011111111112222222222333333333344444444445555555555666666666677777777778
012345678901234567890123456789012345678901234567890123456789012345678901234567890
*/
#ifdef USE_PRAGMA
#pragma interface
#endif
#include <stdio.h>
#include <DS/DSSystem.h>
#include <DS/DSBlock.h>
#include <DS/DSChannel.h>
#include <DS/DSSignal.h>
#include <DS/DSString.h>
#include "QPObjects.h"
#ifdef DMALLOC
#include <dmalloc.h>
#endif
extern DSSystem *p_system;
extern DSObjectRefStack p_stack;
extern "C" {
#include "QPError.h"
void text_sys_def_body_1(const char* symbol)
{
assert(symbol);
#ifdef DEBUG
qpDebugLog << "text_sys_def_body_1: " << symbol;
qpDebugLog << " (system name + push system)" << endl;
#endif
p_system = NewSystem(symbol);
assert(p_system);
assert(p_stack.Push((DSObjectRef)p_system) == DS_OK);
}
void text_sys_def_body_2(const char* symbol)
{
DSSystem *p_system;
char str[120];
assert(p_stack.Top());
assert((p_stack.Top())->GetType() == DS_SYSTEM);
p_system = (DSSystem *)p_stack.Top();
if (symbol)
{
#ifdef DEBUG
qpDebugLog << "text_sys_def_body_2: " << symbol;
qpDebugLog << " (check name + pop system)" << endl;
#endif
assert(p_system->GetName());
if (*p_system->GetName() != symbol)
{
sprintf(str, "Wrong system name '%s'!", symbol);
yyerror(str);
}
}
else
{
#ifdef DEBUG
qpDebugLog << "text_sys_def_body_2 (pop system)" << endl;
#endif
}
assert(p_stack.Pop());
}
void atom_1(const char* symbol)
{
DSExpression *p_expression = NULL;
DSAtom *p_atom;
assert(symbol);
#ifdef DEBUG
qpDebugLog << "atom_1: " << symbol;
qpDebugLog << " (atom name + pop proposition)" << endl;
#endif
assert(p_stack.Top());
assert((p_stack.Top())->GetType() == DS_EXPRESSION);
p_expression = (DSExpression*)p_stack.Top();
assert(p_expression);
assert(p_stack.Pop()); // Expression vom Stack entfernen
p_atom = NewAtom(p_system,
symbol,
p_expression);
assert(p_atom);
}
} // extern "C"