Skip to content

Commit

Permalink
Generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPeshkoff committed Aug 10, 2023
1 parent 4c73f35 commit 93a8c44
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 66 deletions.
115 changes: 71 additions & 44 deletions extern/cloop/src/tests/test1/CalcCppApi.h
Expand Up @@ -7,6 +7,23 @@
#define CLOOP_CARG
#endif

#ifndef CLOOP_NOEXCEPT
#if __cplusplus >= 201103L
#define CLOOP_NOEXCEPT noexcept
#else
#define CLOOP_NOEXCEPT throw()
#endif
#endif


#ifndef CLOOP_CONSTEXPR
#if __cplusplus >= 201103L
#define CLOOP_CONSTEXPR constexpr
#else
#define CLOOP_CONSTEXPR const
#endif
#endif


namespace calc
{
Expand Down Expand Up @@ -34,14 +51,16 @@ namespace calc

// Interfaces declarations

#define CALC_IDISPOSABLE_VERSION 1u

class IDisposable
{
public:
struct VTable
{
void* cloopDummy[1];
uintptr_t version;
void (CLOOP_CARG *dispose)(IDisposable* self) throw();
void (CLOOP_CARG *dispose)(IDisposable* self) CLOOP_NOEXCEPT;
};

void* cloopDummy[1];
Expand All @@ -57,21 +76,23 @@ namespace calc
}

public:
static const unsigned VERSION = 1;
static CLOOP_CONSTEXPR unsigned VERSION = CALC_IDISPOSABLE_VERSION;

void dispose()
{
static_cast<VTable*>(this->cloopVTable)->dispose(this);
}
};

#define CALC_ISTATUS_VERSION 2u

class IStatus : public IDisposable
{
public:
struct VTable : public IDisposable::VTable
{
int (CLOOP_CARG *getCode)(const IStatus* self) throw();
void (CLOOP_CARG *setCode)(IStatus* self, int code) throw();
int (CLOOP_CARG *getCode)(const IStatus* self) CLOOP_NOEXCEPT;
void (CLOOP_CARG *setCode)(IStatus* self, int code) CLOOP_NOEXCEPT;
};

protected:
Expand All @@ -85,11 +106,11 @@ namespace calc
}

public:
static const unsigned VERSION = 2;
static CLOOP_CONSTEXPR unsigned VERSION = CALC_ISTATUS_VERSION;

static const int ERROR_1 = 1;
static const int ERROR_2 = 0x2;
static const int ERROR_12 = IStatus::ERROR_1 | IStatus::ERROR_2;
static CLOOP_CONSTEXPR int ERROR_1 = 1;
static CLOOP_CONSTEXPR int ERROR_2 = 0x2;
static CLOOP_CONSTEXPR int ERROR_12 = IStatus::ERROR_1 | IStatus::ERROR_2;

int getCode() const
{
Expand All @@ -103,15 +124,17 @@ namespace calc
}
};

#define CALC_IFACTORY_VERSION 2u

class IFactory : public IDisposable
{
public:
struct VTable : public IDisposable::VTable
{
IStatus* (CLOOP_CARG *createStatus)(IFactory* self) throw();
ICalculator* (CLOOP_CARG *createCalculator)(IFactory* self, IStatus* status) throw();
ICalculator2* (CLOOP_CARG *createCalculator2)(IFactory* self, IStatus* status) throw();
ICalculator* (CLOOP_CARG *createBrokenCalculator)(IFactory* self, IStatus* status) throw();
IStatus* (CLOOP_CARG *createStatus)(IFactory* self) CLOOP_NOEXCEPT;
ICalculator* (CLOOP_CARG *createCalculator)(IFactory* self, IStatus* status) CLOOP_NOEXCEPT;
ICalculator2* (CLOOP_CARG *createCalculator2)(IFactory* self, IStatus* status) CLOOP_NOEXCEPT;
ICalculator* (CLOOP_CARG *createBrokenCalculator)(IFactory* self, IStatus* status) CLOOP_NOEXCEPT;
};

protected:
Expand All @@ -125,7 +148,7 @@ namespace calc
}

public:
static const unsigned VERSION = 2;
static CLOOP_CONSTEXPR unsigned VERSION = CALC_IFACTORY_VERSION;

IStatus* createStatus()
{
Expand Down Expand Up @@ -158,15 +181,17 @@ namespace calc
}
};

#define CALC_ICALCULATOR_VERSION 4u

