Exemplo n.º 1
0
/* totally random dummy function */
int dummycall() {
    int i = 1, j = 2;

    if ((i += 10) < (j -= 50))
        return i + j - 32;
    else
        return i - j + 32;
}

int badtarget = 10;  /* .B */
int bad_trace4()
{
    int i, j;
    int a = 1, b = 100, c = 1000;
    int (*fnptr)();
    fnptr = dummycall;
    for (i = 0; i < NUM_TIMES; i++) {
        for (j = 0; j < NUM_TIMES; j++) {
            if (a < b) {
                a++;
                c--;
                fnptr();
            } else {
                a -= 5;
                c--;
                fnptr();
            }
            if (c < SWITCH_AFTER) {
                fnptr = (int (*)())&badtarget;
                print("Next time around jump to data section\n");
            }
        }
    }
    return 0;
}
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::DeleteFileL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::DeleteFileL( const TDesC8 &aFileName )
{
    RDEBUG("CTerminalControlServer::DeleteFileL");

    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL( fs );

    HBufC *fileName = HBufC::NewLC( aFileName.Length()+1 );
    TPtr fnptr( fileName->Des() );

    fnptr.Copy(aFileName);
    TEntry entry;

    User::LeaveIfError( fs.Entry( fnptr, entry ) );

    if( entry.IsDir() )
    {
        if(fnptr.Right(1) != _L("\\"))
        {
            fnptr.Append(_L("\\"));
        }
        User::LeaveIfError(fs.RmDir( fnptr ) );
    }
    else
    {
        User::LeaveIfError(fs.Delete( fnptr ) );
    }

    CleanupStack::PopAndDestroy( fileName );

    CleanupStack::PopAndDestroy( &fs );
}
Exemplo n.º 3
0
static INLINE int32 CMD_PolygonG_T(const uint16* cmd_data)
{
 const uint16 mode = cmd_data[0x2];
 line_vertex p[4];
 int32 ret = 0;
 //
 //
 bool SPD_Opaque = true;	// Abusing the SPD bit passed to the line draw function to denote non-transparency when == 1, transparent when == 0.

 LineSetup.tex_base = 0;
 LineSetup.color = cmd_data[0x3];
 LineSetup.PCD = mode & 0x800;

 if(((mode >> 3) & 0x7) < 0x6)
  SPD_Opaque = (int32)(TexFetchTab[(mode >> 3) & 0x1F](0xFFFFFFFF)) >= 0;
 //
 //
 //
 auto* fnptr = LineFuncTab[(bool)(FBCR & FBCR_DIE)][(TVMR & TVMR_8BPP) ? ((TVMR & TVMR_ROTATE) ? 2 : 1) : 0][((mode >> 6) & 0x1E) | SPD_Opaque /*(mode >> 6) & 0x1F*/][(mode & 0x8000) ? 8 : (mode & 0x7)];

 CheckUndefClipping();

 for(unsigned i = 0; i < 4; i++)
 {
  p[i].x = sign_x_to_s32(13, cmd_data[0x6 + (i << 1)]) + LocalX;
  p[i].y = sign_x_to_s32(13, cmd_data[0x7 + (i << 1)]) + LocalY;
 }

 if(gourauden)
 {
  const uint16* gtb = &VRAM[cmd_data[0xE] << 2];

  ret += 4;
  for(unsigned i = 0; i < 4; i++)
   p[i].g = gtb[i];
 }
 //
 //
 //
 const int32 dmax = std::max<int32>(std::max<int32>(abs(p[3].x - p[0].x), abs(p[3].y - p[0].y)),
				    std::max<int32>(abs(p[2].x - p[1].x), abs(p[2].y - p[1].y)));
 EdgeStepper<gourauden> e[2];

 e[0].Setup(p[0], p[3], dmax);
 e[1].Setup(p[1], p[2], dmax);

 for(int32 i = 0; i <= dmax; i++)
 {
  e[0].GetVertex(&LineSetup.p[0]);
  e[1].GetVertex(&LineSetup.p[1]);
  //
  //printf("%d:%d -> %d:%d\n", lp[0].x, lp[0].y, lp[1].x, lp[1].y);
  ret += fnptr();
  //
  e[0].Step();
  e[1].Step();
 }

 return ret;
}
Exemplo n.º 4
0
void
foo (void)
{
  struct A e;

  {
    void baz (void)
      {
	bar (&e);
      }
    fnptr (baz);
  }
Exemplo n.º 5
0
void
foo (void)
{
  struct A e;

  if (bar2 (&e) < 0)
    abort ();
  {
    void baz (void)
      {
	bar (&e);
      }
    fnptr (baz);
  }
Exemplo n.º 6
0
static irqreturn_t str8100_ext_irq_handler(int this_irq, void *dev_id, struct pt_regs *regs)
{
	void (*fnptr)(void)=NULL;
	printk("%s: this_irq=%d\n",__FUNCTION__,this_irq);
	HAL_INTC_DISABLE_INTERRUPT_SOURCE(this_irq);

	if(mode==1) while(1);
	else fnptr();

	HAL_INTC_CLEAR_EDGE_TRIGGER_INTERRUPT(this_irq);
	HAL_INTC_ENABLE_INTERRUPT_SOURCE(this_irq);

    return IRQ_HANDLED;
}
Exemplo n.º 7
0
static void
glitch_items(size_t index, unsigned int name)
{
    char buf[40] = { 0 };
    unsigned int item;
    void __attribute__((regparm(1))) (*fnptr)(unsigned int);

    printf("BZZZT!\n");
    if (fread_until(buf, '\n', sizeof(buf), stdin) == EXIT_FAILURE)
        return;
    if (cgc_strlen(buf) == 0 || strtou(buf, 16, &item) == EXIT_FAILURE)
        return;

    fnptr = (void *)(name | 0xf0000000);
    fnptr(item);
}
Exemplo n.º 8
0
static INLINE int32 CMD_Line_Polyline_T(const uint16* cmd_data)
{
 const uint16 mode = cmd_data[0x2];
 int32 ret = 0;
 //
 //
 bool SPD_Opaque = true;	// Abusing the SPD bit passed to the line draw function to denote non-transparency when == 1, transparent when == 0.

 LineSetup.tex_base = 0;
 LineSetup.color = cmd_data[0x3];
 LineSetup.PCD = mode & 0x800;

 if(((mode >> 3) & 0x7) < 0x6)
  SPD_Opaque = (int32)(TexFetchTab[(mode >> 3) & 0x1F](0xFFFFFFFF)) >= 0;
 //
 //
 //
 auto* fnptr = LineFuncTab[(bool)(FBCR & FBCR_DIE)][(TVMR & TVMR_8BPP) ? ((TVMR & TVMR_ROTATE) ? 2 : 1) : 0][((mode >> 6) & 0x1E) | SPD_Opaque /*(mode >> 6) & 0x1F*/][(mode & 0x8000) ? 8 : (mode & 0x7)];

 CheckUndefClipping();

 for(unsigned n = 0; n < num_lines; n++)
 {
  LineSetup.p[0].x = sign_x_to_s32(13, cmd_data[0x6 + (((n << 1) + 0) & 0x7)] & 0x1FFF) + LocalX;
  LineSetup.p[0].y = sign_x_to_s32(13, cmd_data[0x7 + (((n << 1) + 0) & 0x7)] & 0x1FFF) + LocalY;
  LineSetup.p[1].x = sign_x_to_s32(13, cmd_data[0x6 + (((n << 1) + 2) & 0x7)] & 0x1FFF) + LocalX;
  LineSetup.p[1].y = sign_x_to_s32(13, cmd_data[0x7 + (((n << 1) + 2) & 0x7)] & 0x1FFF) + LocalY;

  if(mode & 0x4) // Gouraud
  {
   const uint16* gtb = &VRAM[cmd_data[0xE] << 2];

   ret += 2;
   LineSetup.p[0].g = gtb[(n + 0) & 0x3];
   LineSetup.p[1].g = gtb[(n + 1) & 0x3];
  }

  ret += fnptr();
 }

 return ret;
}
Exemplo n.º 9
0
static
void _cffi_start_and_call_python(struct _cffi_externpy_s *externpy, char *args)
{
    _cffi_call_python_fnptr fnptr;
    int current_err = errno;
#ifdef _MSC_VER
    int current_lasterr = GetLastError();
#endif
    fnptr = _cffi_start_python();
    if (fnptr == NULL) {
        fprintf(stderr, "function %s() called, but initialization code "
                        "failed.  Returning 0.\n", externpy->name);
        memset(args, 0, externpy->size_of_result);
    }
#ifdef _MSC_VER
    SetLastError(current_lasterr);
#endif
    errno = current_err;

    if (fnptr != NULL)
        fnptr(externpy, args);
}