Description:
fixed c++ compilation bug (thanks to Witchakorn Kamolpornwijit)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r119:01b9b35be113 - - 1 file changed: 4 inserted, 1 deleted
@@ -68,33 +68,36 | |||||
|
68 | FileUtils.rm(params[:message_file]) |
|
68 | FileUtils.rm(params[:message_file]) |
|
69 | end |
|
69 | end |
|
70 |
|
70 | ||
|
71 | # Check if the source file exists before attempt compiling. |
|
71 | # Check if the source file exists before attempt compiling. |
|
72 | if !FileTest.exists? params[:source_file] |
|
72 | if !FileTest.exists? params[:source_file] |
|
73 | talk("ERROR: The source file does not exist!") |
|
73 | talk("ERROR: The source file does not exist!") |
|
74 | open(params[:message_file],"w") do |f| |
|
74 | open(params[:message_file],"w") do |f| |
|
75 | f.puts "ERROR: The source file did not exist." |
|
75 | f.puts "ERROR: The source file did not exist." |
|
76 | end |
|
76 | end |
|
77 | exit(127) |
|
77 | exit(127) |
|
78 | end |
|
78 | end |
|
79 |
|
79 | ||
|
|
80 | + if params[:prog_lang]=='cpp': | ||
|
|
81 | + params[:prog_lang] = 'c++' | ||
|
|
82 | + end | ||
|
|
83 | + | ||
|
80 | # Compile. |
|
84 | # Compile. |
|
81 | case params[:prog_lang] |
|
85 | case params[:prog_lang] |
|
82 |
|
86 | ||
|
83 | when "c" |
|
87 | when "c" |
|
84 | command = "#{C_COMPILER} #{params[:source_file]} -o #{params[:output_file]} #{C_OPTIONS} 2> #{params[:message_file]}" |
|
88 | command = "#{C_COMPILER} #{params[:source_file]} -o #{params[:output_file]} #{C_OPTIONS} 2> #{params[:message_file]}" |
|
85 | system(command) |
|
89 | system(command) |
|
86 |
|
90 | ||
|
87 | when "c++" |
|
91 | when "c++" |
|
88 | - when "cpp" |
|
||
|
89 | command = "#{CPLUSPLUS_COMPILER} #{params[:source_file]} -o #{params[:output_file]} #{CPLUSPLUS_OPTIONS} 2> #{params[:message_file]}" |
|
92 | command = "#{CPLUSPLUS_COMPILER} #{params[:source_file]} -o #{params[:output_file]} #{CPLUSPLUS_OPTIONS} 2> #{params[:message_file]}" |
|
90 | system(command) |
|
93 | system(command) |
|
91 |
|
94 | ||
|
92 | when "pas" |
|
95 | when "pas" |
|
93 | command = "#{PASCAL_COMPILER} #{params[:source_file]} -ooutpas #{PASCAL_OPTIONS} > #{params[:message_file]}" |
|
96 | command = "#{PASCAL_COMPILER} #{params[:source_file]} -ooutpas #{PASCAL_OPTIONS} > #{params[:message_file]}" |
|
94 | system(command) |
|
97 | system(command) |
|
95 | FileUtils.mv("output", params[:output_file]) |
|
98 | FileUtils.mv("output", params[:output_file]) |
|
96 |
|
99 | ||
|
97 | else |
|
100 | else |
|
98 | talk("ERROR: Invalid language specified!") |
|
101 | talk("ERROR: Invalid language specified!") |
|
99 | open(params[:message_file],"w") do |f| |
|
102 | open(params[:message_file],"w") do |f| |
|
100 | f.puts "ERROR: Invalid language specified!" |
|
103 | f.puts "ERROR: Invalid language specified!" |
You need to be logged in to leave comments.
Login now