Skip to content

Commit

Permalink
Make everything compile for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Oct 3, 2023
1 parent 26d7501 commit ae8e992
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Sources/backends/d3d11.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "d3d11.h"

#include "../errors.h"

#ifdef _WIN32

#include "../errors.h"
#include "../log.h"

#define INITGUID
Expand Down
1 change: 1 addition & 0 deletions Sources/backends/d3d11.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "../shader_stage.h"

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

int compile_hlsl_to_d3d11(const char *source, uint8_t **output, size_t *outputlength, shader_stage stage, bool debug);
3 changes: 2 additions & 1 deletion Sources/backends/d3d9.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "../shader_stage.h"

#ifdef _WIN32

#include "../log.h"
#include "../shader_stage.h"

#include <Windows.h>
#include <d3d9.h>
Expand Down
7 changes: 5 additions & 2 deletions Sources/compiler.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once

#include <stdint.h>

#include "names.h"
#include "types.h"

#include <stddef.h>
#include <stdint.h>

typedef struct variable {
uint64_t index;
type_ref type;
Expand Down Expand Up @@ -85,4 +86,6 @@ typedef struct opcodes {

void convert_globals(void);

struct statement;

void convert_function_block(opcodes *code, struct statement *block);
21 changes: 17 additions & 4 deletions Sources/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,29 @@ void close_dir(directory *dir) {

#else

#include <string.h>

#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>

directory open_dir(const char *dirname) {
directory dir;
dir.handle = NULL;
dir.handle = opendir(dirname);
return dir;
}

file read_next_file(directory *dir) {
File file;
file.valid = false;
return file;
struct dirent *entry = readdir(dir->handle);

file f;
f.valid = entry != NULL;

if (f.valid) {
strcpy(f.name, entry->d_name);
}

return f;
}

void close_dir(directory *dir) {
Expand Down
1 change: 1 addition & 0 deletions Sources/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "types.h"

#include <stdbool.h>
#include <stddef.h>

struct expression;

Expand Down
1 change: 1 addition & 0 deletions Sources/tokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "names.h"

#include <stdbool.h>
#include <stddef.h>

typedef enum operatorr {
OPERATOR_EQUALS,
Expand Down
1 change: 1 addition & 0 deletions Sources/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "tokenizer.h"

#include <stdbool.h>
#include <stddef.h>

#define NO_TYPE 0xFFFFFFFF

Expand Down

0 comments on commit ae8e992

Please sign in to comment.