Skip to content

Commit

Permalink
Rename CONCAT to glue
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Apr 6, 2018
1 parent b9c0f6a commit 800a300
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extern int log_override;
#endif
#define TRACE__(msg, ...) printk(msg, ##__VA_ARGS__)

#define TRACE_(chan, msg, ...) CONCAT(TRACE_, chan)(msg, ##__VA_ARGS__)
#define TRACE_(chan, msg, ...) glue(TRACE_, chan)(msg, ##__VA_ARGS__)
#define TRACE(msg, ...) TRACE_(DEFAULT_CHANNEL, msg, ##__VA_ARGS__)
#define TRACELN_(chan, msg, ...) TRACE_(chan, msg "\r\n", ##__VA_ARGS__)
#define TRACELN(msg, ...) TRACE(msg NEWLINE, ##__VA_ARGS__)
Expand Down
2 changes: 1 addition & 1 deletion emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define TRACEI(msg, ...) TRACE(msg "\t", ##__VA_ARGS__)

// this will be the next PyEval_EvalFrameEx.
__no_instrument int CONCAT(decoder_name, OP_SIZE)(struct cpu_state *cpu, struct tlb *tlb) {
__no_instrument int glue(decoder_name, OP_SIZE)(struct cpu_state *cpu, struct tlb *tlb) {
DECLARE_LOCALS;

dword_t addr_offset = 0;
Expand Down
6 changes: 3 additions & 3 deletions emu/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#define sz_64 64
#define sz_80 80
#define sz_128 128
#define twice(x) CONCAT(twice_, x)
#define twice(x) glue(twice_, x)
#define twice_8 16
#define twice_16 32
#define twice_32 64
Expand Down Expand Up @@ -228,7 +228,7 @@
#define SETRES_RAW(result,z)
#define SETRES(result,z) \
cpu->res = (int32_t) (sint(sz(z))) (result); SETRESFLAGS
// sign extend result so SF is correct
// ^ sign extend result so SF is correct
#define ZEROAF cpu->af = cpu->af_ops = 0
#define SETAF(a, b,z) \
cpu->op1 = get(a,z); cpu->op2 = get(b,z); cpu->af_ops = 1
Expand Down Expand Up @@ -342,7 +342,7 @@
} while (0)

// TODO this is probably wrong in some subtle way
#define HALF_OP_SIZE CONCAT(HALF_, OP_SIZE)
#define HALF_OP_SIZE glue(HALF_, OP_SIZE)
#define HALF_16 8
#define HALF_32 16
#define CVT \
Expand Down
8 changes: 4 additions & 4 deletions emu/interp/fpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ static inline extFloat80_t extF80_abs(extFloat80_t f) {
#define get_mem_addr_real(size) mem_read_real(addr, size)
#define set_mem_addr_real(to, size) mem_write_real(addr, to, size)

#define extF80_to_f(f, z) CONCAT(extF80_to_f, sz(z))(f)
#define f_to_extF80(f_, z) CONCAT3(f, sz(z), _to_extF80)(f_)
#define extF80_to_i(i, round, exact, z) CONCAT(extF80_to_i, sz(z))(i, round, exact)
#define i_to_extF80(i_, round, exact, z) CONCAT3(i, sz(z), _to_extF80)(i_, round, exact)
#define extF80_to_f(f, z) glue(extF80_to_f, sz(z))(f)
#define f_to_extF80(f_, z) glue3(f, sz(z), _to_extF80)(f_)
#define extF80_to_i(i, round, exact, z) glue(extF80_to_i, sz(z))(i, round, exact)
#define i_to_extF80(i_, round, exact, z) glue3(i, sz(z), _to_extF80)(i_, round, exact)

#define ST(i) cpu->fp[cpu->top + i]
#define ST_i ST(modrm.rm_opcode)
Expand Down
2 changes: 1 addition & 1 deletion emu/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ typedef uint8_t byte_t;
typedef dword_t addr_t;
typedef dword_t page_t;

#define UINT(size) CONCAT3(uint,size,_t)
#define UINT(size) glue3(uint,size,_t)

#endif
16 changes: 8 additions & 8 deletions misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#include <pthread.h>

// utility macros
#define CONCAT(a, b) _CONCAT(a, b)
#define _CONCAT(a, b) a##b
#define CONCAT3(a,b,c) CONCAT(a, CONCAT(b, c))
#define CONCAT4(a,b,c,d) CONCAT(a, CONCAT3(b, c, d))
#define glue(a, b) _glue(a, b)
#define _glue(a, b) a##b
#define glue3(a,b,c) glue(a, glue(b, c))
#define glue4(a,b,c,d) glue(a, glue3(b, c, d))

#define STR(x) _STR(x)
#define _STR(x) #x
#define str(x) _str(x)
#define _str(x) #x

// keywords
#define bits unsigned int
Expand Down Expand Up @@ -69,8 +69,8 @@ typedef dword_t uid_t_;
typedef word_t mode_t_;
typedef sqword_t off_t_;

#define uint(size) CONCAT3(uint,size,_t)
#define sint(size) CONCAT3(int,size,_t)
#define uint(size) glue3(uint,size,_t)
#define sint(size) glue3(int,size,_t)

typedef pthread_mutex_t lock_t;
#define lock_init(lock) pthread_mutex_init(lock, NULL)
Expand Down

0 comments on commit 800a300

Please sign in to comment.