/EW/EW_Compiler.py

https://gitlab.com/liuxin429go/build · Python · 393 lines · 330 code · 38 blank · 25 comment · 15 complexity · e1d740d6f44ed89a10a185329203315c MD5 · raw file

  1. # -*- coding: UTF-8 -*-
  2. import fileinput
  3. import re
  4. import sys
  5. class EWAlgoCompiler_CountErrors:
  6. def __init__(self):
  7. self.cpl = None
  8. def configure(self, cmplr, typCmplr):
  9. self.cpl = ctrCompiler(cmplr, typCmplr)
  10. def __call__(self, cmplr, typCmplr, path):
  11. self.configure(cmplr, typCmplr)
  12. errors = 0
  13. warnings = 0
  14. for line in fileinput.FileInput(path):
  15. if (len(line) < 10): continue
  16. if (line[0] == " "): continue
  17. if (line[0:3] == "In "): continue
  18. if (line.find(self.cpl.spdexpWarning) > 0):
  19. if (self.cpl.regexpWarning.match(line)):
  20. warnings = warnings + 1
  21. elif (line.find(self.cpl.spdexpError) > 0):
  22. if (self.cpl.regexpError.match(line)):
  23. errors = errors + 1
  24. return errors, warnings
  25. class EWCompiler:
  26. def __init__(self):
  27. self.spdexpError = None
  28. self.regexpError = None
  29. self.spdexpWarning = None
  30. self.regexpWarning = None
  31. #########################################################################################
  32. ##
  33. ##
  34. #########################################################################################
  35. class EWCompiler_gcc_cpp(EWCompiler):
  36. def __init__(self):
  37. EWCompiler.__init__(self)
  38. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  39. drvWrn = r"(([eE]:[\\/]?)?)" # Limit to e: drive for warnings
  40. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  41. dirExp = r"(" + filExp + r"[\\/])"
  42. linExp = r"(:([0-9]+))"
  43. errExp = r"(: error:)"
  44. wrnExp = r"(: warning: (?!inline ))"
  45. xprErr = "^" + "(?P<file>" + drvErr + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + ")" + linExp + "{0,1}" + errExp
  46. xprWrn = "^" + "(?P<file>" + drvWrn + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + ")" + linExp + "{0,1}" + wrnExp
  47. self.regexpError = re.compile(xprErr)
  48. self.regexpWarning = re.compile(xprWrn)
  49. self.spdexpError = ": error:"
  50. self.spdexpWarning = ": warning:"
  51. class EWCompiler_gcc_ftn_3(EWCompiler):
  52. def __init__(self):
  53. EWCompiler.__init__(self)
  54. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  55. drvWrn = r"(([eE]:[\\/]?)?)" # Limit to e: drive for warnings
  56. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  57. dirExp = r"(" + filExp + r"[\\/])"
  58. linExp = r"(:([0-9]+))"
  59. errExp = r"(:\s*$)"
  60. wrnExp = r"(: warning:)"
  61. xprErr = "^" + "(?P<file>" + drvErr + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + ")" + linExp + "{0,1}" + errExp
  62. xprWrn = "^" + "(?P<file>" + drvWrn + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + ")" + linExp + "{0,1}" + wrnExp
  63. self.regexpError = re.compile(xprErr)
  64. self.regexpWarning = re.compile(xprWrn)
  65. self.spdexpError = ": "
  66. self.spdexpWarning = ": warning:"
  67. EWCompiler_gccx86_cpp_xx = EWCompiler_gcc_cpp
  68. EWCompiler_gccx64_cpp_xx = EWCompiler_gcc_cpp
  69. EWCompiler_gcc_cpp_xx = EWCompiler_gcc_cpp
  70. EWCompiler_gcc_cpp_33 = EWCompiler_gcc_cpp
  71. EWCompiler_gcc_cpp_34 = EWCompiler_gcc_cpp
  72. EWCompiler_gcc_cpp_41 = EWCompiler_gcc_cpp
  73. EWCompiler_gcc_cpp_42 = EWCompiler_gcc_cpp
  74. EWCompiler_gcc_cpp_43 = EWCompiler_gcc_cpp
  75. EWCompiler_gcc_cpp_44 = EWCompiler_gcc_cpp
  76. EWCompiler_gcc_cpp_45 = EWCompiler_gcc_cpp
  77. EWCompiler_gcc_cpp_46 = EWCompiler_gcc_cpp
  78. EWCompiler_gcc_cpp_47 = EWCompiler_gcc_cpp
  79. EWCompiler_gcc_cpp_48 = EWCompiler_gcc_cpp
  80. EWCompiler_gcc_cpp_49 = EWCompiler_gcc_cpp
  81. EWCompiler_gcc_cpp_50 = EWCompiler_gcc_cpp
  82. EWCompiler_gcc_cpp_51 = EWCompiler_gcc_cpp
  83. EWCompiler_gcc_cpp_52 = EWCompiler_gcc_cpp
  84. EWCompiler_gcc_cpp_53 = EWCompiler_gcc_cpp
  85. EWCompiler_gcc_cpp_54 = EWCompiler_gcc_cpp
  86. EWCompiler_gcc_cpp_55 = EWCompiler_gcc_cpp
  87. EWCompiler_gcc_cpp_60 = EWCompiler_gcc_cpp
  88. EWCompiler_gcc_cpp_61 = EWCompiler_gcc_cpp
  89. EWCompiler_gcc_cpp_62 = EWCompiler_gcc_cpp
  90. EWCompiler_gcc_cpp_63 = EWCompiler_gcc_cpp
  91. EWCompiler_gccx86_ftn_xx = EWCompiler_gcc_ftn_3
  92. EWCompiler_gccx64_ftn_xx = EWCompiler_gcc_ftn_3
  93. EWCompiler_gcc_ftn_xx = EWCompiler_gcc_ftn_3
  94. EWCompiler_gcc_ftn_33 = EWCompiler_gcc_ftn_3
  95. EWCompiler_gcc_ftn_34 = EWCompiler_gcc_ftn_3
  96. EWCompiler_gcc_ftn_41 = EWCompiler_gcc_ftn_3
  97. EWCompiler_gcc_ftn_42 = EWCompiler_gcc_ftn_3
  98. EWCompiler_gcc_ftn_43 = EWCompiler_gcc_ftn_3
  99. EWCompiler_gcc_ftn_44 = EWCompiler_gcc_ftn_3
  100. EWCompiler_gcc_ftn_45 = EWCompiler_gcc_ftn_3
  101. EWCompiler_gcc_ftn_46 = EWCompiler_gcc_ftn_3
  102. EWCompiler_gcc_ftn_47 = EWCompiler_gcc_ftn_3
  103. EWCompiler_gcc_ftn_48 = EWCompiler_gcc_ftn_3
  104. EWCompiler_gcc_ftn_49 = EWCompiler_gcc_ftn_3
  105. EWCompiler_gcc_ftn_50 = EWCompiler_gcc_ftn_3
  106. EWCompiler_gcc_ftn_51 = EWCompiler_gcc_ftn_3
  107. EWCompiler_gcc_ftn_52 = EWCompiler_gcc_ftn_3
  108. EWCompiler_gcc_ftn_53 = EWCompiler_gcc_ftn_3
  109. EWCompiler_gcc_ftn_54 = EWCompiler_gcc_ftn_3
  110. EWCompiler_gcc_ftn_55 = EWCompiler_gcc_ftn_3
  111. EWCompiler_gcc_ftn_60 = EWCompiler_gcc_ftn_3
  112. EWCompiler_gcc_ftn_61 = EWCompiler_gcc_ftn_3
  113. EWCompiler_gcc_ftn_62 = EWCompiler_gcc_ftn_3
  114. EWCompiler_gcc_ftn_63 = EWCompiler_gcc_ftn_3
  115. #########################################################################################
  116. ##
  117. ##
  118. #########################################################################################
  119. class EWCompiler_intel_cpp(EWCompiler):
  120. def __init__(self):
  121. EWCompiler.__init__(self)
  122. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  123. drvWrn = r"(([eE]:[\\/]?)?)" # Limit to e: drive for warnings
  124. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  125. dirExp = r"(" + filExp + r"[\\/])"
  126. linExp = r"(\([0-9]+\))"
  127. errExp = r"[ ]*:( Internal compiler)?( catastrophic)?( error[: ])"
  128. wrnExp = r"[ ]*:( warning )"
  129. xprErr = "^" + "(?P<file>" + drvErr + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + errExp
  130. xprWrn = "^" + "(?P<file>" + drvWrn + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + wrnExp
  131. self.regexpError = re.compile(xprErr)
  132. self.regexpWarning = re.compile(xprWrn)
  133. self.spdexpError = " error"
  134. self.spdexpWarning = ": warning "
  135. EWCompiler_intel_cpp_90 = EWCompiler_intel_cpp
  136. EWCompiler_intel_cpp_91 = EWCompiler_intel_cpp
  137. EWCompiler_intel_cpp_110 = EWCompiler_intel_cpp
  138. EWCompiler_intel_cpp_111 = EWCompiler_intel_cpp
  139. EWCompiler_itlx64_cpp_90 = EWCompiler_intel_cpp
  140. EWCompiler_itlx64_cpp_91 = EWCompiler_intel_cpp
  141. EWCompiler_itlx64_cpp_110 = EWCompiler_intel_cpp
  142. EWCompiler_itlx64_cpp_111 = EWCompiler_intel_cpp
  143. EWCompiler_itlx64_cpp_120 = EWCompiler_intel_cpp
  144. EWCompiler_itlx64_cpp_140 = EWCompiler_intel_cpp
  145. EWCompiler_itlx64_cpp_150 = EWCompiler_intel_cpp
  146. EWCompiler_itlx64_cpp_160 = EWCompiler_intel_cpp
  147. EWCompiler_itlx64_cpp_170 = EWCompiler_intel_cpp
  148. EWCompiler_itlx64_cpp_180 = EWCompiler_intel_cpp
  149. EWCompiler_itlx86_cpp_90 = EWCompiler_intel_cpp
  150. EWCompiler_itlx86_cpp_91 = EWCompiler_intel_cpp
  151. EWCompiler_itlx86_cpp_110 = EWCompiler_intel_cpp
  152. EWCompiler_itlx86_cpp_111 = EWCompiler_intel_cpp
  153. EWCompiler_itlx86_cpp_120 = EWCompiler_intel_cpp
  154. EWCompiler_itlx86_cpp_140 = EWCompiler_intel_cpp
  155. EWCompiler_itlx86_cpp_150 = EWCompiler_intel_cpp
  156. EWCompiler_itlx86_cpp_160 = EWCompiler_intel_cpp
  157. EWCompiler_itlx86_cpp_170 = EWCompiler_intel_cpp
  158. EWCompiler_itlx86_cpp_180 = EWCompiler_intel_cpp
  159. EWCompiler_itli64_cpp_90 = EWCompiler_intel_cpp
  160. EWCompiler_itli64_cpp_91 = EWCompiler_intel_cpp
  161. EWCompiler_itli64_cpp_110 = EWCompiler_intel_cpp
  162. EWCompiler_itli64_cpp_111 = EWCompiler_intel_cpp
  163. EWCompiler_itli64_cpp_120 = EWCompiler_intel_cpp
  164. EWCompiler_itli64_cpp_140 = EWCompiler_intel_cpp
  165. EWCompiler_itli64_cpp_150 = EWCompiler_intel_cpp
  166. EWCompiler_itli64_cpp_160 = EWCompiler_intel_cpp
  167. EWCompiler_itli64_cpp_170 = EWCompiler_intel_cpp
  168. EWCompiler_itli64_cpp_180 = EWCompiler_intel_cpp
  169. class EWCompiler_intel_ftn(EWCompiler):
  170. def __init__(self):
  171. EWCompiler.__init__(self)
  172. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  173. drvWrn = r"(([eE]:[\\/]?)?)" # Limit to e: drive for warnings
  174. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  175. dirExp = r"(" + filExp + r"[\\/])"
  176. linExp = r"(\([0-9]+\))"
  177. errExp = r"[ ]*:( Error:)"
  178. wrnExp = r"[ ]*:( Warning:)"
  179. xprErr = "^" + "(?P<file>" + drvErr + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + errExp
  180. xprWrn = "^" + "(?P<file>" + drvWrn + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + wrnExp
  181. self.regexpError = re.compile(xprErr)
  182. self.regexpWarning = re.compile(xprWrn)
  183. self.spdexpError = ": Error:"
  184. self.spdexpWarning = ": Warning:"
  185. EWCompiler_intel_ftn_90 = EWCompiler_intel_ftn
  186. EWCompiler_intel_ftn_91 = EWCompiler_intel_ftn
  187. EWCompiler_intel_ftn_110 = EWCompiler_intel_ftn
  188. EWCompiler_intel_ftn_111 = EWCompiler_intel_ftn
  189. EWCompiler_itlx64_ftn_90 = EWCompiler_intel_ftn
  190. EWCompiler_itlx64_ftn_91 = EWCompiler_intel_ftn
  191. EWCompiler_itlx64_ftn_110 = EWCompiler_intel_ftn
  192. EWCompiler_itlx64_ftn_111 = EWCompiler_intel_ftn
  193. EWCompiler_itlx64_ftn_120 = EWCompiler_intel_ftn
  194. EWCompiler_itlx64_ftn_140 = EWCompiler_intel_ftn
  195. EWCompiler_itlx64_ftn_150 = EWCompiler_intel_ftn
  196. EWCompiler_itlx64_ftn_160 = EWCompiler_intel_ftn
  197. EWCompiler_itlx64_ftn_170 = EWCompiler_intel_ftn
  198. EWCompiler_itlx64_ftn_180 = EWCompiler_intel_ftn
  199. EWCompiler_itlx86_ftn_90 = EWCompiler_intel_ftn
  200. EWCompiler_itlx86_ftn_91 = EWCompiler_intel_ftn
  201. EWCompiler_itlx86_ftn_110 = EWCompiler_intel_ftn
  202. EWCompiler_itlx86_ftn_111 = EWCompiler_intel_ftn
  203. EWCompiler_itlx86_ftn_120 = EWCompiler_intel_ftn
  204. EWCompiler_itlx86_ftn_140 = EWCompiler_intel_ftn
  205. EWCompiler_itlx86_ftn_150 = EWCompiler_intel_ftn
  206. EWCompiler_itlx86_ftn_160 = EWCompiler_intel_ftn
  207. EWCompiler_itlx86_ftn_170 = EWCompiler_intel_ftn
  208. EWCompiler_itlx86_ftn_180 = EWCompiler_intel_ftn
  209. EWCompiler_itli64_ftn_90 = EWCompiler_intel_ftn
  210. EWCompiler_itli64_ftn_91 = EWCompiler_intel_ftn
  211. EWCompiler_itli64_ftn_110 = EWCompiler_intel_ftn
  212. EWCompiler_itli64_ftn_111 = EWCompiler_intel_ftn
  213. EWCompiler_itli64_ftn_120 = EWCompiler_intel_ftn
  214. EWCompiler_itli64_ftn_140 = EWCompiler_intel_ftn
  215. EWCompiler_itli64_ftn_150 = EWCompiler_intel_ftn
  216. EWCompiler_itli64_ftn_160 = EWCompiler_intel_ftn
  217. EWCompiler_itli64_ftn_170 = EWCompiler_intel_ftn
  218. EWCompiler_itli64_ftn_180 = EWCompiler_intel_ftn
  219. EWCompiler_cmc_cpp_xx = EWCompiler_intel_cpp
  220. EWCompiler_cmc_ftn_xx = EWCompiler_intel_ftn
  221. EWCompiler_cmcitl_cpp_xx = EWCompiler_intel_cpp
  222. EWCompiler_cmcitl_ftn_xx = EWCompiler_intel_ftn
  223. #########################################################################################
  224. ##
  225. ##
  226. #########################################################################################
  227. class EWCompilerVC(EWCompiler):
  228. def __init__(self):
  229. EWCompiler.__init__(self)
  230. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  231. drvWrn = r"([eE]:[\\/]?)" # Limit to e: drive for warnings
  232. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  233. dirExp = r"(" + filExp + r"[\\/])"
  234. linExp = r"(\([0-9]+\))"
  235. errExp = r"[ ]*:( fatal)?( error )"
  236. wrnExp = r"[ ]*:( warning )"
  237. xprErr = "^" + "(?P<file>" + drvErr + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + errExp
  238. xprWrn = "^" + "(?P<file>" + drvWrn + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + wrnExp
  239. self.regexpError = re.compile(xprErr)
  240. self.regexpWarning = re.compile(xprWrn)
  241. self.spdexpError = " error "
  242. self.spdexpWarning = ": warning "
  243. #########################################################################################
  244. ##
  245. ##
  246. #########################################################################################
  247. class EWCompiler_sun_cpp(EWCompiler):
  248. def __init__(self):
  249. EWCompiler.__init__(self)
  250. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  251. drvWrn = r"(([eE]:[\\/]?)?)" # Limit to e: drive for warnings
  252. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  253. dirExp = r"(" + filExp + r"[\\/])"
  254. linExp = r"(\([0-9]+\))"
  255. errExp = r"[ ]*:( Internal compiler)?( catastrophic)?( error[: ])"
  256. wrnExp = r"[ ]*:( warning )"
  257. xprErr = "^" + "(?P<file>" + drvErr + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + errExp
  258. xprWrn = "^" + "(?P<file>" + drvWrn + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + wrnExp
  259. self.regexpError = re.compile(xprErr)
  260. self.regexpWarning = re.compile(xprWrn)
  261. self.spdexpError = " error"
  262. self.spdexpWarning = ": warning "
  263. EWCompiler_sun_cpp_120 = EWCompiler_sun_cpp
  264. EWCompiler_sun_cpp_121 = EWCompiler_sun_cpp
  265. EWCompiler_sun_cpp_122 = EWCompiler_sun_cpp
  266. EWCompiler_sun_cpp_123 = EWCompiler_sun_cpp
  267. EWCompiler_sun_cpp_125 = EWCompiler_sun_cpp
  268. EWCompiler_sun_cpp_126 = EWCompiler_sun_cpp
  269. class EWCompiler_sun_ftn(EWCompiler):
  270. def __init__(self):
  271. EWCompiler.__init__(self)
  272. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  273. drvWrn = r"(([eE]:[\\/]?)?)" # Limit to e: drive for warnings
  274. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  275. dirExp = r"(" + filExp + r"[\\/])"
  276. linExp = r"(, Line = [0-9]+, Column = [0-9]+)"
  277. errExp = r"[ ]*:( ERROR:)"
  278. wrnExp = r"[ ]*:( WARNING:)"
  279. xprErr = "^" + r'"' + "(?P<file>" + drvErr + "?" + dirExp + "*" + filExp + ")" + r'"' + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + errExp
  280. xprWrn = "^" + r'"' + "(?P<file>" + drvWrn + "?" + dirExp + "*" + filExp + ")" + r'"' + "(?P<line>" + linExp + "{0,1}" + ")" + wrnExp
  281. self.regexpError = re.compile(xprErr)
  282. self.regexpWarning = re.compile(xprWrn)
  283. self.spdexpError = ": ERROR:"
  284. self.spdexpWarning = ": WARNING:"
  285. EWCompiler_sun_ftn_120 = EWCompiler_sun_ftn
  286. EWCompiler_sun_ftn_121 = EWCompiler_sun_ftn
  287. EWCompiler_sun_ftn_122 = EWCompiler_sun_ftn
  288. EWCompiler_sun_ftn_123 = EWCompiler_sun_ftn
  289. EWCompiler_sun_ftn_125 = EWCompiler_sun_ftn
  290. EWCompiler_sun_ftn_126 = EWCompiler_sun_ftn
  291. #########################################################################################
  292. ##
  293. ##
  294. #########################################################################################
  295. class EWCompiler_open64_cpp(EWCompiler):
  296. def __init__(self):
  297. EWCompiler.__init__(self)
  298. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  299. drvWrn = r"(([eE]:[\\/]?)?)" # Limit to e: drive for warnings
  300. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  301. dirExp = r"(" + filExp + r"[\\/])"
  302. linExp = r"(\([0-9]+\))"
  303. errExp = r"[ ]*:( Internal compiler)?( catastrophic)?( error[: ])"
  304. wrnExp = r"[ ]*:( warning )"
  305. xprErr = "^" + "(?P<file>" + drvErr + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + errExp
  306. xprWrn = "^" + "(?P<file>" + drvWrn + "?" + dirExp + "*" + filExp + ")" + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + wrnExp
  307. self.regexpError = re.compile(xprErr)
  308. self.regexpWarning = re.compile(xprWrn)
  309. self.spdexpError = " error"
  310. self.spdexpWarning = ": warning "
  311. EWCompiler_open64_cpp_xx = EWCompiler_open64_cpp
  312. class EWCompiler_open64_ftn(EWCompiler):
  313. def __init__(self):
  314. EWCompiler.__init__(self)
  315. drvErr = r"(([a-zA-Z]:[\\/]|[\\/])?)"
  316. drvWrn = r"(([eE]:[\\/]?)?)" # Limit to e: drive for warnings
  317. filExp = r"([^<>:\"/\\|() ][^<>:\"/\\|()]*)"
  318. dirExp = r"(" + filExp + r"[\\/])"
  319. linExp = r"(, Line = [0-9]+, Column = [0-9]+)"
  320. errExp = r"[ ]*:( Error:)"
  321. wrnExp = r"[ ]*:( WARNING:)"
  322. xprErr = "^" + r'"' + "(?P<file>" + drvErr + "?" + dirExp + "*" + filExp + ")" + r'"' + "(?P<line>" + linExp + "{0,1}" + ")" + linExp + "{0,1}" + errExp
  323. xprWrn = "^" + r'"' + "(?P<file>" + drvWrn + "?" + dirExp + "*" + filExp + ")" + r'"' + "(?P<line>" + linExp + "{0,1}" + ")" + wrnExp
  324. self.regexpError = re.compile(xprErr)
  325. self.regexpWarning = re.compile(xprWrn)
  326. self.spdexpError = ": Error:"
  327. self.spdexpWarning = ": WARNING:"
  328. EWCompiler_open64_ftn_xx = EWCompiler_open64_ftn
  329. #########################################################################################
  330. ##
  331. ##
  332. #########################################################################################
  333. def ctrCompiler(nom, typ = 'cpp'):
  334. ext2typ = { 'c' : 'c', 'C' : 'c',
  335. 'cpp': 'cpp', 'CPP': 'cpp', 'cc' : 'cpp', 'CC' : 'cpp',
  336. 'f' : 'ftn', 'F' : 'ftn', 'for': 'ftn', 'FOR': 'ftn', 'ftn': 'ftn', 'FTN': 'ftn'}
  337. nom = nom.lower()
  338. cplrNam = ''
  339. try:
  340. gen, ver = nom.split('-')
  341. if (ver != 'xx'): ver = ver.replace('.', '')
  342. cplrNam = 'EWCompiler_%s_%s_%s' % (gen, ext2typ[typ], ver)
  343. except (ValueError, KeyError) as e:
  344. raise NotImplementedError("ERR - Unsupported compiler: name=%s type=%s" % (nom, typ) )
  345. try:
  346. if __name__ == '__main__':
  347. return sys.modules['__main__'].__dict__[cplrNam]()
  348. else:
  349. return sys.modules['EW_Compiler'].__dict__[cplrNam]()
  350. except:
  351. raise NotImplementedError("ERR - Unsupported compiler: name=%s type=%s (%s)" % (nom, typ, cplrNam) )
  352. if __name__ == '__main__':
  353. algo = EWAlgoCompiler_CountErrors()
  354. errors, warnings = algo("gcc-3.4", "for", r"E:\dev\_tst\H2D2\derniere\libh2d2\win32\gcc-3.4\debug\source\nmprxy.for.err")
  355. print errors, warnings