1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00
libpsyc/include/psyc.h

57 lines
1.7 KiB
C
Raw Normal View History

2011-04-19 20:57:49 +00:00
/** @file psyc.h
*
* @brief Main psyc interface providing crucial functionality
*/
/** @mainpage Psyc Core Library
*
* @section intro_sec Introduction
*
* This is the introduction.
*
* @section install_sec Installation
*
* @subsection step1 Step 1: Opening the box
*
* etc...
*/
2011-04-16 15:30:03 +00:00
#include <stdint.h>
#include <string.h>
#define PSYC_EPOCH 1440444041 // 2015-08-24 21:20:41 CET (Monday)
/** @brief Checks if short keyword string matches long keyword string
*/
2011-04-20 13:36:56 +00:00
int PSYC_matches(char* sho, size_t slen,
char* lon, size_t llen);
2011-04-16 15:30:03 +00:00
2011-04-18 14:51:54 +00:00
/** @brief Callback for PSYC_text() that produces a value for a match
*
* The application looks up a match such as _fruit from [_fruit] and
* if found writes its current value from its variable store into the
* outgoing buffer.. "Apple" for example. The template returns the
* number of bytes written. 0 is a legal return value. Should the
* callback return -1, PSYC_text leaves the original template text as is.
*/
2011-04-18 14:54:56 +00:00
typedef int (*PSYC_textCB)(uint8_t* match, size_t mlen,
uint8_t** buffer, size_t * blen);
2011-04-18 14:51:54 +00:00
/** @brief Fills out text templates by asking a callback for content
*
* Copies the contents of the template into the buffer while looking
* for braceOpen and braceClose strings and calling the callback for
* each enclosed string between these braces. Should the callback
* return -1, the original template text is copied as is.
*
* By default PSYC's "[" and "]" are used but you can provide any other
* brace strings such as "${" and "}" or "<!--" and "-->".
*
* See also http://about.psyc.eu/psyctext
*/
2011-04-18 14:54:56 +00:00
int PSYC_text(uint8_t* template, size_t tlen,
uint8_t** buffer, size_t * blen,
2011-04-18 14:51:54 +00:00
PSYC_textCB lookupValue,
char* braceOpen, char* braceClose);