From 6ae70d239f7e6ce203aae022a5a6e014615a42cf Mon Sep 17 00:00:00 2001 From: Martin Wickham Date: Tue, 23 Nov 2021 23:28:27 -0600 Subject: [PATCH] Document data/ system --- LICENSE | 6 +----- README.md | 6 ++++++ data/keep_directory_in_git.txt | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 data/keep_directory_in_git.txt diff --git a/LICENSE b/LICENSE index 2e0c783..345035e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,4 @@ -Copyright (c) 2020 Martin Wickham -Dear Imgui is Copyright (c) 2014-2020 Omar Cornut -cimgui is Copyright (c) 2015 Stephan Dilly -cgltf is Copyright (c) 2018 Johannes Kuhlmann -ENet is Copyright (c) 2002-2020 Lee Salzman +Copyright (c) 2020-2021 Martin Wickham Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index aa5f964..af52500 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ This repo provides a template for Advent of Code participants using Zig. It con The src/ directory contains a main file for each day. Put your code there. The build command `zig build dayXX [target and mode options] -- [program args]` will build and run the specified day. You can also use `zig build install_dayXX [target and mode options]` to build the executable for a day and put it into `zig-cache/bin` without executing it. By default this template does not link libc, but you can set `should_link_libc` to `true` in build.zig to change that. If you have files with tests, add those files to the list of test files in build.zig. The command `zig build test` will run tests in all of these files. +Each day contains a decl like this: +```zig +const data = @embedFile("../data/day05.txt"); +``` +To use this system, save your input for a day in the data/ directory with the appropriate name. Reference this decl to load the contents of that file as a compile time constant. If a day has no input, or you prefer not to embed it in this form, simply don't reference this decl. If it's unused, it will not try to load the file, and it won't error if the file does not exist. + This repo also contains Visual Studio Code project files for debugging. These are meant to work with the C/C++ plugin. There is a debug configuration for each day. By default all days are built in debug mode, but this can be changed by editing `.vscode/tasks.json` if you have a need for speed. If you would like to contribute project files for other development environments, please send a PR. diff --git a/data/keep_directory_in_git.txt b/data/keep_directory_in_git.txt new file mode 100644 index 0000000..cc8a4c5 --- /dev/null +++ b/data/keep_directory_in_git.txt @@ -0,0 +1 @@ +This file ensures that the data/ directory exists in a fresh checkout.