#include <string>
#include <fstream>
#include <utility>
#include <stack>
#include <regex>
#include <cstdio>
#include "formulaAnalyser.h"
Go to the source code of this file.
◆ DECLARE_AUX_STRUCTURES
#define DECLARE_AUX_STRUCTURES |
Value:"typedef bool (*fce)();\n"\
"\n"\
"typedef struct {\n"\
" bool evaluated;\n"\
" bool value;\n"\
" fce lambda;\n"\
"} expr;\n"\
"\n"\
"bool get(expr *e){\n"\
" if (!e->evaluated) {\n"\
" e->value = e->lambda();\n"\
" }\n"\
" return e->value;\n"\
"}\n\n"\
◆ ENUM_VAR_NAMES
#define ENUM_VAR_NAMES "enum VarNames { %s };\n\n" |
◆ FAIL_REPORT_METHOD
#define FAIL_REPORT_METHOD |
Value:"\n"\
"void printFailReport() {\n"\
" fprintf(stderr,\"Verification failed after round #%%d!\\nRelevant changes:\\n\", M.hb);\n"\
"\n"\
" int i;\n"\
" /*< Print all changes in formulae values that happened in the failure heartbeat */\n"\
" for (i = %d; i > 0 ; i--) {\n" \
" if (M.check[i]) {\n"\
" fprintf(stderr, M.formulaeContents[i], (M.now[i]?\"true\":\"false\")); \n"\
" }\n"\
" }\n"\
"}\n\n"
◆ GENERATED_FILES_NAME
#define GENERATED_FILES_NAME "monitor" |
◆ HEADER_FILE
Value:"%s\n" \
"#ifndef MONITOR_H\n"\
"#define MONITOR_H\n\n"\
"#include <stdio.h>\n"\
"#include <string.h>\n"\
"#include <stdbool.h>\n"\
"#include \"%s\"\n\n" \
"#ifdef __cplusplus\n"\
"extern \"C\" {\n#endif\n\n"\
" bool monitorVerify();\n\n"\
"#ifdef __cplusplus\n}\n#endif\n\n"\
"#endif"
◆ MONITOR_C_HEADER
Value:"%s\n" \
"#ifdef __cplusplus\n"\
"extern \"C\" {\n"\
"#endif\n\n"
#define GENERATED_FILES_NAME
Definition: monitorCreator.h:16
◆ MONITOR_STRUCT_DECLARATION
#define MONITOR_STRUCT_DECLARATION |
Value:"\ntypedef struct {\n"\
" expr values[%d];\n" \
" const char* formulaeContents[%d];\n" \
" bool pre[%d], now[%d], check[%d];\n" \
" int since[%d];\n" \
" int children[%d][%d];\n"\
" int chCnt[%d];\n" \
" int hb;\n"\
"} monitor;\n\n"
◆ MONITOR_STRUCT_DEFINITION
#define MONITOR_STRUCT_DEFINITION |
Value:"monitor M = {\n"\
" {%s\n" \
" },\n" \
" {%s\n" \
" },\n" \
" {false},\n" \
" {false},\n" \
" {false},\n" \
" {0},\n" \
" {%s\n"\
" },\n" \
" { %s },\n"\
" 0\n" \
"};\n\n" \
"bool initiated = false;\n\n"
◆ MONITOR_VERIFY_CHECK_AND_FINALIZE
#define MONITOR_VERIFY_CHECK_AND_FINALIZE |
Value:"\n" \
" for (int i = 0; i < %d; i++) {\n" \
" if (M.now[i] != M.pre[i])\n" \
" M.since[i] = M.hb;\n" \
" if ((M.check[i] || i == 0) && M.since[i] == M.hb) {\n" \
" M.check[i] = true;" \
" for (int j = 0; j < M.chCnt[i]; j++) {\n" \
" M.check[M.children[i][j]] = true;\n" \
" }\n" \
" } else M.check[i] = false;\n" \
" }\n" \
"\n" \
" if (!M.now[0]) printFailReport();\n" \
" return M.now[0];\n" \
"}\n"
◆ MONITOR_VERIFY_INIT
#define MONITOR_VERIFY_INIT |
Value:"bool monitorVerify() {\n" \
" M.hb++;\n" \
" if (!initiated) {prepare();}\n" \
" else {\n" \
" for (int i = 0; i < %d; i++) {\n" \
" M.pre[i] = M.now[i]; }\n" \
" }\n" \
"\n"
◆ fileSize()
long fileSize |
( |
const char * |
filename | ) |
|