• R/O
  • SSH

mcuhal.arm: Commit

самопильный ХАЛ над библиотекой milandr SPL. позиционируется наличие порта порт на STM32 SPL.


Commit MetaInfo

Revision552dc88da7198c66665c2ac299c6e12b0e6ba29b (tree)
Zeit2022-04-23 16:49:20
Autoralexrayne <alexraynepe196@gmai...>
Commiteralexrayne

Log Message

+lib: str_util: - дополнения к libc
+ str_[r]insertc - inserts char in string
+ i/utoa - some libc have no this functions, so propose. now only contiki ware implements it

Ändern Zusammenfassung

Diff

diff -r 61e1cedcadd8 -r 552dc88da719 lib/str_util.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/str_util.c Sat Apr 23 10:49:20 2022 +0300
@@ -0,0 +1,35 @@
1+/*
2+ * str_util.c
3+ *
4+ * Created on: 22//11/2021
5+ * Author: alexrayne <alexraynepe196@gmail.com>
6+ ------------------------------------------------------------------------
7+ Copyright (c) alexrayne
8+ */
9+
10+#include "str_util.h"
11+#include "string.h"
12+#include "memory.h"
13+
14+
15+
16+char* str_insertc(char* s, char x){
17+ unsigned len = strlen(s);
18+ memmove(s+1, s, len+1);
19+ s[0] = x;
20+ return s;
21+}
22+
23+char* str_rinsertc(char* s, unsigned fromtail, char x){
24+ unsigned len = strlen(s);
25+ if (len < fromtail)
26+ return s;
27+
28+ char* y = s+len-fromtail;
29+ len = fromtail;
30+ memmove(y+1, y, len+1);
31+ y[0] = x;
32+
33+ return s;
34+}
35+
diff -r 61e1cedcadd8 -r 552dc88da719 lib/str_util.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/str_util.h Sat Apr 23 10:49:20 2022 +0300
@@ -0,0 +1,23 @@
1+/*
2+ * str_util.h
3+ *
4+ * Created on: 22//11/2021
5+ * Author: alexrayne <alexraynepe196@gmail.com>
6+ ------------------------------------------------------------------------
7+ Copyright (c) alexrayne
8+ */
9+
10+#ifndef LIB_STR_UTIL_H_
11+#define LIB_STR_UTIL_H_
12+
13+
14+char* str_insertc(char* s, char x);
15+char* str_rinsertc(char* s, unsigned fromtail, char x);
16+
17+
18+/* some compilers absent this functions */
19+char* itoa(int, char *, int);
20+char* utoa(unsigned, char *, int);
21+
22+
23+#endif /* LIB_STR_UTIL_H_ */
Show on old repository browser