<commit_before>#!/bin/bash
# packages MPack up for amalgamation release

HEADERS="\
    mpack-platform.h \
    mpack-common.h \
    mpack-reader.h \
    mpack-writer.h \
    mpack-expect.h \
    mpack-node.h"
SOURCES="\
    mpack-internal.h \
    mpack-platform.c \
    mpack-common.c \
    mpack-internal.c \
    mpack-reader.c \
    mpack-writer.c \
    mpack-expect.c \
    mpack-node.c"

version=`grep PROJECT_NUMBER Doxyfile|sed 's@.*= *\(.*\) *@\1@'`

rm -r docs
doxygen Doxyfile || exit $?

# assemble release package
#name=mpack-$version
#git archive master --prefix "$name/" > $name.tar || exit $?
#tar --transform "s@^@$name/@" -rf $name.tar docs || exit $?
#gzip -f $name.tar || exit $?
#echo
#echo Created $name.tar.gz

# build amalgamation

# add top license and comment
rm -rf build/amalgamation
mkdir -p build/amalgamation/src/mpack
HEADER=build/amalgamation/src/mpack/mpack.h
SOURCE=build/amalgamation/src/mpack/mpack.c
echo '/**' > $HEADER
sed 's/^/ * /' LICENSE >> $HEADER
cat - >> $HEADER <<EOF
 */

/*
 * This is the MPack $version amalgamation package.
 *
 * http://github.com/ludocode/mpack
 */

EOF
cp $HEADER $SOURCE

# assemble header
echo -e "#ifndef MPACK_H\n#define MPACK_H 1\n" >> $HEADER
echo -e "#include \"mpack-config.h\"\n\n" >> $HEADER
for f in $HEADERS; do
    echo -e "/* $f */\n" >> $HEADER
    sed 's@^#include ".*@/* & */@' src/mpack/$f >> $HEADER
    echo -e "\n" >> $HEADER
done
echo -e "#endif\n" >> $HEADER

# assemble source
echo -e "#include \"mpack.h\"\n\n" >> $SOURCE
for f in $SOURCES; do
    echo -e "/* $f */\n" >> $SOURCE
    sed 's@^#include ".*@/* & */@' src/mpack/$f >> $SOURCE
    echo -e "\n" >> $SOURCE
done<commit_msg>Fixed packaging script for new internal/platform file inclusion<commit_after>#!/bin/bash
# packages MPack up for amalgamation release

HEADERS="\
    mpack-platform.h \
    mpack-internal.h \
    mpack-common.h \
    mpack-reader.h \
    mpack-writer.h \
    mpack-expect.h \
    mpack-node.h"
SOURCES="\
    mpack-platform.c \
    mpack-internal.c \
    mpack-common.c \
    mpack-reader.c \
    mpack-writer.c \
    mpack-expect.c \
    mpack-node.c"

version=`grep PROJECT_NUMBER Doxyfile|sed 's@.*= *\(.*\) *@\1@'`

rm -rf docs
doxygen Doxyfile || exit $?

# assemble release package
#name=mpack-$version
#git archive master --prefix "$name/" > $name.tar || exit $?
#tar --transform "s@^@$name/@" -rf $name.tar docs || exit $?
#gzip -f $name.tar || exit $?
#echo
#echo Created $name.tar.gz

# build amalgamation

# add top license and comment
rm -rf build/amalgamation
mkdir -p build/amalgamation/src/mpack
HEADER=build/amalgamation/src/mpack/mpack.h
SOURCE=build/amalgamation/src/mpack/mpack.c
echo '/**' > $HEADER
sed 's/^/ * /' LICENSE >> $HEADER
cat - >> $HEADER <<EOF
 */

/*
 * This is the MPack $version amalgamation package.
 *
 * http://github.com/ludocode/mpack
 */

EOF
cp $HEADER $SOURCE

# assemble header
echo -e "#ifndef MPACK_H\n#define MPACK_H 1\n" >> $HEADER
echo -e "#include \"mpack-config.h\"\n\n" >> $HEADER
for f in $HEADERS; do
    echo -e "/* $f */\n" >> $HEADER
    sed 's@^#include ".*@/* & */@' src/mpack/$f >> $HEADER
    echo -e "\n" >> $HEADER
done
echo -e "#endif\n" >> $HEADER

# assemble source
echo -e "#define MPACK_INTERNAL 1\n" >> $SOURCE
echo -e "#include \"mpack.h\"\n\n" >> $SOURCE
for f in $SOURCES; do
    echo -e "/* $f */\n" >> $SOURCE
    sed 's@^#include ".*@/* & */@' src/mpack/$f >> $SOURCE
    echo -e "\n" >> $SOURCE
done
{'fraction_non_alphanumeric': 0.19200695047784536, 'fraction_numerical': 0.0014480162177816392, 'mean_word_length': 2.7956043956043954, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2436318', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1337, 'n_words': 330}