<commit_before>package net.ssehub.kernel_haven.typechef.wrapper;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import net.ssehub.kernel_haven.SetUpException;
import net.ssehub.kernel_haven.config.CodeExtractorConfiguration;
import net.ssehub.kernel_haven.typechef.TypeChefExtractor;
import net.ssehub.kernel_haven.typechef.util.KbuildParamFile;
import net.ssehub.kernel_haven.typechef.util.OutputVoider;
import net.ssehub.kernel_haven.util.ExtractorException;
import net.ssehub.kernel_haven.util.Logger;
import net.ssehub.kernel_haven.variability_model.VariabilityVariable;

/**
 * A configuration for Typechef.
 * 
 * @author Adam
 */
public class Configuration {

    private static final Logger LOGGER = Logger.get();
    
    private File resDir;
    
    private File sourceDir;
    
    private File platformHeader;
    
    private File openVariablesFile;
    
    private File systemRoot;
    
    private List<File> staticIncludes;
    
    private List<File> postIncludeDirs;
    
    private List<File> sourceIncludeDirs;
    
    private List<String> preprocessorDefines;
    
    private KbuildParamFile kbuildParamFile;
    
    private boolean parseToAst;
    
    private String processRam;
    
    private boolean callInSameVm;
    
    private boolean logCallParams;
    
    private boolean inheritOutput;
    
    private int maxReceivingThreads;
    
    /**
     * Creates a Typechef configuration from the given {@link CodeExtractorConfiguration}.
     * It uses the following keys:
     * <ul>
     *  <li>
     *      <b>Required</b>
     *      <ul>
     *          <li>source_tree</li>
     *      </ul>
     *  </li>
     *  <li>
     *      <b>Required</b> (with default values)
     *      <ul>
     *          <li>code.extractor.system_root</li>
     *          <li>code.extractor.skip_default_include_dirs</li>
     *          <li>code.extractor.parse_to_ast</li>
     *          <li>code.extractor.process_ram</li>
     *      </ul>
     *  </li>
     *  <li>
     *      <b>Optional</b>
     *      <ul>
     *          <li>ccode.extractor.static_include.0</li>
     *          <li>code.extractor.post_include_dir.0</li>
     *          <li>code.extractor.source_include_dir.0</li>
     *          <li>code.extractor.add_linux_source_include_dirs</li>
     *          <li>code.extractor.preprocessor_define.0</li>
     *          <li>code.extractor.kbuildparam_file</li>
     *          <li>code.extractor.platform_header</li>
     *          <li>code.extractor.open_variables</li>
     *          <li>code.extractor.max_receiving_threads</li>
     *      </ul>
     *  </li><commit_msg>Fix typo in javadoc<commit_after>package net.ssehub.kernel_haven.typechef.wrapper;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import net.ssehub.kernel_haven.SetUpException;
import net.ssehub.kernel_haven.config.CodeExtractorConfiguration;
import net.ssehub.kernel_haven.typechef.TypeChefExtractor;
import net.ssehub.kernel_haven.typechef.util.KbuildParamFile;
import net.ssehub.kernel_haven.typechef.util.OutputVoider;
import net.ssehub.kernel_haven.util.ExtractorException;
import net.ssehub.kernel_haven.util.Logger;
import net.ssehub.kernel_haven.variability_model.VariabilityVariable;

/**
 * A configuration for Typechef.
 * 
 * @author Adam
 */
public class Configuration {

    private static final Logger LOGGER = Logger.get();
    
    private File resDir;
    
    private File sourceDir;
    
    private File platformHeader;
    
    private File openVariablesFile;
    
    private File systemRoot;
    
    private List<File> staticIncludes;
    
    private List<File> postIncludeDirs;
    
    private List<File> sourceIncludeDirs;
    
    private List<String> preprocessorDefines;
    
    private KbuildParamFile kbuildParamFile;
    
    private boolean parseToAst;
    
    private String processRam;
    
    private boolean callInSameVm;
    
    private boolean logCallParams;
    
    private boolean inheritOutput;
    
    private int maxReceivingThreads;
    
    /**
     * Creates a Typechef configuration from the given {@link CodeExtractorConfiguration}.
     * It uses the following keys:
     * <ul>
     *  <li>
     *      <b>Required</b>
     *      <ul>
     *          <li>source_tree</li>
     *      </ul>
     *  </li>
     *  <li>
     *      <b>Required</b> (with default values)
     *      <ul>
     *          <li>code.extractor.system_root</li>
     *          <li>code.extractor.skip_default_include_dirs</li>
     *          <li>code.extractor.parse_to_ast</li>
     *          <li>code.extractor.process_ram</li>
     *      </ul>
     *  </li>
     *  <li>
     *      <b>Optional</b>
     *      <ul>
     *          <li>code.extractor.static_include.0</li>
     *          <li>code.extractor.post_include_dir.0</li>
     *          <li>code.extractor.source_include_dir.0</li>
     *          <li>code.extractor.add_linux_source_include_dirs</li>
     *          <li>code.extractor.preprocessor_define.0</li>
     *          <li>code.extractor.kbuildparam_file</li>
     *          <li>code.extractor.platform_header</li>
     *          <li>code.extractor.open_variables</li>
     *          <li>code.extractor.max_receiving_threads</li>
     *      </ul>
     *  </li>
{'fraction_non_alphanumeric': 0.10839224216059452, 'fraction_numerical': 0.0014500634402755121, 'mean_word_length': 2.4660804020100504, 'pattern_counts': {'":': 0, '<': 105, '<?xml version=': 0, '>': 105, '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': '3632560', 'n_tokens_mistral': 1836, 'n_tokens_neox': 1809, 'n_words': 286}