void
editable_event::category (const std::string & name)
{
    unsigned short catcode = name_to_value(name, category_name);
    if (catcode < SEQ64_END_OF_MIDIBYTE_TABLE)
        m_category = category_t(catcode);
    else
        m_category = category_name;

    m_name_category = value_to_name(m_category, category_name);
}
void
editable_event::set_status_from_string
(
    const std::string & ts,
    const std::string & s,
    const std::string & sd0,
    const std::string & sd1
)
{
    unsigned short value = name_to_value(s, category_channel_message);
    timestamp(ts);
    if (value != SEQ64_END_OF_MIDIBYTE_TABLE)
    {
        midibyte newstatus = midibyte(value);
        midibyte d0 = string_to_midibyte(sd0);
        set_status(newstatus, get_channel());   /* pass along code & channel */
        if (is_one_byte_msg(newstatus))
        {
            set_data(d0);
        }
        else if (is_two_byte_msg(newstatus))
        {
            midibyte d1 = string_to_midibyte(sd1);
            set_data(d0, d1);
        }
    }
    else
    {
        value = name_to_value(s, category_channel_message);
        if (value != SEQ64_END_OF_MIDIBYTE_TABLE)
        {
            midibyte newstatus = midibyte(value);
            set_status(newstatus);
        }
    }
    analyze();                          /* create the strings   */
}
static void
ieee_sym_to_value(cell_t *cif)
{
	int	error = -1;
	uintptr_t symvalue = 0;
	unsigned int nargs, nresults;
	char	*symname;
	extern	int name_to_value(char *name, uintptr_t *value);

	nargs = p1275_cell2uint(cif[1]);
	nresults = p1275_cell2uint(cif[2]);

	if (nresults == 0)
		return;		/* No room for results. Just return. */

	/*
	 * If there are no arguments, fall through and return an error.
	 * Otherwise, try to translate the symbol name arg to a value.
	 */
	if (nargs != 0) {
		symname = p1275_cell2ptr(cif[3]);	/* argument 0 */
		error = name_to_value(symname, &symvalue);
	}

	/*
	 * Stuff the results in the argument array and set the
	 * nresults element to the number of results actually returned
	 * in the argument array. (It's a maximum of 2).
	 *
	 * cif[0]:	service name	( Pointer to service name )
	 * cif[1]:	nargs		( number of argument cells)
	 * cif[2]:	nresults	( number of result cells)
	 * cif[3]:	argument{0}	( First argument cell )
	 * ...
	 * cif[3 + nargs]: result{0}	( First result cell )
	 * ...
	 */

	cif[3 + nargs] = p1275_int2cell(error);
	if (nresults > 1) {
		cif[3 + nargs + 1] = p1275_uintptr2cell(symvalue);
		cif[2] = p1275_int2cell(2);	/* there are 2 results */
	} else {
		cif[2] = p1275_int2cell(1);	/* there is 1 result */
	}
}
folly::Future<int32_t> service_with_special_namesSvIf::future_name_to_value() {
  return apache::thrift::detail::si::future([&] { return name_to_value(); });
}