예제 #1
0
파일: sign.c 프로젝트: student-t/PSPP
static void
output_frequency_table (const struct two_sample_test *t2s,
			const struct sign_test_params *param,
			const struct dictionary *dict)
{
  int i;
  struct tab_table *table = tab_create (3, 1 + 4 * t2s->n_pairs);

  const struct variable *wv = dict_get_weight (dict);
  const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;

  tab_set_format (table, RC_WEIGHT, wfmt);
  tab_title (table, _("Frequencies"));

  tab_headers (table, 2, 0, 1, 0);

  /* Vertical lines inside the box */
  tab_box (table, 0, 0, -1, TAL_1,
	   1, 0, tab_nc (table) - 1, tab_nr (table) - 1 );

  /* Box around entire table */
  tab_box (table, TAL_2, TAL_2, -1, -1,
	   0, 0, tab_nc (table) - 1, tab_nr (table) - 1 );

  tab_text (table,  2, 0,  TAB_CENTER, _("N"));

  for (i = 0 ; i < t2s->n_pairs; ++i)
    {
      variable_pair *vp = &t2s->pairs[i];

      struct string pair_name;
      ds_init_cstr (&pair_name, var_to_string ((*vp)[0]));
      ds_put_cstr (&pair_name, " - ");
      ds_put_cstr (&pair_name, var_to_string ((*vp)[1]));


      tab_text (table, 0, 1 + i * 4, TAB_LEFT, ds_cstr (&pair_name));

      ds_destroy (&pair_name);

      tab_hline (table, TAL_1, 0, tab_nc (table) - 1, 1 + i * 4);

      tab_text (table,  1, 1 + i * 4,  TAB_LEFT, _("Negative Differences"));
      tab_text (table,  1, 2 + i * 4,  TAB_LEFT, _("Positive Differences"));
      tab_text (table,  1, 3 + i * 4,  TAB_LEFT, _("Ties"));
      tab_text (table,  1, 4 + i * 4,  TAB_LEFT, _("Total"));

      tab_double (table, 2, 1 + i * 4, TAB_RIGHT, param[i].neg, NULL, RC_WEIGHT);
      tab_double (table, 2, 2 + i * 4, TAB_RIGHT, param[i].pos, NULL, RC_WEIGHT);
      tab_double (table, 2, 3 + i * 4, TAB_RIGHT, param[i].ties, NULL, RC_WEIGHT);
      tab_double (table, 2, 4 + i * 4, TAB_RIGHT,
		  param[i].ties + param[i].neg + param[i].pos, NULL, RC_WEIGHT);
    }

  tab_submit (table);
}
예제 #2
0
char *
eval_arglist(const char args[], const char **stop_ptr)
{
	size_t len = 0;
	char *eval_result = NULL;

	assert(args[0] != '\0');

	while(args[0] != '\0')
	{
		char *free_this = NULL;
		const char *tmp_result = NULL;

		var_t result = var_false();
		const ParsingErrors parsing_error = parse(args, &result);
		if(parsing_error == PE_INVALID_EXPRESSION && is_prev_token_whitespace())
		{
			result = get_parsing_result();
			tmp_result = free_this = var_to_string(result);
			args = get_last_parsed_char();
		}
		else if(parsing_error == PE_NO_ERROR)
		{
			tmp_result = free_this = var_to_string(result);
			args = get_last_position();
		}

		if(tmp_result == NULL)
		{
			var_free(result);
			break;
		}

		if(!is_null_or_empty(eval_result))
		{
			eval_result = extend_string(eval_result, " ", &len);
		}
		eval_result = extend_string(eval_result, tmp_result, &len);

		var_free(result);
		free(free_this);

		args = skip_whitespace(args);
	}
	if(args[0] == '\0')
	{
		return eval_result;
	}
	else
	{
		free(eval_result);
		*stop_ptr = args;
		return NULL;
	}
}
예제 #3
0
파일: sign.c 프로젝트: student-t/PSPP
static void
output_statistics_table (const struct two_sample_test *t2s,
			 const struct sign_test_params *param)
{
  int i;
  struct tab_table *table = tab_create (1 + t2s->n_pairs, 4);

  tab_title (table, _("Test Statistics"));

  tab_headers (table, 0, 1,  0, 1);

  tab_hline (table, TAL_2, 0, tab_nc (table) - 1, 1);
  tab_vline (table, TAL_2, 1, 0, tab_nr (table) - 1);


  /* Vertical lines inside the box */
  tab_box (table, -1, -1, -1, TAL_1,
	   0, 0,
	   tab_nc (table) - 1, tab_nr (table) - 1);

  /* Box around entire table */
  tab_box (table, TAL_2, TAL_2, -1, -1,
	   0, 0, tab_nc (table) - 1,
	   tab_nr (table) - 1);

  tab_text (table,  0, 1, TAT_TITLE | TAB_LEFT,
	    _("Exact Sig. (2-tailed)"));

  tab_text (table,  0, 2, TAT_TITLE | TAB_LEFT,
	    _("Exact Sig. (1-tailed)"));

  tab_text (table,  0, 3, TAT_TITLE | TAB_LEFT,
	    _("Point Probability"));

  for (i = 0 ; i < t2s->n_pairs; ++i)
    {
      variable_pair *vp = &t2s->pairs[i];

      struct string pair_name;
      ds_init_cstr (&pair_name, var_to_string ((*vp)[0]));
      ds_put_cstr (&pair_name, " - ");
      ds_put_cstr (&pair_name, var_to_string ((*vp)[1]));

      tab_text (table,  1 + i, 0, TAB_LEFT, ds_cstr (&pair_name));
      ds_destroy (&pair_name);

      tab_double (table, 1 + i, 1, TAB_RIGHT,
		  param[i].one_tailed_sig * 2, NULL, RC_PVALUE);

      tab_double (table, 1 + i, 2, TAB_RIGHT, param[i].one_tailed_sig, NULL, RC_PVALUE);
      tab_double (table, 1 + i, 3, TAB_RIGHT, param[i].point_prob, NULL, RC_PVALUE);
    }

  tab_submit (table);
}
예제 #4
0
/* Checks for relative position of current pane.  Returns boolean value that
 * reflects state of specified location. */
