Mercurial > repo
comparison interps/cfunge/cfunge-src/src/vector.h @ 996:859f9b4339e6
<Gregor> tar xf egobot.tar.xz
author | HackBot |
---|---|
date | Sun, 09 Dec 2012 19:30:08 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
995:6883f5911eb7 | 996:859f9b4339e6 |
---|---|
1 /* -*- mode: C; coding: utf-8; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- | |
2 * | |
3 * cfunge - A standard-conforming Befunge93/98/109 interpreter in C. | |
4 * Copyright (C) 2008-2009 Arvid Norlander <anmaster AT tele2 DOT se> | |
5 * | |
6 * This program is free software: you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation, either version 3 of the License, or | |
9 * (at the proxy's option) any later version. Arvid Norlander is a | |
10 * proxy who can decide which future versions of the GNU General Public | |
11 * License can be used. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 */ | |
21 /** | |
22 * @file | |
23 * Definition of, and functions for, a Funge vector. | |
24 */ | |
25 #ifndef FUNGE_HAD_SRC_VECTOR_H | |
26 #define FUNGE_HAD_SRC_VECTOR_H | |
27 | |
28 #include "global.h" | |
29 | |
30 #include <stdbool.h> | |
31 | |
32 /// A vector in Funge-Space | |
33 typedef struct s_funge_vector { | |
34 funge_cell x; ///< You should be able to guess what this is. | |
35 funge_cell y; ///< You should be able to guess what this is. | |
36 } funge_vector; | |
37 | |
38 /// Useful to create a vector in a list of parameter for example. | |
39 /// The vector is created on the stack. | |
40 /// @param a This should be the x value. | |
41 /// @param b This should be the y value. | |
42 /// @return A pointer to a vector allocated on the stack, so no need to free it. | |
43 #define vector_create_ref(a, b) (& (funge_vector) { .x = (a), .y = (b) }) | |
44 | |
45 /** | |
46 * Checks if vector is cardinal (as in ^>v<). | |
47 * @param v The vector to check. | |
48 */ | |
49 FUNGE_ATTR_PURE FUNGE_ATTR_FAST FUNGE_ATTR_WARN_UNUSED | |
50 bool vector_is_cardinal(const funge_vector * restrict v); | |
51 | |
52 #endif |