(self, d)
| 706 | return out |
| 707 | |
| 708 | def dict2string(self, d): |
| 709 | if d['type'] == 'comment': |
| 710 | l = '% ' + d['comment'] |
| 711 | elif d['type'] == 'function': |
| 712 | l = self.map_function(d['function']) + '(' + ', '.join(self.parse_arguments(d['arguments'])) + ')' |
| 713 | elif d['type'] == 'print': |
| 714 | args = self.parse_arguments(d['arguments']) |
| 715 | args = ['num2str(' + arg + ')' for arg in args] |
| 716 | l = 'disp([' + ', \' \', '.join(args) + '])' |
| 717 | elif d['type'] == 'vector': |
| 718 | args = self.parse_arguments(d['arguments']) |
| 719 | l = '[' + ', '.join(args) + ']' |
| 720 | elif d['type'] == 'class_dereference': |
| 721 | l = d['name'] + '.' + self.dict2string(d['RHS']) |
| 722 | elif d['type'] == 'enum': |
| 723 | l = self.enum_name_mapping[d['enum']] + '.' + d['key'] |
| 724 | elif d['type'] == 'custom_assignment': |
| 725 | type_name = self.type_name_mapping[d['variable_type']] |
| 726 | if type_name: |
| 727 | LHS = type_name + ' ' + d['variable_name'] |
| 728 | else: |
| 729 | LHS = d['variable_name'] |
| 730 | |
| 731 | if d['RHS']['type'] != 'vector': |
| 732 | RHS = self.dict2string(d['RHS']) |
| 733 | else: # Custom processing for vector assignment |
| 734 | pushes = [d['variable_name'] + '.push_back(' + arg + ');' for arg in d['RHS']['arguments']] |
| 735 | RHS = 'DoubleVector(); ' + ' '.join(pushes) |
| 736 | |
| 737 | l = ' '.join([LHS, '=', RHS]) |
| 738 | else: |
| 739 | l = '??????????????????????????????' |
| 740 | |
| 741 | if 'EOL' in d and d['EOL']: |
| 742 | l += ';' |
| 743 | return l |
| 744 | |
| 745 | def header(self): |
| 746 | return '\n'.join(['CoolProp\n']) |
no test coverage detected