static var_t
paneisat_builtin(const call_info_t *call_info)
{
	char *loc;
	int result;

	const int only = (curr_stats.number_of_windows == 1);
	const int vsplit = (curr_stats.split == VSPLIT);
	const int first = (curr_view == &lwin);

	loc = var_to_string(call_info->argv[0]);
	if(strcmp(loc, "top") == 0)
	{
		result = (only || vsplit || first);
	}
	else if(strcmp(loc, "bottom") == 0)
	{
		result = (only || vsplit || !first);
	}
	else if(strcmp(loc, "left") == 0)
	{
		result = (only || !vsplit || first);
	}
	else if(strcmp(loc, "right") == 0)
	{
		result = (only || !vsplit || !first);
	}
	else
	{
		result = 0;
	}
	free(loc);

	return var_from_bool(result);
}
예제 #5
0
/* Runs the command in shell and returns its output (joined standard output and
 * standard error streams).  All trailing newline characters are stripped to
 * allow easy appending to command output.  Returns the output. */
static var_t
system_builtin(const call_info_t *call_info)
{
	var_t result;
	char *cmd;
	FILE *cmd_stream;
	size_t cmd_out_len;
	var_val_t var_val;

	cmd = var_to_string(call_info->argv[0]);
	cmd_stream = read_cmd_output(cmd);
	free(cmd);

	ui_cancellation_enable();
	var_val.string = read_nonseekable_stream(cmd_stream, &cmd_out_len);
	ui_cancellation_disable();
	fclose(cmd_stream);

	if(var_val.string == NULL)
	{
		var_val.string = "";
		return var_new(VTYPE_STRING, var_val);
	}

	/* Remove trailing new line characters. */
	while(cmd_out_len != 0U && var_val.string[cmd_out_len - 1] == '\n')
	{
		var_val.string[cmd_out_len - 1] = '\0';
		--cmd_out_len;
	}

	result = var_new(VTYPE_STRING, var_val);
	free(var_val.string);
	return result;
}
예제 #6
0
/* Returns string representation of file type. */
static var_t
filetype_builtin(const call_info_t *call_info)
{
	char *str_val = var_to_string(call_info->argv[0]);
	const int fnum = get_fnum(str_val);
	var_val_t var_val = { .string = "" };
  free(str_val);

	if(fnum >= 0)
	{
#ifndef _WIN32
		const mode_t mode = curr_view->dir_entry[fnum].mode;
		var_val.const_string = get_mode_str(mode);
#else
		const FileType type = curr_view->dir_entry[fnum].type;
		var_val.const_string = get_type_str(type);
#endif
	}
	return var_new(VTYPE_STRING, var_val);
}

