@@ -94,7 +94,7 @@ void _GREENTEA_SETUP_COMMON(const int timeout, const char *host_test_name, char
94
94
* and add host test's callback handlers to main event loop
95
95
* This function is blocking.
96
96
*/
97
- void GREENTEA_SETUP (const int timeout, const char *host_test_name) {
97
+ extern " C " void GREENTEA_SETUP (const int timeout, const char *host_test_name) {
98
98
char _value[GREENTEA_UUID_LENGTH] = {0 };
99
99
_GREENTEA_SETUP_COMMON (timeout, host_test_name, _value, GREENTEA_UUID_LENGTH);
100
100
}
@@ -293,7 +293,7 @@ inline void greentea_write_int(const int val)
293
293
* \param value Message payload, string value
294
294
*
295
295
*/
296
- void greentea_send_kv (const char *key, const char *val) {
296
+ extern " C " void greentea_send_kv (const char *key, const char *val) {
297
297
if (key && val) {
298
298
greentea_write_preamble ();
299
299
greentea_write_string (key);
@@ -511,7 +511,6 @@ static int gettok(char *, const int);
511
511
static int getNextToken (char *, const int );
512
512
static int HandleKV (char *, char *, const int , const int );
513
513
static int isstring (int );
514
- static int _get_char ();
515
514
516
515
/* *
517
516
* \brief Current token of key-value protocol's tokenizer
@@ -555,7 +554,7 @@ enum Token {
555
554
* \return Next character from the stream or EOF if stream has ended.
556
555
*
557
556
*/
558
- static int _get_char () {
557
+ extern " C " int greentea_getc () {
559
558
return greentea_serial->getc ();
560
559
}
561
560
@@ -574,7 +573,7 @@ static int _get_char() {
574
573
* success == 0 when end of the stream was found
575
574
*
576
575
*/
577
- int greentea_parse_kv (char *out_key,
576
+ extern " C " int greentea_parse_kv (char *out_key,
578
577
char *out_value,
579
578
const int out_key_size,
580
579
const int out_value_size) {
@@ -689,7 +688,7 @@ static int gettok(char *out_str, const int str_size) {
689
688
690
689
// whitespace ::=
691
690
while (isspace (LastChar)) {
692
- LastChar = _get_char ();
691
+ LastChar = greentea_getc ();
693
692
}
694
693
695
694
// string ::= [a-zA-Z0-9_-!@#$%^&*()]+
@@ -699,7 +698,7 @@ static int gettok(char *out_str, const int str_size) {
699
698
out_str[str_idx++] = LastChar;
700
699
}
701
700
702
- while (isstring ((LastChar = _get_char ())))
701
+ while (isstring ((LastChar = greentea_getc ())))
703
702
if (out_str && str_idx < str_size - 1 ) {
704
703
out_str[str_idx++] = LastChar;
705
704
}
@@ -712,24 +711,23 @@ static int gettok(char *out_str, const int str_size) {
712
711
713
712
// semicolon ::= ';'
714
713
if (LastChar == ' ;' ) {
715
- LastChar = _get_char ();
714
+ LastChar = greentea_getc ();
716
715
return tok_semicolon;
717
716
}
718
717
719
718
// open ::= '{{'
720
719
if (LastChar == ' {' ) {
721
- LastChar = _get_char ();
720
+ LastChar = greentea_getc ();
722
721
if (LastChar == ' {' ) {
723
- LastChar = _get_char ();
722
+ LastChar = greentea_getc ();
724
723
return tok_open;
725
724
}
726
725
}
727
726
728
727
// close ::= '}'
729
728
if (LastChar == ' }' ) {
730
- LastChar = _get_char ();
729
+ LastChar = greentea_getc ();
731
730
if (LastChar == ' }' ) {
732
- // LastChar = _get_char();
733
731
return tok_close;
734
732
}
735
733
}
@@ -739,7 +737,7 @@ static int gettok(char *out_str, const int str_size) {
739
737
740
738
// Otherwise, just return the character as its ascii value.
741
739
int ThisChar = LastChar;
742
- LastChar = _get_char ();
740
+ LastChar = greentea_getc ();
743
741
return ThisChar;
744
742
}
745
743
0 commit comments