mirror of https://gitee.com/bigwinds/arangodb
clean up generator code (#4191)
This commit is contained in:
parent
505d37aada
commit
bbfb8238b1
|
@ -1,9 +1,7 @@
|
|||
/*jshint maxlen: 240 */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief auto-generated file generated from errors.dat
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// auto-generated file generated from errors.dat
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
/*jshint maxlen: 240 */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief auto-generated file generated from exitcodes.dat
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// auto-generated file generated from exitcodes.dat
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
|
|
@ -102,6 +102,3 @@ void TRI_InitializeError() {
|
|||
TRI_InitializeErrorMessages();
|
||||
TRI_InitializeExitMessages();
|
||||
}
|
||||
|
||||
/// @brief shuts down the error messages
|
||||
void TRI_ShutdownError() {}
|
||||
|
|
|
@ -28,52 +28,25 @@
|
|||
#error use <Basics/Common.h>
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the last error
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_errno();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the last error as string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char const* TRI_last_error();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets the last error
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_set_errno(int);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief defines an error string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_set_errno_string(int, char const*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return an error message for an error code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char const* TRI_errno_string(int);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initializes the error messages
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitializeError();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief shuts down the error messages
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_ShutdownError();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief defines an exit string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_set_exitno_string(int, char const*);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief auto-generated file generated from exitcodes.dat
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// auto-generated file generated from exitcodes.dat
|
||||
|
||||
#include "Basics/Common.h"
|
||||
#include "./lib/Basics/exitcodes.h"
|
||||
#include "Basics/exitcodes.h"
|
||||
|
||||
/// helper macro to define an exit code string
|
||||
#define REG_EXIT(id, label) TRI_set_exitno_string(TRI_ ## id, label);
|
||||
|
||||
void TRI_InitializeExitMessages() {
|
||||
REG_EXIT(EXIT_SUCCESS, "success");
|
||||
|
|
|
@ -1,170 +1,74 @@
|
|||
#ifndef ARANGODB_BASICS_EXIT_CODES_H
|
||||
#define ARANGODB_BASICS_EXIT_CODES_H 1
|
||||
|
||||
#ifndef TRIAGENS_BASICS_EXIT_CODES_H
|
||||
#define TRIAGENS_BASICS_EXIT_CODES_H 1
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Exit codes and meanings
|
||||
///
|
||||
/// The following codes might be retured when exiting ArangoDB:
|
||||
///
|
||||
#include "Basics/error.h"
|
||||
/// - 0: @LIT{success}
|
||||
/// No error has occurred.
|
||||
/// - 1: @LIT{exit with error}
|
||||
/// Will be returned when a general error occurred.
|
||||
/// - 2: @LIT{exit code resolving failed}
|
||||
/// fill me
|
||||
/// - 5: @LIT{binary not found}
|
||||
/// fill me
|
||||
/// - 6: @LIT{config not found}
|
||||
/// fill me
|
||||
/// - 10: @LIT{upgrade failed}
|
||||
/// Will be returned when the database upgrade failed
|
||||
/// - 11: @LIT{db upgrade required}
|
||||
/// Will be returned when a database upgrade is required
|
||||
/// - 12: @LIT{db downgrade required}
|
||||
/// Will be returned when a database upgrade is required
|
||||
/// - 13: @LIT{version check failed}
|
||||
/// Will be returned when there is a version mismatch
|
||||
/// - 20: @LIT{already running}
|
||||
/// Will be returned when arangod is already running according to PID-file
|
||||
/// - 21: @LIT{port blocked}
|
||||
/// Will be returned when endpoint is taken by another process
|
||||
/// - 22: @LIT{could not lock - another process could be running}
|
||||
/// fill me
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief helper macro to define an exit code string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Exit codes and meanings
|
||||
/// The following codes might be returned when exiting ArangoDB:
|
||||
|
||||
#define REG_EXIT(id, label) TRI_set_exitno_string(TRI_ ## id, label);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief register all exit codes for ArangoDB
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitializeExitMessages ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 0: EXIT_SUCCESS
|
||||
///
|
||||
/// 0: EXIT_SUCCESS
|
||||
/// success
|
||||
///
|
||||
/// No error has occurred.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_SUCCESS = 0;
|
||||
|
||||
#define TRI_EXIT_SUCCESS (0)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1: EXIT_FAILED
|
||||
///
|
||||
/// 1: EXIT_FAILED
|
||||
/// exit with error
|
||||
///
|
||||
/// Will be returned when a general error occurred.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_FAILED = 1;
|
||||
|
||||
#define TRI_EXIT_FAILED (1)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 2: EXIT_CODE_RESOLVING_FAILED
|
||||
///
|
||||
/// 2: EXIT_CODE_RESOLVING_FAILED
|
||||
/// exit code resolving failed
|
||||
///
|
||||
/// fill me
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_CODE_RESOLVING_FAILED = 2;
|
||||
|
||||
#define TRI_EXIT_CODE_RESOLVING_FAILED (2)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 5: EXIT_BINARY_NOT_FOUND
|
||||
///
|
||||
/// 5: EXIT_BINARY_NOT_FOUND
|
||||
/// binary not found
|
||||
///
|
||||
/// fill me
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_BINARY_NOT_FOUND = 5;
|
||||
|
||||
#define TRI_EXIT_BINARY_NOT_FOUND (5)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 6: EXIT_CONFIG_NOT_FOUND
|
||||
///
|
||||
/// 6: EXIT_CONFIG_NOT_FOUND
|
||||
/// config not found
|
||||
///
|
||||
/// fill me
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_CONFIG_NOT_FOUND = 6;
|
||||
|
||||
#define TRI_EXIT_CONFIG_NOT_FOUND (6)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 10: EXIT_UPGRADE_FAILED
|
||||
///
|
||||
/// 10: EXIT_UPGRADE_FAILED
|
||||
/// upgrade failed
|
||||
///
|
||||
/// Will be returned when the database upgrade failed
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_UPGRADE_FAILED = 10;
|
||||
|
||||
#define TRI_EXIT_UPGRADE_FAILED (10)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 11: EXIT_UPGRADE_REQUIRED
|
||||
///
|
||||
/// 11: EXIT_UPGRADE_REQUIRED
|
||||
/// db upgrade required
|
||||
///
|
||||
/// Will be returned when a database upgrade is required
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_UPGRADE_REQUIRED = 11;
|
||||
|
||||
#define TRI_EXIT_UPGRADE_REQUIRED (11)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 12: EXIT_DOWNGRADE_REQUIRED
|
||||
///
|
||||
/// 12: EXIT_DOWNGRADE_REQUIRED
|
||||
/// db downgrade required
|
||||
///
|
||||
/// Will be returned when a database upgrade is required
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_DOWNGRADE_REQUIRED = 12;
|
||||
|
||||
#define TRI_EXIT_DOWNGRADE_REQUIRED (12)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 13: EXIT_VERSION_CHECK_FAILED
|
||||
///
|
||||
/// 13: EXIT_VERSION_CHECK_FAILED
|
||||
/// version check failed
|
||||
///
|
||||
/// Will be returned when there is a version mismatch
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_VERSION_CHECK_FAILED = 13;
|
||||
|
||||
#define TRI_EXIT_VERSION_CHECK_FAILED (13)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 20: EXIT_ALREADY_RUNNING
|
||||
///
|
||||
/// 20: EXIT_ALREADY_RUNNING
|
||||
/// already running
|
||||
///
|
||||
/// Will be returned when arangod is already running according to PID-file
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_ALREADY_RUNNING = 20;
|
||||
|
||||
#define TRI_EXIT_ALREADY_RUNNING (20)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 21: EXIT_COULD_NOT_BIND_PORT
|
||||
///
|
||||
/// 21: EXIT_COULD_NOT_BIND_PORT
|
||||
/// port blocked
|
||||
///
|
||||
/// Will be returned when endpoint is taken by another process
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_COULD_NOT_BIND_PORT = 21;
|
||||
|
||||
#define TRI_EXIT_COULD_NOT_BIND_PORT (21)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 22: EXIT_COULD_NOT_LOCK
|
||||
///
|
||||
/// 22: EXIT_COULD_NOT_LOCK
|
||||
/// could not lock - another process could be running
|
||||
///
|
||||
/// fill me
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
constexpr int TRI_EXIT_COULD_NOT_LOCK = 22;
|
||||
|
||||
#define TRI_EXIT_COULD_NOT_LOCK (22)
|
||||
|
||||
/// register all exit codes for ArangoDB
|
||||
void TRI_InitializeExitMessages();
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,22 +24,13 @@
|
|||
#include "Basics/Common.h"
|
||||
#include "Basics/voc-mimetypes.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief already initialized
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool Initialized = false;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief the array of mimetypes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::unordered_map<std::string, std::string> Mimetypes;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief register a mimetype for an extension
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_RegisterMimetype(char const* extension, char const* mimetype,
|
||||
bool appendCharset) {
|
||||
std::string full(mimetype);
|
||||
|
@ -50,10 +41,7 @@ bool TRI_RegisterMimetype(char const* extension, char const* mimetype,
|
|||
return !Mimetypes.emplace(std::string(extension), full).second;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief gets the mimetype for an extension
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char const* TRI_GetMimetype(char const* extension) {
|
||||
auto it = Mimetypes.find(std::string(extension));
|
||||
|
||||
|
@ -64,10 +52,7 @@ char const* TRI_GetMimetype(char const* extension) {
|
|||
return (*it).second.c_str();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initializes the mimetypes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitializeMimetypes() {
|
||||
if (Initialized) {
|
||||
return;
|
||||
|
@ -77,10 +62,7 @@ void TRI_InitializeMimetypes() {
|
|||
Initialized = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief shuts down the mimetypes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_ShutdownMimetypes() {
|
||||
Initialized = false;
|
||||
}
|
||||
|
|
|
@ -24,28 +24,16 @@
|
|||
#ifndef ARANGODB_BASICS_MIMETYPES_H
|
||||
#define ARANGODB_BASICS_MIMETYPES_H 1
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief register a mimetype for an extension
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_RegisterMimetype(char const*, char const*, bool);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief gets the mimetype for an extension
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char const* TRI_GetMimetype(char const*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initializes mimetypes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitializeMimetypes();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief shuts down mimetypes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_ShutdownMimetypes();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief auto-generated file generated from errors.dat
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// auto-generated file generated from errors.dat
|
||||
|
||||
#include "Basics/Common.h"
|
||||
#include "./lib/Basics/voc-errors.h"
|
||||
#include "Basics/voc-errors.h"
|
||||
|
||||
/// helper macro to define an error string
|
||||
#define REG_ERROR(id, label) TRI_set_errno_string(TRI_ ## id, label);
|
||||
|
||||
void TRI_InitializeErrorMessages() {
|
||||
REG_ERROR(ERROR_NO_ERROR, "no error");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -72,7 +72,6 @@ void ShutdownRest() {
|
|||
TRI_ShutdownProcess();
|
||||
TRI_ShutdownMimetypes();
|
||||
TRI_ShutdownFiles();
|
||||
TRI_ShutdownError();
|
||||
TRI_ShutdownDebugging();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,10 @@ def genCFile(errors, filename):
|
|||
|
||||
impl = prologue\
|
||||
+ "#include \"Basics/Common.h\"\n"\
|
||||
+ "#include \"" + headerfile + "\"\n"\
|
||||
+ "#include \"Basics/voc-errors.h\"\n"\
|
||||
+ "\n"\
|
||||
+ "/// helper macro to define an error string\n"\
|
||||
+ "#define REG_ERROR(id, label) TRI_set_errno_string(TRI_ ## id, label);\n"\
|
||||
+ "\n"\
|
||||
+ "void TRI_InitializeErrorMessages() {\n"
|
||||
|
||||
|
@ -80,64 +83,37 @@ def genCFile(errors, filename):
|
|||
|
||||
# generate C header file from errors
|
||||
def genCHeaderFile(errors):
|
||||
wiki = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// Error codes and meanings\n"\
|
||||
+ "///\n"\
|
||||
wiki = "/// Error codes and meanings\n"\
|
||||
+ "/// The following errors might be raised when running ArangoDB:\n"\
|
||||
+ "///\n"
|
||||
+ "\n\n"
|
||||
|
||||
for e in errors:
|
||||
wiki = wiki\
|
||||
+ "/// - " + e[1] + ": @LIT{" + e[2].replace("%", "\%").replace("<", "\<").replace(">", "\>") + "}\n"\
|
||||
+ wrap(e[3], 80, 0, 0, "/// ") + "\n"
|
||||
|
||||
wiki = wiki\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"
|
||||
|
||||
header = "\n"\
|
||||
+ "#ifndef TRIAGENS_BASICS_VOC_ERRORS_H\n"\
|
||||
+ "#define TRIAGENS_BASICS_VOC_ERRORS_H 1\n"\
|
||||
header = "#ifndef ARANGODB_BASICS_VOC_ERRORS_H\n"\
|
||||
+ "#define ARANGODB_BASICS_VOC_ERRORS_H 1\n"\
|
||||
+ "\n"\
|
||||
+ wiki\
|
||||
+ "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief helper macro to define an error string\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "#define REG_ERROR(id, label) TRI_set_errno_string(TRI_ ## id, label);\n"\
|
||||
+ "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief register all errors for ArangoDB\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "void TRI_InitializeErrorMessages ();\n"\
|
||||
+ "\n"
|
||||
+ wiki
|
||||
|
||||
# print individual errors
|
||||
for e in errors:
|
||||
header = header\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief " + e[1] + ": " + e[0] + "\n"\
|
||||
+ "///\n"\
|
||||
+ wrap(e[2], 80, 0, 0, "/// ").replace("<", "\<").replace(">", "\>") + "\n"\
|
||||
+ "///\n"\
|
||||
+ "/// " + e[1] + ": " + e[0] + "\n"\
|
||||
+ wrap(e[2], 80, 0, 0, "/// \"") + "\"\n"\
|
||||
+ wrap(e[3], 80, 0, 0, "/// ") + "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "#define TRI_" + e[0].ljust(61) + " (" + e[1] + ")\n"\
|
||||
+ "constexpr int TRI_" + e[0].ljust(61) + " = " + e[1] + ";\n"\
|
||||
+ "\n"
|
||||
|
||||
header = header + "\n"\
|
||||
+ "/// register all errors for ArangoDB\n"\
|
||||
+ "void TRI_InitializeErrorMessages();\n"\
|
||||
+ "\n"
|
||||
|
||||
header = header\
|
||||
+ "#endif\n"\
|
||||
+ "\n"
|
||||
+ "#endif\n"
|
||||
|
||||
return header
|
||||
|
||||
|
||||
# define some globals
|
||||
prologue = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief auto-generated file generated from errors.dat\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
prologue = "/// auto-generated file generated from errors.dat\n"\
|
||||
+ "\n"
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
|
|
|
@ -97,7 +97,10 @@ def genCFile(errors, filename):
|
|||
|
||||
impl = prologue\
|
||||
+ "#include \"Basics/Common.h\"\n"\
|
||||
+ "#include \"" + headerfile + "\"\n"\
|
||||
+ "#include \"Basics/exitcodes.h\"\n"\
|
||||
+ "\n"\
|
||||
+ "/// helper macro to define an exit code string\n"\
|
||||
+ "#define REG_EXIT(id, label) TRI_set_exitno_string(TRI_ ## id, label);\n"\
|
||||
+ "\n"\
|
||||
+ "void TRI_InitializeExitMessages() {\n"
|
||||
|
||||
|
@ -115,55 +118,31 @@ def genCFile(errors, filename):
|
|||
|
||||
# generate C header file from errors
|
||||
def genCHeaderFile(errors):
|
||||
wiki = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// Exit codes and meanings\n"\
|
||||
+ "///\n"\
|
||||
+ "/// The following codes might be retured when exiting ArangoDB:\n"\
|
||||
+ "///\n"\
|
||||
+ "#include \"Basics/error.h\"\n"
|
||||
wiki = "/// Exit codes and meanings\n"\
|
||||
+ "/// The following codes might be returned when exiting ArangoDB:\n"
|
||||
|
||||
for e in errors:
|
||||
wiki = wiki\
|
||||
+ "/// - " + e[1] + ": @LIT{" + e[2].replace("%", "\%").replace("<", "\<").replace(">", "\>") + "}\n"\
|
||||
+ wrap(e[3], 80, 0, 0, "/// ") + "\n"
|
||||
|
||||
wiki = wiki\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"
|
||||
|
||||
header = "\n"\
|
||||
+ "#ifndef TRIAGENS_BASICS_EXIT_CODES_H\n"\
|
||||
+ "#define TRIAGENS_BASICS_EXIT_CODES_H 1\n"\
|
||||
header = "#ifndef ARANGODB_BASICS_EXIT_CODES_H\n"\
|
||||
+ "#define ARANGODB_BASICS_EXIT_CODES_H 1\n"\
|
||||
+ "\n"\
|
||||
+ "#include \"Basics/error.h\"\n"\
|
||||
+ "\n"\
|
||||
+ wiki\
|
||||
+ "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief helper macro to define an exit code string\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "#define REG_EXIT(id, label) TRI_set_exitno_string(TRI_ ## id, label);\n"\
|
||||
+ "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief register all exit codes for ArangoDB\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "void TRI_InitializeExitMessages ();\n"\
|
||||
+ "\n"
|
||||
|
||||
# print individual errors
|
||||
for e in errors:
|
||||
header = header\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief " + e[1] + ": " + e[0] + "\n"\
|
||||
+ "///\n"\
|
||||
+ wrap(e[2], 80, 0, 0, "/// ").replace("<", "\<").replace(">", "\>") + "\n"\
|
||||
+ "///\n"\
|
||||
+ "/// " + e[1] + ": " + e[0] + "\n"\
|
||||
+ wrap(e[2], 80, 0, 0, "/// ") + "\n"\
|
||||
+ wrap(e[3], 80, 0, 0, "/// ") + "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "#define TRI_" + e[0].ljust(61) + " (" + e[1] + ")\n"\
|
||||
+ "constexpr int TRI_" + e[0].ljust(61) + " = " + e[1] + ";\n"\
|
||||
+ "\n"
|
||||
|
||||
header = header\
|
||||
+ "\n"\
|
||||
+ "/// register all exit codes for ArangoDB\n"\
|
||||
+ "void TRI_InitializeExitMessages();\n"\
|
||||
+ "\n"\
|
||||
+ "#endif\n"\
|
||||
+ "\n"
|
||||
|
||||
|
@ -171,9 +150,7 @@ def genCHeaderFile(errors):
|
|||
|
||||
|
||||
# define some globals
|
||||
prologue = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief auto-generated file generated from exitcodes.dat\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
prologue = "/// auto-generated file generated from exitcodes.dat\n"\
|
||||
+ "\n"
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
|
|
Loading…
Reference in New Issue