/* Returns file type from position or -1 if the position has wrong value. */
static int
get_fnum(const char position[])
{
	if(strcmp(position, ".") == 0)
	{
		return curr_view->list_pos;
	}
	else
	{
		return -1;
	}
}
예제 #7
0
/* Checks current layout configuration.  Returns boolean value that reflects
 * state of specified layout type. */
static var_t
layoutis_builtin(const call_info_t *call_info)
{
	char *type;
	int result;

	type = var_to_string(call_info->argv[0]);
	if(strcmp(type, "only") == 0)
	{
		result = (curr_stats.number_of_windows == 1);
	}
	else if(strcmp(type, "split") == 0)
	{
		result = (curr_stats.number_of_windows == 2);
	}
	else if(strcmp(type, "vsplit") == 0)
	{
		result = (curr_stats.number_of_windows == 2 && curr_stats.split == VSPLIT);
	}
	else if(strcmp(type, "hsplit") == 0)
	{
		result = (curr_stats.number_of_windows == 2 && curr_stats.split == HSPLIT);
	}
	else
	{
		result = 0;
	}
	free(type);

	return var_from_bool(result);
}
예제 #8
0
/* Returns string after expanding expression. */
static var_t
expand_builtin(const call_info_t *call_info)
{
	var_t result;
	var_val_t var_val;
	char *str_val;

	str_val = var_to_string(call_info->argv[0]);
	var_val.string = expand_macros(str_val, NULL, NULL, 0);
	free(str_val);

	result = var_new(VTYPE_STRING, var_val);
	free(var_val.string);

	return result;
}
예제 #9
0
/* Gets string representation of file type.  Returns the string. */
static var_t
filetype_builtin(const call_info_t *call_info)
{
	char *str_val = var_to_string(call_info->argv[0]);
	const int fnum = get_fnum(str_val);
	var_val_t var_val = { .string = "" };
	free(str_val);

	if(fnum >= 0)
	{
		const FileType type = curr_view->dir_entry[fnum].type;
		var_val.const_string = get_type_str(type);
	}
	return var_new(VTYPE_STRING, var_val);
}

/* Returns file type from position or -1 if the position has wrong value. */
static int
get_fnum(const char position[])
{
	if(strcmp(position, ".") == 0)
	{
		return curr_view->list_pos;
	}
	return -1;
}

/* Retrieves type of current pane as a string. */
static var_t
getpanetype_builtin(const call_info_t *call_info)
{
	FileView *const view = curr_view;
	var_val_t var_val;

	if(flist_custom_active(view))
	{
		var_val.string = (view->custom.unsorted ? "very-custom" : "custom");
	}
	else
	{
		var_val.string = "regular";
	}

	return var_new(VTYPE_STRING, var_val);
}
예제 #10
0
static VARIABLE *matc_element( VARIABLE *ptr )
{
    double *num = MATR(ptr);
    char *str = NULL;

    int i,j,n,maxn=0;

    VARIABLE *res = NULL;

    element_t *elem = CurrentObject->ElementModel->Elements;

    if ( NEXT(ptr) ) str = var_to_string( NEXT(ptr) );

    if ( CurrentObject->ElementModel->NofElements <= 0 ) error( "element: no elements present.\n" );

    for( i=0; i<NCOL(ptr); i++ )
    {
        n = num[i];
        if ( n <  0 || n >= CurrentObject->ElementModel->NofElements )
        {
            error( "element: Envalid element index: [%d].\n",n );
        }

        maxn = MAX( maxn,elem[n].ElementType->NumberOfNodes );
    }

    res = var_temp_new( TYPE_DOUBLE, NCOL(ptr), maxn );

    for( i=0; i<NCOL(ptr); i++ )
    {
        n = num[i];
        for( j=0; j<elem[n].ElementType->NumberOfNodes; j++ )
        {
            M(res,i,j) = elem[n].Topology[j];
        }
    }

    if ( str ) FREEMEM( str );

    return res;
}
예제 #11
0
static VARIABLE *matc_tcl( VARIABLE *ptr )
{
    VARIABLE *res = NULL;
    char *command;

    int i,n;

    command = var_to_string(ptr);

    Tcl_GlobalEval( TCLInterp, command );

    FREEMEM( command );

    if ( TCLInterp->result && (n=strlen(TCLInterp->result))>0 )
    {
        res = var_temp_new( TYPE_STRING,1,n );
        for( i=0; i<n; i++ ) M( res,0,i ) = TCLInterp->result[i];
    }

    return res;
}
예제 #12
0
/* Checks whether executable exists at absolute path orin directories listed in
 * $PATH when path isn't absolute.  Checks for various executable extensions on
 * Windows.  Returns boolean value describing result of the check. */
