Chess 0.0.1
A library written in c
Loading...
Searching...
No Matches
file.h
Go to the documentation of this file.
1
8#ifndef CHESS_FILE_H_INCLUDED
9#define CHESS_FILE_H_INCLUDED
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include <chess/macros.h>
16
17#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
18 #include <stdbool.h>
19#endif
20#include <stddef.h>
21#include <stdint.h>
22
39
45
52
59size_t chess_file_from_algebraic(ChessFile *file, const char *string);
60
68size_t chess_file_to_algebraic(ChessFile file, char *string, size_t string_size);
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif // CHESS_FILE_H_INCLUDED
void chess_file_debug(ChessFile file)
Prints a debug representation of the given file.
ChessFile
Represents the files (columns) on a chess board, from A to H.
Definition file.h:27
@ CHESS_FILE_A
Definition file.h:28
@ CHESS_FILE_F
Definition file.h:33
@ CHESS_FILE_G
Definition file.h:34
@ CHESS_FILE_H
Definition file.h:35
@ CHESS_FILE_E
Definition file.h:32
@ CHESS_FILE_B
Definition file.h:29
@ CHESS_FILE_C
Definition file.h:30
@ CHESS_FILE_NONE
Definition file.h:37
@ CHESS_FILE_D
Definition file.h:31
size_t chess_file_from_algebraic(ChessFile *file, const char *string)
Parses a file from algebraic notation (e.g., "a", "b", ... "h").
size_t chess_file_to_algebraic(ChessFile file, char *string, size_t string_size)
Converts a file to algebraic notation (e.g., "a", "b", ... "h").
bool chess_file_is_valid(ChessFile file)
Checks if the given file is valid (A-H).
Defines macros and constants for the library.
#define CHESS_ENUM(type, name)
Defines a typed enum or a typedef enum based on the availability of typed enums in the compiler.
Definition macros.h:84