Changeset d9341fa in sasmodels
- Timestamp:
- Dec 18, 2017 11:01:30 AM (7 years ago)
- Children:
- 5c2a0f2
- Parents:
- 98a4f14
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/py2c.py
r98a4f14 rd9341fa 1100 1100 print(tree_source) 1101 1101 1102 def add_constants (sniplets, c_constants): 1103 sniplets.append("#include <math.h>") 1104 sniplets.append("") 1105 vars = c_constants.keys() 1106 for c_var in vars: 1107 declare_values = str(c_constants[c_var]) 1108 if (hasattr(declare_values,'__len__')): 1109 declare_values = declare_values.replace (' ',' ') 1110 declare_values = declare_values.replace ('[ ','[') 1111 declare_values = declare_values.replace (' ]',']') 1112 declare_values = declare_values.replace (' ',',') 1113 str_dcl = "double " + c_var 1114 str_dcl += " = " + declare_values + ";" 1115 sniplets.append (str_dcl) 1116 sniplets.append("") 1117 1102 1118 def translate(functions, constants=0): 1103 1119 sniplets = [] 1104 sniplets.append("#include <math.h>") 1105 sniplets.append("static double pi = 3.14159265359;") 1120 # sniplets.append("#include <math.h>") 1121 # sniplets.append("static double pi = 3.14159265359;") 1122 add_constants (sniplets, constants) 1106 1123 for source,fname,line_no in functions: 1107 1124 line_directive = '#line %d "%s"' %(line_no,fname)
Note: See TracChangeset
for help on using the changeset viewer.