Move common headers to common.h, remove util and debugger from being first class include directories

This commit is contained in:
Jeffrey Pfau 2014-04-02 23:50:20 -07:00
parent 73d32e7cc7
commit ecb1939ff1
55 changed files with 98 additions and 107 deletions

View File

@ -16,8 +16,7 @@ source_group("GBA board" FILES ${GBA_SRC} ${RENDERER_SRC})
source_group("Utilities" FILES ${UTIL_SRC}) source_group("Utilities" FILES ${UTIL_SRC})
include_directories(${CMAKE_SOURCE_DIR}/src/arm) include_directories(${CMAKE_SOURCE_DIR}/src/arm)
include_directories(${CMAKE_SOURCE_DIR}/src/gba) include_directories(${CMAKE_SOURCE_DIR}/src/gba)
include_directories(${CMAKE_SOURCE_DIR}/src/debugger) include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${CMAKE_SOURCE_DIR}/src/util)
if(WIN32) if(WIN32)
add_definitions(-D_WIN32_WINNT=0x0600) add_definitions(-D_WIN32_WINNT=0x0600)

View File

@ -4,8 +4,6 @@
#include "isa-inlines.h" #include "isa-inlines.h"
#include "isa-thumb.h" #include "isa-thumb.h"
#include <limits.h>
static inline enum RegisterBank _ARMSelectBank(enum PrivilegeMode); static inline enum RegisterBank _ARMSelectBank(enum PrivilegeMode);
void ARMSetPrivilegeMode(struct ARMCore* cpu, enum PrivilegeMode mode) { void ARMSetPrivilegeMode(struct ARMCore* cpu, enum PrivilegeMode mode) {

View File

@ -1,19 +1,7 @@
#ifndef ARM_H #ifndef ARM_H
#define ARM_H #define ARM_H
#include <stdint.h> #include "common.h"
#ifdef __POWERPC__
#define LOAD_32(DEST, ADDR, ARR) asm("lwbrx %0, %1, %2" : "=r"(DEST) : "r"(ADDR), "r"(ARR))
#define LOAD_16(DEST, ADDR, ARR) asm("lhbrx %0, %1, %2" : "=r"(DEST) : "r"(ADDR), "r"(ARR))
#define STORE_32(SRC, ADDR, ARR) asm("stwbrx %0, %1, %2" : : "r"(SRC), "r"(ADDR), "r"(ARR))
#define STORE_16(SRC, ADDR, ARR) asm("sthbrx %0, %1, %2" : : "r"(SRC), "r"(ADDR), "r"(ARR))
#else
#define LOAD_32(DEST, ADDR, ARR) DEST = ((uint32_t*) ARR)[(ADDR) >> 2]
#define LOAD_16(DEST, ADDR, ARR) DEST = ((uint16_t*) ARR)[(ADDR) >> 1]
#define STORE_32(SRC, ADDR, ARR) ((uint32_t*) ARR)[(ADDR) >> 2] = SRC
#define STORE_16(SRC, ADDR, ARR) ((uint16_t*) ARR)[(ADDR) >> 1] = SRC
#endif
enum { enum {
ARM_SP = 13, ARM_SP = 13,

26
src/arm/common.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef COMMON_H
#define COMMON_H
#include <limits.h>
#include <math.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef __POWERPC__
#define LOAD_32(DEST, ADDR, ARR) asm("lwbrx %0, %1, %2" : "=r"(DEST) : "r"(ADDR), "r"(ARR))
#define LOAD_16(DEST, ADDR, ARR) asm("lhbrx %0, %1, %2" : "=r"(DEST) : "r"(ADDR), "r"(ARR))
#define STORE_32(SRC, ADDR, ARR) asm("stwbrx %0, %1, %2" : : "r"(SRC), "r"(ADDR), "r"(ARR))
#define STORE_16(SRC, ADDR, ARR) asm("sthbrx %0, %1, %2" : : "r"(SRC), "r"(ADDR), "r"(ARR))
#else
#define LOAD_32(DEST, ADDR, ARR) DEST = ((uint32_t*) ARR)[(ADDR) >> 2]
#define LOAD_16(DEST, ADDR, ARR) DEST = ((uint16_t*) ARR)[(ADDR) >> 1]
#define STORE_32(SRC, ADDR, ARR) ((uint32_t*) ARR)[(ADDR) >> 2] = SRC
#define STORE_16(SRC, ADDR, ARR) ((uint16_t*) ARR)[(ADDR) >> 1] = SRC
#endif
#endif

View File

@ -1,7 +1,7 @@
#ifndef ISA_ARM_H #ifndef ISA_ARM_H
#define ISA_ARM_H #define ISA_ARM_H
#include <stdint.h> #include "common.h"
#define ARM_PREFETCH_CYCLES (1 + cpu->memory->activePrefetchCycles32) #define ARM_PREFETCH_CYCLES (1 + cpu->memory->activePrefetchCycles32)

View File

@ -1,6 +1,8 @@
#ifndef ISA_INLINES_H #ifndef ISA_INLINES_H
#define ISA_INLINES_H #define ISA_INLINES_H
#include "common.h"
#include "arm.h" #include "arm.h"
#define UNUSED(V) (void)(V) #define UNUSED(V) (void)(V)

View File

@ -1,7 +1,7 @@
#ifndef ISA_THUMB_H #ifndef ISA_THUMB_H
#define ISA_THUMB_H #define ISA_THUMB_H
#include <stdint.h> #include "common.h"
struct ARMCore; struct ARMCore;

View File

@ -1,11 +1,6 @@
#include "cli-debugger.h" #include "cli-debugger.h"
#include <signal.h> #include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef USE_PTHREADS #ifdef USE_PTHREADS
#include <pthread.h> #include <pthread.h>

View File

@ -1,6 +1,8 @@
#ifndef CLI_DEBUGGER_H #ifndef CLI_DEBUGGER_H
#define CLI_DEBUGGER_H #define CLI_DEBUGGER_H
#include "common.h"
#include "debugger.h" #include "debugger.h"
#include <histedit.h> #include <histedit.h>

View File

@ -4,8 +4,6 @@
#include "memory-debugger.h" #include "memory-debugger.h"
#include <stdlib.h>
static void _checkBreakpoints(struct ARMDebugger* debugger) { static void _checkBreakpoints(struct ARMDebugger* debugger) {
struct DebugBreakpoint* breakpoint; struct DebugBreakpoint* breakpoint;
int instructionLength; int instructionLength;

View File

@ -1,6 +1,8 @@
#ifndef DEBUGGER_H #ifndef DEBUGGER_H
#define DEBUGGER_H #define DEBUGGER_H
#include "common.h"
#include "arm.h" #include "arm.h"
enum DebuggerState { enum DebuggerState {

View File

@ -1,8 +1,6 @@
#include "gdb-stub.h" #include "gdb-stub.h"
#include <errno.h> #include <errno.h>
#include <signal.h>
#include <string.h>
enum GDBError { enum GDBError {
GDB_NO_ERROR = 0x00, GDB_NO_ERROR = 0x00,

View File

@ -1,8 +1,11 @@
#ifndef GDB_STUB_H #ifndef GDB_STUB_H
#define GDB_STUB_H #define GDB_STUB_H
#include "debugger.h" #include "common.h"
#include "socket.h"
#include "debugger/debugger.h"
#include "util/socket.h"
#define GDB_STUB_MAX_LINE 1200 #define GDB_STUB_MAX_LINE 1200

View File

@ -2,8 +2,6 @@
#include "debugger.h" #include "debugger.h"
#include <string.h>
static void ARMDebuggerShim_store32(struct ARMMemory*, uint32_t address, int32_t value, int* cycleCounter); static void ARMDebuggerShim_store32(struct ARMMemory*, uint32_t address, int32_t value, int* cycleCounter);
static void ARMDebuggerShim_store16(struct ARMMemory*, uint32_t address, int16_t value, int* cycleCounter); static void ARMDebuggerShim_store16(struct ARMMemory*, uint32_t address, int16_t value, int* cycleCounter);
static void ARMDebuggerShim_store8(struct ARMMemory*, uint32_t address, int8_t value, int* cycleCounter); static void ARMDebuggerShim_store8(struct ARMMemory*, uint32_t address, int8_t value, int* cycleCounter);

View File

@ -1,6 +1,8 @@
#ifndef MEMORY_DEBUGGER_H #ifndef MEMORY_DEBUGGER_H
#define MEMORY_DEBUGGER_H #define MEMORY_DEBUGGER_H
#include "common.h"
#include "arm.h" #include "arm.h"
struct ARMDebugger; struct ARMDebugger;

View File

@ -5,9 +5,6 @@
#include "gba-serialize.h" #include "gba-serialize.h"
#include "gba-thread.h" #include "gba-thread.h"
#include <limits.h>
#include <math.h>
const unsigned GBA_AUDIO_SAMPLES = 512; const unsigned GBA_AUDIO_SAMPLES = 512;
const unsigned GBA_AUDIO_FIFO_SIZE = 8 * sizeof(int32_t); const unsigned GBA_AUDIO_FIFO_SIZE = 8 * sizeof(int32_t);
#define SWEEP_CYCLES (GBA_ARM7TDMI_FREQUENCY / 128) #define SWEEP_CYCLES (GBA_ARM7TDMI_FREQUENCY / 128)

View File

@ -1,9 +1,9 @@
#ifndef GBA_AUDIO_H #ifndef GBA_AUDIO_H
#define GBA_AUDIO_H #define GBA_AUDIO_H
#include "circle-buffer.h" #include "common.h"
#include <stdint.h> #include "util/circle-buffer.h"
struct GBADMA; struct GBADMA;

View File

@ -4,9 +4,6 @@
#include "gba-io.h" #include "gba-io.h"
#include "gba-memory.h" #include "gba-memory.h"
#include <math.h>
#include <stdlib.h>
const uint32_t GBA_BIOS_CHECKSUM = 0xBAAE187F; const uint32_t GBA_BIOS_CHECKSUM = 0xBAAE187F;
const uint32_t GBA_DS_BIOS_CHECKSUM = 0xBAAE1880; const uint32_t GBA_DS_BIOS_CHECKSUM = 0xBAAE1880;

View File

@ -1,9 +1,9 @@
#ifndef GBA_BIOS_H #ifndef GBA_BIOS_H
#define GBA_BIOS_H #define GBA_BIOS_H
#include "arm.h" #include "common.h"
#include <string.h> #include "arm.h"
void GBASwi16(struct ARMBoard* board, int immediate); void GBASwi16(struct ARMBoard* board, int immediate);
void GBASwi32(struct ARMBoard* board, int immediate); void GBASwi32(struct ARMBoard* board, int immediate);

View File

@ -1,7 +1,7 @@
#ifndef GBA_GPIO_H #ifndef GBA_GPIO_H
#define GBA_GPIO_H #define GBA_GPIO_H
#include <stdint.h> #include "common.h"
#define IS_GPIO_REGISTER(reg) ((reg) == GPIO_REG_DATA || (reg) == GPIO_REG_DIRECTION || (reg) == GPIO_REG_CONTROL) #define IS_GPIO_REGISTER(reg) ((reg) == GPIO_REG_DATA || (reg) == GPIO_REG_DIRECTION || (reg) == GPIO_REG_CONTROL)

View File

@ -1,6 +1,8 @@
#ifndef GBA_IO_H #ifndef GBA_IO_H
#define GBA_IO_H #define GBA_IO_H
#include "common.h"
#include "gba.h" #include "gba.h"
enum GBAIORegisters { enum GBAIORegisters {

View File

@ -4,11 +4,7 @@
#include "gba-io.h" #include "gba-io.h"
#include "gba-serialize.h" #include "gba-serialize.h"
#include "hle-bios.h" #include "hle-bios.h"
#include "memory.h" #include "util/memory.h"
#include <limits.h>
#include <stdlib.h>
#include <string.h>
static void GBASetActiveRegion(struct ARMMemory* memory, uint32_t region); static void GBASetActiveRegion(struct ARMMemory* memory, uint32_t region);
static int GBAWaitMultiple(struct ARMMemory* memory, uint32_t startAddress, int count); static int GBAWaitMultiple(struct ARMMemory* memory, uint32_t startAddress, int count);

View File

@ -1,13 +1,13 @@
#ifndef GBA_MEMORY_H #ifndef GBA_MEMORY_H
#define GBA_MEMORY_H #define GBA_MEMORY_H
#include "common.h"
#include "arm.h" #include "arm.h"
#include "gba-gpio.h" #include "gba-gpio.h"
#include "gba-savedata.h" #include "gba-savedata.h"
#include <string.h>
enum GBAMemoryRegion { enum GBAMemoryRegion {
REGION_BIOS = 0x0, REGION_BIOS = 0x0,
REGION_WORKING_RAM = 0x2, REGION_WORKING_RAM = 0x2,

View File

@ -1,12 +1,11 @@
#include "gba-savedata.h" #include "gba-savedata.h"
#include "gba.h" #include "gba.h"
#include "memory.h"
#include "util/memory.h"
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h>
#include <unistd.h>
static void _flashSwitchBank(struct GBASavedata* savedata, int bank); static void _flashSwitchBank(struct GBASavedata* savedata, int bank);
static void _flashErase(struct GBASavedata* savedata); static void _flashErase(struct GBASavedata* savedata);

View File

@ -1,7 +1,7 @@
#ifndef GBA_SAVEDATA_H #ifndef GBA_SAVEDATA_H
#define GBA_SAVEDATA_H #define GBA_SAVEDATA_H
#include <stdint.h> #include "common.h"
enum SavedataType { enum SavedataType {
SAVEDATA_NONE = 0, SAVEDATA_NONE = 0,

View File

@ -1,7 +1,7 @@
#ifndef GBA_SENSORS_H #ifndef GBA_SENSORS_H
#define GBA_SENSORS_H #define GBA_SENSORS_H
#include <stdint.h> #include "common.h"
struct GBARotationSource { struct GBARotationSource {
void (*sample)(struct GBARotationSource*); void (*sample)(struct GBARotationSource*);

View File

@ -3,13 +3,10 @@
#include "gba-audio.h" #include "gba-audio.h"
#include "gba-io.h" #include "gba-io.h"
#include "gba-thread.h" #include "gba-thread.h"
#include "memory.h"
#include "util/memory.h"
#include <fcntl.h> #include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
const uint32_t GBA_SAVESTATE_MAGIC = 0x01000000; const uint32_t GBA_SAVESTATE_MAGIC = 0x01000000;

View File

@ -1,6 +1,8 @@
#ifndef GBA_SERIALIZE_H #ifndef GBA_SERIALIZE_H
#define GBA_SERIALIZE_H #define GBA_SERIALIZE_H
#include "common.h"
#include "gba.h" #include "gba.h"
const uint32_t GBA_SAVESTATE_MAGIC; const uint32_t GBA_SAVESTATE_MAGIC;

View File

@ -2,8 +2,6 @@
#include "gba-io.h" #include "gba-io.h"
#include <limits.h>
static struct GBASIODriver* _lookupDriver(struct GBASIO* sio, enum GBASIOMode mode) { static struct GBASIODriver* _lookupDriver(struct GBASIO* sio, enum GBASIOMode mode) {
switch (mode) { switch (mode) {
case SIO_NORMAL_8: case SIO_NORMAL_8:

View File

@ -1,7 +1,7 @@
#ifndef GBA_SIO_H #ifndef GBA_SIO_H
#define GBA_SIO_H #define GBA_SIO_H
#include <stdint.h> #include "common.h"
enum GBASIOMode { enum GBASIOMode {
SIO_NORMAL_8 = 0, SIO_NORMAL_8 = 0,

View File

@ -1,11 +1,11 @@
#include "gba-thread.h" #include "gba-thread.h"
#include "arm.h" #include "arm.h"
#include "debugger.h"
#include "gba.h" #include "gba.h"
#include "gba-serialize.h" #include "gba-serialize.h"
#include <stdlib.h> #include "debugger/debugger.h"
#include <signal.h> #include <signal.h>
#ifdef USE_PTHREADS #ifdef USE_PTHREADS

View File

@ -1,8 +1,11 @@
#ifndef GBA_THREAD_H #ifndef GBA_THREAD_H
#define GBA_THREAD_H #define GBA_THREAD_H
#include "common.h"
#include "gba.h" #include "gba.h"
#include "threading.h"
#include "util/threading.h"
struct GBAThread; struct GBAThread;
typedef void (*ThreadCallback)(struct GBAThread* threadContext); typedef void (*ThreadCallback)(struct GBAThread* threadContext);

View File

@ -4,10 +4,8 @@
#include "gba-io.h" #include "gba-io.h"
#include "gba-serialize.h" #include "gba-serialize.h"
#include "gba-thread.h" #include "gba-thread.h"
#include "memory.h"
#include <limits.h> #include "util/memory.h"
#include <string.h>
static void GBAVideoDummyRendererInit(struct GBAVideoRenderer* renderer); static void GBAVideoDummyRendererInit(struct GBAVideoRenderer* renderer);
static void GBAVideoDummyRendererDeinit(struct GBAVideoRenderer* renderer); static void GBAVideoDummyRendererDeinit(struct GBAVideoRenderer* renderer);

View File

@ -1,9 +1,9 @@
#ifndef GBA_VIDEO_H #ifndef GBA_VIDEO_H
#define GBA_VIDEO_H #define GBA_VIDEO_H
#include "gba-memory.h" #include "common.h"
#include <stdint.h> #include "gba-memory.h"
enum { enum {
VIDEO_CYCLES_PER_PIXEL = 4, VIDEO_CYCLES_PER_PIXEL = 4,

View File

@ -4,14 +4,11 @@
#include "gba-io.h" #include "gba-io.h"
#include "gba-sio.h" #include "gba-sio.h"
#include "gba-thread.h" #include "gba-thread.h"
#include "memory.h"
#include "debugger.h" #include "util/memory.h"
#include "debugger/debugger.h"
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
const uint32_t GBA_ARM7TDMI_FREQUENCY = 0x1000000; const uint32_t GBA_ARM7TDMI_FREQUENCY = 0x1000000;

View File

@ -1,16 +1,16 @@
#ifndef GBA_H #ifndef GBA_H
#define GBA_H #define GBA_H
#include "common.h"
#include "arm.h" #include "arm.h"
#include "debugger.h" #include "debugger/debugger.h"
#include "gba-memory.h" #include "gba-memory.h"
#include "gba-video.h" #include "gba-video.h"
#include "gba-audio.h" #include "gba-audio.h"
#include "gba-sio.h" #include "gba-sio.h"
#include <stdarg.h>
extern const uint32_t GBA_ARM7TDMI_FREQUENCY; extern const uint32_t GBA_ARM7TDMI_FREQUENCY;
enum GBAIRQ { enum GBAIRQ {

View File

@ -1,8 +1,7 @@
#ifndef HLE_BIOS_H #ifndef HLE_BIOS_H
#define HLE_BIOS_H #define HLE_BIOS_H
#include <stdint.h> #include "common.h"
#include <string.h>
extern const size_t hleBiosLength; extern const size_t hleBiosLength;
extern const uint8_t hleBios[]; extern const uint8_t hleBios[];

View File

@ -1,6 +1,8 @@
#ifndef VIDEO_GLSL_H #ifndef VIDEO_GLSL_H
#define VIDEO_GLSL_H #define VIDEO_GLSL_H
#include "common.h"
#include "gba-video.h" #include "gba-video.h"
#include <pthread.h> #include <pthread.h>

View File

@ -3,8 +3,6 @@
#include "gba.h" #include "gba.h"
#include "gba-io.h" #include "gba-io.h"
#include <string.h>
#define UNUSED(X) (void) (X) #define UNUSED(X) (void) (X)
static const int _objSizes[32] = { static const int _objSizes[32] = {

View File

@ -1,9 +1,9 @@
#ifndef VIDEO_SOFTWARE_H #ifndef VIDEO_SOFTWARE_H
#define VIDEO_SOFTWARE_H #define VIDEO_SOFTWARE_H
#include "gba-video.h" #include "common.h"
#include <pthread.h> #include "gba-video.h"
#ifdef COLOR_16_BIT #ifdef COLOR_16_BIT
typedef uint16_t color_t; typedef uint16_t color_t;

View File

@ -15,7 +15,6 @@
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h>
static int _GBASDLInit(void); static int _GBASDLInit(void);
static void _GBASDLDeinit(void); static void _GBASDLDeinit(void);

View File

@ -5,9 +5,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
#include <sys/time.h> #include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static void _GBAPerfRunloop(struct GBAThread* context, int* frames); static void _GBAPerfRunloop(struct GBAThread* context, int* frames);
static void _GBAPerfShutdown(int signal); static void _GBAPerfShutdown(int signal);

View File

@ -1,4 +1,4 @@
#include "memory.h" #include "util/memory.h"
#include <sys/mman.h> #include <sys/mman.h>

View File

@ -1,4 +1,4 @@
#include "debugger.h" #include "debugger/debugger.h"
#include "gba-thread.h" #include "gba-thread.h"
#include "gba.h" #include "gba.h"
#include "renderers/video-software.h" #include "renderers/video-software.h"
@ -16,7 +16,6 @@
#include <malloc.h> #include <malloc.h>
#include <signal.h> #include <signal.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h>
struct GBAVideoEGLRenderer { struct GBAVideoEGLRenderer {
struct GBAVideoSoftwareRenderer d; struct GBAVideoSoftwareRenderer d;

View File

@ -1,4 +1,4 @@
#include "cli-debugger.h" #include "debugger/cli-debugger.h"
#include "gba-thread.h" #include "gba-thread.h"
#include "gba.h" #include "gba.h"
#include "sdl-audio.h" #include "sdl-audio.h"

View File

@ -1,6 +1,8 @@
#ifndef SDL_AUDIO_H #ifndef SDL_AUDIO_H
#define SDL_AUDIO_H #define SDL_AUDIO_H
#include "common.h"
#include <SDL.h> #include <SDL.h>
struct GBASDLAudio { struct GBASDLAudio {

View File

@ -1,6 +1,6 @@
#include "sdl-events.h" #include "sdl-events.h"
#include "debugger.h" #include "debugger/debugger.h"
#include "gba-io.h" #include "gba-io.h"
#include "gba-serialize.h" #include "gba-serialize.h"
#include "gba-video.h" #include "gba-video.h"

View File

@ -1,6 +1,8 @@
#ifndef SDL_EVENTS_H #ifndef SDL_EVENTS_H
#define SDL_EVENTS_H #define SDL_EVENTS_H
#include "common.h"
#include "gba-thread.h" #include "gba-thread.h"
#include <SDL.h> #include <SDL.h>

View File

@ -1,4 +1,4 @@
#include "debugger.h" #include "debugger/debugger.h"
#include "gba-thread.h" #include "gba-thread.h"
#include "gba.h" #include "gba.h"
#include "renderers/video-software.h" #include "renderers/video-software.h"
@ -11,7 +11,6 @@
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h>
struct SoftwareRenderer { struct SoftwareRenderer {
struct GBAVideoSoftwareRenderer d; struct GBAVideoSoftwareRenderer d;

View File

@ -1,4 +1,4 @@
#include "memory.h" #include "util/memory.h"
#include <io.h> #include <io.h>
#include <Windows.h> #include <Windows.h>

View File

@ -1,8 +1,5 @@
#include "circle-buffer.h" #include "circle-buffer.h"
#include <stddef.h>
#include <stdlib.h>
#ifndef NDEBUG #ifndef NDEBUG
static int _checkIntegrity(struct CircleBuffer* buffer) { static int _checkIntegrity(struct CircleBuffer* buffer) {
if ((int8_t*) buffer->writePtr - (int8_t*) buffer->readPtr == buffer->size) { if ((int8_t*) buffer->writePtr - (int8_t*) buffer->readPtr == buffer->size) {

View File

@ -1,8 +1,7 @@
#ifndef CIRCLE_BUFFER_H #ifndef CIRCLE_BUFFER_H
#define CIRCLE_BUFFER_H #define CIRCLE_BUFFER_H
#include <stdint.h> #include "common.h"
#include <string.h>
struct CircleBuffer { struct CircleBuffer {
void* data; void* data;

View File

@ -1,7 +1,7 @@
#ifndef MEMORY_H #ifndef MEMORY_H
#define MEMORY_H #define MEMORY_H
#include <unistd.h> #include "common.h"
#define MEMORY_READ 1 #define MEMORY_READ 1
#define MEMORY_WRITE 2 #define MEMORY_WRITE 2

View File

@ -1,6 +1,8 @@
#ifndef SOCKET_H #ifndef SOCKET_H
#define SOCKET_H #define SOCKET_H
#include "common.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -9,9 +11,7 @@ typedef SOCKET Socket;
#include <fcntl.h> #include <fcntl.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <stdio.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h>
typedef int Socket; typedef int Socket;
#endif #endif

View File

@ -1,6 +1,7 @@
#ifndef THREADING_H #ifndef THREADING_H
#define THREADING_H #define THREADING_H
#include "common.h"
#ifdef USE_PTHREADS #ifdef USE_PTHREADS
#include <pthread.h> #include <pthread.h>