You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB
C

/**
* @file variable.h
* Defines variable data structure
*
* Copyright (C) 2018 Clyne Sullivan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef VARIABLE_H_
#define VARIABLE_H_
7 years ago
#include <stdint.h>
/**
* Data for a script variable.
*/
7 years ago
typedef struct {
uint8_t tmp :1; /**< If zero, variable cannot be free'd */
uint8_t type :3; /**< The variable's type */
uint8_t unused :4; /**< Unused... */
union {
float f;
uint32_t p;
} value; /**< The variable's value, either float or a pointer */
7 years ago
} variable;
/**
* Defines possible variable types.
*/
enum VARTYPE {
NUMBER = 0, /**< Number/float */
STRING, /**< String of text */
OPERATOR, /**< Arithmetical operation */
FUNC, /**< In-script function */
CFUNC, /**< C function */
7 years ago
};
#endif // VARIABLE_H_