github.com/nakagami/firebirdsql@v0.9.10/_attic/msgs.c (about)

     1  #include <stdint.h>
     2  
     3  #include "firebird/impl/msg_helper.h"
     4  
     5  extern void addMessage(int code, const char* message);
     6  
     7  typedef unsigned short USHORT;
     8  typedef USHORT ISC_USHORT;
     9  typedef intptr_t ISC_STATUS;
    10  typedef long SLONG;
    11  
    12  #define stringify_literal(x) #x
    13  
    14  #define FB_IMPL_MSG_NO_SYMBOL(facility, number, text)
    15  
    16  #define FB_IMPL_MSG_SYMBOL(facility, number, symbol, text)
    17  
    18  #define FB_IMPL_MSG(facility, number, symbol, sqlCode, sqlClass, sqlSubClass, text) \
    19      addMessage(make_isc_code(FB_IMPL_MSG_FACILITY_##facility, number), stringify_literal(text));
    20  
    21  int make_isc_code(int facility, int code) {
    22      ISC_USHORT t1 = facility;
    23      t1 &= 0x1F;
    24      ISC_STATUS t2 = t1;
    25      t2 <<= 16;
    26      ISC_STATUS t3 = code;
    27      code &= 0x3FFF;
    28      return t2 | t3 | ((ISC_STATUS) 0x14000000);
    29  }
    30  
    31  void process_messages() {
    32      #include "firebird/impl/msg/all.h"
    33  }