home *** CD-ROM | disk | FTP | other *** search
- /* Trampoline accessor test */
-
- /*
- * Copyright 1995 Bruno Haible, <haible@ma2s2.mathematik.uni-karlsruhe.de>
- *
- * This is free software distributed under the GNU General Public Licence
- * described in the file COPYING. Contact the author if you don't have this
- * or can't live with it. There is ABSOLUTELY NO WARRANTY, explicit or implied,
- * on this software.
- */
-
- #include <stdio.h>
-
- #include "trampoline.h"
-
- typedef int (*function)();
-
- int f (x)
- int x;
- { return x; }
-
- void* variable;
-
- static int data;
-
- int main ()
- {
- function cf = alloc_trampoline(&f, &variable, &data);
- if (is_trampoline(&main))
- { printf("is_trampoline(&main) returns true!\n"); exit(1); }
- if (!is_trampoline(cf))
- { printf("is_trampoline() returns false!\n"); exit(1); }
- if (trampoline_address(cf) != &f)
- { printf("trampoline_address() doesn't work!\n"); exit(1); }
- if (trampoline_variable(cf) != &variable)
- { printf("trampoline_variable() doesn't work!\n"); exit(1); }
- if (trampoline_data(cf) != &data)
- { printf("trampoline_data() doesn't work!\n"); exit(1); }
- printf("test2 passed.\n");
- exit(0);
- }
-