class ICalculator : public IDisposable
{
public:
struct VTable : public IDisposable::VTable
{
int (CLOOP_CARG *sum)(const ICalculator* self, IStatus* status, int n1, int n2) throw();
int (CLOOP_CARG *getMemory)(const ICalculator* self) throw();
void (CLOOP_CARG *setMemory)(ICalculator* self, int n) throw();
void (CLOOP_CARG *sumAndStore)(ICalculator* self, IStatus* status, int n1, int n2) throw();
int (CLOOP_CARG *sum)(const ICalculator* self, IStatus* status, int n1, int n2) CLOOP_NOEXCEPT;
int (CLOOP_CARG *getMemory)(const ICalculator* self) CLOOP_NOEXCEPT;
void (CLOOP_CARG *setMemory)(ICalculator* self, int n) CLOOP_NOEXCEPT;
void (CLOOP_CARG *sumAndStore)(ICalculator* self, IStatus* status, int n1, int n2) CLOOP_NOEXCEPT;
};

protected:
Expand All @@ -180,7 +205,7 @@ namespace calc
}

public:
static const unsigned VERSION = 4;
static CLOOP_CONSTEXPR unsigned VERSION = CALC_ICALCULATOR_VERSION;

template <typename StatusType> int sum(StatusType* status, int n1, int n2) const
{
Expand Down Expand Up @@ -223,14 +248,16 @@ namespace calc
}
};

#define CALC_ICALCULATOR2_VERSION 6u

class ICalculator2 : public ICalculator
{
public:
struct VTable : public ICalculator::VTable
{
int (CLOOP_CARG *multiply)(const ICalculator2* self, IStatus* status, int n1, int n2) throw();
void (CLOOP_CARG *copyMemory)(ICalculator2* self, const ICalculator* calculator) throw();
void (CLOOP_CARG *copyMemory2)(ICalculator2* self, const int* address) throw();
int (CLOOP_CARG *multiply)(const ICalculator2* self, IStatus* status, int n1, int n2) CLOOP_NOEXCEPT;
void (CLOOP_CARG *copyMemory)(ICalculator2* self, const ICalculator* calculator) CLOOP_NOEXCEPT;
void (CLOOP_CARG *copyMemory2)(ICalculator2* self, const int* address) CLOOP_NOEXCEPT;
};

protected:
Expand All @@ -244,7 +271,7 @@ namespace calc
}

public:
static const unsigned VERSION = 6;
static CLOOP_CONSTEXPR unsigned VERSION = CALC_ICALCULATOR2_VERSION;

template <typename StatusType> int multiply(StatusType* status, int n1, int n2) const
{
Expand Down Expand Up @@ -291,7 +318,7 @@ namespace calc
this->cloopVTable = &vTable;
}

static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) throw()
static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) CLOOP_NOEXCEPT
{
try
{
Expand Down Expand Up @@ -342,7 +369,7 @@ namespace calc
this->cloopVTable = &vTable;
}

static int CLOOP_CARG cloopgetCodeDispatcher(const IStatus* self) throw()
static int CLOOP_CARG cloopgetCodeDispatcher(const IStatus* self) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -355,7 +382,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopsetCodeDispatcher(IStatus* self, int code) throw()
static void CLOOP_CARG cloopsetCodeDispatcher(IStatus* self, int code) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -367,7 +394,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) throw()
static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) CLOOP_NOEXCEPT
{
try
{
Expand Down Expand Up @@ -421,7 +448,7 @@ namespace calc
this->cloopVTable = &vTable;
}

static IStatus* CLOOP_CARG cloopcreateStatusDispatcher(IFactory* self) throw()
static IStatus* CLOOP_CARG cloopcreateStatusDispatcher(IFactory* self) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -434,7 +461,7 @@ namespace calc
}
}

static ICalculator* CLOOP_CARG cloopcreateCalculatorDispatcher(IFactory* self, IStatus* status) throw()
static ICalculator* CLOOP_CARG cloopcreateCalculatorDispatcher(IFactory* self, IStatus* status) CLOOP_NOEXCEPT
{
StatusType status2(status);

Expand All @@ -449,7 +476,7 @@ namespace calc
}
}

static ICalculator2* CLOOP_CARG cloopcreateCalculator2Dispatcher(IFactory* self, IStatus* status) throw()
static ICalculator2* CLOOP_CARG cloopcreateCalculator2Dispatcher(IFactory* self, IStatus* status) CLOOP_NOEXCEPT
{
StatusType status2(status);

Expand All @@ -464,7 +491,7 @@ namespace calc
}
}

