-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(modem): Working prototype of macro based perfect forward
- Loading branch information
1 parent
20d92f3
commit 9b334e7
Showing
10 changed files
with
111 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 24 additions & 23 deletions
47
components/esp_modem/include/generate/esp_modem_command_declare_helper.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
|
||
|
||
// Parameters | ||
// * handle different parameters for C++ and C API | ||
// * make parameter unique names, so they could be easily referenced and forwarded | ||
#define INT_IN(param, name) int _ARG(param, name) | ||
#define INT_IN(name) int name | ||
#ifdef __cplusplus | ||
#define _ARG(param, name) param | ||
#include <string> | ||
#define STRING_IN(param, name) const std::string& _ARG(param, name) | ||
#define STRING_OUT(param, name) std::string& _ARG(param, name) | ||
#define BOOL_IN(param, name) const bool _ARG(param, name) | ||
#define BOOL_OUT(param, name) bool& _ARG(param, name) | ||
#define INT_OUT(param, name) int& _ARG(param, name) | ||
#define INTEGER_LIST_IN(param, name) const int* _ARG(param, name) | ||
|
||
#define STRUCT_OUT(struct_name, p1) struct_name& p1 | ||
#define STRING_IN(name) const std::string& name | ||
#define STRING_OUT(name) std::string& name | ||
#define BOOL_IN(name) const bool name | ||
#define BOOL_OUT(name) bool& name | ||
#define INT_OUT(name) int& name | ||
#define INTEGER_LIST_IN(name) const int* name | ||
#define STRUCT_OUT(struct_name, name) struct_name& name | ||
#else | ||
#define _ARG(param, name) name | ||
#define STRING_IN(param, name) const char* _ARG(param, name) | ||
#define STRING_OUT(param, name) char* _ARG(param, name) | ||
#define BOOL_IN(param, name) const bool _ARG(param, name) | ||
#define BOOL_OUT(param, name) bool* _ARG(param, name) | ||
#define INT_OUT(param, name) int* _ARG(param, name) | ||
#define INTEGER_LIST_IN(param, name) const int* _ARG(param, name) | ||
#define STRUCT_OUT(struct_name, p1) esp_modem_ ## struct_name ## _t* p1 | ||
#define STRING_IN(name) const char* name | ||
#define STRING_OUT(name) char* name | ||
#define BOOL_IN(name) const bool name | ||
#define BOOL_OUT(name) bool* name | ||
#define INT_OUT(name) int* name | ||
#define INTEGER_LIST_IN(name) const int* name | ||
#define STRUCT_OUT(struct_name, name) esp_modem_ ## struct_name ## _t* name | ||
#endif | ||
|
||
#define FORWARD_INT_IN(name) name | ||
#define FORWARD_STRING_IN(name) name | ||
#define FORWARD_STRING_OUT(name) name | ||
#define FORWARD_BOOL_IN(name) name | ||
#define FORWARD_BOOL_OUT(name) name | ||
#define FORWARD_INT_OUT(name) name | ||
#define FORWARD_INTEGER_LIST_IN(name) name | ||
#define FORWARD_STRUCT_OUT(struct_name, name) name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
|
||
for i in esp_modem_dce_generic.hpp esp_modem_dce_module.hpp esp_modem_command_library.hpp; do | ||
cat ../include/generate/$i | clang++ -E -P -CC -xc++ -I../include - > ../include/commands/cxx_include/$i | ||
out_file="../include/commands/cxx_include/$i"; | ||
in_file="../include/generate/$i"; | ||
echo "Processing $in_file" | ||
# Process the header and includes -- just paste the content (without expanding) | ||
cat $in_file | sed -n '1,/ESP-MODEM command module starts here/p' > $out_file; | ||
# Now preprocess everything else to expand command prototypes or implementations | ||
cat $in_file | clang++ -E -P -CC -xc++ -I../include - | sed -n '1,/ESP-MODEM command module starts here/!p' >> $out_file; | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters