Add new options and tweak stuff around
This commit is contained in:
parent
a60d0039c1
commit
38b18dbdd3
|
@ -13,22 +13,31 @@ OPTION(CMAKE_BUILD_TYPE "Debug")
|
|||
OPTION(BUILD_TESTS "Build tests for ctest" OFF)
|
||||
OPTION(BUILD_IRCV3 "Build IRCv3 components" ON)
|
||||
OPTION(BUILD_HELPERS "Build message helpers" ON)
|
||||
OPTION(BUILD_VALIDATORS "Build message validators" ON)
|
||||
|
||||
if ( BUILD_IRCV3 )
|
||||
message(STATUS "IRCv3 capabilities are going to be built.")
|
||||
add_compile_definitions(UIRC_IRCV3)
|
||||
endif()
|
||||
|
||||
if ( BUILD_VALIDATORS )
|
||||
message(STATUS "Message validators are going to be built.")
|
||||
add_compile_definitions(UIRC_VALIDATORS)
|
||||
set(build_FILES ${build_FILES} src/validators.c)
|
||||
endif()
|
||||
|
||||
set(build_FILES
|
||||
src/assemblers.c
|
||||
src/misc.c
|
||||
src/tokenizers.c
|
||||
src/validators.c
|
||||
)
|
||||
|
||||
if ( BUILD_HELPERS )
|
||||
message(STATUS "Helper functions are going to be built.")
|
||||
set(build_FILES ${build_FILES} src/helpers.c src/taghelpers.c)
|
||||
set(build_FILES ${build_FILES} src/helpers.c)
|
||||
if ( BUILD_IRCV3 )
|
||||
set(build_FILES ${build_FILES} src/taghelpers.c)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(uirc SHARED ${build_FILES})
|
||||
|
|
11
README.md
11
README.md
|
@ -11,11 +11,12 @@ First, create the required build files (usually the Makefile)
|
|||
```sh
|
||||
cmake -H . -B build/ -DCMAKE_BUILD_TYPE=Release
|
||||
```
|
||||
| Option | Description | Type | Default | Supported since |
|
||||
|:-------------:|:---------------------------------------------------------------------:|:--------:|:-------:|:---------------:|
|
||||
| BUILD_HELPERS | Build simple assemblers and tokenizers that handle the heavy lifting | boolean | true | - |
|
||||
| BUILD_TESTS | Build tests that check if the build results behave as they should | boolean | false | - |
|
||||
| BUILD_IRCV3 | Build IRCv3 support (WIP) | boolean | true | - |
|
||||
| Option | Description | Type | Default | Supported since |
|
||||
|:------------------:|:----------------------------------------------------------------------:|:--------:|:-------:|:---------------:|
|
||||
| BUILD_HELPERS | Build simple assemblers and tokenizers that handle the heavy lifting | boolean | true | - |
|
||||
| BUILD_VALIDATORS | Build validators that check if the messages follow the standards (WIP) | boolean | true | 2020.10.29 |
|
||||
| BUILD_TESTS | Build tests that check if the build results behave as they should | boolean | false | - |
|
||||
| BUILD_IRCV3 | Build IRCv3 support (WIP) | boolean | true | - |
|
||||
|
||||
Following that, just use your build system and compile it
|
||||
|
||||
|
|
|
@ -36,11 +36,13 @@ extern signed long Assm_tags(char* buf, IRC_Tags* in, size_t len);
|
|||
#endif
|
||||
|
||||
/* Validators: They check that the parsed message is valid and follows the standard */
|
||||
#ifdef UIRC_VALIDATORS
|
||||
extern signed int Val_mesg(IRC_Message* mesg);
|
||||
extern signed int Val_channame(char* chan);
|
||||
extern signed int Val_type_nocrlf(char* str);
|
||||
extern signed int Val_type_nospcl(char* str);
|
||||
extern signed int Val_type_noblcm(char* str);
|
||||
#endif
|
||||
|
||||
/* Converters: They convert from one format to another */
|
||||
extern signed int Ircmd_stoi(char* str);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#define MBMASK_INVIS 4 /* 100 */
|
||||
|
||||
/* IRCv3 Supported features bitmask */
|
||||
#ifdef UIRC_IRCV3
|
||||
#define CAP_AWAY_NOTIFY 1 << 3
|
||||
#define CAP_BATCH 1 << 4
|
||||
#define CAP_CAP_NOTIFY 1 << 5
|
||||
|
@ -48,6 +49,7 @@
|
|||
#define CAP_SETNAME 1 << 17
|
||||
#define CAP_TLS 1 << 18
|
||||
#define CAP_USERHOST_IN_NAMES 1 << 19
|
||||
#endif
|
||||
|
||||
extern const char* const IRC_Cmds[];
|
||||
|
||||
|
|
|
@ -89,6 +89,17 @@ IRC_Message* Assm_cmd_SUMMON(char* user, char* target, char* channel);
|
|||
IRC_Message* Assm_cmd_USERHOST(char* users[]);
|
||||
IRC_Message* Assm_cmd_ISON(char* users[]);
|
||||
|
||||
#ifdef UIRC_IRCV3
|
||||
#define Assm_cmd_CAP_END() Assm_AUTO(CAP, false, (char*[]){NULL}, 0)
|
||||
#define Assm_cmd_CAP_LIST() Assm_AUTO(CAP, false, (char*[]){NULL}, 0)
|
||||
|
||||
#define Assm_cmd_CAP_LS(version) Assm_AUTO(CAP, false, (char*[]){version, NULL}, 0)
|
||||
#define Assm_cmd_CAP_REQ(caps) Assm_AUTO(CAP, true, (char*[]){caps, NULL}, 1)
|
||||
|
||||
#define Assm_cmd_CAP_NEW(nick, caps) Assm_AUTO(CAP, true, (char*[]){nick, caps, NULL}, 2)
|
||||
#define Assm_cmd_CAP_DEL(nick, caps) Assm_AUTO(CAP, true, (char*[]){nick, caps, NULL}, 2)
|
||||
#endif
|
||||
|
||||
void Tok_cmd_PING(IRC_Message* mesg, char** source, char** target);
|
||||
void Tok_FArgOpt(IRC_Message* mesg, char** optarg, char** reqarg);
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef UIRC_VALIDATORS
|
||||
#ifndef UIRC_INCLUDED_VALIDATORS
|
||||
#define UIRC_INCLUDED_VALIDATORS
|
||||
signed int Val_mesg(IRC_Message* mesg);
|
||||
|
@ -29,4 +30,5 @@ signed int Val_type_nospcl(char* str);
|
|||
signed int Val_type_noblcm(char* str);
|
||||
signed int Val_channame(char* chan);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
Reference in New Issue