//**************************************************************************************************
//
// ARGUMENT CHECKING/REVOCATION — PREPROCESSOR:
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// RuntimeForStatic base library | C+- (SysRoutine) | Author: Sergei Y.Kitáev
#pragma once
#include "include_restrictions.h"

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// ARGUMENT REVOCATION:
//
//==================================================================================================
// MULTIPLE ARGUMENTS REVOCATION:

#define $INCORRECT_ARGUMENTS() \
   RuntimeForStatic::$FatalError::RaiseIncorrectArguments($$CI)
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE( message ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessage($$CI, (message) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_1( messageFmt, a1 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_2( messageFmt, a1, a2 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_3( messageFmt, a1, a2, a3 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2), (a3) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_4( messageFmt, a1, a2, a3, a4 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2), (a3), (a4) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_5( messageFmt, a1, a2, a3, a4, a5 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2), (a3), (a4), (a5) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_6( messageFmt, a1, a2, a3, a4, a5, a6 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_7( messageFmt, a1, a2, a3, a4, a5, a6, a7 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_8( messageFmt, a1, a2, a3, a4, a5, a6, a7, a8 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7), (a8) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_9( messageFmt, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7), (a8), (a9) )
#define $INCORRECT_ARGUMENTS_WITH_MESSAGE_10( messageFmt, \
                                              a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentsWithMessageFmt($$CI, \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7), (a8), (a9), (a10) )

//--------------------------------------------------------------------------------------------------
// SINGLE ARGUMENT REVOCATION:

#define $INCORRECT_ARGUMENT( argument ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgument($$CI, $NAME_OF(argument) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE( argument, message ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessage($$CI, $NAME_OF(argument), \
      (message) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_1( argument, messageFmt, a1 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_2( argument, messageFmt, a1, a2 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_3( argument, messageFmt, a1, a2, a3 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2), (a3) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_4( argument, messageFmt, a1, a2, a3, a4 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2), (a3), (a4) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_5( argument, messageFmt, a1, a2, a3, a4, a5 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2), (a3), (a4), (a5) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_6( argument, messageFmt, a1, a2, a3, a4, a5, a6 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_7( argument, messageFmt, a1, a2, a3, a4, a5, a6, a7 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_8( argument, messageFmt, a1, a2, a3, a4, a5, a6, a7, a8 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7), (a8) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_9( argument, messageFmt, \
                                            a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7), (a8), (a9) )
#define $INCORRECT_ARGUMENT_WITH_MESSAGE_10( argument, messageFmt, \
                                             a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \
   RuntimeForStatic::$FatalError::RaiseIncorrectArgumentWithMessageFmt($$CI, $NAME_OF(argument), \
      (messageFmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7), (a8), (a9), (a10) )


//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// ARGUMENT VERIFICATION:
//
//==================================================================================================
// DISCARDABLE VERIFICATIONS:

#ifndef $EXCLUDE_VERIFICATION
   #define $VERIFY_NOT_ZERO_ARG( argValue ) \
      RuntimeForStatic::$ArgChecking::VerifyNotZero($ci, $NAME_N_ARG_OF(argValue) )
   #define $VERIFY_NOT_ZERO_SIZE_ARG( argValue ) \
      RuntimeForStatic::$ArgChecking::VerifyNotZero_Size($ci, $NAME_N_ARG_OF(argValue) )
   #define $VERIFY_NOT_NEGATIVE_VALUE_ARG( argValue ) \
      RuntimeForStatic::$ArgChecking::VerifyNotNegative($ci, $NAME_N_ARG_OF(argValue) )
   #define $VERIFY_POSITIVE_VALUE_ARG( argValue ) \
      RuntimeForStatic::$ArgChecking::VerifyPositive($ci, $NAME_N_ARG_OF(argValue) )
   #define $VERIFY_POINTER_ARG( pointerArg ) \
      RuntimeForStatic::$ArgChecking::VerifyPointer($ci, \
         $NAME_OF(pointerArg), ($PCVoid)(pointerArg) )
   #define $VERIFY_HANDLE_ARG( handleArg ) \
      RuntimeForStatic::$ArgChecking::VerifyHandle($ci, $NAME_N_ARG_OF(handleArg) )
   #define $VERIFY_HANDLE_ARG_IV( handleArg ) \
      RuntimeForStatic::$ArgChecking::VerifyHandle($ci, $NAME_N_ARG_OF(handleArg), true )
   #define $VERIFY_HANDLE_ARG_EX( handleArg, isOfInvalidHandleValueCategory ) \
      RuntimeForStatic::$ArgChecking::VerifyHandleArgumentEx($ci, \
         $NAME_N_ARG_OF(handleArg), (isOfInvalidHandleValueCategory) )
   #define $VERIFY_DISPOSABLE_ARG( disposable ) \
      RuntimeForStatic::$ArgChecking::VerifyDisposable($ci, $NAME_N_ARG_OF(disposable) )

   #define $VERIFY_NOT_ZERO_ARG_( argValue ) \
      RuntimeForStatic::$ArgChecking::VerifyNotZero($, $NAME_N_ARG_OF(argValue) )
   #define $VERIFY_NOT_NEGATIVE_VALUE_ARG_( argValue ) \
      RuntimeForStatic::$ArgChecking::VerifyNotNegative($, $NAME_N_ARG_OF(argValue) )
   #define $VERIFY_POSITIVE_VALUE_ARG_( argValue ) \
      RuntimeForStatic::$ArgChecking::VerifyPositive($, $NAME_N_ARG_OF(argValue) )
   #define $VERIFY_POINTER_ARG_( pointerArg ) \
      RuntimeForStatic::$ArgChecking::VerifyPointer($, $NAME_N_ARG_OF(pointerArg) )
   #define $VERIFY_HANDLE_ARG_( handleArg ) \
      RuntimeForStatic::$ArgChecking::VerifyHandle($, $NAME_N_ARG_OF(handleArg) )
   #define $VERIFY_HANDLE_ARG_IV_( handleArg ) \
      RuntimeForStatic::$ArgChecking::VerifyHandle($, $NAME_N_ARG_OF(handleArg), true )
   #define $VERIFY_HANDLE_ARG_EX_( handleArg, isOfInvalidHandleValueCategory ) \
      RuntimeForStatic::$ArgChecking::VerifyHandleArgumentEx($, \
         $NAME_N_ARG_OF(handleArg), (isOfInvalidHandleValueCategory) )
   #define $VERIFY_DISPOSABLE_ARG_( disposable ) \
      RuntimeForStatic::$ArgChecking::VerifyDisposable($, $NAME_N_ARG_OF(disposable) )
#else
   #define $VERIFY_NOT_ZERO_ARG( argValue )                                      $VOID_VALUE
   #define $VERIFY_NOT_ZERO_SIZE_ARG( argValue )                                 $VOID_VALUE
   #define $VERIFY_NOT_NEGATIVE_VALUE_ARG( argValue )                            $VOID_VALUE
   #define $VERIFY_POSITIVE_VALUE_ARG( argValue )                                $VOID_VALUE
   #define $VERIFY_POINTER_ARG( pointerArg )                                     $VOID_VALUE
   #define $VERIFY_HANDLE_ARG( handleArg )                                       $VOID_VALUE
   #define $VERIFY_HANDLE_ARG_IV( handleArg )                                    $VOID_VALUE
   #define $VERIFY_HANDLE_ARG_EX( handleArg, isOfInvalidHandleValueCategory )    $VOID_VALUE
   #define $VERIFY_DISPOSABLE_ARG( disposable )                                  $VOID_VALUE

   #define $VERIFY_NOT_ZERO_ARG_( argValue )                                     $VOID_VALUE
   #define $VERIFY_NOT_NEGATIVE_VALUE_ARG_( argValue )                           $VOID_VALUE
   #define $VERIFY_POSITIVE_VALUE_ARG_( argValue )                               $VOID_VALUE
   #define $VERIFY_POINTER_ARG_( pointerArg )                                    $VOID_VALUE
   #define $VERIFY_HANDLE_ARG_( handleArg )                                      $VOID_VALUE
   #define $VERIFY_HANDLE_ARG_IV_( handleArg )                                   $VOID_VALUE
   #define $VERIFY_HANDLE_ARG_EX_( handleArg, isOfInvalidHandleValueCategory )   $VOID_VALUE
   #define $VERIFY_DISPOSABLE_ARG_( disposable )                                 $VOID_VALUE
#endif // $EXCLUDE_VERIFICATION

//--------------------------------------------------------------------------------------------------
// NON-DISCARDABLE VERIFICATIONS:

#define $$VERIFY_NOT_ZERO_ARG( argValue ) \
   RuntimeForStatic::$ArgChecking::VerifyNotZero($$CI, $NAME_N_ARG_OF(argValue) )
#define $$VERIFY_NOT_ZERO_SIZE_ARG( argValue ) \
   RuntimeForStatic::$ArgChecking::VerifyNotZero_Size($$CI, $NAME_N_ARG_OF(argValue) )
#define $$VERIFY_NOT_NEGATIVE_VALUE_ARG( argValue ) \
   RuntimeForStatic::$ArgChecking::VerifyNotNegative($$CI, $NAME_N_ARG_OF(argValue) )
#define $$VERIFY_POSITIVE_VALUE_ARG( argValue ) \
   RuntimeForStatic::$ArgChecking::VerifyPositive($$CI, $NAME_N_ARG_OF(argValue) )
#define $$VERIFY_POINTER_ARG( pointerArg ) \
   RuntimeForStatic::$ArgChecking::VerifyPointer($$CI, \
      $NAME_OF(pointerArg), ($PCVoid)(pointerArg) )
#define $$VERIFY_HANDLE_ARG( handleArg ) \
   RuntimeForStatic::$ArgChecking::VerifyHandle($$CI, $NAME_N_ARG_OF(handleArg) )
#define $$VERIFY_HANDLE_ARG_IV( handleArg ) \
   RuntimeForStatic::$ArgChecking::VerifyHandle($$CI, $NAME_N_ARG_OF(handleArg), true )
#define $$VERIFY_HANDLE_ARG_EX( handleArg, isOfInvalidHandleValueCategory ) \
   RuntimeForStatic::$ArgChecking::VerifyHandleArgumentEx($$CI, \
      $NAME_N_ARG_OF(handleArg), (isOfInvalidHandleValueCategory) )
#define $$VERIFY_DISPOSABLE_ARG( disposable ) \
   RuntimeForStatic::$ArgChecking::VerifyDisposable($$CI, $NAME_N_ARG_OF(disposable) )

#define $$VERIFY_NOT_ZERO_ARG_( argValue ) \
   RuntimeForStatic::$ArgChecking::VerifyNotZero($$, $NAME_N_ARG_OF(argValue) )
#define $$VERIFY_NOT_ZERO_SIZE_ARG_( argValue ) \
   RuntimeForStatic::$ArgChecking::VerifyNotZero_Size($$, $NAME_N_ARG_OF(argValue) )
#define $$VERIFY_NOT_NEGATIVE_VALUE_ARG_( argValue ) \
   RuntimeForStatic::$ArgChecking::VerifyNotNegative($$, $NAME_N_ARG_OF(argValue) )
#define $$VERIFY_POSITIVE_VALUE_ARG_( argValue ) \
   RuntimeForStatic::$ArgChecking::VerifyPositive($$, $NAME_N_ARG_OF(argValue) )
#define $$VERIFY_POINTER_ARG_( pointerArg ) \
   RuntimeForStatic::$ArgChecking::VerifyPointer($$, $NAME_N_ARG_OF(pointerArg) )
#define $$VERIFY_HANDLE_ARG_( handleArg ) \
   RuntimeForStatic::$ArgChecking::VerifyHandle($$, $NAME_N_ARG_OF(handleArg) )
#define $$VERIFY_HANDLE_ARG_IV_( handleArg ) \
   RuntimeForStatic::$ArgChecking::VerifyHandle($$, $NAME_N_ARG_OF(handleArg), true )
#define $$VERIFY_HANDLE_ARG_EX_( handleArg, isOfInvalidHandleValueCategory ) \
   RuntimeForStatic::$ArgChecking::VerifyHandleArgumentEx($$, \
      $NAME_N_ARG_OF(handleArg), (isOfInvalidHandleValueCategory) )
#define $$VERIFY_DISPOSABLE_ARG_( disposable ) \
   RuntimeForStatic::$ArgChecking::VerifyDisposable($$, $NAME_N_ARG_OF(disposable) )

//==================================================================================================
