Пример #1
0
/* handler for function 3 */
static Obj  HdlrFunc3 (
 Obj  self,
 Obj  a_a,
 Obj  a_b,
 Obj  a_c )
{
 Obj t_1 = 0;
 Bag oldFrame;
 
 /* allocate new stack frame */
 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
 
 /* return [ a, b .. c ]; */
 t_1 = Range3Check( a_a, a_b, a_c );
 SWITCH_TO_OLD_FRAME(oldFrame);
 return t_1;
 
 /* return; */
 SWITCH_TO_OLD_FRAME(oldFrame);
 return 0;
}
Пример #2
0
Файл: c_filt1.c Проект: gxyd/gap
/* handler for function 2 */
static Obj  HdlrFunc2 (
 Obj  self,
 Obj  a_filter )
{
 Obj l_i = 0;
 Obj l_flags = 0;
 Obj t_1 = 0;
 Obj t_2 = 0;
 Obj t_3 = 0;
 Obj t_4 = 0;
 Obj t_5 = 0;
 Obj t_6 = 0;
 Obj t_7 = 0;
 Obj t_8 = 0;
 Obj t_9 = 0;
 Obj t_10 = 0;
 Bag oldFrame;
 OLD_BRK_CURR_STAT
 
 /* allocate new stack frame */
 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
 REM_BRK_CURR_STAT();
 SET_BRK_CURR_STAT(0);
 
 /* flags := FLAGS_FILTER( filter ); */
 t_2 = GF_FLAGS__FILTER;
 t_1 = CALL_1ARGS( t_2, a_filter );
 CHECK_FUNC_RESULT( t_1 )
 l_flags = t_1;
 
 /* for i in [ 1, 3 .. LEN_LIST( WITH_HIDDEN_IMPS_FLAGS_CACHE ) - 1 ] do */
 t_7 = GF_LEN__LIST;
 t_8 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE;
 CHECK_BOUND( t_8, "WITH_HIDDEN_IMPS_FLAGS_CACHE" )
 t_6 = CALL_1ARGS( t_7, t_8 );
 CHECK_FUNC_RESULT( t_6 )
 C_DIFF_FIA( t_5, t_6, INTOBJ_INT(1) )
 t_4 = Range3Check( INTOBJ_INT(1), INTOBJ_INT(3), t_5 );
 if ( IS_SMALL_LIST(t_4) ) {
  t_3 = (Obj)(UInt)1;
  t_1 = INTOBJ_INT(1);
 }
 else {
  t_3 = (Obj)(UInt)0;
  t_1 = CALL_1ARGS( GF_ITERATOR, t_4 );
 }
 while ( 1 ) {
  if ( t_3 ) {
   if ( LEN_LIST(t_4) < INT_INTOBJ(t_1) )  break;
   t_2 = ELMV0_LIST( t_4, INT_INTOBJ(t_1) );
   t_1 = (Obj)(((UInt)t_1)+4);
   if ( t_2 == 0 )  continue;
  }
  else {
   if ( CALL_1ARGS( GF_IS_DONE_ITER, t_1 ) != False )  break;
   t_2 = CALL_1ARGS( GF_NEXT_ITER, t_1 );
  }
  l_i = t_2;
  
  /* if IsBound( WITH_HIDDEN_IMPS_FLAGS_CACHE[i] ) then */
  t_7 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE;
  CHECK_BOUND( t_7, "WITH_HIDDEN_IMPS_FLAGS_CACHE" )
  CHECK_INT_POS( l_i )
  t_6 = C_ISB_LIST( t_7, l_i );
  t_5 = (Obj)(UInt)(t_6 != False);
  if ( t_5 ) {
   
   /* if IS_SUBSET_FLAGS( WITH_HIDDEN_IMPS_FLAGS_CACHE[i + 1], flags ) then */
   t_7 = GF_IS__SUBSET__FLAGS;
   t_9 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE;
   CHECK_BOUND( t_9, "WITH_HIDDEN_IMPS_FLAGS_CACHE" )
   C_SUM_FIA( t_10, l_i, INTOBJ_INT(1) )
   CHECK_INT_POS( t_10 )
   C_ELM_LIST_FPL( t_8, t_9, t_10 )
   t_6 = CALL_2ARGS( t_7, t_8, l_flags );
   CHECK_FUNC_RESULT( t_6 )
   CHECK_BOOL( t_6 )
   t_5 = (Obj)(UInt)(t_6 != False);
   if ( t_5 ) {
    
    /* Unbind( WITH_HIDDEN_IMPS_FLAGS_CACHE[i] ); */
    t_5 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE;
    CHECK_BOUND( t_5, "WITH_HIDDEN_IMPS_FLAGS_CACHE" )
    C_UNB_LIST( t_5, l_i );
    
    /* Unbind( WITH_HIDDEN_IMPS_FLAGS_CACHE[i + 1] ); */
    t_5 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE;
    CHECK_BOUND( t_5, "WITH_HIDDEN_IMPS_FLAGS_CACHE" )
    C_SUM_FIA( t_6, l_i, INTOBJ_INT(1) )
    CHECK_INT_POS( t_6 )
    C_UNB_LIST( t_5, t_6 );
    
   }
   /* fi */
   
  }
  /* fi */
  
 }
 /* od */
 
 /* return; */
 RES_BRK_CURR_STAT();
 SWITCH_TO_OLD_FRAME(oldFrame);
 return 0;
 
 /* return; */
 RES_BRK_CURR_STAT();
 SWITCH_TO_OLD_FRAME(oldFrame);
 return 0;
}
Пример #3
0
/* handler for function 4 */
static Obj  HdlrFunc4 (
 Obj  self )
{
 Obj t_1 = 0;
 Obj t_2 = 0;
 Obj t_3 = 0;
 Obj t_4 = 0;
 Obj t_5 = 0;
 Bag oldFrame;
 
 /* allocate new stack frame */
 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
 
 /* BreakOnError := false; */
 t_1 = False;
 AssGVar( G_BreakOnError, t_1 );
 
 /* CALL_WITH_CATCH( range2, [ 1, 2 ^ 80 ] ); */
 t_1 = GF_CALL__WITH__CATCH;
 t_2 = GC_range2;
 CHECK_BOUND( t_2, "range2" )
 t_3 = NEW_PLIST( T_PLIST, 2 );
 SET_LEN_PLIST( t_3, 2 );
 SET_ELM_PLIST( t_3, 1, INTOBJ_INT(1) );
 t_4 = POW( INTOBJ_INT(2), INTOBJ_INT(80) );
 SET_ELM_PLIST( t_3, 2, t_4 );
 CHANGED_BAG( t_3 );
 CALL_2ARGS( t_1, t_2, t_3 );
 
 /* CALL_WITH_CATCH( range2, [ - 2 ^ 80, 0 ] ); */
 t_1 = GF_CALL__WITH__CATCH;
 t_2 = GC_range2;
 CHECK_BOUND( t_2, "range2" )
 t_3 = NEW_PLIST( T_PLIST, 2 );
 SET_LEN_PLIST( t_3, 2 );
 t_5 = POW( INTOBJ_INT(2), INTOBJ_INT(80) );
 C_AINV_FIA( t_4, t_5 )
 SET_ELM_PLIST( t_3, 1, t_4 );
 CHANGED_BAG( t_3 );
 SET_ELM_PLIST( t_3, 2, INTOBJ_INT(0) );
 CALL_2ARGS( t_1, t_2, t_3 );
 
 /* CALL_WITH_CATCH( range3, [ 1, 2, 2 ^ 80 ] ); */
 t_1 = GF_CALL__WITH__CATCH;
 t_2 = GC_range3;
 CHECK_BOUND( t_2, "range3" )
 t_3 = NEW_PLIST( T_PLIST, 3 );
 SET_LEN_PLIST( t_3, 3 );
 SET_ELM_PLIST( t_3, 1, INTOBJ_INT(1) );
 SET_ELM_PLIST( t_3, 2, INTOBJ_INT(2) );
 t_4 = POW( INTOBJ_INT(2), INTOBJ_INT(80) );
 SET_ELM_PLIST( t_3, 3, t_4 );
 CHANGED_BAG( t_3 );
 CALL_2ARGS( t_1, t_2, t_3 );
 
 /* CALL_WITH_CATCH( range3, [ - 2 ^ 80, 0, 1 ] ); */
 t_1 = GF_CALL__WITH__CATCH;
 t_2 = GC_range3;
 CHECK_BOUND( t_2, "range3" )
 t_3 = NEW_PLIST( T_PLIST, 3 );
 SET_LEN_PLIST( t_3, 3 );
 t_5 = POW( INTOBJ_INT(2), INTOBJ_INT(80) );
 C_AINV_FIA( t_4, t_5 )
 SET_ELM_PLIST( t_3, 1, t_4 );
 CHANGED_BAG( t_3 );
 SET_ELM_PLIST( t_3, 2, INTOBJ_INT(0) );
 SET_ELM_PLIST( t_3, 3, INTOBJ_INT(1) );
 CALL_2ARGS( t_1, t_2, t_3 );
 
 /* CALL_WITH_CATCH( range3, [ 0, 2 ^ 80, 2 ^ 81 ] ); */
 t_1 = GF_CALL__WITH__CATCH;
 t_2 = GC_range3;
 CHECK_BOUND( t_2, "range3" )
 t_3 = NEW_PLIST( T_PLIST, 3 );
 SET_LEN_PLIST( t_3, 3 );
 SET_ELM_PLIST( t_3, 1, INTOBJ_INT(0) );
 t_4 = POW( INTOBJ_INT(2), INTOBJ_INT(80) );
 SET_ELM_PLIST( t_3, 2, t_4 );
 CHANGED_BAG( t_3 );
 t_4 = POW( INTOBJ_INT(2), INTOBJ_INT(81) );
 SET_ELM_PLIST( t_3, 3, t_4 );
 CHANGED_BAG( t_3 );
 CALL_2ARGS( t_1, t_2, t_3 );
 
 /* Display( [ 1, 2 .. 2 ] ); */
 t_1 = GF_Display;
 t_2 = Range3Check( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(2) );
 CALL_1ARGS( t_1, t_2 );
 
 /* CALL_WITH_CATCH( range3, [ 2, 2, 2 ] ); */
 t_1 = GF_CALL__WITH__CATCH;
 t_2 = GC_range3;
 CHECK_BOUND( t_2, "range3" )
 t_3 = NEW_PLIST( T_PLIST, 3 );
 SET_LEN_PLIST( t_3, 3 );
 SET_ELM_PLIST( t_3, 1, INTOBJ_INT(2) );
 SET_ELM_PLIST( t_3, 2, INTOBJ_INT(2) );
 SET_ELM_PLIST( t_3, 3, INTOBJ_INT(2) );
 CALL_2ARGS( t_1, t_2, t_3 );
 
 /* Display( [ 2, 4 .. 6 ] ); */
 t_1 = GF_Display;
 t_2 = Range3Check( INTOBJ_INT(2), INTOBJ_INT(4), INTOBJ_INT(6) );
 CALL_1ARGS( t_1, t_2 );
 
 /* CALL_WITH_CATCH( range3, [ 2, 4, 7 ] ); */
 t_1 = GF_CALL__WITH__CATCH;
 t_2 = GC_range3;
 CHECK_BOUND( t_2, "range3" )
 t_3 = NEW_PLIST( T_PLIST, 3 );
 SET_LEN_PLIST( t_3, 3 );
 SET_ELM_PLIST( t_3, 1, INTOBJ_INT(2) );
 SET_ELM_PLIST( t_3, 2, INTOBJ_INT(4) );
 SET_ELM_PLIST( t_3, 3, INTOBJ_INT(7) );
 CALL_2ARGS( t_1, t_2, t_3 );
 
 /* Display( [ 2, 4 .. 2 ] ); */
 t_1 = GF_Display;
 t_2 = Range3Check( INTOBJ_INT(2), INTOBJ_INT(4), INTOBJ_INT(2) );
 CALL_1ARGS( t_1, t_2 );
 
 /* Display( [ 2, 4 .. 0 ] ); */
 t_1 = GF_Display;
 t_2 = Range3Check( INTOBJ_INT(2), INTOBJ_INT(4), INTOBJ_INT(0) );
 CALL_1ARGS( t_1, t_2 );
 
 /* CALL_WITH_CATCH( range3, [ 4, 2, 1 ] ); */
 t_1 = GF_CALL__WITH__CATCH;
 t_2 = GC_range3;
 CHECK_BOUND( t_2, "range3" )
 t_3 = NEW_PLIST( T_PLIST, 3 );
 SET_LEN_PLIST( t_3, 3 );
 SET_ELM_PLIST( t_3, 1, INTOBJ_INT(4) );
 SET_ELM_PLIST( t_3, 2, INTOBJ_INT(2) );
 SET_ELM_PLIST( t_3, 3, INTOBJ_INT(1) );
 CALL_2ARGS( t_1, t_2, t_3 );
 
 /* Display( [ 4, 2 .. 0 ] ); */
 t_1 = GF_Display;
 t_2 = Range3Check( INTOBJ_INT(4), INTOBJ_INT(2), INTOBJ_INT(0) );
 CALL_1ARGS( t_1, t_2 );
 
 /* Display( [ 4, 2 .. 8 ] ); */
 t_1 = GF_Display;
 t_2 = Range3Check( INTOBJ_INT(4), INTOBJ_INT(2), INTOBJ_INT(8) );
 CALL_1ARGS( t_1, t_2 );
 
 /* return; */
 SWITCH_TO_OLD_FRAME(oldFrame);
 return 0;
 
 /* return; */
 SWITCH_TO_OLD_FRAME(oldFrame);
 return 0;
}