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_TESTS "Build tests for ctest" OFF)
|
||||||
OPTION(BUILD_IRCV3 "Build IRCv3 components" ON)
|
OPTION(BUILD_IRCV3 "Build IRCv3 components" ON)
|
||||||
OPTION(BUILD_HELPERS "Build message helpers" ON)
|
OPTION(BUILD_HELPERS "Build message helpers" ON)
|
||||||
|
OPTION(BUILD_VALIDATORS "Build message validators" ON)
|
||||||
|
|
||||||
if ( BUILD_IRCV3 )
|
if ( BUILD_IRCV3 )
|
||||||
message(STATUS "IRCv3 capabilities are going to be built.")
|
message(STATUS "IRCv3 capabilities are going to be built.")
|
||||||
add_compile_definitions(UIRC_IRCV3)
|
add_compile_definitions(UIRC_IRCV3)
|
||||||
endif()
|
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
|
set(build_FILES
|
||||||
src/assemblers.c
|
src/assemblers.c
|
||||||
src/misc.c
|
src/misc.c
|
||||||
src/tokenizers.c
|
src/tokenizers.c
|
||||||
src/validators.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if ( BUILD_HELPERS )
|
if ( BUILD_HELPERS )
|
||||||
message(STATUS "Helper functions are going to be built.")
|
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()
|
endif()
|
||||||
|
|
||||||
add_library(uirc SHARED ${build_FILES})
|
add_library(uirc SHARED ${build_FILES})
|
||||||
|
|
|
@ -12,8 +12,9 @@ First, create the required build files (usually the Makefile)
|
||||||
cmake -H . -B build/ -DCMAKE_BUILD_TYPE=Release
|
cmake -H . -B build/ -DCMAKE_BUILD_TYPE=Release
|
||||||
```
|
```
|
||||||
| Option | Description | Type | Default | Supported since |
|
| Option | Description | Type | Default | Supported since |
|
||||||
|:-------------:|:---------------------------------------------------------------------:|:--------:|:-------:|:---------------:|
|
|:------------------:|:----------------------------------------------------------------------:|:--------:|:-------:|:---------------:|
|
||||||
| BUILD_HELPERS | Build simple assemblers and tokenizers that handle the heavy lifting | boolean | true | - |
|
| 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_TESTS | Build tests that check if the build results behave as they should | boolean | false | - |
|
||||||
| BUILD_IRCV3 | Build IRCv3 support (WIP) | boolean | true | - |
|
| BUILD_IRCV3 | Build IRCv3 support (WIP) | boolean | true | - |
|
||||||
|
|
||||||
|
|
|
@ -36,11 +36,13 @@ extern signed long Assm_tags(char* buf, IRC_Tags* in, size_t len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Validators: They check that the parsed message is valid and follows the standard */
|
/* 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_mesg(IRC_Message* mesg);
|
||||||
extern signed int Val_channame(char* chan);
|
extern signed int Val_channame(char* chan);
|
||||||
extern signed int Val_type_nocrlf(char* str);
|
extern signed int Val_type_nocrlf(char* str);
|
||||||
extern signed int Val_type_nospcl(char* str);
|
extern signed int Val_type_nospcl(char* str);
|
||||||
extern signed int Val_type_noblcm(char* str);
|
extern signed int Val_type_noblcm(char* str);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Converters: They convert from one format to another */
|
/* Converters: They convert from one format to another */
|
||||||
extern signed int Ircmd_stoi(char* str);
|
extern signed int Ircmd_stoi(char* str);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#define MBMASK_INVIS 4 /* 100 */
|
#define MBMASK_INVIS 4 /* 100 */
|
||||||
|
|
||||||
/* IRCv3 Supported features bitmask */
|
/* IRCv3 Supported features bitmask */
|
||||||
|
#ifdef UIRC_IRCV3
|
||||||
#define CAP_AWAY_NOTIFY 1 << 3
|
#define CAP_AWAY_NOTIFY 1 << 3
|
||||||
#define CAP_BATCH 1 << 4
|
#define CAP_BATCH 1 << 4
|
||||||
#define CAP_CAP_NOTIFY 1 << 5
|
#define CAP_CAP_NOTIFY 1 << 5
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
#define CAP_SETNAME 1 << 17
|
#define CAP_SETNAME 1 << 17
|
||||||
#define CAP_TLS 1 << 18
|
#define CAP_TLS 1 << 18
|
||||||
#define CAP_USERHOST_IN_NAMES 1 << 19
|
#define CAP_USERHOST_IN_NAMES 1 << 19
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const char* const IRC_Cmds[];
|
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_USERHOST(char* users[]);
|
||||||
IRC_Message* Assm_cmd_ISON(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_cmd_PING(IRC_Message* mesg, char** source, char** target);
|
||||||
void Tok_FArgOpt(IRC_Message* mesg, char** optarg, char** reqarg);
|
void Tok_FArgOpt(IRC_Message* mesg, char** optarg, char** reqarg);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef UIRC_VALIDATORS
|
||||||
#ifndef UIRC_INCLUDED_VALIDATORS
|
#ifndef UIRC_INCLUDED_VALIDATORS
|
||||||
#define UIRC_INCLUDED_VALIDATORS
|
#define UIRC_INCLUDED_VALIDATORS
|
||||||
signed int Val_mesg(IRC_Message* mesg);
|
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_type_noblcm(char* str);
|
||||||
signed int Val_channame(char* chan);
|
signed int Val_channame(char* chan);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
Reference in New Issue