C Template before I remembered Rust exists

Base Commit
This commit is contained in:
Tobias Berger 2022-12-01 10:20:21 +01:00
commit 13a623f55b
Signed by: toby
GPG key ID: 2D05EFAB764D6A88
11 changed files with 145 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.exe

22
.vscode/c_cpp_properties.json vendored Normal file
View file

@ -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
}

View file

@ -0,0 +1,12 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.associations": {
"aoc.h": "c"
}
}
}

25
c/build-all.ps1 Normal file
View file

@ -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

52
c/meson.build Normal file
View file

@ -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')

4
c/template/aoc.h Normal file
View file

@ -0,0 +1,4 @@
#pragma once
int main(void);
void part_1(char const *const input);
void part_2(char const *const input);

0
c/template/input.txt Normal file
View file

16
c/template/main.c Normal file
View file

@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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;
}

1
c/template/meson.build Normal file
View file

@ -0,0 +1 @@
executable('day00', ['aoc.h', 'main.c', 'part1.c', 'part2.c'])

6
c/template/part1.c Normal file
View file

@ -0,0 +1,6 @@
#include "aoc.h"
void part_1(char const *const input)
{
return;
}

6
c/template/part2.c Normal file
View file

@ -0,0 +1,6 @@
#include "aoc.h"
void part_2(char const *const input)
{
return;
}