Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fpvm: accessor functions
  • Loading branch information
Sebastien Bourdeauducq committed Nov 24, 2011
1 parent 60b370e commit 50436b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions software/include/fpvm/fpvm.h
Expand Up @@ -36,6 +36,8 @@

#define FPVM_MAXERRLEN 64

typedef void (*fpvm_bind_callback)(void *, const char *, int);

struct fpvm_binding {
int isvar;
union {
Expand All @@ -49,8 +51,6 @@ struct fpvm_tbinding {
char sym[FPVM_MAXSYMLEN];
};

typedef void (*fpvm_bind_callback)(void *, const char *, int);

struct fpvm_fragment {
char last_error[FPVM_MAXERRLEN];
fpvm_bind_callback bind_callback;
Expand Down Expand Up @@ -98,6 +98,8 @@ struct fpvm_fragment {
const char *fpvm_version();

void fpvm_init(struct fpvm_fragment *fragment, int vector_mode);
const char *fpvm_get_last_error(struct fpvm_fragment *fragment);
void fpvm_set_bind_mode(struct fpvm_fragment *fragment, int bind_mode);
void fpvm_set_bind_callback(struct fpvm_fragment *fragment, fpvm_bind_callback callback, void *user);

int fpvm_bind(struct fpvm_fragment *fragment, const char *sym);
Expand Down
10 changes: 10 additions & 0 deletions software/libfpvm/fpvm.c
Expand Up @@ -72,12 +72,22 @@ void fpvm_init(struct fpvm_fragment *fragment, int vector_mode)
fragment->vector_mode = vector_mode;
}

const char *fpvm_get_last_error(struct fpvm_fragment *fragment)
{
return fragment->last_error;
}

void fpvm_set_bind_callback(struct fpvm_fragment *fragment, fpvm_bind_callback callback, void *user)
{
fragment->bind_callback = callback;
fragment->bind_callback_user = user;
}

void fpvm_set_bind_mode(struct fpvm_fragment *fragment, int bind_mode)
{
fragment->bind_mode = bind_mode;
}

int fpvm_bind(struct fpvm_fragment *fragment, const char *sym)
{
int r;
Expand Down

0 comments on commit 50436b5

Please sign in to comment.