libscid snapshot+0cce79d72e38
Chess applications made easy.
Source on GitHub License GPL v2
Loading...
Searching...
No Matches
primitives.h
1#ifndef SCID_PRIMITIVES_H
2#define SCID_PRIMITIVES_H
3
4#include "scid/_platform.h"
5
6#ifdef __cplusplus
7extern "C"
8{
9#endif
10
11 typedef unsigned short scid_error;
12
13 enum
14 {
15 SCID_OK = 0,
16 SCID_ERROR = 1,
17 SCID_ERROR_BAD_ARG = 3,
18
19 SCID_ERROR_FILE_OPEN = 101,
20 SCID_ERROR_FILE_READ_ONLY = 111,
21 SCID_ERROR_CORRUPT = 152,
22
23 SCID_ERROR_INVALID_FEN = 301,
24 SCID_ERROR_INVALID_MOVE = 302,
25
26 SCID_ERROR_BUFFER_FULL = 601
27 };
28
29 typedef int scid_colour;
30
31 enum
32 {
33 SCID_WHITE = 0,
34 SCID_BLACK = 1
35 };
36
37 typedef unsigned scid_square;
38
39 typedef unsigned scid_piece;
40
41 enum
42 {
43 SCID_PIECE_NONE = 0,
44 SCID_PIECE_KING = 1,
45 SCID_PIECE_QUEEN = 2,
46 SCID_PIECE_ROOK = 3,
47 SCID_PIECE_BISHOP = 4,
48 SCID_PIECE_KNIGHT = 5,
49 SCID_PIECE_PAWN = 6,
50
51 SCID_PIECE_WHITE_KING = 1,
52 SCID_PIECE_WHITE_QUEEN = 2,
53 SCID_PIECE_WHITE_ROOK = 3,
54 SCID_PIECE_WHITE_BISHOP = 4,
55 SCID_PIECE_WHITE_KNIGHT = 5,
56 SCID_PIECE_WHITE_PAWN = 6,
57
58 SCID_PIECE_BLACK_KING = 9,
59 SCID_PIECE_BLACK_QUEEN = 10,
60 SCID_PIECE_BLACK_ROOK = 11,
61 SCID_PIECE_BLACK_BISHOP = 12,
62 SCID_PIECE_BLACK_KNIGHT = 13,
63 SCID_PIECE_BLACK_PAWN = 14
64 };
65
66 typedef unsigned char scid_nag;
67
68 SCID_API scid_error
69 scid_square_from_string(
70 const char* text,
71 scid_square* out_square);
72
73
74 SCID_API scid_error
75 scid_square_to_string(
76 scid_square square,
77 char* out_text,
78 size_t out_text_capacity,
79 size_t* out_text_size);
80
81
82 SCID_API scid_error
83 scid_piece_type_from_string(
84 const char* text,
85 scid_piece* out_piece);
86
87
88 SCID_API scid_error
89 scid_nag_create_from_string(
90 const char* text,
91 scid_nag* out_nag);
92
93
94 SCID_API scid_error
95 scid_nag_to_string(
96 scid_nag nag,
97 int as_symbol,
98 char* out_text,
99 size_t out_text_capacity,
100 size_t* out_text_size);
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif