Alphabetize twine functions
This commit is contained in:
parent
7633b91d1a
commit
fee831260f
|
@ -4,9 +4,9 @@
|
||||||
#include <gargoyle/codex.h>
|
#include <gargoyle/codex.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
uint8_t gargoyle_is_sep(char tok);
|
|
||||||
uint8_t gargoyle_is_eql(char lhs, char rhs);
|
|
||||||
uint8_t gargoyle_cmp(const char *s1, const char *s2, uint16_t len, gargoyle_flag_type flags);
|
uint8_t gargoyle_cmp(const char *s1, const char *s2, uint16_t len, gargoyle_flag_type flags);
|
||||||
char *gargoyle_cpy(char *dst, const char *src, uint16_t len, gargoyle_flag_type flags);
|
char *gargoyle_cpy(char *dst, const char *src, uint16_t len, gargoyle_flag_type flags);
|
||||||
|
uint8_t gargoyle_is_eql(char lhs, char rhs);
|
||||||
|
uint8_t gargoyle_is_sep(char tok);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
16
src/twine.c
16
src/twine.c
|
@ -2,14 +2,6 @@
|
||||||
#include <gargoyle/codex.h>
|
#include <gargoyle/codex.h>
|
||||||
#include <gargoyle/twine.h>
|
#include <gargoyle/twine.h>
|
||||||
|
|
||||||
uint8_t gargoyle_is_sep(char tok) {
|
|
||||||
return (tok == '_' || tok == '-');
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t gargoyle_is_eql(char lhs, char rhs) {
|
|
||||||
return tolower(lhs) == tolower(rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t gargoyle_cmp(const char *s1, const char *s2, uint16_t len, gargoyle_flag_type flags) {
|
uint8_t gargoyle_cmp(const char *s1, const char *s2, uint16_t len, gargoyle_flag_type flags) {
|
||||||
while(*s1 && *s2 && len) {
|
while(*s1 && *s2 && len) {
|
||||||
if(flags & GARGOYLE_FLG_ICASE && isalpha(*s1) && gargoyle_is_eql(*s1, *s2)) {
|
if(flags & GARGOYLE_FLG_ICASE && isalpha(*s1) && gargoyle_is_eql(*s1, *s2)) {
|
||||||
|
@ -45,3 +37,11 @@ char *gargoyle_cpy(char *dst, const char *src, uint16_t len, gargoyle_flag_type
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t gargoyle_is_eql(char lhs, char rhs) {
|
||||||
|
return tolower(lhs) == tolower(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t gargoyle_is_sep(char tok) {
|
||||||
|
return (tok == '_' || tok == '-');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue