コード例 #1
0
ファイル: typesxx.c プロジェクト: debrouxl/tilp-libtifiles
/**
 * tifiles_fext2vartype:
 * @model: a calculator model.
 * @s: a file extension as string (like 89p).
 *
 * Returns the type ID of variable (REAL, EQU, PRGM, ...).
 *
 * Return value: a string like "PRGM".
 **/
TIEXPORT2 uint8_t TICALL tifiles_fext2vartype(CalcModel model, const char *s)
{
  if (s == NULL)
  {
    tifiles_critical("%s: invalid string !", __FUNCTION__);
    return 0;
  }

  switch (model) 
  {
#ifndef DISABLE_TI8X
  case CALC_TI73:
    return ti73_fext2byte(s);
  case CALC_TI82:
    return ti82_fext2byte(s);
  case CALC_TI83:
    return ti83_fext2byte(s);
  case CALC_TI83P:
  case CALC_TI84P:
  case CALC_TI84P_USB:
    return ti83p_fext2byte(s);
  case CALC_TI85:
    return ti85_fext2byte(s);
  case CALC_TI86:
    return ti86_fext2byte(s);
#endif
#ifndef DISABLE_TI9X
  case CALC_TI89:
  case CALC_TI89T:
  case CALC_TI89T_USB:
    return ti89_fext2byte(s);
  case CALC_TI92:
    return ti92_fext2byte(s);
  case CALC_TI92P:
    return ti92p_fext2byte(s);
  case CALC_V200:
    return v200_fext2byte(s);
  case CALC_NSPIRE:
    return nsp_fext2byte(s);
#endif
  default:
    tifiles_critical("%s: invalid model argument.", __FUNCTION__);
    return 0;
  }
}
コード例 #2
0
ファイル: filetypes.c プロジェクト: Jonimoose/tilp-libtifiles
/**
 * tifiles_file_get_icon:
 * @filename: a filename as string.
 *
 * Returns the type of file (function, program, ...).
 *
 * Return value: a string like "Assembly Program" (non localized).
 **/
TIEXPORT2 const char *TICALL tifiles_file_get_icon(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_byte2icon(ti73_fext2byte(ext));
  case CALC_TI82:
    return ti82_byte2icon(ti82_fext2byte(ext));
  case CALC_TI83:
    return ti83_byte2icon(ti83_fext2byte(ext));
  case CALC_TI83P:
  case CALC_TI84P:
  case CALC_TI84P_USB:
    return ti83p_byte2icon(ti83p_fext2byte(ext));
  case CALC_TI85:
    return ti85_byte2icon(ti85_fext2byte(ext));
  case CALC_TI86:
    return ti86_byte2icon(ti86_fext2byte(ext));
#endif
#ifndef DISABLE_TI9X
  case CALC_TI89:
  case CALC_TI89T:
  case CALC_TI89T_USB:
    return ti89_byte2icon(ti89_fext2byte(ext));
  case CALC_TI92:
    return ti92_byte2icon(ti92_fext2byte(ext));
  case CALC_TI92P:
    return ti92p_byte2icon(ti92p_fext2byte(ext));
  case CALC_V200:
    return v200_byte2icon(v200_fext2byte(ext));
#endif
  case CALC_NSPIRE:
	  return nsp_byte2icon(nsp_fext2byte(ext));
  case CALC_NONE:
  default:
    return "";
    break;
  }

  return "";
}