3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
14 #include "support/counter_reps.h"
15 #include "support/docstring.h"
16 #include "support/lstrings.h"
22 char loweralphaCounter(int const n)
30 char alphaCounter(int const n)
38 char hebrewCounter(int const n)
40 static const char hebrew[22] = {
41 '\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8',
42 '\xe9', '\xeb', '\xec', '\xee', '\xf0', '\xf1', '\xf2', '\xf4', '\xf6',
43 '\xf7', '\xf8', '\xf9', '\xfa'
52 // On the special cases, see http://mathworld.wolfram.com/RomanNumerals.html
53 // and for a list of roman numerals up to and including 3999, see
54 // http://www.research.att.com/~njas/sequences/a006968.txt. (Thanks to Joost
56 docstring const romanCounter(int const n)
58 static char const * const ones[9] = {
59 "I", "II", "III", "IV", "V",
60 "VI", "VII", "VIII", "IX"
63 static char const * const tens[9] = {
64 "X", "XX", "XXX", "XL", "L",
65 "LX", "LXX", "LXXX", "XC"
68 static char const * const hunds[9] = {
69 "C", "CC", "CCC", "CD", "D",
70 "DC", "DCC", "DCCC", "CM"
73 if (n >= 1000 || n < 1)
74 return from_ascii("??");
88 int hundreds = val / 100;
89 roman = hunds[hundreds - 1];
100 int tensnum = val / 10;
101 roman = roman + tens[tensnum - 1];
106 roman = roman + ones[val -1];
108 return from_ascii(roman);
112 docstring const lowerromanCounter(int const n)
114 return support::lowercase(romanCounter(n));
118 docstring const fnsymbolCounter(int const n)
121 case 1: return docstring(1, 0x002a); //*
122 case 2: return docstring(1, 0x2020); // dagger
123 case 3: return docstring(1, 0x2021); // double dagger
124 case 4: return docstring(1, 0x00A7); // section sign
125 case 5: return docstring(1, 0x00B6); // pilcrow sign
126 case 6: return docstring(1, 0x2016); // vertical bar
127 case 7: return docstring(2, 0x002a); // two *
128 case 8: return docstring(2, 0x2020); // two daggers
129 case 9: return docstring(2, 0x2021); // two double daggers
131 return from_ascii("?");