Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions
stub_test.cpp File Reference
#include <stdio.h>

Go to the source code of this file.

Classes

class  base
class  foo
class  bar
class  baz

Defines

#define NS_IMETHOD   virtual nsresult
#define NS_IMETHODIMP   nsresult
#define STUB_ENTRY(n)

Typedefs

typedef unsigned nsresult
typedef unsigned PRUint32
typedef unsigned nsXPCVariant

Functions

void docall (foo *f, int i, int j)
static int PrepareAndDispatch (baz *self, PRUint32 methodIndex, PRUint32 *args)
int main ()
 main()

Define Documentation

#define NS_IMETHOD   virtual nsresult

Definition at line 13 of file stub_test.cpp.

Definition at line 14 of file stub_test.cpp.

Value:
nsresult baz::callme##n() \
{ \
  register void* method = PrepareAndDispatch; \
  register nsresult result; \
  __asm__ __volatile__( \
    "leal   0x0c(%%ebp), %%ecx\n\t"    /* args */ \
    "pushl  %%ecx\n\t" \
    "pushl  $"#n"\n\t"                 /* method index */ \
    "movl   0x08(%%ebp), %%ecx\n\t"    /* this */ \
    "pushl  %%ecx\n\t" \
    "call   *%%edx"                    /* PrepareAndDispatch */ \
    : "=a" (result)     /* %0 */ \
    : "d" (method)      /* %1 */ \
    : "memory" ); \
    return result; \
}

Definition at line 168 of file stub_test.cpp.


Typedef Documentation

typedef unsigned nsresult

Definition at line 4 of file stub_test.cpp.

typedef unsigned nsXPCVariant

Definition at line 6 of file stub_test.cpp.

typedef unsigned PRUint32

Definition at line 5 of file stub_test.cpp.


Function Documentation

void docall ( foo f,
int  i,
int  j 
)

Definition at line 70 of file stub_test.cpp.

                                 {
  f->callme1(i, j); 
}

Here is the call graph for this function:

int main ( void  )

main()

Definition at line 193 of file stub_test.cpp.

{
  foo* a = new bar();
  baz* b = new baz();

  /* here we make the global 'check for alloc failure' checker happy */
  if(!a || !b)
    return 1;
  
  foo* c = (foo*)b;

  b->setfoo(a);
  c->callme1(1,2);
  c->callme2(2,4);
  c->callme3(3,6);

  return 0;
}

Here is the call graph for this function:

static int PrepareAndDispatch ( baz self,
PRUint32  methodIndex,
PRUint32 args 
) [static]

Definition at line 154 of file stub_test.cpp.

{
    foo* a = self->other;
    int p1 = (int) *args;
    int p2 = (int) *(args+1);
    switch(methodIndex)
    {
    case 1: a->callme1(p1, p2); break;
    case 2: a->callme2(p1, p2); break;
    case 3: a->callme3(p1, p2); break;
    }
    return 1;
}

Here is the call graph for this function: