1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
7 */
8
9#ifndef _MAL_SCENARIO_H
10#define _MAL_SCENARIO_H
11
12#include "mal_import.h"
13
14#define MAL_SCENARIO_READER 0
15#define MAL_SCENARIO_PARSER 1
16#define MAL_SCENARIO_OPTIMIZE 2
17#define MAL_SCENARIO_SCHEDULER 3
18#define MAL_SCENARIO_ENGINE 4
19#define MAL_SCENARIO_INITCLIENT 5
20#define MAL_SCENARIO_EXITCLIENT 6
21#define MAL_SCENARIO_CALLBACK 7
22
23/*#define MAL_SCENARIO_DEBUG*/
24/*
25 * @-
26 * The scenario descriptions contains all information to
27 * implement the scenario. Each client gets a copy.
28 * An exception or error detected while parsing is turned
29 * into an exception and aborts the scenario.
30 */
31#define MAXSCEN 128
32
33typedef struct SCENARIO {
34 str name, language;
35 str initSystem;
36 MALfcn initSystemCmd;
37 str exitSystem;
38 MALfcn exitSystemCmd;
39 str initClient;
40 MALfcn initClientCmd;
41 str exitClient;
42 MALfcn exitClientCmd;
43 str reader;
44 MALfcn readerCmd;
45 str parser;
46 MALfcn parserCmd;
47 str optimizer;
48 MALfcn optimizerCmd;
49 str tactics;
50 MALfcn tacticsCmd;
51 str engine;
52 MALfcn engineCmd;
53 str callback;
54 MALfcn callbackCmd;
55} *Scenario;
56
57mal_export str setScenario(Client c, str nme);
58mal_export str runScenario(Client c, int once);
59mal_export str getScenarioLanguage(Client c);
60mal_export Scenario getFreeScenario(void);
61
62mal_export void showCurrentScenario(void);
63mal_export void showScenarioByName(stream *f, str s);
64mal_export void showScenario(stream *f, Scenario s);
65mal_export void showAllScenarios(stream *f);
66mal_export void resetScenario(Client c);
67
68mal_export Scenario findScenario(str nme);
69mal_export void updateScenario(str scen, str nme, MALfcn fcn);
70
71#endif /* _MAL_SCENARIO_H */
72