value ml_ut_get_symbol( value u, value encoding ) { CAMLparam2( u, encoding ); const char *result; result = ut_get_symbol( UD_ut_unit_val( u ), Int_val( encoding ) ); CHECK_STATUS( result ) CAMLreturn( caml_copy_string( result ) ); }
void R_ut_get_symbol(char * const *ustring, char **rstring) { ut_unit *u; char *trimmed; char *s; trimmed = ut_trim(*ustring, enc); u = ut_parse(sys, trimmed, enc); if (!u) { handle_error("R_ut_get_symbol"); } s = (char *) ut_get_symbol(u, enc); // FIXME: ut_get_symbol seems to allocate the string... does it need to be free-ed? if (s == NULL) return; else *rstring = s; return; }
/*! * Returns an UTF-8 textual representation of this unit's symbol or an empty string * if this unit doesn't have one or if this unit is invalid (TBD). */ QString UdUnit::symbol() const { return QString(ut_get_symbol(m_unit, UT_UTF8)); }