<commit_before>ifndef __mk_ugly_mk
__mk_ugly_mk := 1

#
# Headers.
#

# By header get module
#
define __header_mod_name
	$(strip
		$(subst /,.,
			$(patsubst $(abspath $(SRCGEN_DIR))/include/module/%.h,
					%,
					$(abspath $1))))
endef


__header_mod = $(call map-get,$(build_model),moduleInstanceByName,$1)

__header_gen = $(with $(__header_mod_name), \
  $(subst $(\n),\n,$(call __header_template,$(call __header_mod,$1),$1)))

# 1. ModuleInstance of most specified module in hierarchy
# 2. Target generated mod name
define __header_template
/* Autogenerated file. Do not edit. */ $(\n)
$(for modName <- $2,
	$(\n)
	$(\h)ifndef __MOD_HEADER__$(subst .,__,$(modName)) $(\n)
	$(\h)define __MOD_HEADER__$(subst .,__,$(modName)) $(\n)
	$(foreach impl,$(get 1->type) $(get 1->type>allSuperTypes),
		$(\n)// module: $(get impl->qualifiedName)$(\n)
		$(or $(foreach header,$(strip $(patsubst $(abspath $(SRC_DIR))/%,%,
				 $(abspath $(call module_get_headers,$(impl))))) \
		      ,$(\h)include <../$(header)>$(\n)),
		     // no headers to include$(\n)))

	$(for optionInstance <- $(get 1->options),
		optionId <- $(subst .,__,$(invoke optionInstance->option>getId)),
		$(\n)
		$(\h)ifndef $(optionId)$(\n)
		$(\h)define $(optionId) $(invoke optionInstance->value>toString)$(\n)
		$(\h)endif$(\n))
<commit_msg>mk: swap include and options definition in generated headers<commit_after>ifndef __mk_ugly_mk
__mk_ugly_mk := 1

#
# Headers.
#

# By header get module
#
define __header_mod_name
	$(strip
		$(subst /,.,
			$(patsubst $(abspath $(SRCGEN_DIR))/include/module/%.h,
					%,
					$(abspath $1))))
endef


__header_mod = $(call map-get,$(build_model),moduleInstanceByName,$1)

__header_gen = $(with $(__header_mod_name), \
  $(subst $(\n),\n,$(call __header_template,$(call __header_mod,$1),$1)))

# 1. ModuleInstance of most specified module in hierarchy
# 2. Target generated mod name
define __header_template
/* Autogenerated file. Do not edit. */ $(\n)
$(for modName <- $2,
	$(\n)
	$(\h)ifndef __MOD_HEADER__$(subst .,__,$(modName)) $(\n)
	$(\h)define __MOD_HEADER__$(subst .,__,$(modName)) $(\n)
	$(for optionInstance <- $(get 1->options),
		optionId <- $(subst .,__,$(invoke optionInstance->option>getId)),
		$(\n)
		$(\h)ifndef $(optionId)$(\n)
		$(\h)define $(optionId) $(invoke optionInstance->value>toString)$(\n)
		$(\h)endif$(\n))

	$(foreach impl,$(get 1->type) $(get 1->type>allSuperTypes),
		$(\n)// module: $(get impl->qualifiedName)$(\n)
		$(or $(foreach header,$(strip $(patsubst $(abspath $(SRC_DIR))/%,%,
				 $(abspath $(call module_get_headers,$(impl))))) \
		      ,$(\h)include <../$(header)>$(\n)),
		     // no headers to include$(\n)))



{'fraction_non_alphanumeric': 0.22442862495316598, 'fraction_numerical': 0.008242787560884226, 'mean_word_length': 4.393939393939394, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, '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': '3563857', 'n_tokens_mistral': 1060, 'n_tokens_neox': 977, 'n_words': 212}