Skip to content

Commit c96a386

Browse files
committed
Undo C changes
1 parent 1ac1037 commit c96a386

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tested/languages/c/generators.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def convert_value(value: Value) -> str:
5959
value = as_basic_type(value)
6060
if value.type == BasicNumericTypes.INTEGER:
6161
# Basic heuristic for long numbers
62-
if (value.data > (2 ** 31 - 1)) or (value.data < -(2 ** 31)):
62+
if (value.data > (2**31 - 1)) or (value.data < -(2**31)):
6363
return f"{value.data}L"
6464
else:
6565
return str(value.data)
@@ -164,7 +164,7 @@ def convert_statement(statement: Statement, full=False) -> str:
164164
def _generate_internal_context(ctx: PreparedContext, pu: PreparedExecutionUnit) -> str:
165165
result = f"""
166166
{ctx.before}
167-
167+
168168
int exit_code;
169169
"""
170170

@@ -188,9 +188,9 @@ def _generate_internal_context(ctx: PreparedContext, pu: PreparedExecutionUnit)
188188
if is_special_void_call(tc.input, pu.language):
189189
# The method has a "void" return type, so don't wrap it.
190190
result += (
191-
" " * 4
192-
+ convert_statement(tc.input.unwrapped_input_statement())
193-
+ ";\n"
191+
" " * 4
192+
+ convert_statement(tc.input.unwrapped_input_statement())
193+
+ ";\n"
194194
)
195195
result += " " * 4 + convert_statement(tc.input.no_value_call()) + ";\n"
196196
else:
@@ -205,7 +205,7 @@ def convert_execution_unit(pu: PreparedExecutionUnit) -> str:
205205
result = f"""
206206
#include <stdio.h>
207207
#include <math.h>
208-
208+
209209
#include "values.h"
210210
#include "{pu.submission_name}.c"
211211
"""
@@ -217,24 +217,24 @@ def convert_execution_unit(pu: PreparedExecutionUnit) -> str:
217217
result += f"""
218218
static FILE* {pu.unit.name}_value_file = NULL;
219219
static FILE* {pu.unit.name}_exception_file = NULL;
220-
220+
221221
static void {pu.unit.name}_write_separator() {{
222222
fprintf({pu.unit.name}_value_file, "--{pu.testcase_separator_secret}-- SEP");
223223
fprintf({pu.unit.name}_exception_file, "--{pu.testcase_separator_secret}-- SEP");
224224
fprintf(stdout, "--{pu.testcase_separator_secret}-- SEP");
225225
fprintf(stderr, "--{pu.testcase_separator_secret}-- SEP");
226226
}}
227-
227+
228228
static void {pu.unit.name}_write_context_separator() {{
229229
fprintf({pu.unit.name}_value_file, "--{pu.context_separator_secret}-- SEP");
230230
fprintf({pu.unit.name}_exception_file, "--{pu.context_separator_secret}-- SEP");
231231
fprintf(stdout, "--{pu.context_separator_secret}-- SEP");
232232
fprintf(stderr, "--{pu.context_separator_secret}-- SEP");
233233
}}
234-
234+
235235
#undef send_value
236236
#define send_value(value) write_value({pu.unit.name}_value_file, value)
237-
237+
238238
#undef send_specific_value
239239
#define send_specific_value(value) write_evaluated({pu.unit.name}_value_file, value)
240240
"""
@@ -264,7 +264,7 @@ def convert_execution_unit(pu: PreparedExecutionUnit) -> str:
264264
fclose({pu.unit.name}_exception_file);
265265
return exit_code;
266266
}}
267-
267+
268268
#ifndef INCLUDED
269269
int main() {{
270270
return {pu.unit.name}();
@@ -278,7 +278,7 @@ def convert_selector(contexts: list[str]) -> str:
278278
result = """
279279
#include <string.h>
280280
#include <stdio.h>
281-
281+
282282
#define INCLUDED true
283283
"""
284284

@@ -292,7 +292,7 @@ def convert_selector(contexts: list[str]) -> str:
292292
fprintf(stderr, "No context selected.");
293293
return -2;
294294
}
295-
295+
296296
const char* name = argv[1];
297297
"""
298298
for ctx in contexts:

0 commit comments

Comments
 (0)