all repos — hex @ c76da17c2ee93a3b4a20cdf33d840314003165ca

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

scripts/amalgamate.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
#!/bin/bash

# Files to combine
header_file="src/hex.h"
source_files=(  "src/stack.c" "src/registry.c" "src/error.c" "src/help.c" "src/stacktrace.c" 
                "src/parser.c" "src/interpreter.c" "src/helpers.c" "src/symbols.c" "src/main.c")
output_file="src/hex.c"

# Start with a clean output file
echo "/* *** hex amalgamation *** */" > "$output_file"

# Add the header file with a #line directive
echo "/* File: $header_file */" >> "$output_file"
echo "#line 1 \"$header_file\"" >> "$output_file"
cat "$header_file" >> "$output_file"
echo "" >> "$output_file"

# Add each source file with #line directives
for file in "${source_files[@]}"; do
    echo "/* File: $file */" >> "$output_file"
    echo "#line 1 \"$file\"" >> "$output_file"
    cat "$file" >> "$output_file"
    echo "" >> "$output_file"
done

echo "Amalgamation file created: $output_file"