From 8ee69f012452ee140bf1e18cb460cffc6485e9b6 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sat, 9 Oct 2021 23:45:02 -0700 Subject: [PATCH] [examples] setting up the last two integration examples and slots in the examples directory --- bin/build_examples.sh | 9 ++++++--- bin/run_examples.sh | 9 +++++++++ examples/examples_directory.txt | 7 ++++++- examples/integration/memory_management.c | 18 ++++++++++++++++++ examples/integration/multi_threaded.c | 18 ++++++++++++++++++ examples/intro/hello_world.c | 2 +- 6 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 examples/integration/memory_management.c create mode 100644 examples/integration/multi_threaded.c diff --git a/bin/build_examples.sh b/bin/build_examples.sh index 9b27674..d7bccf3 100755 --- a/bin/build_examples.sh +++ b/bin/build_examples.sh @@ -11,6 +11,9 @@ bin/bld_core.sh show_ctx examps="examples" +bin/bld_core.sh unit memory_management $examps/integration/memory_management.c +bin/bld_core.sh unit multi_threaded $examps/integration/multi_threaded.c + bin/bld_core.sh unit hello_world $examps/intro/hello_world.c bin/bld_core.sh unit parse_check $examps/intro/parse_check.c bin/bld_core.sh unit data_desk_like $examps/intro/data_desk_like_template.c @@ -21,10 +24,10 @@ if [ -d $examps/type_metadata/generated/type_info_meta.h ]; then bin/bld_core.sh unit type_info $examps/type_metadata/type_info_final_program.c fi -bin/bld_core.sh unit expr_intro $examps/expr/expr_intro.c -bin/bld_core.sh unit expr_c_like $examps/expr/expr_c_like.c +bin/bld_core.sh unit expr_intro $examps/expr/expr_intro.c +bin/bld_core.sh unit expr_c_like $examps/expr/expr_c_like.c -bin/bld_core.sh unit overrides $examps/integration/overrides.c +bin/bld_core.sh unit overrides $examps/integration/overrides.c echo diff --git a/bin/run_examples.sh b/bin/run_examples.sh index 54c6d51..0bbd96e 100755 --- a/bin/run_examples.sh +++ b/bin/run_examples.sh @@ -8,6 +8,14 @@ root_path=$PWD build_path=$root_path/build examps=$root_path/examples +echo ~~~ Running Memory Management Example ~~~ +$build_path/memory_management.exe $examps/intro/hello_world.mdesk $examps/intro/labels.mdesk $examps/intro/sets.mdesk +echo + +echo ~~~ Running Multi-Threaded Parse Example ~~~ +$build_path/multi_threaded.exe $examps/intro/hello_world.mdesk $examps/intro/labels.mdesk $examps/intro/sets.mdesk +echo + echo ~~~ Running Type Metadata Generator Example ~~~ cd $examps/type_metadata/generated $build_path/type_metadata.exe $examps/type_metadata/types.mdesk @@ -15,6 +23,7 @@ echo echo ~~~ Running Error Generation Example ~~~ $build_path/user_errors.exe $examps/user_errors/user_errors.mdesk +echo echo ~~~ Running Expression Intro ~~~ $build_path/expr_intro.exe $examps/expr/expr_intro.mdesk diff --git a/examples/examples_directory.txt b/examples/examples_directory.txt index bed4b02..7bdeb2a 100644 --- a/examples/examples_directory.txt +++ b/examples/examples_directory.txt @@ -53,12 +53,17 @@ EXAMPLES: Commentary in this example focuses on strategies for setting up an effective metaprogram. +7. TODO +8. TODO -7. "overrides" integration/overrides.c +9. "overrides" integration/overrides.c When including the Metadesk library into an existing codebase, the overrides system in the library will let you plug in existing implementations you have for many of the basic requirements of the library. This can also be useful if you want to make your program CRT-free, or direct metadesk allocations to your own custom allocator. +10. TODO +11. TODO + diff --git a/examples/integration/memory_management.c b/examples/integration/memory_management.c new file mode 100644 index 0000000..916be1c --- /dev/null +++ b/examples/integration/memory_management.c @@ -0,0 +1,18 @@ +/* +** Example: memory management +** +** TODO +*/ + +//~ includes and globals ////////////////////////////////////////////////////// + +#include "md.h" +#include "md.c" + +//~ main ////////////////////////////////////////////////////////////////////// + +int +main(int argc, char **argv) +{ + // TODO(allen) +} diff --git a/examples/integration/multi_threaded.c b/examples/integration/multi_threaded.c new file mode 100644 index 0000000..a88c287 --- /dev/null +++ b/examples/integration/multi_threaded.c @@ -0,0 +1,18 @@ +/* +** Example: multi threaded parse +** +** TODO +*/ + +//~ includes and globals ////////////////////////////////////////////////////// + +#include "md.h" +#include "md.c" + +//~ main ////////////////////////////////////////////////////////////////////// + +int +main(int argc, char **argv) +{ + // TODO(allen) +} diff --git a/examples/intro/hello_world.c b/examples/intro/hello_world.c index ed88dcb..31b9751 100644 --- a/examples/intro/hello_world.c +++ b/examples/intro/hello_world.c @@ -24,4 +24,4 @@ main(int argc, char **argv) // print the results MD_PrintDebugDumpFromNode(stdout, parse.node, MD_GenerateFlags_All); -} \ No newline at end of file +}