Back to index

texmacs  1.0.7.15
Classes | Defines | Typedefs | Functions | Variables
language.hpp File Reference
#include "space.hpp"
#include "array.hpp"
#include "resource.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  text_property_rep
struct  language_rep

Defines

#define TP_NORMAL   0
#define TP_HYPH   1
#define TP_SPACE   2
#define TP_DSPACE   3
#define TP_BLANK   4
#define TP_PERIOD   5
#define TP_OPERATOR   6
#define TP_SHORTOP   7
#define TP_OTHER   8
#define SPC_NONE   0
#define SPC_SPACE   1
#define SPC_DSPACE   2
#define SPC_PERIOD   3
#define SPC_TINY   4
#define SPC_HALF   5
#define SPC_OPERATOR   6
#define SPC_BIGOP   7
#define HYPH_STD   10000
#define HYPH_PANIC   1000000
#define HYPH_INVALID   100000000
#define OP_UNKNOWN   0
#define OP_TEXT   1
#define OP_SKIP   2
#define OP_SYMBOL   3
#define OP_UNARY   4
#define OP_BINARY   5
#define OP_N_ARY   6
#define OP_PREFIX   7
#define OP_POSTFIX   8
#define OP_INFIX   9
#define OP_APPLY   10
#define OP_SEPARATOR   11
#define OP_OPENING_BRACKET   12
#define OP_MIDDLE_BRACKET   13
#define OP_CLOSING_BRACKET   14
#define OP_BIG   15
#define OP_TOTAL   16
#define LIMITS_NONE   0
#define LIMITS_DISPLAY   1
#define LIMITS_ALWAYS   2
#define SUCCESSION_OK   0
#define REMOVE_SPACE_BEFORE   1
#define REMOVE_CURRENT_SPACE   2
#define REMOVE_ALL_SPACE   3

Typedefs

typedef text_property_reptext_property

Functions

 RESOURCE (language)
int succession_status (int op1, int op2)
void init_succession_status_table ()
language text_language (string s)
language math_language (string s)
language prog_language (string s)
string locale_to_language (string s)
string language_to_locale (string s)
string get_locale_language ()
string get_date (string lan, string fm)
string math_symbol_group (string s, string lan="std-math")
array< stringmath_group_members (string s, string lan="std-math")
string math_symbol_type (string s, string lan="std-math")

Variables

int succession_status_table [OP_TOTAL *OP_TOTAL]

Define Documentation

#define HYPH_INVALID   100000000

Definition at line 48 of file language.hpp.

#define HYPH_PANIC   1000000

Definition at line 47 of file language.hpp.

#define HYPH_STD   10000

Definition at line 46 of file language.hpp.

#define LIMITS_ALWAYS   2

Definition at line 70 of file language.hpp.

#define LIMITS_DISPLAY   1

Definition at line 69 of file language.hpp.

#define LIMITS_NONE   0

Definition at line 68 of file language.hpp.

#define OP_APPLY   10

Definition at line 60 of file language.hpp.

#define OP_BIG   15

Definition at line 65 of file language.hpp.

#define OP_BINARY   5

Definition at line 55 of file language.hpp.

#define OP_CLOSING_BRACKET   14

Definition at line 64 of file language.hpp.

#define OP_INFIX   9

Definition at line 59 of file language.hpp.

#define OP_MIDDLE_BRACKET   13

Definition at line 63 of file language.hpp.

#define OP_N_ARY   6

Definition at line 56 of file language.hpp.

#define OP_OPENING_BRACKET   12

Definition at line 62 of file language.hpp.

#define OP_POSTFIX   8

Definition at line 58 of file language.hpp.

#define OP_PREFIX   7

Definition at line 57 of file language.hpp.

#define OP_SEPARATOR   11

Definition at line 61 of file language.hpp.

#define OP_SKIP   2

Definition at line 52 of file language.hpp.

#define OP_SYMBOL   3

Definition at line 53 of file language.hpp.

#define OP_TEXT   1

Definition at line 51 of file language.hpp.

#define OP_TOTAL   16

Definition at line 66 of file language.hpp.

#define OP_UNARY   4

Definition at line 54 of file language.hpp.

#define OP_UNKNOWN   0

Definition at line 50 of file language.hpp.

#define REMOVE_ALL_SPACE   3

Definition at line 99 of file language.hpp.

#define REMOVE_CURRENT_SPACE   2

Definition at line 98 of file language.hpp.

#define REMOVE_SPACE_BEFORE   1

Definition at line 97 of file language.hpp.

#define SPC_BIGOP   7

Definition at line 44 of file language.hpp.

#define SPC_DSPACE   2

Definition at line 39 of file language.hpp.

#define SPC_HALF   5

Definition at line 42 of file language.hpp.

#define SPC_NONE   0

Definition at line 37 of file language.hpp.

#define SPC_OPERATOR   6

Definition at line 43 of file language.hpp.

#define SPC_PERIOD   3

Definition at line 40 of file language.hpp.

#define SPC_SPACE   1

Definition at line 38 of file language.hpp.

