2009.10.31 Saturday | 08:58

  MLOOP.H ふるいむかし

loop 処理をマクロにしたものですが、
もう、良く覚えていません・・・・
利用サンプルを次の記事に貼ります
MLOOP.H 利用サンプル
#define MLOOP \
   { \
   while(1) { \
      static int sw_continue = 0; \
      if ( sw_continue >= 1 ) { \
         sw_continue = 0; \
         break; \
      } \
      if ( sw_continue <= -1 ) { \
         sw_continue = 0; \
         break; \
      } \

#define MLOOPX(p1,p2,p3) \
   { static int loop_dummy; \
   loop_dummy = 0; \
   while(1) { \
      static int sw_continue = 0; \
      if ( loop_dummy == 0 ) { \
         p1; \
         loop_dummy = 1; \
      } \
      else { \
         p3; \
      } \
      if ( sw_continue >= 1 ) { \
         sw_continue = 0; \
         break; \
      } \
      if ( sw_continue <= -1 ) { \
         sw_continue = 0; \
         break; \
      } \
      if ( (p2) == 0 ) { \
         break; \
      }

#define LOOP \
   { \
   while(1) { \
      if ( sw_continue >= 1 ) { \
         sw_continue--; \
         break; \
      } \
      if ( sw_continue <= -1 ) { \
         break; \
      } \

#define LOOPX(p1,p2,p3) \
   { static int loop_dummy; \
   loop_dummy = 0; \
   while(1) { \
      if ( loop_dummy == 0 ) { \
         p1; \
         loop_dummy = 1; \
      } \
      else { \
         p3; \
      } \
      if ( sw_continue >= 1 ) { \
         sw_continue--; \
         break; \
      } \
      if ( sw_continue <= -1 ) { \
         break; \
      } \
      if ( (p2) == 0 ) { \
         break; \
      }

#define CONTINUE(a) \
   sw_continue = -1 * a; \
   continue;

#define BREAK(a) \
   sw_continue = a; \
   continue;

#define END \
   }}

#define ENDMAIN \
   }}

#define ENDLOOP \
   } \
   if ( sw_continue >= 1 ) { \
      continue; \
   } \
   if ( sw_continue <= -1 ) { \
      sw_continue++; \
      continue; \
   }}