Example #1
0
/**
 * tifiles_vartype2type:
 * @model: a calculator model.
 * @id: a vartype ID.
 *
 * Returns the type ID of variable as string ("Real", "Program", ...).
 * The function is localized.
 *
 * Return value: a string like "Assembly Program".
 **/
TIEXPORT2 const char *TICALL tifiles_vartype2type(CalcModel model, uint8_t vartype)
{
  switch (model)
  {
#ifndef DISABLE_TI8X
  case CALC_TI73:
    return ti73_byte2desc(vartype);
  case CALC_TI82:
    return ti82_byte2desc(vartype);
  case CALC_TI83:
    return ti83_byte2desc(vartype);
  case CALC_TI83P:
  case CALC_TI84P:
  case CALC_TI84P_USB:
    return ti83p_byte2desc(vartype);
  case CALC_TI85:
    return ti85_byte2desc(vartype);
  case CALC_TI86:
    return ti86_byte2desc(vartype);
#endif
#ifndef DISABLE_TI9X
  case CALC_TI89:
  case CALC_TI89T:
  case CALC_TI89T_USB:
    return ti89_byte2desc(vartype);
  case CALC_TI92:
    return ti92_byte2desc(vartype);
  case CALC_TI92P:
    return ti92p_byte2desc(vartype);
  case CALC_V200:
    return v200_byte2desc(vartype);
  case CALC_NSPIRE:
    return nsp_byte2desc(vartype);
#endif
  default:
    tifiles_critical("%s: invalid model argument.", __FUNCTION__);
    return "";
  }
}
Example #2
0
/**
 * tifiles_file_get_type:
 * @filename: a filename as string.
 *
 * Returns the type of file (function, program, ...).
 *
 * Return value: a string like "Assembly Program" (localized).
 **/
TIEXPORT2 const char *TICALL tifiles_file_get_type(const char *filename)
{
  char *ext;

  ext = tifiles_fext_get(filename);
  if (!strcmp(ext, ""))
    return "";

  if (!g_ascii_strcasecmp(ext, "tib"))
    return _("OS upgrade");

  if(!g_ascii_strcasecmp(ext, "tno") || !g_ascii_strcasecmp(ext, "tnc") || !g_ascii_strcasecmp(ext, "tco") || !g_ascii_strcasecmp(ext, "tcc"))
	return _("OS upgrade");

  if (!tifiles_file_is_ti(filename))
    return "";

  if(tifiles_file_is_tigroup(filename))
	  return "TiGroup";

  if (tifiles_file_is_group(filename)) 
  {
    switch (tifiles_file_get_model(filename)) 
	{
    case CALC_TI89:
	case CALC_TI89T:
	case CALC_TI89T_USB:
    case CALC_TI92P:
    case CALC_V200:
      return _("Group/Backup");
    default:
      return _("Group");
    }
  }

  switch (tifiles_file_get_model(filename)) 
  {
#ifndef DISABLE_TI8X
  case CALC_TI73:
    return ti73_byte2desc(ti73_fext2byte(ext));
  case CALC_TI82:
    return ti82_byte2desc(ti82_fext2byte(ext));
  case CALC_TI83:
    return ti83_byte2desc(ti83_fext2byte(ext));
  case CALC_TI83P:
  case CALC_TI84P:
  case CALC_TI84P_USB:
    return ti83p_byte2desc(ti83p_fext2byte(ext));
  case CALC_TI85:
    return ti85_byte2desc(ti85_fext2byte(ext));
  case CALC_TI86:
    return ti86_byte2desc(ti86_fext2byte(ext));
#endif
#ifndef DISABLE_TI9X
  case CALC_TI89:
  case CALC_TI89T:
  case CALC_TI89T_USB:
    return ti89_byte2desc(ti89_fext2byte(ext));
  case CALC_TI92:
    return ti92_byte2desc(ti92_fext2byte(ext));
  case CALC_TI92P:
    return ti92p_byte2desc(ti92p_fext2byte(ext));
  case CALC_V200:
    return v200_byte2desc(v200_fext2byte(ext));
#endif
  case CALC_NSPIRE:
	  return nsp_byte2desc(nsp_fext2byte(ext));
  case CALC_NONE:
  default:
    return "";
    break;
  }

  return "";
}