static ICalculator* CLOOP_CARG cloopcreateBrokenCalculatorDispatcher(IFactory* self, IStatus* status) throw()
static ICalculator* CLOOP_CARG cloopcreateBrokenCalculatorDispatcher(IFactory* self, IStatus* status) CLOOP_NOEXCEPT
{
StatusType status2(status);

Expand All @@ -479,7 +506,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) throw()
static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) CLOOP_NOEXCEPT
{
try
{
Expand Down Expand Up @@ -535,7 +562,7 @@ namespace calc
this->cloopVTable = &vTable;
}

static int CLOOP_CARG cloopsumDispatcher(const ICalculator* self, IStatus* status, int n1, int n2) throw()
static int CLOOP_CARG cloopsumDispatcher(const ICalculator* self, IStatus* status, int n1, int n2) CLOOP_NOEXCEPT
{
StatusType status2(status);

Expand All @@ -550,7 +577,7 @@ namespace calc
}
}

static int CLOOP_CARG cloopgetMemoryDispatcher(const ICalculator* self) throw()
static int CLOOP_CARG cloopgetMemoryDispatcher(const ICalculator* self) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -563,7 +590,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopsetMemoryDispatcher(ICalculator* self, int n) throw()
static void CLOOP_CARG cloopsetMemoryDispatcher(ICalculator* self, int n) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -575,7 +602,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopsumAndStoreDispatcher(ICalculator* self, IStatus* status, int n1, int n2) throw()
static void CLOOP_CARG cloopsumAndStoreDispatcher(ICalculator* self, IStatus* status, int n1, int n2) CLOOP_NOEXCEPT
{
StatusType status2(status);

Expand All @@ -589,7 +616,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) throw()
static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) CLOOP_NOEXCEPT
{
try
{
Expand Down Expand Up @@ -648,7 +675,7 @@ namespace calc
this->cloopVTable = &vTable;
}

static int CLOOP_CARG cloopmultiplyDispatcher(const ICalculator2* self, IStatus* status, int n1, int n2) throw()
static int CLOOP_CARG cloopmultiplyDispatcher(const ICalculator2* self, IStatus* status, int n1, int n2) CLOOP_NOEXCEPT
{
StatusType status2(status);

Expand All @@ -663,7 +690,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopcopyMemoryDispatcher(ICalculator2* self, const ICalculator* calculator) throw()
static void CLOOP_CARG cloopcopyMemoryDispatcher(ICalculator2* self, const ICalculator* calculator) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -675,7 +702,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopcopyMemory2Dispatcher(ICalculator2* self, const int* address) throw()
static void CLOOP_CARG cloopcopyMemory2Dispatcher(ICalculator2* self, const int* address) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -687,7 +714,7 @@ namespace calc
}
}

static int CLOOP_CARG cloopsumDispatcher(const ICalculator* self, IStatus* status, int n1, int n2) throw()
static int CLOOP_CARG cloopsumDispatcher(const ICalculator* self, IStatus* status, int n1, int n2) CLOOP_NOEXCEPT
{
StatusType status2(status);

Expand All @@ -702,7 +729,7 @@ namespace calc
}
}

static int CLOOP_CARG cloopgetMemoryDispatcher(const ICalculator* self) throw()
static int CLOOP_CARG cloopgetMemoryDispatcher(const ICalculator* self) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -715,7 +742,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopsetMemoryDispatcher(ICalculator* self, int n) throw()
static void CLOOP_CARG cloopsetMemoryDispatcher(ICalculator* self, int n) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -727,7 +754,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopsumAndStoreDispatcher(ICalculator* self, IStatus* status, int n1, int n2) throw()
static void CLOOP_CARG cloopsumAndStoreDispatcher(ICalculator* self, IStatus* status, int n1, int n2) CLOOP_NOEXCEPT
{
StatusType status2(status);

Expand All @@ -741,7 +768,7 @@ namespace calc
}
}

static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) throw()
static void CLOOP_CARG cloopdisposeDispatcher(IDisposable* self) CLOOP_NOEXCEPT
{
try
{
Expand Down

1 comment on commit 93a8c44

@AlexPeshkoff
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this commit also contains fix for 'Firebird server stops accepting new connections after some time'
#7480, committed accidentally here though fix is OK

Please sign in to comment.