From b411fb9f0b05526d3f4fe351a91a61b42f278c23 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Fri, 2 May 2008 19:12:20 +0000 Subject: [PATCH] Getting started using the assembler API --- src/target/sparc64.c | 39 +++++++++++++++++++++++++++++++++++++++ src/target/target.h | 10 ++++++++++ 2 files changed, 49 insertions(+) diff --git a/src/target/sparc64.c b/src/target/sparc64.c index 2bbf7bd..b1f5c40 100644 --- a/src/target/sparc64.c +++ b/src/target/sparc64.c @@ -16,7 +16,46 @@ +#include +#include #include "target.h" /* sparc64 */ +/* private */ +/* variables */ +As * as; + + +/* protected */ +/* prototypes */ +static int _sparc64_init(char const * arch, char const * format); +static int _sparc64_exit(void); + + +/* public */ +/* variables */ +TargetPlugin target_plugin = +{ + _sparc64_init, + _sparc64_exit +}; + + +/* protected */ +/* functions */ +/* sparc64_init */ +static int _sparc64_init(char const * arch, char const * format) +{ + if((as = as_new(arch, format)) == NULL) + return 1; + return 0; +} + + +/* sparc64_exit */ +static int _sparc64_exit(void) +{ + as_delete(as); + return 0; +} diff --git a/src/target/target.h b/src/target/target.h index 6e61698..1e016a5 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -22,6 +22,16 @@ /* Target */ /* protected */ +/* types */ typedef struct _Target Target; + +/* public */ +/* types */ +typedef struct _TargetPlugin +{ + int (*init)(char const *, char const *); + int (*exit)(void); +} TargetPlugin; + #endif /* !_C99_TARGET_TARGET_H */