diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c8df1888..118d4b7c 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -29,5 +29,5 @@ jobs: run: stack test - name: Run Carp Tests - run: ./run_carp_tests.sh --no_sdl + run: ./scripts/run_carp_tests.sh --no_sdl diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 9215a102..b91eff28 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -36,5 +36,5 @@ jobs: run: stack test - name: Run Carp Tests - run: ./run_carp_tests.sh --no_sdl + run: ./scripts/run_carp_tests.sh --no_sdl diff --git a/.github/workflows/release_linux.yml b/.github/workflows/release_linux.yml index d3f28506..1bc76bd7 100644 --- a/.github/workflows/release_linux.yml +++ b/.github/workflows/release_linux.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v2 - name: Build and zip - run: ./release.sh ${{ steps.get_tag_name.outputs.VERSION }} --noprompt + run: ./scripts/release.sh ${{ steps.get_tag_name.outputs.VERSION }} --noprompt - name: Create Github Release id: create_release diff --git a/.github/workflows/release_macos.yml b/.github/workflows/release_macos.yml index 4b297bae..5c405c9a 100644 --- a/.github/workflows/release_macos.yml +++ b/.github/workflows/release_macos.yml @@ -14,7 +14,7 @@ name: Create Release (macOS) # uses: actions/checkout@v2 # - name: Build and zip -# run: ./release.sh ${{ github.ref }} --noprompt +# run: ./scripts/release.sh ${{ github.ref }} --noprompt # - name: Create Github Release # id: create_release diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2a5cd4c7..24888dc1 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -48,4 +48,4 @@ jobs: - name: Run Carp Tests shell: bash - run: ./run_carp_tests.sh --no_sdl + run: ./scripts/run_carp_tests.sh --no_sdl diff --git a/.gitignore b/.gitignore index 26ee8a85..7568b3a7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *~ *# */.DS_Store +*.output.actual .stack-work/ @@ -16,3 +17,5 @@ main.obj examples/out /stack.yaml.lock tags +flamegraph.svg + diff --git a/bench/array_update.carp b/bench/array_update.carp index d63fd1b0..abdc1145 100644 --- a/bench/array_update.carp +++ b/bench/array_update.carp @@ -10,9 +10,9 @@ (defn some-updating [] (let-do [a (replicate n &12345) - b (aupdate a 0 &inc-ref)] - (assert (= (nth &b 0) &12346)) - (assert (= (nth &b 1) &12345)))) + b (aupdate a 0 &inc-ref)] + (assert (= (unsafe-nth &b 0) &12346)) + (assert (= (unsafe-nth &b 1) &12345)))) (defn perform-bench [new-n] (do diff --git a/core/carp_string.h b/core/carp_string.h index ff363be9..d60d13f0 100644 --- a/core/carp_string.h +++ b/core/carp_string.h @@ -355,7 +355,7 @@ int String_index_MINUS_of(const String *s, char c) { return String_index_MINUS_of_MINUS_from(s, c, -1); } -String Pointer_str(void* in) { +String Pointer_str(void *in) { int size = snprintf(NULL, 0, "%p", in) + 1; String buffer = CARP_MALLOC(size); sprintf(buffer, "%p", in); diff --git a/benchmarks.sh b/scripts/benchmarks.sh similarity index 81% rename from benchmarks.sh rename to scripts/benchmarks.sh index c6000271..43252a87 100755 --- a/benchmarks.sh +++ b/scripts/benchmarks.sh @@ -5,6 +5,6 @@ set -e; # will make the script stop if there are any errors # Actual tests (using the test suite) for f in ./bench/*.carp; do echo $f - ./carp.sh -x --optimize $f + ./scripts/carp.sh -x --optimize $f echo done diff --git a/build.sh b/scripts/build.sh similarity index 100% rename from build.sh rename to scripts/build.sh diff --git a/carp.sh b/scripts/carp.sh similarity index 100% rename from carp.sh rename to scripts/carp.sh diff --git a/flamegraph.sh b/scripts/flamegraph.sh similarity index 100% rename from flamegraph.sh rename to scripts/flamegraph.sh diff --git a/haskell-flamegraph.sh b/scripts/haskell-flamegraph.sh similarity index 56% rename from haskell-flamegraph.sh rename to scripts/haskell-flamegraph.sh index 7338f6b9..a40a34b6 100755 --- a/haskell-flamegraph.sh +++ b/scripts/haskell-flamegraph.sh @@ -2,6 +2,6 @@ # Usage: # # ./haskell-flamegraph -BUILD_OPTS="--enable-profiling --enable-library-profiling" ./carp.sh $* +RTS -p -hc +BUILD_OPTS="--enable-profiling --enable-library-profiling" ./scripts/carp.sh $* +RTS -p -hc ghc-prof-flamegraph carp.prof xdg-open carp.svg diff --git a/lines_of_code.sh b/scripts/lines_of_code.sh similarity index 100% rename from lines_of_code.sh rename to scripts/lines_of_code.sh diff --git a/release.sh b/scripts/release.sh similarity index 100% rename from release.sh rename to scripts/release.sh diff --git a/run_carp_tests.ps1 b/scripts/run_carp_tests.ps1 similarity index 100% rename from run_carp_tests.ps1 rename to scripts/run_carp_tests.ps1 diff --git a/run_carp_tests.sh b/scripts/run_carp_tests.sh similarity index 64% rename from run_carp_tests.sh rename to scripts/run_carp_tests.sh index 3662e4a9..596d7e00 100755 --- a/run_carp_tests.sh +++ b/scripts/run_carp_tests.sh @@ -8,7 +8,7 @@ if [[ $# -gt 0 ]] && [[ "$1" == "--no_sdl" ]]; then NO_SDL=1 fi -./build.sh +./scripts/build.sh # Build and run some examples ./test/execute.sh ./examples/basics.carp @@ -27,7 +27,7 @@ fi # Actual tests (using the test suite) for f in ./test/*.carp; do echo $f - ./carp.sh -x --log-memory $f + ./scripts/carp.sh -x --log-memory $f echo done @@ -39,28 +39,28 @@ for f in ./test-for-errors/*.carp; do done # Just make sure these compile -./carp.sh ./examples/mutual_recursion.carp -b -./carp.sh ./examples/guessing.carp -b -./carp.sh ./examples/no_core.carp --no-core --no-profile -b -./carp.sh ./examples/check_malloc.carp -b -./carp.sh ./examples/nested_lambdas.carp -b +./scripts/carp.sh ./examples/mutual_recursion.carp -b +./scripts/carp.sh ./examples/guessing.carp -b +./scripts/carp.sh ./examples/no_core.carp --no-core --no-profile -b +./scripts/carp.sh ./examples/check_malloc.carp -b +./scripts/carp.sh ./examples/nested_lambdas.carp -b # Run tests which rely on SDL unless the `--no_sdl` argument was passed in if [[ ${NO_SDL} -eq 0 ]]; then - ./carp.sh ./examples/ant.carp -b - ./carp.sh ./examples/reptile.carp -b - ./carp.sh ./examples/game.carp -b - ./carp.sh ./examples/minimal_sdl.carp -b - ./carp.sh examples/sounds.carp -b - ./carp.sh examples/fonts.carp -b + ./scripts/carp.sh ./examples/ant.carp -b + ./scripts/carp.sh ./examples/reptile.carp -b + ./scripts/carp.sh ./examples/game.carp -b + ./scripts/carp.sh ./examples/minimal_sdl.carp -b + ./scripts/carp.sh ./examples/sounds.carp -b + ./scripts/carp.sh ./examples/fonts.carp -b fi # Generate docs -./carp.sh ./docs/core/generate_core_docs.carp +./scripts/carp.sh ./docs/core/generate_core_docs.carp # Generate SDL docs unless the `--no_sdl` argument was passed in if [[ ${NO_SDL} -eq 0 ]]; then - ./carp.sh ./docs/sdl/generate_sdl_docs.carp + ./scripts/carp.sh ./docs/sdl/generate_sdl_docs.carp fi echo "ALL TESTS DONE." diff --git a/test/check.sh b/test/check.sh index d48eaf17..f3a0d0ab 100755 --- a/test/check.sh +++ b/test/check.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Checks the code (using --check) and compares the output to the .expected file -./carp.sh $1 --log-memory --check > test/output/$1.output.actual 2>&1 +./scripts/carp.sh $1 --log-memory --check > test/output/$1.output.actual 2>&1 if ! diff --strip-trailing-cr test/output/$1.output.actual test/output/$1.output.expected; then echo "$1 failed." diff --git a/test/execute.sh b/test/execute.sh index 385a1a37..0ebe26af 100755 --- a/test/execute.sh +++ b/test/execute.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Runs the executable and compares its output to the .expected file -./carp.sh $1 --log-memory -b && \ +./scripts/carp.sh $1 --log-memory -b && \ ./out/Untitled > test/output/$1.output.actual 2>&1 echo $1