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

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// AUTO-FREE CREATION DEFS:
//
//==================================================================================================
// SINGLE POINTER (AUTO-FREE):

#define $AUTO_FREE( pointer ) \
   RuntimeForStatic::$AutoFree $IDENT_AUTO($auto_free_)($, ($PPVoid)&(pointer) )
#define $AUTO_FREE_SP( pointer ) \
   RuntimeForStatic::$AutoFree $IDENT_AUTO($auto_free_)($, true, ($PPVoid)&(pointer) )

#define $AUTO_FREE_VAR( variable, pointer ) \
   RuntimeForStatic::$AutoFree variable($, ($PPVoid)&(pointer) )

//--------------------------------------------------------------------------------------------------
// ARRAY OF POINTERS (AUTO-FREE):

#define $AUTO_FREE_2( p1, p2 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2) } )
#define $AUTO_FREE_3( p1, p2, p3 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3) } )
#define $AUTO_FREE_4( p1, p2, p3, p4 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4) } )
#define $AUTO_FREE_5( p1, p2, p3, p4, p5 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5) } )
#define $AUTO_FREE_6( p1, p2, p3, p4, p5, p6 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6) } )
#define $AUTO_FREE_7( p1, p2, p3, p4, p5, p6, p7 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6), ($PPVoid)&(p7) } )
#define $AUTO_FREE_8( p1, p2, p3, p4, p5, p6, p7, p8 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6), ($PPVoid)&(p7), ($PPVoid)&(p8) } )
#define $AUTO_FREE_9( p1, p2, p3, p4, p5, p6, p7, p8, p9 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6), ($PPVoid)&(p7), ($PPVoid)&(p8), ($PPVoid)&(p9) } )
#define $AUTO_FREE_10( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6), ($PPVoid)&(p7), ($PPVoid)&(p8), ($PPVoid)&(p9), ($PPVoid)&(p10) } )

//--------------------------------------------------------------------------------------------------
// ARRAY OF POINTERS WITH SPECIAL MEM-FREE ROUTINE (AUTO-FREE):

#define $AUTO_FREE_SP_2( specialFreeRoutine, p1, p2 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2) } )
#define $AUTO_FREE_SP_3( specialFreeRoutine, p1, p2, p3 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3) } )
#define $AUTO_FREE_SP_4( specialFreeRoutine, p1, p2, p3, p4 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4) } )
#define $AUTO_FREE_SP_5( specialFreeRoutine, p1, p2, p3, p4, p5 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5) } )
#define $AUTO_FREE_SP_6( specialFreeRoutine, p1, p2, p3, p4, p5, p6 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6) } )
#define $AUTO_FREE_SP_7( specialFreeRoutine, p1, p2, p3, p4, p5, p6, p7 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6), ($PPVoid)&(p7) } )
#define $AUTO_FREE_SP_8( specialFreeRoutine, p1, p2, p3, p4, p5, p6, p7, p8 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6), ($PPVoid)&(p7), ($PPVoid)&(p8) } )
#define $AUTO_FREE_SP_9( specialFreeRoutine, p1, p2, p3, p4, p5, p6, p7, p8, p9 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6), ($PPVoid)&(p7), ($PPVoid)&(p8), ($PPVoid)&(p9) } )
#define $AUTO_FREE_SP_10( specialFreeRoutine, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ) \
   RuntimeForStatic::$AutoFreeArray $IDENT_AUTO($auto_free_array_)($, (specialFreeRoutine), \
      { ($PPVoid)&(p1), ($PPVoid)&(p2), ($PPVoid)&(p3), ($PPVoid)&(p4), ($PPVoid)&(p5), \
        ($PPVoid)&(p6), ($PPVoid)&(p7), ($PPVoid)&(p8), ($PPVoid)&(p9), ($PPVoid)&(p10) } )

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