Numworks Epsilon
1.4.1
Graphing Calculator Operating System
text_input_helpers.cpp
Go to the documentation of this file.
1
#include <
escher/text_input_helpers.h
>
2
#include <string.h>
3
4
namespace
TextInputHelpers
{
5
6
int
CursorIndexInCommand
(
const
char
* text) {
7
for
(
size_t
i = 0; i <
strlen
(text)-1; i++) {
8
if
(text[i] ==
'('
|| text[i] ==
'\''
) {
9
if
(text[i+1] ==
')'
|| text[i+1] ==
'\''
|| text[i+1] ==
','
) {
10
if
(i >=
strlen
(k_random) &&
memcmp
(&text[i-
strlen
(k_random)], k_random,
strlen
(k_random)) == 0) {
11
break
;
12
}
13
return
i + 1;
14
}
15
}
16
}
17
return
strlen
(text);
18
}
19
20
}
text_input_helpers.h
strlen
size_t strlen(const char *s)
Definition:
strlen.c:3
TextInputHelpers
Definition:
text_input_helpers.h:6
memcmp
LIBA_BEGIN_DECLS int memcmp(const void *s1, const void *s2, size_t n)
Definition:
memcmp.c:3
TextInputHelpers::CursorIndexInCommand
int CursorIndexInCommand(const char *text)
Definition:
text_input_helpers.cpp:6
epsilon
escher
src
text_input_helpers.cpp
Generated by
1.8.14