mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 18:43:02 +01:00
Output initially hex constants as hex, avoiding fr example use of -1 instead 0xFFFFFFFF
This commit is contained in:
parent
fd2ab9d2cd
commit
9e7eb8c082
9
extern/cloop/src/cloop/Expr.cpp
vendored
9
extern/cloop/src/cloop/Expr.cpp
vendored
@ -29,15 +29,18 @@ using std::string;
|
||||
//--------------------------------------
|
||||
|
||||
|
||||
IntLiteralExpr::IntLiteralExpr(int value)
|
||||
: value(value)
|
||||
IntLiteralExpr::IntLiteralExpr(int value, bool hex)
|
||||
: value(value), hex(hex)
|
||||
{
|
||||
}
|
||||
|
||||
string IntLiteralExpr::generate(Language language, const string& prefix)
|
||||
{
|
||||
char buffer[64];
|
||||
sprintf(buffer, "%d", value);
|
||||
if (hex)
|
||||
sprintf(buffer, "%s%x", language == LANGUAGE_PASCAL ? "$" : "0x", value);
|
||||
else
|
||||
sprintf(buffer, "%d", value);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
3
extern/cloop/src/cloop/Expr.h
vendored
3
extern/cloop/src/cloop/Expr.h
vendored
@ -51,13 +51,14 @@ public:
|
||||
class IntLiteralExpr : public Expr
|
||||
{
|
||||
public:
|
||||
IntLiteralExpr(int value);
|
||||
IntLiteralExpr(int value, bool hex);
|
||||
|
||||
public:
|
||||
virtual std::string generate(Language language, const std::string& prefix);
|
||||
|
||||
private:
|
||||
int value;
|
||||
bool hex;
|
||||
};
|
||||
|
||||
|
||||
|
2
extern/cloop/src/cloop/Parser.cpp
vendored
2
extern/cloop/src/cloop/Parser.cpp
vendored
@ -310,7 +310,7 @@ Expr* Parser::parsePrimaryExpr()
|
||||
int base = len > 2 && tolower(p[1]) == 'x' ? 16 : 10;
|
||||
long val = strtol(p, NULL, base);
|
||||
|
||||
return new IntLiteralExpr((int) val);
|
||||
return new IntLiteralExpr((int) val, base == 16);
|
||||
}
|
||||
|
||||
case Token::TYPE_IDENTIFIER:
|
||||
|
2
extern/cloop/src/tests/test1/CalcCApi.h
vendored
2
extern/cloop/src/tests/test1/CalcCApi.h
vendored
@ -43,7 +43,7 @@ CLOOP_EXTERN_C void CALC_IDisposable_dispose(struct CALC_IDisposable* self);
|
||||
#define CALC_IStatus_VERSION 2
|
||||
|
||||
#define CALC_IStatus_ERROR_1 ((int) (1))
|
||||
#define CALC_IStatus_ERROR_2 ((int) (2))
|
||||
#define CALC_IStatus_ERROR_2 ((int) (0x2))
|
||||
#define CALC_IStatus_ERROR_12 ((int) (CALC_IStatus_ERROR_1 | CALC_IStatus_ERROR_2))
|
||||
|
||||
struct CALC_IStatus;
|
||||
|
2
extern/cloop/src/tests/test1/CalcCppApi.h
vendored
2
extern/cloop/src/tests/test1/CalcCppApi.h
vendored
@ -88,7 +88,7 @@ namespace calc
|
||||
static const unsigned VERSION = 2;
|
||||
|
||||
static const int ERROR_1 = 1;
|
||||
static const int ERROR_2 = 2;
|
||||
static const int ERROR_2 = 0x2;
|
||||
static const int ERROR_12 = IStatus::ERROR_1 | IStatus::ERROR_2;
|
||||
|
||||
int getCode() const
|
||||
|
@ -79,7 +79,7 @@ end;
|
||||
Status = class(Disposable)
|
||||
const VERSION = 2;
|
||||
const ERROR_1 = Integer(1);
|
||||
const ERROR_2 = Integer(2);
|
||||
const ERROR_2 = Integer($2);
|
||||
const ERROR_12 = Integer(Status.ERROR_1 or Status.ERROR_2);
|
||||
|
||||
function getCode(): Integer;
|
||||
|
@ -239,8 +239,8 @@ namespace Firebird
|
||||
public:
|
||||
static const unsigned VERSION = 3;
|
||||
|
||||
static const unsigned STATE_WARNINGS = 1;
|
||||
static const unsigned STATE_ERRORS = 2;
|
||||
static const unsigned STATE_WARNINGS = 0x1;
|
||||
static const unsigned STATE_ERRORS = 0x2;
|
||||
static const int RESULT_ERROR = -1;
|
||||
static const int RESULT_OK = 0;
|
||||
static const int RESULT_NO_DATA = 1;
|
||||
@ -1639,19 +1639,19 @@ namespace Firebird
|
||||
public:
|
||||
static const unsigned VERSION = 4;
|
||||
|
||||
static const unsigned PREPARE_PREFETCH_NONE = 0;
|
||||
static const unsigned PREPARE_PREFETCH_TYPE = 1;
|
||||
static const unsigned PREPARE_PREFETCH_INPUT_PARAMETERS = 2;
|
||||
static const unsigned PREPARE_PREFETCH_OUTPUT_PARAMETERS = 4;
|
||||
static const unsigned PREPARE_PREFETCH_LEGACY_PLAN = 8;
|
||||
static const unsigned PREPARE_PREFETCH_DETAILED_PLAN = 16;
|
||||
static const unsigned PREPARE_PREFETCH_AFFECTED_RECORDS = 32;
|
||||
static const unsigned PREPARE_PREFETCH_FLAGS = 64;
|
||||
static const unsigned PREPARE_PREFETCH_NONE = 0x0;
|
||||
static const unsigned PREPARE_PREFETCH_TYPE = 0x1;
|
||||
static const unsigned PREPARE_PREFETCH_INPUT_PARAMETERS = 0x2;
|
||||
static const unsigned PREPARE_PREFETCH_OUTPUT_PARAMETERS = 0x4;
|
||||
static const unsigned PREPARE_PREFETCH_LEGACY_PLAN = 0x8;
|
||||
static const unsigned PREPARE_PREFETCH_DETAILED_PLAN = 0x10;
|
||||
static const unsigned PREPARE_PREFETCH_AFFECTED_RECORDS = 0x20;
|
||||
static const unsigned PREPARE_PREFETCH_FLAGS = 0x40;
|
||||
static const unsigned PREPARE_PREFETCH_METADATA = IStatement::PREPARE_PREFETCH_TYPE | IStatement::PREPARE_PREFETCH_FLAGS | IStatement::PREPARE_PREFETCH_INPUT_PARAMETERS | IStatement::PREPARE_PREFETCH_OUTPUT_PARAMETERS;
|
||||
static const unsigned PREPARE_PREFETCH_ALL = IStatement::PREPARE_PREFETCH_METADATA | IStatement::PREPARE_PREFETCH_LEGACY_PLAN | IStatement::PREPARE_PREFETCH_DETAILED_PLAN | IStatement::PREPARE_PREFETCH_AFFECTED_RECORDS;
|
||||
static const unsigned FLAG_HAS_CURSOR = 1;
|
||||
static const unsigned FLAG_REPEAT_EXECUTE = 2;
|
||||
static const unsigned CURSOR_TYPE_SCROLLABLE = 1;
|
||||
static const unsigned FLAG_HAS_CURSOR = 0x1;
|
||||
static const unsigned FLAG_REPEAT_EXECUTE = 0x2;
|
||||
static const unsigned CURSOR_TYPE_SCROLLABLE = 0x1;
|
||||
|
||||
template <typename StatusType> void getInfo(StatusType* status, unsigned itemsLength, const unsigned char* items, unsigned bufferLength, unsigned char* buffer)
|
||||
{
|
||||
@ -1922,7 +1922,7 @@ namespace Firebird
|
||||
|
||||
static const int EXECUTE_FAILED = -1;
|
||||
static const int SUCCESS_NO_INFO = -2;
|
||||
static const unsigned NO_MORE_ERRORS = -1;
|
||||
static const unsigned NO_MORE_ERRORS = 0xffffffff;
|
||||
|
||||
template <typename StatusType> unsigned getSize(StatusType* status)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user