Peano
Loading...
Searching...
No Matches
Utils.py
Go to the documentation of this file.
1# This file is part of the DaStGen2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3
4
5LLVMSymbol = "__PACKED_ATTRIBUTES_LANGUAGE_EXTENSION__"
6
7
8def get_include_guard(full_qualified_name):
9 return "_INCLUDE_" + full_qualified_name.replace("::", "_").upper() + "_"
10
11
12def get_unqualified_class_name(full_qualified_name):
13 return full_qualified_name.split("::")[-1]
14
15
16def get_namespaces(full_qualified_name):
17 result = [x for x in full_qualified_name.split("::")]
18 result.pop()
19 return result
20
21
22def construct_ifdef_string(symbol_list):
23 """!
24
25 Return empty string if symbol_list is empty. Otherwise construct
26 the whole ifdef thing.
27
28 """
29 result = ""
30 if symbol_list != []:
31 result += "#if "
32 added_one_ifdef = False
33 for i in symbol_list:
34 if added_one_ifdef:
35 result += " and "
36 added_one_ifdef = True
37 result += i
38 result += "\n"
39 return result
construct_ifdef_string(symbol_list)
Return empty string if symbol_list is empty.
Definition Utils.py:22
get_include_guard(full_qualified_name)
Definition Utils.py:8
get_unqualified_class_name(full_qualified_name)
Definition Utils.py:12
get_namespaces(full_qualified_name)
Definition Utils.py:16