2011-05-09 12:37:57 +00:00
|
|
|
/**
|
|
|
|
* @file psyc.h
|
2011-04-20 17:18:35 +00:00
|
|
|
* @brief Main PSYC interface providing crucial functionality.
|
2011-05-09 12:37:57 +00:00
|
|
|
*/
|
2011-04-19 20:57:49 +00:00
|
|
|
|
2011-05-09 12:37:57 +00:00
|
|
|
/**
|
|
|
|
* @mainpage PSYC Core Library
|
2011-04-19 20:57:49 +00:00
|
|
|
*
|
|
|
|
* @section intro_sec Introduction
|
|
|
|
*
|
2011-05-09 07:11:59 +00:00
|
|
|
* Welcome to the libpsyc documentation!
|
2011-04-19 20:57:49 +00:00
|
|
|
*
|
|
|
|
* @section install_sec Installation
|
|
|
|
*/
|
2011-05-09 12:37:57 +00:00
|
|
|
// * @subsection step1 Step 1: Opening the box
|
2011-04-19 20:57:49 +00:00
|
|
|
|
2011-04-20 17:18:35 +00:00
|
|
|
#ifndef PSYC_H
|
2011-11-11 21:18:24 +00:00
|
|
|
#define PSYC_H
|
2011-04-20 17:18:35 +00:00
|
|
|
|
2011-04-16 15:30:03 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
2011-05-20 00:58:32 +00:00
|
|
|
#include <sys/types.h>
|
2011-04-16 15:30:03 +00:00
|
|
|
|
2011-11-03 13:27:01 +00:00
|
|
|
#define PSYC_VERSION 1
|
2011-11-11 21:18:24 +00:00
|
|
|
#define PSYC_EPOCH 1440444041 // 2015-08-24 21:20:41 CET (Monday)
|
2011-04-16 15:30:03 +00:00
|
|
|
|
2011-12-01 13:12:41 +00:00
|
|
|
#define PSYC_STRING(data, len) (PsycString) {len, data}
|
|
|
|
#define PSYC_C2STR(str) (PsycString) {sizeof(str)-1, str}
|
|
|
|
#define PSYC_C2STRI(str) {sizeof(str)-1, str}
|
|
|
|
#define PSYC_C2ARG(str) str, sizeof(str)-1
|
2011-12-27 16:50:25 +00:00
|
|
|
#define PSYC_C2ARG1(str) str, sizeof(str)
|
2011-12-01 13:12:41 +00:00
|
|
|
#define PSYC_C2ARG2(str) sizeof(str)-1, str
|
|
|
|
#define PSYC_S2ARG(str) (str).data, (str).length
|
|
|
|
#define PSYC_S2ARG2(str) (str).length, (str).data
|
|
|
|
#define PSYC_S2ARGP(str) (int)(str).length, (str).data
|
2011-05-03 23:00:35 +00:00
|
|
|
|
2011-10-31 19:04:16 +00:00
|
|
|
#define PSYC_NUM_ELEM(a) (sizeof(a) / sizeof(*(a)))
|
|
|
|
|
2011-11-09 18:01:05 +00:00
|
|
|
/// Boolean: true/false, yes/no.
|
2011-11-11 21:18:24 +00:00
|
|
|
typedef enum {
|
|
|
|
PSYC_FALSE = 0,
|
|
|
|
PSYC_TRUE = 1,
|
|
|
|
PSYC_NO = 0,
|
|
|
|
PSYC_YES = 1,
|
2011-10-31 19:26:47 +00:00
|
|
|
} PsycBool;
|
2011-04-20 17:18:35 +00:00
|
|
|
|
2011-11-09 18:01:05 +00:00
|
|
|
/// Return code: OK/error.
|
2011-11-11 21:18:24 +00:00
|
|
|
typedef enum {
|
|
|
|
PSYC_OK = 1,
|
|
|
|
PSYC_ERROR = -1,
|
2011-11-01 11:06:58 +00:00
|
|
|
} PsycRC;
|
|
|
|
|
2011-11-09 18:01:05 +00:00
|
|
|
/// PSYC packet parts.
|
2011-11-11 21:18:24 +00:00
|
|
|
typedef enum {
|
|
|
|
PSYC_PART_RESET = -1,
|
|
|
|
PSYC_PART_ROUTING = 0,
|
|
|
|
PSYC_PART_LENGTH = 1,
|
|
|
|
PSYC_PART_CONTENT = 2,
|
|
|
|
PSYC_PART_METHOD = 3,
|
|
|
|
PSYC_PART_DATA = 4,
|
|
|
|
PSYC_PART_END = 5,
|
2011-10-31 19:26:47 +00:00
|
|
|
} PsycPart;
|
2011-04-21 12:20:24 +00:00
|
|
|
|
2011-04-20 17:18:35 +00:00
|
|
|
/**
|
|
|
|
* Different types that a variable can have.
|
|
|
|
*
|
|
|
|
* This enum lists PSYC variable types that
|
|
|
|
* this library is capable of checking for
|
|
|
|
* validity. Other variable types are treated
|
|
|
|
* as opaque data.
|
|
|
|
*/
|
2011-11-11 21:18:24 +00:00
|
|
|
typedef enum {
|
|
|
|
PSYC_TYPE_UNKNOWN,
|
|
|
|
PSYC_TYPE_AMOUNT,
|
|
|
|
PSYC_TYPE_COLOR,
|
2011-11-21 15:00:46 +00:00
|
|
|
PSYC_TYPE_COUNTER,
|
2011-11-26 14:03:10 +00:00
|
|
|
PSYC_TYPE_DEF,
|
2011-11-11 21:18:24 +00:00
|
|
|
PSYC_TYPE_DATE,
|
|
|
|
PSYC_TYPE_DEGREE,
|
|
|
|
PSYC_TYPE_ENTITY,
|
|
|
|
PSYC_TYPE_FLAG,
|
|
|
|
PSYC_TYPE_LANGUAGE,
|
|
|
|
PSYC_TYPE_LIST,
|
|
|
|
PSYC_TYPE_NICK,
|
|
|
|
PSYC_TYPE_PAGE,
|
2011-11-21 15:00:46 +00:00
|
|
|
PSYC_TYPE_TABLE,
|
2011-11-11 21:18:24 +00:00
|
|
|
PSYC_TYPE_TIME,
|
2011-11-21 15:00:46 +00:00
|
|
|
PSYC_TYPE_UNIFORM,
|
2011-10-31 19:26:47 +00:00
|
|
|
} PsycType;
|
2011-04-20 17:18:35 +00:00
|
|
|
|
2011-04-21 12:20:24 +00:00
|
|
|
/**
|
|
|
|
* List types.
|
|
|
|
* Possible types are text and binary.
|
|
|
|
*/
|
2011-11-11 21:18:24 +00:00
|
|
|
typedef enum {
|
|
|
|
PSYC_LIST_TEXT = 1,
|
|
|
|
PSYC_LIST_BINARY = 2,
|
2011-10-31 19:26:47 +00:00
|
|
|
} PsycListType;
|
2011-04-21 12:20:24 +00:00
|
|
|
|
2011-05-08 23:49:04 +00:00
|
|
|
/**
|
|
|
|
* String struct.
|
|
|
|
*
|
|
|
|
* Contains pointer and length for a buffer.
|
|
|
|
*/
|
2011-11-11 21:18:24 +00:00
|
|
|
typedef struct {
|
|
|
|
/// Length of the data pointed to by ptr
|
|
|
|
size_t length;
|
|
|
|
/// pointer to the data
|
|
|
|
char *data;
|
2011-10-31 19:26:47 +00:00
|
|
|
} PsycString;
|
2011-04-22 15:09:32 +00:00
|
|
|
|
2011-12-28 22:45:16 +00:00
|
|
|
#include "psyc/syntax.h"
|
2012-01-09 10:52:09 +00:00
|
|
|
#include "psyc/match.h"
|
2011-12-28 22:45:16 +00:00
|
|
|
#include "psyc/method.h"
|
|
|
|
#include "psyc/packet.h"
|
|
|
|
#include "psyc/parse.h"
|
|
|
|
#include "psyc/render.h"
|
|
|
|
#include "psyc/text.h"
|
|
|
|
#include "psyc/uniform.h"
|
2011-10-31 19:04:16 +00:00
|
|
|
#include "psyc/variable.h"
|
2011-04-16 15:30:03 +00:00
|
|
|
|
2011-05-09 07:02:15 +00:00
|
|
|
#endif
|