Ran clang-format on one file missed during previous commit.
[sgk-go] / interface / gtp.h
CommitLineData
7eeb782e
AT
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2 * This is GNU Go, a Go program. Contact gnugo@gnu.org, or see *
3 * http://www.gnu.org/software/gnugo/ for more information. *
4 * *
5 * To facilitate development of the Go Text Protocol, the two *
6 * files gtp.c and gtp.h are licensed under less restrictive *
7 * terms than the rest of GNU Go. *
8 * *
9 * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 and *
10 * 2009 by the Free Software Foundation. *
11 * *
12 * Permission is hereby granted, free of charge, to any person *
13 * obtaining a copy of this file gtp.h, to deal in the Software *
14 * without restriction, including without limitation the rights *
15 * to use, copy, modify, merge, publish, distribute, and/or *
16 * sell copies of the Software, and to permit persons to whom *
17 * the Software is furnished to do so, provided that the above *
18 * copyright notice(s) and this permission notice appear in all *
19 * copies of the Software and that both the above copyright *
20 * notice(s) and this permission notice appear in supporting *
21 * documentation. *
22 * *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY *
24 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE *
25 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR *
26 * PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO *
27 * EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS *
28 * NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR *
29 * CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING *
30 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
31 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT *
32 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS *
33 * SOFTWARE. *
34 * *
35 * Except as contained in this notice, the name of a copyright *
36 * holder shall not be used in advertising or otherwise to *
37 * promote the sale, use or other dealings in this Software *
38 * without prior written authorization of the copyright holder. *
39\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
40
41/* NOTE: GNU Go specific, workarounds dumb Windows sockets. */
42#include "winsocket.h"
43
44#include <stdarg.h>
45#include <stdio.h>
46
47/* Maximum allowed line length in GTP. */
48#define GTP_BUFSIZE 1000
49
50/* Status returned from callback functions. */
d261a5f4
AT
51#define GTP_QUIT -1
52#define GTP_OK 0
53#define GTP_FATAL 1
7eeb782e
AT
54
55/* Whether the GTP command was successful. */
d261a5f4
AT
56#define GTP_SUCCESS 0
57#define GTP_FAILURE 1
7eeb782e
AT
58
59/* Function pointer for callback functions. */
d261a5f4 60typedef int (*gtp_fn_ptr)(char* s);
7eeb782e
AT
61
62/* Function pointer for vertex transform functions. */
d261a5f4 63typedef void (*gtp_transform_ptr)(int ai, int aj, int* bi, int* bj);
7eeb782e
AT
64
65/* Elements in the array of commands required by gtp_main_loop. */
66struct gtp_command {
d261a5f4
AT
67 const char* name;
68 gtp_fn_ptr function;
7eeb782e
AT
69};
70
71void gtp_main_loop(struct gtp_command commands[],
d261a5f4 72 FILE* gtp_input, FILE* gtp_output, FILE* gtp_dump_commands);
7eeb782e
AT
73void gtp_internal_set_boardsize(int size);
74void gtp_set_vertex_transform_hooks(gtp_transform_ptr in,
d261a5f4
AT
75 gtp_transform_ptr out);
76void gtp_mprintf(const char* format, ...);
77void gtp_printf(const char* format, ...);
7eeb782e
AT
78void gtp_start_response(int status);
79int gtp_finish_response(void);
d261a5f4
AT
80int gtp_success(const char* format, ...);
81int gtp_failure(const char* format, ...);
7eeb782e 82void gtp_panic(void);
d261a5f4
AT
83int gtp_decode_color(char* s, int* color);
84int gtp_decode_coord(char* s, int* m, int* n);
85int gtp_decode_move(char* s, int* color, int* i, int* j);
7eeb782e
AT
86void gtp_print_vertices(int n, int movei[], int movej[]);
87void gtp_print_vertex(int i, int j);
88
d261a5f4 89extern FILE* gtp_output_file;
7eeb782e
AT
90
91/*
92 * Local Variables:
93 * tab-width: 8
94 * c-basic-offset: 2
95 * End:
96 */