text: // clang-format off
  
  
  // clang-format on
  /**
   * @file
   *
   * This file was automatically generated using `kdb gen highlevel`.
   * Any changes will be overwritten, when the file is regenerated.
   *
   * @copyright BSD Zero Clause License
   *
   *     Copyright (C) 2019 Elektra Initiative (https://libelektra.org)
   *
   *     Permission to use, copy, modify, and/or distribute this software for any
   *     purpose with or without fee is hereby granted.
   *
   *     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
   *     REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
   *     FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
   *     INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
   *     LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
   *     OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
   *     PERFORMANCE OF THIS SOFTWARE.
   */
  
  #include "externalwithdefaults.actual.h"
  
  
  
  #include <stdlib.h>
  #include <stdio.h>
  #include <string.h>
  
  #include <kdbhelper.h>
  #include <kdbinvoke.h>
  #include <kdbopts.h>
  
  #include <elektra/conversion.h>
  
  
  
  static const char * helpFallback = "Usage: tests_script_gen_highlevel_externalwithdefaults [OPTION...]\n\nOPTIONS\n  --help                      Print this help message\n";
  
  static int isHelpMode (void)
  {
  	ElektraInvokeHandle * gopts = elektraInvokeOpen ("gopts", NULL, NULL);
  
  	typedef int (*func) (void);
  	func * goptsIsHelpModePtr = (func *) elektraInvokeGetFunction (gopts, "ishelpmode");
  	
  	int ret = goptsIsHelpModePtr == NULL ? 0 : (*goptsIsHelpModePtr) ();
  
  	elektraInvokeClose (gopts, NULL);
  	return ret == 1;
  }
  
  
  /**
   * Initializes an instance of Elektra for the application '/tests/script/gen/highlevel/externalwithdefaults'.
   *
   * This can be invoked as many times as you want, however it is not a cheap operation,
   * so you should try to reuse the Elektra handle as much as possible.
   *
   * @param elektra A reference to where the Elektra instance shall be stored.
   *                Has to be disposed of with elektraClose().
   * @param error   A reference to an ElektraError pointer. Will be passed to elektraOpen().
   *
   * @retval 0  on success, @p elektra will contain a new Elektra instance coming from elektraOpen(),
   *            @p error will be unchanged
   * @retval -1 on error, @p elektra will be unchanged, @p error will be set
   * @retval 1  help mode, '-h' or '--help' was specified call printHelpMessage to display
   *            the help message. @p elektra will contain a new Elektra instance. It has to be passed
   *            to printHelpMessage. You also need to elektraClose() it.
   *            @p error will be unchanged
   *
   * @see elektraOpen
   */// 
  int loadConfiguration (Elektra ** elektra, ElektraError ** error)
  {
  	
  	KeySet * defaults = ksNew (5,
  	keyNew ("/mydouble", KEY_META, "default", "0.0", KEY_META, "type", "double", KEY_END),
  	keyNew ("/myfloatarray/#", KEY_META, "default", "2.5", KEY_META, "type", "float", KEY_END),
  	keyNew ("/myint", KEY_META, "default", "0", KEY_META, "type", "long", KEY_END),
  	keyNew ("/mystring", KEY_META, "default", "", KEY_META, "type", "string", KEY_END),
  	keyNew ("/print", KEY_META, "default", "0", KEY_META, "type", "boolean", KEY_END),
  	KS_END);
  ;
  	
  
  	KeySet * contract = ksNew (2,
  	keyNew ("system:/elektra/ensure/plugins/global/gopts", KEY_VALUE, "mounted", KEY_END),
  	keyNew ("system:/elektra/highlevel/helpmode/ignore/require", KEY_VALUE, "1", KEY_END),
  	KS_END);
  ;
  
  	Elektra * e = elektraOpen ("/tests/script/gen/highlevel/externalwithdefaults", defaults, contract, error);
  
  	if (defaults != NULL)
  	{
  		ksDel (defaults);
  	}
  
  	if (e == NULL)
  	{
  		*elektra = NULL;
  		if (isHelpMode ())
  		{
  			elektraErrorReset (error);
  			return 1;
  		}
  
  		return -1;
  	}
  
  	*elektra = e;
  	return elektraHelpKey (e) != NULL ? 1 : 0;
  }
  
  /**
   * Checks whether specload mode was invoked and if so, sends the specification over stdout
   * in the format expected by specload.
   *
   * You MUST not output anything to stdout before invoking this function. Ideally invoking this
   * is the first thing you do in your main()-function.
   *
   * This function will ONLY RETURN, if specload mode was NOT invoked. Otherwise it will call `exit()`.
   *
   * @param argc pass the value of argc from main
   * @param argv pass the value of argv from main
   */
  void exitForSpecload (int argc, const char ** argv)
  {
  	
  }
  
  
  /**
   * Outputs the help message to stdout
   *
   * @param elektra  The Elektra instance produced by loadConfiguration.
   * @param usage	   If this is not NULL, it will be used instead of the default usage line.
   * @param prefix   If this is not NULL, it will be inserted between the usage line and the options list.
   */// 
  void printHelpMessage (Elektra * elektra, const char * usage, const char * prefix)
  {
  	if (elektra == NULL)
  	{
  		printf ("%s", helpFallback);
  		return;
  	}
  
  	Key * helpKey = elektraHelpKey (elektra);
  	if (helpKey == NULL)
  	{
  		return;
  	}
  
  	char * help = elektraGetOptsHelpMessage (helpKey, usage, prefix);
  	printf ("%s", help);
  	elektraFree (help);
  }
  
  
  
  // clang-format off
  
  // clang-format on
  
  // -------------------------
  // Enum conversion functions
  // -------------------------
  
  
  
  // -------------------------
  // Enum accessor functions
  // -------------------------
  
  
  
  
  // clang-format off
  
  // clang-format on
  
  // -------------------------
  // Union accessor functions
  // -------------------------
  
  
  
  
  // clang-format off
  
  // clang-format on
  
  // -------------------------
  // Struct accessor functions
  // -------------------------
  
  
  
  