From 13a623f55be6727a6d26ad737a4b5e66b38c33dc Mon Sep 17 00:00:00 2001 From: Tobias Berger Date: Thu, 1 Dec 2022 10:20:21 +0100 Subject: [PATCH] C Template before I remembered Rust exists Base Commit --- .gitignore | 1 + .vscode/c_cpp_properties.json | 22 +++++++++++++++ AdventOfCode.code-workspace | 12 ++++++++ c/build-all.ps1 | 25 +++++++++++++++++ c/meson.build | 52 +++++++++++++++++++++++++++++++++++ c/template/aoc.h | 4 +++ c/template/input.txt | 0 c/template/main.c | 16 +++++++++++ c/template/meson.build | 1 + c/template/part1.c | 6 ++++ c/template/part2.c | 6 ++++ 11 files changed, 145 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/c_cpp_properties.json create mode 100644 AdventOfCode.code-workspace create mode 100644 c/build-all.ps1 create mode 100644 c/meson.build create mode 100644 c/template/aoc.h create mode 100644 c/template/input.txt create mode 100644 c/template/main.c create mode 100644 c/template/meson.build create mode 100644 c/template/part1.c create mode 100644 c/template/part2.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..adb36c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.exe \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..8b25c25 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,22 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "windowsSdkVersion": "10.0.20348.0", + "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "windows-msvc-x64", + "compileCommands": "${workspaceFolder}/c/build/compile_commands.json" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/AdventOfCode.code-workspace b/AdventOfCode.code-workspace new file mode 100644 index 0000000..5c12d40 --- /dev/null +++ b/AdventOfCode.code-workspace @@ -0,0 +1,12 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "files.associations": { + "aoc.h": "c" + } + } +} \ No newline at end of file diff --git a/c/build-all.ps1 b/c/build-all.ps1 new file mode 100644 index 0000000..a910d75 --- /dev/null +++ b/c/build-all.ps1 @@ -0,0 +1,25 @@ +clang day01/*.c -o day01.exe -Og -g -Wall -Werror -std=c18 +clang day02/*.c -o day02.exe -Og -g -Wall -Werror -std=c18 +clang day03/*.c -o day03.exe -Og -g -Wall -Werror -std=c18 +clang day04/*.c -o day04.exe -Og -g -Wall -Werror -std=c18 +clang day05/*.c -o day05.exe -Og -g -Wall -Werror -std=c18 +clang day06/*.c -o day06.exe -Og -g -Wall -Werror -std=c18 +clang day07/*.c -o day07.exe -Og -g -Wall -Werror -std=c18 +clang day08/*.c -o day08.exe -Og -g -Wall -Werror -std=c18 +clang day09/*.c -o day09.exe -Og -g -Wall -Werror -std=c18 +clang day10/*.c -o day10.exe -Og -g -Wall -Werror -std=c18 +clang day11/*.c -o day11.exe -Og -g -Wall -Werror -std=c18 +clang day12/*.c -o day12.exe -Og -g -Wall -Werror -std=c18 +clang day13/*.c -o day13.exe -Og -g -Wall -Werror -std=c18 +clang day14/*.c -o day14.exe -Og -g -Wall -Werror -std=c18 +clang day15/*.c -o day15.exe -Og -g -Wall -Werror -std=c18 +clang day16/*.c -o day16.exe -Og -g -Wall -Werror -std=c18 +clang day17/*.c -o day17.exe -Og -g -Wall -Werror -std=c18 +clang day18/*.c -o day18.exe -Og -g -Wall -Werror -std=c18 +clang day19/*.c -o day19.exe -Og -g -Wall -Werror -std=c18 +clang day20/*.c -o day20.exe -Og -g -Wall -Werror -std=c18 +clang day21/*.c -o day21.exe -Og -g -Wall -Werror -std=c18 +clang day22/*.c -o day22.exe -Og -g -Wall -Werror -std=c18 +clang day23/*.c -o day23.exe -Og -g -Wall -Werror -std=c18 +clang day24/*.c -o day24.exe -Og -g -Wall -Werror -std=c18 +clang day25/*.c -o day25.exe -Og -g -Wall -Werror -std=c18 \ No newline at end of file diff --git a/c/meson.build b/c/meson.build new file mode 100644 index 0000000..01db23d --- /dev/null +++ b/c/meson.build @@ -0,0 +1,52 @@ +project('adventofcode', 'c') +subdir('template') +# day01 +# subdir('day01') +# day02 +# subdir('day02') +# day03 +# subdir('day03') +# day04 +# subdir('day04') +# day05 +# subdir('day05') +# day06 +# subdir('day06') +# day07 +# subdir('day07') +# day08 +# subdir('day08') +# day09 +# subdir('day09') +# day10 +# subdir('day10') +# day11 +# subdir('day11') +# day12 +# subdir('day12') +# day13 +# subdir('day13') +# day14 +# subdir('day14') +# day15 +# subdir('day15') +# day16 +# subdir('day16') +# day17 +# subdir('day17') +# day18 +# subdir('day18') +# day19 +# subdir('day19') +# day20 +# subdir('day20') +# day21 +# subdir('day21') +# day22 +# subdir('day22') +# day23 +# subdir('day23') +# day24 +# subdir('day24') +# day25 +# subdir('day25') \ No newline at end of file diff --git a/c/template/aoc.h b/c/template/aoc.h new file mode 100644 index 0000000..28009e7 --- /dev/null +++ b/c/template/aoc.h @@ -0,0 +1,4 @@ +#pragma once +int main(void); +void part_1(char const *const input); +void part_2(char const *const input); \ No newline at end of file diff --git a/c/template/input.txt b/c/template/input.txt new file mode 100644 index 0000000..e69de29 diff --git a/c/template/main.c b/c/template/main.c new file mode 100644 index 0000000..dc66418 --- /dev/null +++ b/c/template/main.c @@ -0,0 +1,16 @@ +#include +#include +#include + +#include "aoc.h" + +#define DAY 0 +#define INPUT_LENGTH 0 + +int main(void) +{ + char const *const input = ""; + part_1(input); + part_2(input); + return 0; +} \ No newline at end of file diff --git a/c/template/meson.build b/c/template/meson.build new file mode 100644 index 0000000..afa2745 --- /dev/null +++ b/c/template/meson.build @@ -0,0 +1 @@ +executable('day00', ['aoc.h', 'main.c', 'part1.c', 'part2.c']) \ No newline at end of file diff --git a/c/template/part1.c b/c/template/part1.c new file mode 100644 index 0000000..50d850f --- /dev/null +++ b/c/template/part1.c @@ -0,0 +1,6 @@ +#include "aoc.h" + +void part_1(char const *const input) +{ + return; +} \ No newline at end of file diff --git a/c/template/part2.c b/c/template/part2.c new file mode 100644 index 0000000..3d2c403 --- /dev/null +++ b/c/template/part2.c @@ -0,0 +1,6 @@ +#include "aoc.h" + +void part_2(char const *const input) +{ + return; +} \ No newline at end of file