src/table/namegen.h
changeset 6574 e1d1a12faaf7
parent 6389 8abc1fd9269b
child 6719 4cc327ad39d5
child 6913 cc3f6bb84d6d
equal deleted inserted replaced
6573:7624f942237f 6574:e1d1a12faaf7
  1688 /* The tables and MakeCzechTownName() is (c) Petr Baudis 2005 (GPL'd)
  1688 /* The tables and MakeCzechTownName() is (c) Petr Baudis 2005 (GPL'd)
  1689  * Feel free to ask me about anything unclear or if you need help
  1689  * Feel free to ask me about anything unclear or if you need help
  1690  * with cloning this for your own language. */
  1690  * with cloning this for your own language. */
  1691 
  1691 
  1692 // Sing., pl.
  1692 // Sing., pl.
  1693 typedef enum CzechGender {
  1693 enum CzechGender {
  1694 	CZG_SMASC,
  1694 	CZG_SMASC,
  1695 	CZG_SFEM,
  1695 	CZG_SFEM,
  1696 	CZG_SNEUT,
  1696 	CZG_SNEUT,
  1697 	CZG_PMASC,
  1697 	CZG_PMASC,
  1698 	CZG_PFEM,
  1698 	CZG_PFEM,
  1699 	CZG_PNEUT,
  1699 	CZG_PNEUT,
  1700 	// Special for substantive stems - the ending chooses the gender.
  1700 	// Special for substantive stems - the ending chooses the gender.
  1701 	CZG_FREE,
  1701 	CZG_FREE,
  1702 	// Like CZG_FREE, but disallow CZG_SNEUT.
  1702 	// Like CZG_FREE, but disallow CZG_SNEUT.
  1703 	CZG_NFREE
  1703 	CZG_NFREE
  1704 } CzechGender;
  1704 };
  1705 typedef enum CzechPattern {
  1705 
       
  1706 enum CzechPattern {
  1706 	CZP_JARNI,
  1707 	CZP_JARNI,
  1707 	CZP_MLADY,
  1708 	CZP_MLADY,
  1708 	CZP_PRIVL
  1709 	CZP_PRIVL
  1709 } CzechPattern;
  1710 };
       
  1711 
  1710 /* [CzechGender][CzechPattern] - replaces the last character of the adjective
  1712 /* [CzechGender][CzechPattern] - replaces the last character of the adjective
  1711  * by this. */
  1713  * by this. */
  1712 // XXX: [CZG_SMASC][CZP_PRIVL] needs special handling: -ovX -> -uv.
  1714 // XXX: [CZG_SMASC][CZP_PRIVL] needs special handling: -ovX -> -uv.
  1713 static const char *name_czech_patmod[][3] = {
  1715 static const char *name_czech_patmod[][3] = {
  1714 	/* CZG_SMASC */ { "í", "ý", "X" },
  1716 	/* CZG_SMASC */ { "í", "ý", "X" },
  1719 	/* CZG_PNEUT */ { "í", "á", "a" }
  1721 	/* CZG_PNEUT */ { "í", "á", "a" }
  1720 };
  1722 };
  1721 
  1723 
  1722 // This way the substantives can choose only some adjectives/endings:
  1724 // This way the substantives can choose only some adjectives/endings:
  1723 // At least one of these flags must be satisfied:
  1725 // At least one of these flags must be satisfied:
  1724 typedef enum CzechAllow {
  1726 enum CzechAllow {
  1725 	CZA_SHORT = 1,
  1727 	CZA_SHORT = 1,
  1726 	CZA_MIDDLE = 2,
  1728 	CZA_MIDDLE = 2,
  1727 	CZA_LONG = 4,
  1729 	CZA_LONG = 4,
  1728 	CZA_ALL = ~0
  1730 	CZA_ALL = ~0
  1729 } CzechAllow;
  1731 };
  1730 
  1732 
  1731 DECLARE_ENUM_AS_BIT_SET(CzechAllow);
  1733 DECLARE_ENUM_AS_BIT_SET(CzechAllow);
  1732 
  1734 
  1733 // All these flags must be satisfied (in the stem->others direction):
  1735 // All these flags must be satisfied (in the stem->others direction):
  1734 typedef enum CzechChoose {
  1736 enum CzechChoose {
  1735 	CZC_NONE = 0, // No requirements.
  1737 	CZC_NONE = 0, // No requirements.
  1736 	CZC_COLOR = 1,
  1738 	CZC_COLOR = 1,
  1737 	CZC_POSTFIX = 2, // Matched if postfix was inserted.
  1739 	CZC_POSTFIX = 2, // Matched if postfix was inserted.
  1738 	CZC_NOPOSTFIX = 4, // Matched if no postfix was inserted.
  1740 	CZC_NOPOSTFIX = 4, // Matched if no postfix was inserted.
  1739 	CZC_ANY = ~0
  1741 	CZC_ANY = ~0
  1740 } CzechChoose;
  1742 };
  1741 
  1743 
  1742 DECLARE_ENUM_AS_BIT_SET(CzechChoose);
  1744 DECLARE_ENUM_AS_BIT_SET(CzechChoose);
  1743 
  1745 
  1744 typedef struct CzechNameSubst {
  1746 struct CzechNameSubst {
  1745 	CzechGender gender;
  1747 	CzechGender gender;
  1746 	CzechAllow allow;
  1748 	CzechAllow allow;
  1747 	CzechChoose choose;
  1749 	CzechChoose choose;
  1748 	const char *name;
  1750 	const char *name;
  1749 } CzechNameSubst;
  1751 };
  1750 
  1752 
  1751 typedef struct CzechNameAdj {
  1753 struct CzechNameAdj {
  1752 	CzechPattern pattern;
  1754 	CzechPattern pattern;
  1753 	CzechChoose choose;
  1755 	CzechChoose choose;
  1754 	const char *name;
  1756 	const char *name;
  1755 } CzechNameAdj;
  1757 };
  1756 
  1758 
  1757 // Some of items which should be common are doubled.
  1759 // Some of items which should be common are doubled.
  1758 static const CzechNameAdj name_czech_adj[] = {
  1760 static const CzechNameAdj name_czech_adj[] = {
  1759 	{ CZP_JARNI, CZC_ANY, "Horní" },
  1761 	{ CZP_JARNI, CZC_ANY, "Horní" },
  1760 	{ CZP_JARNI, CZC_ANY, "Horní" },
  1762 	{ CZP_JARNI, CZC_ANY, "Horní" },