From 095ef2947d858df7ccc9baa4806fe7366fca26bc Mon Sep 17 00:00:00 2001 From: cflip Date: Sun, 8 Jan 2023 14:57:40 -0700 Subject: Use C-style include guards instead of #pragma once --- buffer.h | 5 ++++- editor.h | 5 ++++- file.h | 5 ++++- input.h | 5 ++++- row.h | 5 ++++- syntax.h | 5 ++++- terminal.h | 5 ++++- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/buffer.h b/buffer.h index 474202e..7761f6c 100644 --- a/buffer.h +++ b/buffer.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef _BUFFER_H +#define _BUFFER_H struct append_buffer { char* buffer; @@ -9,3 +10,5 @@ struct append_buffer { void ab_append(struct append_buffer* ab, const char* string, int length); void ab_free(struct append_buffer* ab); + +#endif diff --git a/editor.h b/editor.h index 578a91e..8b42b7f 100644 --- a/editor.h +++ b/editor.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef _EDITOR_H +#define _EDITOR_H #include #include "buffer.h" @@ -33,3 +34,5 @@ void editor_scroll(struct editor_state* editor); void editor_draw_rows(struct editor_state* editor, struct append_buffer* buffer); void editor_draw_status_bar(struct editor_state* editor, struct append_buffer* buffer); void editor_draw_message_bar(struct editor_state* editor, struct append_buffer* buffer); + +#endif diff --git a/file.h b/file.h index 831d193..70889ac 100644 --- a/file.h +++ b/file.h @@ -1,6 +1,9 @@ -#pragma once +#ifndef _FILE_H +#define _FILE_H #include "editor.h" void editor_open(struct editor_state* editor, char* filename); void editor_save(struct editor_state* editor); + +#endif diff --git a/input.h b/input.h index 5e63904..bd286b2 100644 --- a/input.h +++ b/input.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef _INPUT_H +#define _INPUT_H #include "editor.h" @@ -20,3 +21,5 @@ enum editor_key { int editor_read_key(); void editor_move_cursor(struct editor_state* editor, int key); void editor_process_keypress(struct editor_state* editor); + +#endif diff --git a/row.h b/row.h index f3c9708..e8f6731 100644 --- a/row.h +++ b/row.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef _ROW_H +#define _ROW_H #include @@ -25,3 +26,5 @@ void delete_row(struct editor_state* editor, int at); void row_insert_char(struct editor_state* editor, struct editor_row* row, int at, int c); void row_append_string(struct editor_state* editor, struct editor_row* row, char* string, size_t length); void row_delete_char(struct editor_state* editor, struct editor_row* row, int at); + +#endif diff --git a/syntax.h b/syntax.h index 0cb673e..9bf85a4 100644 --- a/syntax.h +++ b/syntax.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef _SYNTAX_H +#define _SYNTAX_H #include @@ -34,3 +35,5 @@ enum editor_highlight { void editor_update_syntax(struct editor_state* editor, struct editor_row* row); int editor_syntax_to_colour(int highlight); void editor_select_syntax_highlight(struct editor_state* editor); + +#endif diff --git a/terminal.h b/terminal.h index 529ba74..1df7ea7 100644 --- a/terminal.h +++ b/terminal.h @@ -1,7 +1,10 @@ -#pragma once +#ifndef _TERMINAL_H +#define _TERMINAL_H void die(const char* message); void disable_raw_mode(); void enable_raw_mode(); int get_cursor_position(int* rows, int* cols); int get_window_size(int* rows, int* cols); + +#endif -- cgit v1.2.3