static var_t
executable_builtin(const call_info_t *call_info)
{
	int exists;
	char *str_val;

	str_val = var_to_string(call_info->argv[0]);

	if(is_path_absolute(str_val))
	{
		exists = executable_exists(str_val);
	}
	else
	{
		exists = (find_cmd_in_path(str_val, 0UL, NULL) == 0);
	}

	free(str_val);

	return exists ? var_true() : var_false();
}
예제 #13
0
/* Checks whether executable exists at absolute path orin directories listed in
 * $PATH when path isn't absolute.  Checks for various executable extensions on
 * Windows.  Returns boolean value describing result of the check. */
static var_t
executable_builtin(const call_info_t *call_info)
{
	int exists;
	char *str_val;

	str_val = var_to_string(call_info->argv[0]);

	if(strpbrk(str_val, PATH_SEPARATORS) != NULL)
	{
		exists = executable_exists(str_val);
	}
	else
	{
		exists = (find_cmd_in_path(str_val, 0UL, NULL) == 0);
	}

	free(str_val);

	return var_from_bool(exists);
}
예제 #14
0
/* Allows examining internal parameters from scripts to e.g. figure out
 * environment in which application is running. */
static var_t
has_builtin(const call_info_t *call_info)
{
	var_t result;

	char *const str_val = var_to_string(call_info->argv[0]);

	if(strcmp(str_val, "unix") == 0)
	{
		result = var_from_bool(get_env_type() == ET_UNIX);
	}
	else if(strcmp(str_val, "win") == 0)
	{
		result = var_from_bool(get_env_type() == ET_WIN);
	}
	else
	{
		result = var_false();
	}

	free(str_val);

	return result;
}
예제 #15
0
파일: variables.c 프로젝트: ackeack/workenv
int
let_variable(const char *cmd)
{
	char name[VAR_NAME_MAX + 1];
	char *p;
	int append = 0;
	var_t res_var;
	char *str_var;
	ParsingErrors parsing_error;

	assert(initialized);

	/* currently we support only environment variables */
	if(*cmd != '$')
	{
		text_buffer_add("Incorrect variable type");
		return -1;
	}
	cmd++;

	/* copy variable name */
	p = name;
	while(*cmd != '\0' && char_is_one_of(ENV_VAR_NAME_CHARS, *cmd) &&
			*cmd != '.' && *cmd != '=' && p - name < sizeof(name) - 1)
	{
		if(*cmd != '_' && !isalnum(*cmd))
		{
			text_buffer_add("Incorrect variable name");
			return -1;
		}
		*p++ = *cmd++;
	}
	/* test for empty variable name */
	if(p == name)
	{
		text_buffer_addf("%s: %s", "Unsupported variable name", "empty name");
		return -1;
	}
	*p = '\0';

	cmd = skip_whitespace(cmd);

	/* check for dot and skip it */
	if(*cmd == '.')
	{
		append = 1;
		cmd++;
	}

	/* check for equal sign and skip it */
	if(*cmd != '=')
	{
		text_buffer_addf("%s: %s", "Incorrect :let statement", "'=' expected");
		return -1;
	}

	parsing_error = parse(cmd + 1, &res_var);
	if(parsing_error != PE_NO_ERROR)
	{
		report_parsing_error(parsing_error);
		return -1;
	}

	if(get_last_position() != NULL && *get_last_position() != '\0')
	{
		text_buffer_addf("%s: %s", "Incorrect :let statement",
				"trailing characters");
		return -1;
	}

	/* update environment variable */
	str_var = var_to_string(res_var);
	if(append)
		append_envvar(name, str_var);
	else
		set_envvar(name, str_var);
	free(str_var);

	var_free(res_var);

	return 0;
}
예제 #16
0
static void
reliability_summary_total (const struct reliability *rel)
{
  int i;
  const int n_cols = 5;
  const int heading_columns = 1;
  const int heading_rows = 1;
  const int n_rows = rel->sc[0].n_items + heading_rows ;

  struct tab_table *tbl = tab_create (n_cols, n_rows);
  tab_headers (tbl, heading_columns, 0, heading_rows, 0);

  tab_title (tbl, _("Item-Total Statistics"));

  /* Vertical lines for the data only */
  tab_box (tbl,
	   -1, -1,
	   -1, TAL_1,
	   heading_columns, 0,
	   n_cols - 1, n_rows - 1);

  /* Box around table */
  tab_box (tbl,
	   TAL_2, TAL_2,
	   -1, -1,
	   0, 0,
	   n_cols - 1, n_rows - 1);


  tab_hline (tbl, TAL_2, 0, n_cols - 1, heading_rows);

  tab_vline (tbl, TAL_2, heading_columns, 0, n_rows - 1);

  tab_text (tbl, 1, 0, TAB_CENTER | TAT_TITLE,
	    _("Scale Mean if Item Deleted"));

  tab_text (tbl, 2, 0, TAB_CENTER | TAT_TITLE,
	    _("Scale Variance if Item Deleted"));

  tab_text (tbl, 3, 0, TAB_CENTER | TAT_TITLE,
	    _("Corrected Item-Total Correlation"));

  tab_text (tbl, 4, 0, TAB_CENTER | TAT_TITLE,
	    _("Cronbach's Alpha if Item Deleted"));


  for (i = 0 ; i < rel->sc[0].n_items; ++i)
    {
      double cov, item_to_total_r;
      double mean, weight, var;

      const struct cronbach *s = &rel->sc[rel->total_start + i];
      tab_text (tbl, 0, heading_rows + i, TAB_LEFT| TAT_TITLE,
		var_to_string (rel->sc[0].items[i]));

      moments1_calculate (s->total, &weight, &mean, &var, 0, 0);

      tab_double (tbl, 1, heading_rows + i, TAB_RIGHT,
		 mean, NULL);

      tab_double (tbl, 2, heading_rows + i, TAB_RIGHT,
		 s->variance_of_sums, NULL);

      tab_double (tbl, 4, heading_rows + i, TAB_RIGHT,
		 s->alpha, NULL);


      moments1_calculate (rel->sc[0].m[i], &weight, &mean, &var, 0,0);
      cov = rel->sc[0].variance_of_sums + var - s->variance_of_sums;
      cov /= 2.0;

      item_to_total_r = (cov - var) / (sqrt(var) * sqrt (s->variance_of_sums));


      tab_double (tbl, 3, heading_rows + i, TAB_RIGHT,
		 item_to_total_r, NULL);
    }


  tab_submit (tbl);
}
예제 #17
0
void ui_print_val(uint8_t type, uint8_t *data, uint32_t length)
{
	uint32_t bytes = 0;

	if(data == NULL)
	{
		printf("NULL");
		return;
	}



	switch(type)
	{
		case AMP_TYPE_VAR:
		{
			var_t *cd = var_deserialize(data, length, &bytes);
			char *str = var_to_string(cd);
			printf("%s", str);
			SRELEASE(str);
			var_release(cd);
		}
			break;

		case AMP_TYPE_INT:
			printf("%d", utils_deserialize_int(data, length, &bytes));
			break;

		case AMP_TYPE_TS:
		case AMP_TYPE_UINT:
			printf("%d", utils_deserialize_uint(data, length, &bytes));
			break;

		case AMP_TYPE_VAST:
			printf(VAST_FIELDSPEC, utils_deserialize_vast(data, length, &bytes));
			break;

		case AMP_TYPE_SDNV:
		case AMP_TYPE_UVAST:
			printf(UVAST_FIELDSPEC, utils_deserialize_uvast(data, length, &bytes));
			break;

		case AMP_TYPE_REAL32:
			printf("%f", utils_deserialize_real32(data, length, &bytes));
			break;

		case AMP_TYPE_REAL64:
			printf("%f", utils_deserialize_real64(data, length, &bytes));
			break;

		case AMP_TYPE_STRING:
			{
				char* tmp = NULL;
				tmp = utils_deserialize_string(data, length, &bytes);
				printf("%s", tmp);
				SRELEASE(tmp);
			}
			break;

		case AMP_TYPE_BLOB:
			{
				blob_t *blob = blob_deserialize(data, length, &bytes);
				char *str = blob_to_str(blob);
				printf("%s", str);
				SRELEASE(str);
				SRELEASE(blob);
			}
			break;

		case AMP_TYPE_DC:
			{
				uint32_t bytes = 0;
				Lyst dc = dc_deserialize(data, length, &bytes);
				ui_print_dc(dc);
				dc_destroy(&dc);
			}
			break;

		case AMP_TYPE_MID:
			{
				uint32_t bytes = 0;
				mid_t *mid = mid_deserialize(data, length, &bytes);
				ui_print_mid(mid);
				mid_release(mid);
			}
			break;

		case AMP_TYPE_MC:
			{
				uint32_t bytes = 0;
				Lyst mc = midcol_deserialize(data, length, &bytes);
				ui_print_mc(mc);
				midcol_destroy(&mc);
			}
			break;
			// \todo: Expression has no priority. Need to re-think priority.

		case AMP_TYPE_EXPR:
			{
				uint32_t bytes = 0;
				expr_t *expr = expr_deserialize(data, length, &bytes);
				ui_print_expr(expr);
				expr_release(expr);
			}
			break;

/*		case DTNMP_TYPE_DEF:
			{
				uint32_t bytes = 0;
				def_gen_t *def = def_deserialize_gen(data, length, &bytes);
				ui_print_def(def);
				def_release_gen(def);
			}
			break;
*/
		case AMP_TYPE_TRL:
			{
				uint32_t bytes = 0;
				trl_t *trl = trl_deserialize(data, length, &bytes);
				ui_print_trl(trl);
				trl_release(trl);
			}
			break;

		case AMP_TYPE_TABLE:
			{
				uint32_t bytes = 0;
				table_t *table = table_deserialize(data, length, &bytes);
				ui_print_table(table);
				table_destroy(table, 1);
			}
			break;

		case AMP_TYPE_SRL:
			{
				uint32_t bytes = 0;
				srl_t *srl = srl_deserialize(data, length, &bytes);
				ui_print_srl(srl);
				srl_release(srl);
			}
			break;

		default:
			printf("Unknown.");
	}
}
예제 #18
0
/* Gets string representation of file type.  Returns the string. */
static var_t
filetype_builtin(const call_info_t *call_info)
{
	char *str_val = var_to_string(call_info->argv[0]);
	const int fnum = get_fnum(str_val);
	var_val_t var_val = { .string = "" };
	free(str_val);

	if(fnum >= 0)
	{
		const FileType type = curr_view->dir_entry[fnum].type;
		var_val.const_string = get_type_str(type);
	}
	return var_new(VTYPE_STRING, var_val);
}

