Module Name: othersrc Committed By: agc Date: Thu Feb 23 19:36:08 UTC 2023
Modified Files: othersrc/external/bsd/elex/dist: agcre.c elex.c elex.h main.c striter.c othersrc/external/bsd/elex/dist/tests: 28.expected Added Files: othersrc/external/bsd/elex: namespace.mk Log Message: Update elex to version 20230223 + add introspection - add a "namespace" action to elex_exec_str to return any embedded library namespace used when compiling + move LIB_NAMESPACE from embedded definitions to be defined in Makefiles, and include the makefile snippet if it exists + README typo fixes and added clarification from Brad Harder + bump version to 20230223 To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/elex/namespace.mk cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/elex/dist/agcre.c \ othersrc/external/bsd/elex/dist/elex.c \ othersrc/external/bsd/elex/dist/elex.h \ othersrc/external/bsd/elex/dist/main.c \ othersrc/external/bsd/elex/dist/striter.c cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/elex/dist/tests/28.expected Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/external/bsd/elex/dist/agcre.c diff -u othersrc/external/bsd/elex/dist/agcre.c:1.2 othersrc/external/bsd/elex/dist/agcre.c:1.3 --- othersrc/external/bsd/elex/dist/agcre.c:1.2 Wed Feb 22 01:01:39 2023 +++ othersrc/external/bsd/elex/dist/agcre.c Thu Feb 23 19:36:07 2023 @@ -36,7 +36,6 @@ #include <string.h> #include <unistd.h> -#define LIB_NAMESPACE elex_ #include "agcre.h" /* callback struct */ Index: othersrc/external/bsd/elex/dist/elex.c diff -u othersrc/external/bsd/elex/dist/elex.c:1.2 othersrc/external/bsd/elex/dist/elex.c:1.3 --- othersrc/external/bsd/elex/dist/elex.c:1.2 Wed Feb 22 01:01:39 2023 +++ othersrc/external/bsd/elex/dist/elex.c Thu Feb 23 19:36:07 2023 @@ -33,7 +33,6 @@ #include <string.h> #include <unistd.h> -#define LIB_NAMESPACE elex_ #include "agcre.h" #include "striter.h" #include "elex.h" @@ -672,13 +671,17 @@ elex_exec(elex_t *elex, const char *info return 0; } +/* used to stringify the namespace we're using */ +#define ELEX_STRINGIFY(_x) ELEX_STRINGIFY2(_x) +#define ELEX_STRINGIFY2(_x) #_x + /* one function to access string values */ void * elex_exec_str(elex_t *elex, const char *info, uint64_t n, uint64_t *size) { uint64_t len; - if (elex == NULL || info == NULL) { + if (elex == NULL || info == NULL || size == NULL) { return NULL; } switch(djbhash(info)) { @@ -698,6 +701,9 @@ elex_exec_str(elex_t *elex, const char * return allocate(elex->states[elex->yystate].name, strlen(elex->states[elex->yystate].name), size); case /* "get-yytext" */ 0x88065864: return allocate(elex->yytext, elex->yyleng, size); + case /* "namespace" */ 0x41041c23: + return allocate(ELEX_STRINGIFY(LIB_NAMESPACE), + strlen(ELEX_STRINGIFY(LIB_NAMESPACE)), size); } return NULL; } Index: othersrc/external/bsd/elex/dist/elex.h diff -u othersrc/external/bsd/elex/dist/elex.h:1.2 othersrc/external/bsd/elex/dist/elex.h:1.3 --- othersrc/external/bsd/elex/dist/elex.h:1.2 Wed Feb 22 01:01:39 2023 +++ othersrc/external/bsd/elex/dist/elex.h Thu Feb 23 19:36:07 2023 @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef ELEX_H_ -#define ELEX_H_ 20230221 +#define ELEX_H_ 20230223 #include <inttypes.h> Index: othersrc/external/bsd/elex/dist/main.c diff -u othersrc/external/bsd/elex/dist/main.c:1.2 othersrc/external/bsd/elex/dist/main.c:1.3 --- othersrc/external/bsd/elex/dist/main.c:1.2 Wed Feb 22 01:01:39 2023 +++ othersrc/external/bsd/elex/dist/main.c Thu Feb 23 19:36:07 2023 @@ -32,7 +32,6 @@ #include <string.h> #include <unistd.h> -#define LIB_NAMESPACE elex_ #include "elex.h" #define STRINGIFY(x) #x Index: othersrc/external/bsd/elex/dist/striter.c diff -u othersrc/external/bsd/elex/dist/striter.c:1.2 othersrc/external/bsd/elex/dist/striter.c:1.3 --- othersrc/external/bsd/elex/dist/striter.c:1.2 Wed Feb 22 01:20:52 2023 +++ othersrc/external/bsd/elex/dist/striter.c Thu Feb 23 19:36:07 2023 @@ -33,7 +33,6 @@ #include <string.h> #include <unistd.h> -#define LIB_NAMESPACE elex_ #include "striter.h" /* a string iterator structure */ Index: othersrc/external/bsd/elex/dist/tests/28.expected diff -u othersrc/external/bsd/elex/dist/tests/28.expected:1.2 othersrc/external/bsd/elex/dist/tests/28.expected:1.3 --- othersrc/external/bsd/elex/dist/tests/28.expected:1.2 Wed Feb 22 01:01:40 2023 +++ othersrc/external/bsd/elex/dist/tests/28.expected Thu Feb 23 19:36:08 2023 @@ -1 +1 @@ -elex version 20230221 +elex version 20230223 Added files: Index: othersrc/external/bsd/elex/namespace.mk diff -u /dev/null othersrc/external/bsd/elex/namespace.mk:1.1 --- /dev/null Thu Feb 23 19:36:08 2023 +++ othersrc/external/bsd/elex/namespace.mk Thu Feb 23 19:36:07 2023 @@ -0,0 +1 @@ +CPPFLAGS+= -DLIB_NAMESPACE="elex_"