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

how to pass constrant strings with length at compile time

This commit is contained in:
psyc://psyced.org/~lynX 2011-04-23 17:16:05 +02:00
parent f6448c8fe7
commit 742323e414
2 changed files with 12 additions and 7 deletions

View file

@ -98,6 +98,9 @@ typedef struct
const char* ptr;
} PSYC_Array;
#define PSYC_C2ARRAY(string) { sizeof(string)-1, string }
#define PSYC_C2ARG(string) string, sizeof(string)-1
/* intermediate struct for a PSYC variable modification */
typedef struct {
char oper; // not call it 'operator' as C++ may not like that..?

View file

@ -5,22 +5,24 @@ const PSYC_Array PSYC_routingVars[] = /// Routing variables in alphabetical orde
{
{17, "_amount_fragments"},
{ 8, "_context"},
{ 6, "_count"},
// { 6, "_count"}, // older PSYC
{ 8, "_counter"}, // the name for this is supposed to be _count, not _counter
{ 9, "_fragment"},
{ 7, "_length"},
// { 7, "_length"}, // older PSYC
{ 7, "_source"},
{22, "_source_identification"},
{13, "_source_relay"},
PSYC_C2ARRAY("_source_identification"),
// {22, "_source_identification"},
PSYC_C2ARRAY("_source_relay"),
// {13, "_source_relay"},
{19, "_source_relay_relay"}, // until you have a better idea.. is this really in use?
{ 4, "_tag"},
{10, "_tag_relay"},
{10, "_tag_reply"}, // should be obsolete, but.. TODO
// {10, "_tag_reply"}, // older PSYC
{ 7, "_target"},
{15, "_target_forward"},
{13, "_target_relay"},
{19, "_understand_modules"},
{14, "_using_modules"},
// {19, "_understand_modules"}, // older PSYC
// {14, "_using_modules"}, // older PSYC
};
const size_t PSYC_routingVarsNum = sizeof(PSYC_routingVars) / sizeof(*PSYC_routingVars);