<commit_before>#!/bin/sh

set -e

# replace ',' by newline, make it uppercase and prepend every item with '#define LUA_USE_MODULES_'
export X_MODULES_STRING=$(echo $X_MODULES | tr , '\n' | tr '[a-z]' '[A-Z]' | perl -pe 's/(.*)\n/#define LUA_USE_MODULES_$1\n/g')
# inject the modules string into user_modules.h between '#ifdef LUA_USE_MODULES\n' and '\n#endif /* LUA_USE_MODULES */'
# the 's' flag in '/sg' makes . match newlines
# Perl creates a temp file which is removed right after the manipulation
perl -e 'local $/; $_ = <>; s/(#ifdef LUA_USE_MODULES\n)(.*)(\n#endif \/\* LUA_USE_MODULES \*\/)/$1$ENV{"X_MODULES_STRING"}$3/sg; print' user_modules.h > user_modules.h.tmp && mv user_modules.h.tmp user_modules.h<commit_msg>Adjust set-modules.sh to new user_modules.h structure<commit_after>#!/bin/sh

set -e

# replace ',' by newline, make it uppercase and prepend every item with '#define LUA_USE_MODULES_'
export X_MODULES_STRING=$(echo $X_MODULES | tr , '\n' | tr '[a-z]' '[A-Z]' | perl -pe 's/(.*)\n/#define LUA_USE_MODULES_$1\n/g')
# inject the modules string into user_modules.h between '#ifndef LUA_CROSS_COMPILER\n' and '\n#endif  /* LUA_CROSS_COMPILER'
# the 's' flag in '/sg' makes . match newlines
# Perl creates a temp file which is removed right after the manipulation
perl -e 'local $/; $_ = <>; s/(#ifndef LUA_CROSS_COMPILER\n)(.*)(\n#endif.*LUA_CROSS_COMPILER.*)/$1$ENV{"X_MODULES_STRING"}$3/sg; print' user_modules.h > user_modules.h.tmp && mv user_modules.h.tmp user_modules.h
{'fraction_non_alphanumeric': 0.16499665998663995, 'fraction_numerical': 0.004008016032064128, 'mean_word_length': 4.610486891385768, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3571834', 'n_tokens_mistral': 584, 'n_tokens_neox': 578, 'n_words': 148}