#define SPC_TINY   4

Definition at line 41 of file language.hpp.

#define SUCCESSION_OK   0

Definition at line 96 of file language.hpp.

#define TP_BLANK   4

Definition at line 31 of file language.hpp.

#define TP_DSPACE   3

Definition at line 30 of file language.hpp.

#define TP_HYPH   1

Definition at line 28 of file language.hpp.

#define TP_NORMAL   0

Definition at line 27 of file language.hpp.

#define TP_OPERATOR   6

Definition at line 33 of file language.hpp.

#define TP_OTHER   8

Definition at line 35 of file language.hpp.

#define TP_PERIOD   5

Definition at line 32 of file language.hpp.

#define TP_SHORTOP   7

Definition at line 34 of file language.hpp.

#define TP_SPACE   2

Definition at line 29 of file language.hpp.


Typedef Documentation

Definition at line 90 of file language.hpp.


Function Documentation

string get_date ( string  lan,
string  fm 
)

Definition at line 313 of file text_language.cpp.

                                 {
//#if defined(__MINGW__) || defined(__MINGW32__) || defined(OS_WIN32)
//  return win32::get_date(lan, fm);
  if (invalid_format (fm)) {
    if ((lan == "british") || (lan == "english") || (lan == "american"))
      fm= "%B %d, %Y";
    else if (lan == "german")
      fm= "%d. %B %Y";
    else if (lan == "chinese" || lan == "japanese" ||
            lan == "korean" || lan == "taiwanese")
      {
       string y= simplify_date (var_eval_system ("date +\"%Y\""));
       string m= simplify_date (var_eval_system ("date +\"%m\""));
       string d= simplify_date (var_eval_system ("date +\"%d\""));
       if (lan == "japanese")
         return y * "<#5e74>" * m * "<#6708>" * d * "<#65e5>";
       if (lan == "korean")
         return y * "<#b144> " * m * "<#c6d4> " * d * "<#c77c>";
       return y * "," * m * "," * d;
      }
    else fm= "%d %B %Y";
  }
  lan= language_to_locale (lan);
  string lvar= "LC_TIME";
  if (get_env (lvar) == "") lvar= "LC_ALL";
  if (get_env (lvar) == "") lvar= "LANG";
  string old= get_env (lvar);
  set_env (lvar, lan);
  string date= simplify_date (var_eval_system ("date +\"" * fm * "\""));
  if ((lan == "cz_CZ") || (lan == "hu_HU") || (lan == "pl_PL"))
    date= il2_to_cork (date);
  // if (lan == "ru_RU") date= iso_to_koi8 (date);
  set_env (lvar, old);
  return date;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 265 of file text_language.cpp.

                       {
#if defined(_WIN32) || defined(__WIN32__)
  return windows_locale_to_language (setlocale (LC_ALL, ""));
#else
  string env_lan= get_env ("LC_ALL");
  if (env_lan != "") return locale_to_language (env_lan);
  env_lan= get_env ("LC_MESSAGES");
  if (env_lan != "") return locale_to_language (env_lan);
  env_lan= get_env ("LANG");
  if (env_lan != "") return locale_to_language (env_lan);
  env_lan= get_env ("GDM_LANG");
  if (env_lan != "") return locale_to_language (env_lan);
  return "english";
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 236 of file text_language.cpp.

                              {
  if (s == "american") return "en_US";
  if (s == "british") return "en_GB";
  if (s == "bulgarian") return "bg_BG";
  if (s == "chinese") return "zh_CN";
  if (s == "czech") return "cs_CZ";
  if (s == "danish") return "da_DK";
  if (s == "dutch") return "nl_NL";
  if (s == "english") return "en_US";
  if (s == "finnish") return "fi_FI";
  if (s == "french") return "fr_FR";
  if (s == "german") return "de_DE";
  if (s == "hungarian") return "hu_HU";
  if (s == "italian") return "it_IT";
  if (s == "japanese") return "ja_JP";
  if (s == "korean") return "ko_KR";
  if (s == "polish") return "pl_PL";
  if (s == "portuguese") return "pt_PT";
  if (s == "romanian") return "ro_RO";
  if (s == "russian") return "ru_RU";
  if (s == "slovene") return "sl_SI";
  if (s == "spanish") return "es_ES";
  if (s == "swedish") return "sv_SV";
  if (s == "taiwanese") return "zh_TW";
  if (s == "ukrainian") return "uk_UA";
  return "en_US";
}

Here is the caller graph for this function:

Definition at line 206 of file text_language.cpp.

                              {
  if (N(s) > 5) s= s (0, 5);
  if (s == "en_GB") return "british";
  if (s == "zh_TW") return "taiwanese";
  if (N(s) > 2) s= s (0, 2);
  if (s == "bg") return "bulgarian";
  if (s == "zh") return "chinese";
  if (s == "cs") return "czech";
  if (s == "da") return "danish";
  if (s == "nl") return "dutch";
  if (s == "en") return "english";
  if (s == "fi") return "finnish";
  if (s == "fr") return "french";
  if (s == "de") return "german";
  if (s == "hu") return "hungarian";
  if (s == "it") return "italian";
  if (s == "ja") return "japanese";
  if (s == "ko") return "korean";
  if (s == "pl") return "polish";
  if (s == "pt") return "portuguese";
  if (s == "ro") return "romanian";
  if (s == "ru") return "russian";
  if (s == "sl") return "slovene";
  if (s == "es") return "spanish";
  if (s == "sv") return "swedish";
  if (s == "uk") return "ukrainian";
  return "english";
}

Here is the call graph for this function:

Here is the caller graph for this function:

array<string> math_group_members ( string  s,
string  lan = "std-math" 
)

Definition at line 285 of file math_language.cpp.

                                            {
  language lan= math_language (lang);
  return lan->get_members (gr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

language math_language ( string  s)

Definition at line 273 of file math_language.cpp.

                            {
  if (language::instances -> contains (name)) return language (name);
  return tm_new<math_language_rep> (name);
}

Here is the call graph for this function:

Here is the caller graph for this function:

string math_symbol_group ( string  s,
string  lan = "std-math" 
)

Definition at line 279 of file math_language.cpp.

                                            {
  language lan= math_language (lang);
  return lan->get_group (sym);
}

Here is the call graph for this function:

Here is the caller graph for this function:

string math_symbol_type ( string  s,
string  lan = "std-math" 
)

Definition at line 291 of file math_language.cpp.

                                           {
  int pos= 0;
  language lan= math_language (lang);
  text_property prop= lan->advance (tree (sym), pos);
  switch (prop->op_type) {
  case OP_UNKNOWN:
    return "unknown";
  case OP_SYMBOL:
    return "symbol";
  case OP_UNARY:
    return "unary";
  case OP_BINARY:
    return "binary";
  case OP_N_ARY:
    return "n-ary";
  case OP_PREFIX:
    return "prefix";
  case OP_POSTFIX:
    return "postfix";
  case OP_INFIX:
    return "infix";
  case OP_SEPARATOR:
    return "separator";
  case OP_OPENING_BRACKET:
    return "opening-bracket";
  case OP_MIDDLE_BRACKET:
    return "middle-bracket";
  case OP_CLOSING_BRACKET:
    return "closing-bracket";
  }
  return "unknown";
}

Here is the call graph for this function:

Here is the caller graph for this function:

language prog_language ( string  s)

Definition at line 78 of file verb_language.cpp.

                         {
  if (language::instances -> contains (s)) return language (s);
  if (s == "scheme")
    return make (language, s, tm_new<scheme_language_rep> (s));
  if (s == "mathemagix")
    return make (language, s, tm_new<mathemagix_language_rep> (s));
  if (s == "cpp")
    return make (language, s, tm_new<cpp_language_rep> (s));
  return make (language, s, tm_new<verb_language_rep> (s));
}

Here is the call graph for this function:

Here is the caller graph for this function:

RESOURCE ( language  )
int succession_status ( int  op1,
int  op2 
) [inline]

Definition at line 102 of file language.hpp.

                                                {
  return succession_status_table [op1 * OP_TOTAL + op2]; }

Here is the caller graph for this function:

language text_language ( string  s)

Definition at line 362 of file text_language.cpp.

                         {
  if (language::instances -> contains (s)) return language (s);
  if (s == "american") return make_text_language (s, "us");
  if (s == "british") return make_text_language (s, "ukenglish");
  if (s == "bulgarian") return make_text_language (s, "bulgarian");
  if (s == "chinese") return tm_new<oriental_language_rep> (s);
  if (s == "czech") return make_text_language (s, "czech");
  if (s == "danish") return make_text_language (s, "danish");
  if (s == "dutch") return make_text_language (s, "dutch");
  if (s == "english") return make_text_language (s, "us");
  if (s == "finnish") return make_text_language (s, "finnish");
  if (s == "french") return make_text_language (s, "french");
  if (s == "german") return make_text_language (s, "german");
  if (s == "hungarian") return make_text_language (s, "hungarian");
  if (s == "italian") return make_text_language (s, "italian");
  if (s == "japanese") return tm_new<oriental_language_rep> (s);
  if (s == "korean") return tm_new<oriental_language_rep> (s);
  if (s == "polish") return make_text_language (s, "polish");
  if (s == "portuguese") return make_text_language (s, "portuguese");
  if (s == "romanian") return make_text_language (s, "romanian");
  if (s == "russian") return make_text_language (s, "russian");
  if (s == "slovene") return make_text_language (s, "slovene");
  if (s == "spanish") return make_text_language (s, "spanish");
  if (s == "swedish") return make_text_language (s, "swedish");
  if (s == "taiwanese") return tm_new<oriental_language_rep> (s);
  if (s == "ukrainian") return make_text_language (s, "ukrainian");
  if (s == "verbatim") return tm_new<verb_language_rep> ("verbatim");
  cerr << "\nThe language was " << s << "\n";
  FAILED ("unknown language");
  return tm_new<verb_language_rep> ("verbatim");
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 67 of file language.cpp.