/* Returns file type from position or -1 if the position has wrong value. */
static int
get_fnum(const char position[])
{
	if(strcmp(position, ".") == 0)
	{
		return curr_view->list_pos;
	}
	else
	{
		return -1;
	}
}

/* Checks current layout configuration.  Returns boolean value that reflects
 * state of specified layout type. */
static var_t
layoutis_builtin(const call_info_t *call_info)
{
	char *type;
	int result;

	type = var_to_string(call_info->argv[0]);
	if(strcmp(type, "only") == 0)
	{
		result = (curr_stats.number_of_windows == 1);
	}
	else if(strcmp(type, "split") == 0)
	{
		result = (curr_stats.number_of_windows == 2);
	}
	else if(strcmp(type, "vsplit") == 0)
	{
		result = (curr_stats.number_of_windows == 2 && curr_stats.split == VSPLIT);
	}
	else if(strcmp(type, "hsplit") == 0)
	{
		result = (curr_stats.number_of_windows == 2 && curr_stats.split == HSPLIT);
	}
	else
	{
		result = 0;
	}
	free(type);

	return var_from_bool(result);
}
예제 #19
0
	{
		int result = function_register(&functions[i]);
		assert(result == 0 && "Builtin function registration error");
		(void)result;
	}
}

/* Retrieves values of options related to file choosing as a string.  On unknown
 * arguments empty string is returned. */
static var_t
chooseopt_builtin(const call_info_t *call_info)
{
	var_val_t var_val = { .string = NULL };
	char *type;

	type = var_to_string(call_info->argv[0]);
	if(strcmp(type, "files") == 0)
	{
		var_val.string = curr_stats.chosen_files_out;
	}
	else if(strcmp(type, "dir") == 0)
	{
		var_val.string = curr_stats.chosen_dir_out;
	}
	else if(strcmp(type, "cmd") == 0)
	{
		var_val.string = curr_stats.on_choose;
	}
	else if(strcmp(type, "delimiter") == 0)
	{
		var_val.string = curr_stats.output_delimiter;