Skip to content

Commit

Permalink
Add a function to get compare function name
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Dec 16, 2022
1 parent d36a853 commit da5abab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libasr/codegen/c_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,11 @@ class CCPPDSUtils {
global_scope = global_scope_;
}

std::string get_compare_func(ASR::ttype_t *t) {
std::string type_code = ASRUtils::get_type_code(t, true);
return compareTwoDS[type_code];
}

std::string get_deepcopy(ASR::ttype_t *t, std::string value, std::string target) {
std::string result;
switch (t->type) {
Expand Down Expand Up @@ -569,6 +574,7 @@ class CCPPDSUtils {
return func_decls;
}


void generate_compare_funcs(ASR::ttype_t *t) {
std::string type_code = ASRUtils::get_type_code(t, true);
if (compareTwoDS.find(type_code) != compareTwoDS.end()) {
Expand Down Expand Up @@ -906,7 +912,6 @@ class CCPPDSUtils {
tmp_gen += indent + tab + "idx1 = step < 0 ? (idx1 >= s_len ? s_len-1 : idx1) : idx1;\n";
tmp_gen += indent + tab + list_struct_type + " *__tmp = (" +
list_struct_type + "*) malloc(sizeof(" + list_struct_type + "));\n";
// tmp_gen += indent + tab + list_struct_type + " __tmp;\n";
std::string list_init_func = typecodeToDSfuncs[list_type_code]["list_init"];
tmp_gen += indent + tab + list_init_func + "(__tmp, 4);\n";
tmp_gen += indent + tab + "int s_i = idx1;\n";
Expand Down

0 comments on commit da5abab

Please sign in to comment.