summaryrefslogtreecommitdiff
path: root/src/u8c/u32.h.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/u8c/u32.h.d')
-rw-r--r--src/u8c/u32.h.d/u32alloc.c29
-rw-r--r--src/u8c/u32.h.d/u32cat.c49
-rw-r--r--src/u8c/u32.h.d/u32cmp.c45
-rw-r--r--src/u8c/u32.h.d/u32cp.c42
-rw-r--r--src/u8c/u32.h.d/u32fndchr.c44
-rw-r--r--src/u8c/u32.h.d/u32fndpat.c47
-rw-r--r--src/u8c/u32.h.d/u32free.c24
-rw-r--r--src/u8c/u32.h.d/u32ins.c45
-rw-r--r--src/u8c/u32.h.d/u32substr.c45
-rw-r--r--src/u8c/u32.h.d/u32sz.c31
10 files changed, 0 insertions, 401 deletions
diff --git a/src/u8c/u32.h.d/u32alloc.c b/src/u8c/u32.h.d/u32alloc.c
deleted file mode 100644
index b64a1ee..0000000
--- a/src/u8c/u32.h.d/u32alloc.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <stdbool.h>
-# include <stdlib.h>
-# include <u8c/err.h>
-# include <u8c/u32.h>
-# include <uchar.h>
-bool u8c_u32alloc(char32_t * * const _u32,size_t const _sz) {
- char32_t * arr = NULL;
- if((arr = calloc(sizeof *arr,_sz)) == NULL) {
- u8c_seterr(U"u8c_u32alloc: Unable to allocate resources (not enough memory?).",u8c_errtyp_badalloc);
- return false;
- }
- *_u32 = arr;
- return false;
-}
diff --git a/src/u8c/u32.h.d/u32cat.c b/src/u8c/u32.h.d/u32cat.c
deleted file mode 100644
index 600e0dc..0000000
--- a/src/u8c/u32.h.d/u32cat.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <assert.h>
-# include <stdbool.h>
-# include <stdlib.h>
-# include <u8c/SIZE_C.h>
-# include <u8c/err.h>
-# include <u8c/u32.h>
-# include <uchar.h>
-bool u8c_u32cat(size_t * const _sz,char32_t const * * const _out,char32_t const * const _lstr,char32_t const * const _rstr) {
- assert(_out != NULL);
- assert(_lstr != NULL);
- assert(_rstr != NULL);
- size_t sz = SIZE_C(0x0);
- size_t lsz = SIZE_C(0x0);
- size_t rsz = SIZE_C(0x0);
- u8c_u32sz(&lsz,_lstr);
- u8c_u32sz(&rsz,_rstr);
- sz = lsz + rsz;
- if(_sz != NULL) {
- *_sz = sz;
- }
- char32_t * out = NULL;
- if(u8c_u32alloc(&out,sz + SIZE_C(0x1))) {
- return true;
- }
- for(register size_t n = SIZE_C(0x0);n < lsz;n += SIZE_C(0x1)) {
- out[n] = _lstr[n];
- }
- for(register size_t n = SIZE_C(0x0);n < rsz;n += SIZE_C(0x1)) {
- out[n + lsz] = _rstr[n];
- }
- u8c_u32free(_out);
- *_out = out;
- return false;
-}
diff --git a/src/u8c/u32.h.d/u32cmp.c b/src/u8c/u32.h.d/u32cmp.c
deleted file mode 100644
index 8a6617d..0000000
--- a/src/u8c/u32.h.d/u32cmp.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <assert.h>
-# include <stdbool.h>
-# include <stddef.h>
-# include <stdint.h>
-# include <u8c/SIZE_C.h>
-# include <u8c/err.h>
-# include <u8c/u32.h>
-bool u8c_u32cmp(uint_least8_t * const _res,char32_t const * const _lstr,char32_t const * const _rstr) {
- assert(_res != NULL);
- assert(_lstr != NULL);
- assert(_rstr != NULL);
- for(register size_t n = SIZE_C(0x0);n <= SIZE_MAX;n += SIZE_C(0x1)) {
- register char32_t const lchr = _lstr[n];
- register char32_t const rchr = _rstr[n];
- if(lchr != rchr) {
- if(lchr < rchr) {
- *_res = UINT8_C(0x0);
- return false;
- }
- *_res = UINT8_C(0x2);
- return false;
- }
- if(lchr == UINT32_C(0x0)) {
- *_res = UINT8_C(0x1);
- return false;
- }
- }
- u8c_seterr(U"u8c_u32cmp: Unterminated input.",u8c_errtyp_untermin);
- return true;
-}
diff --git a/src/u8c/u32.h.d/u32cp.c b/src/u8c/u32.h.d/u32cp.c
deleted file mode 100644
index 95a9b35..0000000
--- a/src/u8c/u32.h.d/u32cp.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <assert.h>
-# include <stdbool.h>
-# include <stdlib.h>
-# include <u8c/SIZE_C.h>
-# include <u8c/err.h>
-# include <u8c/u32.h>
-bool u8c_u32cp(size_t * const _sz,char32_t const * * const _out,char32_t const * const _in) {
- assert(_out != NULL);
- assert(_in != NULL);
- if(*_out != NULL) {
- u8c_u32free(&*_out);
- }
- size_t insz = SIZE_C(0x0);
- u8c_u32sz(&insz,_in);
- if(_sz != NULL) {
- *_sz = insz;
- }
- uint_least32_t * out = NULL;
- if(u8c_u32alloc(&out,insz + SIZE_C(0x1))) {
- return false;
- }
- for(register size_t n = SIZE_C(0x0);n < insz;n += SIZE_C(0x1)) {
- out[n] = _in[n];
- }
- *_out = out;
- return false;
-}
diff --git a/src/u8c/u32.h.d/u32fndchr.c b/src/u8c/u32.h.d/u32fndchr.c
deleted file mode 100644
index 228c553..0000000
--- a/src/u8c/u32.h.d/u32fndchr.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <assert.h>
-# include <stdbool.h>
-# include <stddef.h>
-# include <stdint.h>
-# include <u8c/SIZE_C.h>
-# include <u8c/err.h>
-# include <u8c/u32.h>
-bool u8c_u32fndchr(size_t * const _pos,char32_t const * const _in,char32_t const _chr) {
- assert(_pos != NULL);
- assert(_in != NULL);
- for(register size_t n = SIZE_C(0x0);n <= SIZE_MAX;n += SIZE_C(0x1)) {
- register uint_least32_t const tmp = _in[n];
- if(tmp == U'\x0') {
- if(_chr == U'\x0') {
- *_pos = n;
- return false;
- }
- *_pos = SIZE_C(-0x1);
- return true;
- }
- if(tmp == _chr) {
- *_pos = n;
- return false;
- }
- }
- u8c_seterr(U"u8c_u32fndchr: Unterminated input.",u8c_errtyp_badio);
- *_pos = SIZE_C(-0x1);
- return true;
-}
diff --git a/src/u8c/u32.h.d/u32fndpat.c b/src/u8c/u32.h.d/u32fndpat.c
deleted file mode 100644
index 5a1b5d2..0000000
--- a/src/u8c/u32.h.d/u32fndpat.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <assert.h>
-# include <stdbool.h>
-# include <stddef.h>
-# include <stdint.h>
-# include <u8c/SIZE_C.h>
-# include <u8c/err.h>
-# include <u8c/u32.h>
-bool u8c_u32fndpat(size_t * const _pos,char32_t const * const _in,char32_t const * const _pat) {
- assert(_pos != NULL);
- assert(_in != NULL);
- size_t insz = SIZE_C(0x0);
- size_t patsz = SIZE_C(0x0);
- u8c_u32sz(&insz,_in);
- u8c_u32sz(&patsz,_pat);
- if(insz == SIZE_C(0x1) || insz < patsz) {
- *_pos = SIZE_C(-0x1);
- return false;
- }
- for(register size_t n = SIZE_C(0x0);n < insz - patsz;n += SIZE_C(0x1)) {
- char32_t const * str = NULL;
- u8c_u32substr(&str,n,patsz - SIZE_C(0x1),_in);
- uint_least8_t cmpres = UINT8_C(0x0);
- u8c_u32cmp(&cmpres,str,_pat);
- u8c_u32free(&str);
- if(cmpres == UINT8_C(0x1)) {
- *_pos = n;
- return false;
- }
- }
- *_pos = SIZE_C(-0x1);
- return false;
-}
diff --git a/src/u8c/u32.h.d/u32free.c b/src/u8c/u32.h.d/u32free.c
deleted file mode 100644
index a0b120b..0000000
--- a/src/u8c/u32.h.d/u32free.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <stdbool.h>
-# include <stdint.h>
-# include <stdlib.h>
-# include <u8c/u32.h>
-bool u8c_u32free(char32_t const * * const _u32) {
- free((char32_t *)*_u32); /* This cast does indeed discard a const-qualifier, but it is not undefined behaviour, as the array must have been allocated by calloc or malloc, meaning it's original type is not const-qualified. */
- *_u32 = NULL;
- return false;
-}
diff --git a/src/u8c/u32.h.d/u32ins.c b/src/u8c/u32.h.d/u32ins.c
deleted file mode 100644
index 7fccb7c..0000000
--- a/src/u8c/u32.h.d/u32ins.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <assert.h>
-# include <stdbool.h>
-# include <stddef.h>
-# include <u8c/SIZE_C.h>
-# include <u8c/u32.h>
-# include <uchar.h>
-bool u8c_u32ins(size_t * const _sz,char32_t const * * const _out,size_t const _pos,char32_t const * const _str0,char32_t const * const _str1) {
- assert(_out != NULL);
- assert(_str0 != NULL);
- assert(_str1 != NULL);
- char32_t const * lstr = NULL;
- char32_t const * rstr = NULL;
- u8c_u32substr(&lstr,SIZE_C(0x0),_pos - SIZE_C(0x1),_str0);
- u8c_u32substr(&rstr,_pos,SIZE_C(0x0),_str0);
- size_t sz = SIZE_C(0x0);
- char32_t const * out = NULL;
- {
- char32_t const * tmp = NULL;
- u8c_u32cat(NULL,&tmp,lstr,_str1);
- u8c_u32free(&lstr);
- u8c_u32cat(NULL,&out,tmp,rstr);
- u8c_u32free(&rstr);
- u8c_u32free(&tmp);
- }
- if(_sz != NULL) {
- *_sz = sz;
- }
- *_out = out;
- return false;
-}
diff --git a/src/u8c/u32.h.d/u32substr.c b/src/u8c/u32.h.d/u32substr.c
deleted file mode 100644
index 855d062..0000000
--- a/src/u8c/u32.h.d/u32substr.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <assert.h>
-# include <stdbool.h>
-# include <stdlib.h>
-# include <u8c/SIZE_C.h>
-# include <u8c/u32.h>
-# include <uchar.h>
-bool u8c_u32substr(char32_t const * * const _out,size_t const _start,size_t const _len,char32_t const * const _in) {
- assert(_out != NULL);
- assert(_in != NULL);
- u8c_u32free(_out);
- size_t insz = SIZE_C(0x0);
- u8c_u32sz(&insz,_in);
- size_t len = _len;
- if(_len == SIZE_C(0x0)) {
- len = insz - _start;
- }
- if(insz < _start + len) {
- return true;
- }
- size_t const outsz = len + SIZE_C(0x2);
- char32_t * out = NULL;
- if(u8c_u32alloc(&out,outsz)) {
- return true;
- }
- for(register size_t n = SIZE_C(0x0);n <= len;n += SIZE_C(0x1)) {
- out[n] = _in[n + _start];
- }
- *_out = out;
- return false;
-}
diff --git a/src/u8c/u32.h.d/u32sz.c b/src/u8c/u32.h.d/u32sz.c
deleted file mode 100644
index deb1ecd..0000000
--- a/src/u8c/u32.h.d/u32sz.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of u8c.
-
- u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with u8c.
-
- If not, see <https://www.gnu.org/licenses/>.
-*/
-# include <assert.h>
-# include <stdbool.h>
-# include <stddef.h>
-# include <stdint.h>
-# include <u8c/SIZE_C.h>
-# include <u8c/u32.h>
-# include <uchar.h>
-bool u8c_u32sz(size_t * const _sz,char32_t const * const _in) {
- assert(_sz != NULL);
- size_t sz = SIZE_C(0x0);
- if(u8c_u32fndchr(&sz,_in,UINT8_C(0x0))) {
- return true;
- }
- *_sz = sz;
- return true;
-}