-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle_mach.pl
executable file
·139 lines (121 loc) · 4.28 KB
/
style_mach.pl
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* :- compile(library(sets)). */
/* alter attributes list, alter validentity predicates */
:- multifile(typeschema/6).
:- multifile(informalnames/2).
:- multifile(validentity/2).
:- multifile(style/2).
style(mach, 'Mach RPC Interface').
/* Check constraints on an entity */
/* validentity(entity(style), name of entity) */
/* NOTE: IN ALL CASES WHERE THE DATABASE IS CHECKED FOR AN ATTRIBUTE,
MAKE SURE TO ALLOW FOR POSSIBILITY THAT THE ATTRIBUTE WAS NOT
ENTERED BY THE USER (A PARTIAL DESCRIPTION)!*/
validentity(event(mach), Name) :-
indatabase([Name]),
validentity(datacomponent(base), Name),
getvalues(event, _, Name, type, [Type]),
((Type == unspecified ; Type == structure ; Type == array) ->
true;
zz('Mach event must have structure or array as data type',
Name, Type)
).
validentity(controlcomponent(mach), Name) :-
indatabase([Name]),
validentity(controlcomponent(base), Name).
validentity(trigger(mach), Name) :-
indatabase([Name]),
validentity(trigger(base), Name),
getvalues(trigger, _, Name,
[controlcomponent, inmessage, outmessageset, outcalls],
[Controlcomponent, Inmessage, Outmessageset, Outcalls]),
checkfortypemismatch(Name, Controlcomponent, controlcomponent(mach),
'Mach trigger controlcomponent lacks proper type'),
checkfortypemismatch(Name, Inmessage, event(mach),
'Mach trigger inmessage lacks proper type'),
checkfortypemismatch(Name, Outmessageset, event(mach),
'Mach trigger outmessageset includes entity lacking proper type'),
checkfortypemismatch(Name, Outcalls, controlcomponent(mach),
'Mach trigger outcalls includes entity lacking proper type').
validentity(system(mach), Name) :-
indatabase([Name]),
validentity(system(base), Name),
getvalues(system, _, Name,
[controlcomponents, recognizedmessages, triggers, initialcontrolcomponents],
[Controlcomponents, Recognizedmessages, Triggers, Initialcontrolcomponents]),
checkfortypemismatch(Name, Controlcomponents, controlcomponent(mach),
'Mach system controlcomponents includes entity lacking proper type'),
checkfortypemismatch(Name, Initialcontrolcomponents, controlcomponent(mach),
'Mach system initialcontrolcomponents includes entity lacking proper type'),
checkfortypemismatch(Name, Recognizedmessages, event(mach),
'Mach system recognizedmessages includes entity lacking proper type'),
checkfortypemismatch(Name, Triggers, trigger(mach),
'Mach system triggers includes entity lacking proper type'),
((Controlcomponents == [unspecified] ;
Initialcontrolcomponents == [unspecified]) ->
true;
(seteq(Controlcomponents, Initialcontrolcomponents) ->
true;
zz('Mach system controlcomponents and initial controlcomponents differ',
Name, (Controlcomponents, Initialcontrolcomponents))
)
),
/* (Controlcomponents == [unspecified] ->
true;
(length(Controlcomponents, LC),
(LC == 1 ->
true;
zz('Mach system controlcomponents must be one',
Name, Controlcomponents)
))
),*/
((Triggers == [unspecified] ; Triggers == []) ->
zz('Mach system missing a set of triggers', Name, Triggers);
true
).
/*************************************************************************/
/*typeschema(entity(style), variable attributes, types of former,
fixed attributes, fixed attributes values, parent entity(style))*/
typeschema(event(mach),
[],
[],
[type],
[[structure]],
datacomponent(base)).
typeschema(controlcomponent(mach),
[],
[],
[],
[],
controlcomponent(base)).
typeschema(trigger(mach),
[],
[],
[subtype, outspawns],
[[ctype], []],
trigger(base)).
typeschema(system(mach),
[],
[],
[globalobjects, classes, calls, spawns, shareddata, call_layers, spawn_layers,
dataconnector_layers, recognizedmessages],
[[], [], [], [], [], [], [], [],
[machmsgtype_rpc, machmsgtype_encrypted, machmsgtype_normal]],
system(base)).
informalnames(system(mach),
['Initial Control Components',
'Initial Data Connectors ',
'Global Objects ',
'Control Components ',
'Classes ',
'Shared Data ',
'Data Connectors ',
'Calls ',
'Spawns ',
'Recognized Messages ',
'Triggers ',
'Call Layers ',
'Spawn Layers ',
'Data Connector Layers ',
'Nodes ',
'Resources ',
'Platform ']).