Permalink
Browse files

libfpvm: rename "struct sym" to "struct fpvm_sym"

  • Loading branch information...
1 parent 99f2502 commit 8dbe0fd7cabc81690f0dd852da64c9029ffcf8b6 @wpwrak wpwrak committed Jan 11, 2012
Showing with 26 additions and 24 deletions.
  1. +1 −1 software/include/fpvm/ast.h
  2. +10 −10 software/include/fpvm/fpvm.h
  3. +1 −1 software/include/fpvm/symbol.h
  4. +14 −12 software/libfpvm/fpvm.c
@@ -59,7 +59,7 @@ struct ast_branches {
struct ast_node {
enum ast_op op;
- struct sym *sym;
+ struct fpvm_sym *sym;
union {
struct ast_branches branches;
float constant;
@@ -38,19 +38,19 @@
#define FPVM_MAXERRLEN 64
-typedef void (*fpvm_bind_callback)(void *, struct sym *, int);
+typedef void (*fpvm_bind_callback)(void *, struct fpvm_sym *, int);
struct fpvm_binding {
int isvar;
union {
float c;
- struct sym *v;
+ struct fpvm_sym *v;
} b;
};
struct fpvm_tbinding {
int reg;
- struct sym *sym;
+ struct fpvm_sym *sym;
};
enum {
@@ -103,7 +103,7 @@ struct fpvm_fragment {
int vector_mode;
};
-extern struct sym *_Xi, *_Yi, *_Xo, *_Yo;
+extern struct fpvm_sym *_Xi, *_Yi, *_Xo, *_Yo;
const char *fpvm_version(void);
@@ -112,13 +112,13 @@ 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, struct sym *sym);
-void fpvm_set_xin(struct fpvm_fragment *fragment, struct sym *sym);
-void fpvm_set_yin(struct fpvm_fragment *fragment, struct sym *sym);
-void fpvm_set_xout(struct fpvm_fragment *fragment, struct sym *sym);
-void fpvm_set_yout(struct fpvm_fragment *fragment, struct sym *sym);
+int fpvm_bind(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
+void fpvm_set_xin(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
+void fpvm_set_yin(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
+void fpvm_set_xout(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
+void fpvm_set_yout(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
-int fpvm_do_assign(struct fpvm_fragment *fragment, struct sym *dest,
+int fpvm_do_assign(struct fpvm_fragment *fragment, struct fpvm_sym *dest,
struct ast_node *n);
void fpvm_get_references(struct fpvm_fragment *fragment, int *references);
@@ -11,7 +11,7 @@
#ifndef __FPVM_SYMBOL_H
#define __FPVM_SYMBOL_H
-struct sym {
+struct fpvm_sym {
const char *name;
};
View
@@ -24,9 +24,10 @@
#include <fpvm/ast.h>
-struct sym *_Xi, *_Yi, *_Xo, *_Yo; /* unique, provided by user of libfpvm */
+struct fpvm_sym *_Xi, *_Yi, *_Xo, *_Yo;
+ /* unique, provided by user of libfpvm */
-static struct sym dummy_sym = { .name = "" };
+static struct fpvm_sym dummy_sym = { .name = "" };
const char *fpvm_version(void)
{
@@ -80,7 +81,7 @@ void fpvm_set_bind_mode(struct fpvm_fragment *fragment, int bind_mode)
fragment->bind_mode = bind_mode;
}
-int fpvm_bind(struct fpvm_fragment *fragment, struct sym *sym)
+int fpvm_bind(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
int r;
@@ -97,27 +98,27 @@ int fpvm_bind(struct fpvm_fragment *fragment, struct sym *sym)
return r;
}
-void fpvm_set_xin(struct fpvm_fragment *fragment, struct sym *sym)
+void fpvm_set_xin(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
fragment->bindings[0].b.v = sym;
}
-void fpvm_set_yin(struct fpvm_fragment *fragment, struct sym *sym)
+void fpvm_set_yin(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
fragment->bindings[1].b.v = sym;
}
-void fpvm_set_xout(struct fpvm_fragment *fragment, struct sym *sym)
+void fpvm_set_xout(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
fragment->tbindings[0].sym = sym;
}
-void fpvm_set_yout(struct fpvm_fragment *fragment, struct sym *sym)
+void fpvm_set_yout(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
fragment->tbindings[1].sym = sym;
}
-static int lookup(struct fpvm_fragment *fragment, struct sym *sym)
+static int lookup(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
int i;
@@ -134,7 +135,7 @@ static int lookup(struct fpvm_fragment *fragment, struct sym *sym)
return FPVM_INVALID_REG;
}
-static int tbind(struct fpvm_fragment *fragment, struct sym *sym)
+static int tbind(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
if(fragment->ntbindings == FPVM_MAXTBINDINGS) {
snprintf(fragment->last_error, FPVM_MAXERRLEN,
@@ -147,7 +148,8 @@ static int tbind(struct fpvm_fragment *fragment, struct sym *sym)
return fragment->next_sur--;
}
-static int rename_reg(struct fpvm_fragment *fragment, struct sym *sym, int reg)
+static int rename_reg(struct fpvm_fragment *fragment, struct fpvm_sym *sym,
+ int reg)
{
int i;
@@ -168,7 +170,7 @@ static int rename_reg(struct fpvm_fragment *fragment, struct sym *sym, int reg)
return 1;
}
-static int sym_to_reg(struct fpvm_fragment *fragment, struct sym *sym,
+static int sym_to_reg(struct fpvm_fragment *fragment, struct fpvm_sym *sym,
int dest, int *created)
{
int r;
@@ -557,7 +559,7 @@ static void fragment_restore(struct fpvm_fragment *fragment,
fragment->ninstructions = backup->ninstructions;
}
-int fpvm_do_assign(struct fpvm_fragment *fragment, struct sym *dest,
+int fpvm_do_assign(struct fpvm_fragment *fragment, struct fpvm_sym *dest,
struct ast_node *n)
{
int dest_reg;

0 comments on commit 8dbe0fd

Please sign in to comment.